autoprefixer 9.8.7 → 10.0.2

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 (80) hide show
  1. package/CHANGELOG.md +999 -0
  2. package/README.md +0 -3
  3. package/bin/autoprefixer +11 -11
  4. package/data/prefixes.js +799 -545
  5. package/lib/at-rule.js +23 -50
  6. package/lib/autoprefixer.js +108 -97
  7. package/lib/brackets.js +31 -44
  8. package/lib/browsers.js +54 -71
  9. package/lib/declaration.js +122 -178
  10. package/lib/hacks/align-content.js +24 -54
  11. package/lib/hacks/align-items.js +23 -53
  12. package/lib/hacks/align-self.js +32 -60
  13. package/lib/hacks/animation.js +11 -29
  14. package/lib/hacks/appearance.js +19 -35
  15. package/lib/hacks/backdrop-filter.js +16 -31
  16. package/lib/hacks/background-clip.js +19 -36
  17. package/lib/hacks/background-size.js +16 -31
  18. package/lib/hacks/block-logical.js +28 -36
  19. package/lib/hacks/border-image.js +9 -27
  20. package/lib/hacks/border-radius.js +22 -44
  21. package/lib/hacks/break-props.js +38 -51
  22. package/lib/hacks/color-adjust.js +11 -30
  23. package/lib/hacks/cross-fade.js +29 -48
  24. package/lib/hacks/display-flex.js +32 -61
  25. package/lib/hacks/display-grid.js +12 -32
  26. package/lib/hacks/filter-value.js +8 -25
  27. package/lib/hacks/filter.js +13 -27
  28. package/lib/hacks/flex-basis.js +21 -54
  29. package/lib/hacks/flex-direction.js +41 -77
  30. package/lib/hacks/flex-flow.js +33 -61
  31. package/lib/hacks/flex-grow.js +16 -43
  32. package/lib/hacks/flex-shrink.js +21 -54
  33. package/lib/hacks/flex-spec.js +7 -10
  34. package/lib/hacks/flex-wrap.js +11 -32
  35. package/lib/hacks/flex.js +27 -58
  36. package/lib/hacks/fullscreen.js +10 -30
  37. package/lib/hacks/gradient.js +240 -330
  38. package/lib/hacks/grid-area.js +25 -43
  39. package/lib/hacks/grid-column-align.js +14 -34
  40. package/lib/hacks/grid-end.js +30 -45
  41. package/lib/hacks/grid-row-align.js +14 -34
  42. package/lib/hacks/grid-row-column.js +20 -39
  43. package/lib/hacks/grid-rows-columns.js +75 -99
  44. package/lib/hacks/grid-start.js +17 -39
  45. package/lib/hacks/grid-template-areas.js +59 -76
  46. package/lib/hacks/grid-template.js +40 -61
  47. package/lib/hacks/grid-utils.js +686 -716
  48. package/lib/hacks/image-rendering.js +24 -47
  49. package/lib/hacks/image-set.js +10 -30
  50. package/lib/hacks/inline-logical.js +26 -32
  51. package/lib/hacks/intrinsic.js +40 -53
  52. package/lib/hacks/justify-content.js +26 -57
  53. package/lib/hacks/mask-border.js +28 -36
  54. package/lib/hacks/mask-composite.js +41 -57
  55. package/lib/hacks/order.js +22 -52
  56. package/lib/hacks/overscroll-behavior.js +16 -37
  57. package/lib/hacks/pixelated.js +16 -40
  58. package/lib/hacks/place-self.js +18 -41
  59. package/lib/hacks/placeholder-shown.js +9 -28
  60. package/lib/hacks/placeholder.js +15 -38
  61. package/lib/hacks/text-decoration-skip-ink.js +14 -29
  62. package/lib/hacks/text-decoration.js +20 -31
  63. package/lib/hacks/text-emphasis-position.js +9 -28
  64. package/lib/hacks/transform-decl.js +43 -69
  65. package/lib/hacks/user-select.js +19 -27
  66. package/lib/hacks/writing-mode.js +19 -36
  67. package/lib/info.js +63 -93
  68. package/lib/old-selector.js +39 -60
  69. package/lib/old-value.js +17 -25
  70. package/lib/prefixer.js +83 -110
  71. package/lib/prefixes.js +233 -336
  72. package/lib/processor.js +420 -416
  73. package/lib/resolution.js +62 -98
  74. package/lib/selector.js +91 -139
  75. package/lib/supports.js +194 -246
  76. package/lib/transition.js +170 -265
  77. package/lib/utils.js +49 -72
  78. package/lib/value.js +77 -116
  79. package/lib/vendor.js +14 -0
  80. package/package.json +23 -12
