autoprefixer 9.1.5 → 9.3.1

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.
@@ -33,9 +33,9 @@ function (_Declaration) {
33
33
  _proto.prefixed = function prefixed(prop, prefix) {
34
34
  if (prefix === '-ms-') {
35
35
  return '-ms-interpolation-mode';
36
- } else {
37
- return _Declaration.prototype.prefixed.call(this, prop, prefix);
38
36
  }
37
+
38
+ return _Declaration.prototype.prefixed.call(this, prop, prefix);
39
39
  };
40
40
  /**
41
41
  * Change property and value for IE
@@ -37,11 +37,13 @@ function (_Value) {
37
37
  _proto.replace = function replace(string, prefix) {
38
38
  if (prefix === '-moz-' && this.isStretch()) {
39
39
  return string.replace(this.regexp(), '$1-moz-available$3');
40
- } else if (prefix === '-webkit-' && this.isStretch()) {
40
+ }
41
+
42
+ if (prefix === '-webkit-' && this.isStretch()) {
41
43
  return string.replace(this.regexp(), '$1-webkit-fill-available$3');
42
- } else {
43
- return _Value.prototype.replace.call(this, string, prefix);
44
44
  }
45
+
46
+ return _Value.prototype.replace.call(this, string, prefix);
45
47
  };
46
48
 
47
49
  _proto.old = function old(prefix) {
@@ -31,11 +31,13 @@ function (_Declaration) {
31
31
 
32
32
  if (spec === 2009) {
33
33
  return prefix + 'box-pack';
34
- } else if (spec === 2012) {
34
+ }
35
+
36
+ if (spec === 2012) {
35
37
  return prefix + 'flex-pack';
36
- } else {
37
- return _Declaration.prototype.prefixed.call(this, prop, prefix);
38
38
  }
39
+
40
+ return _Declaration.prototype.prefixed.call(this, prop, prefix);
39
41
  };
40
42
  /**
41
43
  * Return property name by final spec
@@ -34,11 +34,13 @@ function (_Declaration) {
34
34
 
35
35
  if (spec === 2009) {
36
36
  return prefix + 'box-ordinal-group';
37
- } else if (spec === 2012) {
37
+ }
38
+
39
+ if (spec === 2012) {
38
40
  return prefix + 'flex-order';
39
- } else {
40
- return _Declaration.prototype.prefixed.call(this, prop, prefix);
41
41
  }
42
+
43
+ return _Declaration.prototype.prefixed.call(this, prop, prefix);
42
44
  };
43
45
  /**
44
46
  * Return property name by final spec
@@ -59,9 +61,9 @@ function (_Declaration) {
59
61
  if (spec === 2009 && /\d/.test(decl.value)) {
60
62
  decl.value = (parseInt(decl.value) + 1).toString();
61
63
  return _Declaration.prototype.set.call(this, decl, prefix);
62
- } else {
63
- return _Declaration.prototype.set.call(this, decl, prefix);
64
64
  }
65
+
66
+ return _Declaration.prototype.set.call(this, decl, prefix);
65
67
  };
66
68
 
67
69
  return Order;
@@ -27,11 +27,13 @@ function (_Value) {
27
27
  _proto.replace = function replace(string, prefix) {
28
28
  if (prefix === '-webkit-') {
29
29
  return string.replace(this.regexp(), '$1-webkit-optimize-contrast');
30
- } else if (prefix === '-moz-') {
30
+ }
31
+
32
+ if (prefix === '-moz-') {
31
33
  return string.replace(this.regexp(), '$1-moz-crisp-edges');
32
- } else {
33
- return _Value.prototype.replace.call(this, string, prefix);
34
34
  }
35
+
36
+ return _Value.prototype.replace.call(this, string, prefix);
35
37
  };
36
38
  /**
37
39
  * Different name for WebKit and Firefox
@@ -41,11 +43,13 @@ function (_Value) {
41
43
  _proto.old = function old(prefix) {
42
44
  if (prefix === '-webkit-') {
43
45
  return new OldValue(this.name, '-webkit-optimize-contrast');
44
- } else if (prefix === '-moz-') {
46
+ }
47
+
48
+ if (prefix === '-moz-') {
45
49
  return new OldValue(this.name, '-moz-crisp-edges');
46
- } else {
47
- return _Value.prototype.old.call(this, prefix);
48
50
  }
51
+
52
+ return _Value.prototype.old.call(this, prefix);
49
53
  };
50
54
 
51
55
  return Pixelated;
@@ -0,0 +1,57 @@
1
+ "use strict";
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; }
4
+
5
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
6
+
7
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+
9
+ var Declaration = require('../declaration');
10
+
11
+ var utils = require('./grid-utils');
12
+
13
+ var PlaceSelf =
14
+ /*#__PURE__*/
15
+ function (_Declaration) {
16
+ _inheritsLoose(PlaceSelf, _Declaration);
17
+
18
+ function PlaceSelf() {
19
+ return _Declaration.apply(this, arguments) || this;
20
+ }
21
+
22
+ var _proto = PlaceSelf.prototype;
23
+
24
+ /**
25
+ * Translate place-self to separate -ms- prefixed properties
26
+ */
27
+ _proto.insert = function insert(decl, prefix, prefixes) {
28
+ if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes); // prevent doubling of prefixes
29
+
30
+ if (decl.parent.some(function (i) {
31
+ return i.prop === '-ms-grid-row-align';
32
+ })) {
33
+ return undefined;
34
+ }
35
+
36
+ var _utils$parse = utils.parse(decl),
37
+ _utils$parse$ = _utils$parse[0],
38
+ first = _utils$parse$[0],
39
+ second = _utils$parse$[1];
40
+
41
+ if (second) {
42
+ utils.insertDecl(decl, 'grid-row-align', first);
43
+ utils.insertDecl(decl, 'grid-column-align', second);
44
+ } else {
45
+ utils.insertDecl(decl, 'grid-row-align', first);
46
+ utils.insertDecl(decl, 'grid-column-align', first);
47
+ }
48
+
49
+ return undefined;
50
+ };
51
+
52
+ return PlaceSelf;
53
+ }(Declaration);
54
+
55
+ _defineProperty(PlaceSelf, "names", ['place-self']);
56
+
57
+ module.exports = PlaceSelf;
@@ -33,15 +33,21 @@ function (_Selector) {
33
33
  _proto.prefixed = function prefixed(prefix) {
34
34
  if (prefix === '-webkit-') {
35
35
  return '::-webkit-input-placeholder';
36
- } else if (prefix === '-ms-') {
36
+ }
37
+
38
+ if (prefix === '-ms-') {
37
39
  return '::-ms-input-placeholder';
38
- } else if (prefix === '-ms- old') {
40
+ }
41
+
42
+ if (prefix === '-ms- old') {
39
43
  return ':-ms-input-placeholder';
40
- } else if (prefix === '-moz- old') {
44
+ }
45
+
46
+ if (prefix === '-moz- old') {
41
47
  return ':-moz-placeholder';
42
- } else {
43
- return "::" + prefix + "placeholder";
44
48
  }
49
+
50
+ return "::" + prefix + "placeholder";
45
51
  };
46
52
 
47
53
  return Placeholder;
@@ -23,9 +23,9 @@ function (_Declaration) {
23
23
  if (prefix === '-ms-') {
24
24
  decl.value = WritingMode.msValues[decl.value] || decl.value;
25
25
  return _Declaration.prototype.set.call(this, decl, prefix);
26
- } else {
27
- return _Declaration.prototype.set.call(this, decl, prefix);
28
26
  }
27
+
28
+ return _Declaration.prototype.set.call(this, decl, prefix);
29
29
  };
30
30
 
31
31
  return WritingMode;
package/lib/prefixer.js CHANGED
@@ -6,7 +6,7 @@ var utils = require('./utils');
6
6
 
7
7
  var vendor = require('postcss').vendor;
8
8
  /**
9
- * Recursivly clone objects
9
+ * Recursively clone objects
10
10
  */
11
11
 
12
12
 
package/lib/prefixes.js CHANGED
@@ -63,6 +63,7 @@ Declaration.hack(require('./hacks/overscroll-behavior'));
63
63
  Declaration.hack(require('./hacks/grid-template-areas'));
64
64
  Declaration.hack(require('./hacks/text-emphasis-position'));
65
65
  Declaration.hack(require('./hacks/color-adjust'));
66
+ Declaration.hack(require('./hacks/place-self'));
66
67
  Value.hack(require('./hacks/gradient'));
67
68
  Value.hack(require('./hacks/intrinsic'));
68
69
  Value.hack(require('./hacks/pixelated'));
package/lib/processor.js CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  var Value = require('./value');
4
4
 
5
+ var insertAreas = require('./hacks/grid-utils').insertAreas;
6
+
5
7
  var OLD_LINEAR = /(^|[^-])linear-gradient\(\s*(top|left|right|bottom)/i;
6
8
  var OLD_RADIAL = /(^|[^-])radial-gradient\(\s*\d+(\w*|%)\s+\d+(\w*|%)\s*,/i;
7
9
  var RADIAL_BLOCK = /\(((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*)\)/i;
@@ -15,8 +17,8 @@ function () {
15
17
  this.prefixes = prefixes;
16
18
  }
17
19
  /**
18
- * Add necessary prefixes
19
- */
20
+ * Add necessary prefixes
21
+ */
20
22
 
21
23
 
22
24
  var _proto = Processor.prototype;
@@ -57,18 +59,29 @@ function () {
57
59
  return selector.process(rule, result);
58
60
  });
59
61
  });
62
+
63
+ function insideGrid(decl) {
64
+ return decl.parent.some(function (subDecl) {
65
+ var displayGrid = subDecl.prop === 'display' && /(inline-)?grid/.test(subDecl.value);
66
+ var gridTemplate = /^grid-template/.test(subDecl.prop);
67
+ var gridGap = /^grid-([A-z]+-)?gap/.test(subDecl.prop);
68
+ return displayGrid || gridTemplate || gridGap;
69
+ });
70
+ }
71
+
72
+ var gridPrefixes = this.gridStatus(css, result) && this.prefixes.add['grid-area'] && this.prefixes.add['grid-area'].prefixes;
60
73
  css.walkDecls(function (decl) {
61
74
  if (_this.disabledDecl(decl, result)) return undefined;
62
75
  var prop = decl.prop;
63
76
  var value = decl.value;
64
77
 
65
78
  if (prop === 'grid-row-span') {
66
- result.warn('grid-row-span is not part of final Grid Layout. ' + 'Use grid-row.', {
79
+ result.warn('grid-row-span is not part of final Grid Layout. Use grid-row.', {
67
80
  node: decl
68
81
  });
69
82
  return undefined;
70
83
  } else if (prop === 'grid-column-span') {
71
- result.warn('grid-column-span is not part of final Grid Layout. ' + 'Use grid-column.', {
84
+ result.warn('grid-column-span is not part of final Grid Layout. Use grid-column.', {
72
85
  node: decl
73
86
  });
74
87
  return undefined;
@@ -84,10 +97,22 @@ function () {
84
97
  });
85
98
  }
86
99
  } else {
87
- var grid = _this.prefixes.add['grid-area'];
88
-
89
- if (_this.prefixes.options.grid && grid && grid.prefixes) {
90
- if (prop === 'grid-auto-columns') {
100
+ if (gridPrefixes) {
101
+ if (/^(align|justify|place)-items$/.test(prop) && insideGrid(decl)) {
102
+ var fixed = prop.replace('-items', '-self');
103
+ result.warn("IE does not support " + prop + " on grid containers. " + ("Try using " + fixed + " on child elements instead: ") + (decl.parent.selector + " > * { " + fixed + ": " + decl.value + " }"), {
104
+ node: decl
105
+ });
106
+ } else if (/^(align|justify|place)-content$/.test(prop) && insideGrid(decl)) {
107
+ result.warn("IE does not support " + decl.prop + " on grid containers", {
108
+ node: decl
109
+ });
110
+ } else if (prop === 'display' && decl.value === 'contents') {
111
+ result.warn('Please do not use display: contents; ' + 'if you have grid setting enabled', {
112
+ node: decl
113
+ });
114
+ return undefined;
115
+ } else if (prop === 'grid-auto-columns') {
91
116
  result.warn('grid-auto-columns is not supported by IE', {
92
117
  node: decl
93
118
  });
@@ -155,7 +180,7 @@ function () {
155
180
  node: decl
156
181
  });
157
182
  } else if (decl.value.indexOf('fill') !== -1) {
158
- result.warn('Replace fill to stretch, ' + 'because spec had been changed', {
183
+ result.warn('Replace fill to stretch, because spec had been changed', {
159
184
  node: decl
160
185
  });
161
186
  }
@@ -179,7 +204,7 @@ function () {
179
204
  }
180
205
  }
181
206
 
182
- if (display !== 'flex' && _this.prefixes.options.grid !== false) {
207
+ if (display !== 'flex' && _this.gridStatus(decl, result) !== false) {
183
208
  prefixer = _this.prefixes.add['grid-row-align'];
184
209
 
185
210
  if (prefixer && prefixer.prefixes) {
@@ -190,13 +215,19 @@ function () {
190
215
  // justify-self flexbox or grid
191
216
  var _display = _this.displayType(decl);
192
217
 
193
- if (_display !== 'flex' && _this.prefixes.options.grid !== false) {
218
+ if (_display !== 'flex' && _this.gridStatus(decl, result) !== false) {
194
219
  prefixer = _this.prefixes.add['grid-column-align'];
195
220
 
196
221
  if (prefixer && prefixer.prefixes) {
197
222
  return prefixer.process(decl, result);
198
223
  }
199
224
  }
225
+ } else if (decl.prop === 'place-self') {
226
+ prefixer = _this.prefixes.add['place-self'];
227
+
228
+ if (prefixer && prefixer.prefixes && _this.gridStatus(decl, result) !== false) {
229
+ return prefixer.process(decl, result);
230
+ }
200
231
  } else {
201
232
  // Properties
202
233
  prefixer = _this.prefixes.add[decl.prop];
@@ -207,7 +238,13 @@ function () {
207
238
  }
208
239
 
209
240
  return undefined;
210
- }); // Values
241
+ }); // Insert grid-area prefixes. We need to be able to store the different
242
+ // rules as a data and hack API is not enough for this
243
+
244
+ if (this.gridStatus(css, result) === true) {
245
+ insertAreas(css, this.disabled);
246
+ } // Values
247
+
211
248
 
212
249
  return css.walkDecls(function (decl) {
213
250
  if (_this.disabledValue(decl, result)) return;
@@ -234,8 +271,8 @@ function () {
234
271
  });
235
272
  };
236
273
  /**
237
- * Remove unnecessary pefixes
238
- */
274
+ * Remove unnecessary pefixes
275
+ */
239
276
 
240
277
 
241
278
  _proto.remove = function remove(css, result) {
@@ -345,20 +382,20 @@ function () {
345
382
  });
346
383
  };
347
384
  /**
348
- * Some rare old values, which is not in standard
349
- */
385
+ * Some rare old values, which is not in standard
386
+ */
350
387
 
351
388
 
352
389
  _proto.withHackValue = function withHackValue(decl) {
353
390
  return decl.prop === '-webkit-background-clip' && decl.value === 'text';
354
391
  };
355
392
  /**
356
- * Check for grid/flexbox options.
357
- */
393
+ * Check for grid/flexbox options.
394
+ */
358
395
 
359
396
 
360
397
  _proto.disabledValue = function disabledValue(node, result) {
361
- if (this.prefixes.options.grid === false && node.type === 'decl') {
398
+ if (this.gridStatus(node, result) === false && node.type === 'decl') {
362
399
  if (node.prop === 'display' && node.value.indexOf('grid') !== -1) {
363
400
  return true;
364
401
  }
@@ -373,12 +410,12 @@ function () {
373
410
  return this.disabled(node, result);
374
411
  };
375
412
  /**
376
- * Check for grid/flexbox options.
377
- */
413
+ * Check for grid/flexbox options.
414
+ */
378
415
 
379
416
 
380
417
  _proto.disabledDecl = function disabledDecl(node, result) {
381
- if (this.prefixes.options.grid === false && node.type === 'decl') {
418
+ if (this.gridStatus(node, result) === false && node.type === 'decl') {
382
419
  if (node.prop.indexOf('grid') !== -1 || node.prop === 'justify-items') {
383
420
  return true;
384
421
  }
@@ -395,8 +432,8 @@ function () {
395
432
  return this.disabled(node, result);
396
433
  };
397
434
  /**
398
- * Check for control comment and global options
399
- */
435
+ * Check for control comment and global options
436
+ */
400
437
 
401
438
 
402
439
  _proto.disabled = function disabled(node, result) {
@@ -457,8 +494,8 @@ function () {
457
494
  return value;
458
495
  };
459
496
  /**
460
- * Normalize spaces in cascade declaration group
461
- */
497
+ * Normalize spaces in cascade declaration group
498
+ */
462
499
 
463
500
 
464
501
  _proto.reduceSpaces = function reduceSpaces(decl) {
@@ -490,8 +527,8 @@ function () {
490
527
  });
491
528
  };
492
529
  /**
493
- * Is it flebox or grid rule
494
- */
530
+ * Is it flebox or grid rule
531
+ */
495
532
 
496
533
 
497
534
  _proto.displayType = function displayType(decl) {
@@ -524,6 +561,66 @@ function () {
524
561
 
525
562
  return false;
526
563
  };
564
+ /**
565
+ * Set grid option via control comment
566
+ */
567
+
568
+
569
+ _proto.gridStatus = function gridStatus(node, result) {
570
+ if (!node) return false;
571
+
572
+ if (node._autoprefixerGridStatus !== undefined) {
573
+ return node._autoprefixerGridStatus;
574
+ }
575
+
576
+ var value = null;
577
+
578
+ if (node.nodes) {
579
+ var status;
580
+ node.each(function (i) {
581
+ if (i.type !== 'comment') return;
582
+
583
+ if (/(!\s*)?autoprefixer\s*grid:\s*(off|on)/i.test(i.text)) {
584
+ if (typeof status !== 'undefined') {
585
+ result.warn('Second Autoprefixer grid control comment ' + 'was ignored. Autoprefixer applies control ' + 'comment to whole block, not to next rules.', {
586
+ node: i
587
+ });
588
+ } else {
589
+ status = /on/i.test(i.text);
590
+ }
591
+ }
592
+ });
593
+
594
+ if (status !== undefined) {
595
+ value = status;
596
+ }
597
+ }
598
+
599
+ if (node.type === 'atrule' && node.name === 'supports') {
600
+ var params = node.params;
601
+
602
+ if (params.indexOf('grid') !== -1 && params.indexOf('auto') !== -1) {
603
+ value = false;
604
+ }
605
+ }
606
+
607
+ if (!node.nodes || value === null) {
608
+ if (node.parent) {
609
+ var isParentGrid = this.gridStatus(node.parent, result);
610
+
611
+ if (node.parent._autoprefixerSelfDisabled === true) {
612
+ value = false;
613
+ } else {
614
+ value = isParentGrid;
615
+ }
616
+ } else {
617
+ value = this.prefixes.options.grid;
618
+ }
619
+ }
620
+
621
+ node._autoprefixerGridStatus = value;
622
+ return value;
623
+ };
527
624
 
528
625
  return Processor;
529
626
  }();
package/lib/transition.js CHANGED
@@ -17,7 +17,7 @@ function () {
17
17
  this.prefixes = prefixes;
18
18
  }
19
19
  /**
20
- * Process transition and add prefies for all necessary properties
20
+ * Process transition and add prefixes for all necessary properties
21
21
  */
22
22
 
23
23
 
@@ -137,7 +137,7 @@ function () {
137
137
  return prop;
138
138
  };
139
139
  /**
140
- * Does we aready have this declaration
140
+ * Does we already have this declaration
141
141
  */
142
142
 
143
143
 
@@ -346,7 +346,7 @@ function () {
346
346
  return result;
347
347
  };
348
348
  /**
349
- * Find or create seperator
349
+ * Find or create separator
350
350
  */
351
351
 
352
352
 
package/lib/utils.js CHANGED
@@ -88,5 +88,21 @@ module.exports = {
88
88
  var join = value.match(/,\s*/);
89
89
  join = join ? join[0] : ', ';
90
90
  return changed.join(join);
91
+ },
92
+
93
+ /**
94
+ * Split the selector into parts.
95
+ * It returns 3 level deep array because selectors can be comma
96
+ * separated (1), space separated (2), and combined (3)
97
+ * @param {String} selector selector string
98
+ * @return {Array<Array<Array>>} 3 level deep array of split selector
99
+ * @see utils.test.js for examples
100
+ */
101
+ splitSelector: function splitSelector(selector) {
102
+ return list.comma(selector).map(function (i) {
103
+ return list.space(i).map(function (k) {
104
+ return k.split(/(?=\.|#)/g);
105
+ });
106
+ });
91
107
  }
92
108
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoprefixer",
3
- "version": "9.1.5",
3
+ "version": "9.3.1",
4
4
  "description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
5
5
  "keywords": ["autoprefixer", "css", "prefix", "postcss", "postcss-plugin"],
6
6
  "author": "Andrey Sitnik <andrey@sitnik.ru>",
@@ -10,12 +10,12 @@
10
10
  "node": ">=6.0.0"
11
11
  },
12
12
  "dependencies": {
13
- "browserslist": "^4.1.0",
14
- "caniuse-lite": "^1.0.30000884",
13
+ "browserslist": "^4.3.3",
14
+ "caniuse-lite": "^1.0.30000898",
15
15
  "normalize-range": "^0.1.2",
16
16
  "num2fraction": "^1.2.2",
17
- "postcss": "^7.0.2",
18
- "postcss-value-parser": "^3.2.3"
17
+ "postcss": "^7.0.5",
18
+ "postcss-value-parser": "^3.3.1"
19
19
  },
20
20
  "bin": {
21
21
  "autoprefixer": "./bin/autoprefixer"