autoprefixer 9.0.2 → 9.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,10 @@
1
1
  # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
+ ## 9.1 “Equality before the law”
5
+ * Add `background-clip: text` support.
6
+ * Fix adding Grid span for IE (by Bogdan).
7
+
4
8
  ## 9.0.2
5
9
  * Show warning on Grid area names conflict (by Bogdan).
6
10
  * Fix documentation (by Sven Wagner).
package/data/prefixes.js CHANGED
@@ -294,12 +294,20 @@ f(require('caniuse-lite/data/features/calc'), function (browsers) {
294
294
 
295
295
  // Background options
296
296
  f(require('caniuse-lite/data/features/background-img-opts'), function (browsers) {
297
- return prefix(['background-clip', 'background-origin', 'background-size'], {
297
+ return prefix(['background-origin', 'background-size'], {
298
298
  feature: 'background-img-opts',
299
299
  browsers: browsers
300
300
  });
301
301
  });
302
302
 
303
+ // background-clip: text
304
+ f(require('caniuse-lite/data/features/background-clip-text'), function (browsers) {
305
+ return prefix(['background-clip'], {
306
+ feature: 'background-clip-text',
307
+ browsers: browsers
308
+ });
309
+ });
310
+
303
311
  // Font feature settings
304
312
  f(require('caniuse-lite/data/features/font-feature'), function (browsers) {
305
313
  return prefix(['font-feature-settings', 'font-variant-ligatures', 'font-language-override'], {
@@ -78,8 +78,7 @@ Object.defineProperty(AlignContent, 'oldValues', {
78
78
  'flex-end': 'end',
79
79
  'flex-start': 'start',
80
80
  'space-between': 'justify',
81
- 'space-around': 'distribute'
82
- }
81
+ 'space-around': 'distribute' }
83
82
  });
84
83
 
85
84
 
@@ -75,8 +75,7 @@ Object.defineProperty(AlignItems, 'oldValues', {
75
75
  writable: true,
76
76
  value: {
77
77
  'flex-end': 'end',
78
- 'flex-start': 'start'
79
- }
78
+ 'flex-start': 'start' }
80
79
  });
81
80
 
82
81
 
@@ -76,8 +76,7 @@ Object.defineProperty(AlignSelf, 'oldValues', {
76
76
  writable: true,
77
77
  value: {
78
78
  'flex-end': 'end',
79
- 'flex-start': 'start'
80
- }
79
+ 'flex-start': 'start' }
81
80
  });
82
81
 
83
82
 
@@ -0,0 +1,48 @@
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+
7
+ 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; }
8
+
9
+ 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) : _defaults(subClass, superClass); }
10
+
11
+ var Declaration = require('../declaration');
12
+ var utils = require('../utils');
13
+
14
+ var BackgroundClip = function (_Declaration) {
15
+ _inherits(BackgroundClip, _Declaration);
16
+
17
+ function BackgroundClip(name, prefixes, all) {
18
+ _classCallCheck(this, BackgroundClip);
19
+
20
+ var _this = _possibleConstructorReturn(this, _Declaration.call(this, name, prefixes, all));
21
+
22
+ if (_this.prefixes) {
23
+ _this.prefixes = utils.uniq(_this.prefixes.map(function (i) {
24
+ if (i === '-ms-') {
25
+ return '-webkit-';
26
+ } else {
27
+ return i;
28
+ }
29
+ }));
30
+ }
31
+ return _this;
32
+ }
33
+
34
+ BackgroundClip.prototype.check = function check(decl) {
35
+ return decl.value.toLowerCase() === 'text';
36
+ };
37
+
38
+ return BackgroundClip;
39
+ }(Declaration);
40
+
41
+ Object.defineProperty(BackgroundClip, 'names', {
42
+ enumerable: true,
43
+ writable: true,
44
+ value: ['background-clip']
45
+ });
46
+
47
+
48
+ module.exports = BackgroundClip;
@@ -11,29 +11,29 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
11
11
  var Declaration = require('../declaration');
12
12
 
13
13
  var Filter = function (_Declaration) {
14
- _inherits(Filter, _Declaration);
14
+ _inherits(Filter, _Declaration);
15
15
 
16
- function Filter() {
17
- _classCallCheck(this, Filter);
16
+ function Filter() {
17
+ _classCallCheck(this, Filter);
18
18
 
19
- return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
20
- }
19
+ return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
20
+ }
21
21
 
22
- /**
23
- * Check is it Internet Explorer filter
24
- */
25
- Filter.prototype.check = function check(decl) {
26
- var v = decl.value;
27
- return v.toLowerCase().indexOf('alpha(') === -1 && v.indexOf('DXImageTransform.Microsoft') === -1 && v.indexOf('data:image/svg+xml') === -1;
28
- };
22
+ /**
23
+ * Check is it Internet Explorer filter
24
+ */
25
+ Filter.prototype.check = function check(decl) {
26
+ var v = decl.value;
27
+ return v.toLowerCase().indexOf('alpha(') === -1 && v.indexOf('DXImageTransform.Microsoft') === -1 && v.indexOf('data:image/svg+xml') === -1;
28
+ };
29
29
 
30
- return Filter;
30
+ return Filter;
31
31
  }(Declaration);
32
32
 
33
33
  Object.defineProperty(Filter, 'names', {
34
- enumerable: true,
35
- writable: true,
36
- value: ['filter']
34
+ enumerable: true,
35
+ writable: true,
36
+ value: ['filter']
37
37
  });
38
38
 
39
39
 
package/lib/hacks/flex.js CHANGED
@@ -83,8 +83,7 @@ Object.defineProperty(Flex, 'oldValues', {
83
83
  writable: true,
84
84
  value: {
85
85
  auto: '1',
86
- none: '0'
87
- }
86
+ none: '0' }
88
87
  });
