autoprefixer 6.7.6 → 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.
Files changed (66) hide show
  1. package/AUTHORS +1 -0
  2. package/CHANGELOG.md +23 -0
  3. package/README.md +10 -16
  4. package/data/prefixes.js +551 -517
  5. package/lib/at-rule.js +55 -38
  6. package/lib/autoprefixer.js +89 -63
  7. package/lib/brackets.js +59 -39
  8. package/lib/browsers.js +102 -65
  9. package/lib/declaration.js +212 -121
  10. package/lib/hacks/align-content.js +65 -38
  11. package/lib/hacks/align-items.js +62 -38
  12. package/lib/hacks/align-self.js +63 -36
  13. package/lib/hacks/appearance.js +42 -0
  14. package/lib/hacks/background-size.js +29 -20
  15. package/lib/hacks/block-logical.js +36 -21
  16. package/lib/hacks/border-image.js +26 -16
  17. package/lib/hacks/border-radius.js +60 -39
  18. package/lib/hacks/break-props.js +69 -44
  19. package/lib/hacks/cross-fade.js +40 -37
  20. package/lib/hacks/display-flex.js +81 -31
  21. package/lib/hacks/display-grid.js +29 -19
  22. package/lib/hacks/filter-value.js +66 -45
  23. package/lib/hacks/filter.js +26 -17
  24. package/lib/hacks/flex-basis.js +60 -30
  25. package/lib/hacks/flex-direction.js +85 -53
  26. package/lib/hacks/flex-flow.js +67 -49
  27. package/lib/hacks/flex-grow.js +45 -26
  28. package/lib/hacks/flex-shrink.js +60 -30
  29. package/lib/hacks/flex-spec.js +18 -8
  30. package/lib/hacks/flex-values.js +39 -20
  31. package/lib/hacks/flex-wrap.js +29 -20
  32. package/lib/hacks/flex.js +68 -43
  33. package/lib/hacks/fullscreen.js +31 -21
  34. package/lib/hacks/gradient.js +462 -302
  35. package/lib/hacks/grid-column-align.js +55 -0
  36. package/lib/hacks/grid-end.js +53 -28
  37. package/lib/hacks/grid-row-align.js +39 -19
  38. package/lib/hacks/grid-start.js +80 -48
  39. package/lib/hacks/grid-template.js +91 -55
  40. package/lib/hacks/image-rendering.js +63 -33
  41. package/lib/hacks/image-set.js +28 -20
  42. package/lib/hacks/inline-logical.js +32 -17
  43. package/lib/hacks/intrinsic.js +66 -0
  44. package/lib/hacks/justify-content.js +69 -42
  45. package/lib/hacks/mask-border.js +36 -21
  46. package/lib/hacks/order.js +58 -35
  47. package/lib/hacks/pixelated.js +44 -30
  48. package/lib/hacks/placeholder.js +40 -25
  49. package/lib/hacks/text-emphasis-position.js +27 -20
  50. package/lib/hacks/transform-decl.js +94 -52
  51. package/lib/hacks/writing-mode.js +37 -27
  52. package/lib/info.js +117 -78
  53. package/lib/old-selector.js +84 -58
  54. package/lib/old-value.js +22 -20
  55. package/lib/prefixer.js +164 -95
  56. package/lib/prefixes.js +446 -351
  57. package/lib/processor.js +394 -278
  58. package/lib/resolution.js +135 -75
  59. package/lib/selector.js +145 -84
  60. package/lib/supports.js +330 -210
  61. package/lib/transition.js +396 -243
  62. package/lib/utils.js +84 -48
  63. package/lib/value.js +118 -80
  64. package/package.json +54 -14
  65. package/lib/hacks/justify-items.js +0 -31
  66. package/lib/hacks/stretch.js +0 -45
