UNPKG

8.89 kBJavaScriptView Raw
1var list = require('postcss/lib/list')
2var pats = {
3 attrcc: '[^\\~|^$*\\]]*',
4 brackets: /(\[[^\]]*\]|\([^\)]*\))/.source,
5 nobrackets: /[^\[\]\(\)]/.source
6}
7function matchOutsideOfBrackets (pat) {
8 if (pat instanceof RegExp) {
9 pat = pat.source
10 }
11 return new RegExp('^(' + pats.brackets + '?' + pats.nobrackets + '*)*' + pat)
12}
13
14module.exports = {
15 'border-radius': {
16 properties: [
17 'border-radius',
18 'border-top-left-radius',
19 'border-top-right-radius',
20 'border-bottom-right-radius',
21 'border-bottom-left-radius'
22 ]
23 },
24 'css-boxshadow': { properties: ['box-shadow'] },
25 'css-animation': {
26 properties: [
27 'animation',
28 'animation-name',
29 'animation-duration',
30 'animation-delay',
31 'animation-direction',
32 'animation-fill-mode',
33 'animation-iteration-count',
34 'animation-play-state',
35 'animation-timing-function',
36 '@keyframes'
37 ]
38 },
39 'css-transitions': {
40 properties: [
41 'transition',
42 'transition-property',
43 'transition-duration',
44 'transition-delay',
45 'transition-timing-function'
46 ]
47 },
48 transforms2d: {
49 properties: [
50 'transform',
51 'transform-origin'
52 ]
53 },
54 transforms3d: {
55 properties: [
56 'perspective',
57 'perspective-origin',
58 'transform-style',
59 'backface-visibility'
60 ]
61 },
62 'css-gradients': {
63 properties: [
64 'background',
65 'background-image',
66 'border-image'
67 ],
68 values: [
69 /(^|[^-])linear-gradient/,
70 /(^|[^-])radial-gradient/
71 ]
72 },
73 'css3-boxsizing': { properties: ['box-sizing'] },
74 'css-filters': { properties: ['filter'] },
75 multicolumn: {
76 properties: [
77 'columns',
78 'column-width',
79 'column-gap',
80 'column-rule',
81 'column-rule-color',
82 'column-rule-width',
83 'column-count',
84 'column-rule-style',
85 'column-span',
86 'column-fill',
87 'break-before',
88 'break-after',
89 'break-inside'
90 ]
91 },
92 'user-select-none': { properties: ['user-select'] },
93 flexbox: {
94 properties: ['display'],
95 values: [
96 'display-flex',
97 'inline-flex',
98 'flex',
99 'flex-grow',
100 'flex-shrink',
101 'flex-basis',
102 'flex-direction',
103 'flex-wrap',
104 'flex-flow',
105 'justify-content',
106 'order',
107 'align-items',
108 'align-self',
109 'align-content'
110 ]
111 },
112 calc: {
113 values: ['calc'],
114 properties: ['']
115 },
116 'background-img-opts': {
117 properties: [
118 'background-clip',
119 'background-origin',
120 'background-size'
121 ]
122 },
123 'font-feature': {
124 properties: [
125 'font-feature-settings',
126 'font-variant-ligatures',
127 'font-language-override',
128 'font-kerning'
129 ]
130 },
131 'border-image': { properties: ['border-image'] },
132 'css-selection': {
133 properties: ['::selection'],
134 selector: true
135 },
136 'css-placeholder': {
137 properties: ['::placeholder'],
138 selector: true
139 },
140 'css-hyphens': { properties: ['hyphens'] },
141 fullscreen: {
142 properties: [':fullscreen'],
143 selector: true
144 },
145 'css3-tabsize': { properties: ['tab-size'] },
146 'intrinsic-width': {
147 properties: [
148 'width',
149 'min-width',
150 'max-width',
151 'height',
152 'min-height',
153 'max-height'
154 ],
155 values: [
156 'max-content',
157 'min-content',
158 'fit-content',
159 'fill-available'
160 ]
161 },
162 'css3-cursors-newer': {
163 properties: ['cursor'],
164 values: [
165 'zoom-in',
166 'zoom-out',
167 'grab',
168 'grabbing'
169 ]
170 },
171 'css-sticky': {
172 properties: ['position'],
173 values: ['sticky']
174 },
175 pointer: { properties: ['touch-action'] },
176 'text-decoration': {
177 properties: [
178 'text-decoration-style',
179 'text-decoration-line',
180 'text-decoration-color'
181 ]
182 },
183 'text-size-adjust': { properties: ['text-size-adjust'] },
184 'css-masks': {
185 properties: [
186 'clip-path',
187 'mask',
188 'mask-clip',
189 'mask-composite',
190 'mask-image',
191 'mask-origin',
192 'mask-position',
193 'mask-repeat',
194 'mask-size'
195 ]
196 },
197 fontface: { atrules: ['font-face'] },
198 multibackgrounds: {
199 properties: [/^background-?/],
200 values: [function (value) {
201 return list.comma(value).length > 1
202 }]
203 },
204 'css-table': {
205 properties: ['display'],
206 values: [
207 'table',
208 'table-cell',
209 'table-row',
210 'table-layout'
211 ]
212 },
213 'css-gencontent': {
214 selectors: [
215 ':before',
216 ':after'
217 ]
218 },
219 'css-fixed': {
220 properties: ['position'],
221 values: ['fixed']
222 },
223 'css-sel2': {
224 selectors: [
225 matchOutsideOfBrackets(/\*/),
226 matchOutsideOfBrackets(/>/),
227 matchOutsideOfBrackets(/\+/),
228 matchOutsideOfBrackets(/\./),
229 matchOutsideOfBrackets(/#/),
230 ':first-child',
231 ':link',
232 ':visited',
233 ':active',
234 ':hover',
235 ':focus',
236 ':lang',
237 new RegExp('\\[' + pats.attrcc + '\\]'),
238 new RegExp('\\[' + pats.attrcc + '=' + pats.attrcc + '\\]'),
239 new RegExp('\\[' + pats.attrcc + '\\~=' + pats.attrcc + '\\]'),
240 new RegExp('\\[' + pats.attrcc + '\\|=' + pats.attrcc + '\\]')
241 ]
242 },
243 'css-sel3': {
244 selectors: [
245 new RegExp('\\[' + pats.attrcc + '\\^=' + pats.attrcc + '\\]'),
246 new RegExp('\\[' + pats.attrcc + '\\$=' + pats.attrcc + '\\]'),
247 new RegExp('\\[' + pats.attrcc + '\\*=' + pats.attrcc + '\\]'),
248 ':root',
249 ':nth-child',
250 ':nth-last-child',
251 'nth-of-type',
252 'nth-last-of-type',
253 ':last-child',
254 ':first-of-type',
255 ':last-of-type',
256 ':only-child',
257 ':only-of-type',
258 ':empty',
259 ':target',
260 ':enabled',
261 ':disabled',
262 ':checked',
263 ':not',
264 /^[^\[]*~/
265 ]
266 },
267 'css-textshadow': { properties: ['text-shadow'] },
268 'css3-colors': {
269 properties: [''],
270 values: [
271 'rgba',
272 'hsl',
273 'hsla'
274 ]
275 },
276 'css-mediaqueries': { atrules: ['media'] },
277 'css-canvas': {
278 properties: [/^background/],
279 values: [/^-webkit-canvas/]
280 },
281 'css-reflections': { properties: ['box-reflect'] },
282 'svg-css': { unimplemented: true },
283 'css-featurequeries': { atrules: ['supports'] },
284 'css-opacity': { properties: ['opacity'] },
285 'text-overflow': { properties: ['text-overflow'] },
286 wordwrap: { properties: ['overflow-wrap'] },
287 'object-fit': { properties: ['object-fit'] },
288 minmaxwh: {
289 properties: [
290 'min-width',
291 'max-width',
292 'min-height',
293 'max-height'
294 ]
295 },
296 'text-stroke': { unimplemented: true },
297 'inline-block': {
298 properties: ['display'],
299 values: ['inline-block']
300 },
301 'css-grid': { unimplemented: true },
302 rem: {
303 properties: [''],
304 values: ['rem']
305 },
306 ttf: { unimplemented: true },
307 'pointer-events': { properties: ['pointer-events'] },
308 'css-regions': { unimplemented: true },
309 'css-counters': {
310 properties: [
311 'counter-reset',
312 'counter-increment'
313 ]
314 },
315 'css-resize': { properties: ['resize'] },
316 'css-repeating-gradients': {
317 properties: [''],
318 values: [
319 'repeating-linear-gradient',
320 'repeating-radial-gradient'
321 ]
322 },
323 'word-break': { properties: ['word-break'] },
324 'viewport-units': {
325 properties: [''],
326 values: [
327 'vw',
328 'vh',
329 'vmin',
330 'vmax'
331 ]
332 },
333 outline: {
334 properties: [
335 'outline',
336 'outline-style',
337 'outline-width',
338 'outline-color'
339 ]
340 },
341 'css3-cursors': {
342 properties: ['cursor'],
343 values: [
344 'none',
345 'context-menu',
346 'cell',
347 'vertical-text',
348 'alias',
349 'copy',
350 'no-drop',
351 'not-allowed',
352 'nesw-resize',
353 'nwse-resize',
354 'col-resize',
355 'row-resize',
356 'all-scroll'
357 ]
358 },
359 'css-variables': { unimplemented: true },
360 'css-backgroundblendmode': { properties: ['background-blend-mode'] },
361 'css-mixblendmode': { properties: ['mix-blend-mode'] },
362 'will-change': { properties: ['will-change'] },
363 'css-shapes': {
364 properties: [
365 'shape-outside',
366 'shape-image-threshold',
367 'shape-margin'
368 ]
369 },
370 'kerning-pairs-ligatures': {
371 properties: ['text-rendering'],
372 values: ['optimizeLegibility']
373 },
374 'css-image-orientation': { properties: ['image-orientation'] },
375 'css-appearance': { properties: ['appearance'] },
376 'css-background-offsets': { unimplemented: true },
377 'css-touch-action': { properties: ['touch-action'] },
378 'css-clip-path': { properties: ['clip-path'] },
379 'font-unicode-range': {
380 properties: ['unicode-range']
381 },
382 'css-font-stretch': { properties: ['font-stretch'] },
383 'font-size-adjust': { properties: ['font-size-adjust'] },
384 'css-media-resolution': {
385 atrules: ['media'],
386 params: [
387 'min-resolution',
388 'max-resolution'
389 ]
390 },
391 'css-image-set': {
392 properties: [''],
393 values: ['image-set']
394 }
395}