properties.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. 'use strict';
  2. const acceptCustomIdentsProperties = new Set([
  3. 'animation',
  4. 'animation-name',
  5. 'font',
  6. 'font-family',
  7. 'counter-increment',
  8. 'grid-row',
  9. 'grid-column',
  10. 'grid-area',
  11. 'list-style',
  12. 'list-style-type',
  13. ]);
  14. /** @type {import('stylelint').LonghandSubPropertiesOfShorthandProperties} */
  15. const longhandSubPropertiesOfShorthandProperties = new Map([
  16. // Sort alphabetically
  17. [
  18. 'animation',
  19. new Set([
  20. // prettier-ignore
  21. 'animation-name',
  22. 'animation-duration',
  23. 'animation-timing-function',
  24. 'animation-delay',
  25. 'animation-iteration-count',
  26. 'animation-direction',
  27. 'animation-fill-mode',
  28. 'animation-play-state',
  29. ]),
  30. ],
  31. [
  32. 'background',
  33. new Set([
  34. // prettier-ignore
  35. 'background-image',
  36. 'background-size',
  37. 'background-position',
  38. 'background-repeat',
  39. 'background-origin',
  40. 'background-clip',
  41. 'background-attachment',
  42. 'background-color',
  43. ]),
  44. ],
  45. [
  46. 'border',
  47. new Set([
  48. // prettier-ignore
  49. 'border-top-width',
  50. 'border-right-width',
  51. 'border-bottom-width',
  52. 'border-left-width',
  53. 'border-top-style',
  54. 'border-right-style',
  55. 'border-bottom-style',
  56. 'border-left-style',
  57. 'border-top-color',
  58. 'border-right-color',
  59. 'border-bottom-color',
  60. 'border-left-color',
  61. ]),
  62. ],
  63. [
  64. 'border-block-end',
  65. new Set([
  66. // prettier-ignore
  67. 'border-block-end-width',
  68. 'border-block-end-style',
  69. 'border-block-end-color',
  70. ]),
  71. ],
  72. [
  73. 'border-block-start',
  74. new Set([
  75. // prettier-ignore
  76. 'border-block-start-width',
  77. 'border-block-start-style',
  78. 'border-block-start-color',
  79. ]),
  80. ],
  81. [
  82. 'border-bottom',
  83. new Set([
  84. // prettier-ignore
  85. 'border-bottom-width',
  86. 'border-bottom-style',
  87. 'border-bottom-color',
  88. ]),
  89. ],
  90. [
  91. 'border-color',
  92. new Set([
  93. // prettier-ignore
  94. 'border-top-color',
  95. 'border-right-color',
  96. 'border-bottom-color',
  97. 'border-left-color',
  98. ]),
  99. ],
  100. [
  101. 'border-image',
  102. new Set([
  103. // prettier-ignore
  104. 'border-image-source',
  105. 'border-image-slice',
  106. 'border-image-width',
  107. 'border-image-outset',
  108. 'border-image-repeat',
  109. ]),
  110. ],
  111. [
  112. 'border-inline-end',
  113. new Set([
  114. // prettier-ignore
  115. 'border-inline-end-width',
  116. 'border-inline-end-style',
  117. 'border-inline-end-color',
  118. ]),
  119. ],
  120. [
  121. 'border-inline-start',
  122. new Set([
  123. // prettier-ignore
  124. 'border-inline-start-width',
  125. 'border-inline-start-style',
  126. 'border-inline-start-color',
  127. ]),
  128. ],
  129. [
  130. 'border-left',
  131. new Set([
  132. // prettier-ignore
  133. 'border-left-width',
  134. 'border-left-style',
  135. 'border-left-color',
  136. ]),
  137. ],
  138. [
  139. 'border-radius',
  140. new Set([
  141. // prettier-ignore
  142. 'border-top-right-radius',
  143. 'border-top-left-radius',
  144. 'border-bottom-right-radius',
  145. 'border-bottom-left-radius',
  146. ]),
  147. ],
  148. [
  149. 'border-right',
  150. new Set([
  151. // prettier-ignore
  152. 'border-right-width',
  153. 'border-right-style',
  154. 'border-right-color',
  155. ]),
  156. ],
  157. [
  158. 'border-style',
  159. new Set([
  160. // prettier-ignore
  161. 'border-top-style',
  162. 'border-right-style',
  163. 'border-bottom-style',
  164. 'border-left-style',
  165. ]),
  166. ],
  167. [
  168. 'border-top',
  169. new Set([
  170. // prettier-ignore
  171. 'border-top-width',
  172. 'border-top-style',
  173. 'border-top-color',
  174. ]),
  175. ],
  176. [
  177. 'border-width',
  178. new Set([
  179. // prettier-ignore
  180. 'border-top-width',
  181. 'border-bottom-width',
  182. 'border-left-width',
  183. 'border-right-width',
  184. ]),
  185. ],
  186. [
  187. 'column-rule',
  188. new Set([
  189. // prettier-ignore
  190. 'column-rule-width',
  191. 'column-rule-style',
  192. 'column-rule-color',
  193. ]),
  194. ],
  195. [
  196. 'columns',
  197. new Set([
  198. // prettier-ignore
  199. 'column-width',
  200. 'column-count',
  201. ]),
  202. ],
  203. [
  204. 'flex',
  205. new Set([
  206. // prettier-ignore
  207. 'flex-grow',
  208. 'flex-shrink',
  209. 'flex-basis',
  210. ]),
  211. ],
  212. [
  213. 'flex-flow',
  214. new Set([
  215. // prettier-ignore
  216. 'flex-direction',
  217. 'flex-wrap',
  218. ]),
  219. ],
  220. [
  221. 'font',
  222. new Set([
  223. // prettier-ignore
  224. 'font-style',
  225. 'font-variant',
  226. 'font-weight',
  227. 'font-stretch',
  228. 'font-size',
  229. 'line-height',
  230. 'font-family',
  231. ]),
  232. ],
  233. [
  234. 'grid',
  235. new Set([
  236. // prettier-ignore
  237. 'grid-template-rows',
  238. 'grid-template-columns',
  239. 'grid-template-areas',
  240. 'grid-auto-rows',
  241. 'grid-auto-columns',
  242. 'grid-auto-flow',
  243. 'grid-column-gap',
  244. 'grid-row-gap',
  245. ]),
  246. ],
  247. [
  248. 'grid-area',
  249. new Set([
  250. // prettier-ignore
  251. 'grid-row-start',
  252. 'grid-column-start',
  253. 'grid-row-end',
  254. 'grid-column-end',
  255. ]),
  256. ],
  257. [
  258. 'grid-column',
  259. new Set([
  260. // prettier-ignore
  261. 'grid-column-start',
  262. 'grid-column-end',
  263. ]),
  264. ],
  265. [
  266. 'grid-gap',
  267. new Set([
  268. // prettier-ignore
  269. 'grid-row-gap',
  270. 'grid-column-gap',
  271. ]),
  272. ],
  273. [
  274. 'grid-row',
  275. new Set([
  276. // prettier-ignore
  277. 'grid-row-start',
  278. 'grid-row-end',
  279. ]),
  280. ],
  281. [
  282. 'grid-template',
  283. new Set([
  284. // prettier-ignore
  285. 'grid-template-columns',
  286. 'grid-template-rows',
  287. 'grid-template-areas',
  288. ]),
  289. ],
  290. [
  291. 'inset',
  292. new Set([
  293. // prettier-ignore
  294. 'top',
  295. 'right',
  296. 'bottom',
  297. 'left',
  298. ]),
  299. ],
  300. [
  301. 'list-style',
  302. new Set([
  303. // prettier-ignore
  304. 'list-style-type',
  305. 'list-style-position',
  306. 'list-style-image',
  307. ]),
  308. ],
  309. [
  310. 'margin',
  311. new Set([
  312. // prettier-ignore
  313. 'margin-top',
  314. 'margin-right',
  315. 'margin-bottom',
  316. 'margin-left',
  317. ]),
  318. ],
  319. [
  320. 'mask',
  321. new Set([
  322. // prettier-ignore
  323. 'mask-image',
  324. 'mask-mode',
  325. 'mask-position',
  326. 'mask-size',
  327. 'mask-repeat',
  328. 'mask-origin',
  329. 'mask-clip',
  330. 'mask-composite',
  331. ]),
  332. ],
  333. [
  334. 'outline',
  335. new Set([
  336. // prettier-ignore
  337. 'outline-color',
  338. 'outline-style',
  339. 'outline-width',
  340. ]),
  341. ],
  342. [
  343. 'padding',
  344. new Set([
  345. // prettier-ignore
  346. 'padding-top',
  347. 'padding-right',
  348. 'padding-bottom',
  349. 'padding-left',
  350. ]),
  351. ],
  352. [
  353. 'text-decoration',
  354. new Set([
  355. // prettier-ignore
  356. 'text-decoration-line',
  357. 'text-decoration-style',
  358. 'text-decoration-color',
  359. // TODO: add support for text-decoration-thickness, Level 4
  360. // https://w3c.github.io/csswg-drafts/css-text-decor-4/#text-decoration-width-property
  361. ]),
  362. ],
  363. [
  364. 'text-emphasis',
  365. new Set([
  366. // prettier-ignore
  367. 'text-emphasis-style',
  368. 'text-emphasis-color',
  369. ]),
  370. ],
  371. [
  372. 'transition',
  373. new Set([
  374. // prettier-ignore
  375. 'transition-property',
  376. 'transition-duration',
  377. 'transition-timing-function',
  378. 'transition-delay',
  379. ]),
  380. ],
  381. ]);
  382. const longhandTimeProperties = new Set([
  383. 'transition-duration',
  384. 'transition-delay',
  385. 'animation-duration',
  386. 'animation-delay',
  387. ]);
  388. const shorthandTimeProperties = new Set(['transition', 'animation']);
  389. module.exports = {
  390. acceptCustomIdentsProperties,
  391. longhandSubPropertiesOfShorthandProperties,
  392. longhandTimeProperties,
  393. shorthandTimeProperties,
  394. };