autoprefixer 10.4.13 → 10.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +4 -4
  2. package/data/prefixes.js +187 -183
  3. package/lib/autoprefixer.js +16 -16
  4. package/lib/browsers.js +13 -13
  5. package/lib/declaration.js +92 -92
  6. package/lib/hacks/align-content.js +9 -9
  7. package/lib/hacks/align-items.js +7 -7
  8. package/lib/hacks/align-self.js +7 -7
  9. package/lib/hacks/block-logical.js +10 -10
  10. package/lib/hacks/border-radius.js +7 -7
  11. package/lib/hacks/break-props.js +16 -16
  12. package/lib/hacks/display-flex.js +9 -9
  13. package/lib/hacks/flex-direction.js +7 -7
  14. package/lib/hacks/flex.js +7 -7
  15. package/lib/hacks/gradient.js +259 -259
  16. package/lib/hacks/grid-column-align.js +6 -6
  17. package/lib/hacks/grid-row-align.js +6 -6
  18. package/lib/hacks/grid-rows-columns.js +23 -23
  19. package/lib/hacks/grid-template-areas.js +12 -12
  20. package/lib/hacks/grid-template.js +9 -9
  21. package/lib/hacks/grid-utils.js +26 -26
  22. package/lib/hacks/image-rendering.js +14 -14
  23. package/lib/hacks/inline-logical.js +6 -6
  24. package/lib/hacks/intrinsic.js +17 -17
  25. package/lib/hacks/justify-content.js +9 -9
  26. package/lib/hacks/mask-composite.js +2 -2
  27. package/lib/hacks/order.js +7 -7
  28. package/lib/hacks/overscroll-behavior.js +6 -6
  29. package/lib/hacks/pixelated.js +10 -10
  30. package/lib/hacks/print-color-adjust.js +7 -7
  31. package/lib/hacks/transform-decl.js +25 -25
  32. package/lib/hacks/user-select.js +10 -10
  33. package/lib/hacks/writing-mode.js +4 -4
  34. package/lib/info.js +6 -6
  35. package/lib/old-selector.js +16 -16
  36. package/lib/prefixer.js +20 -20
  37. package/lib/prefixes.js +124 -124
  38. package/lib/processor.js +159 -159
  39. package/lib/resolution.js +17 -17
  40. package/lib/selector.js +67 -67
  41. package/lib/supports.js +167 -167
  42. package/lib/transition.js +118 -118
  43. package/lib/value.js +26 -26
  44. package/package.json +7 -3
@@ -1,20 +1,6 @@
1
1
  let Declaration = require('../declaration')
2
2
 
3
3
  class TransformDecl extends Declaration {
4
- /**
5
- * Recursively check all parents for @keyframes
6
- */
7
- keyframeParents(decl) {
8
- let { parent } = decl
9
- while (parent) {
10
- if (parent.type === 'atrule' && parent.name === 'keyframes') {
11
- return true
12
- }
13
- ;({ parent } = parent)
14
- }
15
- return false
16
- }
17
-
18
4
  /**
19
5
  * Is transform contain 3D commands
20
6
  */
@@ -32,17 +18,6 @@ class TransformDecl extends Declaration {
32
18
  return false
33
19
  }
34
20
 
35
- /**
36
- * Replace rotateZ to rotate for IE 9
37
- */
38
- set(decl, prefix) {
39
- decl = super.set(decl, prefix)
40
- if (prefix === '-ms-') {
41
- decl.value = decl.value.replace(/rotatez/gi, 'rotate')
42
- }
43
- return decl
44
- }
45
-
46
21
  /**
47
22
  * Don't add prefix for IE in keyframes
48
23
  */
@@ -60,6 +35,31 @@ class TransformDecl extends Declaration {
60
35
  }
61
36
  return undefined
62
37
  }
