cssstyle 4.5.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.
- package/lib/CSSStyleDeclaration.js +16 -6
- package/lib/generated/implementedProperties.js +13 -10
- package/lib/generated/properties.js +822 -94
- package/lib/parsers.js +59 -42
- package/lib/properties/background.js +350 -13
- package/lib/properties/backgroundAttachment.js +18 -1
- package/lib/properties/backgroundClip.js +49 -0
- package/lib/properties/backgroundImage.js +19 -2
- package/lib/properties/backgroundOrigin.js +49 -0
- package/lib/properties/backgroundPosition.js +142 -18
- package/lib/properties/backgroundRepeat.js +52 -2
- package/lib/properties/backgroundSize.js +80 -0
- package/lib/properties/border.js +10 -5
- package/lib/properties/borderBottom.js +4 -4
- package/lib/properties/borderLeft.js +4 -4
- package/lib/properties/borderRight.js +4 -4
- package/lib/properties/borderStyle.js +1 -1
- package/lib/properties/borderTop.js +4 -4
- package/lib/properties/clip.js +2 -1
- package/lib/properties/flex.js +5 -5
- package/lib/properties/font.js +8 -15
- package/lib/properties/fontFamily.js +10 -0
- package/lib/properties/margin.js +1 -1
- package/lib/properties/marginBottom.js +1 -1
- package/lib/properties/marginLeft.js +1 -1
- package/lib/properties/marginRight.js +1 -1
- package/lib/properties/marginTop.js +1 -1
- package/lib/shorthandProperties.js +21 -0
- package/lib/utils/camelize.js +3 -1
- package/lib/utils/strings.js +167 -0
- package/package.json +2 -2
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// autogenerated - 2025-
|
|
2
|
+
// autogenerated - 2025-07-14
|
|
3
3
|
// https://www.w3.org/Style/CSS/all-properties.en.html
|
|
4
4
|
|
|
5
5
|
var external_dependency_parsers_0 = require("../parsers.js");
|
|
6
|
+
var external_dependency_strings_1 = require("../utils/strings.js");
|
|
6
7
|
var backgroundImage_export_parse, backgroundImage_export_isValid, backgroundImage_export_definition;
|
|
7
8
|
backgroundImage_export_parse = function parse(v) {
|
|
8
|
-
|
|
9
|
+
if (v === "") {
|
|
10
|
+
return v;
|
|
11
|
+
}
|
|
12
|
+
const values = external_dependency_parsers_0.splitValue(v, {
|
|
13
|
+
delimiter: ","
|
|
14
|
+
});
|
|
15
|
+
const parsedValues = [];
|
|
16
|
+
for (const value of values) {
|
|
17
|
+
const parsedValue = external_dependency_parsers_0.parseImage(value);
|
|
18
|
+
if (parsedValue) {
|
|
19
|
+
parsedValues.push(parsedValue);
|
|
20
|
+
} else {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (parsedValues.length) {
|
|
25
|
+
return parsedValues.join(", ");
|
|
26
|
+
}
|
|
9
27
|
};
|
|
10
28
|
backgroundImage_export_isValid = function isValid(v) {
|
|
11
|
-
if (v === ""
|
|
29
|
+
if (v === "") {
|
|
12
30
|
return true;
|
|
13
31
|
}
|
|
14
32
|
return typeof backgroundImage_export_parse(v) === "string";
|
|
@@ -31,27 +49,155 @@ backgroundImage_export_definition = {
|
|
|
31
49
|
};
|
|
32
50
|
var backgroundPosition_export_parse, backgroundPosition_export_isValid, backgroundPosition_export_definition;
|
|
33
51
|
backgroundPosition_export_parse = function parse(v) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return;
|
|
52
|
+
if (v === "") {
|
|
53
|
+
return v;
|
|
37
54
|
}
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
const values = external_dependency_parsers_0.splitValue(v, {
|
|
56
|
+
delimiter: ","
|
|
57
|
+
});
|
|
58
|
+
const keyX = ["left", "right"];
|
|
59
|
+
const keyY = ["top", "bottom"];
|
|
60
|
+
const keywordsX = ["center", ...keyX];
|
|
61
|
+
const keywordsY = ["center", ...keyY];
|
|
62
|
+
const keywords = ["center", ...keyX, ...keyY];
|
|
63
|
+
const parsedValues = [];
|
|
64
|
+
for (const value of values) {
|
|
65
|
+
const parts = external_dependency_parsers_0.splitValue(value);
|
|
66
|
+
if (!parts.length || parts.length > 4) {
|
|
67
|
+
return;
|
|
44
68
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
69
|
+
let parsedValue = "";
|
|
70
|
+
switch (parts.length) {
|
|
71
|
+
case 1:
|
|
72
|
+
{
|
|
73
|
+
const [part] = parts;
|
|
74
|
+
const val = external_dependency_parsers_0.parseMeasurement(part) || external_dependency_parsers_0.parseKeyword(part, keywords);
|
|
75
|
+
if (val) {
|
|
76
|
+
if (val === "center") {
|
|
77
|
+
parsedValue = `${val} ${val}`;
|
|
78
|
+
} else if (val === "top" || val === "bottom") {
|
|
79
|
+
parsedValue = `center ${val}`;
|
|
80
|
+
} else {
|
|
81
|
+
parsedValue = `${val} center`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case 2:
|
|
87
|
+
{
|
|
88
|
+
const [part1, part2] = parts;
|
|
89
|
+
const val1 = external_dependency_parsers_0.parseMeasurement(part1) || external_dependency_parsers_0.parseKeyword(part1, keywords);
|
|
90
|
+
const val2 = external_dependency_parsers_0.parseMeasurement(part2) || external_dependency_parsers_0.parseKeyword(part2, keywords);
|
|
91
|
+
if (val1 && val2) {
|
|
92
|
+
if (keywordsY.includes(val1) && keywordsX.includes(val2)) {
|
|
93
|
+
parsedValue = `${val2} ${val1}`;
|
|
94
|
+
} else if (keywordsX.includes(val1)) {
|
|
95
|
+
if (val2 === "center" || !keywordsX.includes(val2)) {
|
|
96
|
+
parsedValue = `${val1} ${val2}`;
|
|
97
|
+
}
|
|
98
|
+
} else if (keywordsY.includes(val2)) {
|
|
99
|
+
if (!keywordsY.includes(val1)) {
|
|
100
|
+
parsedValue = `${val1} ${val2}`;
|
|
101
|
+
}
|
|
102
|
+
} else if (!keywordsY.includes(val1) && !keywordsX.includes(val2)) {
|
|
103
|
+
parsedValue = `${val1} ${val2}`;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
case 3:
|
|
109
|
+
{
|
|
110
|
+
const [part1, part2, part3] = parts;
|
|
111
|
+
const val1 = external_dependency_parsers_0.parseKeyword(part1, keywords);
|
|
112
|
+
const val2 = external_dependency_parsers_0.parseMeasurement(part2) || external_dependency_parsers_0.parseKeyword(part2, keywords);
|
|
113
|
+
const val3 = external_dependency_parsers_0.parseMeasurement(part3) || external_dependency_parsers_0.parseKeyword(part3, keywords);
|
|
114
|
+
if (val1 && val2 && val3) {
|
|
115
|
+
let posX = "";
|
|
116
|
+
let offX = "";
|
|
117
|
+
let posY = "";
|
|
118
|
+
let offY = "";
|
|
119
|
+
if (keywordsX.includes(val1)) {
|
|
120
|
+
if (keyY.includes(val2)) {
|
|
121
|
+
if (!keywords.includes(val3)) {
|
|
122
|
+
posX = val1;
|
|
123
|
+
posY = val2;
|
|
124
|
+
offY = val3;
|
|
125
|
+
}
|
|
126
|
+
} else if (keyY.includes(val3)) {
|
|
127
|
+
if (!keywords.includes(val2)) {
|
|
128
|
+
posX = val1;
|
|
129
|
+
offX = val2;
|
|
130
|
+
posY = val3;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
} else if (keywordsY.includes(val1)) {
|
|
134
|
+
if (keyX.includes(val2)) {
|
|
135
|
+
if (!keywords.includes(val3)) {
|
|
136
|
+
posX = val2;
|
|
137
|
+
offX = val3;
|
|
138
|
+
posY = val1;
|
|
139
|
+
}
|
|
140
|
+
} else if (keyX.includes(val3)) {
|
|
141
|
+
if (!keywords.includes(val2)) {
|
|
142
|
+
posX = val3;
|
|
143
|
+
posY = val1;
|
|
144
|
+
offY = val2;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (posX && posY) {
|
|
149
|
+
if (offX) {
|
|
150
|
+
parsedValue = `${posX} ${offX} ${posY}`;
|
|
151
|
+
} else if (offY) {
|
|
152
|
+
parsedValue = `${posX} ${posY} ${offY}`;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
case 4:
|
|
159
|
+
default:
|
|
160
|
+
{
|
|
161
|
+
const [part1, part2, part3, part4] = parts;
|
|
162
|
+
const val1 = external_dependency_parsers_0.parseKeyword(part1, keywords);
|
|
163
|
+
const val2 = external_dependency_parsers_0.parseMeasurement(part2);
|
|
164
|
+
const val3 = external_dependency_parsers_0.parseKeyword(part3, keywords);
|
|
165
|
+
const val4 = external_dependency_parsers_0.parseMeasurement(part4);
|
|
166
|
+
if (val1 && val2 && val3 && val4) {
|
|
167
|
+
let posX = "";
|
|
168
|
+
let offX = "";
|
|
169
|
+
let posY = "";
|
|
170
|
+
let offY = "";
|
|
171
|
+
if (keywordsX.includes(val1) && keyY.includes(val3)) {
|
|
172
|
+
posX = val1;
|
|
173
|
+
offX = val2;
|
|
174
|
+
posY = val3;
|
|
175
|
+
offY = val4;
|
|
176
|
+
} else if (keyX.includes(val1) && keywordsY.includes(val3)) {
|
|
177
|
+
posX = val1;
|
|
178
|
+
offX = val2;
|
|
179
|
+
posY = val3;
|
|
180
|
+
offY = val4;
|
|
181
|
+
} else if (keyY.includes(val1) && keywordsX.includes(val3)) {
|
|
182
|
+
posX = val3;
|
|
183
|
+
offX = val4;
|
|
184
|
+
posY = val1;
|
|
185
|
+
offY = val2;
|
|
186
|
+
}
|
|
187
|
+
if (posX && offX && posY && offY) {
|
|
188
|
+
parsedValue = `${posX} ${offX} ${posY} ${offY}`;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
54
192
|
}
|
|
193
|
+
if (parsedValue) {
|
|
194
|
+
parsedValues.push(parsedValue);
|
|
195
|
+
} else {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (parsedValues.length) {
|
|
200
|
+
return parsedValues.join(", ");
|
|
55
201
|
}
|
|
56
202
|
};
|
|
57
203
|
backgroundPosition_export_isValid = function isValid(v) {
|
|
@@ -76,10 +222,137 @@ backgroundPosition_export_definition = {
|
|
|
76
222
|
enumerable: true,
|
|
77
223
|
configurable: true
|
|
78
224
|
};
|
|
225
|
+
var backgroundSize_export_parse, backgroundSize_export_isValid, backgroundSize_export_definition;
|
|
226
|
+
backgroundSize_export_parse = function parse(v) {
|
|
227
|
+
if (v === "") {
|
|
228
|
+
return v;
|
|
229
|
+
}
|
|
230
|
+
const values = external_dependency_parsers_0.splitValue(v, {
|
|
231
|
+
delimiter: ","
|
|
232
|
+
});
|
|
233
|
+
const keywordsRatio = ["contain", "cover"];
|
|
234
|
+
const keywordsRepeat = ["auto"];
|
|
235
|
+
const keywords = [...keywordsRatio, ...keywordsRepeat];
|
|
236
|
+
const parsedValues = [];
|
|
237
|
+
for (const value of values) {
|
|
238
|
+
const parts = external_dependency_parsers_0.splitValue(value);
|
|
239
|
+
if (!parts.length || parts.length > 2) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
let parsedValue = "";
|
|
243
|
+
switch (parts.length) {
|
|
244
|
+
case 1:
|
|
245
|
+
{
|
|
246
|
+
const [part] = parts;
|
|
247
|
+
const val = external_dependency_parsers_0.parseMeasurement(part, true) || external_dependency_parsers_0.parseKeyword(part, keywords);
|
|
248
|
+
if (val) {
|
|
249
|
+
parsedValue = val;
|
|
250
|
+
}
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
case 2:
|
|
254
|
+
default:
|
|
255
|
+
{
|
|
256
|
+
const [part1, part2] = parts;
|
|
257
|
+
const val1 = external_dependency_parsers_0.parseMeasurement(part1, true) || external_dependency_parsers_0.parseKeyword(part1, keywordsRepeat);
|
|
258
|
+
const val2 = external_dependency_parsers_0.parseMeasurement(part2, true) || external_dependency_parsers_0.parseKeyword(part2, keywordsRepeat);
|
|
259
|
+
if (val1 && val2) {
|
|
260
|
+
if (val2 === "auto") {
|
|
261
|
+
parsedValue = val1;
|
|
262
|
+
} else {
|
|
263
|
+
parsedValue = `${val1} ${val2}`;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (parsedValue) {
|
|
269
|
+
parsedValues.push(parsedValue);
|
|
270
|
+
} else {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (parsedValues.length) {
|
|
275
|
+
return parsedValues.join(", ");
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
backgroundSize_export_isValid = function isValid(v) {
|
|
279
|
+
if (v === "") {
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
return typeof backgroundSize_export_parse(v) === "string";
|
|
283
|
+
};
|
|
284
|
+
backgroundSize_export_definition = {
|
|
285
|
+
set(v) {
|
|
286
|
+
v = external_dependency_parsers_0.prepareValue(v, this._global);
|
|
287
|
+
if (external_dependency_parsers_0.hasVarFunc(v)) {
|
|
288
|
+
this._setProperty("background", "");
|
|
289
|
+
this._setProperty("background-size", v);
|
|
290
|
+
} else {
|
|
291
|
+
this._setProperty("background-size", backgroundSize_export_parse(v));
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
get() {
|
|
295
|
+
return this.getPropertyValue("background-size");
|
|
296
|
+
},
|
|
297
|
+
enumerable: true,
|
|
298
|
+
configurable: true
|
|
299
|
+
};
|
|
79
300
|
var backgroundRepeat_export_parse, backgroundRepeat_export_isValid, backgroundRepeat_export_definition;
|
|
80
301
|
backgroundRepeat_export_parse = function parse(v) {
|
|
81
|
-
|
|
82
|
-
|
|
302
|
+
if (v === "") {
|
|
303
|
+
return v;
|
|
304
|
+
}
|
|
305
|
+
const values = external_dependency_parsers_0.splitValue(v, {
|
|
306
|
+
delimiter: ","
|
|
307
|
+
});
|
|
308
|
+
const keywordsAxis = ["repeat-x", "repeat-y"];
|
|
309
|
+
const keywordsRepeat = ["repeat", "no-repeat", "space", "round"];
|
|
310
|
+
const keywords = [...keywordsAxis, ...keywordsRepeat];
|
|
311
|
+
const parsedValues = [];
|
|
312
|
+
for (const value of values) {
|
|
313
|
+
const parts = external_dependency_parsers_0.splitValue(value);
|
|
314
|
+
if (!parts.length || parts.length > 2) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
let parsedValue = "";
|
|
318
|
+
switch (parts.length) {
|
|
319
|
+
case 1:
|
|
320
|
+
{
|
|
321
|
+
const [part] = parts;
|
|
322
|
+
const val = external_dependency_parsers_0.parseKeyword(part, keywords);
|
|
323
|
+
if (val) {
|
|
324
|
+
parsedValue = val;
|
|
325
|
+
}
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
case 2:
|
|
329
|
+
default:
|
|
330
|
+
{
|
|
331
|
+
const [part1, part2] = parts;
|
|
332
|
+
const val1 = external_dependency_parsers_0.parseKeyword(part1, keywordsRepeat);
|
|
333
|
+
const val2 = external_dependency_parsers_0.parseKeyword(part2, keywordsRepeat);
|
|
334
|
+
if (val1 && val2) {
|
|
335
|
+
if (val1 === "repeat" && val2 === "no-repeat") {
|
|
336
|
+
parsedValue = "repeat-x";
|
|
337
|
+
} else if (val1 === "no-repeat" && val2 === "repeat") {
|
|
338
|
+
parsedValue = "repeat-y";
|
|
339
|
+
} else if (val1 === val2) {
|
|
340
|
+
parsedValue = val1;
|
|
341
|
+
} else {
|
|
342
|
+
parsedValue = `${val1} ${val2}`;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
if (parsedValue) {
|
|
348
|
+
parsedValues.push(parsedValue);
|
|
349
|
+
} else {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (parsedValues.length) {
|
|
354
|
+
return parsedValues.join(", ");
|
|
355
|
+
}
|
|
83
356
|
};
|
|
84
357
|
backgroundRepeat_export_isValid = function isValid(v) {
|
|
85
358
|
if (v === "") {
|
|
@@ -103,10 +376,115 @@ backgroundRepeat_export_definition = {
|
|
|
103
376
|
enumerable: true,
|
|
104
377
|
configurable: true
|
|
105
378
|
};
|
|
379
|
+
var backgroundOrigin_export_parse, backgroundOrigin_export_isValid, backgroundOrigin_export_definition;
|
|
380
|
+
backgroundOrigin_export_parse = function parse(v) {
|
|
381
|
+
if (v === "") {
|
|
382
|
+
return v;
|
|
383
|
+
}
|
|
384
|
+
const values = external_dependency_parsers_0.splitValue(v, {
|
|
385
|
+
delimiter: ","
|
|
386
|
+
});
|
|
387
|
+
const keywords = ["border-box", "padding-box", "content-box"];
|
|
388
|
+
const parsedValues = [];
|
|
389
|
+
for (const value of values) {
|
|
390
|
+
const parsedValue = external_dependency_parsers_0.parseKeyword(value, keywords);
|
|
391
|
+
if (parsedValue) {
|
|
392
|
+
parsedValues.push(parsedValue);
|
|
393
|
+
} else {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
if (parsedValues.length) {
|
|
398
|
+
return parsedValues.join(", ");
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
backgroundOrigin_export_isValid = function isValid(v) {
|
|
402
|
+
if (v === "") {
|
|
403
|
+
return true;
|
|
404
|
+
}
|
|
405
|
+
return typeof backgroundOrigin_export_parse(v) === "string";
|
|
406
|
+
};
|
|
407
|
+
backgroundOrigin_export_definition = {
|
|
408
|
+
set(v) {
|
|
409
|
+
v = external_dependency_parsers_0.prepareValue(v, this._global);
|
|
410
|
+
if (external_dependency_parsers_0.hasVarFunc(v)) {
|
|
411
|
+
this._setProperty("background", "");
|
|
412
|
+
this._setProperty("background-origin", v);
|
|
413
|
+
} else {
|
|
414
|
+
this._setProperty("background-origin", backgroundOrigin_export_parse(v));
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
get() {
|
|
418
|
+
return this.getPropertyValue("background-origin");
|
|
419
|
+
},
|
|
420
|
+
enumerable: true,
|
|
421
|
+
configurable: true
|
|
422
|
+
};
|
|
423
|
+
var backgroundClip_export_parse, backgroundClip_export_isValid, backgroundClip_export_definition;
|
|
424
|
+
backgroundClip_export_parse = function parse(v) {
|
|
425
|
+
if (v === "") {
|
|
426
|
+
return v;
|
|
427
|
+
}
|
|
428
|
+
const values = external_dependency_parsers_0.splitValue(v, {
|
|
429
|
+
delimiter: ","
|
|
430
|
+
});
|
|
431
|
+
const keywords = ["border-box", "padding-box", "content-box"];
|
|
432
|
+
const parsedValues = [];
|
|
433
|
+
for (const value of values) {
|
|
434
|
+
const parsedValue = external_dependency_parsers_0.parseKeyword(value, keywords);
|
|
435
|
+
if (parsedValue) {
|
|
436
|
+
parsedValues.push(parsedValue);
|
|
437
|
+
} else {
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (parsedValues.length) {
|
|
442
|
+
return parsedValues.join(", ");
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
backgroundClip_export_isValid = function isValid(v) {
|
|
446
|
+
if (v === "") {
|
|
447
|
+
return true;
|
|
448
|
+
}
|
|
449
|
+
return typeof backgroundClip_export_parse(v) === "string";
|
|
450
|
+
};
|
|
451
|
+
backgroundClip_export_definition = {
|
|
452
|
+
set(v) {
|
|
453
|
+
v = external_dependency_parsers_0.prepareValue(v, this._global);
|
|
454
|
+
if (external_dependency_parsers_0.hasVarFunc(v)) {
|
|
455
|
+
this._setProperty("background", "");
|
|
456
|
+
this._setProperty("background-clip", v);
|
|
457
|
+
} else {
|
|
458
|
+
this._setProperty("background-clip", backgroundClip_export_parse(v));
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
get() {
|
|
462
|
+
return this.getPropertyValue("background-clip");
|
|
463
|
+
},
|
|
464
|
+
enumerable: true,
|
|
465
|
+
configurable: true
|
|
466
|
+
};
|
|
106
467
|
var backgroundAttachment_export_parse, backgroundAttachment_export_isValid, backgroundAttachment_export_definition;
|
|
107
468
|
backgroundAttachment_export_parse = function parse(v) {
|
|
469
|
+
if (v === "") {
|
|
470
|
+
return v;
|
|
471
|
+
}
|
|
472
|
+
const values = external_dependency_parsers_0.splitValue(v, {
|
|
473
|
+
delimiter: ","
|
|
474
|
+
});
|
|
108
475
|
const keywords = ["fixed", "scroll", "local"];
|
|
109
|
-
|
|
476
|
+
const parsedValues = [];
|
|
477
|
+
for (const value of values) {
|
|
478
|
+
const parsedValue = external_dependency_parsers_0.parseKeyword(value, keywords);
|
|
479
|
+
if (parsedValue) {
|
|
480
|
+
parsedValues.push(parsedValue);
|
|
481
|
+
} else {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
if (parsedValues.length) {
|
|
486
|
+
return parsedValues.join(", ");
|
|
487
|
+
}
|
|
110
488
|
};
|
|
111
489
|
backgroundAttachment_export_isValid = function isValid(v) {
|
|
112
490
|
if (v === "") {
|
|
@@ -160,12 +538,8 @@ backgroundColor_export_definition = {
|
|
|
160
538
|
enumerable: true,
|
|
161
539
|
configurable: true
|
|
162
540
|
};
|
|
163
|
-
var background_export_definition;
|
|
164
|
-
|
|
165
|
-
// * support multiple backgrounds
|
|
166
|
-
// * also fix longhands
|
|
167
|
-
|
|
168
|
-
const background_local_var_shorthandFor = new Map([["background-image", {
|
|
541
|
+
var background_export_shorthandFor, background_export_parse, background_export_definition;
|
|
542
|
+
background_export_shorthandFor = new Map([["background-image", {
|
|
169
543
|
parse: backgroundImage_export_parse,
|
|
170
544
|
isValid: backgroundImage_export_isValid,
|
|
171
545
|
definition: backgroundImage_export_definition
|
|
@@ -173,10 +547,22 @@ const background_local_var_shorthandFor = new Map([["background-image", {
|
|
|
173
547
|
parse: backgroundPosition_export_parse,
|
|
174
548
|
isValid: backgroundPosition_export_isValid,
|
|
175
549
|
definition: backgroundPosition_export_definition
|
|
550
|
+
}], ["background-size", {
|
|
551
|
+
parse: backgroundSize_export_parse,
|
|
552
|
+
isValid: backgroundSize_export_isValid,
|
|
553
|
+
definition: backgroundSize_export_definition
|
|
176
554
|
}], ["background-repeat", {
|
|
177
555
|
parse: backgroundRepeat_export_parse,
|
|
178
556
|
isValid: backgroundRepeat_export_isValid,
|
|
179
557
|
definition: backgroundRepeat_export_definition
|
|
558
|
+
}], ["background-origin", {
|
|
559
|
+
parse: backgroundOrigin_export_parse,
|
|
560
|
+
isValid: backgroundOrigin_export_isValid,
|
|
561
|
+
definition: backgroundOrigin_export_definition
|
|
562
|
+
}], ["background-clip", {
|
|
563
|
+
parse: backgroundClip_export_parse,
|
|
564
|
+
isValid: backgroundClip_export_isValid,
|
|
565
|
+
definition: backgroundClip_export_definition
|
|
180
566
|
}], ["background-attachment", {
|
|
181
567
|
parse: backgroundAttachment_export_parse,
|
|
182
568
|
isValid: backgroundAttachment_export_isValid,
|
|
@@ -186,28 +572,359 @@ const background_local_var_shorthandFor = new Map([["background-image", {
|
|
|
186
572
|
isValid: backgroundColor_export_isValid,
|
|
187
573
|
definition: backgroundColor_export_definition
|
|
188
574
|
}]]);
|
|
575
|
+
const background_local_var_initialValues = new Map([["background-image", "none"], ["background-position", "0% 0%"], ["background-size", "auto"], ["background-repeat", "repeat"], ["background-origin", "padding-box"], ["background-clip", "border-box"], ["background-attachment", "scroll"], ["background-color", "transparent"]]);
|
|
576
|
+
background_export_parse = function parse(v) {
|
|
577
|
+
const values = external_dependency_parsers_0.splitValue(v, {
|
|
578
|
+
delimiter: ","
|
|
579
|
+
});
|
|
580
|
+
const bgValues = [];
|
|
581
|
+
const l = values.length;
|
|
582
|
+
for (let i = 0; i < l; i++) {
|
|
583
|
+
let bg = {
|
|
584
|
+
"background-image": background_local_var_initialValues.get("background-image"),
|
|
585
|
+
"background-position": background_local_var_initialValues.get("background-position"),
|
|
586
|
+
"background-size": background_local_var_initialValues.get("background-size"),
|
|
587
|
+
"background-repeat": background_local_var_initialValues.get("background-repeat"),
|
|
588
|
+
"background-origin": background_local_var_initialValues.get("background-origin"),
|
|
589
|
+
"background-clip": background_local_var_initialValues.get("background-clip"),
|
|
590
|
+
"background-attachment": background_local_var_initialValues.get("background-attachment"),
|
|
591
|
+
"background-color": background_local_var_initialValues.get("background-color")
|
|
592
|
+
};
|
|
593
|
+
if (l > 1 && i !== l - 1) {
|
|
594
|
+
bg = {
|
|
595
|
+
"background-image": background_local_var_initialValues.get("background-image"),
|
|
596
|
+
"background-position": background_local_var_initialValues.get("background-position"),
|
|
597
|
+
"background-size": background_local_var_initialValues.get("background-size"),
|
|
598
|
+
"background-repeat": background_local_var_initialValues.get("background-repeat"),
|
|
599
|
+
"background-origin": background_local_var_initialValues.get("background-origin"),
|
|
600
|
+
"background-clip": background_local_var_initialValues.get("background-clip"),
|
|
601
|
+
"background-attachment": background_local_var_initialValues.get("background-attachment")
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
const bgPosition = [];
|
|
605
|
+
const bgSize = [];
|
|
606
|
+
const bgRepeat = [];
|
|
607
|
+
const bgBox = [];
|
|
608
|
+
const bgParts = external_dependency_parsers_0.splitValue(values[i], {
|
|
609
|
+
delimiter: "/"
|
|
610
|
+
});
|
|
611
|
+
if (!bgParts.length || bgParts.length > 2) {
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
const [bgPart1, bgPart2 = ""] = bgParts;
|
|
615
|
+
const parts1 = external_dependency_parsers_0.splitValue(bgPart1);
|
|
616
|
+
for (const part of parts1) {
|
|
617
|
+
let partValid = false;
|
|
618
|
+
for (const [property, value] of background_export_shorthandFor) {
|
|
619
|
+
if (value.isValid(part)) {
|
|
620
|
+
partValid = true;
|
|
621
|
+
switch (property) {
|
|
622
|
+
case "background-clip":
|
|
623
|
+
case "background-origin":
|
|
624
|
+
{
|
|
625
|
+
const parsedValue = value.parse(part);
|
|
626
|
+
if (parsedValue) {
|
|
627
|
+
bgBox.push(parsedValue);
|
|
628
|
+
}
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
case "background-color":
|
|
632
|
+
{
|
|
633
|
+
if (i !== values.length - 1) {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
const parsedValue = value.parse(part);
|
|
637
|
+
if (parsedValue) {
|
|
638
|
+
bg[property] = parsedValue;
|
|
639
|
+
}
|
|
640
|
+
break;
|
|
641
|
+
}
|
|
642
|
+
case "background-position":
|
|
643
|
+
{
|
|
644
|
+
const parsedValue = value.parse(part);
|
|
645
|
+
if (parsedValue) {
|
|
646
|
+
bgPosition.push(parsedValue);
|
|
647
|
+
}
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
650
|
+
case "background-repeat":
|
|
651
|
+
{
|
|
652
|
+
const parsedValue = value.parse(part);
|
|
653
|
+
if (parsedValue) {
|
|
654
|
+
bgRepeat.push(parsedValue);
|
|
655
|
+
}
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
case "background-size":
|
|
659
|
+
{
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
default:
|
|
663
|
+
{
|
|
664
|
+
const parsedValue = value.parse(part);
|
|
665
|
+
if (parsedValue) {
|
|
666
|
+
bg[property] = parsedValue;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
if (!partValid) {
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
if (bgPart2) {
|
|
677
|
+
const parts2 = external_dependency_parsers_0.splitValue(bgPart2);
|
|
678
|
+
for (const part of parts2) {
|
|
679
|
+
let partValid = false;
|
|
680
|
+
for (const [property, value] of background_export_shorthandFor) {
|
|
681
|
+
if (value.isValid(part)) {
|
|
682
|
+
partValid = true;
|
|
683
|
+
switch (property) {
|
|
684
|
+
case "background-clip":
|
|
685
|
+
case "background-origin":
|
|
686
|
+
{
|
|
687
|
+
const parsedValue = value.parse(part);
|
|
688
|
+
if (parsedValue) {
|
|
689
|
+
bgBox.push(parsedValue);
|
|
690
|
+
}
|
|
691
|
+
break;
|
|
692
|
+
}
|
|
693
|
+
case "background-color":
|
|
694
|
+
{
|
|
695
|
+
if (i !== l - 1) {
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
const parsedValue = value.parse(part);
|
|
699
|
+
if (parsedValue) {
|
|
700
|
+
bg[property] = parsedValue;
|
|
701
|
+
}
|
|
702
|
+
break;
|
|
703
|
+
}
|
|
704
|
+
case "background-position":
|
|
705
|
+
{
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
case "background-repeat":
|
|
709
|
+
{
|
|
710
|
+
const parsedValue = value.parse(part);
|
|
711
|
+
if (parsedValue) {
|
|
712
|
+
bgRepeat.push(parsedValue);
|
|
713
|
+
}
|
|
714
|
+
break;
|
|
715
|
+
}
|
|
716
|
+
case "background-size":
|
|
717
|
+
{
|
|
718
|
+
const parsedValue = value.parse(part);
|
|
719
|
+
if (parsedValue) {
|
|
720
|
+
bgSize.push(parsedValue);
|
|
721
|
+
}
|
|
722
|
+
break;
|
|
723
|
+
}
|
|
724
|
+
default:
|
|
725
|
+
{
|
|
726
|
+
const parsedValue = value.parse(part);
|
|
727
|
+
if (parsedValue) {
|
|
728
|
+
bg[property] = parsedValue;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
if (!partValid) {
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
if (bgPosition.length) {
|
|
740
|
+
const {
|
|
741
|
+
parse: parser
|
|
742
|
+
} = background_export_shorthandFor.get("background-position");
|
|
743
|
+
const value = parser(bgPosition.join(" "));
|
|
744
|
+
if (value) {
|
|
745
|
+
bg["background-position"] = value;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
if (bgSize.length) {
|
|
749
|
+
const {
|
|
750
|
+
parse: parser
|
|
751
|
+
} = background_export_shorthandFor.get("background-size");
|
|
752
|
+
const value = parser(bgSize.join(" "));
|
|
753
|
+
if (value) {
|
|
754
|
+
bg["background-size"] = value;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
if (bgRepeat.length) {
|
|
758
|
+
const {
|
|
759
|
+
parse: parser
|
|
760
|
+
} = background_export_shorthandFor.get("background-repeat");
|
|
761
|
+
const value = parser(bgRepeat.join(" "));
|
|
762
|
+
if (value) {
|
|
763
|
+
bg["background-repeat"] = value;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
if (bgBox.length) {
|
|
767
|
+
switch (bgBox.length) {
|
|
768
|
+
case 1:
|
|
769
|
+
{
|
|
770
|
+
const [value] = bgBox;
|
|
771
|
+
bg["background-origin"] = value;
|
|
772
|
+
bg["background-clip"] = value;
|
|
773
|
+
break;
|
|
774
|
+
}
|
|
775
|
+
case 2:
|
|
776
|
+
{
|
|
777
|
+
const [value1, value2] = bgBox;
|
|
778
|
+
bg["background-origin"] = value1;
|
|
779
|
+
bg["background-clip"] = value2;
|
|
780
|
+
break;
|
|
781
|
+
}
|
|
782
|
+
default:
|
|
783
|
+
{
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
bgValues.push(bg);
|
|
789
|
+
}
|
|
790
|
+
return bgValues;
|
|
791
|
+
};
|
|
189
792
|
background_export_definition = {
|
|
190
793
|
set(v) {
|
|
191
794
|
v = external_dependency_parsers_0.prepareValue(v, this._global);
|
|
192
|
-
if (v
|
|
193
|
-
for (const [key] of
|
|
795
|
+
if (v === "" || external_dependency_parsers_0.hasVarFunc(v)) {
|
|
796
|
+
for (const [key] of background_export_shorthandFor) {
|
|
194
797
|
this._setProperty(key, "");
|
|
195
798
|
}
|
|
196
799
|
this._setProperty("background", v);
|
|
197
800
|
} else {
|
|
198
|
-
|
|
801
|
+
const bgValues = background_export_parse(v);
|
|
802
|
+
if (!Array.isArray(bgValues)) {
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
const bgMap = new Map([["background-image", []], ["background-position", []], ["background-size", []], ["background-repeat", []], ["background-origin", []], ["background-clip", []], ["background-attachment", []], ["background-color", []]]);
|
|
806
|
+
const backgrounds = [];
|
|
807
|
+
for (const bgValue of bgValues) {
|
|
808
|
+
const bg = [];
|
|
809
|
+
for (const [property, value] of Object.entries(bgValue)) {
|
|
810
|
+
if (value) {
|
|
811
|
+
const arr = bgMap.get(property);
|
|
812
|
+
arr.push(value);
|
|
813
|
+
bgMap.set(property, arr);
|
|
814
|
+
if (value !== background_local_var_initialValues.get(property)) {
|
|
815
|
+
if (property === "background-size") {
|
|
816
|
+
bg.push(`/ ${value}`);
|
|
817
|
+
} else {
|
|
818
|
+
bg.push(value);
|
|
819
|
+
}
|
|
820
|
+
} else if (property === "background-image") {
|
|
821
|
+
if (v === "none") {
|
|
822
|
+
bg.push(value);
|
|
823
|
+
}
|
|
824
|
+
} else if (property === "background-color") {
|
|
825
|
+
if (v === "transparent") {
|
|
826
|
+
bg.push(value);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
backgrounds.push(bg.join(" "));
|
|
832
|
+
}
|
|
833
|
+
for (const [property, value] of bgMap) {
|
|
834
|
+
this._setProperty(property, value.join(", "));
|
|
835
|
+
}
|
|
836
|
+
this._setProperty("background", backgrounds.join(", "));
|
|
199
837
|
}
|
|
200
838
|
},
|
|
201
839
|
get() {
|
|
202
|
-
|
|
203
|
-
if (external_dependency_parsers_0.hasVarFunc(
|
|
204
|
-
return
|
|
840
|
+
const v = this.getPropertyValue("background");
|
|
841
|
+
if (external_dependency_parsers_0.hasVarFunc(v)) {
|
|
842
|
+
return v;
|
|
843
|
+
}
|
|
844
|
+
const bgMap = new Map();
|
|
845
|
+
let l = 0;
|
|
846
|
+
for (const [property] of background_export_shorthandFor) {
|
|
847
|
+
const val = this.getPropertyValue(property);
|
|
848
|
+
if (property === "background-image") {
|
|
849
|
+
if (val === "none" && v === "none" && this.getPropertyValue("background-color") === "transparent") {
|
|
850
|
+
return val;
|
|
851
|
+
}
|
|
852
|
+
if (val !== background_local_var_initialValues.get(property)) {
|
|
853
|
+
const imgValues = external_dependency_parsers_0.splitValue(val, {
|
|
854
|
+
delimiter: ","
|
|
855
|
+
});
|
|
856
|
+
l = imgValues.length;
|
|
857
|
+
bgMap.set(property, imgValues);
|
|
858
|
+
}
|
|
859
|
+
} else if (property === "background-color") {
|
|
860
|
+
if (val !== background_local_var_initialValues.get(property) || v.includes(val)) {
|
|
861
|
+
bgMap.set(property, [val]);
|
|
862
|
+
}
|
|
863
|
+
} else if (val !== background_local_var_initialValues.get(property)) {
|
|
864
|
+
bgMap.set(property, external_dependency_parsers_0.splitValue(val, {
|
|
865
|
+
delimiter: ","
|
|
866
|
+
}));
|
|
867
|
+
}
|
|
205
868
|
}
|
|
206
|
-
|
|
207
|
-
|
|
869
|
+
if (l === 0) {
|
|
870
|
+
const [background] = bgMap.get("background-color");
|
|
871
|
+
if (background) {
|
|
872
|
+
return background;
|
|
873
|
+
}
|
|
208
874
|
return "";
|
|
209
875
|
}
|
|
210
|
-
|
|
876
|
+
const bgValues = [];
|
|
877
|
+
for (let i = 0; i < l; i++) {
|
|
878
|
+
bgValues[i] = [];
|
|
879
|
+
}
|
|
880
|
+
for (const [property, values] of bgMap) {
|
|
881
|
+
for (let i = 0; i < l; i++) {
|
|
882
|
+
switch (property) {
|
|
883
|
+
case "background-color":
|
|
884
|
+
{
|
|
885
|
+
if (i === l - 1) {
|
|
886
|
+
const value = values[0];
|
|
887
|
+
if (external_dependency_parsers_0.hasVarFunc(value)) {
|
|
888
|
+
return "";
|
|
889
|
+
}
|
|
890
|
+
if (value && value !== background_local_var_initialValues.get(property)) {
|
|
891
|
+
const bgValue = bgValues[i];
|
|
892
|
+
bgValue.push(value);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
break;
|
|
896
|
+
}
|
|
897
|
+
case "background-size":
|
|
898
|
+
{
|
|
899
|
+
const value = values[i];
|
|
900
|
+
if (external_dependency_parsers_0.hasVarFunc(value)) {
|
|
901
|
+
return "";
|
|
902
|
+
}
|
|
903
|
+
if (value && value !== background_local_var_initialValues.get(property)) {
|
|
904
|
+
const bgValue = bgValues[i];
|
|
905
|
+
bgValue.push(`/ ${value}`);
|
|
906
|
+
}
|
|
907
|
+
break;
|
|
908
|
+
}
|
|
909
|
+
default:
|
|
910
|
+
{
|
|
911
|
+
const value = values[i];
|
|
912
|
+
if (external_dependency_parsers_0.hasVarFunc(value)) {
|
|
913
|
+
return "";
|
|
914
|
+
}
|
|
915
|
+
if (value && value !== background_local_var_initialValues.get(property)) {
|
|
916
|
+
const bgValue = bgValues[i];
|
|
917
|
+
bgValue.push(value);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
const backgrounds = [];
|
|
924
|
+
for (const bgValue of bgValues) {
|
|
925
|
+
backgrounds.push(bgValue.join(" "));
|
|
926
|
+
}
|
|
927
|
+
return backgrounds.join(", ");
|
|
211
928
|
},
|
|
212
929
|
enumerable: true,
|
|
213
930
|
configurable: true
|
|
@@ -258,7 +975,7 @@ borderStyle_export_isValid = function isValid(v) {
|
|
|
258
975
|
borderStyle_export_definition = {
|
|
259
976
|
set(v) {
|
|
260
977
|
v = external_dependency_parsers_0.prepareValue(v, this._global);
|
|
261
|
-
if (
|
|
978
|
+
if (/^none$/i.test(v)) {
|
|
262
979
|
v = "";
|
|
263
980
|
}
|
|
264
981
|
if (external_dependency_parsers_0.hasVarFunc(v)) {
|
|
@@ -306,8 +1023,8 @@ borderColor_export_definition = {
|
|
|
306
1023
|
enumerable: true,
|
|
307
1024
|
configurable: true
|
|
308
1025
|
};
|
|
309
|
-
var border_export_definition;
|
|
310
|
-
|
|
1026
|
+
var border_export_shorthandFor, border_export_definition;
|
|
1027
|
+
border_export_shorthandFor = new Map([["border-width", {
|
|
311
1028
|
parse: borderWidth_export_parse,
|
|
312
1029
|
isValid: borderWidth_export_isValid,
|
|
313
1030
|
definition: borderWidth_export_definition
|
|
@@ -323,16 +1040,16 @@ const border_local_var_shorthandFor = new Map([["border-width", {
|
|
|
323
1040
|
border_export_definition = {
|
|
324
1041
|
set(v) {
|
|
325
1042
|
v = external_dependency_parsers_0.prepareValue(v, this._global);
|
|
326
|
-
if (
|
|
1043
|
+
if (/^none$/i.test(v)) {
|
|
327
1044
|
v = "";
|
|
328
1045
|
}
|
|
329
1046
|
if (external_dependency_parsers_0.hasVarFunc(v)) {
|
|
330
|
-
for (const [key] of
|
|
1047
|
+
for (const [key] of border_export_shorthandFor) {
|
|
331
1048
|
this._setProperty(key, "");
|
|
332
1049
|
}
|
|
333
1050
|
this._setProperty("border", v);
|
|
334
1051
|
} else {
|
|
335
|
-
this._midShorthandSetter("border", v,
|
|
1052
|
+
this._midShorthandSetter("border", v, border_export_shorthandFor, ["top", "right", "bottom", "left"]);
|
|
336
1053
|
}
|
|
337
1054
|
},
|
|
338
1055
|
get() {
|
|
@@ -340,7 +1057,7 @@ border_export_definition = {
|
|
|
340
1057
|
if (external_dependency_parsers_0.hasVarFunc(val)) {
|
|
341
1058
|
return val;
|
|
342
1059
|
}
|
|
343
|
-
val = this._shorthandGetter("border",
|
|
1060
|
+
val = this._shorthandGetter("border", border_export_shorthandFor);
|
|
344
1061
|
if (external_dependency_parsers_0.hasVarFunc(val)) {
|
|
345
1062
|
return "";
|
|
346
1063
|
}
|
|
@@ -444,8 +1161,8 @@ borderTopColor_export_definition = {
|
|
|
444
1161
|
enumerable: true,
|
|
445
1162
|
configurable: true
|
|
446
1163
|
};
|
|
447
|
-
var borderBottom_export_definition;
|
|
448
|
-
|
|
1164
|
+
var borderBottom_export_shorthandFor, borderBottom_export_definition;
|
|
1165
|
+
borderBottom_export_shorthandFor = new Map([["border-bottom-width", {
|
|
449
1166
|
parse: borderTopWidth_export_parse,
|
|
450
1167
|
isValid: borderTopWidth_export_isValid,
|
|
451
1168
|
definition: borderTopWidth_export_definition
|
|
@@ -462,13 +1179,13 @@ borderBottom_export_definition = {
|
|
|
462
1179
|
set(v) {
|
|
463
1180
|
v = external_dependency_parsers_0.prepareValue(v, this._global);
|
|
464
1181
|
if (external_dependency_parsers_0.hasVarFunc(v)) {
|
|
465
|
-
for (const [key] of
|
|
1182
|
+
for (const [key] of borderBottom_export_shorthandFor) {
|
|
466
1183
|
this._setProperty(key, "");
|
|
467
1184
|
}
|
|
468
1185
|
this._setProperty("border", "");
|
|
469
1186
|
this._setProperty("border-bottom", v);
|
|
470
1187
|
} else {
|
|
471
|
-
this._shorthandSetter("border-bottom", v,
|
|
1188
|
+
this._shorthandSetter("border-bottom", v, borderBottom_export_shorthandFor);
|
|
472
1189
|
}
|
|
473
1190
|
},
|
|
474
1191
|
get() {
|
|
@@ -476,7 +1193,7 @@ borderBottom_export_definition = {
|
|
|
476
1193
|
if (external_dependency_parsers_0.hasVarFunc(val)) {
|
|
477
1194
|
return val;
|
|
478
1195
|
}
|
|
479
|
-
val = this._shorthandGetter("border-bottom",
|
|
1196
|
+
val = this._shorthandGetter("border-bottom", borderBottom_export_shorthandFor);
|
|
480
1197
|
if (external_dependency_parsers_0.hasVarFunc(val)) {
|
|
481
1198
|
return "";
|
|
482
1199
|
}
|
|
@@ -601,8 +1318,8 @@ borderCollapse_export_definition = {
|
|
|
601
1318
|
enumerable: true,
|
|
602
1319
|
configurable: true
|
|
603
1320
|
};
|
|
604
|
-
var borderLeft_export_definition;
|
|
605
|
-
|
|
1321
|
+
var borderLeft_export_shorthandFor, borderLeft_export_definition;
|
|
1322
|
+
borderLeft_export_shorthandFor = new Map([["border-left-width", {
|
|
606
1323
|
parse: borderTopWidth_export_parse,
|
|
607
1324
|
isValid: borderTopWidth_export_isValid,
|
|
608
1325
|
definition: borderTopWidth_export_definition
|
|
@@ -619,13 +1336,13 @@ borderLeft_export_definition = {
|
|
|
619
1336
|
set(v) {
|
|
620
1337
|
v = external_dependency_parsers_0.prepareValue(v, this._global);
|
|
621
1338
|
if (external_dependency_parsers_0.hasVarFunc(v)) {
|
|
622
|
-
for (const [key] of
|
|
1339
|
+
for (const [key] of borderLeft_export_shorthandFor) {
|
|
623
1340
|
this._setProperty(key, "");
|
|
624
1341
|
}
|
|
625
1342
|
this._setProperty("border", "");
|
|
626
1343
|
this._setProperty("border-left", v);
|
|
627
1344
|
} else {
|
|
628
|
-
this._shorthandSetter("border-left", v,
|
|
1345
|
+
this._shorthandSetter("border-left", v, borderLeft_export_shorthandFor);
|
|
629
1346
|
}
|
|
630
1347
|
},
|
|
631
1348
|
get() {
|
|
@@ -633,7 +1350,7 @@ borderLeft_export_definition = {
|
|
|
633
1350
|
if (external_dependency_parsers_0.hasVarFunc(val)) {
|
|
634
1351
|
return val;
|
|
635
1352
|
}
|
|
636
|
-
val = this._shorthandGetter("border-left",
|
|
1353
|
+
val = this._shorthandGetter("border-left", borderLeft_export_shorthandFor);
|
|
637
1354
|
if (external_dependency_parsers_0.hasVarFunc(val)) {
|
|
638
1355
|
return "";
|
|
639
1356
|
}
|
|
@@ -737,8 +1454,8 @@ borderLeftWidth_export_definition = {
|
|
|
737
1454
|
enumerable: true,
|
|
738
1455
|
configurable: true
|
|
739
1456
|
};
|
|
740
|
-
var borderRight_export_definition;
|
|
741
|
-
|
|
1457
|
+
var borderRight_export_shorthandFor, borderRight_export_definition;
|
|
1458
|
+
borderRight_export_shorthandFor = new Map([["border-right-width", {
|
|
742
1459
|
parse: borderTopWidth_export_parse,
|
|
743
1460
|
isValid: borderTopWidth_export_isValid,
|
|
744
1461
|
definition: borderTopWidth_export_definition
|
|
@@ -755,13 +1472,13 @@ borderRight_export_definition = {
|
|
|
755
1472
|
set(v) {
|
|
756
1473
|
v = external_dependency_parsers_0.prepareValue(v, this._global);
|
|
757
1474
|
if (external_dependency_parsers_0.hasVarFunc(v)) {
|
|
758
|
-
for (const [key] of
|
|
1475
|
+
for (const [key] of borderRight_export_shorthandFor) {
|
|
759
1476
|
this._setProperty(key, "");
|
|
760
1477
|
}
|
|
761
1478
|
this._setProperty("border", "");
|
|
762
1479
|
this._setProperty("border-right", v);
|
|
763
1480
|
} else {
|
|
764
|
-
this._shorthandSetter("border-right", v,
|
|
1481
|
+
this._shorthandSetter("border-right", v, borderRight_export_shorthandFor);
|
|
765
1482
|
}
|
|
766
1483
|
},
|
|
767
1484
|
get() {
|
|
@@ -769,7 +1486,7 @@ borderRight_export_definition = {
|
|
|
769
1486
|
if (external_dependency_parsers_0.hasVarFunc(val)) {
|
|
770
1487
|
return val;
|
|
771
1488
|
}
|
|
772
|
-
val = this._shorthandGetter("border-right",
|
|
1489
|
+
val = this._shorthandGetter("border-right", borderRight_export_shorthandFor);
|
|
773
1490
|
if (external_dependency_parsers_0.hasVarFunc(val)) {
|
|
774
1491
|
return "";
|
|
775
1492
|
}
|
|
@@ -913,8 +1630,8 @@ borderSpacing_export_definition = {
|
|
|
913
1630
|
enumerable: true,
|
|
914
1631
|
configurable: true
|
|
915
1632
|
};
|
|
916
|
-
var borderTop_export_definition;
|
|
917
|
-
|
|
1633
|
+
var borderTop_export_shorthandFor, borderTop_export_definition;
|
|
1634
|
+
borderTop_export_shorthandFor = new Map([["border-top-width", {
|
|
918
1635
|
parse: borderTopWidth_export_parse,
|
|
919
1636
|
isValid: borderTopWidth_export_isValid,
|
|
920
1637
|
definition: borderTopWidth_export_definition
|
|
@@ -931,13 +1648,13 @@ borderTop_export_definition = {
|
|
|
931
1648
|
set(v) {
|
|
932
1649
|
v = external_dependency_parsers_0.prepareValue(v, this._global);
|
|
933
1650
|
if (external_dependency_parsers_0.hasVarFunc(v)) {
|
|
934
|
-
for (const [key] of
|
|
1651
|
+
for (const [key] of borderTop_export_shorthandFor) {
|
|
935
1652
|
this._setProperty(key, "");
|
|
936
1653
|
}
|
|
937
1654
|
this._setProperty("border", "");
|
|
938
1655
|
this._setProperty("border-top", v);
|
|
939
1656
|
} else {
|
|
940
|
-
this._shorthandSetter("border-top", v,
|
|
1657
|
+
this._shorthandSetter("border-top", v, borderTop_export_shorthandFor);
|
|
941
1658
|
}
|
|
942
1659
|
},
|
|
943
1660
|
get() {
|
|
@@ -945,7 +1662,7 @@ borderTop_export_definition = {
|
|
|
945
1662
|
if (external_dependency_parsers_0.hasVarFunc(val)) {
|
|
946
1663
|
return val;
|
|
947
1664
|
}
|
|
948
|
-
val = this._shorthandGetter("border-top",
|
|
1665
|
+
val = this._shorthandGetter("border-top", borderTop_export_shorthandFor);
|
|
949
1666
|
if (external_dependency_parsers_0.hasVarFunc(val)) {
|
|
950
1667
|
return "";
|
|
951
1668
|
}
|
|
@@ -1014,7 +1731,7 @@ clip_export_parse = function parse(v) {
|
|
|
1014
1731
|
return val;
|
|
1015
1732
|
}
|
|
1016
1733
|
// parse legacy <shape>
|
|
1017
|
-
v =
|
|
1734
|
+
v = external_dependency_strings_1.asciiLowercase(v);
|
|
1018
1735
|
const matches = v.match(/^rect\(\s*(.*)\s*\)$/);
|
|
1019
1736
|
if (!matches) {
|
|
1020
1737
|
return;
|
|
@@ -1149,8 +1866,8 @@ flexBasis_export_definition = {
|
|
|
1149
1866
|
enumerable: true,
|
|
1150
1867
|
configurable: true
|
|
1151
1868
|
};
|
|
1152
|
-
var flex_export_parse, flex_export_isValid, flex_export_definition;
|
|
1153
|
-
|
|
1869
|
+
var flex_export_shorthandFor, flex_export_parse, flex_export_isValid, flex_export_definition;
|
|
1870
|
+
flex_export_shorthandFor = new Map([["flex-grow", {
|
|
1154
1871
|
parse: flexGrow_export_parse,
|
|
1155
1872
|
isValid: flexGrow_export_isValid,
|
|
1156
1873
|
definition: flexGrow_export_definition
|
|
@@ -1177,7 +1894,7 @@ flex_export_parse = function parse(v) {
|
|
|
1177
1894
|
}
|
|
1178
1895
|
return;
|
|
1179
1896
|
}
|
|
1180
|
-
const obj = external_dependency_parsers_0.parseShorthand(v,
|
|
1897
|
+
const obj = external_dependency_parsers_0.parseShorthand(v, flex_export_shorthandFor);
|
|
1181
1898
|
if (obj) {
|
|
1182
1899
|
const flex = {
|
|
1183
1900
|
"flex-grow": "1",
|
|
@@ -1201,10 +1918,10 @@ flex_export_definition = {
|
|
|
1201
1918
|
set(v) {
|
|
1202
1919
|
v = external_dependency_parsers_0.prepareValue(v, this._global);
|
|
1203
1920
|
if (external_dependency_parsers_0.hasVarFunc(v)) {
|
|
1204
|
-
this._shorthandSetter("flex", "",
|
|
1921
|
+
this._shorthandSetter("flex", "", flex_export_shorthandFor);
|
|
1205
1922
|
this._setProperty("flex", v);
|
|
1206
1923
|
} else {
|
|
1207
|
-
this._shorthandSetter("flex", flex_export_parse(v),
|
|
1924
|
+
this._shorthandSetter("flex", flex_export_parse(v), flex_export_shorthandFor);
|
|
1208
1925
|
}
|
|
1209
1926
|
},
|
|
1210
1927
|
get() {
|
|
@@ -1212,7 +1929,7 @@ flex_export_definition = {
|
|
|
1212
1929
|
if (external_dependency_parsers_0.hasVarFunc(val)) {
|
|
1213
1930
|
return val;
|
|
1214
1931
|
}
|
|
1215
|
-
val = this._shorthandGetter("flex",
|
|
1932
|
+
val = this._shorthandGetter("flex", flex_export_shorthandFor);
|
|
1216
1933
|
if (external_dependency_parsers_0.hasVarFunc(val)) {
|
|
1217
1934
|
return "";
|
|
1218
1935
|
}
|
|
@@ -1428,6 +2145,7 @@ fontFamily_export_parse = function parse(v) {
|
|
|
1428
2145
|
return v;
|
|
1429
2146
|
}
|
|
1430
2147
|
const keywords = ["serif", "sans-serif", "cursive", "fantasy", "monospace", "system-ui", "math", "ui-serif", "ui-sans-serif", "ui-monospace", "ui-rounded"];
|
|
2148
|
+
const genericValues = ["fangsong", "kai", "khmer-mul", "nastaliq"];
|
|
1431
2149
|
const val = external_dependency_parsers_0.splitValue(v, {
|
|
1432
2150
|
delimiter: ","
|
|
1433
2151
|
});
|
|
@@ -1446,6 +2164,18 @@ fontFamily_export_parse = function parse(v) {
|
|
|
1446
2164
|
valid = true;
|
|
1447
2165
|
continue;
|
|
1448
2166
|
}
|
|
2167
|
+
const obj = external_dependency_parsers_0.parseFunction(i);
|
|
2168
|
+
if (obj) {
|
|
2169
|
+
const {
|
|
2170
|
+
name,
|
|
2171
|
+
value
|
|
2172
|
+
} = obj;
|
|
2173
|
+
if (name === "generic" && genericValues.includes(value)) {
|
|
2174
|
+
font.push(`${name}(${value})`);
|
|
2175
|
+
valid = true;
|
|
2176
|
+
continue;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
1449
2179
|
// This implementation does not strictly follow the specification.
|
|
1450
2180
|
// The spec does not require the first letter of the font-family to be
|
|
1451
2181
|
// capitalized, and unquoted font-family names are not restricted to ASCII.
|
|
@@ -1487,8 +2217,8 @@ fontFamily_export_definition = {
|
|
|
1487
2217
|
enumerable: true,
|
|
1488
2218
|
configurable: true
|
|
1489
2219
|
};
|
|
1490
|
-
var font_export_parse, font_export_definition;
|
|
1491
|
-
|
|
2220
|
+
var font_export_shorthandFor, font_export_parse, font_export_definition;
|
|
2221
|
+
font_export_shorthandFor = new Map([["font-style", {
|
|
1492
2222
|
parse: fontStyle_export_parse,
|
|
1493
2223
|
isValid: fontStyle_export_isValid,
|
|
1494
2224
|
definition: fontStyle_export_definition
|
|
@@ -1570,16 +2300,9 @@ font_export_parse = function parse(v) {
|
|
|
1570
2300
|
case "font-style":
|
|
1571
2301
|
case "font-variant":
|
|
1572
2302
|
case "font-weight":
|
|
1573
|
-
{
|
|
1574
|
-
const value = font_local_var_shorthandFor.get(property);
|
|
1575
|
-
if (value.isValid(part)) {
|
|
1576
|
-
font[property] = value.parse(part);
|
|
1577
|
-
}
|
|
1578
|
-
break;
|
|
1579
|
-
}
|
|
1580
2303
|
case "font-size":
|
|
1581
2304
|
{
|
|
1582
|
-
const value =
|
|
2305
|
+
const value = font_export_shorthandFor.get(property);
|
|
1583
2306
|
if (value.isValid(part)) {
|
|
1584
2307
|
font[property] = value.parse(part);
|
|
1585
2308
|
}
|
|
@@ -1596,8 +2319,7 @@ font_export_parse = function parse(v) {
|
|
|
1596
2319
|
return;
|
|
1597
2320
|
}
|
|
1598
2321
|
} else {
|
|
1599
|
-
|
|
1600
|
-
const revParts = [...external_dependency_parsers_0.splitValue(fontBlockA.trim())].reverse();
|
|
2322
|
+
const revParts = external_dependency_parsers_0.splitValue(fontBlockA.trim()).toReversed();
|
|
1601
2323
|
const revFontFamily = [];
|
|
1602
2324
|
const properties = ["font-style", "font-variant", "font-weight", "line-height"];
|
|
1603
2325
|
font["font-style"] = "normal";
|
|
@@ -1617,7 +2339,7 @@ font_export_parse = function parse(v) {
|
|
|
1617
2339
|
case "font-weight":
|
|
1618
2340
|
case "line-height":
|
|
1619
2341
|
{
|
|
1620
|
-
const value =
|
|
2342
|
+
const value = font_export_shorthandFor.get(property);
|
|
1621
2343
|
if (value.isValid(part)) {
|
|
1622
2344
|
font[property] = value.parse(part);
|
|
1623
2345
|
}
|
|
@@ -1685,7 +2407,7 @@ font_export_definition = {
|
|
|
1685
2407
|
set(v) {
|
|
1686
2408
|
v = external_dependency_parsers_0.prepareValue(v, this._global);
|
|
1687
2409
|
if (v === "" || external_dependency_parsers_0.hasVarFunc(v)) {
|
|
1688
|
-
for (const [key] of
|
|
2410
|
+
for (const [key] of font_export_shorthandFor) {
|
|
1689
2411
|
this._setProperty(key, "");
|
|
1690
2412
|
}
|
|
1691
2413
|
this._setProperty("font", v);
|
|
@@ -1695,7 +2417,7 @@ font_export_definition = {
|
|
|
1695
2417
|
return;
|
|
1696
2418
|
}
|
|
1697
2419
|
const str = new Set();
|
|
1698
|
-
for (const [key] of
|
|
2420
|
+
for (const [key] of font_export_shorthandFor) {
|
|
1699
2421
|
const val = obj[key];
|
|
1700
2422
|
if (typeof val === "string") {
|
|
1701
2423
|
this._setProperty(key, val);
|
|
@@ -1717,7 +2439,7 @@ font_export_definition = {
|
|
|
1717
2439
|
return val;
|
|
1718
2440
|
}
|
|
1719
2441
|
const str = new Set();
|
|
1720
|
-
for (const [key] of
|
|
2442
|
+
for (const [key] of font_export_shorthandFor) {
|
|
1721
2443
|
const v = this.getPropertyValue(key);
|
|
1722
2444
|
if (external_dependency_parsers_0.hasVarFunc(v)) {
|
|
1723
2445
|
return "";
|
|
@@ -1814,7 +2536,7 @@ lightingColor_export_definition = {
|
|
|
1814
2536
|
var margin_export_parse, margin_export_isValid, margin_export_definition;
|
|
1815
2537
|
const margin_local_var_positions = ["top", "right", "bottom", "left"];
|
|
1816
2538
|
margin_export_parse = function parse(v) {
|
|
1817
|
-
const val = external_dependency_parsers_0.parseMeasurement(v
|
|
2539
|
+
const val = external_dependency_parsers_0.parseMeasurement(v);
|
|
1818
2540
|
if (val) {
|
|
1819
2541
|
return val;
|
|
1820
2542
|
}
|
|
@@ -1851,7 +2573,7 @@ margin_export_definition = {
|
|
|
1851
2573
|
};
|
|
1852
2574
|
var marginBottom_export_parse, marginBottom_export_isValid, marginBottom_export_definition;
|
|
1853
2575
|
marginBottom_export_parse = function parse(v) {
|
|
1854
|
-
const val = external_dependency_parsers_0.parseMeasurement(v
|
|
2576
|
+
const val = external_dependency_parsers_0.parseMeasurement(v);
|
|
1855
2577
|
if (val) {
|
|
1856
2578
|
return val;
|
|
1857
2579
|
}
|
|
@@ -1881,7 +2603,7 @@ marginBottom_export_definition = {
|
|
|
1881
2603
|
};
|
|
1882
2604
|
var marginLeft_export_parse, marginLeft_export_isValid, marginLeft_export_definition;
|
|
1883
2605
|
marginLeft_export_parse = function parse(v) {
|
|
1884
|
-
const val = external_dependency_parsers_0.parseMeasurement(v
|
|
2606
|
+
const val = external_dependency_parsers_0.parseMeasurement(v);
|
|
1885
2607
|
if (val) {
|
|
1886
2608
|
return val;
|
|
1887
2609
|
}
|
|
@@ -1911,7 +2633,7 @@ marginLeft_export_definition = {
|
|
|
1911
2633
|
};
|
|
1912
2634
|
var marginRight_export_parse, marginRight_export_isValid, marginRight_export_definition;
|
|
1913
2635
|
marginRight_export_parse = function parse(v) {
|
|
1914
|
-
const val = external_dependency_parsers_0.parseMeasurement(v
|
|
2636
|
+
const val = external_dependency_parsers_0.parseMeasurement(v);
|
|
1915
2637
|
if (val) {
|
|
1916
2638
|
return val;
|
|
1917
2639
|
}
|
|
@@ -1941,7 +2663,7 @@ marginRight_export_definition = {
|
|
|
1941
2663
|
};
|
|
1942
2664
|
var marginTop_export_parse, marginTop_export_isValid, marginTop_export_definition;
|
|
1943
2665
|
marginTop_export_parse = function parse(v) {
|
|
1944
|
-
const val = external_dependency_parsers_0.parseMeasurement(v
|
|
2666
|
+
const val = external_dependency_parsers_0.parseMeasurement(v);
|
|
1945
2667
|
if (val) {
|
|
1946
2668
|
return val;
|
|
1947
2669
|
}
|
|
@@ -2524,8 +3246,14 @@ module.exports = {
|
|
|
2524
3246
|
"background-image": backgroundImage_export_definition,
|
|
2525
3247
|
backgroundPosition: backgroundPosition_export_definition,
|
|
2526
3248
|
"background-position": backgroundPosition_export_definition,
|
|
3249
|
+
backgroundSize: backgroundSize_export_definition,
|
|
3250
|
+
"background-size": backgroundSize_export_definition,
|
|
2527
3251
|
backgroundRepeat: backgroundRepeat_export_definition,
|
|
2528
3252
|
"background-repeat": backgroundRepeat_export_definition,
|
|
3253
|
+
backgroundOrigin: backgroundOrigin_export_definition,
|
|
3254
|
+
"background-origin": backgroundOrigin_export_definition,
|
|
3255
|
+
backgroundClip: backgroundClip_export_definition,
|
|
3256
|
+
"background-clip": backgroundClip_export_definition,
|
|
2529
3257
|
backgroundAttachment: backgroundAttachment_export_definition,
|
|
2530
3258
|
"background-attachment": backgroundAttachment_export_definition,
|
|
2531
3259
|
backgroundColor: backgroundColor_export_definition,
|