package/lib/resolution.js CHANGED
@@ -1,125 +1,89 @@
1
- "use strict";
1
+ let n2f = require('num2fraction')
2
2
 
3
- function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
3
+ let Prefixer = require('./prefixer')
4
+ let utils = require('./utils')
4
5
 
5
- function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); }
6
-
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
-
9
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
-
11
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
12
-
13
- var n2f = require('num2fraction');
14
-
15
- var Prefixer = require('./prefixer');
16
-
17
- var utils = require('./utils');
18
-
19
- var REGEXP = /(min|max)-resolution\s*:\s*\d*\.?\d+(dppx|dpi|x)/gi;
20
- var SPLIT = /(min|max)-resolution(\s*:\s*)(\d*\.?\d+)(dppx|dpi|x)/i;
21
-
22
- var Resolution = /*#__PURE__*/function (_Prefixer) {
23
- _inheritsLoose(Resolution, _Prefixer);
24
-
25
- function Resolution() {
26
- return _Prefixer.apply(this, arguments) || this;
27
- }
28
-
29
- var _proto = Resolution.prototype;
6
+ const REGEXP = /(min|max)-resolution\s*:\s*\d*\.?\d+(dppx|dpi|x)/gi
7
+ const SPLIT = /(min|max)-resolution(\s*:\s*)(\d*\.?\d+)(dppx|dpi|x)/i
30
8
 
9
+ class Resolution extends Prefixer {
31
10
  /**
32
- * Return prefixed query name
33
- */
34
- _proto.prefixName = function prefixName(prefix, name) {
11
+ * Return prefixed query name
12
+ */
13
+ prefixName (prefix, name) {
35
14
  if (prefix === '-moz-') {
36
- return name + '--moz-device-pixel-ratio';
15
+ return name + '--moz-device-pixel-ratio'
37
16
  } else {
38
- return prefix + name + '-device-pixel-ratio';
17
+ return prefix + name + '-device-pixel-ratio'
39
18
  }
40
19
  }
41
- /**
42
- * Return prefixed query
43
- */
44
- ;
45
20
 
46
- _proto.prefixQuery = function prefixQuery(prefix, name, colon, value, units) {
21
+ /**
22
+ * Return prefixed query
23
+ */
24
+ prefixQuery (prefix, name, colon, value, units) {
47
25
  if (units === 'dpi') {
48
- value = Number(value / 96);
26
+ value = Number(value / 96)
49
27
  }
50
-
51
28
  if (prefix === '-o-') {
52
- value = n2f(value);
29
+ value = n2f(value)
53
30
  }
54
-
55
- return this.prefixName(prefix, name) + colon + value;
31
+ return this.prefixName(prefix, name) + colon + value
56
32
  }
57
- /**
58
- * Remove prefixed queries
59
- */
60
- ;
61
-
62
- _proto.clean = function clean(rule) {
63
- var _this = this;
64
33
 
34
+ /**
35
+ * Remove prefixed queries
36
+ */
37
+ clean (rule) {
65
38
  if (!this.bad) {
66
- this.bad = [];
67
-
68
- for (var _iterator = _createForOfIteratorHelperLoose(this.prefixes), _step; !(_step = _iterator()).done;) {
69
- var prefix = _step.value;
70
- this.bad.push(this.prefixName(prefix, 'min'));
71
- this.bad.push(this.prefixName(prefix, 'max'));
39
+ this.bad = []
40
+ for (let prefix of this.prefixes) {
41
+ this.bad.push(this.prefixName(prefix, 'min'))
42
+ this.bad.push(this.prefixName(prefix, 'max'))
72
43
  }
73
44
  }
74
45
 
75
- rule.params = utils.editList(rule.params, function (queries) {
76
- return queries.filter(function (query) {
77
- return _this.bad.every(function (i) {
78
- return !query.includes(i);
79
- });
80
- });
81
- });
46
+ rule.params = utils.editList(rule.params, queries => {
47
+ return queries.filter(query => this.bad.every(i => !query.includes(i)))
48
+ })
82
49
  }
83
- /**
84
- * Add prefixed queries
85
- */
86
- ;
87
-
88
- _proto.process = function process(rule) {
89
- var _this2 = this;
90
50
 
91
- var parent = this.parentPrefix(rule);
92
- var prefixes = parent ? [parent] : this.prefixes;
93
- rule.params = utils.editList(rule.params, function (origin, prefixed) {
94
- for (var _iterator2 = _createForOfIteratorHelperLoose(origin), _step2; !(_step2 = _iterator2()).done;) {
95
- var query = _step2.value;
96
-
97
- if (!query.includes('min-resolution') && !query.includes('max-resolution')) {
98
- prefixed.push(query);
99
- continue;
51
+ /**
52
+ * Add prefixed queries
53
+ */
54
+ process (rule) {
55
+ let parent = this.parentPrefix(rule)
56
+ let prefixes = parent ? [parent] : this.prefixes
57
+
58
+ rule.params = utils.editList(rule.params, (origin, prefixed) => {
59
+ for (let query of origin) {
60
+ if (
61
+ !query.includes('min-resolution') &&
62
+ !query.includes('max-resolution')
63
+ ) {
64
+ prefixed.push(query)
65
+ continue
100
66
  }
101
67
 
102
- var _loop = function _loop() {
103
- var prefix = _step3.value;
104
- var processed = query.replace(REGEXP, function (str) {
105
- var parts = str.match(SPLIT);
106
- return _this2.prefixQuery(prefix, parts[1], parts[2], parts[3], parts[4]);
107
- });
108
- prefixed.push(processed);
109
- };
110
-
111
- for (var _iterator3 = _createForOfIteratorHelperLoose(prefixes), _step3; !(_step3 = _iterator3()).done;) {
112
- _loop();
68
+ for (let prefix of prefixes) {
69
+ let processed = query.replace(REGEXP, str => {
70
+ let parts = str.match(SPLIT)
71
+ return this.prefixQuery(
72
+ prefix,
73
+ parts[1],
74
+ parts[2],
75
+ parts[3],
76
+ parts[4]
77
+ )
78
+ })
79
+ prefixed.push(processed)
113
80
  }
114
-
115
- prefixed.push(query);
81
+ prefixed.push(query)
116
82
  }
117
83
 
118
- return utils.uniq(prefixed);
119
- });
120
- };
121
-
122
- return Resolution;
123
- }(Prefixer);
84
+ return utils.uniq(prefixed)
85
+ })
86
+ }
87
+ }
124
88
 
125
- module.exports = Resolution;
89
+ module.exports = Resolution
package/lib/selector.js CHANGED
@@ -1,198 +1,150 @@
1
- "use strict";
1
+ let { list } = require('postcss')
2
2
 
3
- function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
3
+ let OldSelector = require('./old-selector')
4
+ let Prefixer = require('./prefixer')
5
+ let Browsers = require('./browsers')
6
+ let utils = require('./utils')
4
7
 
5
- function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } it = o[Symbol.iterator](); return it.next.bind(it); }
6
-
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
-
9
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
-
11
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
12
-
13
- var _require = require('postcss'),
14
- list = _require.list;
15
-
16
- var OldSelector = require('./old-selector');
17
-
18
- var Prefixer = require('./prefixer');
19
-
20
- var Browsers = require('./browsers');
21
-
22
- var utils = require('./utils');
23
-
24
- var Selector = /*#__PURE__*/function (_Prefixer) {
25
- _inheritsLoose(Selector, _Prefixer);
26
-
27
- function Selector(name, prefixes, all) {
28
- var _this;
29
-
30
- _this = _Prefixer.call(this, name, prefixes, all) || this;
31
- _this.regexpCache = {};
32
- return _this;
8
+ class Selector extends Prefixer {
9
+ constructor (name, prefixes, all) {
10
+ super(name, prefixes, all)
11
+ this.regexpCache = new Map()
33
12
  }
34
- /**
35
- * Is rule selectors need to be prefixed
36
- */
37
-
38
13
 
39
- var _proto = Selector.prototype;
40
-
41
- _proto.check = function check(rule) {
14
+ /**
15
+ * Is rule selectors need to be prefixed
16
+ */
17
+ check (rule) {
42
18
  if (rule.selector.includes(this.name)) {
43
- return !!rule.selector.match(this.regexp());
19
+ return !!rule.selector.match(this.regexp())
44
20
  }
45
21
 
46
- return false;
22
+ return false
47
23
  }
48
- /**
49
- * Return prefixed version of selector
50
- */
51
- ;
52
24
 
53
- _proto.prefixed = function prefixed(prefix) {
54
- return this.name.replace(/^(\W*)/, "$1" + prefix);
55
- }
56
25
  /**
57
- * Lazy loadRegExp for name
58
- */
59
- ;
26
+ * Return prefixed version of selector
27
+ */
28
+ prefixed (prefix) {
29
+ return this.name.replace(/^(\W*)/, `$1${prefix}`)
30
+ }
60
31
 
61
- _proto.regexp = function regexp(prefix) {
62
- if (this.regexpCache[prefix]) {
63
- return this.regexpCache[prefix];
32
+ /**
33
+ * Lazy loadRegExp for name
34
+ */
35
+ regexp (prefix) {
36
+ if (!this.regexpCache.has(prefix)) {
37
+ let name = prefix ? this.prefixed(prefix) : this.name
38
+ this.regexpCache.set(
39
+ prefix,
40
+ new RegExp(`(^|[^:"'=])${utils.escapeRegexp(name)}`, 'gi')
41
+ )
64
42
  }
65
43
 
66
- var name = prefix ? this.prefixed(prefix) : this.name;
67
- this.regexpCache[prefix] = new RegExp("(^|[^:\"'=])" + utils.escapeRegexp(name), 'gi');
68
- return this.regexpCache[prefix];
44
+ return this.regexpCache.get(prefix)
69
45
  }
70
- /**
71
- * All possible prefixes
72
- */
73
- ;
74
46
 
75
- _proto.possible = function possible() {
76
- return Browsers.prefixes();
77
- }
78
47
  /**
79
- * Return all possible selector prefixes
80
- */
81
- ;
82
-
83
- _proto.prefixeds = function prefixeds(rule) {
84
- var _this2 = this;
48
+ * All possible prefixes
49
+ */
50
+ possible () {
51
+ return Browsers.prefixes()
52
+ }
85
53
 
54
+ /**
55
+ * Return all possible selector prefixes
56
+ */
57
+ prefixeds (rule) {
86
58
  if (rule._autoprefixerPrefixeds) {
87
59
  if (rule._autoprefixerPrefixeds[this.name]) {
88
- return rule._autoprefixerPrefixeds;
60
+ return rule._autoprefixerPrefixeds
89
61
  }
90
62
  } else {
91
- rule._autoprefixerPrefixeds = {};
63
+ rule._autoprefixerPrefixeds = {}
92
64
  }
93
65
 
94
- var prefixeds = {};
95
-
66
+ let prefixeds = {}
96
67
  if (rule.selector.includes(',')) {
97
- var ruleParts = list.comma(rule.selector);
98
- var toProcess = ruleParts.filter(function (el) {
99
- return el.includes(_this2.name);
100
- });
101
-
102
- var _loop = function _loop() {
103
- var prefix = _step.value;
104
- prefixeds[prefix] = toProcess.map(function (el) {
105
- return _this2.replace(el, prefix);
106
- }).join(', ');
107
- };
108
-
109
- for (var _iterator = _createForOfIteratorHelperLoose(this.possible()), _step; !(_step = _iterator()).done;) {
110
- _loop();
68
+ let ruleParts = list.comma(rule.selector)
69
+ let toProcess = ruleParts.filter(el => el.includes(this.name))
70
+
71
+ for (let prefix of this.possible()) {
72
+ prefixeds[prefix] = toProcess
73
+ .map(el => this.replace(el, prefix))
74
+ .join(', ')
111
75
  }
112
76
  } else {
113
- for (var _iterator2 = _createForOfIteratorHelperLoose(this.possible()), _step2; !(_step2 = _iterator2()).done;) {
114
- var prefix = _step2.value;
115
- prefixeds[prefix] = this.replace(rule.selector, prefix);
77
+ for (let prefix of this.possible()) {
78
+ prefixeds[prefix] = this.replace(rule.selector, prefix)
116
79
  }
117
80
  }
118
81
 
119
- rule._autoprefixerPrefixeds[this.name] = prefixeds;
120
- return rule._autoprefixerPrefixeds;
82
+ rule._autoprefixerPrefixeds[this.name] = prefixeds
83
+ return rule._autoprefixerPrefixeds
121
84
  }
122
- /**
123
- * Is rule already prefixed before
124
- */
125
- ;
126
85
 
127
- _proto.already = function already(rule, prefixeds, prefix) {
128
- var index = rule.parent.index(rule) - 1;
86
+ /**
87
+ * Is rule already prefixed before
88
+ */
89
+ already (rule, prefixeds, prefix) {
90
+ let index = rule.parent.index(rule) - 1
129
91
 
130
92
  while (index >= 0) {
131
- var before = rule.parent.nodes[index];
93
+ let before = rule.parent.nodes[index]
132
94
 
133
95
  if (before.type !== 'rule') {
134
- return false;
96
+ return false
135
97
  }
136
98
 
137
- var some = false;
138
-
139
- for (var key in prefixeds[this.name]) {
140
- var prefixed = prefixeds[this.name][key];
141
-
99
+ let some = false
100
+ for (let key in prefixeds[this.name]) {
101
+ let prefixed = prefixeds[this.name][key]
142
102
  if (before.selector === prefixed) {
143
103
  if (prefix === key) {
144
- return true;
104
+ return true
145
105
  } else {
146
- some = true;
147
- break;
106
+ some = true
107
+ break
148
108
  }
149
109
  }
150
110
  }
151
-
152
111
  if (!some) {
153
- return false;
112
+ return false
154
113
  }
155
114
 
156
- index -= 1;
115
+ index -= 1
157
116
  }
158
117
 
159
- return false;
118
+ return false
160
119
  }
161
- /**
162
- * Replace selectors by prefixed one
163
- */
164
- ;
165
120
 
166
- _proto.replace = function replace(selector, prefix) {
167
- return selector.replace(this.regexp(), "$1" + this.prefixed(prefix));
168
- }
169
121
  /**
170
- * Clone and add prefixes for at-rule
171
- */
172
- ;
122
+ * Replace selectors by prefixed one
123
+ */
124
+ replace (selector, prefix) {
125
+ return selector.replace(this.regexp(), `$1${this.prefixed(prefix)}`)
126
+ }
173
127
 
174
- _proto.add = function add(rule, prefix) {
175
- var prefixeds = this.prefixeds(rule);
128
+ /**
129
+ * Clone and add prefixes for at-rule
130
+ */
131
+ add (rule, prefix) {
132
+ let prefixeds = this.prefixeds(rule)
176
133
 
177
134
  if (this.already(rule, prefixeds, prefix)) {
178
- return;
135
+ return
179
136
  }
180
137
 
181
- var cloned = this.clone(rule, {
182
- selector: prefixeds[this.name][prefix]
183
- });
184
- rule.parent.insertBefore(rule, cloned);
138
+ let cloned = this.clone(rule, { selector: prefixeds[this.name][prefix] })
139
+ rule.parent.insertBefore(rule, cloned)
185
140
  }
186
- /**
187
- * Return function to fast find prefixed selector
188
- */
189
- ;
190
-
191
- _proto.old = function old(prefix) {
192
- return new OldSelector(this, prefix);
193
- };
194
141
 
195
- return Selector;
196
- }(Prefixer);
142
+ /**
143
+ * Return function to fast find prefixed selector
144
+ */
145
+ old (prefix) {
146
+ return new OldSelector(this, prefix)
147
+ }
148
+ }
197
149
 
198
- module.exports = Selector;
150
+ module.exports = Selector