cssstyle 4.3.0 → 4.4.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 +545 -206
- package/lib/allExtraProperties.js +42 -60
- package/lib/allWebkitProperties.js +107 -187
- package/lib/generated/allProperties.js +615 -0
- package/lib/{implementedProperties.js → generated/implementedProperties.js} +11 -18
- package/lib/generated/properties.js +2574 -0
- package/lib/parsers.js +400 -544
- package/lib/properties/background.js +40 -13
- package/lib/properties/backgroundAttachment.js +23 -15
- package/lib/properties/backgroundColor.js +21 -19
- package/lib/properties/backgroundImage.js +19 -14
- package/lib/properties/backgroundPosition.js +35 -41
- package/lib/properties/backgroundRepeat.js +20 -20
- package/lib/properties/border.js +34 -25
- package/lib/properties/borderBottom.js +34 -11
- package/lib/properties/borderBottomColor.js +27 -8
- package/lib/properties/borderBottomStyle.js +42 -13
- package/lib/properties/borderBottomWidth.js +28 -8
- package/lib/properties/borderCollapse.js +16 -16
- package/lib/properties/borderColor.js +32 -18
- package/lib/properties/borderLeft.js +34 -11
- package/lib/properties/borderLeftColor.js +27 -8
- package/lib/properties/borderLeftStyle.js +42 -13
- package/lib/properties/borderLeftWidth.js +28 -8
- package/lib/properties/borderRight.js +34 -11
- package/lib/properties/borderRightColor.js +27 -8
- package/lib/properties/borderRightStyle.js +42 -13
- package/lib/properties/borderRightWidth.js +28 -8
- package/lib/properties/borderSpacing.js +31 -27
- package/lib/properties/borderStyle.js +43 -27
- package/lib/properties/borderTop.js +34 -11
- package/lib/properties/borderTopColor.js +27 -8
- package/lib/properties/borderTopStyle.js +42 -13
- package/lib/properties/borderTopWidth.js +28 -9
- package/lib/properties/borderWidth.js +32 -34
- package/lib/properties/bottom.js +23 -7
- package/lib/properties/clear.js +32 -8
- package/lib/properties/clip.js +33 -27
- package/lib/properties/color.js +23 -7
- package/lib/properties/flex.js +59 -29
- package/lib/properties/flexBasis.js +21 -16
- package/lib/properties/flexGrow.js +19 -10
- package/lib/properties/flexShrink.js +19 -10
- package/lib/properties/float.js +21 -6
- package/lib/properties/floodColor.js +23 -7
- package/lib/properties/font.js +120 -33
- package/lib/properties/fontFamily.js +59 -21
- package/lib/properties/fontSize.js +37 -28
- package/lib/properties/fontStyle.js +23 -9
- package/lib/properties/fontVariant.js +26 -8
- package/lib/properties/fontWeight.js +26 -23
- package/lib/properties/height.js +21 -14
- package/lib/properties/left.js +23 -7
- package/lib/properties/lightingColor.js +23 -7
- package/lib/properties/lineHeight.js +29 -16
- package/lib/properties/margin.js +42 -57
- package/lib/properties/marginBottom.js +34 -7
- package/lib/properties/marginLeft.js +34 -7
- package/lib/properties/marginRight.js +34 -7
- package/lib/properties/marginTop.js +34 -7
- package/lib/properties/opacity.js +39 -7
- package/lib/properties/outlineColor.js +23 -7
- package/lib/properties/padding.js +43 -51
- package/lib/properties/paddingBottom.js +36 -7
- package/lib/properties/paddingLeft.js +34 -7
- package/lib/properties/paddingRight.js +34 -7
- package/lib/properties/paddingTop.js +34 -7
- package/lib/properties/right.js +23 -7
- package/lib/properties/stopColor.js +23 -7
- package/lib/properties/top.js +23 -7
- package/lib/properties/webkitBorderAfterColor.js +23 -7
- package/lib/properties/webkitBorderBeforeColor.js +23 -7
- package/lib/properties/webkitBorderEndColor.js +23 -7
- package/lib/properties/webkitBorderStartColor.js +23 -7
- package/lib/properties/webkitColumnRuleColor.js +23 -7
- package/lib/properties/webkitTapHighlightColor.js +23 -7
- package/lib/properties/webkitTextEmphasisColor.js +23 -7
- package/lib/properties/webkitTextFillColor.js +23 -7
- package/lib/properties/webkitTextStrokeColor.js +23 -7
- package/lib/properties/width.js +21 -14
- package/lib/utils/camelize.js +35 -0
- package/lib/utils/propertyDescriptors.js +16 -0
- package/package.json +5 -4
- package/lib/allProperties.js +0 -529
- package/lib/constants.js +0 -6
- package/lib/named_colors.json +0 -152
- package/lib/properties/azimuth.js +0 -64
- package/lib/properties/cssFloat.js +0 -12
- package/lib/properties/textLineThroughColor.js +0 -14
- package/lib/properties/textOverlineColor.js +0 -14
- package/lib/properties/textUnderlineColor.js +0 -14
- package/lib/properties/webkitMatchNearestMailBlockquoteColor.js +0 -14
- package/lib/properties.js +0 -1672
- package/lib/utils/getBasicPropertyDescriptor.js +0 -14
|
@@ -1,19 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// FIXME:
|
|
3
|
+
// * support multiple backgrounds
|
|
4
|
+
// * also fix longhands
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
const parsers = require("../parsers");
|
|
7
|
+
const backgroundImage = require("./backgroundImage");
|
|
8
|
+
const backgroundPosition = require("./backgroundPosition");
|
|
9
|
+
const backgroundRepeat = require("./backgroundRepeat");
|
|
10
|
+
const backgroundAttachment = require("./backgroundAttachment");
|
|
11
|
+
const backgroundColor = require("./backgroundColor");
|
|
5
12
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
const shorthandFor = new Map([
|
|
14
|
+
["background-image", backgroundImage],
|
|
15
|
+
["background-position", backgroundPosition],
|
|
16
|
+
["background-repeat", backgroundRepeat],
|
|
17
|
+
["background-attachment", backgroundAttachment],
|
|
18
|
+
["background-color", backgroundColor]
|
|
19
|
+
]);
|
|
13
20
|
|
|
14
21
|
module.exports.definition = {
|
|
15
|
-
set
|
|
16
|
-
|
|
22
|
+
set(v) {
|
|
23
|
+
v = parsers.prepareValue(v, this._global);
|
|
24
|
+
if (v.toLowerCase() === "none" || parsers.hasVarFunc(v)) {
|
|
25
|
+
for (const [key] of shorthandFor) {
|
|
26
|
+
this._setProperty(key, "");
|
|
27
|
+
}
|
|
28
|
+
this._setProperty("background", v);
|
|
29
|
+
} else {
|
|
30
|
+
this._shorthandSetter("background", v, shorthandFor);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
get() {
|
|
34
|
+
let val = this.getPropertyValue("background");
|
|
35
|
+
if (parsers.hasVarFunc(val)) {
|
|
36
|
+
return val;
|
|
37
|
+
}
|
|
38
|
+
val = this._shorthandGetter("background", shorthandFor);
|
|
39
|
+
if (parsers.hasVarFunc(val)) {
|
|
40
|
+
return "";
|
|
41
|
+
}
|
|
42
|
+
return val;
|
|
43
|
+
},
|
|
17
44
|
enumerable: true,
|
|
18
|
-
configurable: true
|
|
45
|
+
configurable: true
|
|
19
46
|
};
|
|
@@ -1,24 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
module.exports.parse = function parse(v) {
|
|
6
|
+
const keywords = ["fixed", "scroll", "local"];
|
|
7
|
+
return parsers.parseKeyword(v, keywords);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
module.exports.isValid = function isValid(v) {
|
|
11
|
+
if (v === "") {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
return typeof module.exports.parse(v) === "string";
|
|
15
|
+
};
|
|
11
16
|
|
|
12
17
|
module.exports.definition = {
|
|
13
|
-
set
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
set(v) {
|
|
19
|
+
v = parsers.prepareValue(v, this._global);
|
|
20
|
+
if (parsers.hasVarFunc(v)) {
|
|
21
|
+
this._setProperty("background", "");
|
|
22
|
+
this._setProperty("backgound-attachemnt", v);
|
|
23
|
+
} else {
|
|
24
|
+
this._setProperty("background-attachment", module.exports.parse(v));
|
|
16
25
|
}
|
|
17
|
-
this._setProperty('background-attachment', v);
|
|
18
26
|
},
|
|
19
|
-
get
|
|
20
|
-
return this.getPropertyValue(
|
|
27
|
+
get() {
|
|
28
|
+
return this.getPropertyValue("background-attachment");
|
|
21
29
|
},
|
|
22
30
|
enumerable: true,
|
|
23
|
-
configurable: true
|
|
31
|
+
configurable: true
|
|
24
32
|
};
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
return
|
|
5
|
+
module.exports.parse = function parse(v) {
|
|
6
|
+
const val = parsers.parseColor(v);
|
|
7
|
+
if (val) {
|
|
8
|
+
return val;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
return v;
|
|
12
|
-
}
|
|
13
|
-
return undefined;
|
|
10
|
+
return parsers.parseKeyword(v);
|
|
14
11
|
};
|
|
15
12
|
|
|
16
13
|
module.exports.isValid = function isValid(v) {
|
|
17
|
-
|
|
14
|
+
if (v === "" || typeof parsers.parseKeyword(v) === "string") {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return parsers.isValidColor(v);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
module.exports.definition = {
|
|
21
|
-
set
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
|
|
21
|
+
set(v) {
|
|
22
|
+
v = parsers.prepareValue(v, this._global);
|
|
23
|
+
if (parsers.hasVarFunc(v)) {
|
|
24
|
+
this._setProperty("background", "");
|
|
25
|
+
this._setProperty("backgound-color", v);
|
|
26
|
+
} else {
|
|
27
|
+
this._setProperty("background-color", module.exports.parse(v));
|
|
25
28
|
}
|
|
26
|
-
this._setProperty('background-color', parsed);
|
|
27
29
|
},
|
|
28
|
-
get
|
|
29
|
-
return this.getPropertyValue(
|
|
30
|
+
get() {
|
|
31
|
+
return this.getPropertyValue("background-color");
|
|
30
32
|
},
|
|
31
33
|
enumerable: true,
|
|
32
|
-
configurable: true
|
|
34
|
+
configurable: true
|
|
33
35
|
};
|
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (parsed !== undefined) {
|
|
8
|
-
return parsed;
|
|
9
|
-
}
|
|
10
|
-
return undefined;
|
|
5
|
+
module.exports.parse = function parse(v) {
|
|
6
|
+
return parsers.parseImage(v);
|
|
11
7
|
};
|
|
12
8
|
|
|
13
9
|
module.exports.isValid = function isValid(v) {
|
|
14
|
-
|
|
10
|
+
if (v === "" || typeof parsers.parseKeyword(v, ["none"]) === "string") {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return typeof module.exports.parse(v) === "string";
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
module.exports.definition = {
|
|
18
|
-
set
|
|
19
|
-
|
|
17
|
+
set(v) {
|
|
18
|
+
v = parsers.prepareValue(v, this._global);
|
|
19
|
+
if (parsers.hasVarFunc(v)) {
|
|
20
|
+
this._setProperty("background", "");
|
|
21
|
+
this._setProperty("backgound-image", v);
|
|
22
|
+
} else {
|
|
23
|
+
this._setProperty("background-image", module.exports.parse(v));
|
|
24
|
+
}
|
|
20
25
|
},
|
|
21
|
-
get
|
|
22
|
-
return this.getPropertyValue(
|
|
26
|
+
get() {
|
|
27
|
+
return this.getPropertyValue("background-image");
|
|
23
28
|
},
|
|
24
29
|
enumerable: true,
|
|
25
|
-
configurable: true
|
|
30
|
+
configurable: true
|
|
26
31
|
};
|
|
@@ -1,58 +1,52 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
var parts = v.split(/\s+/);
|
|
12
|
-
if (parts.length > 2 || parts.length < 1) {
|
|
13
|
-
return undefined;
|
|
5
|
+
module.exports.parse = function parse(v) {
|
|
6
|
+
const parts = parsers.splitValue(v);
|
|
7
|
+
if (!parts.length || parts.length > 2) {
|
|
8
|
+
return;
|
|
14
9
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
types[index] = parsers.valueType(part);
|
|
18
|
-
});
|
|
10
|
+
const validKeywordsX = ["left", "center", "right"];
|
|
11
|
+
const validKeywordsY = ["top", "center", "bottom"];
|
|
19
12
|
if (parts.length === 1) {
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
const dim = parsers.parseMeasurement(parts[0]);
|
|
14
|
+
if (dim) {
|
|
15
|
+
return dim;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return v;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
if (
|
|
31
|
-
(types[0] === parsers.TYPES.LENGTH || types[0] === parsers.TYPES.PERCENT) &&
|
|
32
|
-
(types[1] === parsers.TYPES.LENGTH || types[1] === parsers.TYPES.PERCENT)
|
|
33
|
-
) {
|
|
34
|
-
return v;
|
|
17
|
+
const validKeywords = new Set([...validKeywordsX, ...validKeywordsY]);
|
|
18
|
+
return parsers.parseKeyword(v, [...validKeywords]);
|
|
35
19
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
20
|
+
const [partX, partY] = parts;
|
|
21
|
+
const posX = parsers.parseMeasurement(partX) || parsers.parseKeyword(partX, validKeywordsX);
|
|
22
|
+
if (posX) {
|
|
23
|
+
const posY = parsers.parseMeasurement(partY) || parsers.parseKeyword(partY, validKeywordsY);
|
|
24
|
+
if (posY) {
|
|
25
|
+
return `${posX} ${posY}`;
|
|
26
|
+
}
|
|
41
27
|
}
|
|
42
|
-
return undefined;
|
|
43
28
|
};
|
|
44
29
|
|
|
45
30
|
module.exports.isValid = function isValid(v) {
|
|
46
|
-
|
|
31
|
+
if (v === "") {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
return typeof module.exports.parse(v) === "string";
|
|
47
35
|
};
|
|
48
36
|
|
|
49
37
|
module.exports.definition = {
|
|
50
|
-
set
|
|
51
|
-
|
|
38
|
+
set(v) {
|
|
39
|
+
v = parsers.prepareValue(v, this._global);
|
|
40
|
+
if (parsers.hasVarFunc(v)) {
|
|
41
|
+
this._setProperty("background", "");
|
|
42
|
+
this._setProperty("backgound-position", v);
|
|
43
|
+
} else {
|
|
44
|
+
this._setProperty("background-position", module.exports.parse(v));
|
|
45
|
+
}
|
|
52
46
|
},
|
|
53
|
-
get
|
|
54
|
-
return this.getPropertyValue(
|
|
47
|
+
get() {
|
|
48
|
+
return this.getPropertyValue("background-position");
|
|
55
49
|
},
|
|
56
50
|
enumerable: true,
|
|
57
|
-
configurable: true
|
|
51
|
+
configurable: true
|
|
58
52
|
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const parsers = require("../parsers");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
(v.toLowerCase() === 'repeat' ||
|
|
9
|
-
v.toLowerCase() === 'repeat-x' ||
|
|
10
|
-
v.toLowerCase() === 'repeat-y' ||
|
|
11
|
-
v.toLowerCase() === 'no-repeat' ||
|
|
12
|
-
v.toLowerCase() === 'inherit')
|
|
13
|
-
) {
|
|
14
|
-
return v;
|
|
15
|
-
}
|
|
16
|
-
return undefined;
|
|
5
|
+
module.exports.parse = function parse(v) {
|
|
6
|
+
const keywords = ["repeat", "repeat-x", "repeat-y", "no-repeat", "space", "round"];
|
|
7
|
+
return parsers.parseKeyword(v, keywords);
|
|
17
8
|
};
|
|
18
9
|
|
|
19
10
|
module.exports.isValid = function isValid(v) {
|
|
20
|
-
|
|
11
|
+
if (v === "") {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
return typeof module.exports.parse(v) === "string";
|
|
21
15
|
};
|
|
22
16
|
|
|
23
17
|
module.exports.definition = {
|
|
24
|
-
set
|
|
25
|
-
|
|
18
|
+
set(v) {
|
|
19
|
+
v = parsers.prepareValue(v, this._global);
|
|
20
|
+
if (parsers.hasVarFunc(v)) {
|
|
21
|
+
this._setProperty("background", "");
|
|
22
|
+
this._setProperty("backgound-repeat", v);
|
|
23
|
+
} else {
|
|
24
|
+
this._setProperty("background-repeat", module.exports.parse(v));
|
|
25
|
+
}
|
|
26
26
|
},
|
|
27
|
-
get
|
|
28
|
-
return this.getPropertyValue(
|
|
27
|
+
get() {
|
|
28
|
+
return this.getPropertyValue("background-repeat");
|
|
29
29
|
},
|
|
30
30
|
enumerable: true,
|
|
31
|
-
configurable: true
|
|
31
|
+
configurable: true
|
|
32
32
|
};
|
package/lib/properties/border.js
CHANGED
|
@@ -1,33 +1,42 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const parsers = require("../parsers");
|
|
4
|
+
const borderWidth = require("./borderWidth");
|
|
5
|
+
const borderStyle = require("./borderStyle");
|
|
6
|
+
const borderColor = require("./borderColor");
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var myShorthandSetter = shorthandSetter('border', shorthand_for);
|
|
13
|
-
var myShorthandGetter = shorthandGetter('border', shorthand_for);
|
|
8
|
+
const shorthandFor = new Map([
|
|
9
|
+
["border-width", borderWidth],
|
|
10
|
+
["border-style", borderStyle],
|
|
11
|
+
["border-color", borderColor]
|
|
12
|
+
]);
|
|
14
13
|
|
|
15
14
|
module.exports.definition = {
|
|
16
|
-
set
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
set(v) {
|
|
16
|
+
v = parsers.prepareValue(v, this._global);
|
|
17
|
+
if (v.toLowerCase() === "none") {
|
|
18
|
+
v = "";
|
|
19
|
+
}
|
|
20
|
+
if (parsers.hasVarFunc(v)) {
|
|
21
|
+
for (const [key] of shorthandFor) {
|
|
22
|
+
this._setProperty(key, "");
|
|
23
|
+
}
|
|
24
|
+
this._setProperty("border", v);
|
|
25
|
+
} else {
|
|
26
|
+
this._midShorthandSetter("border", v, shorthandFor, ["top", "right", "bottom", "left"]);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
get() {
|
|
30
|
+
let val = this.getPropertyValue("border");
|
|
31
|
+
if (parsers.hasVarFunc(val)) {
|
|
32
|
+
return val;
|
|
33
|
+
}
|
|
34
|
+
val = this._shorthandGetter("border", shorthandFor);
|
|
35
|
+
if (parsers.hasVarFunc(val)) {
|
|
36
|
+
return "";
|
|
19
37
|
}
|
|
20
|
-
|
|
21
|
-
this.removeProperty('border-top');
|
|
22
|
-
this.removeProperty('border-left');
|
|
23
|
-
this.removeProperty('border-right');
|
|
24
|
-
this.removeProperty('border-bottom');
|
|
25
|
-
this._values['border-top'] = this._values.border;
|
|
26
|
-
this._values['border-left'] = this._values.border;
|
|
27
|
-
this._values['border-right'] = this._values.border;
|
|
28
|
-
this._values['border-bottom'] = this._values.border;
|
|
38
|
+
return val;
|
|
29
39
|
},
|
|
30
|
-
get: myShorthandGetter,
|
|
31
40
|
enumerable: true,
|
|
32
|
-
configurable: true
|
|
41
|
+
configurable: true
|
|
33
42
|
};
|
|
@@ -1,17 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const parsers = require("../parsers");
|
|
4
|
+
const borderTopWidth = require("./borderTopWidth");
|
|
5
|
+
const borderTopStyle = require("./borderTopStyle");
|
|
6
|
+
const borderTopColor = require("./borderTopColor");
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const shorthandFor = new Map([
|
|
9
|
+
["border-bottom-width", borderTopWidth],
|
|
10
|
+
["border-bottom-style", borderTopStyle],
|
|
11
|
+
["border-bottom-color", borderTopColor]
|
|
12
|
+
]);
|
|
11
13
|
|
|
12
14
|
module.exports.definition = {
|
|
13
|
-
set
|
|
14
|
-
|
|
15
|
+
set(v) {
|
|
16
|
+
v = parsers.prepareValue(v, this._global);
|
|
17
|
+
if (parsers.hasVarFunc(v)) {
|
|
18
|
+
for (const [key] of shorthandFor) {
|
|
19
|
+
this._setProperty(key, "");
|
|
20
|
+
}
|
|
21
|
+
this._setProperty("border", "");
|
|
22
|
+
this._setProperty("border-bottom", v);
|
|
23
|
+
} else {
|
|
24
|
+
this._shorthandSetter("border-bottom", v, shorthandFor);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
get() {
|
|
28
|
+
let val = this.getPropertyValue("border-bottom");
|
|
29
|
+
if (parsers.hasVarFunc(val)) {
|
|
30
|
+
return val;
|
|
31
|
+
}
|
|
32
|
+
val = this._shorthandGetter("border-bottom", shorthandFor);
|
|
33
|
+
if (parsers.hasVarFunc(val)) {
|
|
34
|
+
return "";
|
|
35
|
+
}
|
|
36
|
+
return val;
|
|
37
|
+
},
|
|
15
38
|
enumerable: true,
|
|
16
|
-
configurable: true
|
|
39
|
+
configurable: true
|
|
17
40
|
};
|
|
@@ -1,16 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const parsers = require("../parsers");
|
|
4
|
+
|
|
5
|
+
module.exports.parse = function parse(v) {
|
|
6
|
+
const val = parsers.parseColor(v);
|
|
7
|
+
if (val) {
|
|
8
|
+
return val;
|
|
9
|
+
}
|
|
10
|
+
return parsers.parseKeyword(v);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
module.exports.isValid = function isValid(v) {
|
|
14
|
+
if (v === "" || typeof parsers.parseKeyword(v) === "string") {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return parsers.isValidColor(v);
|
|
18
|
+
};
|
|
4
19
|
|
|
5
20
|
module.exports.definition = {
|
|
6
|
-
set
|
|
7
|
-
|
|
8
|
-
|
|
21
|
+
set(v) {
|
|
22
|
+
v = parsers.prepareValue(v, this._global);
|
|
23
|
+
if (parsers.hasVarFunc(v)) {
|
|
24
|
+
this._setProperty("border", "");
|
|
25
|
+
this._setProperty("border-bottom", "");
|
|
26
|
+
this._setProperty("border-color", "");
|
|
9
27
|
}
|
|
28
|
+
this._setProperty("border-bottom-color", module.exports.parse(v));
|
|
10
29
|
},
|
|
11
|
-
get
|
|
12
|
-
return this.getPropertyValue(
|
|
30
|
+
get() {
|
|
31
|
+
return this.getPropertyValue("border-bottom-color");
|
|
13
32
|
},
|
|
14
33
|
enumerable: true,
|
|
15
|
-
configurable: true
|
|
34
|
+
configurable: true
|
|
16
35
|
};
|
|
@@ -1,21 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const parsers = require("../parsers");
|
|
4
|
+
|
|
5
|
+
module.exports.parse = function parse(v) {
|
|
6
|
+
const keywords = [
|
|
7
|
+
"none",
|
|
8
|
+
"hidden",
|
|
9
|
+
"dotted",
|
|
10
|
+
"dashed",
|
|
11
|
+
"solid",
|
|
12
|
+
"double",
|
|
13
|
+
"groove",
|
|
14
|
+
"ridge",
|
|
15
|
+
"inset",
|
|
16
|
+
"outset"
|
|
17
|
+
];
|
|
18
|
+
return parsers.parseKeyword(v, keywords);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
module.exports.isValid = function isValid(v) {
|
|
22
|
+
if (v === "") {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
return typeof module.exports.parse(v) === "string";
|
|
26
|
+
};
|
|
5
27
|
|
|
6
28
|
module.exports.definition = {
|
|
7
|
-
set
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this._setProperty(
|
|
29
|
+
set(v) {
|
|
30
|
+
v = parsers.prepareValue(v, this._global);
|
|
31
|
+
const val = module.exports.parse(v);
|
|
32
|
+
if (val === "none" || val === "hidden") {
|
|
33
|
+
this._setProperty("border-bottom-style", "");
|
|
34
|
+
this._setProperty("border-bottom-color", "");
|
|
35
|
+
this._setProperty("border-bottom-width", "");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (parsers.hasVarFunc(v)) {
|
|
39
|
+
this._setProperty("border", "");
|
|
40
|
+
this._setProperty("border-bottom", "");
|
|
41
|
+
this._setProperty("border-style", "");
|
|
14
42
|
}
|
|
43
|
+
this._setProperty("border-bottom-style", val);
|
|
15
44
|
},
|
|
16
|
-
get
|
|
17
|
-
return this.getPropertyValue(
|
|
45
|
+
get() {
|
|
46
|
+
return this.getPropertyValue("border-bottom-style");
|
|
18
47
|
},
|
|
19
48
|
enumerable: true,
|
|
20
|
-
configurable: true
|
|
49
|
+
configurable: true
|
|
21
50
|
};
|
|
@@ -1,16 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const parsers = require("../parsers");
|
|
4
|
+
|
|
5
|
+
module.exports.parse = function parse(v) {
|
|
6
|
+
const keywords = ["thin", "medium", "thick"];
|
|
7
|
+
const key = parsers.parseKeyword(v, keywords);
|
|
8
|
+
if (key) {
|
|
9
|
+
return key;
|
|
10
|
+
}
|
|
11
|
+
return parsers.parseLength(v, true);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
module.exports.isValid = function isValid(v) {
|
|
15
|
+
if (v === "") {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
return typeof module.exports.parse(v) === "string";
|
|
19
|
+
};
|
|
4
20
|
|
|
5
21
|
module.exports.definition = {
|
|
6
|
-
set
|
|
7
|
-
|
|
8
|
-
|
|
22
|
+
set(v) {
|
|
23
|
+
v = parsers.prepareValue(v, this._global);
|
|
24
|
+
if (parsers.hasVarFunc(v)) {
|
|
25
|
+
this._setProperty("border", "");
|
|
26
|
+
this._setProperty("border-bottom", "");
|
|
27
|
+
this._setProperty("border-width", "");
|
|
9
28
|
}
|
|
29
|
+
this._setProperty("border-bottom-width", module.exports.parse(v));
|
|
10
30
|
},
|
|
11
|
-
get
|
|
12
|
-
return this.getPropertyValue(
|
|
31
|
+
get() {
|
|
32
|
+
return this.getPropertyValue("border-bottom-width");
|
|
13
33
|
},
|
|
14
34
|
enumerable: true,
|
|
15
|
-
configurable: true
|
|
35
|
+
configurable: true
|
|
16
36
|
};
|