transform-to-unocss-core 0.0.62 → 0.0.64
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/dist/index.cjs +658 -105
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.iife.js +658 -105
- package/dist/index.js +658 -105
- package/dist/index.umd.js +658 -105
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -50,12 +50,12 @@ function isConstant(s) {
|
|
|
50
50
|
function isEnv(s) {
|
|
51
51
|
return /^env\(/.test(s);
|
|
52
52
|
}
|
|
53
|
-
function getVal(val, transform$1, inClass, prefix = "") {
|
|
54
|
-
if (isCalc(val) || isUrl(val) || isHex(val) || isRgb(val) || isHsl(val) || isPercent(val) || isVar(val) || isCubicBezier(val) || isConstant(val) || isAttr(val) || isEnv(val) || isRepeatingLinearGradient(val) || isRepeatingRadialGradient(val)) return inClass ? `-[${prefix}${trim(val, "all").replace(/['"]/g, "")}]` : `="[${prefix}${trim(val, "all").replace(/['"]/g, "")}]"`;
|
|
53
|
+
function getVal(val, transform$1, inClass, prefix = "", dynamicFlag = false) {
|
|
54
|
+
if (dynamicFlag || isCalc(val) || isUrl(val) || isHex(val) || isRgb(val) || isHsl(val) || isPercent(val) || isVar(val) || isCubicBezier(val) || isConstant(val) || isAttr(val) || isEnv(val) || isRepeatingLinearGradient(val) || isRepeatingRadialGradient(val)) return inClass ? `-[${prefix}${trim(transform$1 ? transform$1(val) : val, "all").replace(/['"]/g, "")}]` : `="[${prefix}${trim(transform$1 ? transform$1(val) : val, "all").replace(/['"]/g, "")}]"`;
|
|
55
55
|
return prefix ? `-[${prefix}${transform$1 ? transform$1(val) : val}]` : `-${transform$1 ? transform$1(val) : val}`;
|
|
56
56
|
}
|
|
57
57
|
function getHundred(n) {
|
|
58
|
-
if (typeof n === "string" && n.endsWith("%")) return n.slice(0, -1);
|
|
58
|
+
if (typeof n === "string" && n.endsWith("%")) return +n.slice(0, -1);
|
|
59
59
|
return +n * 100;
|
|
60
60
|
}
|
|
61
61
|
function joinWithLine(s) {
|
|
@@ -84,8 +84,11 @@ function trim(s, type = "around") {
|
|
|
84
84
|
if (type === "around") return s.replace(/(^\s*)|(\s*$)/g, "");
|
|
85
85
|
return s;
|
|
86
86
|
}
|
|
87
|
-
function transformImportant(v) {
|
|
88
|
-
v = v.replace(/\s+/g, " ").replace(/\s*,\s*/g, ",").replace(/\s*\/\s*/g, "/");
|
|
87
|
+
function transformImportant(v, trimSpace = true) {
|
|
88
|
+
if (trimSpace) v = v.replace(/\s+/g, " ").replace(/\s*,\s*/g, ",").replace(/\s*\/\s*/g, "/");
|
|
89
|
+
if (/calc\([^)]+\)/.test(v)) v = v.replace(/calc\(([^)]+)\)/g, (all, k) => {
|
|
90
|
+
return all.replace(k, k.replace(/\s/g, ""));
|
|
91
|
+
});
|
|
89
92
|
if (/rgb/.test(v)) v = v.replace(/rgba?\(([^)]+)\)/g, (all, k) => {
|
|
90
93
|
const _k = k.trim().split(" ");
|
|
91
94
|
return all.replace(k, _k.map((i, index) => i.endsWith(",") ? i : i + (_k.length - 1 === index ? "" : ",")).join(""));
|
|
@@ -95,8 +98,7 @@ function transformImportant(v) {
|
|
|
95
98
|
return all.replace(k, _k.map((i, index) => i.endsWith(",") ? i : i + (_k.length - 1 === index ? "" : ",")).join(""));
|
|
96
99
|
});
|
|
97
100
|
if (/var\([^)]+\)/.test(v)) v = v.replace(/var\(([^)]+)\)/g, (all, k) => {
|
|
98
|
-
|
|
99
|
-
return all.replace(k, _k.map((i, index) => i.endsWith(",") ? i : i + (_k.length - 1 === index ? "" : ",")).join(""));
|
|
101
|
+
return all.replace(k, k.replace(/\s/g, "_"));
|
|
100
102
|
});
|
|
101
103
|
if (v.endsWith("!important")) return [v.replace(/\s*!important/, "").trim(), "!"];
|
|
102
104
|
return [v.trim(), ""];
|
|
@@ -135,16 +137,43 @@ function getGradient(s) {
|
|
|
135
137
|
return s.startsWith("linear-gradient") ? "linear" : s.startsWith("radial-gradient") ? "radial" : s.startsWith("conic-gradient") ? "conic" : "";
|
|
136
138
|
}
|
|
137
139
|
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/accent.ts
|
|
142
|
+
const accentMap = ["accent-color"];
|
|
143
|
+
function accent(key, val) {
|
|
144
|
+
if (!accentMap.includes(key)) return;
|
|
145
|
+
const [value, important] = transformImportant(val);
|
|
146
|
+
return `accent-[${joinWithUnderLine(value)}]${important}`;
|
|
147
|
+
}
|
|
148
|
+
|
|
138
149
|
//#endregion
|
|
139
150
|
//#region src/align.ts
|
|
151
|
+
const alignMap = [
|
|
152
|
+
"align-content",
|
|
153
|
+
"align-items",
|
|
154
|
+
"align-self"
|
|
155
|
+
];
|
|
140
156
|
function align(key, val) {
|
|
157
|
+
if (!alignMap.includes(key)) return;
|
|
141
158
|
const [value, important] = transformImportant(val);
|
|
142
|
-
return `${getLastName(key)}-${getLastName(
|
|
159
|
+
return `${getLastName(key)}-${value.split(" ").reverse().map(getLastName).join("-")}${important}`;
|
|
143
160
|
}
|
|
144
161
|
|
|
145
162
|
//#endregion
|
|
146
163
|
//#region src/animation.ts
|
|
164
|
+
const animationMap = [
|
|
165
|
+
"animation",
|
|
166
|
+
"animation-delay",
|
|
167
|
+
"animation-direction",
|
|
168
|
+
"animation-duration",
|
|
169
|
+
"animation-fill-mode",
|
|
170
|
+
"animation-iteration-count",
|
|
171
|
+
"animation-name",
|
|
172
|
+
"animation-play-state",
|
|
173
|
+
"animation-timing-function"
|
|
174
|
+
];
|
|
147
175
|
function animation(key, val) {
|
|
176
|
+
if (!animationMap.includes(key)) return;
|
|
148
177
|
const [value, important] = transformImportant(val);
|
|
149
178
|
if (key === "animation-delay") return `animate-delay${getVal(value)}${important}`;
|
|
150
179
|
if (key === "animation-duration") return `animate-duration${getVal(value)}${important}`;
|
|
@@ -196,66 +225,108 @@ function animation(key, val) {
|
|
|
196
225
|
return `animate-[${value}]${important}`;
|
|
197
226
|
}
|
|
198
227
|
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/appearance.ts
|
|
230
|
+
const appearanceMap = ["appearance"];
|
|
231
|
+
function appearance(key, val) {
|
|
232
|
+
if (!appearanceMap.includes(key)) return;
|
|
233
|
+
const [value, important] = transformImportant(val);
|
|
234
|
+
return `appearance${getVal(value)}${important}`;
|
|
235
|
+
}
|
|
236
|
+
|
|
199
237
|
//#endregion
|
|
200
238
|
//#region src/aspect.ts
|
|
239
|
+
const aspectMap = ["aspect-ratio"];
|
|
201
240
|
function aspect(key, val) {
|
|
241
|
+
if (!aspectMap.includes(key)) return;
|
|
202
242
|
const [value, important] = transformImportant(val);
|
|
203
243
|
if (value === "auto") return `${getFirstName(key)}-${value}${important}`;
|
|
204
244
|
return `${getFirstName(key)}="[${value}]${important}"`;
|
|
205
245
|
}
|
|
206
246
|
|
|
207
|
-
//#endregion
|
|
208
|
-
//#region src/box.ts
|
|
209
|
-
const validKey = ["box-shadow", "drop-shadow"];
|
|
210
|
-
function box(key, val) {
|
|
211
|
-
let [value, important] = transformImportant(val);
|
|
212
|
-
if (key.startsWith("box-decoration")) return `box-decoration-${value}${important}`;
|
|
213
|
-
if (key === "box-sizing") return `box-${getFirstName(value)}${important}`;
|
|
214
|
-
if (validKey.includes(key)) return `shadow="[${value.split(" ").join("_")}]${important}"`;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
247
|
//#endregion
|
|
218
248
|
//#region src/filter.ts
|
|
219
|
-
const hundred = [
|
|
220
|
-
"contrast",
|
|
221
|
-
"brightness",
|
|
222
|
-
"saturate"
|
|
223
|
-
];
|
|
224
249
|
const percent = [
|
|
225
250
|
"grayscale",
|
|
226
251
|
"invert",
|
|
227
252
|
"sepia"
|
|
228
253
|
];
|
|
254
|
+
const filterMap = ["filter", "backdrop-filter"];
|
|
229
255
|
function filter(key, val) {
|
|
256
|
+
if (!filterMap.includes(key)) return;
|
|
230
257
|
const [v, important] = transformImportant(val);
|
|
231
258
|
const [_, name, value] = v.match(/([\w-]+)\((.*)\)/);
|
|
232
|
-
if (
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
259
|
+
if ([
|
|
260
|
+
"contrast",
|
|
261
|
+
"brightness",
|
|
262
|
+
"saturate"
|
|
263
|
+
].includes(name)) {
|
|
264
|
+
const hundred = getHundred(value);
|
|
265
|
+
if (Number.isNaN(hundred)) return `${name}${getVal(value)}${important}`;
|
|
266
|
+
return `${name}-${hundred}${important}`;
|
|
267
|
+
}
|
|
268
|
+
if (name === "drop-shadow") return `drop-${dropShadow(value, important)}`;
|
|
269
|
+
if (percent.includes(name)) {
|
|
270
|
+
if (value.endsWith("%")) return `${name}-${value.slice(0, -1)}${important}`;
|
|
271
|
+
const hundred = getHundred(value);
|
|
272
|
+
if (Number.isNaN(hundred)) return `${name}${getVal(value)}${important}`;
|
|
273
|
+
return `${name}-${hundred}${important}`;
|
|
274
|
+
}
|
|
275
|
+
if (name === "hue-rotate") {
|
|
276
|
+
if (value.endsWith("deg")) return `${name}-${value.slice(0, -3)}${important}`;
|
|
277
|
+
return `${name}${getVal(value)}${important}`;
|
|
278
|
+
}
|
|
236
279
|
return `${name}-${value}${important}`;
|
|
237
280
|
}
|
|
281
|
+
function dropShadow(val, important = "") {
|
|
282
|
+
const [value] = transformImportant(val);
|
|
283
|
+
return `shadow="[${value.split(" ").join("_")}]${important}"`;
|
|
284
|
+
}
|
|
238
285
|
|
|
239
286
|
//#endregion
|
|
240
287
|
//#region src/backdrop.ts
|
|
288
|
+
const backdropMap = ["backdrop-filter"];
|
|
241
289
|
function backdrop(key, val) {
|
|
290
|
+
if (!backdropMap.includes(key)) return;
|
|
242
291
|
const [value, important] = transformImportant(val);
|
|
292
|
+
if (value.startsWith("var")) return;
|
|
243
293
|
return `backdrop-${filter(key, value)}${important}`;
|
|
244
294
|
}
|
|
245
295
|
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/backface.ts
|
|
298
|
+
const backfaceMap = ["backface-visibility"];
|
|
299
|
+
function backface(key, val) {
|
|
300
|
+
if (!backfaceMap.includes(key)) return;
|
|
301
|
+
const [value, important] = transformImportant(val);
|
|
302
|
+
return `${getFirstName(key)}${getVal(value)}${important}`;
|
|
303
|
+
}
|
|
304
|
+
|
|
246
305
|
//#endregion
|
|
247
306
|
//#region src/background.ts
|
|
248
|
-
const backgroundMap = [
|
|
307
|
+
const backgroundMap = [
|
|
308
|
+
"background",
|
|
309
|
+
"background-attachment",
|
|
310
|
+
"background-blend-mode",
|
|
311
|
+
"background-clip",
|
|
312
|
+
"background-color",
|
|
313
|
+
"background-image",
|
|
314
|
+
"background-origin",
|
|
315
|
+
"background-position",
|
|
316
|
+
"background-repeat",
|
|
317
|
+
"background-size"
|
|
318
|
+
];
|
|
249
319
|
const lengthRe = "\\d*\\.?\\d+(?:px|em|rem|%|vw|vh)?";
|
|
250
320
|
const positionPair = `(${lengthRe})\\s+(${lengthRe})`;
|
|
251
321
|
const optimizedReg = new RegExp(`${positionPair}\\s*,\\s*${positionPair}`);
|
|
252
322
|
function background(key, val) {
|
|
323
|
+
if (!backgroundMap.includes(key)) return;
|
|
253
324
|
const [value, important] = transformImportant(val);
|
|
254
325
|
if (key === "background-size") return `bg${getVal(value, /\d/.test(value) ? joinWithUnderLine : joinWithLine, false, "length:")}${important}`;
|
|
255
|
-
if (
|
|
326
|
+
if (["background-color", "background-attachment"].includes(key)) return `bg${getVal(value, joinWithLine)}${important}`;
|
|
256
327
|
if (key === "background-position") {
|
|
257
328
|
if (/\d/.test(value)) return `bg${getVal(value, joinWithUnderLine, false, "position:")}${important}`;
|
|
258
|
-
return `bg${getVal(value, joinWithLine)}${important}`;
|
|
329
|
+
return `bg${getVal(value, joinWithLine, false, "position:")}${important}`;
|
|
259
330
|
}
|
|
260
331
|
if (["background", "background-image"].includes(key)) {
|
|
261
332
|
if (isSize(value)) return `bg${getVal(value, joinWithUnderLine, false, "position:")}${important}`;
|
|
@@ -374,20 +445,20 @@ function getLinearGradientPosition$1(from, via, to) {
|
|
|
374
445
|
if (from) {
|
|
375
446
|
from = from.replaceAll(commaReplacer, ",");
|
|
376
447
|
const [fromColor, fromPosition] = from.split(" ");
|
|
377
|
-
if (fromPosition) result += ` from="${isRgb(fromColor) ? `[${fromColor}]` : fromColor} ${fromPosition}"`;
|
|
378
|
-
else if (fromColor) result += ` from="${isRgb(fromColor) ? `[${fromColor}]` : fromColor}"`;
|
|
448
|
+
if (fromPosition) result += ` from="${isRgb(fromColor) || isVar(fromColor) ? `[${fromColor}]` : fromColor} ${fromPosition}"`;
|
|
449
|
+
else if (fromColor) result += ` from="${isRgb(fromColor) || isVar(fromColor) ? `[${fromColor}]` : fromColor}"`;
|
|
379
450
|
}
|
|
380
451
|
if (via) {
|
|
381
452
|
via = via.replaceAll(commaReplacer, ",");
|
|
382
453
|
const [viaColor, viaPosition] = via.split(" ");
|
|
383
|
-
if (viaPosition) result += ` via="${isRgb(viaColor) ? `[${viaColor}]` : viaColor} ${viaPosition}"`;
|
|
384
|
-
else if (viaColor) result += ` via="${isRgb(viaColor) ? `[${viaColor}]` : viaColor}"`;
|
|
454
|
+
if (viaPosition) result += ` via="${isRgb(viaColor) || isVar(viaColor) ? `[${viaColor}]` : viaColor} ${viaPosition}"`;
|
|
455
|
+
else if (viaColor) result += ` via="${isRgb(viaColor) || isVar(viaColor) ? `[${viaColor}]` : viaColor}"`;
|
|
385
456
|
}
|
|
386
457
|
if (to) {
|
|
387
458
|
to = to.replaceAll(commaReplacer, ",");
|
|
388
459
|
const [toColor, toPosition] = to.split(" ");
|
|
389
|
-
if (toPosition) result += ` to="${isRgb(toColor) ? `[${toColor}]` : toColor} ${toPosition}"`;
|
|
390
|
-
else if (toColor) result += ` to="${isRgb(toColor) ? `[${toColor}]` : toColor}"`;
|
|
460
|
+
if (toPosition) result += ` to="${isRgb(toColor) || isVar(toColor) ? `[${toColor}]` : toColor} ${toPosition}"`;
|
|
461
|
+
else if (toColor) result += ` to="${isRgb(toColor) || isVar(toColor) ? `[${toColor}]` : toColor}"`;
|
|
391
462
|
}
|
|
392
463
|
return result;
|
|
393
464
|
}
|
|
@@ -414,6 +485,24 @@ const borderSize = [
|
|
|
414
485
|
"border-bottom",
|
|
415
486
|
"border-left"
|
|
416
487
|
];
|
|
488
|
+
const widthMatchMap = {
|
|
489
|
+
"inline": "x",
|
|
490
|
+
"block": "y",
|
|
491
|
+
"inline-start": "s",
|
|
492
|
+
"inline-end": "e",
|
|
493
|
+
"top": "t",
|
|
494
|
+
"right": "r",
|
|
495
|
+
"bottom": "b",
|
|
496
|
+
"left": "l"
|
|
497
|
+
};
|
|
498
|
+
const radiusMatchMap = {
|
|
499
|
+
top: "t",
|
|
500
|
+
right: "r",
|
|
501
|
+
bottom: "b",
|
|
502
|
+
left: "l",
|
|
503
|
+
end: "e",
|
|
504
|
+
start: "s"
|
|
505
|
+
};
|
|
417
506
|
function border(key, val) {
|
|
418
507
|
let [value, important] = transformImportant(val);
|
|
419
508
|
if (key === "border-spacing") return `${key}="[${joinWithUnderLine(value)}]${important}"`;
|
|
@@ -430,14 +519,26 @@ function border(key, val) {
|
|
|
430
519
|
}
|
|
431
520
|
return `border${getVal(value)}${important}`;
|
|
432
521
|
}
|
|
433
|
-
|
|
522
|
+
const radiusMatch = key.match(/border(-start|-end|-top|-bottom)?(-start|-end|-left|-right)?-radius/);
|
|
523
|
+
if (radiusMatch) {
|
|
524
|
+
const [_, start, end] = radiusMatch;
|
|
525
|
+
if (start && end) return `${important}rounded-${radiusMatchMap[start.slice(1)]}${radiusMatchMap[end.slice(1)]}${getVal(value, joinWithUnderLine)}`;
|
|
526
|
+
if (start || end) return `${important}rounded-${radiusMatchMap[(start === null || start === void 0 ? void 0 : start.slice(1)) || (end === null || end === void 0 ? void 0 : end.slice(1))]}${getVal(value, joinWithUnderLine)}`;
|
|
527
|
+
return `${important}rounded${getVal(value, joinWithUnderLine, false, "", true)}`;
|
|
528
|
+
}
|
|
529
|
+
const widthMatch = key.match(/border(-inline|-block|-inline-start|-inline-end|-top|-right|-bottom|-left)?-(width|color)/);
|
|
530
|
+
if (widthMatch) {
|
|
531
|
+
if (widthMatch[1]) {
|
|
532
|
+
const widthType = widthMatchMap[widthMatch[1].slice(1)];
|
|
533
|
+
return `${important}border-${widthType}${getVal(value, joinWithUnderLine, false, "length:")}`;
|
|
534
|
+
}
|
|
535
|
+
return `${important}border${getVal(value, joinWithUnderLine, false, "length:")}`;
|
|
536
|
+
}
|
|
434
537
|
if (borderSize.some((b) => key.startsWith(b))) {
|
|
435
538
|
const keys = key.split("-");
|
|
436
539
|
if (keys.slice(-1)[0] === "radius") return value.split(" ").map((v) => `border-rd-${keys.slice(1, -1).map((s) => s[0]).join("")}${getVal(v)}${important}`).join(" ");
|
|
437
540
|
return value.split(" ").map((v) => `border-${key.split("-")[1][0]}${getVal(v)}${important}`).join(" ");
|
|
438
541
|
}
|
|
439
|
-
if (key === "border-inline-end-width") return `border-e${getVal(value)}${important}`;
|
|
440
|
-
if (key === "border-inline-start-width") return `border-s${getVal(value)}${important}`;
|
|
441
542
|
if (key.startsWith("border-image")) return "";
|
|
442
543
|
if (key === "border-width" && value.includes(" ")) return value.split(" ").map((v, i) => `border-${borderSize[i].split("-")[1][0]}${getVal(v)}${important}`).join(" ");
|
|
443
544
|
if (/^\d[%|(px)rem]$/.test(value) || key === "border-collapse") return `border-${value}${important}`;
|
|
@@ -459,38 +560,114 @@ function border(key, val) {
|
|
|
459
560
|
}).join(" ");
|
|
460
561
|
}
|
|
461
562
|
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region src/box.ts
|
|
565
|
+
const boxMap = [
|
|
566
|
+
"box-sizing",
|
|
567
|
+
"box-decoration-break",
|
|
568
|
+
"box-shadow"
|
|
569
|
+
];
|
|
570
|
+
function box(key, val) {
|
|
571
|
+
if (!boxMap.includes(key)) return;
|
|
572
|
+
const [value, important] = transformImportant(val);
|
|
573
|
+
if (key.startsWith("box-decoration-break")) return `box-decoration-${value}${important}`;
|
|
574
|
+
if (key === "box-sizing") return `box-${getFirstName(value)}${important}`;
|
|
575
|
+
if (key === "box-shadow") return `shadow="[${value.split(" ").join("_")}]${important}"`;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
//#endregion
|
|
579
|
+
//#region src/break.ts
|
|
580
|
+
const breakMap = [
|
|
581
|
+
"break-inside",
|
|
582
|
+
"break-before",
|
|
583
|
+
"break-after"
|
|
584
|
+
];
|
|
585
|
+
function transformBreak(key, val) {
|
|
586
|
+
if (!breakMap.includes(key)) return;
|
|
587
|
+
const [value, important] = transformImportant(val);
|
|
588
|
+
return `${key}-${value}${important}`;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
//#endregion
|
|
592
|
+
//#region src/caption.ts
|
|
593
|
+
const captionMap = ["caption-side"];
|
|
594
|
+
function caption(key, val) {
|
|
595
|
+
if (!captionMap.includes(key)) return;
|
|
596
|
+
const [value, important] = transformImportant(val);
|
|
597
|
+
return `${getFirstName(key)}${getVal(value)}${important}`;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
//#endregion
|
|
601
|
+
//#region src/caret.ts
|
|
602
|
+
const caretMap = ["caret-color"];
|
|
603
|
+
function caret(key, val) {
|
|
604
|
+
if (!caretMap.includes(key)) return;
|
|
605
|
+
const [value, important] = transformImportant(val);
|
|
606
|
+
return `${getFirstName(key)}${getVal(value)}${important}`;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/clear.ts
|
|
611
|
+
const clearMap = ["clear"];
|
|
612
|
+
function clear(key, val) {
|
|
613
|
+
if (!clearMap.includes(key)) return;
|
|
614
|
+
const [value, important] = transformImportant(val);
|
|
615
|
+
return `${key}-${value}${important}`;
|
|
616
|
+
}
|
|
617
|
+
|
|
462
618
|
//#endregion
|
|
463
619
|
//#region src/color.ts
|
|
620
|
+
const colorMap = ["color"];
|
|
464
621
|
function color(key, val) {
|
|
622
|
+
if (!colorMap.includes(key)) return;
|
|
465
623
|
const [value, important] = transformImportant(val);
|
|
466
624
|
return `text${getVal(value)}${important}`;
|
|
467
625
|
}
|
|
468
626
|
|
|
469
627
|
//#endregion
|
|
470
628
|
//#region src/column.ts
|
|
629
|
+
const columnMap = ["column-gap"];
|
|
471
630
|
function column(key, val) {
|
|
631
|
+
if (!columnMap.includes(key)) return;
|
|
472
632
|
const [value, important] = transformImportant(val);
|
|
473
633
|
if (key === "column-gap") return `gap-x-${value}${important}`;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
//#endregion
|
|
637
|
+
//#region src/columns.ts
|
|
638
|
+
const columnsMap = ["columns"];
|
|
639
|
+
function columns(key, val) {
|
|
640
|
+
if (!columnsMap.includes(key)) return;
|
|
641
|
+
const [value, important] = transformImportant(val);
|
|
474
642
|
return `${key}-${value}${important}`;
|
|
475
643
|
}
|
|
476
644
|
|
|
477
645
|
//#endregion
|
|
478
646
|
//#region src/content.ts
|
|
647
|
+
const contentMap = ["content", "content-visibility"];
|
|
479
648
|
function content(key, val) {
|
|
480
|
-
|
|
481
|
-
|
|
649
|
+
if (!contentMap.includes(key)) return;
|
|
650
|
+
const [value, important] = transformImportant(val, false);
|
|
651
|
+
if (key === "content-visibility") return `content-visibility-${value}${important}`;
|
|
652
|
+
const match = value.match(/^(["'])(.*?)\1$/);
|
|
653
|
+
if (match) return `content-['${match[2].replace(/\s/g, "_")}']${important}`;
|
|
654
|
+
return `content-[${value}]${important}`;
|
|
482
655
|
}
|
|
483
656
|
|
|
484
657
|
//#endregion
|
|
485
658
|
//#region src/cursor.ts
|
|
659
|
+
const cursorMap = ["cursor"];
|
|
486
660
|
function cursor(key, val) {
|
|
661
|
+
if (!cursorMap.includes(key)) return;
|
|
487
662
|
const [value, important] = transformImportant(val);
|
|
488
663
|
return `${key}${getVal(value)}${important}`;
|
|
489
664
|
}
|
|
490
665
|
|
|
491
666
|
//#endregion
|
|
492
667
|
//#region src/display.ts
|
|
668
|
+
const displayMap = ["display"];
|
|
493
669
|
function display(key, val) {
|
|
670
|
+
if (!displayMap.includes(key)) return;
|
|
494
671
|
const [value, important] = transformImportant(val);
|
|
495
672
|
if (value === "none") return `hidden${important}`;
|
|
496
673
|
if (value === "hidden") return `invisible${important}`;
|
|
@@ -499,13 +676,24 @@ function display(key, val) {
|
|
|
499
676
|
|
|
500
677
|
//#endregion
|
|
501
678
|
//#region src/empty.ts
|
|
502
|
-
const
|
|
679
|
+
const emptyKey = {
|
|
503
680
|
show: "visible",
|
|
504
681
|
hide: "hidden"
|
|
505
682
|
};
|
|
683
|
+
const emptyMap = ["empty-cells"];
|
|
506
684
|
function empty(key, val) {
|
|
685
|
+
if (!emptyMap.includes(key)) return;
|
|
507
686
|
const [value, important] = transformImportant(val);
|
|
508
|
-
return `table-empty-cells-${
|
|
687
|
+
if (emptyKey[value]) return `table-empty-cells-${emptyKey[value]}${important}`;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
//#endregion
|
|
691
|
+
//#region src/fill.ts
|
|
692
|
+
const fillMap = ["fill"];
|
|
693
|
+
function fill(key, val) {
|
|
694
|
+
if (!fillMap.includes(key)) return;
|
|
695
|
+
const [value, important] = transformImportant(val);
|
|
696
|
+
return `${key}-${value}${important}`;
|
|
509
697
|
}
|
|
510
698
|
|
|
511
699
|
//#endregion
|
|
@@ -515,8 +703,16 @@ const lastMaps = [
|
|
|
515
703
|
"flex-grow",
|
|
516
704
|
"flex-shrink"
|
|
517
705
|
];
|
|
706
|
+
const flexMap = [
|
|
707
|
+
"flex",
|
|
708
|
+
"flex-grow",
|
|
709
|
+
"flex-shrink",
|
|
710
|
+
"flex-basis",
|
|
711
|
+
"flex-wrap",
|
|
712
|
+
"flex-direction"
|
|
713
|
+
];
|
|
518
714
|
function flex(key, val) {
|
|
519
|
-
if (
|
|
715
|
+
if (!flexMap.includes(key)) return;
|
|
520
716
|
const [value, important] = transformImportant(val);
|
|
521
717
|
if (lastMaps.includes(key)) return `${getLastName(key)}${getVal(value)}${important}`;
|
|
522
718
|
if (value === "1") return `flex-1${important}`;
|
|
@@ -528,14 +724,25 @@ function flex(key, val) {
|
|
|
528
724
|
|
|
529
725
|
//#endregion
|
|
530
726
|
//#region src/float.ts
|
|
727
|
+
const floatMap = ["float"];
|
|
531
728
|
function float(key, val) {
|
|
729
|
+
if (!floatMap.includes(key)) return;
|
|
532
730
|
const [value, important] = transformImportant(val);
|
|
533
|
-
return `${key}-${value}${important}`;
|
|
731
|
+
return `${key}-${getLastName(value)}${important}`;
|
|
534
732
|
}
|
|
535
733
|
|
|
536
734
|
//#endregion
|
|
537
735
|
//#region src/font.ts
|
|
736
|
+
const fontMap = [
|
|
737
|
+
"font",
|
|
738
|
+
"font-size",
|
|
739
|
+
"font-weight",
|
|
740
|
+
"font-family",
|
|
741
|
+
"font-style",
|
|
742
|
+
"font-variant-numeric"
|
|
743
|
+
];
|
|
538
744
|
function font(key, val) {
|
|
745
|
+
if (!fontMap.includes(key)) return;
|
|
539
746
|
const [value, important] = transformImportant(val);
|
|
540
747
|
if (key === "font-size") {
|
|
541
748
|
if ([
|
|
@@ -547,7 +754,7 @@ function font(key, val) {
|
|
|
547
754
|
].includes(value)) return `font-size-${value}${important}`;
|
|
548
755
|
return `text-${value}${important}`;
|
|
549
756
|
}
|
|
550
|
-
if (key === "font-weight") return `font
|
|
757
|
+
if (key === "font-weight") return `font${getVal(value)}${important}`;
|
|
551
758
|
if (key === "font-family") {
|
|
552
759
|
const match = value.match(/ui-(\w{0,4})/);
|
|
553
760
|
if (!match) return `font-[${joinWithUnderLine(val)}]${important}`;
|
|
@@ -568,38 +775,84 @@ function transformFont(v) {
|
|
|
568
775
|
return v.split(" ").map((item) => /^\d/.test(item) ? `text-${item}` : item).join(" ");
|
|
569
776
|
}
|
|
570
777
|
|
|
778
|
+
//#endregion
|
|
779
|
+
//#region src/gap.ts
|
|
780
|
+
const gapMap = [
|
|
781
|
+
"gap",
|
|
782
|
+
"gap-x",
|
|
783
|
+
"gap-y"
|
|
784
|
+
];
|
|
785
|
+
function gap(key, val) {
|
|
786
|
+
if (!gapMap.includes(key)) return;
|
|
787
|
+
const [value, important] = transformImportant(val);
|
|
788
|
+
if (key.startsWith("column")) return `gap-x${getVal(value)}${important}`;
|
|
789
|
+
if (key.startsWith("row")) return `gap-y${getVal(value)}${important}`;
|
|
790
|
+
return `gap${getVal(value)}${important}`;
|
|
791
|
+
}
|
|
792
|
+
|
|
571
793
|
//#endregion
|
|
572
794
|
//#region src/grid.ts
|
|
795
|
+
const gridMap = [
|
|
796
|
+
"grid",
|
|
797
|
+
"grid-row",
|
|
798
|
+
"grid-column",
|
|
799
|
+
"grid-template-columns",
|
|
800
|
+
"grid-template-rows",
|
|
801
|
+
"grid-auto-flow",
|
|
802
|
+
"grid-auto-columns",
|
|
803
|
+
"grid-auto-rows",
|
|
804
|
+
"grid-column-start",
|
|
805
|
+
"grid-column-end",
|
|
806
|
+
"grid-row-start",
|
|
807
|
+
"grid-row-end"
|
|
808
|
+
];
|
|
573
809
|
function grid(key, val) {
|
|
810
|
+
if (!gridMap.includes(key)) return;
|
|
574
811
|
const [value, important] = transformImportant(val);
|
|
575
812
|
if (key.startsWith("grid-template")) {
|
|
576
|
-
const matcher$1 = value.match(
|
|
813
|
+
const matcher$1 = value.match(/^repeat\s*\(\s*(\d+)/);
|
|
577
814
|
if (matcher$1) return `grid-${getLastName(key) === "rows" ? "rows" : "cols"}-${matcher$1[1]}${important}`;
|
|
578
|
-
|
|
815
|
+
if (value.startsWith("repeat(")) return;
|
|
816
|
+
return `grid-${getLastName(key) === "rows" ? "rows" : "cols"}${value.includes(" ") ? `-[${joinWithUnderLine(value)}]` : getVal(value)}${important}`;
|
|
579
817
|
}
|
|
580
818
|
if (key === "grid-auto-flow") return `grid-flow-${joinWithLine(value).replace("column", "col")}${important}`;
|
|
581
819
|
if (key.startsWith("grid-auto")) {
|
|
582
|
-
|
|
583
|
-
return `auto-${getLastName(key) === "rows" ? "rows" : "cols"}-${
|
|
820
|
+
if (/\d/.test(value)) return `auto-${getLastName(key) === "rows" ? "rows" : "cols"}-[${joinWithUnderLine(value)}]${important}`;
|
|
821
|
+
return `auto-${getLastName(key) === "rows" ? "rows" : "cols"}-${getFirstName(value)}${important}`;
|
|
822
|
+
}
|
|
823
|
+
const matcher = value.match(/span\s+([^/]+)\/\s*span\s+(.*)/);
|
|
824
|
+
if (matcher) {
|
|
825
|
+
if (matcher[1] !== matcher[2]) return;
|
|
826
|
+
return `${key.slice(5).replace("column", "col")}-span${getVal(matcher[1])}${important}`;
|
|
584
827
|
}
|
|
585
|
-
const matcher = value.match(/span\s+(\d)/);
|
|
586
|
-
if (matcher) return `${key.slice(5).replace("column", "col")}-span-${matcher[1]}${important}`;
|
|
587
828
|
if (value === "1/-1") return `${key.slice(5).replace("column", "col")}-span-full${important}`;
|
|
588
|
-
return `${key.slice(5).replace("column", "col")}
|
|
829
|
+
return `${key.slice(5).replace("column", "col")}${getVal(value)}${important}`;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
//#endregion
|
|
833
|
+
//#region src/hyphens.ts
|
|
834
|
+
const hyphensMap = ["hyphens"];
|
|
835
|
+
function hyphens(key, val) {
|
|
836
|
+
if (!hyphensMap.includes(key)) return;
|
|
837
|
+
const [value, important] = transformImportant(val);
|
|
838
|
+
return `${key}${getVal(value)}${important}`;
|
|
589
839
|
}
|
|
590
840
|
|
|
591
841
|
//#endregion
|
|
592
842
|
//#region src/inset.ts
|
|
843
|
+
const insetMap = ["inset-inline-start", "inset-inline-end"];
|
|
593
844
|
function inset(key, val) {
|
|
845
|
+
if (!insetMap.includes(key)) return;
|
|
594
846
|
const [value, important] = transformImportant(val);
|
|
595
847
|
if (key === "inset-inline-start") return `start${getVal(value)}${important}`;
|
|
596
848
|
if (key === "inset-inline-end") return `end${getVal(value)}${important}`;
|
|
597
|
-
return void 0;
|
|
598
849
|
}
|
|
599
850
|
|
|
600
851
|
//#endregion
|
|
601
852
|
//#region src/isolation.ts
|
|
853
|
+
const isolationMap = ["isolation"];
|
|
602
854
|
function isolation(key, val) {
|
|
855
|
+
if (!isolationMap.includes(key)) return;
|
|
603
856
|
const [value, important] = transformImportant(val);
|
|
604
857
|
if (val === "isolate") return `${value}${important}`;
|
|
605
858
|
return `${key}-${value}${important}`;
|
|
@@ -607,22 +860,32 @@ function isolation(key, val) {
|
|
|
607
860
|
|
|
608
861
|
//#endregion
|
|
609
862
|
//#region src/justify.ts
|
|
863
|
+
const justifyMap = [
|
|
864
|
+
"justify",
|
|
865
|
+
"justify-content",
|
|
866
|
+
"justify-items",
|
|
867
|
+
"justify-self"
|
|
868
|
+
];
|
|
610
869
|
function justify(key, val) {
|
|
870
|
+
if (!justifyMap.includes(key)) return;
|
|
611
871
|
const [value, important] = transformImportant(val);
|
|
872
|
+
if (value.includes(" ")) return;
|
|
612
873
|
if (key === "justify-content") return `justify-${getLastName(value)}${important}`;
|
|
613
874
|
return `${key}-${getLastName(value)}${important}`;
|
|
614
875
|
}
|
|
615
876
|
|
|
616
877
|
//#endregion
|
|
617
878
|
//#region src/letter.ts
|
|
879
|
+
const letterMap = ["letter-spacing"];
|
|
618
880
|
function letter(key, val) {
|
|
881
|
+
if (!letterMap.includes(key)) return;
|
|
619
882
|
const [value, important] = transformImportant(val);
|
|
620
|
-
return `tracking
|
|
883
|
+
return `tracking${getVal(value)}${important}`;
|
|
621
884
|
}
|
|
622
885
|
|
|
623
886
|
//#endregion
|
|
624
887
|
//#region src/line.ts
|
|
625
|
-
const
|
|
888
|
+
const lineKey = {
|
|
626
889
|
1: "none",
|
|
627
890
|
1.25: "tight",
|
|
628
891
|
1.375: "snug",
|
|
@@ -630,16 +893,29 @@ const lineMap = {
|
|
|
630
893
|
1.625: "relaxed",
|
|
631
894
|
2: "loose"
|
|
632
895
|
};
|
|
896
|
+
const lineMap = ["line-height"];
|
|
633
897
|
function line(key, val) {
|
|
898
|
+
if (!lineMap.includes(key)) return;
|
|
634
899
|
const [value, important] = transformImportant(val);
|
|
635
|
-
if (value in
|
|
900
|
+
if (value in lineKey) return `lh-${lineKey[value]}${important}`;
|
|
636
901
|
return `lh${getVal(value, (v) => /\d$/.test(v) ? `[${v}]` : v)}${important}`;
|
|
637
902
|
}
|
|
638
903
|
|
|
639
904
|
//#endregion
|
|
640
905
|
//#region src/list.ts
|
|
906
|
+
const listMap = [
|
|
907
|
+
"list-style",
|
|
908
|
+
"list-style-type",
|
|
909
|
+
"list-style-position",
|
|
910
|
+
"list-style-image"
|
|
911
|
+
];
|
|
641
912
|
function list(key, val) {
|
|
913
|
+
if (!listMap.includes(key)) return;
|
|
642
914
|
const [value, important] = transformImportant(val);
|
|
915
|
+
if (key === "list-style-image") {
|
|
916
|
+
if (value === "none") return `${getFirstName(key)}-none${important}`;
|
|
917
|
+
return `${getFirstName(key)}${getVal(value)}${important}`;
|
|
918
|
+
}
|
|
643
919
|
return `${getFirstName(key)}${getVal(value)}${important}`;
|
|
644
920
|
}
|
|
645
921
|
|
|
@@ -673,33 +949,49 @@ function transformMargin(key, val) {
|
|
|
673
949
|
|
|
674
950
|
//#endregion
|
|
675
951
|
//#region src/mask.ts
|
|
952
|
+
const maskMap = [
|
|
953
|
+
"mask-position",
|
|
954
|
+
"mask-origin",
|
|
955
|
+
"mask-repeat",
|
|
956
|
+
"mask-size",
|
|
957
|
+
"mask-type",
|
|
958
|
+
"mask-image",
|
|
959
|
+
"mask-mode",
|
|
960
|
+
"mask-composite",
|
|
961
|
+
"mask-clip",
|
|
962
|
+
"mask-type"
|
|
963
|
+
];
|
|
676
964
|
function mask(key, val) {
|
|
965
|
+
if (!maskMap.includes(key)) return;
|
|
677
966
|
const [value, important] = transformImportant(val);
|
|
678
967
|
if ([
|
|
679
968
|
"mask-clip",
|
|
680
969
|
"mask-origin",
|
|
681
970
|
"mask-type"
|
|
682
|
-
].includes(key)) return `${
|
|
683
|
-
if (["mask-mode", "mask-composite"].includes(key)) return `${
|
|
971
|
+
].includes(key)) return `${key}-${getFirstName(value)}${important}`;
|
|
972
|
+
if (["mask-mode", "mask-composite"].includes(key)) return `${getFirstName(key)}-${getFirstName(value)}${important}`;
|
|
684
973
|
if (["mask-position", "mask-size"].includes(key)) {
|
|
685
974
|
if (isCalc(value) || isUrl(value) || isHex(value) || isRgb(value) || isHsl(value) || isPercent(value) || isVar(value) || isCubicBezier(value)) return `${important}${key}${getVal(value)}`;
|
|
686
975
|
if (/\d/.test(value)) return `${important}[${key}:${joinWithUnderLine(value)}]`;
|
|
687
976
|
return `${important}${getFirstName(key)}-${joinWithLine(value)}`;
|
|
688
977
|
}
|
|
689
|
-
if (key === "mask-repeat")
|
|
978
|
+
if (key === "mask-repeat") {
|
|
979
|
+
if (value.includes("-")) return `mask-${value}${important}`;
|
|
980
|
+
return `${key}-${value}${important}`;
|
|
981
|
+
}
|
|
690
982
|
if (key === "mask-image") {
|
|
691
983
|
const type = getGradient(value);
|
|
692
984
|
if (type) {
|
|
693
985
|
const newValue = value.replace(/rgba?\(([^)]+)\)/g, (all, v) => all.replace(v, v.replace(/\s*,\s*/g, commaReplacer)));
|
|
694
986
|
const matcher = newValue.match(linearGradientReg);
|
|
695
|
-
if (!matcher) return
|
|
987
|
+
if (!matcher) return `[${key}:${joinWithUnderLine(value)}]${important}`;
|
|
696
988
|
let [direction, from, via, to] = matcher.slice(1);
|
|
697
989
|
direction = direction.split(" ").map((item) => item[0]).join("");
|
|
698
990
|
return direction ? `${getLinearGradientPosition(`mask-${direction}`, from, via, to).trim()}` : getLinearGradientPosition(`mask-${type}`, from, via, to).trim();
|
|
699
991
|
}
|
|
700
|
-
return
|
|
992
|
+
return `mask${getVal(value)}${important}`;
|
|
701
993
|
}
|
|
702
|
-
return `${
|
|
994
|
+
return `${key}${getVal(value)}${important}`;
|
|
703
995
|
}
|
|
704
996
|
function getLinearGradientPosition(prefix, from, via, to) {
|
|
705
997
|
let result = "";
|
|
@@ -710,28 +1002,44 @@ function getLinearGradientPosition(prefix, from, via, to) {
|
|
|
710
1002
|
if (from) {
|
|
711
1003
|
from = from.replaceAll(commaReplacer, ",");
|
|
712
1004
|
const [fromColor, fromPosition] = from.split(" ");
|
|
713
|
-
if (fromPosition) result += ` ${prefix}-from="${isRgb(fromColor) ? `[${fromColor}]` : fromColor} ${fromPosition}"`;
|
|
714
|
-
else if (fromColor) result += ` ${prefix}-from-${isRgb(fromColor) ? `[${fromColor}]` : fromColor}`;
|
|
1005
|
+
if (fromPosition) result += ` ${prefix}-from="${isRgb(fromColor) || isVar(fromColor) ? `[${fromColor}]` : fromColor} ${fromPosition}"`;
|
|
1006
|
+
else if (fromColor) result += ` ${prefix}-from-${isRgb(fromColor) || isVar(fromColor) ? `[${fromColor}]` : fromColor}`;
|
|
715
1007
|
}
|
|
716
1008
|
if (via) {
|
|
717
1009
|
via = via.replaceAll(commaReplacer, ",");
|
|
718
1010
|
const [viaColor, viaPosition] = via.split(" ");
|
|
719
|
-
if (viaPosition) result += ` ${prefix}-via="${isRgb(viaColor) ? `[${viaColor}]` : viaColor} ${viaPosition}"`;
|
|
720
|
-
else if (viaColor) result += ` ${prefix}-via${isRgb(viaColor) ? `[${viaColor}]` : viaColor}`;
|
|
1011
|
+
if (viaPosition) result += ` ${prefix}-via="${isRgb(viaColor) || isVar(viaColor) ? `[${viaColor}]` : viaColor} ${viaPosition}"`;
|
|
1012
|
+
else if (viaColor) result += ` ${prefix}-via${isRgb(viaColor) || isVar(viaColor) ? `[${viaColor}]` : viaColor}`;
|
|
721
1013
|
}
|
|
722
1014
|
if (to) {
|
|
723
1015
|
to = to.replaceAll(commaReplacer, ",");
|
|
724
1016
|
const [toColor, toPosition] = to.split(" ");
|
|
725
|
-
if (toPosition) result += ` ${prefix}-to="${isRgb(toColor) ? `[${toColor}]` : toColor} ${toPosition}"`;
|
|
726
|
-
else if (toColor) result += ` ${prefix}-to-${isRgb(toColor) ? `[${toColor}]` : toColor}`;
|
|
1017
|
+
if (toPosition) result += ` ${prefix}-to="${isRgb(toColor) || isVar(toColor) ? `[${toColor}]` : toColor} ${toPosition}"`;
|
|
1018
|
+
else if (toColor) result += ` ${prefix}-to-${isRgb(toColor) || isVar(toColor) ? `[${toColor}]` : toColor}`;
|
|
727
1019
|
}
|
|
728
1020
|
return result;
|
|
729
1021
|
}
|
|
730
1022
|
|
|
731
1023
|
//#endregion
|
|
732
1024
|
//#region src/max.ts
|
|
1025
|
+
const maxMap = [
|
|
1026
|
+
"max-height",
|
|
1027
|
+
"max-width",
|
|
1028
|
+
"max-block-size",
|
|
1029
|
+
"max-inline-size",
|
|
1030
|
+
"min-height",
|
|
1031
|
+
"min-width",
|
|
1032
|
+
"min-block-size",
|
|
1033
|
+
"min-inline-size"
|
|
1034
|
+
];
|
|
733
1035
|
function max(key, val) {
|
|
1036
|
+
if (!maxMap.includes(key)) return;
|
|
734
1037
|
const [value, important] = transformImportant(val);
|
|
1038
|
+
if (/(?:max|min)-(?:inline|block)-size/.test(key)) {
|
|
1039
|
+
const fixedKey = key.split("-").slice(0, 2).join("-");
|
|
1040
|
+
if (/\d/.test(value) || isVar(value) || isCalc(value)) return `${fixedKey}${getVal(value)}${important}`;
|
|
1041
|
+
return `${fixedKey}-${getFirstName(value)}${important}`;
|
|
1042
|
+
}
|
|
735
1043
|
const all = key.split("-");
|
|
736
1044
|
const attributeValue = isCalc(value) || isVar(value) ? getVal(value) : getVal(getFirstName(value));
|
|
737
1045
|
return `${all[0]}-${all[1][0]}${attributeValue}${important}`;
|
|
@@ -739,38 +1047,72 @@ function max(key, val) {
|
|
|
739
1047
|
|
|
740
1048
|
//#endregion
|
|
741
1049
|
//#region src/mix.ts
|
|
1050
|
+
const mixMap = ["mix-blend-mode"];
|
|
742
1051
|
function mix(key, val) {
|
|
1052
|
+
if (!mixMap.includes(key)) return;
|
|
743
1053
|
const [value, important] = transformImportant(val);
|
|
744
1054
|
return `mix-blend-${value}${important}`;
|
|
745
1055
|
}
|
|
746
1056
|
|
|
747
1057
|
//#endregion
|
|
748
1058
|
//#region src/object.ts
|
|
1059
|
+
const objectMap = ["object-fit", "object-position"];
|
|
749
1060
|
function object(key, val) {
|
|
1061
|
+
if (!objectMap.includes(key)) return;
|
|
750
1062
|
const [value, important] = transformImportant(val);
|
|
751
|
-
if (key === "object-position")
|
|
1063
|
+
if (key === "object-position") {
|
|
1064
|
+
if (isVar(value)) return `${getFirstName(key)}${getVal(value)}${important}`;
|
|
1065
|
+
return `${getFirstName(key)}-${joinWithLine(value)}${important}`;
|
|
1066
|
+
}
|
|
752
1067
|
return `${getFirstName(key)}-${value}${important}`;
|
|
753
1068
|
}
|
|
754
1069
|
|
|
755
1070
|
//#endregion
|
|
756
1071
|
//#region src/opacity.ts
|
|
1072
|
+
const opacityMap = ["opacity"];
|
|
757
1073
|
function opacity(key, val) {
|
|
1074
|
+
if (!opacityMap.includes(key)) return;
|
|
758
1075
|
const [value, important] = transformImportant(val);
|
|
759
|
-
|
|
760
|
-
return
|
|
1076
|
+
const hundred = getHundred(value);
|
|
1077
|
+
if (Number.isNaN(hundred)) return `${key}${getVal(value)}${important}`;
|
|
1078
|
+
return `op-${hundred}${important}`;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
//#endregion
|
|
1082
|
+
//#region src/order.ts
|
|
1083
|
+
const orderMap = ["order"];
|
|
1084
|
+
function order(key, val) {
|
|
1085
|
+
if (!orderMap.includes(key)) return;
|
|
1086
|
+
const [value, important] = transformImportant(val);
|
|
1087
|
+
return `${key}${getVal(value)}${important}`;
|
|
761
1088
|
}
|
|
762
1089
|
|
|
763
1090
|
//#endregion
|
|
764
1091
|
//#region src/outline.ts
|
|
1092
|
+
const outlineMap = [
|
|
1093
|
+
"outline-width",
|
|
1094
|
+
"outline-style",
|
|
1095
|
+
"outline-offset",
|
|
1096
|
+
"outline",
|
|
1097
|
+
"outline-color"
|
|
1098
|
+
];
|
|
765
1099
|
function outline(key, val) {
|
|
1100
|
+
if (!outlineMap.includes(key)) return;
|
|
766
1101
|
const [value, important] = transformImportant(val);
|
|
767
|
-
if (key === "outline-offset") return `${key}
|
|
768
|
-
return `${getFirstName(key)}
|
|
1102
|
+
if (key === "outline-offset") return `${key}${getVal(value)}${important}`;
|
|
1103
|
+
return `${getFirstName(key)}${getVal(value)}${important}`;
|
|
769
1104
|
}
|
|
770
1105
|
|
|
771
1106
|
//#endregion
|
|
772
1107
|
//#region src/word.ts
|
|
1108
|
+
const wordMap = [
|
|
1109
|
+
"word-break",
|
|
1110
|
+
"word-spacing",
|
|
1111
|
+
"word-wrap",
|
|
1112
|
+
"overflow-wrap"
|
|
1113
|
+
];
|
|
773
1114
|
function word(key, val) {
|
|
1115
|
+
if (!wordMap.includes(key)) return;
|
|
774
1116
|
const [value, important] = transformImportant(val);
|
|
775
1117
|
if (key.startsWith("word-spacing")) return `word-spacing${getVal(val)}${important}`;
|
|
776
1118
|
if (value === "keep-all") return `break-keep${important}`;
|
|
@@ -780,7 +1122,14 @@ function word(key, val) {
|
|
|
780
1122
|
|
|
781
1123
|
//#endregion
|
|
782
1124
|
//#region src/overflow.ts.ts
|
|
1125
|
+
const overflowMap = [
|
|
1126
|
+
"overflow",
|
|
1127
|
+
"overflow-x",
|
|
1128
|
+
"overflow-y",
|
|
1129
|
+
"overflow-wrap"
|
|
1130
|
+
];
|
|
783
1131
|
function overflow(key, val) {
|
|
1132
|
+
if (!overflowMap.includes(key)) return;
|
|
784
1133
|
const [value, important] = transformImportant(val);
|
|
785
1134
|
if (key === "overflow-wrap") return word(key, val);
|
|
786
1135
|
return `${key}-${value}${important}`;
|
|
@@ -788,27 +1137,71 @@ function overflow(key, val) {
|
|
|
788
1137
|
|
|
789
1138
|
//#endregion
|
|
790
1139
|
//#region src/overscroll.ts
|
|
1140
|
+
const overscrollMap = [
|
|
1141
|
+
"overscroll-behavior",
|
|
1142
|
+
"overscroll-behavior-x",
|
|
1143
|
+
"overscroll-behavior-y"
|
|
1144
|
+
];
|
|
791
1145
|
function overscroll(key, val) {
|
|
1146
|
+
if (!overscrollMap.includes(key)) return;
|
|
792
1147
|
const [value, important] = transformImportant(val);
|
|
793
1148
|
const [prefix, _, suffix] = key.split("-");
|
|
794
1149
|
if (suffix) return `${prefix}-${suffix}-${value}${important}`;
|
|
795
1150
|
return `${prefix}-${value}${important}`;
|
|
796
1151
|
}
|
|
797
1152
|
|
|
1153
|
+
//#endregion
|
|
1154
|
+
//#region src/perspective.ts
|
|
1155
|
+
const perspectiveMap = ["perspective", "perspective-origin"];
|
|
1156
|
+
function perspective(key, val) {
|
|
1157
|
+
if (!perspectiveMap.includes(key)) return;
|
|
1158
|
+
const [value, important] = transformImportant(val);
|
|
1159
|
+
return `${key}${getVal(value, joinWithLine)}${important}`;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
798
1162
|
//#endregion
|
|
799
1163
|
//#region src/place.ts
|
|
1164
|
+
const placeMap = [
|
|
1165
|
+
"place-content",
|
|
1166
|
+
"place-items",
|
|
1167
|
+
"place-self"
|
|
1168
|
+
];
|
|
800
1169
|
function place(key, val) {
|
|
1170
|
+
if (!placeMap.includes(key)) return;
|
|
1171
|
+
const [value, important] = transformImportant(val);
|
|
1172
|
+
if (value.includes(" ")) return;
|
|
1173
|
+
return `${key}-${getLastName(value)}${important}`;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
//#endregion
|
|
1177
|
+
//#region src/pointer.ts
|
|
1178
|
+
const pointerMap = ["pointer-events"];
|
|
1179
|
+
function pointer(key, val) {
|
|
1180
|
+
if (!pointerMap.includes(key)) return;
|
|
801
1181
|
const [value, important] = transformImportant(val);
|
|
802
1182
|
return `${key}-${getLastName(value)}${important}`;
|
|
803
1183
|
}
|
|
804
1184
|
|
|
1185
|
+
//#endregion
|
|
1186
|
+
//#region src/position.ts
|
|
1187
|
+
const positionMap$1 = ["position"];
|
|
1188
|
+
function position(key, val) {
|
|
1189
|
+
if (!positionMap$1.includes(key)) return;
|
|
1190
|
+
const [value, important] = transformImportant(val);
|
|
1191
|
+
if (value === "none") return `hidden${important}`;
|
|
1192
|
+
if (value === "hidden") return `invisible${important}`;
|
|
1193
|
+
return `${value}${important}`;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
805
1196
|
//#endregion
|
|
806
1197
|
//#region src/resize.ts
|
|
807
1198
|
const map = {
|
|
808
1199
|
vertical: "y",
|
|
809
1200
|
horizontal: "x"
|
|
810
1201
|
};
|
|
1202
|
+
const resizeMap = ["resize"];
|
|
811
1203
|
function resize(key, val) {
|
|
1204
|
+
if (!resizeMap.includes(key)) return;
|
|
812
1205
|
const [value, important] = transformImportant(val);
|
|
813
1206
|
if (value === "both") return `${key}${important}`;
|
|
814
1207
|
return `${key}-${map[value] || value}${important}`;
|
|
@@ -816,7 +1209,9 @@ function resize(key, val) {
|
|
|
816
1209
|
|
|
817
1210
|
//#endregion
|
|
818
1211
|
//#region src/rotate.ts
|
|
1212
|
+
const rotateMap = ["rotate"];
|
|
819
1213
|
function rotate(key, val) {
|
|
1214
|
+
if (!rotateMap.includes(key)) return;
|
|
820
1215
|
const [value, important] = transformImportant(val);
|
|
821
1216
|
if (value.includes(" ")) return `rotate-[${joinWithUnderLine(value)}]${important}`;
|
|
822
1217
|
return `rotate${getVal(value)}${important}`;
|
|
@@ -824,34 +1219,116 @@ function rotate(key, val) {
|
|
|
824
1219
|
|
|
825
1220
|
//#endregion
|
|
826
1221
|
//#region src/row.ts
|
|
1222
|
+
const rowMap = ["row-gap"];
|
|
827
1223
|
function row(key, val) {
|
|
1224
|
+
if (!rowMap.includes(key)) return;
|
|
828
1225
|
const [value, important] = transformImportant(val);
|
|
829
|
-
return `gap-y
|
|
1226
|
+
return `gap-y${getVal(value)}${important}`;
|
|
830
1227
|
}
|
|
831
1228
|
|
|
832
1229
|
//#endregion
|
|
833
1230
|
//#region src/scroll.ts
|
|
1231
|
+
const scrollMap = [
|
|
1232
|
+
"scroll-snap-type",
|
|
1233
|
+
"scroll-snap-stop",
|
|
1234
|
+
"scroll-snap-align",
|
|
1235
|
+
"scroll-padding",
|
|
1236
|
+
"scroll-padding-inline",
|
|
1237
|
+
"scroll-padding-block",
|
|
1238
|
+
"scroll-padding-inline-start",
|
|
1239
|
+
"scroll-padding-inline-end",
|
|
1240
|
+
"scroll-padding-block-start",
|
|
1241
|
+
"scroll-padding-block-end",
|
|
1242
|
+
"scroll-padding-top",
|
|
1243
|
+
"scroll-padding-right",
|
|
1244
|
+
"scroll-padding-bottom",
|
|
1245
|
+
"scroll-padding-left",
|
|
1246
|
+
"scroll-margin",
|
|
1247
|
+
"scroll-margin-inline",
|
|
1248
|
+
"scroll-margin-block",
|
|
1249
|
+
"scroll-margin-inline-start",
|
|
1250
|
+
"scroll-margin-inline-end",
|
|
1251
|
+
"scroll-margin-block-start",
|
|
1252
|
+
"scroll-margin-block-end",
|
|
1253
|
+
"scroll-margin-top",
|
|
1254
|
+
"scroll-margin-right",
|
|
1255
|
+
"scroll-margin-bottom",
|
|
1256
|
+
"scroll-margin-left",
|
|
1257
|
+
"scroll-behavior"
|
|
1258
|
+
];
|
|
834
1259
|
function scroll(key, val) {
|
|
1260
|
+
if (!scrollMap.includes(key)) return;
|
|
835
1261
|
const [value, important] = transformImportant(val);
|
|
836
|
-
if (key.startsWith("scroll-snap"))
|
|
1262
|
+
if (key.startsWith("scroll-snap")) {
|
|
1263
|
+
if (value.includes(" ")) {
|
|
1264
|
+
const [pre, after] = value.split(" ");
|
|
1265
|
+
return `snap-${pre}${getVal(after)}${important}`;
|
|
1266
|
+
}
|
|
1267
|
+
return `snap-${value}${important}`;
|
|
1268
|
+
}
|
|
837
1269
|
if (key === "scroll-behavior") return `scroll-${value}${important}`;
|
|
838
1270
|
const [_, prefix, suffix, way] = key.match(/scroll-(margin|padding)-?(\w+)?-?(\w+)?/);
|
|
839
1271
|
if (suffix === "inline" && way) return `scroll-${prefix[0]}${way[0]}${getVal(value)}${important}`;
|
|
840
1272
|
if (suffix) return `scroll-${prefix[0]}${suffix[0]}${getVal(value)}${important}`;
|
|
841
|
-
return `scroll-${prefix[0]}
|
|
1273
|
+
return `scroll-${prefix[0]}${getVal(value)}${important}`;
|
|
842
1274
|
}
|
|
843
1275
|
|
|
844
1276
|
//#endregion
|
|
845
1277
|
//#region src/size.ts
|
|
1278
|
+
const sizeMap = [
|
|
1279
|
+
"z-index",
|
|
1280
|
+
"width",
|
|
1281
|
+
"height"
|
|
1282
|
+
];
|
|
846
1283
|
function size(key, val) {
|
|
1284
|
+
if (!sizeMap.includes(key)) return;
|
|
1285
|
+
let [value, important] = transformImportant(val);
|
|
1286
|
+
let prefix = "";
|
|
1287
|
+
if (value.startsWith("-")) {
|
|
1288
|
+
prefix = "-";
|
|
1289
|
+
value = value.slice(1);
|
|
1290
|
+
}
|
|
1291
|
+
if (isCalc(value) || isVar(value) || /\d/.test(value)) return `${prefix}${key[0]}${getVal(value)}${important}`;
|
|
1292
|
+
return `${key[0]}-${getFirstName(value)}${important}`;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
//#endregion
|
|
1296
|
+
//#region src/stroke.ts
|
|
1297
|
+
const strokeMap = ["stroke", "stroke-width"];
|
|
1298
|
+
function stroke(key, val) {
|
|
1299
|
+
if (!strokeMap.includes(key)) return;
|
|
847
1300
|
const [value, important] = transformImportant(val);
|
|
848
|
-
|
|
849
|
-
|
|
1301
|
+
return `${getFirstName(key)}${getVal(value)}${important}`;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
//#endregion
|
|
1305
|
+
//#region src/table.ts
|
|
1306
|
+
const tableMap = ["table-layout"];
|
|
1307
|
+
function table(key, val) {
|
|
1308
|
+
if (!tableMap.includes(key)) return;
|
|
1309
|
+
const [value, important] = transformImportant(val);
|
|
1310
|
+
return `${getFirstName(key)}${getVal(value)}${important}`;
|
|
850
1311
|
}
|
|
851
1312
|
|
|
852
1313
|
//#endregion
|
|
853
1314
|
//#region src/text.ts
|
|
1315
|
+
const textMap = [
|
|
1316
|
+
"text-align",
|
|
1317
|
+
"text-align-last",
|
|
1318
|
+
"text-decoration-line",
|
|
1319
|
+
"text-decoration-style",
|
|
1320
|
+
"text-decoration-color",
|
|
1321
|
+
"text-decoration-thickness",
|
|
1322
|
+
"text-indent",
|
|
1323
|
+
"text-underline-offset",
|
|
1324
|
+
"text-transform",
|
|
1325
|
+
"text-wrap",
|
|
1326
|
+
"text-overflow",
|
|
1327
|
+
"text-justify",
|
|
1328
|
+
"text-shadow"
|
|
1329
|
+
];
|
|
854
1330
|
function text(key, val) {
|
|
1331
|
+
if (!textMap.includes(key)) return;
|
|
855
1332
|
const [value, important] = transformImportant(val);
|
|
856
1333
|
if (key === "text-decoration-line") {
|
|
857
1334
|
if (value === "none") return `no-underline${important}`;
|
|
@@ -862,7 +1339,7 @@ function text(key, val) {
|
|
|
862
1339
|
return `${value}${important}`;
|
|
863
1340
|
}
|
|
864
1341
|
if (key.startsWith("text-decoration") || key === "text-indent") return `${key.split("-")[1]}${getVal(value)}${important}`;
|
|
865
|
-
if (key === "text-underline-offset") return `underline-offset
|
|
1342
|
+
if (key === "text-underline-offset") return `underline-offset${getVal(value)}${important}`;
|
|
866
1343
|
if (key === "text-align-last") return `${important}[${key}:${value}]`;
|
|
867
1344
|
if ([
|
|
868
1345
|
"inherit",
|
|
@@ -871,21 +1348,46 @@ function text(key, val) {
|
|
|
871
1348
|
"unset",
|
|
872
1349
|
"revert-layer"
|
|
873
1350
|
].includes(value)) return `${important}text-align-${value}`;
|
|
874
|
-
return `text
|
|
1351
|
+
return `text${getVal(value)}${important}`;
|
|
875
1352
|
}
|
|
876
1353
|
|
|
877
1354
|
//#endregion
|
|
878
1355
|
//#region src/top.ts
|
|
1356
|
+
const topMap = [
|
|
1357
|
+
"top",
|
|
1358
|
+
"right",
|
|
1359
|
+
"bottom",
|
|
1360
|
+
"left"
|
|
1361
|
+
];
|
|
879
1362
|
function top(key, val) {
|
|
1363
|
+
if (!topMap.includes(key)) return;
|
|
880
1364
|
const [value, important] = transformImportant(val);
|
|
881
1365
|
return `${key}${getVal(value)}${important}`;
|
|
882
1366
|
}
|
|
883
1367
|
|
|
1368
|
+
//#endregion
|
|
1369
|
+
//#region src/touch.ts
|
|
1370
|
+
const touchMap = ["touch-action"];
|
|
1371
|
+
function touch(key, val) {
|
|
1372
|
+
if (!touchMap.includes(key)) return;
|
|
1373
|
+
const [value, important] = transformImportant(val);
|
|
1374
|
+
return `${getFirstName(key)}${getVal(value)}${important}`;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
884
1377
|
//#endregion
|
|
885
1378
|
//#region src/transform.ts
|
|
1379
|
+
const transformMap = [
|
|
1380
|
+
"transform",
|
|
1381
|
+
"transform-origin",
|
|
1382
|
+
"transform-style"
|
|
1383
|
+
];
|
|
886
1384
|
function transform(key, val) {
|
|
1385
|
+
if (!transformMap.includes(key)) return;
|
|
887
1386
|
const [v, important] = transformImportant(val);
|
|
888
|
-
if (key === "transform-origin")
|
|
1387
|
+
if (key === "transform-origin") {
|
|
1388
|
+
if (isVar(v) || isCalc(v)) return `origin${getVal(v)}${important}`;
|
|
1389
|
+
return `origin-${/\d/.test(v) && v.includes(" ") ? `[${joinWithUnderLine(v)}]` : joinWithLine(v)}${important}`;
|
|
1390
|
+
}
|
|
889
1391
|
if (key === "transform-style") return `transform-${v}${important}`;
|
|
890
1392
|
if (val === "none") return `${key}-none${important}`;
|
|
891
1393
|
return joinEmpty(v).split(" ").map((v$1) => {
|
|
@@ -897,10 +1399,14 @@ function transform(key, val) {
|
|
|
897
1399
|
if (values.length > 1) return `${namePrefix}-${nameSuffix.toLowerCase()}="${values.map((v$2) => isVar(v$2) ? `[${v$2}]` : namePrefix === "scale" ? getHundred(v$2) : transformVal(v$2)).join(" ")}${important}"`;
|
|
898
1400
|
return `${namePrefix}="${nameSuffix.toLowerCase()}-${isVar(values[0]) ? `[${values[0]}]` : namePrefix === "scale" ? getHundred(values[0]) : transformVal(values[0])}${important}"`;
|
|
899
1401
|
} else {
|
|
900
|
-
|
|
1402
|
+
let values = value.replace(/,(?![^()]*\))/g, " ").split(" ");
|
|
901
1403
|
if (values.length > 1) {
|
|
902
1404
|
if (namePrefix === "translate") return `${namePrefix}="[${values.join(",")}]"`;
|
|
903
|
-
|
|
1405
|
+
if (values.some((v$2) => (isCalc(v$2) || isVar(v$2)) && !v$2.endsWith(")"))) values = [value];
|
|
1406
|
+
return `${namePrefix}="${values.map((v$2) => {
|
|
1407
|
+
const _v = isVar(v$2) || isCalc(v$2) ? `[${v$2}]` : namePrefix === "scale" ? getHundred(v$2) : transformVal(v$2);
|
|
1408
|
+
return _v;
|
|
1409
|
+
}).join(" ")}${important}"`;
|
|
904
1410
|
}
|
|
905
1411
|
return `${namePrefix}="${isVar(values[0]) ? `[${values[0]}]` : namePrefix === "scale" ? getHundred(values[0]) : transformVal(values[0])}${important}"`;
|
|
906
1412
|
}
|
|
@@ -914,7 +1420,16 @@ function transformVal(val) {
|
|
|
914
1420
|
//#endregion
|
|
915
1421
|
//#region src/transition.ts
|
|
916
1422
|
const times = ["transition-delay", "transition-duration"];
|
|
1423
|
+
const transitionMap = [
|
|
1424
|
+
"transition",
|
|
1425
|
+
"transition-property",
|
|
1426
|
+
"transition-duration",
|
|
1427
|
+
"transition-delay",
|
|
1428
|
+
"transition-timing-function",
|
|
1429
|
+
"transition-behavior"
|
|
1430
|
+
];
|
|
917
1431
|
function transition(key, val) {
|
|
1432
|
+
if (!transitionMap.includes(key)) return;
|
|
918
1433
|
const [value, important] = transformImportant(val);
|
|
919
1434
|
if (key === "transition-timing-function") {
|
|
920
1435
|
if (value === "linear") return `ease-${value}${important}`;
|
|
@@ -926,6 +1441,7 @@ function transition(key, val) {
|
|
|
926
1441
|
if (value === "box-shadow") return `transition-shadow${important}`;
|
|
927
1442
|
return `transition-${value}${important}`;
|
|
928
1443
|
}
|
|
1444
|
+
if (key === "transition-behavior") return `transition-${getLastName(value)}${important}`;
|
|
929
1445
|
const _val = getVal(value);
|
|
930
1446
|
if (_val === `-${value}` && times.includes(key)) {
|
|
931
1447
|
let num = value.trim();
|
|
@@ -952,35 +1468,72 @@ function transformTransition(v, important) {
|
|
|
952
1468
|
|
|
953
1469
|
//#endregion
|
|
954
1470
|
//#region src/user.ts
|
|
1471
|
+
const userMap = ["user-select"];
|
|
955
1472
|
function user(key, val) {
|
|
1473
|
+
if (!userMap.includes(key)) return;
|
|
956
1474
|
const [value, important] = transformImportant(val);
|
|
957
1475
|
return `${getLastName(key)}-${value}${important}`;
|
|
958
1476
|
}
|
|
959
1477
|
|
|
960
1478
|
//#endregion
|
|
961
1479
|
//#region src/vertical.ts
|
|
1480
|
+
const verticalMap = [
|
|
1481
|
+
"vertical-align",
|
|
1482
|
+
"vertical-text-align",
|
|
1483
|
+
"vertical-text-align-last",
|
|
1484
|
+
"vertical-align-last",
|
|
1485
|
+
"vertical-justify",
|
|
1486
|
+
"vertical-justify-content",
|
|
1487
|
+
"vertical-justify-items",
|
|
1488
|
+
"vertical-justify-self"
|
|
1489
|
+
];
|
|
962
1490
|
function vertical(key, val) {
|
|
1491
|
+
if (!verticalMap.includes(key)) return;
|
|
1492
|
+
const [value, important] = transformImportant(val);
|
|
1493
|
+
return `v${getVal(value)}${important}`;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
//#endregion
|
|
1497
|
+
//#region src/visibility.ts
|
|
1498
|
+
const visibilityMap = ["visibility"];
|
|
1499
|
+
function visibility(key, val) {
|
|
1500
|
+
if (!visibilityMap.includes(key)) return;
|
|
963
1501
|
const [value, important] = transformImportant(val);
|
|
964
|
-
return `
|
|
1502
|
+
if (value === "none") return `hidden${important}`;
|
|
1503
|
+
if (value === "hidden") return `invisible${important}`;
|
|
1504
|
+
return `${value}${important}`;
|
|
965
1505
|
}
|
|
966
1506
|
|
|
967
1507
|
//#endregion
|
|
968
1508
|
//#region src/white.ts
|
|
1509
|
+
const whiteMap$1 = ["white-space"];
|
|
969
1510
|
function white(key, val) {
|
|
1511
|
+
if (!whiteMap$1.includes(key)) return;
|
|
970
1512
|
const [value, important] = transformImportant(val);
|
|
971
1513
|
return `whitespace-${value}${important}`;
|
|
972
1514
|
}
|
|
973
1515
|
|
|
974
1516
|
//#endregion
|
|
975
1517
|
//#region src/will.ts
|
|
1518
|
+
const willMap = ["will-change"];
|
|
1519
|
+
const willChangeKeys = {
|
|
1520
|
+
"auto": "auto",
|
|
1521
|
+
"scroll-position": "scroll",
|
|
1522
|
+
"contents": "contents",
|
|
1523
|
+
"transform": "transform"
|
|
1524
|
+
};
|
|
976
1525
|
function will(key, val) {
|
|
1526
|
+
if (!willMap.includes(key)) return;
|
|
977
1527
|
const [value, important] = transformImportant(val);
|
|
978
|
-
return
|
|
1528
|
+
if (value in willChangeKeys) return `will-change-${willChangeKeys[value]}${important}`;
|
|
1529
|
+
return `${key}-[${joinWithUnderLine(value)}]${important}`;
|
|
979
1530
|
}
|
|
980
1531
|
|
|
981
1532
|
//#endregion
|
|
982
1533
|
//#region src/writing.ts
|
|
1534
|
+
const whiteMap = ["writing-mode"];
|
|
983
1535
|
function writing(key, val) {
|
|
1536
|
+
if (!whiteMap.includes(key)) return;
|
|
984
1537
|
const [value, important] = transformImportant(val);
|
|
985
1538
|
if (val === "horizontal-tb") return `write-normal${important}`;
|
|
986
1539
|
return `write-${value.replace("-rl", "-right").replace("-lr", "-left")}${important}`;
|
|
@@ -991,37 +1544,37 @@ function writing(key, val) {
|
|
|
991
1544
|
const typeMap = {
|
|
992
1545
|
animation,
|
|
993
1546
|
aspect,
|
|
994
|
-
backface
|
|
995
|
-
caption
|
|
1547
|
+
backface,
|
|
1548
|
+
caption,
|
|
996
1549
|
column,
|
|
997
|
-
columns
|
|
998
|
-
break:
|
|
1550
|
+
columns,
|
|
1551
|
+
break: transformBreak,
|
|
999
1552
|
empty,
|
|
1000
1553
|
box,
|
|
1001
1554
|
writing,
|
|
1002
1555
|
display,
|
|
1003
1556
|
float,
|
|
1004
|
-
clear
|
|
1557
|
+
clear,
|
|
1005
1558
|
isolation,
|
|
1006
1559
|
object,
|
|
1007
1560
|
overflow,
|
|
1008
1561
|
overscroll,
|
|
1009
|
-
position
|
|
1562
|
+
position,
|
|
1010
1563
|
top,
|
|
1011
1564
|
left: top,
|
|
1012
1565
|
right: top,
|
|
1013
1566
|
bottom: top,
|
|
1014
|
-
visibility
|
|
1567
|
+
visibility,
|
|
1015
1568
|
z: size,
|
|
1016
1569
|
flex,
|
|
1017
|
-
order
|
|
1570
|
+
order,
|
|
1018
1571
|
grid,
|
|
1019
|
-
gap
|
|
1572
|
+
gap,
|
|
1020
1573
|
justify,
|
|
1021
1574
|
align,
|
|
1022
1575
|
place,
|
|
1023
1576
|
padding: transformMargin,
|
|
1024
|
-
perspective
|
|
1577
|
+
perspective,
|
|
1025
1578
|
margin: transformMargin,
|
|
1026
1579
|
width: size,
|
|
1027
1580
|
min: max,
|
|
@@ -1033,7 +1586,7 @@ const typeMap = {
|
|
|
1033
1586
|
list,
|
|
1034
1587
|
text,
|
|
1035
1588
|
mask,
|
|
1036
|
-
hyphens
|
|
1589
|
+
hyphens,
|
|
1037
1590
|
vertical,
|
|
1038
1591
|
white,
|
|
1039
1592
|
word,
|
|
@@ -1046,22 +1599,22 @@ const typeMap = {
|
|
|
1046
1599
|
mix,
|
|
1047
1600
|
filter,
|
|
1048
1601
|
backdrop,
|
|
1049
|
-
table
|
|
1602
|
+
table,
|
|
1050
1603
|
transition,
|
|
1051
1604
|
transform,
|
|
1052
|
-
accent
|
|
1053
|
-
appearance
|
|
1605
|
+
accent,
|
|
1606
|
+
appearance,
|
|
1054
1607
|
cursor,
|
|
1055
|
-
caret
|
|
1056
|
-
pointer
|
|
1608
|
+
caret,
|
|
1609
|
+
pointer,
|
|
1057
1610
|
resize,
|
|
1058
1611
|
scroll,
|
|
1059
1612
|
inset,
|
|
1060
|
-
touch
|
|
1613
|
+
touch,
|
|
1061
1614
|
user,
|
|
1062
1615
|
will,
|
|
1063
|
-
fill
|
|
1064
|
-
stroke
|
|
1616
|
+
fill,
|
|
1617
|
+
stroke,
|
|
1065
1618
|
color,
|
|
1066
1619
|
row
|
|
1067
1620
|
};
|