38
+
39
+ /**
40
+ * Recursively check all parents for @keyframes
41
+ */
42
+ keyframeParents(decl) {
43
+ let { parent } = decl
44
+ while (parent) {
45
+ if (parent.type === 'atrule' && parent.name === 'keyframes') {
46
+ return true
47
+ }
48
+ ;({ parent } = parent)
49
+ }
50
+ return false
51
+ }
52
+
53
+ /**
54
+ * Replace rotateZ to rotate for IE 9
55
+ */
56
+ set(decl, prefix) {
57
+ decl = super.set(decl, prefix)
58
+ if (prefix === '-ms-') {
59
+ decl.value = decl.value.replace(/rotatez/gi, 'rotate')
60
+ }
61
+ return decl
62
+ }
63
63
  }
64
64
 
65
65
  TransformDecl.names = ['transform', 'transform-origin']
@@ -1,16 +1,6 @@
1
1
  let Declaration = require('../declaration')
2
2
 
3
3
  class UserSelect extends Declaration {
4
- /**
5
- * Change prefixed value for IE
6
- */
7
- set(decl, prefix) {
8
- if (prefix === '-ms-' && decl.value === 'contain') {
9
- decl.value = 'element'
10
- }
11
- return super.set(decl, prefix)
12
- }
13
-
14
4
  /**
15
5
  * Avoid prefixing all in IE
16
6
  */
@@ -21,6 +11,16 @@ class UserSelect extends Declaration {
21
11
  return super.insert(decl, prefix, prefixes)
22
12
  }
23
13
  }
14
+
15
+ /**
16
+ * Change prefixed value for IE
17
+ */
18
+ set(decl, prefix) {
19
+ if (prefix === '-ms-' && decl.value === 'contain') {
20
+ decl.value = 'element'
21
+ }
22
+ return super.set(decl, prefix)
23
+ }
24
24
  }
25
25
 
26
26
  UserSelect.names = ['user-select']
@@ -29,13 +29,13 @@ WritingMode.names = ['writing-mode']
29
29
  WritingMode.msValues = {
30
30
  ltr: {
31
31
  'horizontal-tb': 'lr-tb',
32
- 'vertical-rl': 'tb-rl',
33
- 'vertical-lr': 'tb-lr'
32
+ 'vertical-lr': 'tb-lr',
33
+ 'vertical-rl': 'tb-rl'
34
34
  },
35
35
  rtl: {
36
36
  'horizontal-tb': 'rl-tb',
37
- 'vertical-rl': 'bt-rl',
38
- 'vertical-lr': 'bt-lr'
37
+ 'vertical-lr': 'bt-lr',
38
+ 'vertical-rl': 'bt-rl'
39
39
  }
40
40
  }
41
41
 
package/lib/info.js CHANGED
@@ -5,17 +5,17 @@ function capitalize(str) {
5
5
  }
6
6
 
7
7
  const NAMES = {
8
+ and_chr: 'Chrome for Android',
9
+ and_ff: 'Firefox for Android',
10
+ and_qq: 'QQ Browser',
11
+ and_uc: 'UC for Android',
12
+ baidu: 'Baidu Browser',
8
13
  ie: 'IE',
9
14
  ie_mob: 'IE Mobile',
10
15
  ios_saf: 'iOS Safari',
16
+ kaios: 'KaiOS Browser',
11
17
  op_mini: 'Opera Mini',
12
18
  op_mob: 'Opera Mobile',
13
- and_chr: 'Chrome for Android',
14
- and_ff: 'Firefox for Android',
15
- and_uc: 'UC for Android',
16
- and_qq: 'QQ Browser',
17
- kaios: 'KaiOS Browser',
18
- baidu: 'Baidu Browser',
19
19
  samsung: 'Samsung Internet'
20
20
  }
21
21
 
@@ -12,6 +12,22 @@ class OldSelector {
12
12
  this.nameRegexp = selector.regexp()
13
13
  }
14
14
 