89
88
 
90
89
 
@@ -37,6 +37,8 @@ var Gradient = function (_Value) {
37
37
  left: 'right',
38
38
  bottom: 'top',
39
39
  right: 'left'
40
+
41
+ // Direction to replace
40
42
  }
41
43
  }), Object.defineProperty(_this, 'oldDirections', {
42
44
  enumerable: true,
@@ -55,6 +57,10 @@ var Gradient = function (_Value) {
55
57
  'bottom left': 'right top, left bottom',
56
58
  'left top': 'right bottom, left top',
57
59
  'left bottom': 'right top, left bottom'
60
+
61
+ /**
62
+ * Change degrees for webkit prefix
63
+ */
58
64
  }
59
65
  }), _temp), _possibleConstructorReturn(_this, _ret);
60
66
  }
@@ -62,12 +68,6 @@ var Gradient = function (_Value) {
62
68
  // Direction to replace
63
69
 
64
70
 
65
- // Direction to replace
66
-
67
-
68
- /**
69
- * Change degrees for webkit prefix
70
- */
71
71
  Gradient.prototype.replace = function replace(string, prefix) {
72
72
  var ast = parser(string);
73
73
  for (var _iterator = ast.nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
@@ -367,17 +367,27 @@ function parseTemplate(_ref8) {
367
367
 
368
368
  // Insert parsed grid areas
369
369
 
370
+ /**
371
+ * Get an array of -ms- prefixed props and values
372
+ * @param {Object} [area] area object with columm and row data
373
+ * @param {Boolean} [addRowSpan] should we add grid-column-row value?
374
+ * @param {Boolean} [addColumnSpan] should we add grid-column-span value?
375
+ * @return {Array<Object>}
376
+ */
370
377
  function getMSDecls(area) {
378
+ var addRowSpan = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
379
+ var addColumnSpan = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
380
+
371
381
  return [].concat({
372
382
  prop: '-ms-grid-row',
373
383
  value: String(area.row.start)
374
- }, area.row.span > 1 ? {
384
+ }, area.row.span > 1 || addRowSpan ? {
375
385
  prop: '-ms-grid-row-span',
376
386
  value: String(area.row.span)
377
387
  } : [], {
378
388
  prop: '-ms-grid-column',
379
389
  value: String(area.column.start)
380
- }, area.column.span > 1 ? {
390
+ }, area.column.span > 1 || addColumnSpan ? {
381
391
  prop: '-ms-grid-column-span',
382
392
  value: String(area.column.span)
383
393
  } : []);
@@ -392,6 +402,44 @@ function getParentMedia(parent) {
392
402
  return getParentMedia(parent.parent);
393
403
  }
394
404
 
405
+ /**
406
+ * Check grid-template(-areas) rules with the same selector for
407
+ * -ms-grid-(row|column)-span values. If initial and compared values are
408
+ * different - return an array of boolean values which need to be updated
409
+ * @param {Declaration} decl
410
+ * @param {Object} area area object with column and row data
411
+ * @param {String} areaName area name (e.g. "head")
412
+ * @return {Array<Boolean, Boolean>}
413
+ */
414
+ function shouldAddSpan(decl, area, areaName) {
415
+ var root = decl.root();
416
+ var rule = decl.parent;
417
+ var overrideValues = [false, false];
418
+
419
+ root.walkRules(rule.selector, function (node) {
420
+ // abort if we are on the same rule
421
+ if (rule.toString() === node.toString()) {
422
+ return false;
423
+ }
424
+
425
+ node.walkDecls('grid-template', function (d) {
426
+ var template = parseTemplate({ decl: d, gap: getGridGap(d) });
427
+ var comparedArea = template.areas[areaName];
428
+ if (area.row.span !== comparedArea.row.span) {
429
+ overrideValues[0] = true;
430
+ } else if (area.column.span !== comparedArea.column.span) {
431
+ overrideValues[1] = true;
432
+ }
433
+
434
+ return undefined;
435
+ });
436
+
437
+ return undefined;
438
+ });
439
+
440
+ return overrideValues;
441
+ }
442
+
395
443
  function insertAreas(areas, decl, result) {
396
444
  var missed = Object.keys(areas);
397
445
 
@@ -416,7 +464,12 @@ function insertAreas(areas, decl, result) {
416
464
  rule.removeAll();
417
465
 
418
466
  // insert prefixed decls in new rule
419
- getMSDecls(area).forEach(function (i) {
467
+
468
+ var _shouldAddSpan = shouldAddSpan(decl, area, value),
469
+ addRowSpan = _shouldAddSpan[0],
470
+ addColumnSpan = _shouldAddSpan[1];
471
+
472
+ getMSDecls(area, addRowSpan, addColumnSpan).forEach(function (i) {
420
473
  return rule.append(Object.assign(i, {
421
474
  raws: {
422
475
  between: gridArea.raws.between
@@ -83,8 +83,7 @@ Object.defineProperty(JustifyContent, 'oldValues', {
83
83
  'flex-end': 'end',
84
84
  'flex-start': 'start',
85
85
  'space-between': 'justify',
86
- 'space-around': 'distribute'
87
- }
86
+ 'space-around': 'distribute' }
88
87
  });
89
88
 
90
89
 
package/lib/prefixes.js CHANGED
@@ -46,6 +46,7 @@ Declaration.hack(require('./hacks/grid-row-align'));
46
46
  Declaration.hack(require('./hacks/transform-decl'));
47
47
  Declaration.hack(require('./hacks/flex-direction'));
48
48
  Declaration.hack(require('./hacks/image-rendering'));
49
+ Declaration.hack(require('./hacks/background-clip'));
49
50
  Declaration.hack(require('./hacks/text-decoration'));
50
51
  Declaration.hack(require('./hacks/justify-content'));
51
52
  Declaration.hack(require('./hacks/background-size'));
package/package.json CHANGED
@@ -1,18 +1,17 @@
1
1
  {
2
2
  "name": "autoprefixer",
3
- "version": "9.0.2",
3
+ "version": "9.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": ["autoprefixer", "css", "prefix", "postcss", "postcss-plugin"],
6
6
  "author": "Andrey Sitnik <andrey@sitnik.ru>",
7
7
  "license": "MIT",
8
8
  "repository": "postcss/autoprefixer",
9
- "homepage": "https://github.com/postcss/autoprefixer#readme",
10
9
  "engines": {
11
10
  "node": ">=6.0.0"
12
11
  },
13
12
  "dependencies": {
14
13
  "browserslist": "^4.0.1",
15
- "caniuse-lite": "^1.0.30000865",
14
+ "caniuse-lite": "^1.0.30000872",
16
15
  "normalize-range": "^0.1.2",
17
16
  "num2fraction": "^1.2.2",
18
17
  "postcss": "^7.0.2",