cssstyle 5.2.0 → 5.3.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/lib/CSSStyleDeclaration.js +250 -254
- package/lib/generated/allProperties.js +39 -1
- package/lib/generated/implementedProperties.js +2219 -80
- package/lib/generated/properties.js +5253 -1904
- package/lib/normalize.js +1417 -0
- package/lib/parsers.js +372 -389
- package/lib/properties/background.js +76 -63
- package/lib/properties/backgroundAttachment.js +37 -22
- package/lib/properties/backgroundClip.js +37 -22
- package/lib/properties/backgroundColor.js +35 -15
- package/lib/properties/backgroundImage.js +49 -19
- package/lib/properties/backgroundOrigin.js +37 -22
- package/lib/properties/backgroundPosition.js +145 -128
- package/lib/properties/backgroundRepeat.js +55 -48
- package/lib/properties/backgroundSize.js +86 -46
- package/lib/properties/border.js +139 -22
- package/lib/properties/borderBottom.js +137 -21
- package/lib/properties/borderBottomColor.js +41 -16
- package/lib/properties/borderBottomStyle.js +39 -30
- package/lib/properties/borderBottomWidth.js +49 -16
- package/lib/properties/borderCollapse.js +32 -8
- package/lib/properties/borderColor.js +96 -23
- package/lib/properties/borderLeft.js +137 -21
- package/lib/properties/borderLeftColor.js +41 -16
- package/lib/properties/borderLeftStyle.js +39 -30
- package/lib/properties/borderLeftWidth.js +49 -16
- package/lib/properties/borderRight.js +137 -21
- package/lib/properties/borderRightColor.js +41 -16
- package/lib/properties/borderRightStyle.js +39 -30
- package/lib/properties/borderRightWidth.js +49 -16
- package/lib/properties/borderSpacing.js +42 -25
- package/lib/properties/borderStyle.js +96 -34
- package/lib/properties/borderTop.js +131 -15
- package/lib/properties/borderTopColor.js +41 -16
- package/lib/properties/borderTopStyle.js +39 -30
- package/lib/properties/borderTopWidth.js +49 -16
- package/lib/properties/borderWidth.js +108 -23
- package/lib/properties/bottom.js +40 -12
- package/lib/properties/clear.js +32 -22
- package/lib/properties/clip.js +46 -32
- package/lib/properties/color.js +34 -13
- package/lib/properties/display.js +169 -179
- package/lib/properties/flex.js +137 -38
- package/lib/properties/flexBasis.js +43 -14
- package/lib/properties/flexGrow.js +42 -9
- package/lib/properties/flexShrink.js +42 -9
- package/lib/properties/float.js +32 -9
- package/lib/properties/floodColor.js +34 -13
- package/lib/properties/font.js +145 -44
- package/lib/properties/fontFamily.js +66 -67
- package/lib/properties/fontSize.js +43 -26
- package/lib/properties/fontStyle.js +42 -11
- package/lib/properties/fontVariant.js +52 -15
- package/lib/properties/fontWeight.js +47 -15
- package/lib/properties/height.js +40 -13
- package/lib/properties/left.js +40 -12
- package/lib/properties/lightingColor.js +34 -13
- package/lib/properties/lineHeight.js +45 -18
- package/lib/properties/margin.js +73 -36
- package/lib/properties/marginBottom.js +43 -19
- package/lib/properties/marginLeft.js +43 -19
- package/lib/properties/marginRight.js +43 -19
- package/lib/properties/marginTop.js +43 -19
- package/lib/properties/opacity.js +41 -28
- package/lib/properties/outlineColor.js +34 -13
- package/lib/properties/padding.js +71 -36
- package/lib/properties/paddingBottom.js +44 -21
- package/lib/properties/paddingLeft.js +44 -19
- package/lib/properties/paddingRight.js +44 -19
- package/lib/properties/paddingTop.js +44 -19
- package/lib/properties/right.js +40 -12
- package/lib/properties/stopColor.js +34 -13
- package/lib/properties/top.js +40 -12
- package/lib/properties/webkitBorderAfterColor.js +34 -13
- package/lib/properties/webkitBorderBeforeColor.js +34 -13
- package/lib/properties/webkitBorderEndColor.js +34 -13
- package/lib/properties/webkitBorderStartColor.js +34 -13
- package/lib/properties/webkitColumnRuleColor.js +34 -13
- package/lib/properties/webkitTapHighlightColor.js +34 -13
- package/lib/properties/webkitTextEmphasisColor.js +34 -13
- package/lib/properties/webkitTextFillColor.js +34 -13
- package/lib/properties/webkitTextStrokeColor.js +34 -13
- package/lib/properties/width.js +40 -13
- package/lib/{allWebkitProperties.js → utils/allExtraProperties.js} +42 -1
- package/lib/utils/propertyDescriptors.js +6 -3
- package/package.json +11 -10
- package/lib/allExtraProperties.js +0 -49
- package/lib/shorthandProperties.js +0 -21
|
@@ -2,28 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const val = parsers.parseColor(v);
|
|
7
|
-
if (val) {
|
|
8
|
-
return val;
|
|
9
|
-
}
|
|
10
|
-
return parsers.parseKeyword(v);
|
|
11
|
-
};
|
|
5
|
+
const property = "-webkit-border-after-color";
|
|
12
6
|
|
|
13
|
-
module.exports.
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
module.exports.parse = function parse(v, opt = {}) {
|
|
8
|
+
const { globalObject } = opt;
|
|
9
|
+
if (v === "") {
|
|
10
|
+
return v;
|
|
11
|
+
}
|
|
12
|
+
const value = parsers.parsePropertyValue(property, v, {
|
|
13
|
+
globalObject,
|
|
14
|
+
inArray: true
|
|
15
|
+
});
|
|
16
|
+
if (Array.isArray(value) && value.length === 1) {
|
|
17
|
+
const [{ name, type }] = value;
|
|
18
|
+
switch (type) {
|
|
19
|
+
case "GlobalKeyword": {
|
|
20
|
+
return name;
|
|
21
|
+
}
|
|
22
|
+
default: {
|
|
23
|
+
return parsers.parseColor(value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} else if (typeof value === "string") {
|
|
27
|
+
return value;
|
|
16
28
|
}
|
|
17
|
-
return parsers.isValidColor(v);
|
|
18
29
|
};
|
|
19
30
|
|
|
20
31
|
module.exports.definition = {
|
|
21
32
|
set(v) {
|
|
22
33
|
v = parsers.prepareValue(v, this._global);
|
|
23
|
-
|
|
34
|
+
if (parsers.hasVarFunc(v)) {
|
|
35
|
+
this._setProperty(property, v);
|
|
36
|
+
} else {
|
|
37
|
+
const val = module.exports.parse(v, {
|
|
38
|
+
globalObject: this._global
|
|
39
|
+
});
|
|
40
|
+
if (typeof val === "string") {
|
|
41
|
+
const priority = this._priorities.get(property) ?? "";
|
|
42
|
+
this._setProperty(property, val, priority);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
24
45
|
},
|
|
25
46
|
get() {
|
|
26
|
-
return this.getPropertyValue(
|
|
47
|
+
return this.getPropertyValue(property);
|
|
27
48
|
},
|
|
28
49
|
enumerable: true,
|
|
29
50
|
configurable: true
|
|
@@ -2,28 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const val = parsers.parseColor(v);
|
|
7
|
-
if (val) {
|
|
8
|
-
return val;
|
|
9
|
-
}
|
|
10
|
-
return parsers.parseKeyword(v);
|
|
11
|
-
};
|
|
5
|
+
const property = "-webkit-border-before-color";
|
|
12
6
|
|
|
13
|
-
module.exports.
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
module.exports.parse = function parse(v, opt = {}) {
|
|
8
|
+
const { globalObject } = opt;
|
|
9
|
+
if (v === "") {
|
|
10
|
+
return v;
|
|
11
|
+
}
|
|
12
|
+
const value = parsers.parsePropertyValue(property, v, {
|
|
13
|
+
globalObject,
|
|
14
|
+
inArray: true
|
|
15
|
+
});
|
|
16
|
+
if (Array.isArray(value) && value.length === 1) {
|
|
17
|
+
const [{ name, type }] = value;
|
|
18
|
+
switch (type) {
|
|
19
|
+
case "GlobalKeyword": {
|
|
20
|
+
return name;
|
|
21
|
+
}
|
|
22
|
+
default: {
|
|
23
|
+
return parsers.parseColor(value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} else if (typeof value === "string") {
|
|
27
|
+
return value;
|
|
16
28
|
}
|
|
17
|
-
return parsers.isValidColor(v);
|
|
18
29
|
};
|
|
19
30
|
|
|
20
31
|
module.exports.definition = {
|
|
21
32
|
set(v) {
|
|
22
33
|
v = parsers.prepareValue(v, this._global);
|
|
23
|
-
|
|
34
|
+
if (parsers.hasVarFunc(v)) {
|
|
35
|
+
this._setProperty(property, v);
|
|
36
|
+
} else {
|
|
37
|
+
const val = module.exports.parse(v, {
|
|
38
|
+
globalObject: this._global
|
|
39
|
+
});
|
|
40
|
+
if (typeof val === "string") {
|
|
41
|
+
const priority = this._priorities.get(property) ?? "";
|
|
42
|
+
this._setProperty(property, val, priority);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
24
45
|
},
|
|
25
46
|
get() {
|
|
26
|
-
return this.getPropertyValue(
|
|
47
|
+
return this.getPropertyValue(property);
|
|
27
48
|
},
|
|
28
49
|
enumerable: true,
|
|
29
50
|
configurable: true
|
|
@@ -2,28 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const val = parsers.parseColor(v);
|
|
7
|
-
if (val) {
|
|
8
|
-
return val;
|
|
9
|
-
}
|
|
10
|
-
return parsers.parseKeyword(v);
|
|
11
|
-
};
|
|
5
|
+
const property = "-webkit-border-end-color";
|
|
12
6
|
|
|
13
|
-
module.exports.
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
module.exports.parse = function parse(v, opt = {}) {
|
|
8
|
+
const { globalObject } = opt;
|
|
9
|
+
if (v === "") {
|
|
10
|
+
return v;
|
|
11
|
+
}
|
|
12
|
+
const value = parsers.parsePropertyValue(property, v, {
|
|
13
|
+
globalObject,
|
|
14
|
+
inArray: true
|
|
15
|
+
});
|
|
16
|
+
if (Array.isArray(value) && value.length === 1) {
|
|
17
|
+
const [{ name, type }] = value;
|
|
18
|
+
switch (type) {
|
|
19
|
+
case "GlobalKeyword": {
|
|
20
|
+
return name;
|
|
21
|
+
}
|
|
22
|
+
default: {
|
|
23
|
+
return parsers.parseColor(value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} else if (typeof value === "string") {
|
|
27
|
+
return value;
|
|
16
28
|
}
|
|
17
|
-
return parsers.isValidColor(v);
|
|
18
29
|
};
|
|
19
30
|
|
|
20
31
|
module.exports.definition = {
|
|
21
32
|
set(v) {
|
|
22
33
|
v = parsers.prepareValue(v, this._global);
|
|
23
|
-
|
|
34
|
+
if (parsers.hasVarFunc(v)) {
|
|
35
|
+
this._setProperty(property, v);
|
|
36
|
+
} else {
|
|
37
|
+
const val = module.exports.parse(v, {
|
|
38
|
+
globalObject: this._global
|
|
39
|
+
});
|
|
40
|
+
if (typeof val === "string") {
|
|
41
|
+
const priority = this._priorities.get(property) ?? "";
|
|
42
|
+
this._setProperty(property, val, priority);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
24
45
|
},
|
|
25
46
|
get() {
|
|
26
|
-
return this.getPropertyValue(
|
|
47
|
+
return this.getPropertyValue(property);
|
|
27
48
|
},
|
|
28
49
|
enumerable: true,
|
|
29
50
|
configurable: true
|
|
@@ -2,28 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const val = parsers.parseColor(v);
|
|
7
|
-
if (val) {
|
|
8
|
-
return val;
|
|
9
|
-
}
|
|
10
|
-
return parsers.parseKeyword(v);
|
|
11
|
-
};
|
|
5
|
+
const property = "-webkit-border-start-color";
|
|
12
6
|
|
|
13
|
-
module.exports.
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
module.exports.parse = function parse(v, opt = {}) {
|
|
8
|
+
const { globalObject } = opt;
|
|
9
|
+
if (v === "") {
|
|
10
|
+
return v;
|
|
11
|
+
}
|
|
12
|
+
const value = parsers.parsePropertyValue(property, v, {
|
|
13
|
+
globalObject,
|
|
14
|
+
inArray: true
|
|
15
|
+
});
|
|
16
|
+
if (Array.isArray(value) && value.length === 1) {
|
|
17
|
+
const [{ name, type }] = value;
|
|
18
|
+
switch (type) {
|
|
19
|
+
case "GlobalKeyword": {
|
|
20
|
+
return name;
|
|
21
|
+
}
|
|
22
|
+
default: {
|
|
23
|
+
return parsers.parseColor(value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} else if (typeof value === "string") {
|
|
27
|
+
return value;
|
|
16
28
|
}
|
|
17
|
-
return parsers.isValidColor(v);
|
|
18
29
|
};
|
|
19
30
|
|
|
20
31
|
module.exports.definition = {
|
|
21
32
|
set(v) {
|
|
22
33
|
v = parsers.prepareValue(v, this._global);
|
|
23
|
-
|
|
34
|
+
if (parsers.hasVarFunc(v)) {
|
|
35
|
+
this._setProperty(property, v);
|
|
36
|
+
} else {
|
|
37
|
+
const val = module.exports.parse(v, {
|
|
38
|
+
globalObject: this._global
|
|
39
|
+
});
|
|
40
|
+
if (typeof val === "string") {
|
|
41
|
+
const priority = this._priorities.get(property) ?? "";
|
|
42
|
+
this._setProperty(property, val, priority);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
24
45
|
},
|
|
25
46
|
get() {
|
|
26
|
-
return this.getPropertyValue(
|
|
47
|
+
return this.getPropertyValue(property);
|
|
27
48
|
},
|
|
28
49
|
enumerable: true,
|
|
29
50
|
configurable: true
|
|
@@ -2,28 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const val = parsers.parseColor(v);
|
|
7
|
-
if (val) {
|
|
8
|
-
return val;
|
|
9
|
-
}
|
|
10
|
-
return parsers.parseKeyword(v);
|
|
11
|
-
};
|
|
5
|
+
const property = "-webkit-column-rule-color";
|
|
12
6
|
|
|
13
|
-
module.exports.
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
module.exports.parse = function parse(v, opt = {}) {
|
|
8
|
+
const { globalObject } = opt;
|
|
9
|
+
if (v === "") {
|
|
10
|
+
return v;
|
|
11
|
+
}
|
|
12
|
+
const value = parsers.parsePropertyValue(property, v, {
|
|
13
|
+
globalObject,
|
|
14
|
+
inArray: true
|
|
15
|
+
});
|
|
16
|
+
if (Array.isArray(value) && value.length === 1) {
|
|
17
|
+
const [{ name, type }] = value;
|
|
18
|
+
switch (type) {
|
|
19
|
+
case "GlobalKeyword": {
|
|
20
|
+
return name;
|
|
21
|
+
}
|
|
22
|
+
default: {
|
|
23
|
+
return parsers.parseColor(value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} else if (typeof value === "string") {
|
|
27
|
+
return value;
|
|
16
28
|
}
|
|
17
|
-
return parsers.isValidColor(v);
|
|
18
29
|
};
|
|
19
30
|
|
|
20
31
|
module.exports.definition = {
|
|
21
32
|
set(v) {
|
|
22
33
|
v = parsers.prepareValue(v, this._global);
|
|
23
|
-
|
|
34
|
+
if (parsers.hasVarFunc(v)) {
|
|
35
|
+
this._setProperty(property, v);
|
|
36
|
+
} else {
|
|
37
|
+
const val = module.exports.parse(v, {
|
|
38
|
+
globalObject: this._global
|
|
39
|
+
});
|
|
40
|
+
if (typeof val === "string") {
|
|
41
|
+
const priority = this._priorities.get(property) ?? "";
|
|
42
|
+
this._setProperty(property, val, priority);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
24
45
|
},
|
|
25
46
|
get() {
|
|
26
|
-
return this.getPropertyValue(
|
|
47
|
+
return this.getPropertyValue(property);
|
|
27
48
|
},
|
|
28
49
|
enumerable: true,
|
|
29
50
|
configurable: true
|
|
@@ -2,28 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const val = parsers.parseColor(v);
|
|
7
|
-
if (val) {
|
|
8
|
-
return val;
|
|
9
|
-
}
|
|
10
|
-
return parsers.parseKeyword(v);
|
|
11
|
-
};
|
|
5
|
+
const property = "-webkit-tap-highlight-color";
|
|
12
6
|
|
|
13
|
-
module.exports.
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
module.exports.parse = function parse(v, opt = {}) {
|
|
8
|
+
const { globalObject } = opt;
|
|
9
|
+
if (v === "") {
|
|
10
|
+
return v;
|
|
11
|
+
}
|
|
12
|
+
const value = parsers.parsePropertyValue(property, v, {
|
|
13
|
+
globalObject,
|
|
14
|
+
inArray: true
|
|
15
|
+
});
|
|
16
|
+
if (Array.isArray(value) && value.length === 1) {
|
|
17
|
+
const [{ name, type }] = value;
|
|
18
|
+
switch (type) {
|
|
19
|
+
case "GlobalKeyword": {
|
|
20
|
+
return name;
|
|
21
|
+
}
|
|
22
|
+
default: {
|
|
23
|
+
return parsers.parseColor(value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} else if (typeof value === "string") {
|
|
27
|
+
return value;
|
|
16
28
|
}
|
|
17
|
-
return parsers.isValidColor(v);
|
|
18
29
|
};
|
|
19
30
|
|
|
20
31
|
module.exports.definition = {
|
|
21
32
|
set(v) {
|
|
22
33
|
v = parsers.prepareValue(v, this._global);
|
|
23
|
-
|
|
34
|
+
if (parsers.hasVarFunc(v)) {
|
|
35
|
+
this._setProperty(property, v);
|
|
36
|
+
} else {
|
|
37
|
+
const val = module.exports.parse(v, {
|
|
38
|
+
globalObject: this._global
|
|
39
|
+
});
|
|
40
|
+
if (typeof val === "string") {
|
|
41
|
+
const priority = this._priorities.get(property) ?? "";
|
|
42
|
+
this._setProperty(property, val, priority);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
24
45
|
},
|
|
25
46
|
get() {
|
|
26
|
-
return this.getPropertyValue(
|
|
47
|
+
return this.getPropertyValue(property);
|
|
27
48
|
},
|
|
28
49
|
enumerable: true,
|
|
29
50
|
configurable: true
|
|
@@ -2,28 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const val = parsers.parseColor(v);
|
|
7
|
-
if (val) {
|
|
8
|
-
return val;
|
|
9
|
-
}
|
|
10
|
-
return parsers.parseKeyword(v);
|
|
11
|
-
};
|
|
5
|
+
const property = "-webkit-text-emphasis-color";
|
|
12
6
|
|
|
13
|
-
module.exports.
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
module.exports.parse = function parse(v, opt = {}) {
|
|
8
|
+
const { globalObject } = opt;
|
|
9
|
+
if (v === "") {
|
|
10
|
+
return v;
|
|
11
|
+
}
|
|
12
|
+
const value = parsers.parsePropertyValue(property, v, {
|
|
13
|
+
globalObject,
|
|
14
|
+
inArray: true
|
|
15
|
+
});
|
|
16
|
+
if (Array.isArray(value) && value.length === 1) {
|
|
17
|
+
const [{ name, type }] = value;
|
|
18
|
+
switch (type) {
|
|
19
|
+
case "GlobalKeyword": {
|
|
20
|
+
return name;
|
|
21
|
+
}
|
|
22
|
+
default: {
|
|
23
|
+
return parsers.parseColor(value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} else if (typeof value === "string") {
|
|
27
|
+
return value;
|
|
16
28
|
}
|
|
17
|
-
return parsers.isValidColor(v);
|
|
18
29
|
};
|
|
19
30
|
|
|
20
31
|
module.exports.definition = {
|
|
21
32
|
set(v) {
|
|
22
33
|
v = parsers.prepareValue(v, this._global);
|
|
23
|
-
|
|
34
|
+
if (parsers.hasVarFunc(v)) {
|
|
35
|
+
this._setProperty(property, v);
|
|
36
|
+
} else {
|
|
37
|
+
const val = module.exports.parse(v, {
|
|
38
|
+
globalObject: this._global
|
|
39
|
+
});
|
|
40
|
+
if (typeof val === "string") {
|
|
41
|
+
const priority = this._priorities.get(property) ?? "";
|
|
42
|
+
this._setProperty(property, val, priority);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
24
45
|
},
|
|
25
46
|
get() {
|
|
26
|
-
return this.getPropertyValue(
|
|
47
|
+
return this.getPropertyValue(property);
|
|
27
48
|
},
|
|
28
49
|
enumerable: true,
|
|
29
50
|
configurable: true
|
|
@@ -2,28 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const val = parsers.parseColor(v);
|
|
7
|
-
if (val) {
|
|
8
|
-
return val;
|
|
9
|
-
}
|
|
10
|
-
return parsers.parseKeyword(v);
|
|
11
|
-
};
|
|
5
|
+
const property = "-webkit-text-fill-color";
|
|
12
6
|
|
|
13
|
-
module.exports.
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
module.exports.parse = function parse(v, opt = {}) {
|
|
8
|
+
const { globalObject } = opt;
|
|
9
|
+
if (v === "") {
|
|
10
|
+
return v;
|
|
11
|
+
}
|
|
12
|
+
const value = parsers.parsePropertyValue(property, v, {
|
|
13
|
+
globalObject,
|
|
14
|
+
inArray: true
|
|
15
|
+
});
|
|
16
|
+
if (Array.isArray(value) && value.length === 1) {
|
|
17
|
+
const [{ name, type }] = value;
|
|
18
|
+
switch (type) {
|
|
19
|
+
case "GlobalKeyword": {
|
|
20
|
+
return name;
|
|
21
|
+
}
|
|
22
|
+
default: {
|
|
23
|
+
return parsers.parseColor(value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} else if (typeof value === "string") {
|
|
27
|
+
return value;
|
|
16
28
|
}
|
|
17
|
-
return parsers.isValidColor(v);
|
|
18
29
|
};
|
|
19
30
|
|
|
20
31
|
module.exports.definition = {
|
|
21
32
|
set(v) {
|
|
22
33
|
v = parsers.prepareValue(v, this._global);
|
|
23
|
-
|
|
34
|
+
if (parsers.hasVarFunc(v)) {
|
|
35
|
+
this._setProperty(property, v);
|
|
36
|
+
} else {
|
|
37
|
+
const val = module.exports.parse(v, {
|
|
38
|
+
globalObject: this._global
|
|
39
|
+
});
|
|
40
|
+
if (typeof val === "string") {
|
|
41
|
+
const priority = this._priorities.get(property) ?? "";
|
|
42
|
+
this._setProperty(property, val, priority);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
24
45
|
},
|
|
25
46
|
get() {
|
|
26
|
-
return this.getPropertyValue(
|
|
47
|
+
return this.getPropertyValue(property);
|
|
27
48
|
},
|
|
28
49
|
enumerable: true,
|
|
29
50
|
configurable: true
|
|
@@ -2,28 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const val = parsers.parseColor(v);
|
|
7
|
-
if (val) {
|
|
8
|
-
return val;
|
|
9
|
-
}
|
|
10
|
-
return parsers.parseKeyword(v);
|
|
11
|
-
};
|
|
5
|
+
const property = "-webkit-text-stroke-color";
|
|
12
6
|
|
|
13
|
-
module.exports.
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
module.exports.parse = function parse(v, opt = {}) {
|
|
8
|
+
const { globalObject } = opt;
|
|
9
|
+
if (v === "") {
|
|
10
|
+
return v;
|
|
11
|
+
}
|
|
12
|
+
const value = parsers.parsePropertyValue(property, v, {
|
|
13
|
+
globalObject,
|
|
14
|
+
inArray: true
|
|
15
|
+
});
|
|
16
|
+
if (Array.isArray(value) && value.length === 1) {
|
|
17
|
+
const [{ name, type }] = value;
|
|
18
|
+
switch (type) {
|
|
19
|
+
case "GlobalKeyword": {
|
|
20
|
+
return name;
|
|
21
|
+
}
|
|
22
|
+
default: {
|
|
23
|
+
return parsers.parseColor(value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} else if (typeof value === "string") {
|
|
27
|
+
return value;
|
|
16
28
|
}
|
|
17
|
-
return parsers.isValidColor(v);
|
|
18
29
|
};
|
|
19
30
|
|
|
20
31
|
module.exports.definition = {
|
|
21
32
|
set(v) {
|
|
22
33
|
v = parsers.prepareValue(v, this._global);
|
|
23
|
-
|
|
34
|
+
if (parsers.hasVarFunc(v)) {
|
|
35
|
+
this._setProperty(property, v);
|
|
36
|
+
} else {
|
|
37
|
+
const val = module.exports.parse(v, {
|
|
38
|
+
globalObject: this._global
|
|
39
|
+
});
|
|
40
|
+
if (typeof val === "string") {
|
|
41
|
+
const priority = this._priorities.get(property) ?? "";
|
|
42
|
+
this._setProperty(property, val, priority);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
24
45
|
},
|
|
25
46
|
get() {
|
|
26
|
-
return this.getPropertyValue(
|
|
47
|
+
return this.getPropertyValue(property);
|
|
27
48
|
},
|
|
28
49
|
enumerable: true,
|
|
29
50
|
configurable: true
|
package/lib/properties/width.js
CHANGED
|
@@ -2,29 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const dim = parsers.parseMeasurement(v, true);
|
|
7
|
-
if (dim) {
|
|
8
|
-
return dim;
|
|
9
|
-
}
|
|
10
|
-
const keywords = ["auto", "min-content", "max-content", "fit-content"];
|
|
11
|
-
return parsers.parseKeyword(v, keywords);
|
|
12
|
-
};
|
|
5
|
+
const property = "width";
|
|
13
6
|
|
|
14
|
-
module.exports.
|
|
7
|
+
module.exports.parse = function parse(v, opt = {}) {
|
|
8
|
+
const { globalObject } = opt;
|
|
15
9
|
if (v === "") {
|
|
16
|
-
return
|
|
10
|
+
return v;
|
|
11
|
+
}
|
|
12
|
+
const value = parsers.parsePropertyValue(property, v, {
|
|
13
|
+
globalObject,
|
|
14
|
+
inArray: true
|
|
15
|
+
});
|
|
16
|
+
if (Array.isArray(value) && value.length === 1) {
|
|
17
|
+
const [{ isNumber, name, type, value: itemValue }] = value;
|
|
18
|
+
switch (type) {
|
|
19
|
+
case "Calc": {
|
|
20
|
+
if (isNumber) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
return `${name}(${itemValue})`;
|
|
24
|
+
}
|
|
25
|
+
case "GlobalKeyword":
|
|
26
|
+
case "Identifier": {
|
|
27
|
+
return name;
|
|
28
|
+
}
|
|
29
|
+
default: {
|
|
30
|
+
return parsers.parseLengthPercentage(value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
} else if (typeof value === "string") {
|
|
34
|
+
return value;
|
|
17
35
|
}
|
|
18
|
-
return typeof module.exports.parse(v) === "string";
|
|
19
36
|
};
|
|
20
37
|
|
|
21
38
|
module.exports.definition = {
|
|
22
39
|
set(v) {
|
|
23
40
|
v = parsers.prepareValue(v, this._global);
|
|
24
|
-
|
|
41
|
+
if (parsers.hasVarFunc(v)) {
|
|
42
|
+
this._setProperty(property, v);
|
|
43
|
+
} else {
|
|
44
|
+
const val = module.exports.parse(v, {
|
|
45
|
+
globalObject: this._global
|
|
46
|
+
});
|
|
47
|
+
if (typeof val === "string") {
|
|
48
|
+
const priority = this._priorities.get(property) ?? "";
|
|
49
|
+
this._setProperty(property, val, priority);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
25
52
|
},
|
|
26
53
|
get() {
|
|
27
|
-
return this.getPropertyValue(
|
|
54
|
+
return this.getPropertyValue(property);
|
|
28
55
|
},
|
|
29
56
|
enumerable: true,
|
|
30
57
|
configurable: true
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* current specifications or drafts, but are handled by browsers nevertheless.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const webkitProperties = [
|
|
9
9
|
"background-composite",
|
|
10
10
|
"border-after",
|
|
11
11
|
"border-after-color",
|
|
@@ -112,3 +112,44 @@ module.exports = [
|
|
|
112
112
|
"wrap-shape-outside",
|
|
113
113
|
"zoom"
|
|
114
114
|
].map((prop) => `-webkit-${prop}`);
|
|
115
|
+
|
|
116
|
+
module.exports = new Set([
|
|
117
|
+
"background-position-x",
|
|
118
|
+
"background-position-y",
|
|
119
|
+
"background-repeat-x",
|
|
120
|
+
"background-repeat-y",
|
|
121
|
+
"color-interpolation",
|
|
122
|
+
"color-profile",
|
|
123
|
+
"color-rendering",
|
|
124
|
+
"enable-background",
|
|
125
|
+
"glyph-orientation-horizontal",
|
|
126
|
+
"kerning",
|
|
127
|
+
"marker-offset",
|
|
128
|
+
"marks",
|
|
129
|
+
"pointer-events",
|
|
130
|
+
"shape-rendering",
|
|
131
|
+
"size",
|
|
132
|
+
"src",
|
|
133
|
+
"stop-color",
|
|
134
|
+
"stop-opacity",
|
|
135
|
+
"text-anchor",
|
|
136
|
+
"text-line-through",
|
|
137
|
+
"text-line-through-color",
|
|
138
|
+
"text-line-through-mode",
|
|
139
|
+
"text-line-through-style",
|
|
140
|
+
"text-line-through-width",
|
|
141
|
+
"text-overline",
|
|
142
|
+
"text-overline-color",
|
|
143
|
+
"text-overline-mode",
|
|
144
|
+
"text-overline-style",
|
|
145
|
+
"text-overline-width",
|
|
146
|
+
"text-rendering",
|
|
147
|
+
"text-underline",
|
|
148
|
+
"text-underline-color",
|
|
149
|
+
"text-underline-mode",
|
|
150
|
+
"text-underline-style",
|
|
151
|
+
"text-underline-width",
|
|
152
|
+
"unicode-range",
|
|
153
|
+
"vector-effect",
|
|
154
|
+
...webkitProperties
|
|
155
|
+
]);
|