autoprefixer 9.4.7 → 9.5.0
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.
- package/CHANGELOG.md +12 -0
- package/README.md +30 -21
- package/lib/hacks/gradient.js +4 -4
- package/lib/hacks/grid-utils.js +13 -10
- package/lib/hacks/mask-composite.js +106 -0
- package/lib/prefixes.js +1 -0
- package/lib/processor.js +5 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
3
3
|
|
|
4
|
+
## 9.5 “Draco dormiens nunquam titillandus”
|
|
5
|
+
* Add `mask-composite` support (by Semen Levenson).
|
|
6
|
+
|
|
7
|
+
## 9.4.10
|
|
8
|
+
* Add warning for named Grid rows.
|
|
9
|
+
|
|
10
|
+
## 9.4.9
|
|
11
|
+
* Fix `grid-template` and `@media` case (by Bogdan Dolin).
|
|
12
|
+
|
|
13
|
+
## 9.4.8
|
|
14
|
+
* Fix `calc()` support in Grid gap.
|
|
15
|
+
|
|
4
16
|
## 9.4.7
|
|
5
17
|
* Fix infinite loop on mismatched parens.
|
|
6
18
|
|
package/README.md
CHANGED
|
@@ -103,18 +103,23 @@ See [Browserslist docs] for queries, browser names, config format, and defaults.
|
|
|
103
103
|
|
|
104
104
|
### Does Autoprefixer polyfill Grid Layout for IE?
|
|
105
105
|
|
|
106
|
-
Autoprefixer can be used to translate modern CSS Grid syntax into IE 10
|
|
107
|
-
but this polyfill will not work in 100% of cases.
|
|
106
|
+
Autoprefixer can be used to translate modern CSS Grid syntax into IE 10
|
|
107
|
+
and IE 11 syntax, but this polyfill will not work in 100% of cases.
|
|
108
|
+
This is why it is disabled by default.
|
|
108
109
|
|
|
109
|
-
First, you need to enable Grid prefixes by using either the `grid: "autoplace"`
|
|
110
|
+
First, you need to enable Grid prefixes by using either the `grid: "autoplace"`
|
|
111
|
+
option or the `/* autoprefixer grid: autoplace */` control comment.
|
|
110
112
|
|
|
111
113
|
Second, you need to test every fix with Grid in IE. It is not an enable and
|
|
112
114
|
forget feature, but it is still very useful.
|
|
113
115
|
Financial Times and Yandex use it in production.
|
|
114
116
|
|
|
115
|
-
Third, there is only very limited auto placement support. Read the
|
|
117
|
+
Third, there is only very limited auto placement support. Read the
|
|
118
|
+
[Grid Autoplacement support in IE](#grid-autoplacement-support-in-ie) section
|
|
119
|
+
for more details.
|
|
116
120
|
|
|
117
|
-
Fourth, if you are not using the autoplacement feature, the best way
|
|
121
|
+
Fourth, if you are not using the autoplacement feature, the best way
|
|
122
|
+
to use Autoprefixer is by using `grid-template` or `grid-template-areas`.
|
|
118
123
|
|
|
119
124
|
```css
|
|
120
125
|
.page {
|
|
@@ -314,7 +319,7 @@ module.exports = {
|
|
|
314
319
|
|
|
315
320
|
[other PostCSS plugins]: https://github.com/postcss/postcss#plugins
|
|
316
321
|
[postcss-loader]: https://github.com/postcss/postcss-loader
|
|
317
|
-
[webpack]:
|
|
322
|
+
[webpack]: https://webpack.js.org/
|
|
318
323
|
|
|
319
324
|
|
|
320
325
|
### CSS-in-JS
|
|
@@ -435,7 +440,7 @@ Autoprefixer should be used in assets build tools. Text editor plugins are not
|
|
|
435
440
|
a good solution, because prefixes decrease code readability and you will need
|
|
436
441
|
to change values in all prefixed properties.
|
|
437
442
|
|
|
438
|
-
I recommend you to learn how to use build tools like [
|
|
443
|
+
I recommend you to learn how to use build tools like [Parcel].
|
|
439
444
|
They work much better and will open you a whole new world of useful plugins
|
|
440
445
|
and automation.
|
|
441
446
|
|
|
@@ -445,8 +450,9 @@ If you can’t move to a build tool, you can use text editor plugins:
|
|
|
445
450
|
* [Brackets](https://github.com/mikaeljorhult/brackets-autoprefixer)
|
|
446
451
|
* [Atom Editor](https://github.com/sindresorhus/atom-autoprefixer)
|
|
447
452
|
* [Visual Studio](https://github.com/madskristensen/WebCompiler)
|
|
453
|
+
([how to](https://stackoverflow.com/a/54908636/2440))
|
|
448
454
|
|
|
449
|
-
[
|
|
455
|
+
[Parcel]: https://parceljs.org/
|
|
450
456
|
|
|
451
457
|
|
|
452
458
|
## Warnings
|
|
@@ -593,14 +599,17 @@ Available options are:
|
|
|
593
599
|
parameters. Default is `true`.
|
|
594
600
|
* `flexbox` (boolean|string): should Autoprefixer add prefixes for flexbox
|
|
595
601
|
properties. With `"no-2009"` value Autoprefixer will add prefixes only
|
|
596
|
-
for final and IE versions of specification. Default is `true`.
|
|
597
|
-
* `grid` (false|"autoplace"|"no-autoplace"): should Autoprefixer
|
|
598
|
-
properties?
|
|
599
|
-
* `false` (default): prevent Autoprefixer from outputting
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
602
|
+
for final and IE 10 versions of specification. Default is `true`.
|
|
603
|
+
* `grid` (false|"autoplace"|"no-autoplace"): should Autoprefixer
|
|
604
|
+
add IE 10-11 prefixes for Grid Layout properties?
|
|
605
|
+
* `false` (default): prevent Autoprefixer from outputting
|
|
606
|
+
CSS Grid translations.
|
|
607
|
+
* `"autoplace"`: enable Autoprefixer grid translations
|
|
608
|
+
and *include* autoplacement support. You can also use
|
|
609
|
+
`/* autoprefixer grid: autoplace */` in your CSS.
|
|
610
|
+
* `"no-autoplace"`: enable Autoprefixer grid translations
|
|
611
|
+
but *exclude* autoplacement support. You can also use
|
|
612
|
+
`/* autoprefixer grid: no-autoplace */` in your CSS.
|
|
604
613
|
(alias for the deprecated `true` value)
|
|
605
614
|
* `stats` (object): custom [usage statistics] for `> 10% in my stats`
|
|
606
615
|
browsers query.
|
|
@@ -813,11 +822,11 @@ so unfortunately this little snippet will _never_ be IE friendly.
|
|
|
813
822
|
|
|
814
823
|
#### No manual cell placement or column/row spans allowed inside an autoplacement grid
|
|
815
824
|
|
|
816
|
-
Elements must not be manually placed or given column/row spans inside
|
|
817
|
-
grid. Only the most basic of autoplacement grids are supported.
|
|
818
|
-
placed manually outside the the explicit grid though.
|
|
819
|
-
individual grid cells inside an explicit
|
|
820
|
-
future release.
|
|
825
|
+
Elements must not be manually placed or given column/row spans inside
|
|
826
|
+
an autoplacement grid. Only the most basic of autoplacement grids are supported.
|
|
827
|
+
Grid cells can still be placed manually outside the the explicit grid though.
|
|
828
|
+
Support for manually placing individual grid cells inside an explicit
|
|
829
|
+
autoplacement grid is planned for a future release.
|
|
821
830
|
|
|
822
831
|
```css
|
|
823
832
|
.autoplacement-grid {
|
package/lib/hacks/gradient.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
-
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
|
6
|
-
|
|
7
5
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
8
6
|
|
|
7
|
+
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
|
8
|
+
|
|
9
9
|
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; }
|
|
10
10
|
|
|
11
11
|
var OldValue = require('../old-value');
|
|
@@ -34,7 +34,7 @@ function (_Value) {
|
|
|
34
34
|
|
|
35
35
|
_this = _Value.call.apply(_Value, [this].concat(args)) || this;
|
|
36
36
|
|
|
37
|
-
_defineProperty(_assertThisInitialized(
|
|
37
|
+
_defineProperty(_assertThisInitialized(_this), "directions", {
|
|
38
38
|
top: 'bottom',
|
|
39
39
|
left: 'right',
|
|
40
40
|
bottom: 'top',
|
|
@@ -42,7 +42,7 @@ function (_Value) {
|
|
|
42
42
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
_defineProperty(_assertThisInitialized(
|
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "oldDirections", {
|
|
46
46
|
'top': 'left bottom, left top',
|
|
47
47
|
'left': 'right top, left top',
|
|
48
48
|
'bottom': 'left top, left bottom',
|
package/lib/hacks/grid-utils.js
CHANGED
|
@@ -541,8 +541,9 @@ function insertAreas(css, isDisabled) {
|
|
|
541
541
|
|
|
542
542
|
if (!rulesToInsert[lastArea]) {
|
|
543
543
|
rulesToInsert[lastArea] = {};
|
|
544
|
-
}
|
|
544
|
+
}
|
|
545
545
|
|
|
546
|
+
var lastRuleIsSet = false; // walk through every grid-template rule data
|
|
546
547
|
|
|
547
548
|
for (var _iterator2 = data.rules, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
|
548
549
|
var _ref9;
|
|
@@ -586,6 +587,7 @@ function insertAreas(css, isDisabled) {
|
|
|
586
587
|
}));
|
|
587
588
|
});
|
|
588
589
|
rulesToInsert[lastArea].lastRule = gridAreaRule;
|
|
590
|
+
lastRuleIsSet = true;
|
|
589
591
|
} else if (rule.hasDuplicates && !rule.params && !selectorIsComplex) {
|
|
590
592
|
(function () {
|
|
591
593
|
// grid-template has duplicates and not inside media rule
|
|
@@ -605,10 +607,11 @@ function insertAreas(css, isDisabled) {
|
|
|
605
607
|
}
|
|
606
608
|
|
|
607
609
|
rulesToInsert[lastArea].lastRule = cloned;
|
|
610
|
+
lastRuleIsSet = true;
|
|
608
611
|
})();
|
|
609
612
|
} else if (rule.hasDuplicates && !rule.params && selectorIsComplex && gridAreaRule.selector.includes(rule.selectors[0])) {
|
|
610
613
|
// grid-template has duplicates and not inside media rule
|
|
611
|
-
//
|
|
614
|
+
// and the selector is complex
|
|
612
615
|
gridAreaRule.walkDecls(/-ms-grid-(row|column)/, function (d) {
|
|
613
616
|
return d.remove();
|
|
614
617
|
});
|
|
@@ -648,9 +651,11 @@ function insertAreas(css, isDisabled) {
|
|
|
648
651
|
} else {
|
|
649
652
|
// store the rule to insert later
|
|
650
653
|
rulesToInsert[lastArea][rule.params].push(cloned);
|
|
651
|
-
}
|
|
654
|
+
} // set new rule as last rule ONLY if we didn't set lastRule for
|
|
655
|
+
// this grid-area before
|
|
656
|
+
|
|
652
657
|
|
|
653
|
-
if (
|
|
658
|
+
if (!lastRuleIsSet) {
|
|
654
659
|
rulesToInsert[lastArea].lastRule = gridAreaMedia || gridAreaRule;
|
|
655
660
|
}
|
|
656
661
|
})();
|
|
@@ -820,12 +825,10 @@ function getGridGap(decl) {
|
|
|
820
825
|
|
|
821
826
|
if (/^(grid-)?gap$/.test(prop)) {
|
|
822
827
|
var _parser$nodes = parser(value).nodes,
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
gap.row = row.value;
|
|
828
|
-
gap.column = column.value || row.value;
|
|
828
|
+
row = _parser$nodes[0],
|
|
829
|
+
column = _parser$nodes[2];
|
|
830
|
+
gap.row = row && parser.stringify(row);
|
|
831
|
+
gap.column = column ? parser.stringify(column) : gap.row;
|
|
829
832
|
}
|
|
830
833
|
|
|
831
834
|
if (/^(grid-)?row-gap$/.test(prop)) gap.row = value;
|
|
@@ -0,0 +1,106 @@
|
|
|
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 MaskComposite =
|
|
12
|
+
/*#__PURE__*/
|
|
13
|
+
function (_Declaration) {
|
|
14
|
+
_inheritsLoose(MaskComposite, _Declaration);
|
|
15
|
+
|
|
16
|
+
function MaskComposite() {
|
|
17
|
+
return _Declaration.apply(this, arguments) || this;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var _proto = MaskComposite.prototype;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Prefix mask-composite for webkit
|
|
24
|
+
*/
|
|
25
|
+
_proto.insert = function insert(decl, prefix, prefixes) {
|
|
26
|
+
var isCompositeProp = decl.prop === 'mask-composite';
|
|
27
|
+
var compositeValues;
|
|
28
|
+
|
|
29
|
+
if (isCompositeProp) {
|
|
30
|
+
compositeValues = decl.value.split(',');
|
|
31
|
+
} else {
|
|
32
|
+
compositeValues = decl.value.match(MaskComposite.regexp) || [];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
compositeValues = compositeValues.map(function (el) {
|
|
36
|
+
return el.trim();
|
|
37
|
+
}).filter(function (el) {
|
|
38
|
+
return el;
|
|
39
|
+
});
|
|
40
|
+
var hasCompositeValues = compositeValues.length;
|
|
41
|
+
var compositeDecl;
|
|
42
|
+
|
|
43
|
+
if (hasCompositeValues) {
|
|
44
|
+
compositeDecl = this.clone(decl);
|
|
45
|
+
compositeDecl.value = compositeValues.map(function (value) {
|
|
46
|
+
return MaskComposite.oldValues[value] || value;
|
|
47
|
+
}).join(', ');
|
|
48
|
+
|
|
49
|
+
if (compositeValues.includes('intersect')) {
|
|
50
|
+
compositeDecl.value += ', xor';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
compositeDecl.prop = prefix + 'mask-composite';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (isCompositeProp) {
|
|
57
|
+
if (!hasCompositeValues) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (this.needCascade(decl)) {
|
|
62
|
+
compositeDecl.raws.before = this.calcBefore(prefixes, decl, prefix);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return decl.parent.insertBefore(decl, compositeDecl);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var cloned = this.clone(decl);
|
|
69
|
+
cloned.prop = prefix + cloned.prop;
|
|
70
|
+
|
|
71
|
+
if (hasCompositeValues) {
|
|
72
|
+
cloned.value = cloned.value.replace(MaskComposite.regexp, '');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (this.needCascade(decl)) {
|
|
76
|
+
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
decl.parent.insertBefore(decl, cloned);
|
|
80
|
+
|
|
81
|
+
if (!hasCompositeValues) {
|
|
82
|
+
return decl;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (this.needCascade(decl)) {
|
|
86
|
+
compositeDecl.raws.before = this.calcBefore(prefixes, decl, prefix);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return decl.parent.insertBefore(decl, compositeDecl);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
return MaskComposite;
|
|
93
|
+
}(Declaration);
|
|
94
|
+
|
|
95
|
+
_defineProperty(MaskComposite, "names", ['mask', 'mask-composite']);
|
|
96
|
+
|
|
97
|
+
_defineProperty(MaskComposite, "oldValues", {
|
|
98
|
+
add: 'source-over',
|
|
99
|
+
substract: 'source-out',
|
|
100
|
+
intersect: 'source-in',
|
|
101
|
+
exclude: 'xor'
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
_defineProperty(MaskComposite, "regexp", new RegExp("\\s+(" + Object.keys(MaskComposite.oldValues).join('|') + ")\\b(?!\\))\\s*(?=[,])", 'ig'));
|
|
105
|
+
|
|
106
|
+
module.exports = MaskComposite;
|
package/lib/prefixes.js
CHANGED
|
@@ -39,6 +39,7 @@ Declaration.hack(require('./hacks/align-self'));
|
|
|
39
39
|
Declaration.hack(require('./hacks/appearance'));
|
|
40
40
|
Declaration.hack(require('./hacks/flex-basis'));
|
|
41
41
|
Declaration.hack(require('./hacks/mask-border'));
|
|
42
|
+
Declaration.hack(require('./hacks/mask-composite'));
|
|
42
43
|
Declaration.hack(require('./hacks/align-items'));
|
|
43
44
|
Declaration.hack(require('./hacks/flex-shrink'));
|
|
44
45
|
Declaration.hack(require('./hacks/break-props'));
|
package/lib/processor.js
CHANGED
|
@@ -204,6 +204,11 @@ function () {
|
|
|
204
204
|
word: 'auto-fill'
|
|
205
205
|
});
|
|
206
206
|
return undefined;
|
|
207
|
+
} else if (/^grid-template/.test(prop) && value.indexOf('[') !== -1) {
|
|
208
|
+
result.warn('Autoprefixer currently does not support line names. ' + 'Try using grid-template-areas instead.', {
|
|
209
|
+
node: decl,
|
|
210
|
+
word: '['
|
|
211
|
+
});
|
|
207
212
|
}
|
|
208
213
|
}
|
|
209
214
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autoprefixer",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.0",
|
|
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,8 +10,8 @@
|
|
|
10
10
|
"node": ">=6.0.0"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"browserslist": "^4.4.
|
|
14
|
-
"caniuse-lite": "^1.0.
|
|
13
|
+
"browserslist": "^4.4.2",
|
|
14
|
+
"caniuse-lite": "^1.0.30000947",
|
|
15
15
|
"normalize-range": "^0.1.2",
|
|
16
16
|
"num2fraction": "^1.2.2",
|
|
17
17
|
"postcss": "^7.0.14",
|