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.
Files changed (86) hide show
  1. package/lib/CSSStyleDeclaration.js +2 -2
  2. package/lib/generated/implementedProperties.js +1 -1
  3. package/lib/generated/properties.js +1958 -2271
  4. package/lib/generated/propertyDefinitions.js +13033 -0
  5. package/lib/normalize.js +1259 -1095
  6. package/lib/parsers.js +588 -228
  7. package/lib/properties/background.js +89 -79
  8. package/lib/properties/backgroundAttachment.js +11 -14
  9. package/lib/properties/backgroundClip.js +11 -14
  10. package/lib/properties/backgroundColor.js +8 -13
  11. package/lib/properties/backgroundImage.js +11 -26
  12. package/lib/properties/backgroundOrigin.js +11 -14
  13. package/lib/properties/backgroundPosition.js +29 -18
  14. package/lib/properties/backgroundRepeat.js +11 -7
  15. package/lib/properties/backgroundSize.js +22 -16
  16. package/lib/properties/border.js +30 -87
  17. package/lib/properties/borderBottom.js +30 -86
  18. package/lib/properties/borderBottomColor.js +8 -14
  19. package/lib/properties/borderBottomStyle.js +8 -13
  20. package/lib/properties/borderBottomWidth.js +11 -23
  21. package/lib/properties/borderCollapse.js +4 -9
  22. package/lib/properties/borderColor.js +17 -23
  23. package/lib/properties/borderLeft.js +30 -86
  24. package/lib/properties/borderLeftColor.js +8 -14
  25. package/lib/properties/borderLeftStyle.js +8 -13
  26. package/lib/properties/borderLeftWidth.js +11 -23
  27. package/lib/properties/borderRight.js +30 -86
  28. package/lib/properties/borderRightColor.js +8 -14
  29. package/lib/properties/borderRightStyle.js +8 -13
  30. package/lib/properties/borderRightWidth.js +11 -23
  31. package/lib/properties/borderSpacing.js +12 -9
  32. package/lib/properties/borderStyle.js +17 -23
  33. package/lib/properties/borderTop.js +30 -86
  34. package/lib/properties/borderTopColor.js +8 -14
  35. package/lib/properties/borderTopStyle.js +8 -13
  36. package/lib/properties/borderTopWidth.js +11 -23
  37. package/lib/properties/borderWidth.js +18 -36
  38. package/lib/properties/bottom.js +6 -17
  39. package/lib/properties/clear.js +4 -9
  40. package/lib/properties/clip.js +10 -5
  41. package/lib/properties/color.js +4 -10
  42. package/lib/properties/display.js +11 -8
  43. package/lib/properties/flex.js +55 -53
  44. package/lib/properties/flexBasis.js +10 -20
  45. package/lib/properties/flexGrow.js +10 -19
  46. package/lib/properties/flexShrink.js +10 -19
  47. package/lib/properties/float.js +4 -9
  48. package/lib/properties/floodColor.js +4 -10
  49. package/lib/properties/font.js +46 -33
  50. package/lib/properties/fontFamily.js +16 -12
  51. package/lib/properties/fontSize.js +11 -22
  52. package/lib/properties/fontStyle.js +14 -8
  53. package/lib/properties/fontVariant.js +11 -18
  54. package/lib/properties/fontWeight.js +14 -25
  55. package/lib/properties/height.js +7 -17
  56. package/lib/properties/left.js +6 -17
  57. package/lib/properties/lightingColor.js +4 -10
  58. package/lib/properties/lineHeight.js +10 -24
  59. package/lib/properties/margin.js +14 -32
  60. package/lib/properties/marginBottom.js +10 -20
  61. package/lib/properties/marginLeft.js +10 -20
  62. package/lib/properties/marginRight.js +10 -20
  63. package/lib/properties/marginTop.js +10 -20
  64. package/lib/properties/opacity.js +6 -18
  65. package/lib/properties/outlineColor.js +4 -10
  66. package/lib/properties/padding.js +15 -30
  67. package/lib/properties/paddingBottom.js +11 -21
  68. package/lib/properties/paddingLeft.js +11 -21
  69. package/lib/properties/paddingRight.js +11 -21
  70. package/lib/properties/paddingTop.js +11 -21
  71. package/lib/properties/right.js +6 -17
  72. package/lib/properties/stopColor.js +4 -10
  73. package/lib/properties/top.js +7 -17
  74. package/lib/properties/webkitBorderAfterColor.js +4 -10
  75. package/lib/properties/webkitBorderBeforeColor.js +4 -10
  76. package/lib/properties/webkitBorderEndColor.js +4 -10
  77. package/lib/properties/webkitBorderStartColor.js +4 -10
  78. package/lib/properties/webkitColumnRuleColor.js +4 -10
  79. package/lib/properties/webkitTapHighlightColor.js +4 -10
  80. package/lib/properties/webkitTextEmphasisColor.js +4 -10
  81. package/lib/properties/webkitTextFillColor.js +4 -10
  82. package/lib/properties/webkitTextStrokeColor.js +4 -10
  83. package/lib/properties/width.js +7 -17
  84. package/lib/utils/propertyDescriptors.js +49 -13
  85. package/lib/utils/strings.js +6 -0
  86. package/package.json +8 -27
