autoprefixer 9.8.7 → 10.0.2
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 +999 -0
- package/README.md +0 -3
- package/bin/autoprefixer +11 -11
- package/data/prefixes.js +799 -545
- package/lib/at-rule.js +23 -50
- package/lib/autoprefixer.js +108 -97
- package/lib/brackets.js +31 -44
- package/lib/browsers.js +54 -71
- package/lib/declaration.js +122 -178
- package/lib/hacks/align-content.js +24 -54
- package/lib/hacks/align-items.js +23 -53
- package/lib/hacks/align-self.js +32 -60
- package/lib/hacks/animation.js +11 -29
- package/lib/hacks/appearance.js +19 -35
- package/lib/hacks/backdrop-filter.js +16 -31
- package/lib/hacks/background-clip.js +19 -36
- package/lib/hacks/background-size.js +16 -31
- package/lib/hacks/block-logical.js +28 -36
- package/lib/hacks/border-image.js +9 -27
- package/lib/hacks/border-radius.js +22 -44
- package/lib/hacks/break-props.js +38 -51
- package/lib/hacks/color-adjust.js +11 -30
- package/lib/hacks/cross-fade.js +29 -48
- package/lib/hacks/display-flex.js +32 -61
- package/lib/hacks/display-grid.js +12 -32
- package/lib/hacks/filter-value.js +8 -25
- package/lib/hacks/filter.js +13 -27
- package/lib/hacks/flex-basis.js +21 -54
- package/lib/hacks/flex-direction.js +41 -77
- package/lib/hacks/flex-flow.js +33 -61
- package/lib/hacks/flex-grow.js +16 -43
- package/lib/hacks/flex-shrink.js +21 -54
- package/lib/hacks/flex-spec.js +7 -10
- package/lib/hacks/flex-wrap.js +11 -32
- package/lib/hacks/flex.js +27 -58
- package/lib/hacks/fullscreen.js +10 -30
- package/lib/hacks/gradient.js +240 -330
- package/lib/hacks/grid-area.js +25 -43
- package/lib/hacks/grid-column-align.js +14 -34
- package/lib/hacks/grid-end.js +30 -45
- package/lib/hacks/grid-row-align.js +14 -34
- package/lib/hacks/grid-row-column.js +20 -39
- package/lib/hacks/grid-rows-columns.js +75 -99
- package/lib/hacks/grid-start.js +17 -39
- package/lib/hacks/grid-template-areas.js +59 -76
- package/lib/hacks/grid-template.js +40 -61
- package/lib/hacks/grid-utils.js +686 -716
- package/lib/hacks/image-rendering.js +24 -47
- package/lib/hacks/image-set.js +10 -30
- package/lib/hacks/inline-logical.js +26 -32
- package/lib/hacks/intrinsic.js +40 -53
- package/lib/hacks/justify-content.js +26 -57
- package/lib/hacks/mask-border.js +28 -36
- package/lib/hacks/mask-composite.js +41 -57
- package/lib/hacks/order.js +22 -52
- package/lib/hacks/overscroll-behavior.js +16 -37
- package/lib/hacks/pixelated.js +16 -40
- package/lib/hacks/place-self.js +18 -41
- package/lib/hacks/placeholder-shown.js +9 -28
- package/lib/hacks/placeholder.js +15 -38
- package/lib/hacks/text-decoration-skip-ink.js +14 -29
- package/lib/hacks/text-decoration.js +20 -31
- package/lib/hacks/text-emphasis-position.js +9 -28
- package/lib/hacks/transform-decl.js +43 -69
- package/lib/hacks/user-select.js +19 -27
- package/lib/hacks/writing-mode.js +19 -36
- package/lib/info.js +63 -93
- package/lib/old-selector.js +39 -60
- package/lib/old-value.js +17 -25
- package/lib/prefixer.js +83 -110
- package/lib/prefixes.js +233 -336
- package/lib/processor.js +420 -416
- package/lib/resolution.js +62 -98
- package/lib/selector.js +91 -139
- package/lib/supports.js +194 -246
- package/lib/transition.js +170 -265
- package/lib/utils.js +49 -72
- package/lib/value.js +77 -116
- package/lib/vendor.js +14 -0
- package/package.json +23 -12
package/lib/hacks/grid-area.js
CHANGED
|
@@ -1,52 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
let Declaration = require('../declaration')
|
|
2
|
+
let utils = require('./grid-utils')
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
class GridArea extends Declaration {
|
|
5
|
+
/**
|
|
6
|
+
* Translate grid-area to separate -ms- prefixed properties
|
|
7
|
+
*/
|
|
8
|
+
insert (decl, prefix, prefixes, result) {
|
|
9
|
+
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
let values = utils.parse(decl)
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
let [rowStart, rowSpan] = utils.translate(values, 0, 2)
|
|
14
|
+
let [columnStart, columnSpan] = utils.translate(values, 1, 3)
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
;[
|
|
17
|
+
['grid-row', rowStart],
|
|
18
|
+
['grid-row-span', rowSpan],
|
|
19
|
+
['grid-column', columnStart],
|
|
20
|
+
['grid-column-span', columnSpan]
|
|
21
|
+
].forEach(([prop, value]) => {
|
|
22
|
+
utils.insertDecl(decl, prop, value)
|
|
23
|
+
})
|
|
12
24
|
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
utils.warnTemplateSelectorNotFound(decl, result)
|
|
26
|
+
utils.warnIfGridRowColumnExists(decl, result)
|
|
15
27
|
|
|
16
|
-
|
|
17
|
-
return _Declaration.apply(this, arguments) || this;
|
|
28
|
+
return undefined
|
|
18
29
|
}
|
|
30
|
+
}
|
|
19
31
|
|
|
20
|
-
|
|
32
|
+
GridArea.names = ['grid-area']
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
* Translate grid-area to separate -ms- prefixed properties
|
|
24
|
-
*/
|
|
25
|
-
_proto.insert = function insert(decl, prefix, prefixes, result) {
|
|
26
|
-
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
|
|
27
|
-
var values = utils.parse(decl);
|
|
28
|
-
|
|
29
|
-
var _utils$translate = utils.translate(values, 0, 2),
|
|
30
|
-
rowStart = _utils$translate[0],
|
|
31
|
-
rowSpan = _utils$translate[1];
|
|
32
|
-
|
|
33
|
-
var _utils$translate2 = utils.translate(values, 1, 3),
|
|
34
|
-
columnStart = _utils$translate2[0],
|
|
35
|
-
columnSpan = _utils$translate2[1];
|
|
36
|
-
|
|
37
|
-
[['grid-row', rowStart], ['grid-row-span', rowSpan], ['grid-column', columnStart], ['grid-column-span', columnSpan]].forEach(function (_ref) {
|
|
38
|
-
var prop = _ref[0],
|
|
39
|
-
value = _ref[1];
|
|
40
|
-
utils.insertDecl(decl, prop, value);
|
|
41
|
-
});
|
|
42
|
-
utils.warnTemplateSelectorNotFound(decl, result);
|
|
43
|
-
utils.warnIfGridRowColumnExists(decl, result);
|
|
44
|
-
return undefined;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
return GridArea;
|
|
48
|
-
}(Declaration);
|
|
49
|
-
|
|
50
|
-
_defineProperty(GridArea, "names", ['grid-area']);
|
|
51
|
-
|
|
52
|
-
module.exports = GridArea;
|
|
34
|
+
module.exports = GridArea
|
|
@@ -1,48 +1,28 @@
|
|
|
1
|
-
|
|
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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
|
6
|
-
|
|
7
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
|
|
9
|
-
var Declaration = require('../declaration');
|
|
10
|
-
|
|
11
|
-
var GridColumnAlign = /*#__PURE__*/function (_Declaration) {
|
|
12
|
-
_inheritsLoose(GridColumnAlign, _Declaration);
|
|
13
|
-
|
|
14
|
-
function GridColumnAlign() {
|
|
15
|
-
return _Declaration.apply(this, arguments) || this;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
var _proto = GridColumnAlign.prototype;
|
|
1
|
+
let Declaration = require('../declaration')
|
|
19
2
|
|
|
3
|
+
class GridColumnAlign extends Declaration {
|
|
20
4
|
/**
|
|
21
5
|
* Do not prefix flexbox values
|
|
22
6
|
*/
|
|
23
|
-
|
|
24
|
-
return !decl.value.includes('flex-') && decl.value !== 'baseline'
|
|
7
|
+
check (decl) {
|
|
8
|
+
return !decl.value.includes('flex-') && decl.value !== 'baseline'
|
|
25
9
|
}
|
|
10
|
+
|
|
26
11
|
/**
|
|
27
12
|
* Change property name for IE
|
|
28
13
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
_proto.prefixed = function prefixed(prop, prefix) {
|
|
32
|
-
return prefix + 'grid-column-align';
|
|
14
|
+
prefixed (prop, prefix) {
|
|
15
|
+
return prefix + 'grid-column-align'
|
|
33
16
|
}
|
|
17
|
+
|
|
34
18
|
/**
|
|
35
19
|
* Change IE property back
|
|
36
20
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return GridColumnAlign;
|
|
44
|
-
}(Declaration);
|
|
21
|
+
normalize () {
|
|
22
|
+
return 'justify-self'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
45
25
|
|
|
46
|
-
|
|
26
|
+
GridColumnAlign.names = ['grid-column-align']
|
|
47
27
|
|
|
48
|
-
module.exports = GridColumnAlign
|
|
28
|
+
module.exports = GridColumnAlign
|
package/lib/hacks/grid-end.js
CHANGED
|
@@ -1,62 +1,47 @@
|
|
|
1
|
-
|
|
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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
|
6
|
-
|
|
7
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
|
|
9
|
-
var Declaration = require('../declaration');
|
|
10
|
-
|
|
11
|
-
var GridEnd = /*#__PURE__*/function (_Declaration) {
|
|
12
|
-
_inheritsLoose(GridEnd, _Declaration);
|
|
13
|
-
|
|
14
|
-
function GridEnd() {
|
|
15
|
-
return _Declaration.apply(this, arguments) || this;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
var _proto = GridEnd.prototype;
|
|
1
|
+
let Declaration = require('../declaration')
|
|
19
2
|
|
|
3
|
+
class GridEnd extends Declaration {
|
|
20
4
|
/**
|
|
21
5
|
* Change repeating syntax for IE
|
|
22
6
|
*/
|
|
23
|
-
|
|
24
|
-
if (prefix !== '-ms-') return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return undefined
|
|
7
|
+
insert (decl, prefix, prefixes, result) {
|
|
8
|
+
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
|
|
9
|
+
|
|
10
|
+
let clonedDecl = this.clone(decl)
|
|
11
|
+
|
|
12
|
+
let startProp = decl.prop.replace(/end$/, 'start')
|
|
13
|
+
let spanProp = prefix + decl.prop.replace(/end$/, 'span')
|
|
14
|
+
|
|
15
|
+
if (decl.parent.some(i => i.prop === spanProp)) {
|
|
16
|
+
return undefined
|
|
33
17
|
}
|
|
34
18
|
|
|
35
|
-
clonedDecl.prop = spanProp
|
|
19
|
+
clonedDecl.prop = spanProp
|
|
36
20
|
|
|
37
21
|
if (decl.value.includes('span')) {
|
|
38
|
-
clonedDecl.value = decl.value.replace(/span\s/i, '')
|
|
22
|
+
clonedDecl.value = decl.value.replace(/span\s/i, '')
|
|
39
23
|
} else {
|
|
40
|
-
|
|
41
|
-
decl.parent.walkDecls(startProp,
|
|
42
|
-
startDecl = d
|
|
43
|
-
})
|
|
44
|
-
|
|
24
|
+
let startDecl
|
|
25
|
+
decl.parent.walkDecls(startProp, d => {
|
|
26
|
+
startDecl = d
|
|
27
|
+
})
|
|
45
28
|
if (startDecl) {
|
|
46
|
-
|
|
47
|
-
clonedDecl.value = value
|
|
29
|
+
let value = Number(decl.value) - Number(startDecl.value) + ''
|
|
30
|
+
clonedDecl.value = value
|
|
48
31
|
} else {
|
|
49
|
-
decl.warn(
|
|
32
|
+
decl.warn(
|
|
33
|
+
result,
|
|
34
|
+
`Can not prefix ${decl.prop} (${startProp} is not found)`
|
|
35
|
+
)
|
|
50
36
|
}
|
|
51
37
|
}
|
|
52
38
|
|
|
53
|
-
decl.cloneBefore(clonedDecl)
|
|
54
|
-
return undefined;
|
|
55
|
-
};
|
|
39
|
+
decl.cloneBefore(clonedDecl)
|
|
56
40
|
|
|
57
|
-
|
|
58
|
-
}
|
|
41
|
+
return undefined
|
|
42
|
+
}
|
|
43
|
+
}
|
|
59
44
|
|
|
60
|
-
|
|
45
|
+
GridEnd.names = ['grid-row-end', 'grid-column-end']
|
|
61
46
|
|
|
62
|
-
module.exports = GridEnd
|
|
47
|
+
module.exports = GridEnd
|
|
@@ -1,48 +1,28 @@
|
|
|
1
|
-
|
|
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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
|
6
|
-
|
|
7
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
|
|
9
|
-
var Declaration = require('../declaration');
|
|
10
|
-
|
|
11
|
-
var GridRowAlign = /*#__PURE__*/function (_Declaration) {
|
|
12
|
-
_inheritsLoose(GridRowAlign, _Declaration);
|
|
13
|
-
|
|
14
|
-
function GridRowAlign() {
|
|
15
|
-
return _Declaration.apply(this, arguments) || this;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
var _proto = GridRowAlign.prototype;
|
|
1
|
+
let Declaration = require('../declaration')
|
|
19
2
|
|
|
3
|
+
class GridRowAlign extends Declaration {
|
|
20
4
|
/**
|
|
21
5
|
* Do not prefix flexbox values
|
|
22
6
|
*/
|
|
23
|
-
|
|
24
|
-
return !decl.value.includes('flex-') && decl.value !== 'baseline'
|
|
7
|
+
check (decl) {
|
|
8
|
+
return !decl.value.includes('flex-') && decl.value !== 'baseline'
|
|
25
9
|
}
|
|
10
|
+
|
|
26
11
|
/**
|
|
27
12
|
* Change property name for IE
|
|
28
13
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
_proto.prefixed = function prefixed(prop, prefix) {
|
|
32
|
-
return prefix + 'grid-row-align';
|
|
14
|
+
prefixed (prop, prefix) {
|
|
15
|
+
return prefix + 'grid-row-align'
|
|
33
16
|
}
|
|
17
|
+
|
|
34
18
|
/**
|
|
35
19
|
* Change IE property back
|
|
36
20
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return GridRowAlign;
|
|
44
|
-
}(Declaration);
|
|
21
|
+
normalize () {
|
|
22
|
+
return 'align-self'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
45
25
|
|
|
46
|
-
|
|
26
|
+
GridRowAlign.names = ['grid-row-align']
|
|
47
27
|
|
|
48
|
-
module.exports = GridRowAlign
|
|
28
|
+
module.exports = GridRowAlign
|
|
@@ -1,52 +1,33 @@
|
|
|
1
|
-
|
|
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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
|
6
|
-
|
|
7
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
|
|
9
|
-
var Declaration = require('../declaration');
|
|
10
|
-
|
|
11
|
-
var utils = require('./grid-utils');
|
|
12
|
-
|
|
13
|
-
var GridRowColumn = /*#__PURE__*/function (_Declaration) {
|
|
14
|
-
_inheritsLoose(GridRowColumn, _Declaration);
|
|
15
|
-
|
|
16
|
-
function GridRowColumn() {
|
|
17
|
-
return _Declaration.apply(this, arguments) || this;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var _proto = GridRowColumn.prototype;
|
|
1
|
+
let Declaration = require('../declaration')
|
|
2
|
+
let utils = require('./grid-utils')
|
|
21
3
|
|
|
4
|
+
class GridRowColumn extends Declaration {
|
|
22
5
|
/**
|
|
23
6
|
* Translate grid-row / grid-column to separate -ms- prefixed properties
|
|
24
7
|
*/
|
|
25
|
-
|
|
26
|
-
if (prefix !== '-ms-') return
|
|
27
|
-
var values = utils.parse(decl);
|
|
8
|
+
insert (decl, prefix, prefixes) {
|
|
9
|
+
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
|
|
28
10
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
span = _utils$translate[1];
|
|
11
|
+
let values = utils.parse(decl)
|
|
12
|
+
let [start, span] = utils.translate(values, 0, 1)
|
|
32
13
|
|
|
33
|
-
|
|
14
|
+
let hasStartValueSpan = values[0] && values[0].includes('span')
|
|
34
15
|
|
|
35
16
|
if (hasStartValueSpan) {
|
|
36
|
-
span = values[0].join('').replace(/\D/g, '')
|
|
17
|
+
span = values[0].join('').replace(/\D/g, '')
|
|
37
18
|
}
|
|
38
19
|
|
|
39
|
-
[
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
20
|
+
;[
|
|
21
|
+
[decl.prop, start],
|
|
22
|
+
[`${decl.prop}-span`, span]
|
|
23
|
+
].forEach(([prop, value]) => {
|
|
24
|
+
utils.insertDecl(decl, prop, value)
|
|
25
|
+
})
|
|
46
26
|
|
|
47
|
-
|
|
48
|
-
}
|
|
27
|
+
return undefined
|
|
28
|
+
}
|
|
29
|
+
}
|
|
49
30
|
|
|
50
|
-
|
|
31
|
+
GridRowColumn.names = ['grid-row', 'grid-column']
|
|
51
32
|
|
|
52
|
-
module.exports = GridRowColumn
|
|
33
|
+
module.exports = GridRowColumn
|
|
@@ -1,149 +1,125 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
prefixTrackProp = _require.prefixTrackProp,
|
|
13
|
-
prefixTrackValue = _require.prefixTrackValue,
|
|
14
|
-
autoplaceGridItems = _require.autoplaceGridItems,
|
|
15
|
-
getGridGap = _require.getGridGap,
|
|
16
|
-
inheritGridGap = _require.inheritGridGap;
|
|
17
|
-
|
|
18
|
-
var Processor = require('../processor');
|
|
19
|
-
|
|
20
|
-
var GridRowsColumns = /*#__PURE__*/function (_Declaration) {
|
|
21
|
-
_inheritsLoose(GridRowsColumns, _Declaration);
|
|
22
|
-
|
|
23
|
-
function GridRowsColumns() {
|
|
24
|
-
return _Declaration.apply(this, arguments) || this;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var _proto = GridRowsColumns.prototype;
|
|
28
|
-
|
|
1
|
+
let Declaration = require('../declaration')
|
|
2
|
+
let {
|
|
3
|
+
prefixTrackProp,
|
|
4
|
+
prefixTrackValue,
|
|
5
|
+
autoplaceGridItems,
|
|
6
|
+
getGridGap,
|
|
7
|
+
inheritGridGap
|
|
8
|
+
} = require('./grid-utils')
|
|
9
|
+
let Processor = require('../processor')
|
|
10
|
+
|
|
11
|
+
class GridRowsColumns extends Declaration {
|
|
29
12
|
/**
|
|
30
13
|
* Change property name for IE
|
|
31
14
|
*/
|
|
32
|
-
|
|
15
|
+
prefixed (prop, prefix) {
|
|
33
16
|
if (prefix === '-ms-') {
|
|
34
|
-
return prefixTrackProp({
|
|
35
|
-
prop: prop,
|
|
36
|
-
prefix: prefix
|
|
37
|
-
});
|
|
17
|
+
return prefixTrackProp({ prop, prefix })
|
|
38
18
|
}
|
|
39
|
-
|
|
40
|
-
return _Declaration.prototype.prefixed.call(this, prop, prefix);
|
|
19
|
+
return super.prefixed(prop, prefix)
|
|
41
20
|
}
|
|
21
|
+
|
|
42
22
|
/**
|
|
43
23
|
* Change IE property back
|
|
44
24
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
25
|
+
normalize (prop) {
|
|
26
|
+
return prop.replace(/^grid-(rows|columns)/, 'grid-template-$1')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
insert (decl, prefix, prefixes, result) {
|
|
30
|
+
if (prefix !== '-ms-') return super.insert(decl, prefix, prefixes)
|
|
31
|
+
|
|
32
|
+
let { parent, prop, value } = decl
|
|
33
|
+
let isRowProp = prop.includes('rows')
|
|
34
|
+
let isColumnProp = prop.includes('columns')
|
|
35
|
+
|
|
36
|
+
let hasGridTemplate = parent.some(
|
|
37
|
+
i => i.prop === 'grid-template' || i.prop === 'grid-template-areas'
|
|
38
|
+
)
|
|
39
|
+
|
|
61
40
|
/**
|
|
62
41
|
* Not to prefix rows declaration if grid-template(-areas) is present
|
|
63
42
|
*/
|
|
64
|
-
|
|
65
43
|
if (hasGridTemplate && isRowProp) {
|
|
66
|
-
return false
|
|
44
|
+
return false
|
|
67
45
|
}
|
|
68
46
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var gapValue = isRowProp ? gap.row : gap.column;
|
|
47
|
+
let processor = new Processor({ options: {} })
|
|
48
|
+
let status = processor.gridStatus(parent, result)
|
|
49
|
+
let gap = getGridGap(decl)
|
|
50
|
+
gap = inheritGridGap(decl, gap) || gap
|
|
51
|
+
|
|
52
|
+
let gapValue = isRowProp ? gap.row : gap.column
|
|
76
53
|
|
|
77
54
|
if ((status === 'no-autoplace' || status === true) && !hasGridTemplate) {
|
|
78
|
-
gapValue = null
|
|
55
|
+
gapValue = null
|
|
79
56
|
}
|
|
80
57
|
|
|
81
|
-
|
|
82
|
-
value
|
|
58
|
+
let prefixValue = prefixTrackValue({
|
|
59
|
+
value,
|
|
83
60
|
gap: gapValue
|
|
84
|
-
})
|
|
61
|
+
})
|
|
62
|
+
|
|
85
63
|
/**
|
|
86
64
|
* Insert prefixes
|
|
87
65
|
*/
|
|
88
|
-
|
|
89
66
|
decl.cloneBefore({
|
|
90
|
-
prop: prefixTrackProp({
|
|
91
|
-
prop: prop,
|
|
92
|
-
prefix: prefix
|
|
93
|
-
}),
|
|
67
|
+
prop: prefixTrackProp({ prop, prefix }),
|
|
94
68
|
value: prefixValue
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
var autoflowValue = 'row';
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
let autoflow = parent.nodes.find(i => i.prop === 'grid-auto-flow')
|
|
72
|
+
let autoflowValue = 'row'
|
|
100
73
|
|
|
101
74
|
if (autoflow && !processor.disabled(autoflow, result)) {
|
|
102
|
-
autoflowValue = autoflow.value.trim()
|
|
75
|
+
autoflowValue = autoflow.value.trim()
|
|
103
76
|
}
|
|
104
|
-
|
|
105
77
|
if (status === 'autoplace') {
|
|
106
78
|
/**
|
|
107
79
|
* Show warning if grid-template-rows decl is not found
|
|
108
80
|
*/
|
|
109
|
-
|
|
110
|
-
return i.prop === 'grid-template-rows';
|
|
111
|
-
});
|
|
81
|
+
let rowDecl = parent.nodes.find(i => i.prop === 'grid-template-rows')
|
|
112
82
|
|
|
113
83
|
if (!rowDecl && hasGridTemplate) {
|
|
114
|
-
return undefined
|
|
84
|
+
return undefined
|
|
115
85
|
} else if (!rowDecl && !hasGridTemplate) {
|
|
116
|
-
decl.warn(
|
|
117
|
-
|
|
86
|
+
decl.warn(
|
|
87
|
+
result,
|
|
88
|
+
'Autoplacement does not work without grid-template-rows property'
|
|
89
|
+
)
|
|
90
|
+
return undefined
|
|
118
91
|
}
|
|
92
|
+
|
|
119
93
|
/**
|
|
120
94
|
* Show warning if grid-template-columns decl is not found
|
|
121
95
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return i.prop === 'grid-template-columns';
|
|
126
|
-
});
|
|
127
|
-
|
|
96
|
+
let columnDecl = parent.nodes.find(i => {
|
|
97
|
+
return i.prop === 'grid-template-columns'
|
|
98
|
+
})
|
|
128
99
|
if (!columnDecl && !hasGridTemplate) {
|
|
129
|
-
decl.warn(
|
|
100
|
+
decl.warn(
|
|
101
|
+
result,
|
|
102
|
+
'Autoplacement does not work without grid-template-columns property'
|
|
103
|
+
)
|
|
130
104
|
}
|
|
105
|
+
|
|
131
106
|
/**
|
|
132
107
|
* Autoplace grid items
|
|
133
108
|
*/
|
|
134
|
-
|
|
135
|
-
|
|
136
109
|
if (isColumnProp && !hasGridTemplate) {
|
|
137
|
-
autoplaceGridItems(decl, result, gap, autoflowValue)
|
|
110
|
+
autoplaceGridItems(decl, result, gap, autoflowValue)
|
|
138
111
|
}
|
|
139
112
|
}
|
|
140
113
|
|
|
141
|
-
return undefined
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return GridRowsColumns;
|
|
145
|
-
}(Declaration);
|
|
114
|
+
return undefined
|
|
115
|
+
}
|
|
116
|
+
}
|
|
146
117
|
|
|
147
|
-
|
|
118
|
+
GridRowsColumns.names = [
|
|
119
|
+
'grid-template-rows',
|
|
120
|
+
'grid-template-columns',
|
|
121
|
+
'grid-rows',
|
|
122
|
+
'grid-columns'
|
|
123
|
+
]
|
|
148
124
|
|
|
149
|
-
module.exports = GridRowsColumns
|
|
125
|
+
module.exports = GridRowsColumns
|
package/lib/hacks/grid-start.js
CHANGED
|
@@ -1,55 +1,33 @@
|
|
|
1
|
-
|
|
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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
|
6
|
-
|
|
7
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
|
|
9
|
-
var Declaration = require('../declaration');
|
|
10
|
-
|
|
11
|
-
var GridStart = /*#__PURE__*/function (_Declaration) {
|
|
12
|
-
_inheritsLoose(GridStart, _Declaration);
|
|
13
|
-
|
|
14
|
-
function GridStart() {
|
|
15
|
-
return _Declaration.apply(this, arguments) || this;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
var _proto = GridStart.prototype;
|
|
1
|
+
let Declaration = require('../declaration')
|
|
19
2
|
|
|
3
|
+
class GridStart extends Declaration {
|
|
20
4
|
/**
|
|
21
5
|
* Do not add prefix for unsupported value in IE
|
|
22
6
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return !value.includes('/') || value.includes('span')
|
|
7
|
+
check (decl) {
|
|
8
|
+
let value = decl.value
|
|
9
|
+
return !value.includes('/') || value.includes('span')
|
|
26
10
|
}
|
|
11
|
+
|
|
27
12
|
/**
|
|
28
13
|
* Return a final spec property
|
|
29
14
|
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
_proto.normalize = function normalize(prop) {
|
|
33
|
-
return prop.replace('-start', '');
|
|
15
|
+
normalize (prop) {
|
|
16
|
+
return prop.replace('-start', '')
|
|
34
17
|
}
|
|
18
|
+
|
|
35
19
|
/**
|
|
36
20
|
* Change property name for IE
|
|
37
21
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
_proto.prefixed = function prefixed(prop, prefix) {
|
|
41
|
-
var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
|
|
42
|
-
|
|
22
|
+
prefixed (prop, prefix) {
|
|
23
|
+
let result = super.prefixed(prop, prefix)
|
|
43
24
|
if (prefix === '-ms-') {
|
|
44
|
-
result = result.replace('-start', '')
|
|
25
|
+
result = result.replace('-start', '')
|
|
45
26
|
}
|
|
27
|
+
return result
|
|
28
|
+
}
|
|
29
|
+
}
|
|
46
30
|
|
|
47
|
-
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
return GridStart;
|
|
51
|
-
}(Declaration);
|
|
52
|
-
|
|
53
|
-
_defineProperty(GridStart, "names", ['grid-row-start', 'grid-column-start']);
|
|
31
|
+
GridStart.names = ['grid-row-start', 'grid-column-start']
|
|
54
32
|
|
|
55
|
-
module.exports = GridStart
|
|
33
|
+
module.exports = GridStart
|