autoprefixer 7.0.1 → 7.1.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 CHANGED
@@ -1,6 +1,12 @@
1
1
  # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
+ ## 7.1 “Universitas litterarum”
5
+ * Add `unicode-bidi` support.
6
+ * Add `-webkit-appearance` support for Edge.
7
+ * Add `from` option to `info()`.
8
+ * Fix intrinsic widths prefixes in Grid Layout.
9
+
4
10
  ## 7.0.1
5
11
  * Fix Autoprefixer for old JS runtimes.
6
12
 
package/README.md CHANGED
@@ -227,15 +227,9 @@ wrote `-webkit-gradient` without W3C’s `gradient`,
227
227
  Autoprefixer will not add other prefixes.
228
228
 
229
229
  But [PostCSS] has a plugins to convert CSS to unprefixed state.
230
- Use them before Autoprefixer:
230
+ Use [postcss-unprefix] before Autoprefixer.
231
231
 
232
- * [postcss-unprefix]
233
- * [postcss-flexboxfixer]
234
- * [postcss-gradientfixer]
235
-
236
- [postcss-gradientfixer]: https://github.com/hallvors/postcss-gradientfixer
237
- [postcss-flexboxfixer]: https://github.com/hallvors/postcss-flexboxfixer
238
- [postcss-unprefix]: https://github.com/yisibl/postcss-unprefix
232
+ [postcss-unprefix]: https://github.com/gucong3000/postcss-unprefix
239
233
 
240
234
  #### Does Autoprefixer add `-epub-` prefix?
241
235
 
