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,31 +1,14 @@
1
1
  let Declaration = require('../declaration')
2
2
  let {
3
- prefixTrackProp,
4
- prefixTrackValue,
5
3
  autoplaceGridItems,
6
4
  getGridGap,
7
- inheritGridGap
5
+ inheritGridGap,
6
+ prefixTrackProp,
7
+ prefixTrackValue
8
8
  } = require('./grid-utils')
9
9
  let Processor = require('../processor')
10
10
 
11
11
  class GridRowsColumns extends Declaration {
12
- /**
13
- * Change property name for IE
14
- */
15
- prefixed(prop, prefix) {
16
- if (prefix === '-ms-') {
17
- return prefixTrackProp({ prop, prefix })
18
- }
19
- return super.prefixed(prop, prefix)
20
- }
21
-
22
- /**
23
- * Change IE property back
24
- */
25
- normalize(prop) {
26
- return prop.replace(/^grid-(rows|columns)/, 'grid-template-$1')
27
- }
28
-
29
12
  insert(decl, prefix, prefixes, result) {
30
13
  if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
31
14
 
@@ -56,15 +39,15 @@ class GridRowsColumns extends Declaration {
56
39
  }
57
40
 
58
41
  let prefixValue = prefixTrackValue({
59
- value,
60
- gap: gapValue
42
+ gap: gapValue,
43
+ value
61
44
  })
62
45
 
63
46
  /**
64
47
  * Insert prefixes
65
48
  */
66
49
  decl.cloneBefore({
67
- prop: prefixTrackProp({ prop, prefix }),
50
+ prop: prefixTrackProp({ prefix, prop }),
68
51
  value: prefixValue
69
52
  })
70
53
 
@@ -113,6 +96,23 @@ class GridRowsColumns extends Declaration {
113
96
 
114
97
  return undefined
115
98
  }
99
+
100
+ /**
101
+ * Change IE property back
102
+ */
103
+ normalize(prop) {
104
+ return prop.replace(/^grid-(rows|columns)/, 'grid-template-$1')
105
+ }
106
+
107
+ /**
108
+ * Change property name for IE
109
+ */
110
+ prefixed(prop, prefix) {
111
+ if (prefix === '-ms-') {
112
+ return prefixTrackProp({ prefix, prop })
113
+ }
114
+ return super.prefixed(prop, prefix)
115
+ }
116
116
  }
117
117
 
118
118
  GridRowsColumns.names = [
@@ -1,12 +1,12 @@
1
1
  let Declaration = require('../declaration')
2
2
  let {
3
+ getGridGap,
4
+ inheritGridGap,
3
5
  parseGridAreas,
4
- warnMissedAreas,
5
6
  prefixTrackProp,
6
7
  prefixTrackValue,
7
- getGridGap,
8
8
  warnGridGap,
9
- inheritGridGap
9
+ warnMissedAreas
10
10
  } = require('./grid-utils')
11
11
 
12
12
  function getGridRows(tpl) {
@@ -39,8 +39,8 @@ class GridTemplateAreas extends Declaration {
39
39
  hasRows = true
40
40
  let { prop, value } = trackDecl
41
41
  trackDecl.cloneBefore({
42
- prop: prefixTrackProp({ prop, prefix }),
43
- value: prefixTrackValue({ value, gap: gap.row })
42
+ prop: prefixTrackProp({ prefix, prop }),
43
+ value: prefixTrackValue({ gap: gap.row, value })
44
44
  })
45
45
  } else {
46
46
  hasColumns = true
@@ -52,25 +52,25 @@ class GridTemplateAreas extends Declaration {
52
52
  if (hasColumns && !hasRows && gap.row && gridRows.length > 1) {
53
53
  decl.cloneBefore({
54
54
  prop: '-ms-grid-rows',
55
+ raws: {},
55
56
  value: prefixTrackValue({
56
- value: `repeat(${gridRows.length}, auto)`,
57
- gap: gap.row
58
- }),
59
- raws: {}
57
+ gap: gap.row,
58
+ value: `repeat(${gridRows.length}, auto)`
59
+ })
60
60
  })
61
61
  }
62
62
 
63
63
  // warnings
64
64
  warnGridGap({
65
+ decl,
65
66
  gap,
66
67
  hasColumns,
67
- decl,
68
68
  result
69
69
  })
70
70
 
71
71
  let areas = parseGridAreas({
72
- rows: gridRows,
73
- gap
72
+ gap,
73
+ rows: gridRows
74
74
  })
75
75
 
76
76
  warnMissedAreas(areas, decl, result)
@@ -1,10 +1,10 @@
1
1
  let Declaration = require('../declaration')
2
2
  let {
3
- parseTemplate,
4
- warnMissedAreas,
5
3
  getGridGap,
4
+ inheritGridGap,
5
+ parseTemplate,
6
6
  warnGridGap,
7
- inheritGridGap
7
+ warnMissedAreas
8
8
  } = require('./grid-utils')
9
9
 
10
10
  class GridTemplate extends Declaration {
@@ -26,7 +26,7 @@ class GridTemplate extends Declaration {
26
26
  */
27
27
  let inheritedGap = inheritGridGap(decl, gap)
28
28
 
29
- let { rows, columns, areas } = parseTemplate({
29
+ let { areas, columns, rows } = parseTemplate({
30
30
  decl,
31
31
  gap: inheritedGap || gap
32
32
  })
@@ -36,9 +36,9 @@ class GridTemplate extends Declaration {
36
36
  let hasColumns = Boolean(columns)
37
37
 
38
38
  warnGridGap({
39
+ decl,
39
40
  gap,
40
41
  hasColumns,
41
- decl,
42
42
  result
43
43
  })
44
44
 
@@ -47,16 +47,16 @@ class GridTemplate extends Declaration {
47
47
  if ((hasRows && hasColumns) || hasAreas) {
48
48
  decl.cloneBefore({
49
49
  prop: '-ms-grid-rows',
50
- value: rows,
51
- raws: {}
50
+ raws: {},
51
+ value: rows
52
52
  })
53
53
  }
54
54
 
55
55
  if (hasColumns) {
56
56
  decl.cloneBefore({
57
57
  prop: '-ms-grid-columns',
58
- value: columns,
59
- raws: {}
58
+ raws: {},
59
+ value: columns
60
60
  })
61
61
  }
62
62
 
@@ -90,7 +90,7 @@ function insertDecl(decl, prop, value) {
90
90
 
91
91
  exports.prefixTrackProp = prefixTrackProp
92
92
 
93
- function prefixTrackProp({ prop, prefix }) {
93
+ function prefixTrackProp({ prefix, prop }) {
94
94
  return prefix + prop.replace('template-', '')
95
95
  }
96
96
 
@@ -105,9 +105,9 @@ function transformRepeat({ nodes }, { gap }) {
105
105
  return result
106
106
  },
107
107
  {
108
+ count: [],
108
109
  key: 'count',
109
- size: [],
110
- count: []
110
+ size: []
111
111
  }
112
112
  )
113
113
 
@@ -132,7 +132,7 @@ function transformRepeat({ nodes }, { gap }) {
132
132
 
133
133
  exports.prefixTrackValue = prefixTrackValue
134
134
 
135
- function prefixTrackValue({ value, gap }) {
135
+ function prefixTrackValue({ gap, value }) {
136
136
  let result = parser(value).nodes.reduce((nodes, node) => {
137
137
  if (node.type === 'function' && node.value === 'repeat') {
138
138
  return nodes.concat({
@@ -164,7 +164,7 @@ function prefixTrackValue({ value, gap }) {
164
164
  let DOTS = /^\.+$/
165
165
 
166
166
  function track(start, end) {
167
- return { start, end, span: end - start }
167
+ return { end, span: end - start, start }
168
168
  }
169
169
 
170
170
  function getColumns(line) {
@@ -173,7 +173,7 @@ function getColumns(line) {
173
173
 
174
174
  exports.parseGridAreas = parseGridAreas
175
175
 
176
- function parseGridAreas({ rows, gap }) {
176
+ function parseGridAreas({ gap, rows }) {
177
177
  return rows.reduce((areas, line, rowIndex) => {
178
178
  if (gap.row) rowIndex *= 2
179
179
 
@@ -248,25 +248,25 @@ function parseTemplate({ decl, gap }) {
248
248
  return result
249
249
  },
250
250
  {
251
- key: 'rows',
251
+ areas: [],
252
252
  columns: [],
253
- rows: [],
254
- areas: []
253
+ key: 'rows',
254
+ rows: []
255
255
  }
256
256
  )
257
257
 
258
258
  return {
259
259
  areas: parseGridAreas({
260
- rows: gridTemplate.areas,
261
- gap
260
+ gap,
261
+ rows: gridTemplate.areas
262
262
  }),
263
263
  columns: prefixTrackValue({
264
- value: gridTemplate.columns.join(' '),
265
- gap: gap.column
264
+ gap: gap.column,
265
+ value: gridTemplate.columns.join(' ')
266
266
  }),
267
267
  rows: prefixTrackValue({
268
- value: gridTemplate.rows.join(' '),
269
- gap: gap.row
268
+ gap: gap.row,
269
+ value: gridTemplate.rows.join(' ')
270
270
  })
271
271
  }
272
272
  }
@@ -429,12 +429,12 @@ function parseGridTemplatesData(css) {
429
429
 
430
430
  parsed[index].allAreas = uniq([...allAreas, ...areaNames])
431
431
  parsed[index].rules.push({
432
+ areas,
433
+ duplicateAreaNames,
432
434
  hasDuplicates: !hasNoDuplicates,
433
- params: media.params,
434
- selectors: rule.selectors,
435
435
  node: rule,
436
- duplicateAreaNames,
437
- areas
436
+ params: media.params,
437
+ selectors: rule.selectors
438
438
  })
439
439
  } else {
440
440
  // index is NOT found, push the new item to the parsed array
@@ -443,13 +443,13 @@ function parseGridTemplatesData(css) {
443
443
  areasCount: 0,
444
444
  rules: [
445
445
  {
446
- hasDuplicates: false,
446
+ areas,
447
+ duplicateAreaNames: [],
447
448
  duplicateRules: [],
448
- params: media.params,
449
- selectors: rule.selectors,
449
+ hasDuplicates: false,
450
450
  node: rule,
451
- duplicateAreaNames: [],
452
- areas
451
+ params: media.params,
452
+ selectors: rule.selectors
453
453
  }
454
454
  ]
455
455
  })
@@ -993,7 +993,7 @@ function inheritGridGap(decl, gap) {
993
993
 
994
994
  exports.warnGridGap = warnGridGap
995
995
 
996
- function warnGridGap({ gap, hasColumns, decl, result }) {
996
+ function warnGridGap({ decl, gap, hasColumns, result }) {
997
997
  let hasBothGaps = gap.row && gap.column
998
998
  if (!hasColumns && (hasBothGaps || (gap.column && !gap.row))) {
999
999
  delete gap.column
@@ -1079,7 +1079,7 @@ function autoplaceGridItems(decl, result, gap, autoflowValue = 'row') {
1079
1079
  ).join(' ')
1080
1080
  })
1081
1081
 
1082
- let areas = parseGridAreas({ rows: filledRows, gap })
1082
+ let areas = parseGridAreas({ gap, rows: filledRows })
1083
1083
  let keys = Object.keys(areas)
1084
1084
  let items = keys.map(i => areas[i])
1085
1085
 
@@ -8,6 +8,13 @@ class ImageRendering extends Declaration {
8
8
  return decl.value === 'pixelated'
9
9
  }
10
10
 
11
+ /**
12
+ * Return property name by spec
13
+ */
14
+ normalize() {
15
+ return 'image-rendering'
16
+ }
17
+
11
18
  /**
12
19
  * Change property name for IE
13
20
  */
@@ -18,6 +25,13 @@ class ImageRendering extends Declaration {
18
25
  return super.prefixed(prop, prefix)
19
26
  }
20
27
 
28
+ /**
29
+ * Warn on old value
30
+ */
31
+ process(node, result) {
32
+ return super.process(node, result)
33
+ }
34
+
21
35
  /**
22
36
  * Change property and value for IE
23
37
  */
@@ -27,20 +41,6 @@ class ImageRendering extends Declaration {
27
41
  decl.value = 'nearest-neighbor'
28
42
  return decl
29
43
  }
30
-
31
- /**
32
- * Return property name by spec
33
- */
34
- normalize() {
35
- return 'image-rendering'
36
- }
37
-
38
- /**
39
- * Warn on old value
40
- */
41
- process(node, result) {
42
- return super.process(node, result)
43
- }
44
44
  }
45
45
 
46
46
  ImageRendering.names = ['image-rendering', 'interpolation-mode']
@@ -2,17 +2,17 @@ let Declaration = require('../declaration')
2
2
 
3
3
  class InlineLogical extends Declaration {
4
4
  /**
5
- * Use old syntax for -moz- and -webkit-
5
+ * Return property name by spec
6
6
  */
7
- prefixed(prop, prefix) {
8
- return prefix + prop.replace('-inline', '')
7
+ normalize(prop) {
8
+ return prop.replace(/(margin|padding|border)-(start|end)/, '$1-inline-$2')
9
9
  }
10
10
 
11
11
  /**
12
- * Return property name by spec
12
+ * Use old syntax for -moz- and -webkit-
13
13
  */
14
- normalize(prop) {
15
- return prop.replace(/(margin|padding|border)-(start|end)/, '$1-inline-$2')
14
+ prefixed(prop, prefix) {
15
+ return prefix + prop.replace('-inline', '')
16
16
  }
17
17
  }
18
18
 
@@ -6,9 +6,11 @@ function regexp(name) {
6
6
  }
7
7
 
8
8
  class Intrinsic extends Value {
9
- regexp() {
10
- if (!this.regexpCache) this.regexpCache = regexp(this.name)
11
- return this.regexpCache
9
+ add(decl, prefix) {
10
+ if (decl.prop.includes('grid') && prefix !== '-webkit-') {
11
+ return undefined
12
+ }
13
+ return super.add(decl, prefix)
12
14
  }
13
15
 
14
16
  isStretch() {
@@ -19,16 +21,6 @@ class Intrinsic extends Value {
19
21
  )
20
22
  }
21
23
 
22
- replace(string, prefix) {
23
- if (prefix === '-moz-' && this.isStretch()) {
24
- return string.replace(this.regexp(), '$1-moz-available$3')
25
- }
26
- if (prefix === '-webkit-' && this.isStretch()) {
27
- return string.replace(this.regexp(), '$1-webkit-fill-available$3')
28
- }
29
- return super.replace(string, prefix)
30
- }
31
-
32
24
  old(prefix) {
33
25
  let prefixed = prefix + this.name
34
26
  if (this.isStretch()) {
@@ -41,11 +33,19 @@ class Intrinsic extends Value {
41
33
  return new OldValue(this.name, prefixed, prefixed, regexp(prefixed))
42
34
  }
43
35
 
44
- add(decl, prefix) {
45
- if (decl.prop.includes('grid') && prefix !== '-webkit-') {
46
- return undefined
36
+ regexp() {
37
+ if (!this.regexpCache) this.regexpCache = regexp(this.name)
38
+ return this.regexpCache
39
+ }
40
+
41
+ replace(string, prefix) {
42
+ if (prefix === '-moz-' && this.isStretch()) {
43
+ return string.replace(this.regexp(), '$1-moz-available$3')
47
44
  }
48
- return super.add(decl, prefix)
45
+ if (prefix === '-webkit-' && this.isStretch()) {
46
+ return string.replace(this.regexp(), '$1-webkit-fill-available$3')
47
+ }
48
+ return super.replace(string, prefix)
49
49
  }
50
50
  }
51
51
 
@@ -2,6 +2,13 @@ let flexSpec = require('./flex-spec')
2
2
  let Declaration = require('../declaration')
3
3
 
4
4
  class JustifyContent extends Declaration {
5
+ /**
6
+ * Return property name by final spec
7
+ */
8
+ normalize() {
9
+ return 'justify-content'
10
+ }
11
+
5
12
  /**
6
13
  * Change property name for 2009 and 2012 specs
7
14
  */
@@ -17,13 +24,6 @@ class JustifyContent extends Declaration {
17
24
  return super.prefixed(prop, prefix)
18
25
  }
19
26
 
20
- /**
21
- * Return property name by final spec
22
- */
23
- normalize() {
24
- return 'justify-content'
25
- }
26
-
27
27
  /**
28
28
  * Change value for 2009 and 2012 specs
29
29
  */
@@ -47,8 +47,8 @@ JustifyContent.names = ['justify-content', 'flex-pack', 'box-pack']
47
47
  JustifyContent.oldValues = {
48
48
  'flex-end': 'end',
49
49
  'flex-start': 'start',
50
- 'space-between': 'justify',
51
- 'space-around': 'distribute'
50
+ 'space-around': 'distribute',
51
+ 'space-between': 'justify'
52
52
  }
53
53
 
54
54
  module.exports = JustifyContent
@@ -73,9 +73,9 @@ MaskComposite.names = ['mask', 'mask-composite']
73
73
 
74
74
  MaskComposite.oldValues = {
75
75
  add: 'source-over',
76
- subtract: 'source-out',
76
+ exclude: 'xor',
77
77
  intersect: 'source-in',
78
- exclude: 'xor'
78
+ subtract: 'source-out'
79
79
  }
80
80
 
81
81
  MaskComposite.regexp = new RegExp(
@@ -2,6 +2,13 @@ let flexSpec = require('./flex-spec')
2
2
  let Declaration = require('../declaration')
3
3
 
4
4
  class Order extends Declaration {
5
+ /**
6
+ * Return property name by final spec
7
+ */
8
+ normalize() {
9
+ return 'order'
10
+ }
11
+
5
12
  /**
6
13
  * Change property name for 2009 and 2012 specs
7
14
  */
@@ -17,13 +24,6 @@ class Order extends Declaration {
17
24
  return super.prefixed(prop, prefix)
18
25
  }
19
26
 
20
- /**
21
- * Return property name by final spec
22
- */
23
- normalize() {
24
- return 'order'
25
- }
26
-
27
27
  /**
28
28
  * Fix value for 2009 spec
29
29
  */
@@ -2,17 +2,17 @@ let Declaration = require('../declaration')
2
2
 
3
3
  class OverscrollBehavior extends Declaration {
4
4
  /**
5
- * Change property name for IE
5
+ * Return property name by spec
6
6
  */
7
- prefixed(prop, prefix) {
8
- return prefix + 'scroll-chaining'
7
+ normalize() {
8
+ return 'overscroll-behavior'
9
9
  }
10
10
 
11
11
  /**
12
- * Return property name by spec
12
+ * Change property name for IE
13
13
  */
14
- normalize() {
15
- return 'overscroll-behavior'
14
+ prefixed(prop, prefix) {
15
+ return prefix + 'scroll-chaining'
16
16
  }
17
17
 
18
18
  /**
@@ -3,29 +3,29 @@ let Value = require('../value')
3
3
 
4
4
  class Pixelated extends Value {
5
5
  /**
6
- * Use non-standard name for WebKit and Firefox
6
+ * Different name for WebKit and Firefox
7
7
  */
8
- replace(string, prefix) {
8
+ old(prefix) {
9
9
  if (prefix === '-webkit-') {
10
- return string.replace(this.regexp(), '$1-webkit-optimize-contrast')
10
+ return new OldValue(this.name, '-webkit-optimize-contrast')
11
11
  }
12
12
  if (prefix === '-moz-') {
13
- return string.replace(this.regexp(), '$1-moz-crisp-edges')
13
+ return new OldValue(this.name, '-moz-crisp-edges')
14
14
  }
15
- return super.replace(string, prefix)
15
+ return super.old(prefix)
16
16
  }
17
17
 
18
18
  /**
19
- * Different name for WebKit and Firefox
19
+ * Use non-standard name for WebKit and Firefox
20
20
  */
21
- old(prefix) {
21
+ replace(string, prefix) {
22
22
  if (prefix === '-webkit-') {
23
- return new OldValue(this.name, '-webkit-optimize-contrast')
23
+ return string.replace(this.regexp(), '$1-webkit-optimize-contrast')
24
24
  }
25
25
  if (prefix === '-moz-') {
26
- return new OldValue(this.name, '-moz-crisp-edges')
26
+ return string.replace(this.regexp(), '$1-moz-crisp-edges')
27
27
  }
28
- return super.old(prefix)
28
+ return super.replace(string, prefix)
29
29
  }
30
30
  }
31
31
 
@@ -1,6 +1,13 @@
1
1
  let Declaration = require('../declaration')
2
2
 
3
3
  class PrintColorAdjust extends Declaration {
4
+ /**
5
+ * Return property name by spec
6
+ */
7
+ normalize() {
8
+ return 'print-color-adjust'
9
+ }
10
+
4
11
  /**
5
12
  * Change property name for WebKit-based browsers
6
13
  */
@@ -11,13 +18,6 @@ class PrintColorAdjust extends Declaration {
11
18
  return prefix + 'print-color-adjust'
12
19
  }
13
20
  }
14
-
15
- /**
16
- * Return property name by spec
17
- */
18
- normalize() {
19
- return 'print-color-adjust'
20
- }
21
21
  }
22
22
 
23
23
  PrintColorAdjust.names = ['print-color-adjust', 'color-adjust']