autoprefixer 7.1.6 → 7.2.3
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 +20 -0
- package/README.md +39 -8
- package/bin/autoprefixer-info +3 -0
- package/data/prefixes.js +1 -1
- package/lib/autoprefixer.js +6 -0
- package/lib/browsers.js +0 -24
- package/lib/declaration.js +5 -5
- package/lib/hacks/animation.js +40 -0
- package/lib/hacks/break-props.js +4 -8
- package/lib/hacks/display-flex.js +2 -4
- package/lib/hacks/filter-value.js +3 -61
- package/lib/hacks/gradient.js +3 -11
- package/lib/hacks/grid-area.js +84 -0
- package/lib/hacks/grid-end.js +3 -3
- package/lib/hacks/grid-row-column.js +60 -0
- package/lib/hacks/grid-rows-columns.js +63 -0
- package/lib/hacks/grid-shorthand.js +160 -0
- package/lib/hacks/grid-start.js +6 -49
- package/lib/hacks/grid-template-areas.js +133 -0
- package/lib/hacks/grid-template.js +28 -68
- package/lib/hacks/image-rendering.js +4 -7
- package/lib/hacks/image-set.js +3 -3
- package/lib/hacks/mask-border.js +3 -3
- package/lib/hacks/text-emphasis-position.js +1 -3
- package/lib/hacks/transform-decl.js +1 -1
- package/lib/prefixer.js +3 -5
- package/lib/prefixes.js +5 -1
- package/lib/processor.js +10 -29
- package/lib/resolution.js +1 -7
- package/lib/supports.js +1 -1
- package/lib/transition.js +3 -6
- package/package.json +32 -14
- package/lib/hacks/flex-values.js +0 -56
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
3
3
|
|
|
4
|
+
## 7.2.3
|
|
5
|
+
* Fix `grid-template-areas` in `@media` (by Evgeny Petukhov).
|
|
6
|
+
|
|
7
|
+
## 7.2.2
|
|
8
|
+
* Fix `_autoprefixerDisabled is undefined` issue.
|
|
9
|
+
|
|
10
|
+
## 7.2.1
|
|
11
|
+
* Fix IE and other old JS runtimes support.
|
|
12
|
+
|
|
13
|
+
## 7.2 “Ordem e Progresso”
|
|
14
|
+
* Add `grid-template-areas` support (by Evgeny Petukhov).
|
|
15
|
+
* Add `grid-template` support (by Evgeny Petukhov).
|
|
16
|
+
* Add `grid-area` support (by Alexey Komarov).
|
|
17
|
+
* Add `autoprefixer-info` CLI tool.
|
|
18
|
+
* Add wrong `radial-gradient` properties warning.
|
|
19
|
+
* Use current working dir on missed `from` in `info()` (by Phil Dokas).
|
|
20
|
+
* Fix `grid-row` and `grid-column` support (by Alexey Komarov).
|
|
21
|
+
* Do not prefix `reverse` animation direction.
|
|
22
|
+
* Improve test coverage (by Dmitry Semigradsky).
|
|
23
|
+
|
|
4
24
|
## 7.1.6
|
|
5
25
|
* Add warning for using `browserslist` option instead of `browsers`.
|
|
6
26
|
* Add warning for multiple control comments in the same scope.
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ entirely):
|
|
|
12
12
|
|
|
13
13
|
```css
|
|
14
14
|
:fullscreen a {
|
|
15
|
-
display: flex
|
|
15
|
+
display: flex;
|
|
16
16
|
}
|
|
17
17
|
```
|
|
18
18
|
|
|
@@ -23,19 +23,19 @@ of Autoprefixer.
|
|
|
23
23
|
```css
|
|
24
24
|
:-webkit-full-screen a {
|
|
25
25
|
display: -webkit-box;
|
|
26
|
-
display: flex
|
|
26
|
+
display: flex;
|
|
27
27
|
}
|
|
28
28
|
:-moz-full-screen a {
|
|
29
|
-
display: flex
|
|
29
|
+
display: flex;
|
|
30
30
|
}
|
|
31
31
|
:-ms-fullscreen a {
|
|
32
32
|
display: -ms-flexbox;
|
|
33
|
-
display: flex
|
|
33
|
+
display: flex;
|
|
34
34
|
}
|
|
35
35
|
:fullscreen a {
|
|
36
36
|
display: -webkit-box;
|
|
37
37
|
display: -ms-flexbox;
|
|
38
|
-
display: flex
|
|
38
|
+
display: flex;
|
|
39
39
|
}
|
|
40
40
|
```
|
|
41
41
|
|
|
@@ -86,7 +86,7 @@ a {
|
|
|
86
86
|
display: -webkit-box;
|
|
87
87
|
display: -webkit-flex;
|
|
88
88
|
display: -ms-flexbox;
|
|
89
|
-
display: flex
|
|
89
|
+
display: flex;
|
|
90
90
|
}
|
|
91
91
|
```
|
|
92
92
|
|
|
@@ -160,7 +160,7 @@ var cleaner = postcss([ autoprefixer({ add: false, browsers: [] }) ]);
|
|
|
160
160
|
var prefixer = postcss([ autoprefixer ]);
|
|
161
161
|
|
|
162
162
|
cleaner.process(css).then(function (cleaned) {
|
|
163
|
-
return prefixer.process(cleaned.css)
|
|
163
|
+
return prefixer.process(cleaned.css);
|
|
164
164
|
}).then(function (result) {
|
|
165
165
|
console.log(result.css);
|
|
166
166
|
});
|
|
@@ -578,7 +578,38 @@ to increase performance.
|
|
|
578
578
|
|
|
579
579
|
## Debug
|
|
580
580
|
|
|
581
|
-
|
|
581
|
+
Run `npx autoprefixer-info` in your project directory to check
|
|
582
|
+
which browsers are selected and which properties will be prefixed:
|
|
583
|
+
|
|
584
|
+
```
|
|
585
|
+
$ npx autoprefixer-info
|
|
586
|
+
Browsers:
|
|
587
|
+
Edge: 16
|
|
588
|
+
|
|
589
|
+
These browsers account for 0.04% of all users globally
|
|
590
|
+
|
|
591
|
+
At-Rules:
|
|
592
|
+
@viewport: ms
|
|
593
|
+
|
|
594
|
+
Selectors:
|
|
595
|
+
::placeholder: ms
|
|
596
|
+
|
|
597
|
+
Properties:
|
|
598
|
+
user-select: ms
|
|
599
|
+
hyphens: ms
|
|
600
|
+
appearance: webkit
|
|
601
|
+
scroll-snap-type: ms
|
|
602
|
+
scroll-snap-coordinate: ms
|
|
603
|
+
scroll-snap-destination: ms
|
|
604
|
+
scroll-snap-points-x: ms
|
|
605
|
+
scroll-snap-points-y: ms
|
|
606
|
+
flow-into: ms
|
|
607
|
+
flow-from: ms
|
|
608
|
+
region-fragment: ms
|
|
609
|
+
text-spacing: ms
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
JS API is also available:
|
|
582
613
|
|
|
583
614
|
```js
|
|
584
615
|
var info = autoprefixer().info();
|
package/data/prefixes.js
CHANGED
|
@@ -647,7 +647,7 @@ f(grid, function (browsers) {
|
|
|
647
647
|
feature: 'css-grid',
|
|
648
648
|
browsers: browsers
|
|
649
649
|
});
|
|
650
|
-
prefix(['grid-template-columns', 'grid-template-rows', 'grid-row-start', 'grid-column-start', 'grid-row-end', 'grid-column-end', 'grid-row', 'grid-column'], {
|
|
650
|
+
prefix(['grid-template-columns', 'grid-template-rows', 'grid-row-start', 'grid-column-start', 'grid-row-end', 'grid-column-end', 'grid-row', 'grid-column', 'grid-area', 'grid-template', 'grid-template-areas'], {
|
|
651
651
|
feature: 'css-grid',
|
|
652
652
|
browsers: browsers
|
|
653
653
|
});
|
package/lib/autoprefixer.js
CHANGED
|
@@ -25,6 +25,7 @@ function timeCapsule(result, prefixes) {
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/* istanbul ignore next */
|
|
28
29
|
result.warn('Greetings, time traveller. ' + 'We are in the golden age of prefix-less CSS, ' + 'where Autoprefixer is no longer needed for your stylesheet.');
|
|
29
30
|
}
|
|
30
31
|
|
|
@@ -92,7 +93,12 @@ module.exports = postcss.plugin('autoprefixer', function () {
|
|
|
92
93
|
|
|
93
94
|
plugin.options = options;
|
|
94
95
|
|
|
96
|
+
plugin.browsers = reqs;
|
|
97
|
+
|
|
95
98
|
plugin.info = function (opts) {
|
|
99
|
+
opts = opts || {};
|
|
100
|
+
opts.from = opts.from || process.cwd();
|
|
101
|
+
|
|
96
102
|
return require('./info')(loadPrefixes(opts));
|
|
97
103
|
};
|
|
98
104
|
|
package/lib/browsers.js
CHANGED
|
@@ -65,30 +65,6 @@ var Browsers = function () {
|
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
/**
|
|
69
|
-
* Select major browsers versions by criteria
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
Browsers.prototype.browsers = function browsers(criteria) {
|
|
74
|
-
var _this = this;
|
|
75
|
-
|
|
76
|
-
var selected = [];
|
|
77
|
-
|
|
78
|
-
var _loop = function _loop(browser) {
|
|
79
|
-
var data = _this.data[browser];
|
|
80
|
-
var versions = criteria(data).map(function (version) {
|
|
81
|
-
return browser + ' ' + version;
|
|
82
|
-
});
|
|
83
|
-
selected = selected.concat(versions);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
for (var browser in this.data) {
|
|
87
|
-
_loop(browser);
|
|
88
|
-
}
|
|
89
|
-
return selected;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
68
|
/**
|
|
93
69
|
* Return prefix for selected browser
|
|
94
70
|
*/
|
package/lib/declaration.js
CHANGED
|
@@ -215,12 +215,12 @@ var Declaration = function (_Prefixer) {
|
|
|
215
215
|
*/
|
|
216
216
|
|
|
217
217
|
|
|
218
|
-
Declaration.prototype.add = function add(decl, prefix, prefixes) {
|
|
218
|
+
Declaration.prototype.add = function add(decl, prefix, prefixes, result) {
|
|
219
219
|
var prefixed = this.prefixed(decl.prop, prefix);
|
|
220
220
|
if (this.isAlready(decl, prefixed) || this.otherPrefixes(decl.value, prefix)) {
|
|
221
221
|
return undefined;
|
|
222
222
|
}
|
|
223
|
-
return this.insert(decl, prefix, prefixes);
|
|
223
|
+
return this.insert(decl, prefix, prefixes, result);
|
|
224
224
|
};
|
|
225
225
|
|
|
226
226
|
/**
|
|
@@ -228,13 +228,13 @@ var Declaration = function (_Prefixer) {
|
|
|
228
228
|
*/
|
|
229
229
|
|
|
230
230
|
|
|
231
|
-
Declaration.prototype.process = function process(decl) {
|
|
231
|
+
Declaration.prototype.process = function process(decl, result) {
|
|
232
232
|
if (!this.needCascade(decl)) {
|
|
233
|
-
_Prefixer.prototype.process.call(this, decl);
|
|
233
|
+
_Prefixer.prototype.process.call(this, decl, result);
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
var prefixes = _Prefixer.prototype.process.call(this, decl);
|
|
237
|
+
var prefixes = _Prefixer.prototype.process.call(this, decl, result);
|
|
238
238
|
|
|
239
239
|
if (!prefixes || !prefixes.length) {
|
|
240
240
|
return;
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
|
|
11
|
+
var Animation = function (_Declaration) {
|
|
12
|
+
_inherits(Animation, _Declaration);
|
|
13
|
+
|
|
14
|
+
function Animation() {
|
|
15
|
+
_classCallCheck(this, Animation);
|
|
16
|
+
|
|
17
|
+
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Don’t add prefixes for modern values.
|
|
22
|
+
*/
|
|
23
|
+
Animation.prototype.check = function check(decl) {
|
|
24
|
+
return !decl.value.split(/\s+/).some(function (i) {
|
|
25
|
+
var lower = i.toLowerCase();
|
|
26
|
+
return lower === 'reverse' || lower === 'alternate-reverse';
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return Animation;
|
|
31
|
+
}(Declaration);
|
|
32
|
+
|
|
33
|
+
Object.defineProperty(Animation, 'names', {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
writable: true,
|
|
36
|
+
value: ['animation', 'animation-direction']
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
module.exports = Animation;
|
package/lib/hacks/break-props.js
CHANGED
|
@@ -21,12 +21,10 @@ var BreakProps = function (_Declaration) {
|
|
|
21
21
|
* Change name for -webkit- and -moz- prefix
|
|
22
22
|
*/
|
|
23
23
|
BreakProps.prototype.prefixed = function prefixed(prop, prefix) {
|
|
24
|
-
if (prefix === '-
|
|
25
|
-
return '-webkit-column-' + prop;
|
|
26
|
-
} else if (prefix === '-moz-') {
|
|
24
|
+
if (prefix === '-moz-') {
|
|
27
25
|
return 'page-' + prop;
|
|
28
26
|
} else {
|
|
29
|
-
return
|
|
27
|
+
return prefix + 'column-' + prop;
|
|
30
28
|
}
|
|
31
29
|
};
|
|
32
30
|
|
|
@@ -40,10 +38,9 @@ var BreakProps = function (_Declaration) {
|
|
|
40
38
|
return 'break-inside';
|
|
41
39
|
} else if (prop.indexOf('before') !== -1) {
|
|
42
40
|
return 'break-before';
|
|
43
|
-
} else
|
|
41
|
+
} else {
|
|
44
42
|
return 'break-after';
|
|
45
43
|
}
|
|
46
|
-
return undefined;
|
|
47
44
|
};
|
|
48
45
|
|
|
49
46
|
/**
|
|
@@ -52,8 +49,7 @@ var BreakProps = function (_Declaration) {
|
|
|
52
49
|
|
|
53
50
|
|
|
54
51
|
BreakProps.prototype.set = function set(decl, prefix) {
|
|
55
|
-
|
|
56
|
-
if (decl.prop === 'break-inside' && v === 'avoid-column' || v === 'avoid-page') {
|
|
52
|
+
if (decl.prop === 'break-inside' && decl.value === 'avoid-column' || decl.value === 'avoid-page') {
|
|
57
53
|
decl.value = 'avoid';
|
|
58
54
|
}
|
|
59
55
|
return _Declaration.prototype.set.call(this, decl, prefix);
|
|
@@ -83,10 +83,8 @@ var DisplayFlex = function (_Value) {
|
|
|
83
83
|
|
|
84
84
|
DisplayFlex.prototype.old = function old(prefix) {
|
|
85
85
|
var prefixed = this.prefixed(prefix);
|
|
86
|
-
if (prefixed)
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
return undefined;
|
|
86
|
+
if (!prefixed) return undefined;
|
|
87
|
+
return new OldValue(this.name, prefixed);
|
|
90
88
|
};
|
|
91
89
|
|
|
92
90
|
return DisplayFlex;
|
|
@@ -6,39 +6,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
|
|
6
6
|
|
|
7
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
8
|
|
|
9
|
-
var OldValue = require('../old-value');
|
|
10
9
|
var Value = require('../value');
|
|
11
|
-
var utils = require('../utils');
|
|
12
|
-
|
|
13
|
-
var OldFilterValue = function (_OldValue) {
|
|
14
|
-
_inherits(OldFilterValue, _OldValue);
|
|
15
|
-
|
|
16
|
-
function OldFilterValue() {
|
|
17
|
-
_classCallCheck(this, OldFilterValue);
|
|
18
|
-
|
|
19
|
-
return _possibleConstructorReturn(this, _OldValue.apply(this, arguments));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Clean -webkit-filter from properties list
|
|
24
|
-
*/
|
|
25
|
-
OldFilterValue.prototype.clean = function clean(decl) {
|
|
26
|
-
var _this2 = this;
|
|
27
|
-
|
|
28
|
-
decl.value = utils.editList(decl.value, function (props) {
|
|
29
|
-
if (props.every(function (i) {
|
|
30
|
-
return i.indexOf(_this2.unprefixed) !== 0;
|
|
31
|
-
})) {
|
|
32
|
-
return props;
|
|
33
|
-
}
|
|
34
|
-
return props.filter(function (i) {
|
|
35
|
-
return i.indexOf(_this2.prefixed) === -1;
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return OldFilterValue;
|
|
41
|
-
}(OldValue);
|
|
42
10
|
|
|
43
11
|
var FilterValue = function (_Value) {
|
|
44
12
|
_inherits(FilterValue, _Value);
|
|
@@ -46,40 +14,14 @@ var FilterValue = function (_Value) {
|
|
|
46
14
|
function FilterValue(name, prefixes) {
|
|
47
15
|
_classCallCheck(this, FilterValue);
|
|
48
16
|
|
|
49
|
-
var
|
|
17
|
+
var _this = _possibleConstructorReturn(this, _Value.call(this, name, prefixes));
|
|
50
18
|
|
|
51
19
|
if (name === 'filter-function') {
|
|
52
|
-
|
|
20
|
+
_this.name = 'filter';
|
|
53
21
|
}
|
|
54
|
-
return
|
|
22
|
+
return _this;
|
|
55
23
|
}
|
|
56
24
|
|
|
57
|
-
/**
|
|
58
|
-
* Use prefixed and unprefixed filter for WebKit
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
FilterValue.prototype.replace = function replace(value, prefix) {
|
|
63
|
-
if (prefix === '-webkit-' && value.indexOf('filter(') === -1) {
|
|
64
|
-
if (value.indexOf('-webkit-filter') === -1) {
|
|
65
|
-
return _Value.prototype.replace.call(this, value, prefix) + ', ' + value;
|
|
66
|
-
} else {
|
|
67
|
-
return value;
|
|
68
|
-
}
|
|
69
|
-
} else {
|
|
70
|
-
return _Value.prototype.replace.call(this, value, prefix);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Clean -webkit-filter
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
FilterValue.prototype.old = function old(prefix) {
|
|
80
|
-
return new OldFilterValue(this.name, prefix + this.name);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
25
|
return FilterValue;
|
|
84
26
|
}(Value);
|
|
85
27
|
|
package/lib/hacks/gradient.js
CHANGED
|
@@ -136,9 +136,7 @@ var Gradient = function (_Value) {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
Gradient.prototype.normalize = function normalize(nodes) {
|
|
139
|
-
if (!nodes[0])
|
|
140
|
-
return nodes;
|
|
141
|
-
}
|
|
139
|
+
if (!nodes[0]) return nodes;
|
|
142
140
|
|
|
143
141
|
if (/-?\d+(.\d+)?grad/.test(nodes[0].value)) {
|
|
144
142
|
nodes[0].value = this.normalizeUnit(nodes[0].value, 400);
|
|
@@ -210,7 +208,7 @@ var Gradient = function (_Value) {
|
|
|
210
208
|
this.fixDirection(params);
|
|
211
209
|
} else if (params[0].value.indexOf('deg') !== -1) {
|
|
212
210
|
this.fixAngle(params);
|
|
213
|
-
} else if (params[2].value === 'at') {
|
|
211
|
+
} else if (params[2] && params[2].value === 'at') {
|
|
214
212
|
this.fixRadial(params);
|
|
215
213
|
}
|
|
216
214
|
}
|
|
@@ -313,13 +311,7 @@ var Gradient = function (_Value) {
|
|
|
313
311
|
if (nodes[0] && nodes[0].value.indexOf('deg') !== -1) {
|
|
314
312
|
return false;
|
|
315
313
|
}
|
|
316
|
-
if (string.indexOf('px') !== -1) {
|
|
317
|
-
return false;
|
|
318
|
-
}
|
|
319
|
-
if (string.indexOf('-corner') !== -1) {
|
|
320
|
-
return false;
|
|
321
|
-
}
|
|
322
|
-
if (string.indexOf('-side') !== -1) {
|
|
314
|
+
if (string.indexOf('px') !== -1 || string.indexOf('-corner') !== -1 || string.indexOf('-side') !== -1) {
|
|
323
315
|
return false;
|
|
324
316
|
}
|
|
325
317
|
|
|
@@ -0,0 +1,84 @@
|
|
|
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 shorthand = require('./grid-shorthand');
|
|
11
|
+
|
|
12
|
+
var GridArea = function (_Declaration) {
|
|
13
|
+
_inherits(GridArea, _Declaration);
|
|
14
|
+
|
|
15
|
+
function GridArea() {
|
|
16
|
+
_classCallCheck(this, GridArea);
|
|
17
|
+
|
|
18
|
+
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Translate grid-area to separate -ms- prefixed properties
|
|
23
|
+
*/
|
|
24
|
+
GridArea.prototype.insert = function insert(decl, prefix, prefixes) {
|
|
25
|
+
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
|
|
26
|
+
|
|
27
|
+
if (decl.parent.some(function (i) {
|
|
28
|
+
return i.prop === '-ms-grid-row';
|
|
29
|
+
})) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var values = shorthand.parse(decl);
|
|
34
|
+
|
|
35
|
+
var _shorthand$translate = shorthand.translate(values, 0, 2),
|
|
36
|
+
rowStart = _shorthand$translate[0],
|
|
37
|
+
rowSpan = _shorthand$translate[1];
|
|
38
|
+
|
|
39
|
+
var _shorthand$translate2 = shorthand.translate(values, 1, 3),
|
|
40
|
+
columnStart = _shorthand$translate2[0],
|
|
41
|
+
columnSpan = _shorthand$translate2[1];
|
|
42
|
+
|
|
43
|
+
if (rowStart) {
|
|
44
|
+
decl.cloneBefore({
|
|
45
|
+
prop: '-ms-grid-row',
|
|
46
|
+
value: rowStart.toString()
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (rowSpan) {
|
|
51
|
+
decl.cloneBefore({
|
|
52
|
+
prop: '-ms-grid-row-span',
|
|
53
|
+
value: rowSpan.toString()
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (columnStart) {
|
|
58
|
+
decl.cloneBefore({
|
|
59
|
+
prop: '-ms-grid-column',
|
|
60
|
+
value: columnStart.toString()
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (columnSpan) {
|
|
65
|
+
decl.cloneBefore({
|
|
66
|
+
prop: '-ms-grid-column-span',
|
|
67
|
+
value: columnSpan.toString()
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return undefined;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return GridArea;
|
|
75
|
+
}(Declaration);
|
|
76
|
+
|
|
77
|
+
Object.defineProperty(GridArea, 'names', {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
writable: true,
|
|
80
|
+
value: ['grid-area']
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
module.exports = GridArea;
|
package/lib/hacks/grid-end.js
CHANGED
|
@@ -39,11 +39,11 @@ var GridEnd = function (_Declaration) {
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
GridEnd.prototype.prefixed = function prefixed(prop, prefix) {
|
|
42
|
+
var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
|
|
42
43
|
if (prefix === '-ms-') {
|
|
43
|
-
|
|
44
|
-
} else {
|
|
45
|
-
return _Declaration.prototype.prefixed.call(this, prop, prefix);
|
|
44
|
+
result = result.replace('-end', '-span');
|
|
46
45
|
}
|
|
46
|
+
return result;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
/**
|
|
@@ -0,0 +1,60 @@
|
|
|
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 shorthand = require('./grid-shorthand');
|
|
11
|
+
|
|
12
|
+
var GridRowColumn = function (_Declaration) {
|
|
13
|
+
_inherits(GridRowColumn, _Declaration);
|
|
14
|
+
|
|
15
|
+
function GridRowColumn() {
|
|
16
|
+
_classCallCheck(this, GridRowColumn);
|
|
17
|
+
|
|
18
|
+
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Translate grid-row / grid-column to separate -ms- prefixed properties
|
|
23
|
+
*/
|
|
24
|
+
GridRowColumn.prototype.insert = function insert(decl, prefix, prefixes) {
|
|
25
|
+
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
|
|
26
|
+
|
|
27
|
+
var values = shorthand.parse(decl);
|
|
28
|
+
|
|
29
|
+
var _shorthand$translate = shorthand.translate(values, 0, 1),
|
|
30
|
+
start = _shorthand$translate[0],
|
|
31
|
+
span = _shorthand$translate[1];
|
|
32
|
+
|
|
33
|
+
if (start) {
|
|
34
|
+
decl.cloneBefore({
|
|
35
|
+
prop: '-ms-' + decl.prop,
|
|
36
|
+
value: start.toString()
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (span) {
|
|
41
|
+
decl.cloneBefore({
|
|
42
|
+
prop: '-ms-' + decl.prop + '-span',
|
|
43
|
+
value: span.toString()
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return undefined;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return GridRowColumn;
|
|
51
|
+
}(Declaration);
|
|
52
|
+
|
|
53
|
+
Object.defineProperty(GridRowColumn, 'names', {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
writable: true,
|
|
56
|
+
value: ['grid-row', 'grid-column']
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
module.exports = GridRowColumn;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 shorthand = require('./grid-shorthand');
|
|
11
|
+
|
|
12
|
+
var GridRowsColumns = function (_Declaration) {
|
|
13
|
+
_inherits(GridRowsColumns, _Declaration);
|
|
14
|
+
|
|
15
|
+
function GridRowsColumns() {
|
|
16
|
+
_classCallCheck(this, GridRowsColumns);
|
|
17
|
+
|
|
18
|
+
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Change property name for IE
|
|
23
|
+
*/
|
|
24
|
+
GridRowsColumns.prototype.prefixed = function prefixed(prop, prefix) {
|
|
25
|
+
if (prefix === '-ms-') {
|
|
26
|
+
return prefix + prop.replace('template-', '');
|
|
27
|
+
} else {
|
|
28
|
+
return _Declaration.prototype.prefixed.call(this, prop, prefix);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Change IE property back
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
GridRowsColumns.prototype.normalize = function normalize(prop) {
|
|
38
|
+
return prop.replace(/^grid-(rows|columns)/, 'grid-template-$1');
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Change repeating syntax for IE
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
GridRowsColumns.prototype.set = function set(decl, prefix) {
|
|
47
|
+
if (prefix === '-ms-' && decl.value.indexOf('repeat(') !== -1) {
|
|
48
|
+
decl.value = shorthand.changeRepeat(decl.value);
|
|
49
|
+
}
|
|
50
|
+
return _Declaration.prototype.set.call(this, decl, prefix);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return GridRowsColumns;
|
|
54
|
+
}(Declaration);
|
|
55
|
+
|
|
56
|
+
Object.defineProperty(GridRowsColumns, 'names', {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: ['grid-template-rows', 'grid-template-columns', 'grid-rows', 'grid-columns']
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
module.exports = GridRowsColumns;
|