properties.js 6.0 KB

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