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.
- package/AUTHORS +1 -0
- package/CHANGELOG.md +23 -0
- package/README.md +10 -16
- package/data/prefixes.js +551 -517
- package/lib/at-rule.js +55 -38
- package/lib/autoprefixer.js +89 -63
- package/lib/brackets.js +59 -39
- package/lib/browsers.js +102 -65
- package/lib/declaration.js +212 -121
- package/lib/hacks/align-content.js +65 -38
- package/lib/hacks/align-items.js +62 -38
- package/lib/hacks/align-self.js +63 -36
- package/lib/hacks/appearance.js +42 -0
- package/lib/hacks/background-size.js +29 -20
- package/lib/hacks/block-logical.js +36 -21
- package/lib/hacks/border-image.js +26 -16
- package/lib/hacks/border-radius.js +60 -39
- package/lib/hacks/break-props.js +69 -44
- package/lib/hacks/cross-fade.js +40 -37
- package/lib/hacks/display-flex.js +81 -31
- package/lib/hacks/display-grid.js +29 -19
- package/lib/hacks/filter-value.js +66 -45
- package/lib/hacks/filter.js +26 -17
- package/lib/hacks/flex-basis.js +60 -30
- package/lib/hacks/flex-direction.js +85 -53
- package/lib/hacks/flex-flow.js +67 -49
- package/lib/hacks/flex-grow.js +45 -26
- package/lib/hacks/flex-shrink.js +60 -30
- package/lib/hacks/flex-spec.js +18 -8
- package/lib/hacks/flex-values.js +39 -20
- package/lib/hacks/flex-wrap.js +29 -20
- package/lib/hacks/flex.js +68 -43
- package/lib/hacks/fullscreen.js +31 -21
- package/lib/hacks/gradient.js +462 -302
- package/lib/hacks/grid-column-align.js +55 -0
- package/lib/hacks/grid-end.js +53 -28
- package/lib/hacks/grid-row-align.js +39 -19
- package/lib/hacks/grid-start.js +80 -48
- package/lib/hacks/grid-template.js +91 -55
- package/lib/hacks/image-rendering.js +63 -33
- package/lib/hacks/image-set.js +28 -20
- package/lib/hacks/inline-logical.js +32 -17
- package/lib/hacks/intrinsic.js +66 -0
- package/lib/hacks/justify-content.js +69 -42
- package/lib/hacks/mask-border.js +36 -21
- package/lib/hacks/order.js +58 -35
- package/lib/hacks/pixelated.js +44 -30
- package/lib/hacks/placeholder.js +40 -25
- package/lib/hacks/text-emphasis-position.js +27 -20
- package/lib/hacks/transform-decl.js +94 -52
- package/lib/hacks/writing-mode.js +37 -27
- package/lib/info.js +117 -78
- package/lib/old-selector.js +84 -58
- package/lib/old-value.js +22 -20
- package/lib/prefixer.js +164 -95
- package/lib/prefixes.js +446 -351
- package/lib/processor.js +394 -278
- package/lib/resolution.js +135 -75
- package/lib/selector.js +145 -84
- package/lib/supports.js +330 -210
- package/lib/transition.js +396 -243
- package/lib/utils.js +84 -48
- package/lib/value.js +118 -80
- package/package.json +54 -14
- package/lib/hacks/justify-items.js +0 -31
- package/lib/hacks/stretch.js +0 -45
package/lib/declaration.js
CHANGED
|
@@ -1,162 +1,253 @@
|
|
|
1
|
-
|
|
2
|
-
var Browsers, Declaration, Prefixer, utils,
|
|
3
|
-
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
4
|
-
hasProp = {}.hasOwnProperty;
|
|
1
|
+
'use strict';
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
7
4
|
|
|
8
|
-
|
|
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; }
|
|
9
6
|
|
|
10
|
-
|
|
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; }
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
var Prefixer = require('./prefixer');
|
|
10
|
+
var Browsers = require('./browsers');
|
|
11
|
+
var utils = require('./utils');
|
|
12
|
+
|
|
13
|
+
var Declaration = function (_Prefixer) {
|
|
14
|
+
_inherits(Declaration, _Prefixer);
|
|
14
15
|
|
|
15
16
|
function Declaration() {
|
|
16
|
-
|
|
17
|
+
_classCallCheck(this, Declaration);
|
|
18
|
+
|
|
19
|
+
return _possibleConstructorReturn(this, _Prefixer.apply(this, arguments));
|
|
17
20
|
}
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Always true, because we already get prefixer by property name
|
|
24
|
+
*/
|
|
25
|
+
Declaration.prototype.check = function check() /* decl */{
|
|
26
|
+
return true;
|
|
21
27
|
};
|
|
22
28
|
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Return prefixed version of property
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
Declaration.prototype.prefixed = function prefixed(prop, prefix) {
|
|
35
|
+
return prefix + prop;
|
|
25
36
|
};
|
|
26
37
|
|
|
27
|
-
|
|
28
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Return unprefixed version of property
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
Declaration.prototype.normalize = function normalize(prop) {
|
|
44
|
+
return prop;
|
|
29
45
|
};
|
|
30
46
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Check `value`, that it contain other prefixes, rather than `prefix`
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
Declaration.prototype.otherPrefixes = function otherPrefixes(value, prefix) {
|
|
53
|
+
for (var _iterator = Browsers.prefixes(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
54
|
+
var _ref;
|
|
55
|
+
|
|
56
|
+
if (_isArray) {
|
|
57
|
+
if (_i >= _iterator.length) break;
|
|
58
|
+
_ref = _iterator[_i++];
|
|
59
|
+
} else {
|
|
60
|
+
_i = _iterator.next();
|
|
61
|
+
if (_i.done) break;
|
|
62
|
+
_ref = _i.value;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var other = _ref;
|
|
66
|
+
|
|
67
|
+
if (other === prefix) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (value.indexOf(other) !== -1) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
41
73
|
}
|
|
42
|
-
|
|
43
|
-
return false;
|
|
74
|
+
return false;
|
|
44
75
|
};
|
|
45
76
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
77
|
+
/**
|
|
78
|
+
* Set prefix to declaration
|
|
79
|
+
*/
|
|
50
80
|
|
|
51
|
-
|
|
52
|
-
|
|
81
|
+
|
|
82
|
+
Declaration.prototype.set = function set(decl, prefix) {
|
|
83
|
+
decl.prop = this.prefixed(decl.prop, prefix);
|
|
84
|
+
return decl;
|
|
53
85
|
};
|
|
54
86
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
prefix = utils.removeNote(prefix);
|
|
64
|
-
if (prefix.length > max) {
|
|
65
|
-
max = prefix.length;
|
|
87
|
+
/**
|
|
88
|
+
* Should we use visual cascade for prefixes
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
Declaration.prototype.needCascade = function needCascade(decl) {
|
|
93
|
+
if (!decl._autoprefixerCascade) {
|
|
94
|
+
decl._autoprefixerCascade = this.all.options.cascade !== false && decl.raw('before').indexOf('\n') !== -1;
|
|
66
95
|
}
|
|
67
|
-
|
|
68
|
-
return decl._autoprefixerMax = max;
|
|
96
|
+
return decl._autoprefixerCascade;
|
|
69
97
|
};
|
|
70
98
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
before = decl.raw('before');
|
|
77
|
-
max = this.maxPrefixed(prefixes, decl);
|
|
78
|
-
diff = max - utils.removeNote(prefix).length;
|
|
79
|
-
for (i = j = 0, ref = diff; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
|
|
80
|
-
before += ' ';
|
|
81
|
-
}
|
|
82
|
-
return before;
|
|
83
|
-
};
|
|
99
|
+
/**
|
|
100
|
+
* Return maximum length of possible prefixed property
|
|
101
|
+
*/
|
|
102
|
+
|
|
84
103
|
|
|
85
|
-
Declaration.prototype.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
min = lines[lines.length - 1];
|
|
89
|
-
this.all.group(decl).up(function(prefixed) {
|
|
90
|
-
var array, last;
|
|
91
|
-
array = prefixed.raw('before').split("\n");
|
|
92
|
-
last = array[array.length - 1];
|
|
93
|
-
if (last.length < min.length) {
|
|
94
|
-
return min = last;
|
|
104
|
+
Declaration.prototype.maxPrefixed = function maxPrefixed(prefixes, decl) {
|
|
105
|
+
if (decl._autoprefixerMax) {
|
|
106
|
+
return decl._autoprefixerMax;
|
|
95
107
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
108
|
+
|
|
109
|
+
var max = 0;
|
|
110
|
+
for (var _iterator2 = prefixes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
|
111
|
+
var _ref2;
|
|
112
|
+
|
|
113
|
+
if (_isArray2) {
|
|
114
|
+
if (_i2 >= _iterator2.length) break;
|
|
115
|
+
_ref2 = _iterator2[_i2++];
|
|
116
|
+
} else {
|
|
117
|
+
_i2 = _iterator2.next();
|
|
118
|
+
if (_i2.done) break;
|
|
119
|
+
_ref2 = _i2.value;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
var prefix = _ref2;
|
|
123
|
+
|
|
124
|
+
prefix = utils.removeNote(prefix);
|
|
125
|
+
if (prefix.length > max) {
|
|
126
|
+
max = prefix.length;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
decl._autoprefixerMax = max;
|
|
130
|
+
|
|
131
|
+
return decl._autoprefixerMax;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Calculate indentation to create visual cascade
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
Declaration.prototype.calcBefore = function calcBefore(prefixes, decl) {
|
|
140
|
+
var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
141
|
+
|
|
142
|
+
var max = this.maxPrefixed(prefixes, decl);
|
|
143
|
+
var diff = max - utils.removeNote(prefix).length;
|
|
144
|
+
|
|
145
|
+
var before = decl.raw('before');
|
|
146
|
+
before += Array(diff).fill(' ').join('');
|
|
147
|
+
|
|
148
|
+
return before;
|
|
99
149
|
};
|
|
100
150
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Remove visual cascade
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
Declaration.prototype.restoreBefore = function restoreBefore(decl) {
|
|
157
|
+
var lines = decl.raw('before').split('\n');
|
|
158
|
+
var min = lines[lines.length - 1];
|
|
159
|
+
|
|
160
|
+
this.all.group(decl).up(function (prefixed) {
|
|
161
|
+
var array = prefixed.raw('before').split('\n');
|
|
162
|
+
var last = array[array.length - 1];
|
|
163
|
+
if (last.length < min.length) {
|
|
164
|
+
min = last;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
lines[lines.length - 1] = min;
|
|
169
|
+
decl.raws.before = lines.join('\n');
|
|
117
170
|
};
|
|
118
171
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Clone and insert new declaration
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
Declaration.prototype.insert = function insert(decl, prefix, prefixes) {
|
|
178
|
+
var cloned = this.set(this.clone(decl), prefix);
|
|
179
|
+
if (!cloned) return undefined;
|
|
180
|
+
|
|
181
|
+
var already = decl.parent.some(function (i) {
|
|
182
|
+
return i.prop === cloned.prop && i.value === cloned.value;
|
|
183
|
+
});
|
|
184
|
+
if (already) {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (this.needCascade(decl)) {
|
|
189
|
+
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
|
|
190
|
+
}
|
|
191
|
+
return decl.parent.insertBefore(decl, cloned);
|
|
128
192
|
};
|
|
129
193
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
194
|
+
/**
|
|
195
|
+
* Did this declaration has this prefix above
|
|
196
|
+
*/
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
Declaration.prototype.isAlready = function isAlready(decl, prefixed) {
|
|
200
|
+
var already = this.all.group(decl).up(function (i) {
|
|
201
|
+
return i.prop === prefixed;
|
|
202
|
+
});
|
|
203
|
+
if (!already) {
|
|
204
|
+
already = this.all.group(decl).down(function (i) {
|
|
205
|
+
return i.prop === prefixed;
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
return already;
|
|
137
209
|
};
|
|
138
210
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
211
|
+
/**
|
|
212
|
+
* Clone and add prefixes for declaration
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
Declaration.prototype.add = function add(decl, prefix, prefixes) {
|
|
217
|
+
var prefixed = this.prefixed(decl.prop, prefix);
|
|
218
|
+
if (this.isAlready(decl, prefixed) || this.otherPrefixes(decl.value, prefix)) {
|
|
219
|
+
return undefined;
|
|
146
220
|
}
|
|
147
|
-
|
|
148
|
-
return Declaration.__super__.process.apply(this, arguments);
|
|
149
|
-
}
|
|
221
|
+
return this.insert(decl, prefix, prefixes);
|
|
150
222
|
};
|
|
151
223
|
|
|
152
|
-
|
|
153
|
-
|
|
224
|
+
/**
|
|
225
|
+
* Add spaces for visual cascade
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
Declaration.prototype.process = function process(decl) {
|
|
230
|
+
if (this.needCascade(decl)) {
|
|
231
|
+
var prefixes = _Prefixer.prototype.process.call(this, decl);
|
|
232
|
+
if (prefixes && prefixes.length) {
|
|
233
|
+
this.restoreBefore(decl);
|
|
234
|
+
decl.raws.before = this.calcBefore(prefixes, decl);
|
|
235
|
+
}
|
|
236
|
+
} else {
|
|
237
|
+
_Prefixer.prototype.process.call(this, decl);
|
|
238
|
+
}
|
|
154
239
|
};
|
|
155
240
|
|
|
156
|
-
|
|
241
|
+
/**
|
|
242
|
+
* Return list of prefixed properties to clean old prefixes
|
|
243
|
+
*/
|
|
157
244
|
|
|
158
|
-
})(Prefixer);
|
|
159
245
|
|
|
160
|
-
|
|
246
|
+
Declaration.prototype.old = function old(prop, prefix) {
|
|
247
|
+
return [this.prefixed(prop, prefix)];
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
return Declaration;
|
|
251
|
+
}(Prefixer);
|
|
161
252
|
|
|
162
|
-
|
|
253
|
+
module.exports = Declaration;
|
|
@@ -1,57 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
var AlignContent, Declaration, flexSpec,
|
|
3
|
-
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
4
|
-
hasProp = {}.hasOwnProperty;
|
|
1
|
+
'use strict';
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
7
4
|
|
|
8
|
-
|
|
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; }
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
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 flexSpec = require('./flex-spec');
|
|
10
|
+
var Declaration = require('../declaration');
|
|
11
|
+
|
|
12
|
+
var AlignContent = function (_Declaration) {
|
|
13
|
+
_inherits(AlignContent, _Declaration);
|
|
12
14
|
|
|
13
15
|
function AlignContent() {
|
|
14
|
-
|
|
16
|
+
_classCallCheck(this, AlignContent);
|
|
17
|
+
|
|
18
|
+
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Change property name for 2012 spec
|
|
23
|
+
*/
|
|
24
|
+
AlignContent.prototype.prefixed = function prefixed(prop, prefix) {
|
|
25
|
+
var spec = void 0;
|
|
18
26
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
'space-around': 'distribute'
|
|
24
|
-
};
|
|
27
|
+
var _flexSpec = flexSpec(prefix);
|
|
28
|
+
|
|
29
|
+
spec = _flexSpec[0];
|
|
30
|
+
prefix = _flexSpec[1];
|
|
25
31
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} else {
|
|
32
|
-
return AlignContent.__super__.prefixed.apply(this, arguments);
|
|
33
|
-
}
|
|
32
|
+
if (spec === 2012) {
|
|
33
|
+
return prefix + 'flex-line-pack';
|
|
34
|
+
} else {
|
|
35
|
+
return _Declaration.prototype.prefixed.call(this, prop, prefix);
|
|
36
|
+
}
|
|
34
37
|
};
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Return property name by final spec
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
AlignContent.prototype.normalize = function normalize() {
|
|
45
|
+
return 'align-content';
|
|
38
46
|
};
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Change value for 2012 spec and ignore prefix for 2009
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
AlignContent.prototype.set = function set(decl, prefix) {
|
|
54
|
+
var spec = flexSpec(prefix)[0];
|
|
55
|
+
if (spec === 2012) {
|
|
56
|
+
decl.value = AlignContent.oldValues[decl.value] || decl.value;
|
|
57
|
+
return _Declaration.prototype.set.call(this, decl, prefix);
|
|
58
|
+
} else if (spec === 'final') {
|
|
59
|
+
return _Declaration.prototype.set.call(this, decl, prefix);
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
49
62
|
};
|
|
50
63
|
|
|
51
64
|
return AlignContent;
|
|
65
|
+
}(Declaration);
|
|
52
66
|
|
|
53
|
-
|
|
67
|
+
Object.defineProperty(AlignContent, 'names', {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
writable: true,
|
|
70
|
+
value: ['align-content', 'flex-line-pack']
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(AlignContent, 'oldValues', {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
writable: true,
|
|
75
|
+
value: {
|
|
76
|
+
'flex-end': 'end',
|
|
77
|
+
'flex-start': 'start',
|
|
78
|
+
'space-between': 'justify',
|
|
79
|
+
'space-around': 'distribute'
|
|
80
|
+
}
|
|
81
|
+
});
|
|
54
82
|
|
|
55
|
-
module.exports = AlignContent;
|
|
56
83
|
|
|
57
|
-
|
|
84
|
+
module.exports = AlignContent;
|
package/lib/hacks/align-items.js
CHANGED
|
@@ -1,57 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
var AlignItems, Declaration, flexSpec,
|
|
3
|
-
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
4
|
-
hasProp = {}.hasOwnProperty;
|
|
1
|
+
'use strict';
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
7
4
|
|
|
8
|
-
|
|
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; }
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
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 flexSpec = require('./flex-spec');
|
|
10
|
+
var Declaration = require('../declaration');
|
|
11
|
+
|
|
12
|
+
var AlignItems = function (_Declaration) {
|
|
13
|
+
_inherits(AlignItems, _Declaration);
|
|
12
14
|
|
|
13
15
|
function AlignItems() {
|
|
14
|
-
|
|
16
|
+
_classCallCheck(this, AlignItems);
|
|
17
|
+
|
|
18
|
+
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Change property name for 2009 and 2012 specs
|
|
23
|
+
*/
|
|
24
|
+
AlignItems.prototype.prefixed = function prefixed(prop, prefix) {
|
|
25
|
+
var spec = void 0;
|
|
18
26
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
var _flexSpec = flexSpec(prefix);
|
|
28
|
+
|
|
29
|
+
spec = _flexSpec[0];
|
|
30
|
+
prefix = _flexSpec[1];
|
|
23
31
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} else {
|
|
32
|
-
return AlignItems.__super__.prefixed.apply(this, arguments);
|
|
33
|
-
}
|
|
32
|
+
if (spec === 2009) {
|
|
33
|
+
return prefix + 'box-align';
|
|
34
|
+
} else if (spec === 2012) {
|
|
35
|
+
return prefix + 'flex-align';
|
|
36
|
+
} else {
|
|
37
|
+
return _Declaration.prototype.prefixed.call(this, prop, prefix);
|
|
38
|
+
}
|
|
34
39
|
};
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Return property name by final spec
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
AlignItems.prototype.normalize = function normalize() {
|
|
47
|
+
return 'align-items';
|
|
38
48
|
};
|
|
39
49
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Change value for 2009 and 2012 specs
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
AlignItems.prototype.set = function set(decl, prefix) {
|
|
56
|
+
var spec = flexSpec(prefix)[0];
|
|
57
|
+
if (spec === 2009 || spec === 2012) {
|
|
58
|
+
decl.value = AlignItems.oldValues[decl.value] || decl.value;
|
|
59
|
+
}
|
|
60
|
+
return _Declaration.prototype.set.call(this, decl, prefix);
|
|
49
61
|
};
|
|
50
62
|
|
|
51
63
|
return AlignItems;
|
|
64
|
+
}(Declaration);
|
|
52
65
|
|
|
53
|
-
|
|
66
|
+
Object.defineProperty(AlignItems, 'names', {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
writable: true,
|
|
69
|
+
value: ['align-items', 'flex-align', 'box-align']
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(AlignItems, 'oldValues', {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
writable: true,
|
|
74
|
+
value: {
|
|
75
|
+
'flex-end': 'end',
|
|
76
|
+
'flex-start': 'start'
|
|
77
|
+
}
|
|
78
|
+
});
|
|
54
79
|
|
|
55
|
-
module.exports = AlignItems;
|
|
56
80
|
|
|
57
|
-
|
|
81
|
+
module.exports = AlignItems;
|