package/data/prefixes.js CHANGED
@@ -389,7 +389,7 @@ f(require('caniuse-lite/data/features/css3-tabsize.js'), function (browsers) {
389
389
  // Intrinsic & extrinsic sizing
390
390
  f(require('caniuse-lite/data/features/intrinsic-width.js'), function (browsers) {
391
391
  return prefix(['max-content', 'min-content', 'fit-content', 'fill', 'fill-available', 'stretch'], {
392
- props: ['width', 'min-width', 'max-width', 'height', 'min-height', 'max-height', 'inline-size', 'min-inline-size', 'max-inline-size', 'block-size', 'min-block-size', 'max-block-size'],
392
+ props: ['width', 'min-width', 'max-width', 'height', 'min-height', 'max-height', 'inline-size', 'min-inline-size', 'max-inline-size', 'block-size', 'min-block-size', 'max-block-size', 'grid-template', 'grid-template-rows', 'grid-template-columns'],
393
393
  feature: 'intrinsic-width',
394
394
  browsers: browsers
395
395
  });
@@ -568,7 +568,8 @@ f(logicalProps, { match: /x\s#2/ }, function (browsers) {
568
568
  });
569
569
 
570
570
  // CSS appearance
571
- f(require('caniuse-lite/data/features/css-appearance.js'), function (browsers) {
571
+ var appearance = require('caniuse-lite/data/features/css-appearance.js');
572
+ f(appearance, { match: /#2|x/ }, function (browsers) {
572
573
  return prefix(['appearance'], {
573
574
  feature: 'css-appearance',
574
575
  browsers: browsers
@@ -672,4 +673,31 @@ f(require('caniuse-lite/data/features/css-any-link.js'), function (browsers) {
672
673
  feature: 'css-any-link',
673
674
  browsers: browsers
674
675
  });
676
+ });
677
+
678
+ // unicode-bidi
679
+ var bidi = require('caniuse-lite/data/features/css-unicode-bidi.js');
680
+
681
+ f(bidi, function (browsers) {
682
+ return prefix(['isolate'], {
683
+ props: ['unicode-bidi'],
684
+ feature: 'css-unicode-bidi',
685
+ browsers: browsers
686
+ });
687
+ });
688
+
689
+ f(bidi, { match: /y x|a x #2/ }, function (browsers) {
690
+ return prefix(['plaintext'], {
691
+ props: ['unicode-bidi'],
692
+ feature: 'css-unicode-bidi',
693
+ browsers: browsers
694
+ });
695
+ });
696
+
697
+ f(bidi, { match: /y x/ }, function (browsers) {
698
+ return prefix(['isolate-override'], {
699
+ props: ['unicode-bidi'],
700
+ feature: 'css-unicode-bidi',
701
+ browsers: browsers
702
+ });
675
703
  });
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
+
5
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
6
+
7
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
8
+
9
+ var Declaration = require('../declaration');
10
+ var utils = require('../utils');
11
+
12
+ var Appearance = function (_Declaration) {
13
+ _inherits(Appearance, _Declaration);
14
+
15
+ function Appearance(name, prefixes, all) {
16
+ _classCallCheck(this, Appearance);
17
+
18
+ var _this = _possibleConstructorReturn(this, _Declaration.call(this, name, prefixes, all));
19
+
20
+ if (_this.prefixes) {
21
+ _this.prefixes = utils.uniq(_this.prefixes.map(function (i) {
22
+ if (i === '-ms-') {
23
+ return '-webkit-';
24
+ } else {
25
+ return i;
26
+ }
27
+ }));
28
+ }
29
+ return _this;
30
+ }
31
+
32
+ return Appearance;
33
+ }(Declaration);
34
+
35
+ Object.defineProperty(Appearance, 'names', {
36
+ enumerable: true,
37
+ writable: true,
38
+ value: ['appearance']
39
+ });
40
+
41
+
42
+ module.exports = Appearance;
@@ -9,51 +9,58 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
9
9
  var OldValue = require('../old-value');
10
10
  var Value = require('../value');
11
11
 
12
- var Stretch = function (_Value) {
13
- _inherits(Stretch, _Value);
12
+ function _regexp(name) {
13
+ return new RegExp('(^|[\\s,(])(' + name + '($|[\\s),]))', 'gi');
14
+ }
14
15
 
15
- function Stretch() {
16
- _classCallCheck(this, Stretch);
16
+ var Intrinsic = function (_Value) {
17
+ _inherits(Intrinsic, _Value);
18
+
19
+ function Intrinsic() {
20
+ _classCallCheck(this, Intrinsic);
17
21
 
18
22
  return _possibleConstructorReturn(this, _Value.apply(this, arguments));
19
23
  }
20
24
 
21
- /**
22
- * Different prefix for WebKit and Firefox
23
- */
24
- Stretch.prototype.replace = function replace(string, prefix) {
25
- if (prefix === '-moz-') {
25
+ Intrinsic.prototype.regexp = function regexp() {
26
+ if (!this.regexpCache) this.regexpCache = _regexp(this.name);
27
+ return this.regexpCache;
28
+ };
29
+
30
+ Intrinsic.prototype.isStretch = function isStretch() {
31
+ return this.name === 'stretch' || this.name === 'fill' || this.name === 'fill-available';
32
+ };
33
+
34
+ Intrinsic.prototype.replace = function replace(string, prefix) {
35
+ if (prefix === '-moz-' && this.isStretch()) {
26
36
  return string.replace(this.regexp(), '$1-moz-available$3');
27
- } else if (prefix === '-webkit-') {
37
+ } else if (prefix === '-webkit-' && this.isStretch()) {
28
38
  return string.replace(this.regexp(), '$1-webkit-fill-available$3');
29
39
  } else {
30
40
  return _Value.prototype.replace.call(this, string, prefix);
31
41
  }
32
42
  };
33
43
 
34
- /**
35
- * Different name for WebKit and Firefox
36
- */
37
-
38
-
39
- Stretch.prototype.old = function old(prefix) {
40
- if (prefix === '-moz-') {
41
- return new OldValue(this.name, '-moz-available');
42
- } else if (prefix === '-webkit-') {
43
- return new OldValue(this.name, '-webkit-fill-available');
44
- } else {
45
- return _Value.prototype.old.call(this, prefix);
44
+ Intrinsic.prototype.old = function old(prefix) {
45
+ var prefixed = prefix + this.name;
46
+ if (this.isStretch()) {
47
+ if (prefix === '-moz-') {
48
+ prefixed = '-moz-available';
49
+ } else if (prefix === '-webkit-') {
50
+ prefixed = '-webkit-fill-available';
51
+ }
46
52
  }
53
+ return new OldValue(this.name, prefixed, prefixed, _regexp(prefixed));
47
54
  };
48
55
 
49
- return Stretch;
56
+ return Intrinsic;
50
57
  }(Value);
51
58
 
52
- Object.defineProperty(Stretch, 'names', {
59
+ Object.defineProperty(Intrinsic, 'names', {
53
60
  enumerable: true,
54
61
  writable: true,
55
- value: ['stretch', 'fill', 'fill-available']
62
+ value: ['max-content', 'min-content', 'fit-content', 'fill', 'fill-available', 'stretch']
56
63
  });
57
64
 
58
65
 
59
- module.exports = Stretch;
66
+ module.exports = Intrinsic;
@@ -19,7 +19,7 @@ var OldSelector = function () {
19
19
  }
20
20
 
21
21
  /**
22
- * Is rule is hack without unprefixed version bottom
22
+ * Is rule a hack without unprefixed version bottom
23
23
  */
24
24
 
25
25
 
@@ -71,7 +71,7 @@ var OldSelector = function () {
71
71
  };
72
72
 
73
73
  /**
74
- * Does rule contain unnecessayr prefixed selector
74
+ * Does rule contain an unnecessary prefixed selector
75
75
  */
76
76
 
77
77
 
package/lib/prefixes.js CHANGED
@@ -27,6 +27,7 @@ Declaration.hack(require('./hacks/flex-grow'));
27
27
  Declaration.hack(require('./hacks/flex-wrap'));
28
28
  Declaration.hack(require('./hacks/grid-start'));
29
29
  Declaration.hack(require('./hacks/align-self'));
30
+ Declaration.hack(require('./hacks/appearance'));
30
31
  Declaration.hack(require('./hacks/flex-basis'));
31
32
  Declaration.hack(require('./hacks/mask-border'));
32
33
  Declaration.hack(require('./hacks/align-items'));
@@ -48,8 +49,8 @@ Declaration.hack(require('./hacks/justify-content'));
48
49
  Declaration.hack(require('./hacks/background-size'));
49
50
  Declaration.hack(require('./hacks/text-emphasis-position'));
50
51
 
51
- Value.hack(require('./hacks/stretch'));
52
52
  Value.hack(require('./hacks/gradient'));
53
+ Value.hack(require('./hacks/intrinsic'));
53
54
  Value.hack(require('./hacks/pixelated'));
54
55
  Value.hack(require('./hacks/image-set'));
55
56
  Value.hack(require('./hacks/cross-fade'));
package/lib/processor.js CHANGED
@@ -31,19 +31,19 @@ var Processor = function () {
31
31
 
32
32
  css.walkAtRules(function (rule) {
33
33
  if (rule.name === 'keyframes') {
34
- if (!_this.disabledForAdd(rule)) {
34
+ if (!_this.disabled(rule)) {
35
35
  return keyframes && keyframes.process(rule);
36
36
  }
37
37
  } else if (rule.name === 'viewport') {
38
- if (!_this.disabledForAdd(rule)) {
38
+ if (!_this.disabled(rule)) {
39
39
  return viewport && viewport.process(rule);
40
40
  }
41
41
  } else if (rule.name === 'supports') {
42
- if (_this.prefixes.options.supports !== false && !_this.disabledForAdd(rule)) {
42
+ if (_this.prefixes.options.supports !== false && !_this.disabled(rule)) {
43
43
  return supports.process(rule);
44
44
  }
45
45
  } else if (rule.name === 'media' && rule.params.indexOf('-resolution') !== -1) {
46
- if (!_this.disabledForAdd(rule)) {
46
+ if (!_this.disabled(rule)) {
47
47
  return resolution && resolution.process(rule);
48
48
  }
49
49
  }
@@ -53,7 +53,7 @@ var Processor = function () {
53
53
 
54
54
  // Selectors
55
55
  css.walkRules(function (rule) {
56
- if (_this.disabledForAdd(rule)) return undefined;
56
+ if (_this.disabled(rule)) return undefined;
57
57
 
58
58
  return _this.prefixes.add.selectors.map(function (selector) {
59
59
  return selector.process(rule, result);
@@ -61,7 +61,7 @@ var Processor = function () {
61
61
  });
62
62
 
63
63
  css.walkDecls(function (decl) {
64
- if (_this.disabledForAdd(decl)) return undefined;
64
+ if (_this.disabledDecl(decl)) return undefined;
65
65
 
66
66
  if (decl.prop === 'display' && decl.value === 'box') {
67
67
  result.warn('You should write display: flex by final spec ' + 'instead of display: box', { node: decl });
@@ -139,7 +139,7 @@ var Processor = function () {
139
139
 
140
140
  // Values
141
141
  return css.walkDecls(function (decl) {
142
- if (_this.disabledForAdd(decl)) return;
142
+ if (_this.disabledValue(decl)) return;
143
143
 
144
144
  var unprefixed = _this.prefixes.unprefixed(decl.prop);
145
145
  for (var _iterator = _this.prefixes.values('add', unprefixed), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
@@ -175,7 +175,7 @@ var Processor = function () {
175
175
 
176
176
  css.walkAtRules(function (rule, i) {
177
177
  if (_this2.prefixes.remove['@' + rule.name]) {
178
- if (!_this2.disabledForRemove(rule)) {
178
+ if (!_this2.disabled(rule)) {
179
179
  rule.parent.removeChild(i);
180
180
  }
181
181
  } else if (rule.name === 'media' && rule.params.indexOf('-resolution') !== -1 && resolution) {
@@ -188,7 +188,7 @@ var Processor = function () {
188
188
  var _loop = function _loop(checker) {
189
189
  css.walkRules(function (rule, i) {
190
190
  if (checker.check(rule)) {
191
- if (!_this2.disabledForRemove(rule)) {
191
+ if (!_this2.disabled(rule)) {
192
192
  rule.parent.removeChild(i);
193
193
  }
194
194
  }
@@ -213,7 +213,7 @@ var Processor = function () {
213
213
  }
214
214
 
215
215
  return css.walkDecls(function (decl, i) {
216
- if (_this2.disabledForRemove(decl)) return;
216
+ if (_this2.disabled(decl)) return;
217
217
 
218
218
  var rule = decl.parent;
219
219
  var unprefixed = _this2.prefixes.unprefixed(decl.prop);
@@ -289,26 +289,40 @@ var Processor = function () {
289
289
  */
290
290
 
291
291
 
292
- Processor.prototype.disabledForAdd = function disabledForAdd(node) {
292
+ Processor.prototype.disabledValue = function disabledValue(node) {
293
293
  if (this.prefixes.options.grid === false && node.type === 'decl') {
294
294
  if (node.prop === 'display' && node.value.indexOf('grid') !== -1) {
295
295
  return true;
296
296
  }
297
- if (node.prop.indexOf('grid') !== -1 || node.prop === 'justify-items') {
298
- return true;
299
- }
300
297
  }
301
298
  if (this.prefixes.options.flexbox === false && node.type === 'decl') {
302
299
  if (node.prop === 'display' && node.value.indexOf('flex') !== -1) {
303
300
  return true;
304
301
  }
302
+ }
303
+
304
+ return this.disabled(node);
305
+ };
306
+
307
+ /**
308
+ * Check for grid/flexbox options.
309
+ */
310
+
311
+
312
+ Processor.prototype.disabledDecl = function disabledDecl(node) {
313
+ if (this.prefixes.options.grid === false && node.type === 'decl') {
314
+ if (node.prop.indexOf('grid') !== -1 || node.prop === 'justify-items') {
315
+ return true;
316
+ }
317
+ }
318
+ if (this.prefixes.options.flexbox === false && node.type === 'decl') {
305
319
  var other = ['order', 'justify-content', 'align-items', 'align-content'];
306
320
  if (node.prop.indexOf('flex') !== -1 || other.indexOf(node.prop) !== -1) {
307
321
  return true;
308
322
  }
309
323
  }
310
324
 
311
- return this.disabledForRemove(node);
325
+ return this.disabled(node);
312
326
  };
313
327
 
314
328
  /**
@@ -316,7 +330,7 @@ var Processor = function () {
316
330
  */
317
331
 
318
332
 
319
- Processor.prototype.disabledForRemove = function disabledForRemove(node) {
333
+ Processor.prototype.disabled = function disabled(node) {
320
334
  if (node._autoprefixerDisabled !== undefined) {
321
335
  return node._autoprefixerDisabled;
322
336
  } else if (node.nodes) {
@@ -339,13 +353,13 @@ var Processor = function () {
339
353
  if (status !== undefined) {
340
354
  result = !status;
341
355
  } else if (node.parent) {
342
- result = this.disabledForRemove(node.parent);
356
+ result = this.disabled(node.parent);
343
357
  }
344
358
 
345
359
  node._autoprefixerDisabled = result;
346
360
  return node._autoprefixerDisabled;
347
361
  } else if (node.parent) {
348
- node._autoprefixerDisabled = this.disabledForRemove(node.parent);
362
+ node._autoprefixerDisabled = this.disabled(node.parent);
349
363
  return node._autoprefixerDisabled;
350
364
  } else {
351
365
  // unknown state
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autoprefixer",
3
- "version": "7.0.1",
3
+ "version": "7.1.0",
4
4
  "description": "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website",
5
5
  "keywords": [
6
6
  "autoprefixer",
@@ -14,7 +14,7 @@
14
14
  "repository": "postcss/autoprefixer",
15
15
  "dependencies": {
16
16
  "browserslist": "^2.1.2",
17
- "caniuse-lite": "^1.0.30000665",
17
+ "caniuse-lite": "^1.0.30000669",
18
18
  "normalize-range": "^0.1.2",
19
19
  "num2fraction": "^1.2.2",
20
20
  "postcss": "^6.0.1",
@@ -31,11 +31,9 @@
31
31
  "gulp": "^3.9.1",
32
32
  "gulp-babel": "^6.1.2",
33
33
  "gulp-coffee": "^2.3.4",
34
- "gulp-eslint": "^3.0.1",
35
- "gulp-jest": "^1.0.0",
36
34
  "gulp-json-editor": "^2.2.1",
37
35
  "gulp-replace": "^0.5.4",
38
- "jest": "^19.0.2",
36
+ "jest": "^20.0.1",
39
37
  "lint-staged": "^3.4.1",
40
38
  "pre-commit": "^1.2.2",
41
39
  "vinyl-source-stream": "^1.1.0",
@@ -43,7 +41,8 @@
43
41
  },
44
42
  "scripts": {
45
43
  "lint-staged": "lint-staged",
46
- "test": "gulp"
44
+ "lint": "eslint *.js lib/*.js data/*.js test/*.js",
45
+ "test": "jest && npm run lint && gulp"
47
46
  },
48
47
  "lint-staged": {
49
48
  "*.js": "eslint"