cssstyle 4.6.0 → 5.0.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.
@@ -5,6 +5,7 @@
5
5
  "use strict";
6
6
  const CSSOM = require("rrweb-cssom");
7
7
  const allExtraProperties = require("./allExtraProperties");
8
+ const { shorthandProperties } = require("./shorthandProperties");
8
9
  const allProperties = require("./generated/allProperties");
9
10
  const implementedProperties = require("./generated/implementedProperties");
10
11
  const generatedProperties = require("./generated/properties");
@@ -121,18 +122,26 @@ class CSSStyleDeclaration {
121
122
  if (this._computed) {
122
123
  return "";
123
124
  }
124
- const properties = [];
125
+ const properties = new Map();
125
126
  for (let i = 0; i < this._length; i++) {
126
127
  const property = this[i];
127
128
  const value = this.getPropertyValue(property);
128
129
  const priority = this.getPropertyPriority(property);
129
130
  if (priority === "important") {
130
- properties.push(`${property}: ${value} !${priority};`);
131
+ properties.set(property, `${property}: ${value} !${priority};`);
131
132
  } else {
132
- properties.push(`${property}: ${value};`);
133
+ if (shorthandProperties.has(property)) {
134
+ const longhandProperties = shorthandProperties.get(property);
135
+ for (const [longhandProperty] of longhandProperties) {
136
+ if (properties.has(longhandProperty) && !this.getPropertyPriority(longhandProperty)) {
137
+ properties.delete(longhandProperty);
138
+ }
139
+ }
140
+ }
141
+ properties.set(property, `${property}: ${value};`);
133
142
  }
134
143
  }
135
- return properties.join(" ");
144
+ return [...properties.values()].join(" ");
136
145
  }
137
146
 
138
147
  set cssText(value) {
@@ -273,7 +282,7 @@ class CSSStyleDeclaration {
273
282
  }
274
283
  const isCustomProperty = property.startsWith("--");
275
284
  if (isCustomProperty) {
276
- this._setProperty(property, value);
285
+ this._setProperty(property, value, priority);
277
286
  return;
278
287
  }
279
288
  property = asciiLowercase(property);
@@ -1,14 +1,26 @@
1
1
  "use strict";
2
- // autogenerated - 2025-06-25
2
+ // autogenerated - 2025-07-14
3
3
  // https://www.w3.org/Style/CSS/all-properties.en.html
4
4
 
5
5
  module.exports = new Set([
6
+ "-webkit-border-after-color",
7
+ "-webkit-border-before-color",
8
+ "-webkit-border-end-color",
9
+ "-webkit-border-start-color",
10
+ "-webkit-column-rule-color",
11
+ "-webkit-tap-highlight-color",
12
+ "-webkit-text-emphasis-color",
13
+ "-webkit-text-fill-color",
14
+ "-webkit-text-stroke-color",
6
15
  "background",
7
16
  "background-attachment",
17
+ "background-clip",
8
18
  "background-color",
9
19
  "background-image",
20
+ "background-origin",
10
21
  "background-position",
11
22
  "background-repeat",
23
+ "background-size",
12
24
  "border",
13
25
  "border-bottom",
14
26
  "border-bottom-color",
@@ -66,14 +78,5 @@ module.exports = new Set([
66
78
  "right",
67
79
  "stop-color",
68
80
  "top",
69
- "-webkit-border-after-color",
70
- "-webkit-border-before-color",
71
- "-webkit-border-end-color",
72
- "-webkit-border-start-color",
73
- "-webkit-column-rule-color",
74
- "-webkit-tap-highlight-color",
75
- "-webkit-text-emphasis-color",
76
- "-webkit-text-fill-color",
77
- "-webkit-text-stroke-color",
78
81
  "width"
79
82
  ]);