@@ -11,13 +11,13 @@ const property = "margin";
11
11
  module.exports.position = "edges";
12
12
 
13
13
  module.exports.shorthandFor = new Map([
14
- ["margin-top", marginTop],
15
- ["margin-right", marginRight],
16
- ["margin-bottom", marginBottom],
17
- ["margin-left", marginLeft]
14
+ [marginTop.property, marginTop],
15
+ [marginRight.property, marginRight],
16
+ [marginBottom.property, marginBottom],
17
+ [marginLeft.property, marginLeft]
18
18
  ]);
19
19
 
20
- module.exports.parse = function parse(v, opt = {}) {
20
+ module.exports.parse = (v, opt = {}) => {
21
21
  const { globalObject } = opt;
22
22
  if (v === "") {
23
23
  return v;
@@ -32,34 +32,14 @@ module.exports.parse = function parse(v, opt = {}) {
32
32
  return;
33
33
  }
34
34
  for (const value of values) {
35
- const { isNumber, name, type, value: itemValue } = value;
36
- switch (type) {
37
- case "Calc": {
38
- if (isNumber) {
39
- return;
40
- }
41
- parsedValues.push(`${name}(${itemValue})`);
42
- break;
43
- }
44
- case "GlobalKeyword": {
45
- if (values.length !== 1) {
46
- return;
47
- }
48
- parsedValues.push(name);
49
- break;
50
- }
51
- case "Identifier": {
52
- parsedValues.push(name);
53
- break;
54
- }
55
- default: {
56
- const parsedValue = parsers.parseLengthPercentage([value]);
57
- if (!parsedValue) {
58
- return;
59
- }
60
- parsedValues.push(parsedValue);
61
- }
35
+ const parsedValue = parsers.resolveNumericValue([value], {
36
+ length: values.length,
37
+ type: "length"
38
+ });
39
+ if (!parsedValue) {
40
+ return;
62
41
  }
42
+ parsedValues.push(parsedValue);
63
43
  }
64
44
  } else if (typeof values === "string") {
65
45
  parsedValues.push(values);
@@ -93,3 +73,5 @@ module.exports.definition = {
93
73
  enumerable: true,
94
74
  configurable: true
95
75
  };
76
+
77
+ module.exports.property = property;
@@ -7,7 +7,7 @@ const shorthand = "margin";
7
7
 
8
8
  module.exports.position = "bottom";
9
9
 
10
- module.exports.parse = function parse(v, opt = {}) {
10
+ module.exports.parse = (v, opt = {}) => {
11
11
  const { globalObject } = opt;
12
12
  if (v === "") {
13
13
  return v;
@@ -17,22 +17,9 @@ module.exports.parse = function parse(v, opt = {}) {
17
17
  inArray: true
18
18
  });
19
19
  if (Array.isArray(value) && value.length === 1) {
20
- const [{ isNumber, name, type, value: itemValue }] = value;
21
- switch (type) {
22
- case "Calc": {
23
- if (isNumber) {
24
- return;
25
- }
26
- return `${name}(${itemValue})`;
27
- }
28
- case "GlobalKeyword":
29
- case "Identifier": {
30
- return name;
31
- }
32
- default: {
33
- return parsers.parseLengthPercentage(value);
34
- }
35
- }
20
+ return parsers.resolveNumericValue(value, {
21
+ type: "length"
22
+ });
36
23
  } else if (typeof value === "string") {
37
24
  return value;
38
25
  }
@@ -49,9 +36,10 @@ module.exports.definition = {
49
36
  globalObject: this._global
50
37
  });
51
38
  if (typeof val === "string") {
52
- const shorthandPriority = this._priorities.get(shorthand);
53
- const prior = this._priorities.get(property) ?? "";
54
- const priority = shorthandPriority && prior ? "" : prior;
39
+ const priority =
40
+ !this._priorities.get(shorthand) && this._priorities.has(property)
41
+ ? this._priorities.get(property)
42
+ : "";
55
43
  this._positionLonghandSetter(property, val, priority, shorthand);
56
44
  }
57
45
  }
@@ -62,3 +50,5 @@ module.exports.definition = {
62
50
  enumerable: true,
63
51
  configurable: true
64
52
  };
53
+
54
+ module.exports.property = property;
@@ -7,7 +7,7 @@ const shorthand = "margin";
7
7
 
8
8
  module.exports.position = "left";
9
9
 
10
- module.exports.parse = function parse(v, opt = {}) {
10
+ module.exports.parse = (v, opt = {}) => {
11
11
  const { globalObject } = opt;
12
12
  if (v === "") {
13
13
  return v;
@@ -17,22 +17,9 @@ module.exports.parse = function parse(v, opt = {}) {
17
17
  inArray: true
18
18
  });
19
19
  if (Array.isArray(value) && value.length === 1) {
20
- const [{ isNumber, name, type, value: itemValue }] = value;
21
- switch (type) {
22
- case "Calc": {
23
- if (isNumber) {
24
- return;
25
- }
26
- return `${name}(${itemValue})`;
27
- }
28
- case "GlobalKeyword":
29
- case "Identifier": {
30
- return name;
31
- }
32
- default: {
33
- return parsers.parseLengthPercentage(value);
34
- }
35
- }
20
+ return parsers.resolveNumericValue(value, {
21
+ type: "length"
22
+ });
36
23
  } else if (typeof value === "string") {
37
24
  return value;
38
25
  }
@@ -49,9 +36,10 @@ module.exports.definition = {
49
36
  globalObject: this._global
50
37
  });
51
38
  if (typeof val === "string") {
52
- const shorthandPriority = this._priorities.get(shorthand);
53
- const prior = this._priorities.get(property) ?? "";
54
- const priority = shorthandPriority && prior ? "" : prior;
39
+ const priority =
40
+ !this._priorities.get(shorthand) && this._priorities.has(property)
41
+ ? this._priorities.get(property)
42
+ : "";
55
43
  this._positionLonghandSetter(property, val, priority, shorthand);
56
44
  }
57
45
  }
@@ -62,3 +50,5 @@ module.exports.definition = {
62
50
  enumerable: true,
63
51
  configurable: true
64
52
  };
53
+
54
+ module.exports.property = property;
@@ -7,7 +7,7 @@ const shorthand = "margin";
7
7
 
8
8
  module.exports.position = "right";
9
9
 
10
- module.exports.parse = function parse(v, opt = {}) {
10
+ module.exports.parse = (v, opt = {}) => {
11
11
  const { globalObject } = opt;
12
12
  if (v === "") {
13
13
  return v;
@@ -17,22 +17,9 @@ module.exports.parse = function parse(v, opt = {}) {
17
17
  inArray: true
18
18
  });
19
19
  if (Array.isArray(value) && value.length === 1) {
20
- const [{ isNumber, name, type, value: itemValue }] = value;
21
- switch (type) {
22
- case "Calc": {
23
- if (isNumber) {
24
- return;
25
- }
26
- return `${name}(${itemValue})`;
27
- }
28
- case "GlobalKeyword":
29
- case "Identifier": {
30
- return name;
31
- }
32
- default: {
33
- return parsers.parseLengthPercentage(value);
34
- }
35
- }
20
+ return parsers.resolveNumericValue(value, {
21
+ type: "length"
22
+ });
36
23
  } else if (typeof value === "string") {
37
24
  return value;
38
25
  }
@@ -49,9 +36,10 @@ module.exports.definition = {
49
36
  globalObject: this._global
50
37
  });
51
38
  if (typeof val === "string") {
52
- const shorthandPriority = this._priorities.get(shorthand);
53
- const prior = this._priorities.get(property) ?? "";
54
- const priority = shorthandPriority && prior ? "" : prior;
39
+ const priority =
40
+ !this._priorities.get(shorthand) && this._priorities.has(property)
41
+ ? this._priorities.get(property)
42
+ : "";
55
43
  this._positionLonghandSetter(property, val, priority, shorthand);
56
44
  }
57
45
  }
@@ -62,3 +50,5 @@ module.exports.definition = {
62
50
  enumerable: true,
63
51
  configurable: true
64
52
  };
53
+
54
+ module.exports.property = property;
@@ -7,7 +7,7 @@ const shorthand = "margin";
7
7
 
8
8
  module.exports.position = "top";
9
9
 
10
- module.exports.parse = function parse(v, opt = {}) {
10
+ module.exports.parse = (v, opt = {}) => {
11
11
  const { globalObject } = opt;
12
12
  if (v === "") {
13
13
  return v;
@@ -17,22 +17,9 @@ module.exports.parse = function parse(v, opt = {}) {
17
17
  inArray: true
18
18
  });
19
19
  if (Array.isArray(value) && value.length === 1) {
20
- const [{ isNumber, name, type, value: itemValue }] = value;
21
- switch (type) {
22
- case "Calc": {
23
- if (isNumber) {
24
- return;
25
- }
26
- return `${name}(${itemValue})`;
27
- }
28
- case "GlobalKeyword":
29
- case "Identifier": {
30
- return name;
31
- }
32
- default: {
33
- return parsers.parseLengthPercentage(value);
34
- }
35
- }
20
+ return parsers.resolveNumericValue(value, {
21
+ type: "length"
22
+ });
36
23
  } else if (typeof value === "string") {
37
24
  return value;
38
25
  }
@@ -49,9 +36,10 @@ module.exports.definition = {
49
36
  globalObject: this._global
50
37
  });
51
38
  if (typeof val === "string") {
52
- const shorthandPriority = this._priorities.get(shorthand);
53
- const prior = this._priorities.get(property) ?? "";
54
- const priority = shorthandPriority && prior ? "" : prior;
39
+ const priority =
40
+ !this._priorities.get(shorthand) && this._priorities.has(property)
41
+ ? this._priorities.get(property)
42
+ : "";
55
43
  this._positionLonghandSetter(property, val, priority, shorthand);
56
44
  }
57
45
  }
@@ -62,3 +50,5 @@ module.exports.definition = {
62
50
  enumerable: true,
63
51
  configurable: true
64
52
  };
53
+
54
+ module.exports.property = property;
@@ -4,7 +4,7 @@ const parsers = require("../parsers");
4
4
 
5
5
  const property = "opacity";
6
6
 
7
- module.exports.parse = function parse(v, opt = {}) {
7
+ module.exports.parse = (v, opt = {}) => {
8
8
  const { globalObject } = opt;
9
9
  if (v === "") {
10
10
  return v;
@@ -14,23 +14,9 @@ module.exports.parse = function parse(v, opt = {}) {
14
14
  inArray: true
15
15
  });
16
16
  if (Array.isArray(value) && value.length === 1) {
17
- const [{ name, type, value: itemValue }] = value;
18
- switch (type) {
19
- case "Calc": {
20
- return `${name}(${itemValue})`;
21
- }
22
- case "GlobalKeyword":
23
- case "Identifier": {
24
- return name;
25
- }
26
- case "Number": {
27
- return parsers.parseNumber(value);
28
- }
29
- case "Percentage": {
30
- return parsers.parsePercentage(value);
31
- }
32
- default:
33
- }
17
+ return parsers.resolveNumericValue(value, {
18
+ clamp: true
19
+ });
34
20
  } else if (typeof value === "string") {
35
21
  return value;
36
22
  }
@@ -57,3 +43,5 @@ module.exports.definition = {
57
43
  enumerable: true,
58
44
  configurable: true
59
45
  };
46
+
47
+ module.exports.property = property;
@@ -4,7 +4,7 @@ const parsers = require("../parsers");
4
4
 
5
5
  const property = "outline-color";
6
6
 
7
- module.exports.parse = function parse(v, opt = {}) {
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
- const [{ name, type }] = value;
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;
@@ -11,13 +11,13 @@ const property = "padding";
11
11
  module.exports.position = "edges";
12
12
 
13
13
  module.exports.shorthandFor = new Map([
14
- ["padding-top", paddingTop],
15
- ["padding-right", paddingRight],
16
- ["padding-bottom", paddingBottom],
17
- ["padding-left", paddingLeft]
14
+ [paddingTop.property, paddingTop],
15
+ [paddingRight.property, paddingRight],
16
+ [paddingBottom.property, paddingBottom],
17
+ [paddingLeft.property, paddingLeft]
18
18
  ]);
19
19
 
20
- module.exports.parse = function parse(v, opt = {}) {
20
+ module.exports.parse = (v, opt = {}) => {
21
21
  const { globalObject } = opt;
22
22
  if (v === "") {
23
23
  return v;
@@ -32,32 +32,15 @@ module.exports.parse = function parse(v, opt = {}) {
32
32
  return;
33
33
  }
34
34
  for (const value of values) {
35
- const { isNumber, name, type, value: itemValue } = value;
36
- switch (type) {
37
- case "Calc": {
38
- if (isNumber) {
39
- return;
40
- }
41
- parsedValues.push(`${name}(${itemValue})`);
42
- break;
43
- }
44
- case "GlobalKeyword": {
45
- if (values.length !== 1) {
46
- return;
47
- }
48
- parsedValues.push(name);
49
- break;
50
- }
51
- default: {
52
- const parsedValue = parsers.parseLengthPercentage([value], {
53
- min: 0
54
- });
55
- if (!parsedValue) {
56
- return;
57
- }
58
- parsedValues.push(parsedValue);
59
- }
35
+ const parsedValue = parsers.resolveNumericValue([value], {
36
+ length: values.length,
37
+ min: 0,
38
+ type: "length"
39
+ });
40
+ if (!parsedValue) {
41
+ return;
60
42
  }
43
+ parsedValues.push(parsedValue);
61
44
  }
62
45
  } else if (typeof values === "string") {
63
46
  parsedValues.push(values);
@@ -91,3 +74,5 @@ module.exports.definition = {
91
74
  enumerable: true,
92
75
  configurable: true
93
76
  };
77
+
78
+ module.exports.property = property;
@@ -7,7 +7,7 @@ const shorthand = "padding";
7
7
 
8
8
  module.exports.position = "bottom";
9
9
 
10
- module.exports.parse = function parse(v, opt = {}) {
10
+ module.exports.parse = (v, opt = {}) => {
11
11
  const { globalObject } = opt;
12
12
  if (v === "") {
13
13
  return v;
@@ -17,23 +17,10 @@ module.exports.parse = function parse(v, opt = {}) {
17
17
  inArray: true
18
18
  });
19
19
  if (Array.isArray(value) && value.length === 1) {
20
- const [{ isNumber, name, type, value: itemValue }] = value;
21
- switch (type) {
22
- case "Calc": {
23
- if (isNumber) {
24
- return;
25
- }
26
- return `${name}(${itemValue})`;
27
- }
28
- case "GlobalKeyword": {
29
- return name;
30
- }
31
- default: {
32
- return parsers.parseLengthPercentage(value, {
33
- min: 0
34
- });
35
- }
36
- }
20
+ return parsers.resolveNumericValue(value, {
21
+ min: 0,
22
+ type: "length"
23
+ });
37
24
  } else if (typeof value === "string") {
38
25
  return value;
39
26
  }
@@ -50,9 +37,10 @@ module.exports.definition = {
50
37
  globalObject: this._global
51
38
  });
52
39
  if (typeof val === "string") {
53
- const shorthandPriority = this._priorities.get(shorthand);
54
- const prior = this._priorities.get(property) ?? "";
55
- const priority = shorthandPriority && prior ? "" : prior;
40
+ const priority =
41
+ !this._priorities.get(shorthand) && this._priorities.has(property)
42
+ ? this._priorities.get(property)
43
+ : "";
56
44
  this._positionLonghandSetter(property, val, priority, shorthand);
57
45
  }
58
46
  }
@@ -63,3 +51,5 @@ module.exports.definition = {
63
51
  enumerable: true,
64
52
  configurable: true
65
53
  };
54
+
55
+ module.exports.property = property;
@@ -7,7 +7,7 @@ const shorthand = "padding";
7
7
 
8
8
  module.exports.position = "left";
9
9
 
10
- module.exports.parse = function parse(v, opt = {}) {
10
+ module.exports.parse = (v, opt = {}) => {
11
11
  const { globalObject } = opt;
12
12
  if (v === "") {
13
13
  return v;
@@ -17,23 +17,10 @@ module.exports.parse = function parse(v, opt = {}) {
17
17
  inArray: true
18
18
  });
19
19
  if (Array.isArray(value) && value.length === 1) {
20
- const [{ isNumber, name, type, value: itemValue }] = value;
21
- switch (type) {
22
- case "Calc": {
23
- if (isNumber) {
24
- return;
25
- }
26
- return `${name}(${itemValue})`;
27
- }
28
- case "GlobalKeyword": {
29
- return name;
30
- }
31
- default: {
32
- return parsers.parseLengthPercentage(value, {
33
- min: 0
34
- });
35
- }
36
- }
20
+ return parsers.resolveNumericValue(value, {
21
+ min: 0,
22
+ type: "length"
23
+ });
37
24
  } else if (typeof value === "string") {
38
25
  return value;
39
26
  }
@@ -50,9 +37,10 @@ module.exports.definition = {
50
37
  globalObject: this._global
51
38
  });
52
39
  if (typeof val === "string") {
53
- const shorthandPriority = this._priorities.get(shorthand);
54
- const prior = this._priorities.get(property) ?? "";
55
- const priority = shorthandPriority && prior ? "" : prior;
40
+ const priority =
41
+ !this._priorities.get(shorthand) && this._priorities.has(property)
42
+ ? this._priorities.get(property)
43
+ : "";
56
44
  this._positionLonghandSetter(property, val, priority, shorthand);
57
45
  }
58
46
  }
@@ -63,3 +51,5 @@ module.exports.definition = {
63
51
  enumerable: true,
64
52
  configurable: true
65
53
  };
54
+
55
+ module.exports.property = property;
@@ -7,7 +7,7 @@ const shorthand = "padding";
7
7
 
8
8
  module.exports.position = "right";
9
9
 
10
- module.exports.parse = function parse(v, opt = {}) {
10
+ module.exports.parse = (v, opt = {}) => {
11
11
  const { globalObject } = opt;
12
12
  if (v === "") {
13
13
  return v;
@@ -17,23 +17,10 @@ module.exports.parse = function parse(v, opt = {}) {
17
17
  inArray: true
18
18
  });
19
19
  if (Array.isArray(value) && value.length === 1) {
20
- const [{ isNumber, name, type, value: itemValue }] = value;
21
- switch (type) {
22
- case "Calc": {
23
- if (isNumber) {
24
- return;
25
- }
26
- return `${name}(${itemValue})`;
27
- }
28
- case "GlobalKeyword": {
29
- return name;
30
- }
31
- default: {
32
- return parsers.parseLengthPercentage(value, {
33
- min: 0
34
- });
35
- }
36
- }
20
+ return parsers.resolveNumericValue(value, {
21
+ min: 0,
22
+ type: "length"
23
+ });
37
24
  } else if (typeof value === "string") {
38
25
  return value;
39
26
  }
@@ -50,9 +37,10 @@ module.exports.definition = {
50
37
  globalObject: this._global
51
38
  });
52
39
  if (typeof val === "string") {
53
- const shorthandPriority = this._priorities.get(shorthand);
54
- const prior = this._priorities.get(property) ?? "";
55
- const priority = shorthandPriority && prior ? "" : prior;
40
+ const priority =
41
+ !this._priorities.get(shorthand) && this._priorities.has(property)
42
+ ? this._priorities.get(property)
43
+ : "";
56
44
  this._positionLonghandSetter(property, val, priority, shorthand);
57
45
  }
58
46
  }
@@ -63,3 +51,5 @@ module.exports.definition = {
63
51
  enumerable: true,
64
52
  configurable: true
65
53
  };
54
+
55
+ module.exports.property = property;
@@ -7,7 +7,7 @@ const shorthand = "padding";
7
7
 
8
8
  module.exports.position = "top";
9
9
 
10
- module.exports.parse = function parse(v, opt = {}) {
10
+ module.exports.parse = (v, opt = {}) => {
11
11
  const { globalObject } = opt;
12
12
  if (v === "") {
13
13
  return v;
@@ -17,23 +17,10 @@ module.exports.parse = function parse(v, opt = {}) {
17
17
  inArray: true
18
18
  });
19
19
  if (Array.isArray(value) && value.length === 1) {
20
- const [{ isNumber, name, type, value: itemValue }] = value;
21
- switch (type) {
22
- case "Calc": {
23
- if (isNumber) {
24
- return;
25
- }
26
- return `${name}(${itemValue})`;
27
- }
28
- case "GlobalKeyword": {
29
- return name;
30
- }
31
- default: {
32
- return parsers.parseLengthPercentage(value, {
33
- min: 0
34
- });
35
- }
36
- }
20
+ return parsers.resolveNumericValue(value, {
21
+ min: 0,
22
+ type: "length"
23
+ });
37
24
  } else if (typeof value === "string") {
38
25
  return value;
39
26
  }
@@ -50,9 +37,10 @@ module.exports.definition = {
50
37
  globalObject: this._global
51
38
  });
52
39
  if (typeof val === "string") {
53
- const shorthandPriority = this._priorities.get(shorthand);
54
- const prior = this._priorities.get(property) ?? "";
55
- const priority = shorthandPriority && prior ? "" : prior;
40
+ const priority =
41
+ !this._priorities.get(shorthand) && this._priorities.has(property)
42
+ ? this._priorities.get(property)
43
+ : "";
56
44
  this._positionLonghandSetter(property, val, priority, shorthand);
57
45
  }
58
46
  }
@@ -63,3 +51,5 @@ module.exports.definition = {
63
51
  enumerable: true,
64
52
  configurable: true
65
53
  };
54
+
55
+ module.exports.property = property;