15
+ /**
16
+ * Does rule contain an unnecessary prefixed selector
17
+ */
18
+ check(rule) {
19
+ if (!rule.selector.includes(this.prefixed)) {
20
+ return false
21
+ }
22
+ if (!rule.selector.match(this.regexp)) {
23
+ return false
24
+ }
25
+ if (this.isHack(rule)) {
26
+ return false
27
+ }
28
+ return true
29
+ }
30
+
15
31
  /**
16
32
  * Is rule a hack without unprefixed version bottom
17
33
  */
@@ -46,22 +62,6 @@ class OldSelector {
46
62
 
47
63
  return true
48
64
  }
49
-
50
- /**
51
- * Does rule contain an unnecessary prefixed selector
52
- */
53
- check(rule) {
54
- if (!rule.selector.includes(this.prefixed)) {
55
- return false
56
- }
57
- if (!rule.selector.match(this.regexp)) {
58
- return false
59
- }
60
- if (this.isHack(rule)) {
61
- return false
62
- }
63
- return true
64
- }
65
65
  }
66
66
 
67
67
  module.exports = OldSelector
package/lib/prefixer.js CHANGED
@@ -34,6 +34,23 @@ function clone(obj, parent) {
34
34
  }
35
35
 
36
36
  class Prefixer {
37
+ constructor(name, prefixes, all) {
38
+ this.prefixes = prefixes
39
+ this.name = name
40
+ this.all = all
41
+ }
42
+
43
+ /**
44
+ * Clone node and clean autprefixer custom caches
45
+ */
46
+ static clone(node, overrides) {
47
+ let cloned = clone(node)
48
+ for (let name in overrides) {
49
+ cloned[name] = overrides[name]
50
+ }
51
+ return cloned
52
+ }
53
+
37
54
  /**
38
55
  * Add hack to selected names
39
56
  */
@@ -60,20 +77,10 @@ class Prefixer {
60
77
  }
61
78
 
62
79
  /**
63
- * Clone node and clean autprefixer custom caches
80
+ * Shortcut for Prefixer.clone
64
81
  */
65
- static clone(node, overrides) {
66
- let cloned = clone(node)
67
- for (let name in overrides) {
68
- cloned[name] = overrides[name]
69
- }
70
- return cloned
71
- }
72
-
73
- constructor(name, prefixes, all) {
74
- this.prefixes = prefixes
75
- this.name = name
76
- this.all = all
82
+ clone(node, overrides) {
83
+ return Prefixer.clone(node, overrides)
77
84
  }
78
85
 
79
86
  /**
@@ -132,13 +139,6 @@ class Prefixer {
132
139
 
133
140
  return added
134
141
  }
135
-
136
- /**
137
- * Shortcut for Prefixer.clone
138
- */
139
- clone(node, overrides) {
140
- return Prefixer.clone(node, overrides)
141
- }
142
142
  }
143
143
 
144
144
  module.exports = Prefixer
package/lib/prefixes.js CHANGED
@@ -156,76 +156,77 @@ class Prefixes {
156
156
  }
157
157
 
158
158
  /**
159
- * Select prefixes from data, which is necessary for selected browsers
159
+ * Declaration loader with caching
160
160
  */
161
- select(list) {
162
- let selected = { add: {}, remove: {} }
161
+ decl(prop) {
162
+ if (!declsCache.has(prop)) {
163
+ declsCache.set(prop, Declaration.load(prop))
164
+ }
163
165
 
164
- for (let name in list) {
165
- let data = list[name]
166
- let add = data.browsers.map(i => {
167
- let params = i.split(' ')
168
- return {
169
- browser: `${params[0]} ${params[1]}`,
170
- note: params[2]
171
- }
172
- })
166
+ return declsCache.get(prop)
167
+ }
173
168
 
174
- let notes = add
175
- .filter(i => i.note)
176
- .map(i => `${this.browsers.prefix(i.browser)} ${i.note}`)
177
- notes = utils.uniq(notes)
169
+ /**
170
+ * Group declaration by unprefixed property to check them
171
+ */
172
+ group(decl) {
173
+ let rule = decl.parent
174
+ let index = rule.index(decl)
175
+ let { length } = rule.nodes
176
+ let unprefixed = this.unprefixed(decl.prop)
178
177
 
179
- add = add
180
- .filter(i => this.browsers.isSelected(i.browser))
181
- .map(i => {
182
- let prefix = this.browsers.prefix(i.browser)
183
- if (i.note) {
184
- return `${prefix} ${i.note}`
185
- } else {
186
- return prefix
178
+ let checker = (step, callback) => {
179
+ index += step
180
+ while (index >= 0 && index < length) {
181
+ let other = rule.nodes[index]
182
+ if (other.type === 'decl') {
183
+ if (step === -1 && other.prop === unprefixed) {
184
+ if (!Browsers.withPrefix(other.value)) {
185
+ break
186
+ }
187
187
  }
188
- })
189
- add = this.sort(utils.uniq(add))
190
-
191
- if (this.options.flexbox === 'no-2009') {
192
- add = add.filter(i => !i.includes('2009'))
193
- }
194
188
 
195
- let all = data.browsers.map(i => this.browsers.prefix(i))
196
- if (data.mistakes) {
197
- all = all.concat(data.mistakes)
198
- }
199
- all = all.concat(notes)
200
- all = utils.uniq(all)
189
+ if (this.unprefixed(other.prop) !== unprefixed) {
190
+ break
191
+ } else if (callback(other) === true) {
192
+ return true
193
+ }
201
194
 
202
- if (add.length) {
203
- selected.add[name] = add
204
- if (add.length < all.length) {
205
- selected.remove[name] = all.filter(i => !add.includes(i))
195
+ if (step === +1 && other.prop === unprefixed) {
196
+ if (!Browsers.withPrefix(other.value)) {
197
+ break
198
+ }
199
+ }
206
200
  }
207
- } else {
208
- selected.remove[name] = all
201
+
202
+ index += step
209
203
  }
204
+ return false
210
205
  }
211
206
 
212
- return selected
207
+ return {
208
+ down(callback) {
209
+ return checker(+1, callback)
210
+ },
211
+ up(callback) {
212
+ return checker(-1, callback)
213
+ }
214
+ }
213
215
  }
214
216
 
215
217
  /**
216
- * Sort vendor prefixes
218
+ * Normalize prefix for remover
217
219
  */
218
- sort(prefixes) {
219
- return prefixes.sort((a, b) => {
220
- let aLength = utils.removeNote(a).length
221
- let bLength = utils.removeNote(b).length
220
+ normalize(prop) {
221
+ return this.decl(prop).normalize(prop)
222
+ }
222
223
 
223
- if (aLength === bLength) {
224
- return b.length - a.length
225
- } else {
226
- return bLength - aLength
227
- }
228
- })
224
+ /**
225
+ * Return prefixed version of property
226
+ */
227
+ prefixed(prop, prefix) {
228
+ prop = vendor.unprefixed(prop)
229
+ return this.decl(prop).prefixed(prop, prefix)
229
230
  }
230
231
 
231
232
  /**
@@ -233,8 +234,8 @@ class Prefixes {
233
234
  */
234
235
  preprocess(selected) {
235
236
  let add = {
236
- 'selectors': [],
237
- '@supports': new Supports(Prefixes, this)
237
+ '@supports': new Supports(Prefixes, this),
238
+ 'selectors': []
238
239
  }
239
240
  for (let name in selected.add) {
240
241
  let prefixes = selected.add[name]
@@ -324,14 +325,76 @@ class Prefixes {
324
325
  }
325
326
 
326
327
  /**
327
- * Declaration loader with caching
328
+ * Select prefixes from data, which is necessary for selected browsers
328
329
  */
329
- decl(prop) {
330
- if (!declsCache.has(prop)) {
331
- declsCache.set(prop, Declaration.load(prop))
330
+ select(list) {
331
+ let selected = { add: {}, remove: {} }
332
+
333
+ for (let name in list) {
334
+ let data = list[name]
335
+ let add = data.browsers.map(i => {
336
+ let params = i.split(' ')
337
+ return {
338
+ browser: `${params[0]} ${params[1]}`,
339
+ note: params[2]
340
+ }
341
+ })
342
+
343
+ let notes = add
344
+ .filter(i => i.note)
345
+ .map(i => `${this.browsers.prefix(i.browser)} ${i.note}`)
346
+ notes = utils.uniq(notes)
347
+
348
+ add = add
349
+ .filter(i => this.browsers.isSelected(i.browser))
350
+ .map(i => {
351
+ let prefix = this.browsers.prefix(i.browser)
352
+ if (i.note) {
353
+ return `${prefix} ${i.note}`
354
+ } else {
355
+ return prefix
356
+ }
357
+ })
358
+ add = this.sort(utils.uniq(add))
359
+
360
+ if (this.options.flexbox === 'no-2009') {
361
+ add = add.filter(i => !i.includes('2009'))
362
+ }
363
+
364
+ let all = data.browsers.map(i => this.browsers.prefix(i))
365
+ if (data.mistakes) {
366
+ all = all.concat(data.mistakes)
367
+ }
368
+ all = all.concat(notes)
369
+ all = utils.uniq(all)
370
+
371
+ if (add.length) {
372
+ selected.add[name] = add
373
+ if (add.length < all.length) {
374
+ selected.remove[name] = all.filter(i => !add.includes(i))
375
+ }
376
+ } else {
377
+ selected.remove[name] = all
378
+ }
332
379
  }
333
380
 
334
- return declsCache.get(prop)
381
+ return selected
382
+ }
383
+
384
+ /**
385
+ * Sort vendor prefixes
386
+ */
387
+ sort(prefixes) {
388
+ return prefixes.sort((a, b) => {
389
+ let aLength = utils.removeNote(a).length
390
+ let bLength = utils.removeNote(b).length
391
+
392
+ if (aLength === bLength) {
393
+ return b.length - a.length
394
+ } else {
395
+ return bLength - aLength
396
+ }
397
+ })
335
398
  }
336
399
 
337
400
  /**
@@ -345,21 +408,6 @@ class Prefixes {
345
408
  return value
346
409
  }
347
410
 
348
- /**
349
- * Normalize prefix for remover
350
- */
351
- normalize(prop) {
352
- return this.decl(prop).normalize(prop)
353
- }
354
-
355
- /**
356
- * Return prefixed version of property
357
- */
358
- prefixed(prop, prefix) {
359
- prop = vendor.unprefixed(prop)
360
- return this.decl(prop).prefixed(prop, prefix)
361
- }
362
-
363
411
  /**
364
412
  * Return values, which must be prefixed in selected property
365
413
  */
@@ -375,54 +423,6 @@ class Prefixes {
375
423
  return global || values || []
376
424
  }
377
425
  }
378
-
379
- /**
380
- * Group declaration by unprefixed property to check them
381
- */
382
- group(decl) {
383
- let rule = decl.parent
384
- let index = rule.index(decl)
385
- let { length } = rule.nodes
386
- let unprefixed = this.unprefixed(decl.prop)
387
-
388
- let checker = (step, callback) => {
389
- index += step
390
- while (index >= 0 && index < length) {
391
- let other = rule.nodes[index]
392
- if (other.type === 'decl') {
393
- if (step === -1 && other.prop === unprefixed) {
394
- if (!Browsers.withPrefix(other.value)) {
395
- break
396
- }
397
- }
398
-
399
- if (this.unprefixed(other.prop) !== unprefixed) {
400
- break
401
- } else if (callback(other) === true) {
402
- return true
403
- }
404
-
405
- if (step === +1 && other.prop === unprefixed) {
406
- if (!Browsers.withPrefix(other.value)) {
407
- break
408
- }
409
- }
410
- }
411
-
412
- index += step
413
- }
414
- return false
415
- }
416
-
417
- return {
418
- up(callback) {
419
- return checker(-1, callback)
420
- },
421
- down(callback) {
422
- return checker(+1, callback)
423
- }
424
- }
425
- }
426
426
  }
427
427
 
428
428
  module.exports = Prefixes