autoprefixer 10.2.2 → 10.2.6

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 (79) hide show
  1. package/README.md +3 -3
  2. package/data/prefixes.js +187 -91
  3. package/lib/at-rule.js +2 -2
  4. package/lib/autoprefixer.d.ts +3 -3
  5. package/lib/autoprefixer.js +28 -18
  6. package/lib/brackets.js +3 -3
  7. package/lib/browsers.js +6 -6
  8. package/lib/declaration.js +14 -14
  9. package/lib/hacks/align-content.js +3 -3
  10. package/lib/hacks/align-items.js +3 -3
  11. package/lib/hacks/align-self.js +4 -4
  12. package/lib/hacks/animation.js +1 -1
  13. package/lib/hacks/appearance.js +1 -1
  14. package/lib/hacks/backdrop-filter.js +1 -1
  15. package/lib/hacks/background-clip.js +2 -2
  16. package/lib/hacks/background-size.js +1 -1
  17. package/lib/hacks/block-logical.js +2 -2
  18. package/lib/hacks/border-image.js +1 -1
  19. package/lib/hacks/border-radius.js +2 -2
  20. package/lib/hacks/break-props.js +4 -4
  21. package/lib/hacks/color-adjust.js +2 -2
  22. package/lib/hacks/cross-fade.js +1 -1
  23. package/lib/hacks/display-flex.js +5 -5
  24. package/lib/hacks/display-grid.js +2 -2
  25. package/lib/hacks/filter-value.js +1 -1
  26. package/lib/hacks/filter.js +1 -1
  27. package/lib/hacks/flex-basis.js +3 -3
  28. package/lib/hacks/flex-direction.js +3 -3
  29. package/lib/hacks/flex-flow.js +1 -1
  30. package/lib/hacks/flex-grow.js +2 -2
  31. package/lib/hacks/flex-shrink.js +3 -3
  32. package/lib/hacks/flex-wrap.js +1 -1
  33. package/lib/hacks/flex.js +3 -3
  34. package/lib/hacks/fullscreen.js +1 -1
  35. package/lib/hacks/gradient.js +18 -18
  36. package/lib/hacks/grid-area.js +1 -1
  37. package/lib/hacks/grid-column-align.js +3 -3
  38. package/lib/hacks/grid-end.js +1 -1
  39. package/lib/hacks/grid-row-align.js +3 -3
  40. package/lib/hacks/grid-row-column.js +1 -1
  41. package/lib/hacks/grid-rows-columns.js +3 -3
  42. package/lib/hacks/grid-start.js +3 -3
  43. package/lib/hacks/grid-template-areas.js +2 -2
  44. package/lib/hacks/grid-template.js +1 -1
  45. package/lib/hacks/grid-utils.js +60 -48
  46. package/lib/hacks/image-rendering.js +5 -5
  47. package/lib/hacks/image-set.js +1 -1
  48. package/lib/hacks/inline-logical.js +2 -2
  49. package/lib/hacks/intrinsic.js +6 -6
  50. package/lib/hacks/justify-content.js +3 -3
  51. package/lib/hacks/mask-border.js +2 -2
  52. package/lib/hacks/mask-composite.js +1 -1
  53. package/lib/hacks/order.js +3 -3
  54. package/lib/hacks/overscroll-behavior.js +3 -3
  55. package/lib/hacks/pixelated.js +2 -2
  56. package/lib/hacks/place-self.js +1 -1
  57. package/lib/hacks/placeholder-shown.js +1 -1
  58. package/lib/hacks/placeholder.js +2 -2
  59. package/lib/hacks/text-decoration-skip-ink.js +1 -1
  60. package/lib/hacks/text-decoration.js +1 -1
  61. package/lib/hacks/text-emphasis-position.js +1 -1
  62. package/lib/hacks/transform-decl.js +4 -4
  63. package/lib/hacks/user-select.js +2 -2
  64. package/lib/hacks/writing-mode.js +1 -1
  65. package/lib/info.js +8 -4
  66. package/lib/old-selector.js +3 -3
  67. package/lib/old-value.js +2 -2
  68. package/lib/prefixer.js +13 -9
  69. package/lib/prefixes.js +124 -68
  70. package/lib/processor.js +14 -14
  71. package/lib/resolution.js +6 -6
  72. package/lib/selector.js +10 -10
  73. package/lib/supports.js +28 -20
  74. package/lib/transition.js +15 -15
  75. package/lib/utils.js +65 -67
  76. package/lib/value.js +7 -7
  77. package/lib/vendor.js +2 -2
  78. package/package.json +5 -5
  79. package/CHANGELOG.md +0 -1019
