cssstyle 5.3.5 → 5.3.6
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/lib/CSSStyleDeclaration.js +2 -2
- package/lib/generated/implementedProperties.js +1 -1
- package/lib/generated/properties.js +1958 -2271
- package/lib/generated/propertyDefinitions.js +13033 -0
- package/lib/normalize.js +1259 -1095
- package/lib/parsers.js +588 -228
- package/lib/properties/background.js +89 -79
- package/lib/properties/backgroundAttachment.js +11 -14
- package/lib/properties/backgroundClip.js +11 -14
- package/lib/properties/backgroundColor.js +8 -13
- package/lib/properties/backgroundImage.js +11 -26
- package/lib/properties/backgroundOrigin.js +11 -14
- package/lib/properties/backgroundPosition.js +29 -18
- package/lib/properties/backgroundRepeat.js +11 -7
- package/lib/properties/backgroundSize.js +22 -16
- package/lib/properties/border.js +30 -87
- package/lib/properties/borderBottom.js +30 -86
- package/lib/properties/borderBottomColor.js +8 -14
- package/lib/properties/borderBottomStyle.js +8 -13
- package/lib/properties/borderBottomWidth.js +11 -23
- package/lib/properties/borderCollapse.js +4 -9
- package/lib/properties/borderColor.js +17 -23
- package/lib/properties/borderLeft.js +30 -86
- package/lib/properties/borderLeftColor.js +8 -14
- package/lib/properties/borderLeftStyle.js +8 -13
- package/lib/properties/borderLeftWidth.js +11 -23
- package/lib/properties/borderRight.js +30 -86
- package/lib/properties/borderRightColor.js +8 -14
- package/lib/properties/borderRightStyle.js +8 -13
- package/lib/properties/borderRightWidth.js +11 -23
- package/lib/properties/borderSpacing.js +12 -9
- package/lib/properties/borderStyle.js +17 -23
- package/lib/properties/borderTop.js +30 -86
- package/lib/properties/borderTopColor.js +8 -14
- package/lib/properties/borderTopStyle.js +8 -13
- package/lib/properties/borderTopWidth.js +11 -23
- package/lib/properties/borderWidth.js +18 -36
- package/lib/properties/bottom.js +6 -17
- package/lib/properties/clear.js +4 -9
- package/lib/properties/clip.js +10 -5
- package/lib/properties/color.js +4 -10
- package/lib/properties/display.js +11 -8
- package/lib/properties/flex.js +55 -53
- package/lib/properties/flexBasis.js +10 -20
- package/lib/properties/flexGrow.js +10 -19
- package/lib/properties/flexShrink.js +10 -19
- package/lib/properties/float.js +4 -9
- package/lib/properties/floodColor.js +4 -10
- package/lib/properties/font.js +46 -33
- package/lib/properties/fontFamily.js +16 -12
- package/lib/properties/fontSize.js +11 -22
- package/lib/properties/fontStyle.js +14 -8
- package/lib/properties/fontVariant.js +11 -18
- package/lib/properties/fontWeight.js +14 -25
- package/lib/properties/height.js +7 -17
- package/lib/properties/left.js +6 -17
- package/lib/properties/lightingColor.js +4 -10
- package/lib/properties/lineHeight.js +10 -24
- package/lib/properties/margin.js +14 -32
- package/lib/properties/marginBottom.js +10 -20
- package/lib/properties/marginLeft.js +10 -20
- package/lib/properties/marginRight.js +10 -20
- package/lib/properties/marginTop.js +10 -20
- package/lib/properties/opacity.js +6 -18
- package/lib/properties/outlineColor.js +4 -10
- package/lib/properties/padding.js +15 -30
- package/lib/properties/paddingBottom.js +11 -21
- package/lib/properties/paddingLeft.js +11 -21
- package/lib/properties/paddingRight.js +11 -21
- package/lib/properties/paddingTop.js +11 -21
- package/lib/properties/right.js +6 -17
- package/lib/properties/stopColor.js +4 -10
- package/lib/properties/top.js +7 -17
- package/lib/properties/webkitBorderAfterColor.js +4 -10
- package/lib/properties/webkitBorderBeforeColor.js +4 -10
- package/lib/properties/webkitBorderEndColor.js +4 -10
- package/lib/properties/webkitBorderStartColor.js +4 -10
- package/lib/properties/webkitColumnRuleColor.js +4 -10
- package/lib/properties/webkitTapHighlightColor.js +4 -10
- package/lib/properties/webkitTextEmphasisColor.js +4 -10
- package/lib/properties/webkitTextFillColor.js +4 -10
- package/lib/properties/webkitTextStrokeColor.js +4 -10
- package/lib/properties/width.js +7 -17
- package/lib/utils/propertyDescriptors.js +49 -13
- package/lib/utils/strings.js +6 -0
- package/package.json +8 -27
package/lib/properties/clip.js
CHANGED
|
@@ -6,11 +6,12 @@ const parsers = require("../parsers");
|
|
|
6
6
|
|
|
7
7
|
const property = "clip";
|
|
8
8
|
|
|
9
|
-
module.exports.parse =
|
|
9
|
+
module.exports.parse = (v, opt = {}) => {
|
|
10
10
|
const { globalObject } = opt;
|
|
11
11
|
if (v === "") {
|
|
12
12
|
return v;
|
|
13
13
|
}
|
|
14
|
+
const { AST_TYPES } = parsers;
|
|
14
15
|
const value = parsers.parsePropertyValue(property, v, {
|
|
15
16
|
globalObject,
|
|
16
17
|
inArray: true
|
|
@@ -18,14 +19,16 @@ module.exports.parse = function parse(v, opt = {}) {
|
|
|
18
19
|
if (Array.isArray(value) && value.length === 1) {
|
|
19
20
|
const [{ name, type, value: itemValue }] = value;
|
|
20
21
|
switch (type) {
|
|
21
|
-
case
|
|
22
|
+
case AST_TYPES.FUNCTION: {
|
|
22
23
|
const values = parsers.splitValue(itemValue, {
|
|
23
24
|
delimiter: ","
|
|
24
25
|
});
|
|
25
26
|
const parsedValues = [];
|
|
26
27
|
for (const item of values) {
|
|
27
28
|
const parsedValue = parsers.parseCSS(item, { context: "value" }, true);
|
|
28
|
-
const val = parsers.
|
|
29
|
+
const val = parsers.resolveNumericValue(parsedValue.children, {
|
|
30
|
+
type: "length"
|
|
31
|
+
});
|
|
29
32
|
if (val) {
|
|
30
33
|
parsedValues.push(val);
|
|
31
34
|
} else {
|
|
@@ -34,8 +37,8 @@ module.exports.parse = function parse(v, opt = {}) {
|
|
|
34
37
|
}
|
|
35
38
|
return `${name}(${parsedValues.join(", ")})`;
|
|
36
39
|
}
|
|
37
|
-
case
|
|
38
|
-
case
|
|
40
|
+
case AST_TYPES.GLOBAL_KEYWORD:
|
|
41
|
+
case AST_TYPES.IDENTIFIER: {
|
|
39
42
|
return name;
|
|
40
43
|
}
|
|
41
44
|
default:
|
|
@@ -66,3 +69,5 @@ module.exports.definition = {
|
|
|
66
69
|
enumerable: true,
|
|
67
70
|
configurable: true
|
|
68
71
|
};
|
|
72
|
+
|
|
73
|
+
module.exports.property = property;
|
package/lib/properties/color.js
CHANGED
|
@@ -4,7 +4,7 @@ const parsers = require("../parsers");
|
|
|
4
4
|
|
|
5
5
|
const property = "color";
|
|
6
6
|
|
|
7
|
-
module.exports.parse =
|
|
7
|
+
module.exports.parse = (v, opt = {}) => {
|
|
8
8
|
const { globalObject } = opt;
|
|
9
9
|
if (v === "") {
|
|
10
10
|
return v;
|
|
@@ -14,15 +14,7 @@ module.exports.parse = function parse(v, opt = {}) {
|
|
|
14
14
|
inArray: true
|
|
15
15
|
});
|
|
16
16
|
if (Array.isArray(value) && value.length === 1) {
|
|
17
|
-
|
|
18
|
-
switch (type) {
|
|
19
|
-
case "GlobalKeyword": {
|
|
20
|
-
return name;
|
|
21
|
-
}
|
|
22
|
-
default: {
|
|
23
|
-
return parsers.parseColor(value);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
17
|
+
return parsers.resolveColorValue(value);
|
|
26
18
|
} else if (typeof value === "string") {
|
|
27
19
|
return value;
|
|
28
20
|
}
|
|
@@ -49,3 +41,5 @@ module.exports.definition = {
|
|
|
49
41
|
enumerable: true,
|
|
50
42
|
configurable: true
|
|
51
43
|
};
|
|
44
|
+
|
|
45
|
+
module.exports.property = property;
|
|
@@ -8,11 +8,12 @@ const property = "display";
|
|
|
8
8
|
const displayOutside = ["block", "inline", "run-in"];
|
|
9
9
|
const displayFlow = ["flow", "flow-root"];
|
|
10
10
|
|
|
11
|
-
module.exports.parse =
|
|
11
|
+
module.exports.parse = (v, opt = {}) => {
|
|
12
12
|
const { globalObject } = opt;
|
|
13
13
|
if (v === "") {
|
|
14
14
|
return v;
|
|
15
15
|
}
|
|
16
|
+
const { AST_TYPES } = parsers;
|
|
16
17
|
const value = parsers.parsePropertyValue(property, v, {
|
|
17
18
|
globalObject,
|
|
18
19
|
inArray: true
|
|
@@ -22,10 +23,10 @@ module.exports.parse = function parse(v, opt = {}) {
|
|
|
22
23
|
case 1: {
|
|
23
24
|
const [{ name, type }] = value;
|
|
24
25
|
switch (type) {
|
|
25
|
-
case
|
|
26
|
+
case AST_TYPES.GLOBAL_KEYWORD: {
|
|
26
27
|
return name;
|
|
27
28
|
}
|
|
28
|
-
case
|
|
29
|
+
case AST_TYPES.IDENTIFIER: {
|
|
29
30
|
if (name === "flow") {
|
|
30
31
|
return "block";
|
|
31
32
|
}
|
|
@@ -37,8 +38,8 @@ module.exports.parse = function parse(v, opt = {}) {
|
|
|
37
38
|
}
|
|
38
39
|
case 2: {
|
|
39
40
|
const [part1, part2] = value;
|
|
40
|
-
const val1 = part1.type ===
|
|
41
|
-
const val2 = part2.type ===
|
|
41
|
+
const val1 = part1.type === AST_TYPES.IDENTIFIER && part1.name;
|
|
42
|
+
const val2 = part2.type === AST_TYPES.IDENTIFIER && part2.name;
|
|
42
43
|
if (val1 && val2) {
|
|
43
44
|
let outerValue = "";
|
|
44
45
|
let innerValue = "";
|
|
@@ -122,9 +123,9 @@ module.exports.parse = function parse(v, opt = {}) {
|
|
|
122
123
|
}
|
|
123
124
|
case 3: {
|
|
124
125
|
const [part1, part2, part3] = value;
|
|
125
|
-
const val1 = part1.type ===
|
|
126
|
-
const val2 = part2.type ===
|
|
127
|
-
const val3 = part3.type ===
|
|
126
|
+
const val1 = part1.type === AST_TYPES.IDENTIFIER && part1.name;
|
|
127
|
+
const val2 = part2.type === AST_TYPES.IDENTIFIER && part2.name;
|
|
128
|
+
const val3 = part3.type === AST_TYPES.IDENTIFIER && part3.name;
|
|
128
129
|
if (val1 && val2 && part3) {
|
|
129
130
|
let outerValue = "";
|
|
130
131
|
let flowValue = "";
|
|
@@ -205,3 +206,5 @@ module.exports.definition = {
|
|
|
205
206
|
enumerable: true,
|
|
206
207
|
configurable: true
|
|
207
208
|
};
|
|
209
|
+
|
|
210
|
+
module.exports.property = property;
|
package/lib/properties/flex.js
CHANGED
|
@@ -8,123 +8,124 @@ const flexBasis = require("./flexBasis");
|
|
|
8
8
|
const property = "flex";
|
|
9
9
|
|
|
10
10
|
module.exports.initialValues = new Map([
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
11
|
+
[flexGrow.property, "0"],
|
|
12
|
+
[flexShrink.property, "1"],
|
|
13
|
+
[flexBasis.property, "auto"]
|
|
14
14
|
]);
|
|
15
15
|
|
|
16
16
|
module.exports.shorthandFor = new Map([
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
17
|
+
[flexGrow.property, flexGrow],
|
|
18
|
+
[flexShrink.property, flexShrink],
|
|
19
|
+
[flexBasis.property, flexBasis]
|
|
20
20
|
]);
|
|
21
21
|
|
|
22
|
-
module.exports.parse =
|
|
22
|
+
module.exports.parse = (v, opt = {}) => {
|
|
23
23
|
const { globalObject } = opt;
|
|
24
24
|
if (v === "") {
|
|
25
25
|
return v;
|
|
26
26
|
}
|
|
27
|
+
const { AST_TYPES } = parsers;
|
|
27
28
|
const value = parsers.parsePropertyValue(property, v, {
|
|
28
29
|
globalObject,
|
|
29
30
|
inArray: true
|
|
30
31
|
});
|
|
31
32
|
if (Array.isArray(value) && value.length) {
|
|
32
33
|
const flex = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
[flexGrow.property]: "1",
|
|
35
|
+
[flexShrink.property]: "1",
|
|
36
|
+
[flexBasis.property]: "0%"
|
|
36
37
|
};
|
|
37
38
|
if (value.length === 1) {
|
|
38
39
|
const [{ isNumber, name, type, unit, value: itemValue }] = value;
|
|
39
40
|
switch (type) {
|
|
40
|
-
case
|
|
41
|
+
case AST_TYPES.CALC: {
|
|
41
42
|
if (isNumber) {
|
|
42
|
-
flex[
|
|
43
|
+
flex[flexGrow.property] = `${name}(${itemValue})`;
|
|
43
44
|
return flex;
|
|
44
45
|
}
|
|
45
|
-
flex[
|
|
46
|
+
flex[flexBasis.property] = `${name}(${itemValue})`;
|
|
46
47
|
return flex;
|
|
47
48
|
}
|
|
48
|
-
case
|
|
49
|
-
flex[
|
|
49
|
+
case AST_TYPES.DIMENSION: {
|
|
50
|
+
flex[flexBasis.property] = `${itemValue}${unit}`;
|
|
50
51
|
return flex;
|
|
51
52
|
}
|
|
52
|
-
case
|
|
53
|
+
case AST_TYPES.GLOBAL_KEYWORD: {
|
|
53
54
|
return name;
|
|
54
55
|
}
|
|
55
|
-
case
|
|
56
|
+
case AST_TYPES.IDENTIFIER: {
|
|
56
57
|
if (name === "none") {
|
|
57
58
|
return {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
[flexGrow.property]: "0",
|
|
60
|
+
[flexShrink.property]: "0",
|
|
61
|
+
[flexBasis.property]: "auto"
|
|
61
62
|
};
|
|
62
63
|
}
|
|
63
|
-
flex[
|
|
64
|
+
flex[flexBasis.property] = name;
|
|
64
65
|
return flex;
|
|
65
66
|
}
|
|
66
|
-
case
|
|
67
|
-
flex[
|
|
67
|
+
case AST_TYPES.NUMBER: {
|
|
68
|
+
flex[flexGrow.property] = itemValue;
|
|
68
69
|
return flex;
|
|
69
70
|
}
|
|
70
|
-
case
|
|
71
|
-
flex[
|
|
71
|
+
case AST_TYPES.PERCENTAGE: {
|
|
72
|
+
flex[flexBasis.property] = `${itemValue}%`;
|
|
72
73
|
return flex;
|
|
73
74
|
}
|
|
74
75
|
default:
|
|
75
76
|
}
|
|
76
77
|
} else {
|
|
77
78
|
const [val1, val2, val3] = value;
|
|
78
|
-
if (val1.type ===
|
|
79
|
-
flex[
|
|
80
|
-
} else if (val1.type ===
|
|
81
|
-
flex[
|
|
79
|
+
if (val1.type === AST_TYPES.CALC && val1.isNumber) {
|
|
80
|
+
flex[flexGrow.property] = `${val1.name}(${val1.value})`;
|
|
81
|
+
} else if (val1.type === AST_TYPES.NUMBER) {
|
|
82
|
+
flex[flexGrow.property] = val1.value;
|
|
82
83
|
} else {
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
86
|
if (val3) {
|
|
86
|
-
if (val2.type ===
|
|
87
|
-
flex[
|
|
88
|
-
} else if (val2.type ===
|
|
89
|
-
flex[
|
|
87
|
+
if (val2.type === AST_TYPES.CALC && val2.isNumber) {
|
|
88
|
+
flex[flexShrink.property] = `${val2.name}(${val2.value})`;
|
|
89
|
+
} else if (val2.type === AST_TYPES.NUMBER) {
|
|
90
|
+
flex[flexShrink.property] = val2.value;
|
|
90
91
|
} else {
|
|
91
92
|
return;
|
|
92
93
|
}
|
|
93
|
-
if (val3.type ===
|
|
94
|
-
flex[
|
|
95
|
-
} else if (val3.type ===
|
|
96
|
-
flex[
|
|
97
|
-
} else if (val3.type ===
|
|
98
|
-
flex[
|
|
99
|
-
} else if (val3.type ===
|
|
100
|
-
flex[
|
|
94
|
+
if (val3.type === AST_TYPES.GLOBAL_KEYWORD || val3.type === AST_TYPES.IDENTIFIER) {
|
|
95
|
+
flex[flexBasis.property] = val3.name;
|
|
96
|
+
} else if (val3.type === AST_TYPES.CALC && !val3.isNumber) {
|
|
97
|
+
flex[flexBasis.property] = `${val3.name}(${val3.value})`;
|
|
98
|
+
} else if (val3.type === AST_TYPES.DIMENSION) {
|
|
99
|
+
flex[flexBasis.property] = `${val3.value}${val3.unit}`;
|
|
100
|
+
} else if (val3.type === AST_TYPES.PERCENTAGE) {
|
|
101
|
+
flex[flexBasis.property] = `${val3.value}%`;
|
|
101
102
|
} else {
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
104
105
|
} else {
|
|
105
106
|
switch (val2.type) {
|
|
106
|
-
case
|
|
107
|
+
case AST_TYPES.CALC: {
|
|
107
108
|
if (val2.isNumber) {
|
|
108
|
-
flex[
|
|
109
|
+
flex[flexShrink.property] = `${val2.name}(${val2.value})`;
|
|
109
110
|
} else {
|
|
110
|
-
flex[
|
|
111
|
+
flex[flexBasis.property] = `${val2.name}(${val2.value})`;
|
|
111
112
|
}
|
|
112
113
|
break;
|
|
113
114
|
}
|
|
114
|
-
case
|
|
115
|
-
flex[
|
|
115
|
+
case AST_TYPES.DIMENSION: {
|
|
116
|
+
flex[flexBasis.property] = `${val2.value}${val2.unit}`;
|
|
116
117
|
break;
|
|
117
118
|
}
|
|
118
|
-
case
|
|
119
|
-
flex[
|
|
119
|
+
case AST_TYPES.NUMBER: {
|
|
120
|
+
flex[flexShrink.property] = val2.value;
|
|
120
121
|
break;
|
|
121
122
|
}
|
|
122
|
-
case
|
|
123
|
-
flex[
|
|
123
|
+
case AST_TYPES.PERCENTAGE: {
|
|
124
|
+
flex[flexBasis.property] = `${val2.value}%`;
|
|
124
125
|
break;
|
|
125
126
|
}
|
|
126
|
-
case
|
|
127
|
-
flex[
|
|
127
|
+
case AST_TYPES.IDENTIFIER: {
|
|
128
|
+
flex[flexBasis.property] = val2.name;
|
|
128
129
|
break;
|
|
129
130
|
}
|
|
130
131
|
default: {
|
|
@@ -133,7 +134,6 @@ module.exports.parse = function parse(v, opt = {}) {
|
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
return flex;
|
|
136
|
-
// return [...Object.values(flex)].join(" ");
|
|
137
137
|
}
|
|
138
138
|
} else if (typeof value === "string") {
|
|
139
139
|
return value;
|
|
@@ -174,3 +174,5 @@ module.exports.definition = {
|
|
|
174
174
|
enumerable: true,
|
|
175
175
|
configurable: true
|
|
176
176
|
};
|
|
177
|
+
|
|
178
|
+
module.exports.property = property;
|
|
@@ -5,7 +5,7 @@ const parsers = require("../parsers");
|
|
|
5
5
|
const property = "flex-basis";
|
|
6
6
|
const shorthand = "flex";
|
|
7
7
|
|
|
8
|
-
module.exports.parse =
|
|
8
|
+
module.exports.parse = (v, opt = {}) => {
|
|
9
9
|
const { globalObject } = opt;
|
|
10
10
|
if (v === "") {
|
|
11
11
|
return v;
|
|
@@ -15,22 +15,9 @@ module.exports.parse = function parse(v, opt = {}) {
|
|
|
15
15
|
inArray: true
|
|
16
16
|
});
|
|
17
17
|
if (Array.isArray(value) && value.length === 1) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (isNumber) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
return `${name}(${itemValue})`;
|
|
25
|
-
}
|
|
26
|
-
case "GlobalKeyword":
|
|
27
|
-
case "Identifier": {
|
|
28
|
-
return name;
|
|
29
|
-
}
|
|
30
|
-
default: {
|
|
31
|
-
return parsers.parseLengthPercentage(value);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
18
|
+
return parsers.resolveNumericValue(value, {
|
|
19
|
+
type: "length"
|
|
20
|
+
});
|
|
34
21
|
} else if (typeof value === "string") {
|
|
35
22
|
return value;
|
|
36
23
|
}
|
|
@@ -47,9 +34,10 @@ module.exports.definition = {
|
|
|
47
34
|
globalObject: this._global
|
|
48
35
|
});
|
|
49
36
|
if (typeof val === "string") {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
37
|
+
const priority =
|
|
38
|
+
!this._priorities.get(shorthand) && this._priorities.has(property)
|
|
39
|
+
? this._priorities.get(property)
|
|
40
|
+
: "";
|
|
53
41
|
this._flexBoxSetter(property, val, priority, shorthand);
|
|
54
42
|
}
|
|
55
43
|
}
|
|
@@ -60,3 +48,5 @@ module.exports.definition = {
|
|
|
60
48
|
enumerable: true,
|
|
61
49
|
configurable: true
|
|
62
50
|
};
|
|
51
|
+
|
|
52
|
+
module.exports.property = property;
|
|
@@ -5,7 +5,7 @@ const parsers = require("../parsers");
|
|
|
5
5
|
const property = "flex-grow";
|
|
6
6
|
const shorthand = "flex";
|
|
7
7
|
|
|
8
|
-
module.exports.parse =
|
|
8
|
+
module.exports.parse = (v, opt = {}) => {
|
|
9
9
|
const { globalObject } = opt;
|
|
10
10
|
if (v === "") {
|
|
11
11
|
return v;
|
|
@@ -15,21 +15,9 @@ module.exports.parse = function parse(v, opt = {}) {
|
|
|
15
15
|
inArray: true
|
|
16
16
|
});
|
|
17
17
|
if (Array.isArray(value) && value.length === 1) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (isNumber) {
|
|
22
|
-
return `${name}(${itemValue})`;
|
|
23
|
-
}
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
case "GlobalKeyword": {
|
|
27
|
-
return name;
|
|
28
|
-
}
|
|
29
|
-
default: {
|
|
30
|
-
return parsers.parseNumber(value);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
18
|
+
return parsers.resolveNumericValue(value, {
|
|
19
|
+
min: 0
|
|
20
|
+
});
|
|
33
21
|
} else if (typeof value === "string") {
|
|
34
22
|
return value;
|
|
35
23
|
}
|
|
@@ -46,9 +34,10 @@ module.exports.definition = {
|
|
|
46
34
|
globalObject: this._global
|
|
47
35
|
});
|
|
48
36
|
if (typeof val === "string") {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
const priority =
|
|
38
|
+
!this._priorities.get(shorthand) && this._priorities.has(property)
|
|
39
|
+
? this._priorities.get(property)
|
|
40
|
+
: "";
|
|
52
41
|
this._flexBoxSetter(property, val, priority, shorthand);
|
|
53
42
|
}
|
|
54
43
|
}
|
|
@@ -59,3 +48,5 @@ module.exports.definition = {
|
|
|
59
48
|
enumerable: true,
|
|
60
49
|
configurable: true
|
|
61
50
|
};
|
|
51
|
+
|
|
52
|
+
module.exports.property = property;
|
|
@@ -5,7 +5,7 @@ const parsers = require("../parsers");
|
|
|
5
5
|
const property = "flex-shrink";
|
|
6
6
|
const shorthand = "flex";
|
|
7
7
|
|
|
8
|
-
module.exports.parse =
|
|
8
|
+
module.exports.parse = (v, opt = {}) => {
|
|
9
9
|
const { globalObject } = opt;
|
|
10
10
|
if (v === "") {
|
|
11
11
|
return v;
|
|
@@ -15,21 +15,9 @@ module.exports.parse = function parse(v, opt = {}) {
|
|
|
15
15
|
inArray: true
|
|
16
16
|
});
|
|
17
17
|
if (Array.isArray(value) && value.length === 1) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (isNumber) {
|
|
22
|
-
return `${name}(${itemValue})`;
|
|
23
|
-
}
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
case "GlobalKeyword": {
|
|
27
|
-
return name;
|
|
28
|
-
}
|
|
29
|
-
default: {
|
|
30
|
-
return parsers.parseNumber(value);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
18
|
+
return parsers.resolveNumericValue(value, {
|
|
19
|
+
min: 0
|
|
20
|
+
});
|
|
33
21
|
} else if (typeof value === "string") {
|
|
34
22
|
return value;
|
|
35
23
|
}
|
|
@@ -46,9 +34,10 @@ module.exports.definition = {
|
|
|
46
34
|
globalObject: this._global
|
|
47
35
|
});
|
|
48
36
|
if (typeof val === "string") {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
const priority =
|
|
38
|
+
!this._priorities.get(shorthand) && this._priorities.has(property)
|
|
39
|
+
? this._priorities.get(property)
|
|
40
|
+
: "";
|
|
52
41
|
this._flexBoxSetter(property, val, priority, shorthand);
|
|
53
42
|
}
|
|
54
43
|
}
|
|
@@ -59,3 +48,5 @@ module.exports.definition = {
|
|
|
59
48
|
enumerable: true,
|
|
60
49
|
configurable: true
|
|
61
50
|
};
|
|
51
|
+
|
|
52
|
+
module.exports.property = property;
|
package/lib/properties/float.js
CHANGED
|
@@ -4,7 +4,7 @@ const parsers = require("../parsers");
|
|
|
4
4
|
|
|
5
5
|
const property = "float";
|
|
6
6
|
|
|
7
|
-
module.exports.parse =
|
|
7
|
+
module.exports.parse = (v, opt = {}) => {
|
|
8
8
|
const { globalObject } = opt;
|
|
9
9
|
if (v === "") {
|
|
10
10
|
return v;
|
|
@@ -14,14 +14,7 @@ module.exports.parse = function parse(v, opt = {}) {
|
|
|
14
14
|
inArray: true
|
|
15
15
|
});
|
|
16
16
|
if (Array.isArray(value) && value.length === 1) {
|
|
17
|
-
|
|
18
|
-
switch (type) {
|
|
19
|
-
case "GlobalKeyword":
|
|
20
|
-
case "Identifier": {
|
|
21
|
-
return name;
|
|
22
|
-
}
|
|
23
|
-
default:
|
|
24
|
-
}
|
|
17
|
+
return parsers.resolveKeywordValue(value);
|
|
25
18
|
} else if (typeof value === "string") {
|
|
26
19
|
return value;
|
|
27
20
|
}
|
|
@@ -48,3 +41,5 @@ module.exports.definition = {
|
|
|
48
41
|
enumerable: true,
|
|
49
42
|
configurable: true
|
|
50
43
|
};
|
|
44
|
+
|
|
45
|
+
module.exports.property = property;
|
|
@@ -4,7 +4,7 @@ const parsers = require("../parsers");
|
|
|
4
4
|
|
|
5
5
|
const property = "flood-color";
|
|
6
6
|
|
|
7
|
-
module.exports.parse =
|
|
7
|
+
module.exports.parse = (v, opt = {}) => {
|
|
8
8
|
const { globalObject } = opt;
|
|
9
9
|
if (v === "") {
|
|
10
10
|
return v;
|
|
@@ -14,15 +14,7 @@ module.exports.parse = function parse(v, opt = {}) {
|
|
|
14
14
|
inArray: true
|
|
15
15
|
});
|
|
16
16
|
if (Array.isArray(value) && value.length === 1) {
|
|
17
|
-
|
|
18
|
-
switch (type) {
|
|
19
|
-
case "GlobalKeyword": {
|
|
20
|
-
return name;
|
|
21
|
-
}
|
|
22
|
-
default: {
|
|
23
|
-
return parsers.parseColor(value);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
17
|
+
return parsers.resolveColorValue(value);
|
|
26
18
|
} else if (typeof value === "string") {
|
|
27
19
|
return value;
|
|
28
20
|
}
|
|
@@ -49,3 +41,5 @@ module.exports.definition = {
|
|
|
49
41
|
enumerable: true,
|
|
50
42
|
configurable: true
|
|
51
43
|
};
|
|
44
|
+
|
|
45
|
+
module.exports.property = property;
|