package/lib/prefixer.js CHANGED
@@ -1,121 +1,190 @@
1
- (function() {
2
- var Browsers, Prefixer, clone, utils, vendor,
3
- hasProp = {}.hasOwnProperty;
1
+ 'use strict';
4
2
 
5
- Browsers = require('./browsers');
3
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
6
4
 
7
- utils = require('./utils');
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
6
 
9
- vendor = require('postcss/lib/vendor');
7
+ var Browsers = require('./browsers');
8
+ var utils = require('./utils');
10
9
 
11
- clone = function(obj, parent) {
12
- var cloned, i, value;
13
- cloned = new obj.constructor();
14
- for (i in obj) {
15
- if (!hasProp.call(obj, i)) continue;
16
- value = obj[i];
17
- if (i === 'parent' && typeof value === 'object') {
18
- if (parent) {
19
- cloned[i] = parent;
10
+ var vendor = require('postcss/lib/vendor');
11
+
12
+ /**
13
+ * Recursivly clone objects
14
+ */
15
+ function _clone(obj, parent) {
16
+ var cloned = new obj.constructor();
17
+
18
+ for (var _iterator = Object.keys(obj || {}), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
19
+ var _ref;
20
+
21
+ if (_isArray) {
22
+ if (_i >= _iterator.length) break;
23
+ _ref = _iterator[_i++];
24
+ } else {
25
+ _i = _iterator.next();
26
+ if (_i.done) break;
27
+ _ref = _i.value;
20
28
  }
21
- } else if (i === 'source') {
22
- cloned[i] = value;
23
- } else if (i === null) {
24
- cloned[i] = value;
25
- } else if (value instanceof Array) {
26
- cloned[i] = value.map(function(i) {
27
- return clone(i, cloned);
28
- });
29
- } else if (i !== '_autoprefixerPrefix' && i !== '_autoprefixerValues') {
30
- if (typeof value === 'object' && value !== null) {
31
- value = clone(value, cloned);
29
+
30
+ var i = _ref;
31
+
32
+ var value = obj[i];
33
+ if (i === 'parent' && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
34
+ if (parent) {
35
+ cloned[i] = parent;
36
+ }
37
+ } else if (i === 'source') {
38
+ cloned[i] = value;
39
+ } else if (i === null) {
40
+ cloned[i] = value;
41
+ } else if (value instanceof Array) {
42
+ cloned[i] = value.map(function (x) {
43
+ return _clone(x, cloned);
44
+ });
45
+ } else if (i !== '_autoprefixerPrefix' && i !== '_autoprefixerValues') {
46
+ if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value !== null) {
47
+ value = _clone(value, cloned);
48
+ }
49
+ cloned[i] = value;
32
50
  }
33
- cloned[i] = value;
34
- }
35
51
  }
52
+
36
53
  return cloned;
37
- };
38
-
39
- Prefixer = (function() {
40
- Prefixer.hack = function(klass) {
41
- var j, len, name, ref, results;
42
- this.hacks || (this.hacks = {});
43
- ref = klass.names;
44
- results = [];
45
- for (j = 0, len = ref.length; j < len; j++) {
46
- name = ref[j];
47
- results.push(this.hacks[name] = klass);
48
- }
49
- return results;
54
+ }
55
+
56
+ var Prefixer = function () {
57
+
58
+ /**
59
+ * Add hack to selected names
60
+ */
61
+ Prefixer.hack = function hack(klass) {
62
+ var _this = this;
63
+
64
+ if (!this.hacks) {
65
+ this.hacks = {};
66
+ }
67
+ return klass.names.map(function (name) {
68
+ _this.hacks[name] = klass;
69
+ return _this.hacks[name];
70
+ });
50
71
  };
51
72
 
52
- Prefixer.load = function(name, prefixes, all) {
53
- var klass, ref;
54
- klass = (ref = this.hacks) != null ? ref[name] : void 0;
55
- if (klass) {
56
- return new klass(name, prefixes, all);
57
- } else {
58
- return new this(name, prefixes, all);
59
- }
73
+ /**
74
+ * Load hacks for some names
75
+ */
76
+
77
+
78
+ Prefixer.load = function load(name, prefixes, all) {
79
+ var Klass = this.hacks && this.hacks[name];
80
+ if (Klass) {
81
+ return new Klass(name, prefixes, all);
82
+ } else {
83
+ return new this(name, prefixes, all);
84
+ }
60
85
  };
61
86
 
62
- Prefixer.clone = function(node, overrides) {
63
- var cloned, name;
64
- cloned = clone(node);
65
- for (name in overrides) {
66
- cloned[name] = overrides[name];
67
- }
68
- return cloned;
87
+ /**
88
+ * Clone node and clean autprefixer custom caches
89
+ */
90
+
91
+
92
+ Prefixer.clone = function clone(node, overrides) {
93
+ var cloned = _clone(node);
94
+ for (var name in overrides) {
95
+ cloned[name] = overrides[name];
96
+ }
97
+ return cloned;
69
98
  };
70
99
 
71
- function Prefixer(name1, prefixes1, all1) {
72
- this.name = name1;
73
- this.prefixes = prefixes1;
74
- this.all = all1;
100
+ function Prefixer(name, prefixes, all) {
101
+ _classCallCheck(this, Prefixer);
102
+
103
+ this.name = name;
104
+ this.prefixes = prefixes;
105
+ this.all = all;
75
106
  }
76
107
 
77
- Prefixer.prototype.parentPrefix = function(node) {
78
- var prefix;
79
- prefix = node._autoprefixerPrefix != null ? node._autoprefixerPrefix : node.type === 'decl' && node.prop[0] === '-' ? vendor.prefix(node.prop) : node.type === 'root' ? false : node.type === 'rule' && node.selector.indexOf(':-') !== -1 && /:(-\w+-)/.test(node.selector) ? node.selector.match(/:(-\w+-)/)[1] : node.type === 'atrule' && node.name[0] === '-' ? vendor.prefix(node.name) : this.parentPrefix(node.parent);
80
- if (Browsers.prefixes().indexOf(prefix) === -1) {
81
- prefix = false;
82
- }
83
- return node._autoprefixerPrefix = prefix;
84
- };
108
+ /**
109
+ * Find prefix in node parents
110
+ */
111
+
85
112
 
86
- Prefixer.prototype.process = function(node) {
87
- var added, j, k, len, len1, parent, prefix, prefixes, ref;
88
- if (!this.check(node)) {
89
- return;
90
- }
91
- parent = this.parentPrefix(node);
92
- prefixes = [];
93
- ref = this.prefixes;
94
- for (j = 0, len = ref.length; j < len; j++) {
95
- prefix = ref[j];
96
- if (parent && parent !== utils.removeNote(prefix)) {
97
- continue;
113
+ Prefixer.prototype.parentPrefix = function parentPrefix(node) {
114
+ var prefix = void 0;
115
+
116
+ if (typeof node._autoprefixerPrefix !== 'undefined') {
117
+ prefix = node._autoprefixerPrefix;
118
+ } else if (node.type === 'decl' && node.prop[0] === '-') {
119
+ prefix = vendor.prefix(node.prop);
120
+ } else if (node.type === 'root') {
121
+ prefix = false;
122
+ } else if (node.type === 'rule' && node.selector.indexOf(':-') !== -1 && /:(-\w+-)/.test(node.selector)) {
123
+ prefix = node.selector.match(/:(-\w+-)/)[1];
124
+ } else if (node.type === 'atrule' && node.name[0] === '-') {
125
+ prefix = vendor.prefix(node.name);
126
+ } else {
127
+ prefix = this.parentPrefix(node.parent);
98
128
  }
99
- prefixes.push(prefix);
100
- }
101
- added = [];
102
- for (k = 0, len1 = prefixes.length; k < len1; k++) {
103
- prefix = prefixes[k];
104
- if (this.add(node, prefix, added.concat([prefix]))) {
105
- added.push(prefix);
129
+
130
+ if (Browsers.prefixes().indexOf(prefix) === -1) {
131
+ prefix = false;
106
132
  }
107
- }
108
- return added;
133
+
134
+ node._autoprefixerPrefix = prefix;
135
+
136
+ return node._autoprefixerPrefix;
109
137
  };
110
138
 
111
- Prefixer.prototype.clone = function(node, overrides) {
112
- return Prefixer.clone(node, overrides);
139
+ /**
140
+ * Clone node with prefixes
141
+ */
142
+
143
+
144
+ Prefixer.prototype.process = function process(node) {
145
+ if (!this.check(node)) {
146
+ return undefined;
147
+ }
148
+
149
+ var parent = this.parentPrefix(node);
150
+
151
+ var prefixes = this.prefixes.filter(function (prefix) {
152
+ return !parent || parent === utils.removeNote(prefix);
153
+ });
154
+
155
+ var added = [];
156
+ for (var _iterator2 = prefixes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
157
+ var _ref2;
158
+
159
+ if (_isArray2) {
160
+ if (_i2 >= _iterator2.length) break;
161
+ _ref2 = _iterator2[_i2++];
162
+ } else {
163
+ _i2 = _iterator2.next();
164
+ if (_i2.done) break;
165
+ _ref2 = _i2.value;
166
+ }
167
+
168
+ var prefix = _ref2;
169
+
170
+ if (this.add(node, prefix, added.concat([prefix]))) {
171
+ added.push(prefix);
172
+ }
173
+ }
174
+
175
+ return added;
113
176
  };
114
177
 
115
- return Prefixer;
178
+ /**
179
+ * Shortcut for Prefixer.clone
180
+ */
116
181
 
117
- })();
118
182
 
119
- module.exports = Prefixer;
183
+ Prefixer.prototype.clone = function clone(node, overrides) {
184
+ return Prefixer.clone(node, overrides);
185
+ };
186
+
187
+ return Prefixer;
188
+ }();
120
189
 
121
- }).call(this);
190
+ module.exports = Prefixer;