package/lib/supports.js CHANGED
@@ -21,7 +21,7 @@ for (let browser in data.stats) {
21
21
  }
22
22
 
23
23
  class Supports {
24
- constructor (Prefixes, all) {
24
+ constructor(Prefixes, all) {
25
25
  this.Prefixes = Prefixes
26
26
  this.all = all
27
27
  }
@@ -29,7 +29,7 @@ class Supports {
29
29
  /**
30
30
  * Return prefixer only with @supports supported browsers
31
31
  */
32
- prefixer () {
32
+ prefixer() {
33
33
  if (this.prefixerCache) {
34
34
  return this.prefixerCache
35
35
  }
@@ -54,7 +54,7 @@ class Supports {
54
54
  /**
55
55
  * Parse string into declaration property and value
56
56
  */
57
- parse (str) {
57
+ parse(str) {
58
58
  let parts = str.split(':')
59
59
  let prop = parts[0]
60
60
  let value = parts[1]
@@ -65,7 +65,7 @@ class Supports {
65
65
  /**
66
66
  * Create virtual rule to process it by prefixer
67
67
  */
68
- virtual (str) {
68
+ virtual(str) {
69
69
  let [prop, value] = this.parse(str)
70
70
  let rule = parse('a{}').first
71
71
  rule.append({ prop, value, raws: { before: '' } })
@@ -75,7 +75,7 @@ class Supports {
75
75
  /**
76
76
  * Return array of Declaration with all necessary prefixes
77
77
  */
78
- prefixed (str) {
78
+ prefixed(str) {
79
79
  let rule = this.virtual(str)
80
80
  if (this.disabled(rule.first)) {
81
81
  return rule.nodes
@@ -99,21 +99,21 @@ class Supports {
99
99
  /**
100
100
  * Return true if brackets node is "not" word
101
101
  */
102
- isNot (node) {
102
+ isNot(node) {
103
103
  return typeof node === 'string' && /not\s*/i.test(node)
104
104
  }
105
105
 
106
106
  /**
107
107
  * Return true if brackets node is "or" word
108
108
  */
109
- isOr (node) {
109
+ isOr(node) {
110
110
  return typeof node === 'string' && /\s*or\s*/i.test(node)
111
111
  }
112
112
 
113
113
  /**
114
114
  * Return true if brackets node is (prop: value)
115
115
  */
116
- isProp (node) {
116
+ isProp(node) {
117
117
  return (
118
118
  typeof node === 'object' &&
119
119
  node.length === 1 &&
@@ -124,7 +124,7 @@ class Supports {
124
124
  /**
125
125
  * Return true if prefixed property has no unprefixed
126
126
  */
127
- isHack (all, unprefixed) {
127
+ isHack(all, unprefixed) {
128
128
  let check = new RegExp(`(\\(|\\s)${utils.escapeRegexp(unprefixed)}:`)
129
129
  return !check.test(all)
130
130
  }
@@ -132,7 +132,7 @@ class Supports {
132
132
  /**
133
133
  * Return true if we need to remove node
134
134
  */
135
- toRemove (str, all) {
135
+ toRemove(str, all) {
136
136
  let [prop, value] = this.parse(str)
137
137
  let unprefixed = this.all.unprefixed(prop)
138
138
 
@@ -158,7 +158,7 @@ class Supports {
158
158
  /**
159
159
  * Remove all unnecessary prefixes
160
160
  */
161
- remove (nodes, all) {
161
+ remove(nodes, all) {
162
162
  let i = 0
163
163
  while (i < nodes.length) {
164
164
  if (
@@ -187,7 +187,7 @@ class Supports {
187
187
  /**
188
188
  * Clean brackets with one child
189
189
  */
190
- cleanBrackets (nodes) {
190
+ cleanBrackets(nodes) {
191
191
  return nodes.map(i => {
192
192
  if (typeof i !== 'object') {
193
193
  return i
@@ -204,7 +204,7 @@ class Supports {
204
204
  /**
205
205
  * Add " or " between properties and convert it to brackets format
206
206
  */
207
- convert (progress) {
207
+ convert(progress) {
208
208
  let result = ['']
209
209
  for (let i of progress) {
210
210
  result.push([`${i.prop}: ${i.value}`])
@@ -217,23 +217,31 @@ class Supports {
217
217
  /**
218
218
  * Compress value functions into a string nodes
219
219
  */
220
- normalize (nodes) {
220
+ normalize(nodes) {
221
221
  if (typeof nodes !== 'object') {
222
222
  return nodes
223
223
  }
224
224
 
225
225
  nodes = nodes.filter(i => i !== '')
226
- if (typeof nodes[0] === 'string' && nodes[0].includes(':')) {
227
- return [brackets.stringify(nodes)]
228
- }
229
226
 
227
+ if (typeof nodes[0] === 'string') {
228
+ let firstNode = nodes[0].trim()
229
+
230
+ if (
231
+ firstNode.includes(':') ||
232
+ firstNode === 'selector' ||
233
+ firstNode === 'not selector'
234
+ ) {
235
+ return [brackets.stringify(nodes)]
236
+ }
237
+ }
230
238
  return nodes.map(i => this.normalize(i))
231
239
  }
232
240
 
233
241
  /**
234
242
  * Add prefixes
235
243
  */
236
- add (nodes, all) {
244
+ add(nodes, all) {
237
245
  return nodes.map(i => {
238
246
  if (this.isProp(i)) {
239
247
  let prefixed = this.prefixed(i[0])
@@ -255,7 +263,7 @@ class Supports {
255
263
  /**
256
264
  * Add prefixed declaration
257
265
  */
258
- process (rule) {
266
+ process(rule) {
259
267
  let ast = brackets.parse(rule.params)
260
268
  ast = this.normalize(ast)
261
269
  ast = this.remove(ast, rule.params)
@@ -267,7 +275,7 @@ class Supports {
267
275
  /**
268
276
  * Check global options
269
277
  */
270
- disabled (node) {
278
+ disabled(node) {
271
279
  if (!this.all.options.grid) {
272
280
  if (node.prop === 'display' && node.value.includes('grid')) {
273
281
  return true
package/lib/transition.js CHANGED
@@ -5,7 +5,7 @@ let Browsers = require('./browsers')
5
5
  let vendor = require('./vendor')
6
6
 
7
7
  class Transition {
8
- constructor (prefixes) {
8
+ constructor(prefixes) {
9
9
  this.props = ['transition', 'transition-property']
10
10
  this.prefixes = prefixes
11
11
  }
@@ -13,7 +13,7 @@ class Transition {
13
13
  /**
14
14
  * Process transition and add prefixes for all necessary properties
15
15
  */
16
- add (decl, result) {
16
+ add(decl, result) {
17
17
  let prefix, prop
18
18
  let add = this.prefixes.add[decl.prop]
19
19
  let vendorPrefixes = this.ruleVendorPrefixes(decl)
@@ -82,7 +82,7 @@ class Transition {
82
82
  /**
83
83
  * Find property name
84
84
  */
85
- findProp (param) {
85
+ findProp(param) {
86
86
  let prop = param[0].value
87
87
  if (/^\d/.test(prop)) {
88
88
  for (let [i, token] of param.entries()) {
@@ -97,14 +97,14 @@ class Transition {
97
97
  /**
98
98
  * Does we already have this declaration
99
99
  */
100
- already (decl, prop, value) {
100
+ already(decl, prop, value) {
101
101
  return decl.parent.some(i => i.prop === prop && i.value === value)
102
102
  }
103
103
 
104
104
  /**
105
105
  * Add declaration if it is not exist
106
106
  */
107
- cloneBefore (decl, prop, value) {
107
+ cloneBefore(decl, prop, value) {
108
108
  if (!this.already(decl, prop, value)) {
109
109
  decl.cloneBefore({ prop, value })
110
110
  }
@@ -113,7 +113,7 @@ class Transition {
113
113
  /**
114
114
  * Show transition-property warning
115
115
  */
116
- checkForWarning (result, decl) {
116
+ checkForWarning(result, decl) {
117
117
  if (decl.prop !== 'transition-property') {
118
118
  return
119
119
  }
@@ -158,7 +158,7 @@ class Transition {
158
158
  /**
159
159
  * Process transition and remove all unnecessary properties
160
160
  */
161
- remove (decl) {
161
+ remove(decl) {
162
162
  let params = this.parse(decl.value)
163
163
  params = params.filter(i => {
164
164
  let prop = this.prefixes.remove[this.findProp(i)]
@@ -193,7 +193,7 @@ class Transition {
193
193
  /**
194
194
  * Parse properties list to array
195
195
  */
196
- parse (value) {
196
+ parse(value) {
197
197
  let ast = parser(value)
198
198
  let result = []
199
199
  let param = []
@@ -211,7 +211,7 @@ class Transition {
211
211
  /**
212
212
  * Return properties string from array
213
213
  */
214
- stringify (params) {
214
+ stringify(params) {
215
215
  if (params.length === 0) {
216
216
  return ''
217
217
  }
@@ -234,7 +234,7 @@ class Transition {
234
234
  /**
235
235
  * Return new param array with different name
236
236
  */
237
- clone (origin, name, param) {
237
+ clone(origin, name, param) {
238
238
  let result = []
239
239
  let changed = false
240
240
  for (let i of param) {
@@ -251,7 +251,7 @@ class Transition {
251
251
  /**
252
252
  * Find or create separator
253
253
  */
254
- div (params) {
254
+ div(params) {
255
255
  for (let param of params) {
256
256
  for (let node of param) {
257
257
  if (node.type === 'div' && node.value === ',') {
@@ -262,7 +262,7 @@ class Transition {
262
262
  return { type: 'div', value: ',', after: ' ' }
263
263
  }
264
264
 
265
- cleanOtherPrefixes (params, prefix) {
265
+ cleanOtherPrefixes(params, prefix) {
266
266
  return params.filter(param => {
267
267
  let current = vendor.prefix(this.findProp(param))
268
268
  return current === '' || current === prefix
@@ -272,7 +272,7 @@ class Transition {
272
272
  /**
273
273
  * Remove all non-webkit prefixes and unprefixed params if we have prefixed
274
274
  */
275
- cleanFromUnprefixed (params, prefix) {
275
+ cleanFromUnprefixed(params, prefix) {
276
276
  let remove = params
277
277
  .map(i => this.findProp(i))
278
278
  .filter(i => i.slice(0, prefix.length) === prefix)
@@ -292,7 +292,7 @@ class Transition {
292
292
  /**
293
293
  * Check property for disabled by option
294
294
  */
295
- disabled (prop, prefix) {
295
+ disabled(prop, prefix) {
296
296
  let other = ['order', 'justify-content', 'align-self', 'align-content']
297
297
  if (prop.includes('flex') || other.includes(prop)) {
298
298
  if (this.prefixes.options.flexbox === false) {
@@ -309,7 +309,7 @@ class Transition {
309
309
  /**
310
310
  * Check if transition prop is inside vendor specific rule
311
311
  */
312
- ruleVendorPrefixes (decl) {
312
+ ruleVendorPrefixes(decl) {
313
313
  let { parent } = decl
314
314
 
315
315
  if (parent.type !== 'rule') {
package/lib/utils.js CHANGED
@@ -1,80 +1,78 @@
1
1
  let { list } = require('postcss')
2
2
 
3
- module.exports = {
4
- /**
5
- * Throw special error, to tell beniary,
6
- * that this error is from Autoprefixer.
7
- */
8
- error (text) {
9
- let err = new Error(text)
10
- err.autoprefixer = true
11
- throw err
12
- },
3
+ /**
4
+ * Throw special error, to tell beniary,
5
+ * that this error is from Autoprefixer.
6
+ */
7
+ module.exports.error = function (text) {
8
+ let err = new Error(text)
9
+ err.autoprefixer = true
10
+ throw err
11
+ }
13
12
 
14
- /**
15
- * Return array, that doesn’t contain duplicates.
16
- */
17
- uniq (array) {
18
- return [...new Set(array)]
19
- },
13
+ /**
14
+ * Return array, that doesn’t contain duplicates.
15
+ */
16
+ module.exports.uniq = function (array) {
17
+ return [...new Set(array)]
18
+ }
20
19
 
21
- /**
22
- * Return "-webkit-" on "-webkit- old"
23
- */
24
- removeNote (string) {
25
- if (!string.includes(' ')) {
26
- return string
27
- }
20
+ /**
21
+ * Return "-webkit-" on "-webkit- old"
22
+ */
23
+ module.exports.removeNote = function (string) {
24
+ if (!string.includes(' ')) {
25
+ return string
26
+ }
28
27
 
29
- return string.split(' ')[0]
30
- },
28
+ return string.split(' ')[0]
29
+ }
31
30
 
32
- /**
33
- * Escape RegExp symbols
34
- */
35
- escapeRegexp (string) {
36
- return string.replace(/[$()*+-.?[\\\]^{|}]/g, '\\$&')
37
- },
31
+ /**
32
+ * Escape RegExp symbols
33
+ */
34
+ module.exports.escapeRegexp = function (string) {
35
+ return string.replace(/[$()*+-.?[\\\]^{|}]/g, '\\$&')
36
+ }
38
37
 
39
- /**
40
- * Return regexp to check, that CSS string contain word
41
- */
42
- regexp (word, escape = true) {
43
- if (escape) {
44
- word = this.escapeRegexp(word)
45
- }
46
- return new RegExp(`(^|[\\s,(])(${word}($|[\\s(,]))`, 'gi')
47
- },
38
+ /**
39
+ * Return regexp to check, that CSS string contain word
40
+ */
41
+ module.exports.regexp = function (word, escape = true) {
42
+ if (escape) {
43
+ word = this.escapeRegexp(word)
44
+ }
45
+ return new RegExp(`(^|[\\s,(])(${word}($|[\\s(,]))`, 'gi')
46
+ }
48
47
 
49
- /**
50
- * Change comma list
51
- */
52
- editList (value, callback) {
53
- let origin = list.comma(value)
54
- let changed = callback(origin, [])
48
+ /**
49
+ * Change comma list
50
+ */
51
+ module.exports.editList = function (value, callback) {
52
+ let origin = list.comma(value)
53
+ let changed = callback(origin, [])
55
54
 
56
- if (origin === changed) {
57
- return value
58
- }
55
+ if (origin === changed) {
56
+ return value
57
+ }
59
58
 
60
- let join = value.match(/,\s*/)
61
- join = join ? join[0] : ', '
62
- return changed.join(join)
63
- },
59
+ let join = value.match(/,\s*/)
60
+ join = join ? join[0] : ', '
61
+ return changed.join(join)
62
+ }
64
63
 
65
- /**
66
- * Split the selector into parts.
67
- * It returns 3 level deep array because selectors can be comma
68
- * separated (1), space separated (2), and combined (3)
69
- * @param {String} selector selector string
70
- * @return {Array<Array<Array>>} 3 level deep array of split selector
71
- * @see utils.test.js for examples
72
- */
73
- splitSelector (selector) {
74
- return list.comma(selector).map(i => {
75
- return list.space(i).map(k => {
76
- return k.split(/(?=\.|#)/g)
77
- })
64
+ /**
65
+ * Split the selector into parts.
66
+ * It returns 3 level deep array because selectors can be comma
67
+ * separated (1), space separated (2), and combined (3)
68
+ * @param {String} selector selector string
69
+ * @return {Array<Array<Array>>} 3 level deep array of split selector
70
+ * @see utils.test.js for examples
71
+ */
72
+ module.exports.splitSelector = function (selector) {
73
+ return list.comma(selector).map(i => {
74
+ return list.space(i).map(k => {
75
+ return k.split(/(?=\.|#)/g)
78
76
  })
79
- }
77
+ })
80
78
  }
package/lib/value.js CHANGED
@@ -7,7 +7,7 @@ class Value extends Prefixer {
7
7
  /**
8
8
  * Clone decl for each prefixed values
9
9
  */
10
- static save (prefixes, decl) {
10
+ static save(prefixes, decl) {
11
11
  let prop = decl.prop
12
12
  let result = []
13
13
 
@@ -61,7 +61,7 @@ class Value extends Prefixer {
61
61
  /**
62
62
  * Is declaration need to be prefixed
63
63
  */
64
- check (decl) {
64
+ check(decl) {
65
65
  let value = decl.value
66
66
  if (!value.includes(this.name)) {
67
67
  return false
@@ -73,21 +73,21 @@ class Value extends Prefixer {
73
73
  /**
74
74
  * Lazy regexp loading
75
75
  */
76
- regexp () {
76
+ regexp() {
77
77
  return this.regexpCache || (this.regexpCache = utils.regexp(this.name))
78
78
  }
79
79
 
80
80
  /**
81
81
  * Add prefix to values in string
82
82
  */
83
- replace (string, prefix) {
83
+ replace(string, prefix) {
84
84
  return string.replace(this.regexp(), `$1${prefix}$2`)
85
85
  }
86
86
 
87
87
  /**
88
88
  * Get value with comments if it was not changed
89
89
  */
90
- value (decl) {
90
+ value(decl) {
91
91
  if (decl.raws.value && decl.raws.value.value === decl.value) {
92
92
  return decl.raws.value.raw
93
93
  } else {
@@ -98,7 +98,7 @@ class Value extends Prefixer {
98
98
  /**
99
99
  * Save values with next prefixed token
100
100
  */
101
- add (decl, prefix) {
101
+ add(decl, prefix) {
102
102
  if (!decl._autoprefixerValues) {
103
103
  decl._autoprefixerValues = {}
104
104
  }
@@ -117,7 +117,7 @@ class Value extends Prefixer {
117
117
  /**
118
118
  * Return function to fast find prefixed value
119
119
  */
120
- old (prefix) {
120
+ old(prefix) {
121
121
  return new OldValue(this.name, prefix + this.name)
122
122
  }
123
123
  }
package/lib/vendor.js CHANGED
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- prefix (prop) {
2
+ prefix(prop) {
3
3
  let match = prop.match(/^(-\w+-)/)
4
4
  if (match) {
5
5
  return match[0]
@@ -8,7 +8,7 @@ module.exports = {
8
8
  return ''
9
9
  },
10
10
 
11
- unprefixed (prop) {
11
+ unprefixed(prop) {
12
12
  return prop.replace(/^-\w+-/, '')
13
13
  }
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoprefixer",
3
- "version": "10.2.2",
3
+ "version": "10.2.6",
4
4
  "description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
5
5
  "engines": {
6
6
  "node": "^10 || ^12 || >=14"
@@ -26,10 +26,10 @@
26
26
  "postcss": "^8.1.0"
27
27
  },
28
28
  "dependencies": {
29
- "browserslist": "^4.16.1",
30
- "caniuse-lite": "^1.0.30001178",
31
- "colorette": "^1.2.1",
32
- "fraction.js": "^4.0.13",
29
+ "browserslist": "^4.16.6",
30
+ "caniuse-lite": "^1.0.30001230",
31
+ "colorette": "^1.2.2",
32
+ "fraction.js": "^4.1.1",
33
33
  "normalize-range": "^0.1.2",
34
34
  "postcss-value-parser": "^4.1.0"
35
35
  },