@csszyx/compiler 0.6.2 → 0.8.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/README.md +27 -2
- package/dist/color-var.cjs +3 -28
- package/dist/{color-var.js → color-var.mjs} +2 -6
- package/dist/index.cjs +2073 -3202
- package/dist/index.d.cts +12118 -111
- package/dist/index.d.mts +13484 -0
- package/dist/index.mjs +2706 -0
- package/dist/shared/compiler.BIUVmI0H.mjs +2271 -0
- package/dist/{index.js → shared/compiler.C6jT0mcT.cjs} +75 -1609
- package/dist/transform-core.cjs +17 -0
- package/dist/transform-core.d.cts +86 -0
- package/dist/transform-core.d.mts +86 -0
- package/dist/transform-core.mjs +1 -0
- package/package.json +41 -19
- package/dist/chunk-3RG5ZIWI.js +0 -10
- package/dist/index.d.ts +0 -1477
- /package/dist/{color-var.d.ts → color-var.d.mts} +0 -0
|
@@ -0,0 +1,2271 @@
|
|
|
1
|
+
var PropertyCategory = /* @__PURE__ */ ((PropertyCategory2) => {
|
|
2
|
+
PropertyCategory2[PropertyCategory2["SPACING"] = 0] = "SPACING";
|
|
3
|
+
PropertyCategory2[PropertyCategory2["COLOR"] = 1] = "COLOR";
|
|
4
|
+
PropertyCategory2[PropertyCategory2["FRACTION"] = 2] = "FRACTION";
|
|
5
|
+
PropertyCategory2[PropertyCategory2["UNITLESS"] = 3] = "UNITLESS";
|
|
6
|
+
PropertyCategory2[PropertyCategory2["ANGLE"] = 4] = "ANGLE";
|
|
7
|
+
PropertyCategory2[PropertyCategory2["DURATION"] = 5] = "DURATION";
|
|
8
|
+
PropertyCategory2[PropertyCategory2["ARBITRARY"] = 6] = "ARBITRARY";
|
|
9
|
+
PropertyCategory2[PropertyCategory2["PASSTHROUGH"] = 7] = "PASSTHROUGH";
|
|
10
|
+
return PropertyCategory2;
|
|
11
|
+
})(PropertyCategory || {});
|
|
12
|
+
const PROPERTY_CATEGORY_MAP = {
|
|
13
|
+
// ---- SPACING ----
|
|
14
|
+
p: 0 /* SPACING */,
|
|
15
|
+
pt: 0 /* SPACING */,
|
|
16
|
+
pr: 0 /* SPACING */,
|
|
17
|
+
pb: 0 /* SPACING */,
|
|
18
|
+
pl: 0 /* SPACING */,
|
|
19
|
+
px: 0 /* SPACING */,
|
|
20
|
+
py: 0 /* SPACING */,
|
|
21
|
+
ps: 0 /* SPACING */,
|
|
22
|
+
pe: 0 /* SPACING */,
|
|
23
|
+
pbs: 0 /* SPACING */,
|
|
24
|
+
pbe: 0 /* SPACING */,
|
|
25
|
+
m: 0 /* SPACING */,
|
|
26
|
+
mt: 0 /* SPACING */,
|
|
27
|
+
mr: 0 /* SPACING */,
|
|
28
|
+
mb: 0 /* SPACING */,
|
|
29
|
+
ml: 0 /* SPACING */,
|
|
30
|
+
mx: 0 /* SPACING */,
|
|
31
|
+
my: 0 /* SPACING */,
|
|
32
|
+
ms: 0 /* SPACING */,
|
|
33
|
+
me: 0 /* SPACING */,
|
|
34
|
+
mbs: 0 /* SPACING */,
|
|
35
|
+
mbe: 0 /* SPACING */,
|
|
36
|
+
spaceX: 0 /* SPACING */,
|
|
37
|
+
spaceY: 0 /* SPACING */,
|
|
38
|
+
gap: 0 /* SPACING */,
|
|
39
|
+
gapX: 0 /* SPACING */,
|
|
40
|
+
gapY: 0 /* SPACING */,
|
|
41
|
+
inset: 0 /* SPACING */,
|
|
42
|
+
insetX: 0 /* SPACING */,
|
|
43
|
+
insetY: 0 /* SPACING */,
|
|
44
|
+
top: 0 /* SPACING */,
|
|
45
|
+
right: 0 /* SPACING */,
|
|
46
|
+
bottom: 0 /* SPACING */,
|
|
47
|
+
left: 0 /* SPACING */,
|
|
48
|
+
start: 0 /* SPACING */,
|
|
49
|
+
end: 0 /* SPACING */,
|
|
50
|
+
insetS: 0 /* SPACING */,
|
|
51
|
+
insetE: 0 /* SPACING */,
|
|
52
|
+
insetBs: 0 /* SPACING */,
|
|
53
|
+
insetBe: 0 /* SPACING */,
|
|
54
|
+
w: 0 /* SPACING */,
|
|
55
|
+
minW: 0 /* SPACING */,
|
|
56
|
+
maxW: 0 /* SPACING */,
|
|
57
|
+
h: 0 /* SPACING */,
|
|
58
|
+
minH: 0 /* SPACING */,
|
|
59
|
+
maxH: 0 /* SPACING */,
|
|
60
|
+
size: 0 /* SPACING */,
|
|
61
|
+
blockSize: 0 /* SPACING */,
|
|
62
|
+
minBlockSize: 0 /* SPACING */,
|
|
63
|
+
maxBlockSize: 0 /* SPACING */,
|
|
64
|
+
inlineSize: 0 /* SPACING */,
|
|
65
|
+
minInlineSize: 0 /* SPACING */,
|
|
66
|
+
maxInlineSize: 0 /* SPACING */,
|
|
67
|
+
basis: 0 /* SPACING */,
|
|
68
|
+
indent: 0 /* SPACING */,
|
|
69
|
+
scrollM: 0 /* SPACING */,
|
|
70
|
+
scrollMt: 0 /* SPACING */,
|
|
71
|
+
scrollMr: 0 /* SPACING */,
|
|
72
|
+
scrollMb: 0 /* SPACING */,
|
|
73
|
+
scrollMl: 0 /* SPACING */,
|
|
74
|
+
scrollMs: 0 /* SPACING */,
|
|
75
|
+
scrollMe: 0 /* SPACING */,
|
|
76
|
+
scrollMx: 0 /* SPACING */,
|
|
77
|
+
scrollMy: 0 /* SPACING */,
|
|
78
|
+
scrollP: 0 /* SPACING */,
|
|
79
|
+
scrollPt: 0 /* SPACING */,
|
|
80
|
+
scrollPr: 0 /* SPACING */,
|
|
81
|
+
scrollPb: 0 /* SPACING */,
|
|
82
|
+
scrollPl: 0 /* SPACING */,
|
|
83
|
+
scrollPs: 0 /* SPACING */,
|
|
84
|
+
scrollPe: 0 /* SPACING */,
|
|
85
|
+
scrollPx: 0 /* SPACING */,
|
|
86
|
+
scrollPy: 0 /* SPACING */,
|
|
87
|
+
scrollPbs: 0 /* SPACING */,
|
|
88
|
+
scrollPbe: 0 /* SPACING */,
|
|
89
|
+
scrollMbs: 0 /* SPACING */,
|
|
90
|
+
scrollMbe: 0 /* SPACING */,
|
|
91
|
+
translateX: 0 /* SPACING */,
|
|
92
|
+
translateY: 0 /* SPACING */,
|
|
93
|
+
borderSpacing: 0 /* SPACING */,
|
|
94
|
+
borderSpacingX: 0 /* SPACING */,
|
|
95
|
+
borderSpacingY: 0 /* SPACING */,
|
|
96
|
+
outlineOffset: 0 /* SPACING */,
|
|
97
|
+
ringOffset: 0 /* SPACING */,
|
|
98
|
+
underlineOffset: 0 /* SPACING */,
|
|
99
|
+
// ---- COLOR ----
|
|
100
|
+
bg: 1 /* COLOR */,
|
|
101
|
+
color: 1 /* COLOR */,
|
|
102
|
+
borderColor: 1 /* COLOR */,
|
|
103
|
+
divideColor: 1 /* COLOR */,
|
|
104
|
+
outlineColor: 1 /* COLOR */,
|
|
105
|
+
ringColor: 1 /* COLOR */,
|
|
106
|
+
ringOffsetColor: 1 /* COLOR */,
|
|
107
|
+
shadowColor: 1 /* COLOR */,
|
|
108
|
+
textShadowColor: 1 /* COLOR */,
|
|
109
|
+
decorationColor: 1 /* COLOR */,
|
|
110
|
+
accent: 1 /* COLOR */,
|
|
111
|
+
caret: 1 /* COLOR */,
|
|
112
|
+
fill: 1 /* COLOR */,
|
|
113
|
+
stroke: 1 /* COLOR */,
|
|
114
|
+
from: 1 /* COLOR */,
|
|
115
|
+
via: 1 /* COLOR */,
|
|
116
|
+
to: 1 /* COLOR */,
|
|
117
|
+
dropShadowColor: 1 /* COLOR */,
|
|
118
|
+
// ---- UNITLESS ----
|
|
119
|
+
opacity: 3 /* UNITLESS */,
|
|
120
|
+
z: 3 /* UNITLESS */,
|
|
121
|
+
order: 3 /* UNITLESS */,
|
|
122
|
+
columns: 3 /* UNITLESS */,
|
|
123
|
+
gridCols: 3 /* UNITLESS */,
|
|
124
|
+
gridRows: 3 /* UNITLESS */,
|
|
125
|
+
col: 3 /* UNITLESS */,
|
|
126
|
+
colSpan: 3 /* UNITLESS */,
|
|
127
|
+
colStart: 3 /* UNITLESS */,
|
|
128
|
+
colEnd: 3 /* UNITLESS */,
|
|
129
|
+
row: 3 /* UNITLESS */,
|
|
130
|
+
rowSpan: 3 /* UNITLESS */,
|
|
131
|
+
rowStart: 3 /* UNITLESS */,
|
|
132
|
+
rowEnd: 3 /* UNITLESS */,
|
|
133
|
+
lineClamp: 3 /* UNITLESS */,
|
|
134
|
+
grow: 3 /* UNITLESS */,
|
|
135
|
+
shrink: 3 /* UNITLESS */,
|
|
136
|
+
scale: 3 /* UNITLESS */,
|
|
137
|
+
scaleX: 3 /* UNITLESS */,
|
|
138
|
+
scaleY: 3 /* UNITLESS */,
|
|
139
|
+
brightness: 3 /* UNITLESS */,
|
|
140
|
+
contrast: 3 /* UNITLESS */,
|
|
141
|
+
saturate: 3 /* UNITLESS */,
|
|
142
|
+
hueRotate: 3 /* UNITLESS */,
|
|
143
|
+
backdropBrightness: 3 /* UNITLESS */,
|
|
144
|
+
backdropContrast: 3 /* UNITLESS */,
|
|
145
|
+
backdropSaturate: 3 /* UNITLESS */,
|
|
146
|
+
backdropHueRotate: 3 /* UNITLESS */,
|
|
147
|
+
backdropOpacity: 3 /* UNITLESS */,
|
|
148
|
+
strokeWidth: 3 /* UNITLESS */,
|
|
149
|
+
border: 3 /* UNITLESS */,
|
|
150
|
+
borderT: 3 /* UNITLESS */,
|
|
151
|
+
borderR: 3 /* UNITLESS */,
|
|
152
|
+
borderB: 3 /* UNITLESS */,
|
|
153
|
+
borderL: 3 /* UNITLESS */,
|
|
154
|
+
borderX: 3 /* UNITLESS */,
|
|
155
|
+
borderY: 3 /* UNITLESS */,
|
|
156
|
+
borderS: 3 /* UNITLESS */,
|
|
157
|
+
borderE: 3 /* UNITLESS */,
|
|
158
|
+
borderBs: 3 /* UNITLESS */,
|
|
159
|
+
borderBe: 3 /* UNITLESS */,
|
|
160
|
+
ring: 3 /* UNITLESS */,
|
|
161
|
+
outline: 3 /* UNITLESS */,
|
|
162
|
+
leading: 3 /* UNITLESS */,
|
|
163
|
+
decorationThickness: 3 /* UNITLESS */,
|
|
164
|
+
// ---- ANGLE ----
|
|
165
|
+
rotate: 4 /* ANGLE */,
|
|
166
|
+
skewX: 4 /* ANGLE */,
|
|
167
|
+
skewY: 4 /* ANGLE */,
|
|
168
|
+
// ---- DURATION ----
|
|
169
|
+
duration: 5 /* DURATION */,
|
|
170
|
+
delay: 5 /* DURATION */,
|
|
171
|
+
animationDelay: 5 /* DURATION */
|
|
172
|
+
};
|
|
173
|
+
function getPropertyCategory(property) {
|
|
174
|
+
return PROPERTY_CATEGORY_MAP[property] ?? 7 /* PASSTHROUGH */;
|
|
175
|
+
}
|
|
176
|
+
const COLOR_PROPERTIES = new Set(
|
|
177
|
+
Object.entries(PROPERTY_CATEGORY_MAP).filter(([, cat]) => cat === 1 /* COLOR */).map(([key]) => key)
|
|
178
|
+
);
|
|
179
|
+
function getCSSVariableName(property, variantPrefix) {
|
|
180
|
+
const prop = property.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
181
|
+
if (variantPrefix) {
|
|
182
|
+
return `--_sz-${variantPrefix}-${prop}`;
|
|
183
|
+
}
|
|
184
|
+
return `--_sz-${prop}`;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const COLOR_STRING_KEYWORDS = /* @__PURE__ */ new Set([
|
|
188
|
+
"inherit",
|
|
189
|
+
"current",
|
|
190
|
+
"transparent",
|
|
191
|
+
"black",
|
|
192
|
+
"white",
|
|
193
|
+
"none"
|
|
194
|
+
]);
|
|
195
|
+
function isValidColorString(value) {
|
|
196
|
+
if (COLOR_STRING_KEYWORDS.has(value)) {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
if (value.startsWith("--")) {
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
if (value.startsWith("#")) {
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
if (value.startsWith("[") && value.endsWith("]")) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
if (/^(rgb|hsl|oklch|color|hwb|lab|lch|oklab)\(/.test(value)) {
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
if (/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9]+)*-\d+$/.test(value)) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
if (/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z][a-zA-Z0-9]*)*$/.test(value)) {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
function hasSlashOpacity(value) {
|
|
220
|
+
const slashIdx = value.indexOf("/");
|
|
221
|
+
if (slashIdx === -1) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
return slashIdx > 0 && /\d$/.test(value.slice(0, slashIdx));
|
|
225
|
+
}
|
|
226
|
+
function stripInvalidColorStrings(sz) {
|
|
227
|
+
const result = {};
|
|
228
|
+
for (const [key, value] of Object.entries(sz)) {
|
|
229
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
230
|
+
result[key] = stripInvalidColorStrings(value);
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
if (typeof value === "string" && PROPERTY_CATEGORY_MAP[key] === PropertyCategory.COLOR) {
|
|
234
|
+
const strVal = value.replace(/!$/, "");
|
|
235
|
+
if (hasSlashOpacity(strVal)) {
|
|
236
|
+
if (process.env.NODE_ENV !== "production" && typeof window === "undefined") {
|
|
237
|
+
const slashIdx = strVal.indexOf("/");
|
|
238
|
+
const colorPart = strVal.slice(0, slashIdx);
|
|
239
|
+
const opPart = strVal.slice(slashIdx + 1);
|
|
240
|
+
console.warn(
|
|
241
|
+
`[csszyx] "${key}: '${strVal}'" \u2014 string slash opacity is not supported. Use object form: { color: '${colorPart}', op: ${opPart} }.`
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
if (!isValidColorString(strVal)) {
|
|
247
|
+
if (process.env.NODE_ENV !== "production" && typeof window === "undefined") {
|
|
248
|
+
console.warn(
|
|
249
|
+
`[csszyx] "${key}: '${strVal}'" is not a recognized color value and will be ignored. Use a Tailwind color ("blue-500"), CSS variable ("--my-color"), hex/rgb/hsl ("#ff0000"), or object form ({ color: "blue-500", op: 50 }).`
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
result[key] = value;
|
|
256
|
+
}
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const PROPERTY_MAP = {
|
|
261
|
+
// Background
|
|
262
|
+
bg: "bg",
|
|
263
|
+
bgAttach: "bg",
|
|
264
|
+
bgClip: "bg-clip",
|
|
265
|
+
bgImg: "bg",
|
|
266
|
+
bgOrigin: "bg-origin",
|
|
267
|
+
bgPos: "bg",
|
|
268
|
+
bgRepeat: "bg",
|
|
269
|
+
bgSize: "bg",
|
|
270
|
+
// Gradient color stops
|
|
271
|
+
from: "from",
|
|
272
|
+
via: "via",
|
|
273
|
+
to: "to",
|
|
274
|
+
// Border Radius
|
|
275
|
+
rounded: "rounded",
|
|
276
|
+
roundedT: "rounded-t",
|
|
277
|
+
roundedR: "rounded-r",
|
|
278
|
+
roundedB: "rounded-b",
|
|
279
|
+
roundedL: "rounded-l",
|
|
280
|
+
roundedTl: "rounded-tl",
|
|
281
|
+
roundedTr: "rounded-tr",
|
|
282
|
+
roundedBl: "rounded-bl",
|
|
283
|
+
roundedBr: "rounded-br",
|
|
284
|
+
roundedS: "rounded-s",
|
|
285
|
+
roundedE: "rounded-e",
|
|
286
|
+
roundedSs: "rounded-ss",
|
|
287
|
+
roundedSe: "rounded-se",
|
|
288
|
+
roundedEs: "rounded-es",
|
|
289
|
+
roundedEe: "rounded-ee",
|
|
290
|
+
// Border
|
|
291
|
+
border: "border",
|
|
292
|
+
borderColor: "border",
|
|
293
|
+
borderStyle: "border",
|
|
294
|
+
borderT: "border-t",
|
|
295
|
+
borderR: "border-r",
|
|
296
|
+
borderB: "border-b",
|
|
297
|
+
borderL: "border-l",
|
|
298
|
+
borderX: "border-x",
|
|
299
|
+
borderY: "border-y",
|
|
300
|
+
borderS: "border-s",
|
|
301
|
+
borderE: "border-e",
|
|
302
|
+
borderBs: "border-bs",
|
|
303
|
+
borderBe: "border-be",
|
|
304
|
+
// Divide
|
|
305
|
+
divideX: "divide-x",
|
|
306
|
+
divideY: "divide-y",
|
|
307
|
+
divideColor: "divide",
|
|
308
|
+
divideStyle: "divide",
|
|
309
|
+
// Outline
|
|
310
|
+
outline: "outline",
|
|
311
|
+
outlineColor: "outline",
|
|
312
|
+
outlineOffset: "outline-offset",
|
|
313
|
+
outlineStyle: "outline",
|
|
314
|
+
// Ring (v4: outset ring + inset ring)
|
|
315
|
+
ring: "ring",
|
|
316
|
+
ringColor: "ring",
|
|
317
|
+
ringOffset: "ring-offset",
|
|
318
|
+
ringOffsetColor: "ring-offset",
|
|
319
|
+
insetRing: "inset-ring",
|
|
320
|
+
insetRingColor: "inset-ring",
|
|
321
|
+
// Spacing (canonical shorthand only)
|
|
322
|
+
p: "p",
|
|
323
|
+
pt: "pt",
|
|
324
|
+
pr: "pr",
|
|
325
|
+
pb: "pb",
|
|
326
|
+
pl: "pl",
|
|
327
|
+
px: "px",
|
|
328
|
+
py: "py",
|
|
329
|
+
ps: "ps",
|
|
330
|
+
pe: "pe",
|
|
331
|
+
pbs: "pbs",
|
|
332
|
+
pbe: "pbe",
|
|
333
|
+
m: "m",
|
|
334
|
+
mt: "mt",
|
|
335
|
+
mr: "mr",
|
|
336
|
+
mb: "mb",
|
|
337
|
+
ml: "ml",
|
|
338
|
+
mx: "mx",
|
|
339
|
+
my: "my",
|
|
340
|
+
ms: "ms",
|
|
341
|
+
me: "me",
|
|
342
|
+
mbs: "mbs",
|
|
343
|
+
mbe: "mbe",
|
|
344
|
+
// Space between
|
|
345
|
+
spaceX: "space-x",
|
|
346
|
+
spaceY: "space-y",
|
|
347
|
+
// Sizing (canonical shorthand only)
|
|
348
|
+
w: "w",
|
|
349
|
+
minW: "min-w",
|
|
350
|
+
maxW: "max-w",
|
|
351
|
+
h: "h",
|
|
352
|
+
minH: "min-h",
|
|
353
|
+
maxH: "max-h",
|
|
354
|
+
size: "size",
|
|
355
|
+
blockSize: "block",
|
|
356
|
+
minBlockSize: "min-block",
|
|
357
|
+
maxBlockSize: "max-block",
|
|
358
|
+
inlineSize: "inline",
|
|
359
|
+
minInlineSize: "min-inline",
|
|
360
|
+
maxInlineSize: "max-inline",
|
|
361
|
+
// Layout
|
|
362
|
+
aspect: "aspect",
|
|
363
|
+
columns: "columns",
|
|
364
|
+
breakAfter: "break-after",
|
|
365
|
+
breakBefore: "break-before",
|
|
366
|
+
breakInside: "break-inside",
|
|
367
|
+
boxDecoration: "box-decoration",
|
|
368
|
+
box: "box",
|
|
369
|
+
float: "float",
|
|
370
|
+
clear: "clear",
|
|
371
|
+
isolation: "isolation",
|
|
372
|
+
objectFit: "object",
|
|
373
|
+
objectPos: "object",
|
|
374
|
+
overflowX: "overflow-x",
|
|
375
|
+
overflowY: "overflow-y",
|
|
376
|
+
overscroll: "overscroll",
|
|
377
|
+
overscrollX: "overscroll-x",
|
|
378
|
+
overscrollY: "overscroll-y",
|
|
379
|
+
z: "z",
|
|
380
|
+
position: "position",
|
|
381
|
+
display: "display",
|
|
382
|
+
// Inset
|
|
383
|
+
inset: "inset",
|
|
384
|
+
insetX: "inset-x",
|
|
385
|
+
insetY: "inset-y",
|
|
386
|
+
top: "top",
|
|
387
|
+
right: "right",
|
|
388
|
+
bottom: "bottom",
|
|
389
|
+
left: "left",
|
|
390
|
+
// TW v4.2: start/end now emit inset-s-*/inset-e-* (same CSS, deprecated old class names)
|
|
391
|
+
start: "inset-s",
|
|
392
|
+
end: "inset-e",
|
|
393
|
+
insetS: "inset-s",
|
|
394
|
+
insetE: "inset-e",
|
|
395
|
+
insetBs: "inset-bs",
|
|
396
|
+
insetBe: "inset-be",
|
|
397
|
+
// Visibility
|
|
398
|
+
visibility: "visibility",
|
|
399
|
+
// Typography
|
|
400
|
+
color: "text",
|
|
401
|
+
text: "text",
|
|
402
|
+
fontWeight: "font",
|
|
403
|
+
weight: "font",
|
|
404
|
+
fontFamily: "font",
|
|
405
|
+
fontStretch: "font-stretch",
|
|
406
|
+
textAlign: "text",
|
|
407
|
+
decoration: "decoration",
|
|
408
|
+
decorationColor: "decoration",
|
|
409
|
+
decorationStyle: "decoration",
|
|
410
|
+
decorationThickness: "decoration",
|
|
411
|
+
underlineOffset: "underline-offset",
|
|
412
|
+
textTransform: "text",
|
|
413
|
+
textOverflow: "text",
|
|
414
|
+
textWrap: "text",
|
|
415
|
+
wrap: "wrap",
|
|
416
|
+
indent: "indent",
|
|
417
|
+
align: "align",
|
|
418
|
+
whitespace: "whitespace",
|
|
419
|
+
break: "break",
|
|
420
|
+
hyphens: "hyphens",
|
|
421
|
+
content: "content",
|
|
422
|
+
leading: "leading",
|
|
423
|
+
tracking: "tracking",
|
|
424
|
+
lineClamp: "line-clamp",
|
|
425
|
+
fontFeatures: "font-features",
|
|
426
|
+
list: "list",
|
|
427
|
+
listPos: "list",
|
|
428
|
+
listImg: "list-image",
|
|
429
|
+
// Flex & Grid
|
|
430
|
+
basis: "basis",
|
|
431
|
+
flexDir: "flex",
|
|
432
|
+
flexWrap: "flex",
|
|
433
|
+
grow: "grow",
|
|
434
|
+
shrink: "shrink",
|
|
435
|
+
order: "order",
|
|
436
|
+
items: "items",
|
|
437
|
+
self: "self",
|
|
438
|
+
justify: "justify",
|
|
439
|
+
justifyItems: "justify-items",
|
|
440
|
+
justifySelf: "justify-self",
|
|
441
|
+
placeContent: "place-content",
|
|
442
|
+
placeItems: "place-items",
|
|
443
|
+
placeSelf: "place-self",
|
|
444
|
+
gap: "gap",
|
|
445
|
+
gapX: "gap-x",
|
|
446
|
+
gapY: "gap-y",
|
|
447
|
+
// Grid
|
|
448
|
+
gridCols: "grid-cols",
|
|
449
|
+
gridRows: "grid-rows",
|
|
450
|
+
col: "col",
|
|
451
|
+
colSpan: "col-span",
|
|
452
|
+
colStart: "col-start",
|
|
453
|
+
colEnd: "col-end",
|
|
454
|
+
row: "row",
|
|
455
|
+
rowSpan: "row-span",
|
|
456
|
+
rowStart: "row-start",
|
|
457
|
+
rowEnd: "row-end",
|
|
458
|
+
gridFlow: "grid-flow",
|
|
459
|
+
autoCols: "auto-cols",
|
|
460
|
+
autoRows: "auto-rows",
|
|
461
|
+
// Effects
|
|
462
|
+
shadow: "shadow",
|
|
463
|
+
shadowColor: "shadow",
|
|
464
|
+
insetShadow: "inset-shadow",
|
|
465
|
+
insetShadowColor: "inset-shadow",
|
|
466
|
+
textShadow: "text-shadow",
|
|
467
|
+
textShadowColor: "text-shadow",
|
|
468
|
+
opacity: "opacity",
|
|
469
|
+
mixBlend: "mix-blend",
|
|
470
|
+
bgBlend: "bg-blend",
|
|
471
|
+
// Filters
|
|
472
|
+
blur: "blur",
|
|
473
|
+
brightness: "brightness",
|
|
474
|
+
contrast: "contrast",
|
|
475
|
+
dropShadow: "drop-shadow",
|
|
476
|
+
dropShadowColor: "drop-shadow",
|
|
477
|
+
grayscale: "grayscale",
|
|
478
|
+
hueRotate: "hue-rotate",
|
|
479
|
+
invert: "invert",
|
|
480
|
+
saturate: "saturate",
|
|
481
|
+
sepia: "sepia",
|
|
482
|
+
backdropBlur: "backdrop-blur",
|
|
483
|
+
backdropBrightness: "backdrop-brightness",
|
|
484
|
+
backdropContrast: "backdrop-contrast",
|
|
485
|
+
backdropGrayscale: "backdrop-grayscale",
|
|
486
|
+
backdropHueRotate: "backdrop-hue-rotate",
|
|
487
|
+
backdropInvert: "backdrop-invert",
|
|
488
|
+
backdropOpacity: "backdrop-opacity",
|
|
489
|
+
backdropSaturate: "backdrop-saturate",
|
|
490
|
+
backdropSepia: "backdrop-sepia",
|
|
491
|
+
// Transforms
|
|
492
|
+
scale: "scale",
|
|
493
|
+
scaleX: "scale-x",
|
|
494
|
+
scaleY: "scale-y",
|
|
495
|
+
scaleZ: "scale-z",
|
|
496
|
+
rotate: "rotate",
|
|
497
|
+
rotateX: "rotate-x",
|
|
498
|
+
rotateY: "rotate-y",
|
|
499
|
+
rotateZ: "rotate-z",
|
|
500
|
+
translate: "translate",
|
|
501
|
+
translateX: "translate-x",
|
|
502
|
+
translateY: "translate-y",
|
|
503
|
+
translateZ: "translate-z",
|
|
504
|
+
skewX: "skew-x",
|
|
505
|
+
skewY: "skew-y",
|
|
506
|
+
origin: "origin",
|
|
507
|
+
backface: "backface",
|
|
508
|
+
perspective: "perspective",
|
|
509
|
+
perspectiveOrigin: "perspective-origin",
|
|
510
|
+
transformStyle: "transform",
|
|
511
|
+
transform: "transform",
|
|
512
|
+
// Transitions & Animation
|
|
513
|
+
transition: "transition",
|
|
514
|
+
transitionBehavior: "transition",
|
|
515
|
+
duration: "duration",
|
|
516
|
+
ease: "ease",
|
|
517
|
+
delay: "delay",
|
|
518
|
+
animate: "animate",
|
|
519
|
+
animationDelay: "animation-delay",
|
|
520
|
+
// animation-delay — distinct from transition delay
|
|
521
|
+
// Masks
|
|
522
|
+
mask: "mask",
|
|
523
|
+
maskSize: "mask-size",
|
|
524
|
+
maskPos: "mask-position",
|
|
525
|
+
maskRepeat: "mask-repeat",
|
|
526
|
+
maskShape: "mask",
|
|
527
|
+
// Interactivity
|
|
528
|
+
cursor: "cursor",
|
|
529
|
+
caret: "caret",
|
|
530
|
+
pointerEvents: "pointer-events",
|
|
531
|
+
fieldSizing: "field-sizing",
|
|
532
|
+
scheme: "scheme",
|
|
533
|
+
resize: "resize",
|
|
534
|
+
scroll: "scroll",
|
|
535
|
+
scrollM: "scroll-m",
|
|
536
|
+
scrollMt: "scroll-mt",
|
|
537
|
+
scrollMr: "scroll-mr",
|
|
538
|
+
scrollMb: "scroll-mb",
|
|
539
|
+
scrollMl: "scroll-ml",
|
|
540
|
+
scrollMs: "scroll-ms",
|
|
541
|
+
scrollMe: "scroll-me",
|
|
542
|
+
scrollMx: "scroll-mx",
|
|
543
|
+
scrollMy: "scroll-my",
|
|
544
|
+
scrollP: "scroll-p",
|
|
545
|
+
scrollPt: "scroll-pt",
|
|
546
|
+
scrollPr: "scroll-pr",
|
|
547
|
+
scrollPb: "scroll-pb",
|
|
548
|
+
scrollPl: "scroll-pl",
|
|
549
|
+
scrollPs: "scroll-ps",
|
|
550
|
+
scrollPe: "scroll-pe",
|
|
551
|
+
scrollPx: "scroll-px",
|
|
552
|
+
scrollPy: "scroll-py",
|
|
553
|
+
scrollPbs: "scroll-pbs",
|
|
554
|
+
scrollPbe: "scroll-pbe",
|
|
555
|
+
scrollMbs: "scroll-mbs",
|
|
556
|
+
scrollMbe: "scroll-mbe",
|
|
557
|
+
snapAlign: "snap",
|
|
558
|
+
snapStop: "snap",
|
|
559
|
+
snapType: "snap",
|
|
560
|
+
touch: "touch",
|
|
561
|
+
select: "select",
|
|
562
|
+
willChange: "will-change",
|
|
563
|
+
appearance: "appearance",
|
|
564
|
+
accent: "accent",
|
|
565
|
+
forcedColorAdjust: "forced-color-adjust",
|
|
566
|
+
// SVG
|
|
567
|
+
fill: "fill",
|
|
568
|
+
stroke: "stroke",
|
|
569
|
+
strokeWidth: "stroke",
|
|
570
|
+
// Tables
|
|
571
|
+
borderCollapse: "border",
|
|
572
|
+
borderSpacing: "border-spacing",
|
|
573
|
+
borderSpacingX: "border-spacing-x",
|
|
574
|
+
borderSpacingY: "border-spacing-y",
|
|
575
|
+
tableLayout: "table",
|
|
576
|
+
caption: "caption",
|
|
577
|
+
// Overflow
|
|
578
|
+
overflow: "overflow"
|
|
579
|
+
};
|
|
580
|
+
const CSS_VAR_TYPE_HINTS = {
|
|
581
|
+
fontFamily: "family-name",
|
|
582
|
+
fontWeight: "weight",
|
|
583
|
+
text: "length"
|
|
584
|
+
};
|
|
585
|
+
const SUGGESTION_MAP = {
|
|
586
|
+
// Background
|
|
587
|
+
backgroundColor: "bg",
|
|
588
|
+
backgroundImage: "bgImg",
|
|
589
|
+
backgroundSize: "bgSize",
|
|
590
|
+
backgroundPosition: "bgPos",
|
|
591
|
+
backgroundRepeat: "bgRepeat",
|
|
592
|
+
bgAttachment: "bgAttach",
|
|
593
|
+
bgImage: "bgImg",
|
|
594
|
+
// Border Radius
|
|
595
|
+
borderRadius: "rounded",
|
|
596
|
+
borderTopLeftRadius: "roundedTl",
|
|
597
|
+
borderTopRightRadius: "roundedTr",
|
|
598
|
+
borderBottomLeftRadius: "roundedBl",
|
|
599
|
+
borderBottomRightRadius: "roundedBr",
|
|
600
|
+
// Border
|
|
601
|
+
borderWidth: "border",
|
|
602
|
+
// Spacing
|
|
603
|
+
padding: "p",
|
|
604
|
+
paddingTop: "pt",
|
|
605
|
+
paddingRight: "pr",
|
|
606
|
+
paddingBottom: "pb",
|
|
607
|
+
paddingLeft: "pl",
|
|
608
|
+
paddingX: "px",
|
|
609
|
+
paddingY: "py",
|
|
610
|
+
margin: "m",
|
|
611
|
+
marginTop: "mt",
|
|
612
|
+
marginRight: "mr",
|
|
613
|
+
marginBottom: "mb",
|
|
614
|
+
marginLeft: "ml",
|
|
615
|
+
marginX: "mx",
|
|
616
|
+
marginY: "my",
|
|
617
|
+
// Sizing
|
|
618
|
+
width: "w",
|
|
619
|
+
height: "h",
|
|
620
|
+
minWidth: "minW",
|
|
621
|
+
maxWidth: "maxW",
|
|
622
|
+
minHeight: "minH",
|
|
623
|
+
maxHeight: "maxH",
|
|
624
|
+
// Layout
|
|
625
|
+
aspectRatio: "aspect",
|
|
626
|
+
boxSizing: "box",
|
|
627
|
+
boxDecorationBreak: "boxDecoration",
|
|
628
|
+
objectPosition: "objectPos",
|
|
629
|
+
zIndex: "z",
|
|
630
|
+
// Typography
|
|
631
|
+
font: "fontWeight (for weight) or fontFamily (for family)",
|
|
632
|
+
fontStyle: "italic/notItalic (boolean)",
|
|
633
|
+
weight: "fontWeight",
|
|
634
|
+
textDecoration: "decoration or underline/lineThrough/noUnderline (boolean)",
|
|
635
|
+
textDecorationColor: "decorationColor",
|
|
636
|
+
textDecorationStyle: "decorationStyle",
|
|
637
|
+
textDecorationThickness: "decorationThickness",
|
|
638
|
+
textUnderlineOffset: "underlineOffset",
|
|
639
|
+
lineHeight: "leading",
|
|
640
|
+
letterSpacing: "tracking",
|
|
641
|
+
textIndent: "indent",
|
|
642
|
+
verticalAlign: "align",
|
|
643
|
+
wordBreak: "break",
|
|
644
|
+
overflowWrap: "wrap",
|
|
645
|
+
textWrap: "textWrap",
|
|
646
|
+
listStyleType: "list",
|
|
647
|
+
listStylePosition: "listPos",
|
|
648
|
+
listStyleImage: "listImg",
|
|
649
|
+
listStyle: "list",
|
|
650
|
+
listPosition: "listPos",
|
|
651
|
+
listImage: "listImg",
|
|
652
|
+
// Flex & Grid
|
|
653
|
+
flexBasis: "basis",
|
|
654
|
+
flexDirection: "flexDir",
|
|
655
|
+
flexGrow: "grow",
|
|
656
|
+
flexShrink: "shrink",
|
|
657
|
+
alignItems: "items",
|
|
658
|
+
alignContent: "content",
|
|
659
|
+
alignSelf: "self",
|
|
660
|
+
justifyContent: "justify",
|
|
661
|
+
gridTemplateColumns: "gridCols",
|
|
662
|
+
gridTemplateRows: "gridRows",
|
|
663
|
+
gridColumn: "col",
|
|
664
|
+
gridRow: "row",
|
|
665
|
+
gridAutoFlow: "gridFlow",
|
|
666
|
+
gridAutoColumns: "autoCols",
|
|
667
|
+
gridAutoRows: "autoRows",
|
|
668
|
+
// Effects
|
|
669
|
+
boxShadow: "shadow",
|
|
670
|
+
mixBlendMode: "mixBlend",
|
|
671
|
+
backgroundBlendMode: "bgBlend",
|
|
672
|
+
// Transitions
|
|
673
|
+
transitionProperty: "transition",
|
|
674
|
+
transitionDuration: "duration",
|
|
675
|
+
transitionTimingFunction: "ease",
|
|
676
|
+
transitionDelay: "delay",
|
|
677
|
+
animation: "animate",
|
|
678
|
+
transformOrigin: "origin",
|
|
679
|
+
// Interactivity
|
|
680
|
+
caretColor: "caret",
|
|
681
|
+
accentColor: "accent",
|
|
682
|
+
scrollBehavior: "scroll",
|
|
683
|
+
scrollMargin: "scrollM",
|
|
684
|
+
scrollPadding: "scrollP",
|
|
685
|
+
scrollSnapAlign: "snapAlign",
|
|
686
|
+
scrollSnapStop: "snapStop",
|
|
687
|
+
scrollSnapType: "snapType",
|
|
688
|
+
touchAction: "touch",
|
|
689
|
+
userSelect: "select",
|
|
690
|
+
captionSide: "caption",
|
|
691
|
+
// Boolean remaps
|
|
692
|
+
flexWrapReverse: "flexWrap: 'wrap-reverse'",
|
|
693
|
+
flexNowrap: "flexWrap: 'nowrap'"
|
|
694
|
+
};
|
|
695
|
+
const VARIANT_MAP = {
|
|
696
|
+
// Focus variants
|
|
697
|
+
focusWithin: "focus-within",
|
|
698
|
+
focusVisible: "focus-visible",
|
|
699
|
+
// Structural variants
|
|
700
|
+
firstOfType: "first-of-type",
|
|
701
|
+
lastOfType: "last-of-type",
|
|
702
|
+
onlyOfType: "only-of-type",
|
|
703
|
+
onlyChild: "only",
|
|
704
|
+
firstChild: "first",
|
|
705
|
+
lastChild: "last",
|
|
706
|
+
// Motion variants
|
|
707
|
+
motionReduce: "motion-reduce",
|
|
708
|
+
motionSafe: "motion-safe",
|
|
709
|
+
// Contrast variants
|
|
710
|
+
contrastMore: "contrast-more",
|
|
711
|
+
contrastLess: "contrast-less",
|
|
712
|
+
// Pseudo-element variants
|
|
713
|
+
firstLine: "first-line",
|
|
714
|
+
firstLetter: "first-letter",
|
|
715
|
+
// Form variants
|
|
716
|
+
placeholderShown: "placeholder-shown",
|
|
717
|
+
inRange: "in-range",
|
|
718
|
+
outOfRange: "out-of-range",
|
|
719
|
+
readOnly: "read-only",
|
|
720
|
+
// Pointer variants
|
|
721
|
+
pointerFine: "pointer-fine",
|
|
722
|
+
pointerCoarse: "pointer-coarse",
|
|
723
|
+
pointerNone: "pointer-none",
|
|
724
|
+
// Screen orientation
|
|
725
|
+
screenPortrait: "portrait",
|
|
726
|
+
screenLandscape: "landscape",
|
|
727
|
+
// Container query max variants
|
|
728
|
+
"@maxSm": "@max-sm",
|
|
729
|
+
"@maxMd": "@max-md",
|
|
730
|
+
"@maxLg": "@max-lg",
|
|
731
|
+
"@maxXl": "@max-xl",
|
|
732
|
+
"@max2xl": "@max-2xl"
|
|
733
|
+
};
|
|
734
|
+
const KNOWN_VARIANTS = /* @__PURE__ */ new Set([
|
|
735
|
+
// Responsive
|
|
736
|
+
"sm",
|
|
737
|
+
"md",
|
|
738
|
+
"lg",
|
|
739
|
+
"xl",
|
|
740
|
+
"2xl",
|
|
741
|
+
// Container queries
|
|
742
|
+
"@sm",
|
|
743
|
+
"@md",
|
|
744
|
+
"@lg",
|
|
745
|
+
"@xl",
|
|
746
|
+
"@2xl",
|
|
747
|
+
// Dark mode
|
|
748
|
+
"dark",
|
|
749
|
+
"light",
|
|
750
|
+
// Print/Media
|
|
751
|
+
"print",
|
|
752
|
+
"portrait",
|
|
753
|
+
"landscape",
|
|
754
|
+
// Motion
|
|
755
|
+
"motion-reduce",
|
|
756
|
+
"motion-safe",
|
|
757
|
+
"motionReduce",
|
|
758
|
+
"motionSafe",
|
|
759
|
+
// Contrast
|
|
760
|
+
"contrast-more",
|
|
761
|
+
"contrast-less",
|
|
762
|
+
"contrastMore",
|
|
763
|
+
"contrastLess",
|
|
764
|
+
// States
|
|
765
|
+
"hover",
|
|
766
|
+
"focus",
|
|
767
|
+
"focus-within",
|
|
768
|
+
"focus-visible",
|
|
769
|
+
"focusWithin",
|
|
770
|
+
"focusVisible",
|
|
771
|
+
"active",
|
|
772
|
+
"visited",
|
|
773
|
+
"target",
|
|
774
|
+
"disabled",
|
|
775
|
+
"enabled",
|
|
776
|
+
"checked",
|
|
777
|
+
"indeterminate",
|
|
778
|
+
"default",
|
|
779
|
+
"required",
|
|
780
|
+
"valid",
|
|
781
|
+
"invalid",
|
|
782
|
+
"in-range",
|
|
783
|
+
"out-of-range",
|
|
784
|
+
"inRange",
|
|
785
|
+
"outOfRange",
|
|
786
|
+
"placeholder-shown",
|
|
787
|
+
"placeholderShown",
|
|
788
|
+
"autofill",
|
|
789
|
+
"read-only",
|
|
790
|
+
"readOnly",
|
|
791
|
+
// Structure
|
|
792
|
+
"first",
|
|
793
|
+
"last",
|
|
794
|
+
"only",
|
|
795
|
+
"odd",
|
|
796
|
+
"even",
|
|
797
|
+
"empty",
|
|
798
|
+
"first-of-type",
|
|
799
|
+
"last-of-type",
|
|
800
|
+
"only-of-type",
|
|
801
|
+
"firstOfType",
|
|
802
|
+
"lastOfType",
|
|
803
|
+
"onlyOfType",
|
|
804
|
+
"first-child",
|
|
805
|
+
"last-child",
|
|
806
|
+
"only-child",
|
|
807
|
+
"firstChild",
|
|
808
|
+
"lastChild",
|
|
809
|
+
"onlyChild",
|
|
810
|
+
// Pseudo-elements
|
|
811
|
+
"before",
|
|
812
|
+
"after",
|
|
813
|
+
"placeholder",
|
|
814
|
+
"file",
|
|
815
|
+
"marker",
|
|
816
|
+
"selection",
|
|
817
|
+
"first-line",
|
|
818
|
+
"first-letter",
|
|
819
|
+
"firstLine",
|
|
820
|
+
"firstLetter",
|
|
821
|
+
"backdrop",
|
|
822
|
+
// Pointer
|
|
823
|
+
"pointer-fine",
|
|
824
|
+
"pointer-coarse",
|
|
825
|
+
"pointer-none",
|
|
826
|
+
"pointerFine",
|
|
827
|
+
"pointerCoarse",
|
|
828
|
+
"pointerNone",
|
|
829
|
+
// Open
|
|
830
|
+
"open",
|
|
831
|
+
// RTL/LTR
|
|
832
|
+
"ltr",
|
|
833
|
+
"rtl"
|
|
834
|
+
]);
|
|
835
|
+
const ARIA_STATES = /* @__PURE__ */ new Set([
|
|
836
|
+
"checked",
|
|
837
|
+
"disabled",
|
|
838
|
+
"expanded",
|
|
839
|
+
"hidden",
|
|
840
|
+
"pressed",
|
|
841
|
+
"readonly",
|
|
842
|
+
"required",
|
|
843
|
+
"selected",
|
|
844
|
+
"busy",
|
|
845
|
+
"current",
|
|
846
|
+
"invalid",
|
|
847
|
+
"live",
|
|
848
|
+
"atomic",
|
|
849
|
+
"modal"
|
|
850
|
+
]);
|
|
851
|
+
const BOOLEAN_SHORTHANDS = /* @__PURE__ */ new Set([
|
|
852
|
+
// Display
|
|
853
|
+
"block",
|
|
854
|
+
"inline",
|
|
855
|
+
"inlineBlock",
|
|
856
|
+
"flex",
|
|
857
|
+
"inlineFlex",
|
|
858
|
+
"grid",
|
|
859
|
+
"inlineGrid",
|
|
860
|
+
"hidden",
|
|
861
|
+
"contents",
|
|
862
|
+
"table",
|
|
863
|
+
"tableRow",
|
|
864
|
+
"tableCell",
|
|
865
|
+
"flowRoot",
|
|
866
|
+
"listItem",
|
|
867
|
+
// Position
|
|
868
|
+
"static",
|
|
869
|
+
"fixed",
|
|
870
|
+
"absolute",
|
|
871
|
+
"relative",
|
|
872
|
+
"sticky",
|
|
873
|
+
// Visibility
|
|
874
|
+
"visible",
|
|
875
|
+
"invisible",
|
|
876
|
+
"collapse",
|
|
877
|
+
// Typography
|
|
878
|
+
"truncate",
|
|
879
|
+
"uppercase",
|
|
880
|
+
"lowercase",
|
|
881
|
+
"capitalize",
|
|
882
|
+
"normalCase",
|
|
883
|
+
"underline",
|
|
884
|
+
"overline",
|
|
885
|
+
"lineThrough",
|
|
886
|
+
"noUnderline",
|
|
887
|
+
"italic",
|
|
888
|
+
"notItalic",
|
|
889
|
+
"antialiased",
|
|
890
|
+
"subpixelAntialiased",
|
|
891
|
+
// Flexbox (grow/shrink only — flexWrap uses string values)
|
|
892
|
+
"grow",
|
|
893
|
+
"shrink",
|
|
894
|
+
// Filters (default values)
|
|
895
|
+
"blur",
|
|
896
|
+
"grayscale",
|
|
897
|
+
"invert",
|
|
898
|
+
"sepia",
|
|
899
|
+
"backdropBlur",
|
|
900
|
+
"backdropGrayscale",
|
|
901
|
+
"backdropInvert",
|
|
902
|
+
"backdropSepia",
|
|
903
|
+
// Misc
|
|
904
|
+
"container",
|
|
905
|
+
"prose",
|
|
906
|
+
"proseInvert",
|
|
907
|
+
"srOnly",
|
|
908
|
+
"notSrOnly",
|
|
909
|
+
"isolate",
|
|
910
|
+
"ordinal",
|
|
911
|
+
"slashedZero",
|
|
912
|
+
// Font variant numeric
|
|
913
|
+
"liningNums",
|
|
914
|
+
"oldstyleNums",
|
|
915
|
+
"proportionalNums",
|
|
916
|
+
"tabularNums",
|
|
917
|
+
"diagonalFractions",
|
|
918
|
+
"stackedFractions",
|
|
919
|
+
// Divide/Space reverse
|
|
920
|
+
"divideXReverse",
|
|
921
|
+
"divideYReverse",
|
|
922
|
+
"spaceXReverse",
|
|
923
|
+
"spaceYReverse",
|
|
924
|
+
// Ring (v3 future)
|
|
925
|
+
"ring",
|
|
926
|
+
// Outline
|
|
927
|
+
"outline"
|
|
928
|
+
]);
|
|
929
|
+
const BOOLEAN_TO_CLASS = {
|
|
930
|
+
inlineBlock: "inline-block",
|
|
931
|
+
inlineFlex: "inline-flex",
|
|
932
|
+
inlineGrid: "inline-grid",
|
|
933
|
+
tableRow: "table-row",
|
|
934
|
+
tableCell: "table-cell",
|
|
935
|
+
flowRoot: "flow-root",
|
|
936
|
+
listItem: "list-item",
|
|
937
|
+
normalCase: "normal-case",
|
|
938
|
+
lineThrough: "line-through",
|
|
939
|
+
noUnderline: "no-underline",
|
|
940
|
+
notItalic: "not-italic",
|
|
941
|
+
subpixelAntialiased: "subpixel-antialiased",
|
|
942
|
+
backdropBlur: "backdrop-blur",
|
|
943
|
+
backdropGrayscale: "backdrop-grayscale",
|
|
944
|
+
backdropInvert: "backdrop-invert",
|
|
945
|
+
backdropSepia: "backdrop-sepia",
|
|
946
|
+
srOnly: "sr-only",
|
|
947
|
+
notSrOnly: "not-sr-only",
|
|
948
|
+
divideXReverse: "divide-x-reverse",
|
|
949
|
+
divideYReverse: "divide-y-reverse",
|
|
950
|
+
spaceXReverse: "space-x-reverse",
|
|
951
|
+
spaceYReverse: "space-y-reverse",
|
|
952
|
+
// Font variant numeric
|
|
953
|
+
liningNums: "lining-nums",
|
|
954
|
+
oldstyleNums: "oldstyle-nums",
|
|
955
|
+
proportionalNums: "proportional-nums",
|
|
956
|
+
tabularNums: "tabular-nums",
|
|
957
|
+
diagonalFractions: "diagonal-fractions",
|
|
958
|
+
stackedFractions: "stacked-fractions",
|
|
959
|
+
// Transforms
|
|
960
|
+
transformGpu: "transform-gpu",
|
|
961
|
+
transformCpu: "transform-cpu",
|
|
962
|
+
// Misc
|
|
963
|
+
proseInvert: "prose-invert"
|
|
964
|
+
};
|
|
965
|
+
const SNAP_DIRECT_MAP = {
|
|
966
|
+
snapAlign: {
|
|
967
|
+
start: "snap-start",
|
|
968
|
+
end: "snap-end",
|
|
969
|
+
center: "snap-center",
|
|
970
|
+
none: "snap-align-none"
|
|
971
|
+
},
|
|
972
|
+
snapStop: {
|
|
973
|
+
normal: "snap-normal",
|
|
974
|
+
always: "snap-always"
|
|
975
|
+
},
|
|
976
|
+
snapType: {
|
|
977
|
+
none: "snap-none",
|
|
978
|
+
x: "snap-x",
|
|
979
|
+
y: "snap-y",
|
|
980
|
+
both: "snap-both"
|
|
981
|
+
},
|
|
982
|
+
snapStrictness: {
|
|
983
|
+
mandatory: "snap-mandatory",
|
|
984
|
+
proximity: "snap-proximity"
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
const NEGATIVE_ALLOWED = /* @__PURE__ */ new Set([
|
|
988
|
+
"m",
|
|
989
|
+
"mt",
|
|
990
|
+
"mr",
|
|
991
|
+
"mb",
|
|
992
|
+
"ml",
|
|
993
|
+
"mx",
|
|
994
|
+
"my",
|
|
995
|
+
"ms",
|
|
996
|
+
"me",
|
|
997
|
+
"mbs",
|
|
998
|
+
"mbe",
|
|
999
|
+
"top",
|
|
1000
|
+
"right",
|
|
1001
|
+
"bottom",
|
|
1002
|
+
"left",
|
|
1003
|
+
"inset",
|
|
1004
|
+
"inset-x",
|
|
1005
|
+
"inset-y",
|
|
1006
|
+
// TW v4.2: start/end now map to inset-s/inset-e
|
|
1007
|
+
"inset-s",
|
|
1008
|
+
"inset-e",
|
|
1009
|
+
"inset-bs",
|
|
1010
|
+
"inset-be",
|
|
1011
|
+
"z",
|
|
1012
|
+
"order",
|
|
1013
|
+
"col",
|
|
1014
|
+
"col-start",
|
|
1015
|
+
"col-end",
|
|
1016
|
+
"row",
|
|
1017
|
+
"row-start",
|
|
1018
|
+
"row-end",
|
|
1019
|
+
"rotate",
|
|
1020
|
+
"rotate-x",
|
|
1021
|
+
"rotate-y",
|
|
1022
|
+
"rotate-z",
|
|
1023
|
+
"scale-z",
|
|
1024
|
+
"skew-x",
|
|
1025
|
+
"skew-y",
|
|
1026
|
+
"translate",
|
|
1027
|
+
"translate-x",
|
|
1028
|
+
"translate-y",
|
|
1029
|
+
"translate-z",
|
|
1030
|
+
"mask",
|
|
1031
|
+
"space-x",
|
|
1032
|
+
"space-y",
|
|
1033
|
+
"tracking",
|
|
1034
|
+
"indent",
|
|
1035
|
+
"scroll-m",
|
|
1036
|
+
"scroll-mx",
|
|
1037
|
+
"scroll-my",
|
|
1038
|
+
"scroll-mt",
|
|
1039
|
+
"scroll-mr",
|
|
1040
|
+
"scroll-mb",
|
|
1041
|
+
"scroll-ml",
|
|
1042
|
+
"hue-rotate",
|
|
1043
|
+
"backdrop-hue-rotate"
|
|
1044
|
+
]);
|
|
1045
|
+
function handleImportant(value) {
|
|
1046
|
+
if (typeof value === "string" && value.endsWith("!")) {
|
|
1047
|
+
return { value: value.slice(0, -1), important: true };
|
|
1048
|
+
}
|
|
1049
|
+
return { value, important: false };
|
|
1050
|
+
}
|
|
1051
|
+
function formatOpacity(op) {
|
|
1052
|
+
if (typeof op === "number") {
|
|
1053
|
+
if (Number.isInteger(op * 2)) {
|
|
1054
|
+
return String(op);
|
|
1055
|
+
}
|
|
1056
|
+
return `[${op}]`;
|
|
1057
|
+
}
|
|
1058
|
+
if (typeof op === "string") {
|
|
1059
|
+
if (op.startsWith("--")) {
|
|
1060
|
+
return `(${op})`;
|
|
1061
|
+
}
|
|
1062
|
+
return `[${op}]`;
|
|
1063
|
+
}
|
|
1064
|
+
return String(op);
|
|
1065
|
+
}
|
|
1066
|
+
function isArbitraryVariant(key) {
|
|
1067
|
+
return key.startsWith("[") && key.endsWith("]");
|
|
1068
|
+
}
|
|
1069
|
+
function normalizeArbitraryVariant(key) {
|
|
1070
|
+
return key.replace(/\s+/g, "");
|
|
1071
|
+
}
|
|
1072
|
+
function normalizeArbitraryValue(value) {
|
|
1073
|
+
const stripped = value.startsWith("[") && value.endsWith("]") ? value.slice(1, -1) : value;
|
|
1074
|
+
return stripped.trim().replace(/\s+/g, "_");
|
|
1075
|
+
}
|
|
1076
|
+
const FRACTION_SUPPORTED_PROPS = /* @__PURE__ */ new Set([
|
|
1077
|
+
// Sizing (both rawKey and resolved key forms)
|
|
1078
|
+
"w",
|
|
1079
|
+
"width",
|
|
1080
|
+
"min-w",
|
|
1081
|
+
"minW",
|
|
1082
|
+
"minWidth",
|
|
1083
|
+
"max-w",
|
|
1084
|
+
"maxW",
|
|
1085
|
+
"maxWidth",
|
|
1086
|
+
"h",
|
|
1087
|
+
"height",
|
|
1088
|
+
"min-h",
|
|
1089
|
+
"minH",
|
|
1090
|
+
"minHeight",
|
|
1091
|
+
"max-h",
|
|
1092
|
+
"maxH",
|
|
1093
|
+
"maxHeight",
|
|
1094
|
+
"size",
|
|
1095
|
+
// Flex
|
|
1096
|
+
"basis",
|
|
1097
|
+
"flexBasis",
|
|
1098
|
+
"flex",
|
|
1099
|
+
// Inset
|
|
1100
|
+
"inset",
|
|
1101
|
+
"inset-x",
|
|
1102
|
+
"insetX",
|
|
1103
|
+
"inset-y",
|
|
1104
|
+
"insetY",
|
|
1105
|
+
"top",
|
|
1106
|
+
"right",
|
|
1107
|
+
"bottom",
|
|
1108
|
+
"left",
|
|
1109
|
+
"start",
|
|
1110
|
+
"end",
|
|
1111
|
+
// Translate
|
|
1112
|
+
"translate",
|
|
1113
|
+
"translate-x",
|
|
1114
|
+
"translateX",
|
|
1115
|
+
"translate-y",
|
|
1116
|
+
"translateY",
|
|
1117
|
+
// Aspect
|
|
1118
|
+
"aspect"
|
|
1119
|
+
]);
|
|
1120
|
+
function needsArbitraryBrackets(value) {
|
|
1121
|
+
const v = value.startsWith("[") && value.endsWith("]") ? value.slice(1, -1) : value;
|
|
1122
|
+
return /^\d+(\.\d+)?(px|rem|em|%|vh|vw|ch|dvh|dvw|svh|svw|lvh|lvw|cqw|cqh|deg|rad|turn|grad|ms|s|fr)$/.test(
|
|
1123
|
+
v
|
|
1124
|
+
) || // Positive units
|
|
1125
|
+
/^-\d+(\.\d+)?(px|rem|em|%|vh|vw|ch|dvh|dvw|svh|svw|lvh|lvw|cqw|cqh|deg|rad|turn|grad|ms|s|fr)$/.test(
|
|
1126
|
+
v
|
|
1127
|
+
) || // Negative units like -1px, -2rem
|
|
1128
|
+
/^\.\d+(px|rem|em|%|vh|vw|ch)?$/.test(v) || // Values starting with . like .25em
|
|
1129
|
+
/^-\.\d+(px|rem|em|%|vh|vw|ch)?$/.test(v) || // Negative values starting with -. like -.25em
|
|
1130
|
+
v.startsWith("#") || // Hex colors
|
|
1131
|
+
v.startsWith("rgb") || // RGB colors
|
|
1132
|
+
v.startsWith("hsl") || // HSL colors
|
|
1133
|
+
v.includes("calc(") || // Calculations
|
|
1134
|
+
v.includes("var(") || // CSS variables (old syntax)
|
|
1135
|
+
v.includes("attr(") || // attr() function
|
|
1136
|
+
v.includes("url(") || // URLs
|
|
1137
|
+
v.includes("clamp(") || // Clamp
|
|
1138
|
+
v.includes("min(") || // Min
|
|
1139
|
+
v.includes("max(") || // Max
|
|
1140
|
+
v.includes(" ");
|
|
1141
|
+
}
|
|
1142
|
+
const LIST_STYLE_STANDARD = /* @__PURE__ */ new Set(["none", "disc", "decimal"]);
|
|
1143
|
+
const FONT_STRETCH_KEYWORDS = /* @__PURE__ */ new Set([
|
|
1144
|
+
"ultra-condensed",
|
|
1145
|
+
"extra-condensed",
|
|
1146
|
+
"condensed",
|
|
1147
|
+
"semi-condensed",
|
|
1148
|
+
"normal",
|
|
1149
|
+
"semi-expanded",
|
|
1150
|
+
"expanded",
|
|
1151
|
+
"extra-expanded",
|
|
1152
|
+
"ultra-expanded"
|
|
1153
|
+
]);
|
|
1154
|
+
function camelToKebab(prop) {
|
|
1155
|
+
if (prop.startsWith("--")) {
|
|
1156
|
+
return prop;
|
|
1157
|
+
}
|
|
1158
|
+
return prop.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1159
|
+
}
|
|
1160
|
+
function getVariantPrefix(key) {
|
|
1161
|
+
if (VARIANT_MAP[key]) {
|
|
1162
|
+
return VARIANT_MAP[key];
|
|
1163
|
+
}
|
|
1164
|
+
return key.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1165
|
+
}
|
|
1166
|
+
function handleGroupPeer(type, nestedObj, prefix) {
|
|
1167
|
+
const classes = [];
|
|
1168
|
+
for (const [nestedKey, nestedValue] of Object.entries(nestedObj)) {
|
|
1169
|
+
if (nestedValue === null || nestedValue === void 0 || nestedValue === false) {
|
|
1170
|
+
continue;
|
|
1171
|
+
}
|
|
1172
|
+
if (nestedKey === "has" && typeof nestedValue === "object") {
|
|
1173
|
+
for (const [selector, selectorValue] of Object.entries(nestedValue)) {
|
|
1174
|
+
if (selectorValue === null || selectorValue === void 0 || selectorValue === false) {
|
|
1175
|
+
continue;
|
|
1176
|
+
}
|
|
1177
|
+
const variantPrefix = `${prefix}${type}-has-[${selector}]:`;
|
|
1178
|
+
const result = transform(selectorValue, variantPrefix);
|
|
1179
|
+
if (result.className) {
|
|
1180
|
+
classes.push(result.className);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
continue;
|
|
1184
|
+
}
|
|
1185
|
+
if (nestedKey === "data" && typeof nestedValue === "object") {
|
|
1186
|
+
for (const [attr, attrValue] of Object.entries(nestedValue)) {
|
|
1187
|
+
if (attrValue === null || attrValue === void 0 || attrValue === false) {
|
|
1188
|
+
continue;
|
|
1189
|
+
}
|
|
1190
|
+
const variantPrefix = `${prefix}${type}-data-[${attr}]:`;
|
|
1191
|
+
const result = transform(attrValue, variantPrefix);
|
|
1192
|
+
if (result.className) {
|
|
1193
|
+
classes.push(result.className);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
continue;
|
|
1197
|
+
}
|
|
1198
|
+
if (nestedKey === "aria" && typeof nestedValue === "object") {
|
|
1199
|
+
for (const [attr, attrValue] of Object.entries(nestedValue)) {
|
|
1200
|
+
if (attrValue === null || attrValue === void 0 || attrValue === false) {
|
|
1201
|
+
continue;
|
|
1202
|
+
}
|
|
1203
|
+
const variantPrefix = ARIA_STATES.has(attr) ? `${prefix}${type}-aria-${attr}:` : `${prefix}${type}-aria-[${attr}]:`;
|
|
1204
|
+
const result = transform(attrValue, variantPrefix);
|
|
1205
|
+
if (result.className) {
|
|
1206
|
+
classes.push(result.className);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
continue;
|
|
1210
|
+
}
|
|
1211
|
+
const isVariant = KNOWN_VARIANTS.has(nestedKey) || KNOWN_VARIANTS.has(getVariantPrefix(nestedKey));
|
|
1212
|
+
const isArbitrary = nestedKey.startsWith(".") || nestedKey.startsWith("#") || nestedKey.startsWith("[") || nestedKey.startsWith(":");
|
|
1213
|
+
if (isArbitrary) {
|
|
1214
|
+
const variantPrefix = `${prefix}${type}-[${nestedKey}]:`;
|
|
1215
|
+
const result = transform(nestedValue, variantPrefix);
|
|
1216
|
+
if (result.className) {
|
|
1217
|
+
classes.push(result.className);
|
|
1218
|
+
}
|
|
1219
|
+
} else if (isVariant) {
|
|
1220
|
+
const mappedVariant = getVariantPrefix(nestedKey);
|
|
1221
|
+
const variantPrefix = `${prefix}${type}-${mappedVariant}:`;
|
|
1222
|
+
const result = transform(nestedValue, variantPrefix);
|
|
1223
|
+
if (result.className) {
|
|
1224
|
+
classes.push(result.className);
|
|
1225
|
+
}
|
|
1226
|
+
} else if (typeof nestedValue === "object" && nestedValue !== null) {
|
|
1227
|
+
for (const [state, stateValue] of Object.entries(nestedValue)) {
|
|
1228
|
+
if (stateValue === null || stateValue === void 0 || stateValue === false) {
|
|
1229
|
+
continue;
|
|
1230
|
+
}
|
|
1231
|
+
if (state === "data" && typeof stateValue === "object") {
|
|
1232
|
+
for (const [attr, attrValue] of Object.entries(stateValue)) {
|
|
1233
|
+
if (attrValue === null || attrValue === void 0 || attrValue === false) {
|
|
1234
|
+
continue;
|
|
1235
|
+
}
|
|
1236
|
+
const variantPrefix2 = `${prefix}${type}-data-[${attr}]/${nestedKey}:`;
|
|
1237
|
+
const result2 = transform(attrValue, variantPrefix2);
|
|
1238
|
+
if (result2.className) {
|
|
1239
|
+
classes.push(result2.className);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
continue;
|
|
1243
|
+
}
|
|
1244
|
+
if (state === "aria" && typeof stateValue === "object") {
|
|
1245
|
+
for (const [attr, attrValue] of Object.entries(stateValue)) {
|
|
1246
|
+
if (attrValue === null || attrValue === void 0 || attrValue === false) {
|
|
1247
|
+
continue;
|
|
1248
|
+
}
|
|
1249
|
+
const ariaSegment = ARIA_STATES.has(attr) ? `aria-${attr}` : `aria-[${attr}]`;
|
|
1250
|
+
const variantPrefix2 = `${prefix}${type}-${ariaSegment}/${nestedKey}:`;
|
|
1251
|
+
const result2 = transform(attrValue, variantPrefix2);
|
|
1252
|
+
if (result2.className) {
|
|
1253
|
+
classes.push(result2.className);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
continue;
|
|
1257
|
+
}
|
|
1258
|
+
const mappedState = getVariantPrefix(state);
|
|
1259
|
+
const variantPrefix = `${prefix}${type}-${mappedState}/${nestedKey}:`;
|
|
1260
|
+
const result = transform(stateValue, variantPrefix);
|
|
1261
|
+
if (result.className) {
|
|
1262
|
+
classes.push(result.className);
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
return classes;
|
|
1268
|
+
}
|
|
1269
|
+
function handleHas(hasObj, prefix) {
|
|
1270
|
+
const classes = [];
|
|
1271
|
+
for (const [selector, value] of Object.entries(hasObj)) {
|
|
1272
|
+
if (value === null || value === void 0 || value === false) {
|
|
1273
|
+
continue;
|
|
1274
|
+
}
|
|
1275
|
+
let selectorStr;
|
|
1276
|
+
if (KNOWN_VARIANTS.has(selector) || selector.startsWith(":")) {
|
|
1277
|
+
selectorStr = selector.startsWith(":") ? selector : `:${selector}`;
|
|
1278
|
+
} else {
|
|
1279
|
+
selectorStr = selector;
|
|
1280
|
+
}
|
|
1281
|
+
const variantPrefix = `${prefix}has-[${selectorStr}]:`;
|
|
1282
|
+
const result = transform(value, variantPrefix);
|
|
1283
|
+
if (result.className) {
|
|
1284
|
+
classes.push(result.className);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
return classes;
|
|
1288
|
+
}
|
|
1289
|
+
function handleNot(notObj, prefix) {
|
|
1290
|
+
const classes = [];
|
|
1291
|
+
for (const [key, value] of Object.entries(notObj)) {
|
|
1292
|
+
if (value === null || value === void 0 || value === false) {
|
|
1293
|
+
continue;
|
|
1294
|
+
}
|
|
1295
|
+
if (key === "supports" && typeof value === "object") {
|
|
1296
|
+
for (const [condition, condValue] of Object.entries(value)) {
|
|
1297
|
+
const variantPrefix = `${prefix}not-supports-[${condition}]:`;
|
|
1298
|
+
const result = transform(condValue, variantPrefix);
|
|
1299
|
+
if (result.className) {
|
|
1300
|
+
classes.push(result.className);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
} else {
|
|
1304
|
+
const mappedVariant = getVariantPrefix(key);
|
|
1305
|
+
const variantPrefix = `${prefix}not-${mappedVariant}:`;
|
|
1306
|
+
const result = transform(value, variantPrefix);
|
|
1307
|
+
if (result.className) {
|
|
1308
|
+
classes.push(result.className);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
return classes;
|
|
1313
|
+
}
|
|
1314
|
+
function handleData(dataObj, prefix) {
|
|
1315
|
+
const classes = [];
|
|
1316
|
+
for (const [key, value] of Object.entries(dataObj)) {
|
|
1317
|
+
if (value === null || value === void 0 || value === false) {
|
|
1318
|
+
continue;
|
|
1319
|
+
}
|
|
1320
|
+
const variantPrefix = `${prefix}data-[${key}]:`;
|
|
1321
|
+
const result = transform(value, variantPrefix);
|
|
1322
|
+
if (result.className) {
|
|
1323
|
+
classes.push(result.className);
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
return classes;
|
|
1327
|
+
}
|
|
1328
|
+
function handleAria(ariaObj, prefix) {
|
|
1329
|
+
const classes = [];
|
|
1330
|
+
for (const [key, value] of Object.entries(ariaObj)) {
|
|
1331
|
+
if (value === null || value === void 0 || value === false) {
|
|
1332
|
+
continue;
|
|
1333
|
+
}
|
|
1334
|
+
let variantPrefix;
|
|
1335
|
+
if (ARIA_STATES.has(key)) {
|
|
1336
|
+
variantPrefix = `${prefix}aria-${key}:`;
|
|
1337
|
+
} else {
|
|
1338
|
+
variantPrefix = `${prefix}aria-[${key}]:`;
|
|
1339
|
+
}
|
|
1340
|
+
const result = transform(value, variantPrefix);
|
|
1341
|
+
if (result.className) {
|
|
1342
|
+
classes.push(result.className);
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
return classes;
|
|
1346
|
+
}
|
|
1347
|
+
function handleSupports(supportsObj, prefix) {
|
|
1348
|
+
const classes = [];
|
|
1349
|
+
for (const [condition, value] of Object.entries(supportsObj)) {
|
|
1350
|
+
if (value === null || value === void 0 || value === false) {
|
|
1351
|
+
continue;
|
|
1352
|
+
}
|
|
1353
|
+
const variantPrefix = `${prefix}supports-[${condition}]:`;
|
|
1354
|
+
const result = transform(value, variantPrefix);
|
|
1355
|
+
if (result.className) {
|
|
1356
|
+
classes.push(result.className);
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
return classes;
|
|
1360
|
+
}
|
|
1361
|
+
function transform(szProp, prefix = "", mangleMap) {
|
|
1362
|
+
if (!szProp || typeof szProp !== "object") {
|
|
1363
|
+
return { className: "", attributes: {} };
|
|
1364
|
+
}
|
|
1365
|
+
const classes = [];
|
|
1366
|
+
const attributes = {};
|
|
1367
|
+
for (const [rawKey, value] of Object.entries(szProp)) {
|
|
1368
|
+
if (value === false) {
|
|
1369
|
+
if (rawKey === "italic") {
|
|
1370
|
+
classes.push(`${prefix}not-italic`);
|
|
1371
|
+
} else if (rawKey === "antialiased") {
|
|
1372
|
+
classes.push(`${prefix}subpixel-antialiased`);
|
|
1373
|
+
}
|
|
1374
|
+
continue;
|
|
1375
|
+
}
|
|
1376
|
+
if (value === null || value === void 0) {
|
|
1377
|
+
continue;
|
|
1378
|
+
}
|
|
1379
|
+
if (rawKey === "css") {
|
|
1380
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
1381
|
+
for (const [cssProp, cssVal] of Object.entries(value)) {
|
|
1382
|
+
if (cssVal === null || cssVal === void 0) {
|
|
1383
|
+
continue;
|
|
1384
|
+
}
|
|
1385
|
+
const kebab = camelToKebab(cssProp);
|
|
1386
|
+
classes.push(`${prefix}[${kebab}:${normalizeArbitraryValue(String(cssVal))}]`);
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
continue;
|
|
1390
|
+
}
|
|
1391
|
+
if (rawKey.startsWith("@") && typeof value === "string") {
|
|
1392
|
+
const mappedKey = VARIANT_MAP[rawKey] || rawKey;
|
|
1393
|
+
classes.push(`${prefix}${mappedKey}/${value}`);
|
|
1394
|
+
continue;
|
|
1395
|
+
}
|
|
1396
|
+
if (rawKey === "bgImg" && typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
1397
|
+
const grad = value;
|
|
1398
|
+
const gradType = grad.gradient;
|
|
1399
|
+
if (!gradType) {
|
|
1400
|
+
continue;
|
|
1401
|
+
}
|
|
1402
|
+
let cls = "";
|
|
1403
|
+
if (gradType === "linear") {
|
|
1404
|
+
const dir = grad.dir ?? "to-r";
|
|
1405
|
+
if (typeof dir === "number") {
|
|
1406
|
+
if (dir < 0) {
|
|
1407
|
+
cls = `-bg-linear-${Math.abs(dir)}`;
|
|
1408
|
+
} else {
|
|
1409
|
+
cls = `bg-linear-${dir}`;
|
|
1410
|
+
}
|
|
1411
|
+
} else if (typeof dir === "string") {
|
|
1412
|
+
if (dir.startsWith("--")) {
|
|
1413
|
+
cls = `bg-linear-(${dir})`;
|
|
1414
|
+
} else if (dir.startsWith("to-")) {
|
|
1415
|
+
cls = `bg-linear-${dir}`;
|
|
1416
|
+
} else {
|
|
1417
|
+
cls = `bg-linear-[${normalizeArbitraryValue(dir)}]`;
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
} else if (gradType === "radial") {
|
|
1421
|
+
const dir = grad.dir;
|
|
1422
|
+
if (dir === void 0 || dir === null) {
|
|
1423
|
+
cls = "bg-radial";
|
|
1424
|
+
} else if (typeof dir === "string") {
|
|
1425
|
+
if (dir.startsWith("--")) {
|
|
1426
|
+
cls = `bg-radial-(${dir})`;
|
|
1427
|
+
} else {
|
|
1428
|
+
cls = `bg-radial-[${normalizeArbitraryValue(dir)}]`;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
} else if (gradType === "conic") {
|
|
1432
|
+
const dir = grad.dir;
|
|
1433
|
+
if (dir === void 0 || dir === null) {
|
|
1434
|
+
cls = "bg-conic";
|
|
1435
|
+
} else if (typeof dir === "number") {
|
|
1436
|
+
if (dir < 0) {
|
|
1437
|
+
cls = `-bg-conic-${Math.abs(dir)}`;
|
|
1438
|
+
} else {
|
|
1439
|
+
cls = `bg-conic-${dir}`;
|
|
1440
|
+
}
|
|
1441
|
+
} else if (typeof dir === "string") {
|
|
1442
|
+
if (dir.startsWith("--")) {
|
|
1443
|
+
cls = `bg-conic-(${dir})`;
|
|
1444
|
+
} else {
|
|
1445
|
+
cls = `bg-conic-[${normalizeArbitraryValue(dir)}]`;
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
if (grad.in) {
|
|
1450
|
+
cls += `/${grad.in}`;
|
|
1451
|
+
}
|
|
1452
|
+
if (cls) {
|
|
1453
|
+
classes.push(`${prefix}${cls}`);
|
|
1454
|
+
}
|
|
1455
|
+
continue;
|
|
1456
|
+
}
|
|
1457
|
+
if ((rawKey === "group" || rawKey === "peer") && typeof value === "string") {
|
|
1458
|
+
classes.push(`${prefix}${rawKey}/${value}`);
|
|
1459
|
+
continue;
|
|
1460
|
+
}
|
|
1461
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value) && rawKey in PROPERTY_MAP && "color" in value) {
|
|
1462
|
+
const colorObj = value;
|
|
1463
|
+
const twPrefix = PROPERTY_MAP[rawKey] || rawKey.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1464
|
+
const rawColorBase = String(colorObj.color);
|
|
1465
|
+
const colorBase = rawColorBase.startsWith("--") ? `(${rawColorBase})` : needsArbitraryBrackets(rawColorBase) ? `[${normalizeArbitraryValue(rawColorBase)}]` : normalizeArbitraryValue(rawColorBase);
|
|
1466
|
+
if (colorObj.op !== void 0) {
|
|
1467
|
+
const opStr = formatOpacity(colorObj.op);
|
|
1468
|
+
classes.push(`${prefix}${twPrefix}-${colorBase}/${opStr}`);
|
|
1469
|
+
} else {
|
|
1470
|
+
classes.push(`${prefix}${twPrefix}-${colorBase}`);
|
|
1471
|
+
}
|
|
1472
|
+
continue;
|
|
1473
|
+
}
|
|
1474
|
+
if (typeof value === "string" && PROPERTY_CATEGORY_MAP[rawKey] === PropertyCategory.COLOR) {
|
|
1475
|
+
const strVal = value.replace(/!$/, "");
|
|
1476
|
+
if (hasSlashOpacity(strVal)) {
|
|
1477
|
+
if (process.env.NODE_ENV !== "production" && typeof window === "undefined") {
|
|
1478
|
+
const slashIdx = strVal.indexOf("/");
|
|
1479
|
+
const colorPart = strVal.slice(0, slashIdx);
|
|
1480
|
+
const opPart = strVal.slice(slashIdx + 1);
|
|
1481
|
+
console.warn(
|
|
1482
|
+
`[csszyx] "${rawKey}: '${strVal}'" \u2014 string slash opacity is not supported. Use object form: { color: '${colorPart}', op: ${opPart} }.`
|
|
1483
|
+
);
|
|
1484
|
+
}
|
|
1485
|
+
continue;
|
|
1486
|
+
}
|
|
1487
|
+
if (!isValidColorString(strVal)) {
|
|
1488
|
+
if (process.env.NODE_ENV !== "production" && typeof window === "undefined") {
|
|
1489
|
+
console.warn(
|
|
1490
|
+
`[csszyx] "${rawKey}: '${strVal}'" is not a recognized color value and will be ignored. Use a Tailwind color ("blue-500"), CSS variable ("--my-color"), hex/rgb/hsl ("#ff0000"), or object form ({ color: "blue-500", op: 50 }).`
|
|
1491
|
+
);
|
|
1492
|
+
}
|
|
1493
|
+
continue;
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
if (typeof value === "object" && !Array.isArray(value)) {
|
|
1497
|
+
if (rawKey === "group") {
|
|
1498
|
+
const groupClasses = handleGroupPeer("group", value, prefix);
|
|
1499
|
+
classes.push(...groupClasses);
|
|
1500
|
+
continue;
|
|
1501
|
+
}
|
|
1502
|
+
if (rawKey === "peer") {
|
|
1503
|
+
const peerClasses = handleGroupPeer("peer", value, prefix);
|
|
1504
|
+
classes.push(...peerClasses);
|
|
1505
|
+
continue;
|
|
1506
|
+
}
|
|
1507
|
+
if (rawKey === "has") {
|
|
1508
|
+
const hasClasses = handleHas(value, prefix);
|
|
1509
|
+
classes.push(...hasClasses);
|
|
1510
|
+
continue;
|
|
1511
|
+
}
|
|
1512
|
+
if (rawKey === "not") {
|
|
1513
|
+
const notClasses = handleNot(value, prefix);
|
|
1514
|
+
classes.push(...notClasses);
|
|
1515
|
+
continue;
|
|
1516
|
+
}
|
|
1517
|
+
if (rawKey === "data") {
|
|
1518
|
+
const dataClasses = handleData(value, prefix);
|
|
1519
|
+
classes.push(...dataClasses);
|
|
1520
|
+
continue;
|
|
1521
|
+
}
|
|
1522
|
+
if (rawKey === "aria") {
|
|
1523
|
+
const ariaClasses = handleAria(value, prefix);
|
|
1524
|
+
classes.push(...ariaClasses);
|
|
1525
|
+
continue;
|
|
1526
|
+
}
|
|
1527
|
+
if (rawKey === "supports") {
|
|
1528
|
+
const supportsClasses = handleSupports(value, prefix);
|
|
1529
|
+
classes.push(...supportsClasses);
|
|
1530
|
+
continue;
|
|
1531
|
+
}
|
|
1532
|
+
if (rawKey === "min" || rawKey === "max") {
|
|
1533
|
+
const KNOWN_BP = /* @__PURE__ */ new Set(["sm", "md", "lg", "xl", "2xl"]);
|
|
1534
|
+
for (const [breakpoint, breakpointValue] of Object.entries(value)) {
|
|
1535
|
+
if (breakpointValue === null || breakpointValue === void 0 || breakpointValue === false) {
|
|
1536
|
+
continue;
|
|
1537
|
+
}
|
|
1538
|
+
let bpStr;
|
|
1539
|
+
if (isArbitraryVariant(breakpoint)) {
|
|
1540
|
+
bpStr = `${rawKey}-${breakpoint}`;
|
|
1541
|
+
} else if (KNOWN_BP.has(breakpoint)) {
|
|
1542
|
+
bpStr = `${rawKey}-${breakpoint}`;
|
|
1543
|
+
} else {
|
|
1544
|
+
bpStr = `${rawKey}-[${breakpoint}]`;
|
|
1545
|
+
}
|
|
1546
|
+
const nestedPrefix2 = `${prefix}${bpStr}:`;
|
|
1547
|
+
const result = transform(breakpointValue, nestedPrefix2);
|
|
1548
|
+
if (result.className) {
|
|
1549
|
+
classes.push(result.className);
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
continue;
|
|
1553
|
+
}
|
|
1554
|
+
if (rawKey.startsWith("@")) {
|
|
1555
|
+
const mappedKey = VARIANT_MAP[rawKey] || rawKey;
|
|
1556
|
+
if (typeof value === "string") {
|
|
1557
|
+
classes.push(`${prefix}${mappedKey}/${value}`);
|
|
1558
|
+
continue;
|
|
1559
|
+
}
|
|
1560
|
+
const KNOWN_BP = /* @__PURE__ */ new Set(["sm", "md", "lg", "xl", "2xl"]);
|
|
1561
|
+
for (const [nestedKey, nestedValue] of Object.entries(value)) {
|
|
1562
|
+
if (nestedValue === null || nestedValue === void 0 || nestedValue === false) {
|
|
1563
|
+
continue;
|
|
1564
|
+
}
|
|
1565
|
+
if (isArbitraryVariant(nestedKey)) {
|
|
1566
|
+
const nestedPrefix2 = `${prefix}${mappedKey}-${nestedKey}:`;
|
|
1567
|
+
const result = transform(nestedValue, nestedPrefix2);
|
|
1568
|
+
if (result.className) {
|
|
1569
|
+
classes.push(result.className);
|
|
1570
|
+
}
|
|
1571
|
+
} else if ((mappedKey === "@min" || mappedKey === "@max") && typeof nestedValue === "object" && nestedValue !== null && !KNOWN_BP.has(nestedKey) && !PROPERTY_MAP[nestedKey] && !BOOLEAN_SHORTHANDS.has(nestedKey)) {
|
|
1572
|
+
const nestedPrefix2 = `${prefix}${mappedKey}-[${nestedKey}]:`;
|
|
1573
|
+
const result = transform(nestedValue, nestedPrefix2);
|
|
1574
|
+
if (result.className) {
|
|
1575
|
+
classes.push(result.className);
|
|
1576
|
+
}
|
|
1577
|
+
} else if (PROPERTY_MAP[nestedKey] || BOOLEAN_SHORTHANDS.has(nestedKey) || nestedKey.startsWith("@")) {
|
|
1578
|
+
const nestedPrefix2 = `${prefix}${mappedKey}:`;
|
|
1579
|
+
const result = transform(
|
|
1580
|
+
{ [nestedKey]: nestedValue },
|
|
1581
|
+
nestedPrefix2
|
|
1582
|
+
);
|
|
1583
|
+
if (result.className) {
|
|
1584
|
+
classes.push(result.className);
|
|
1585
|
+
}
|
|
1586
|
+
} else if (typeof nestedValue === "object" && nestedValue !== null) {
|
|
1587
|
+
const nestedPrefix2 = `${prefix}${mappedKey}/${nestedKey}:`;
|
|
1588
|
+
const result = transform(nestedValue, nestedPrefix2);
|
|
1589
|
+
if (result.className) {
|
|
1590
|
+
classes.push(result.className);
|
|
1591
|
+
}
|
|
1592
|
+
} else {
|
|
1593
|
+
const nestedPrefix2 = `${prefix}${mappedKey}:`;
|
|
1594
|
+
const result = transform(
|
|
1595
|
+
{ [nestedKey]: nestedValue },
|
|
1596
|
+
nestedPrefix2
|
|
1597
|
+
);
|
|
1598
|
+
if (result.className) {
|
|
1599
|
+
classes.push(result.className);
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
continue;
|
|
1604
|
+
}
|
|
1605
|
+
if (isArbitraryVariant(rawKey)) {
|
|
1606
|
+
const normalizedKey = normalizeArbitraryVariant(rawKey);
|
|
1607
|
+
const nestedPrefix2 = `${prefix}${normalizedKey}:`;
|
|
1608
|
+
const nestedResult2 = transform(value, nestedPrefix2);
|
|
1609
|
+
if (nestedResult2.className) {
|
|
1610
|
+
classes.push(nestedResult2.className);
|
|
1611
|
+
}
|
|
1612
|
+
continue;
|
|
1613
|
+
}
|
|
1614
|
+
const variantName = getVariantPrefix(rawKey);
|
|
1615
|
+
const nestedPrefix = `${prefix}${variantName}:`;
|
|
1616
|
+
const nestedResult = transform(value, nestedPrefix);
|
|
1617
|
+
if (nestedResult.className) {
|
|
1618
|
+
classes.push(nestedResult.className);
|
|
1619
|
+
}
|
|
1620
|
+
continue;
|
|
1621
|
+
}
|
|
1622
|
+
if (SNAP_DIRECT_MAP[rawKey] && typeof value === "string") {
|
|
1623
|
+
const mapped = SNAP_DIRECT_MAP[rawKey][value];
|
|
1624
|
+
if (mapped) {
|
|
1625
|
+
classes.push(`${prefix}${mapped}`);
|
|
1626
|
+
continue;
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
if (typeof value === "string" && KNOWN_VARIANTS.has(rawKey)) {
|
|
1630
|
+
const variantName = getVariantPrefix(rawKey);
|
|
1631
|
+
classes.push(`${prefix}${variantName}:${value}`);
|
|
1632
|
+
continue;
|
|
1633
|
+
}
|
|
1634
|
+
if (rawKey.startsWith("--")) {
|
|
1635
|
+
classes.push(`${prefix}[${rawKey}:${value}]`);
|
|
1636
|
+
continue;
|
|
1637
|
+
}
|
|
1638
|
+
if (rawKey === "container") {
|
|
1639
|
+
if (value === true) {
|
|
1640
|
+
classes.push(`${prefix}container`);
|
|
1641
|
+
} else if (typeof value === "string") {
|
|
1642
|
+
classes.push(`${prefix}@container/${value}`);
|
|
1643
|
+
}
|
|
1644
|
+
continue;
|
|
1645
|
+
}
|
|
1646
|
+
let key = rawKey;
|
|
1647
|
+
if (PROPERTY_MAP[key]) {
|
|
1648
|
+
key = PROPERTY_MAP[key];
|
|
1649
|
+
} else {
|
|
1650
|
+
key = key.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1651
|
+
}
|
|
1652
|
+
let className = prefix;
|
|
1653
|
+
if (rawKey === "willChange" && typeof value === "string") {
|
|
1654
|
+
const WILL_CHANGE_KEYWORDS = /* @__PURE__ */ new Set(["auto", "scroll", "contents", "transform"]);
|
|
1655
|
+
if (WILL_CHANGE_KEYWORDS.has(value)) {
|
|
1656
|
+
classes.push(`${prefix}will-change-${value}`);
|
|
1657
|
+
} else if (value.startsWith("--")) {
|
|
1658
|
+
classes.push(`${prefix}will-change-(${value})`);
|
|
1659
|
+
} else {
|
|
1660
|
+
classes.push(`${prefix}will-change-[${normalizeArbitraryValue(value)}]`);
|
|
1661
|
+
}
|
|
1662
|
+
continue;
|
|
1663
|
+
}
|
|
1664
|
+
if (key === "display") {
|
|
1665
|
+
if (typeof value === "string") {
|
|
1666
|
+
if (value === "none") {
|
|
1667
|
+
className += "hidden";
|
|
1668
|
+
} else {
|
|
1669
|
+
className += value;
|
|
1670
|
+
}
|
|
1671
|
+
classes.push(className);
|
|
1672
|
+
continue;
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
if (key === "position") {
|
|
1676
|
+
if (typeof value === "string") {
|
|
1677
|
+
className += value;
|
|
1678
|
+
classes.push(className);
|
|
1679
|
+
continue;
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
if (key === "visibility") {
|
|
1683
|
+
if (typeof value === "string") {
|
|
1684
|
+
if (value === "hidden") {
|
|
1685
|
+
className += "invisible";
|
|
1686
|
+
} else {
|
|
1687
|
+
className += value;
|
|
1688
|
+
}
|
|
1689
|
+
classes.push(className);
|
|
1690
|
+
continue;
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
if (key === "isolation") {
|
|
1694
|
+
if (typeof value === "string") {
|
|
1695
|
+
if (value === "isolate") {
|
|
1696
|
+
className += "isolate";
|
|
1697
|
+
} else {
|
|
1698
|
+
className += `isolation-${value}`;
|
|
1699
|
+
}
|
|
1700
|
+
classes.push(className);
|
|
1701
|
+
continue;
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
if ((rawKey === "fromPos" || rawKey === "viaPos" || rawKey === "toPos") && typeof value === "number") {
|
|
1705
|
+
const gradPrefix = rawKey.replace("Pos", "");
|
|
1706
|
+
classes.push(`${prefix}${gradPrefix}-${value}%`);
|
|
1707
|
+
continue;
|
|
1708
|
+
}
|
|
1709
|
+
if (typeof value === "string") {
|
|
1710
|
+
if (rawKey === "decoration") {
|
|
1711
|
+
if (["underline", "overline", "line-through", "no-underline", "none"].includes(
|
|
1712
|
+
value
|
|
1713
|
+
)) {
|
|
1714
|
+
className += value === "none" ? "no-underline" : value;
|
|
1715
|
+
classes.push(className);
|
|
1716
|
+
continue;
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
if (rawKey === "textTransform") {
|
|
1720
|
+
if (["uppercase", "lowercase", "capitalize", "normal-case"].includes(value)) {
|
|
1721
|
+
className += value;
|
|
1722
|
+
classes.push(className);
|
|
1723
|
+
continue;
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
if (rawKey === "fontVariant") {
|
|
1727
|
+
const FONT_VARIANT_CLASSES = /* @__PURE__ */ new Set([
|
|
1728
|
+
"normal-nums",
|
|
1729
|
+
"ordinal",
|
|
1730
|
+
"slashed-zero",
|
|
1731
|
+
"lining-nums",
|
|
1732
|
+
"oldstyle-nums",
|
|
1733
|
+
"proportional-nums",
|
|
1734
|
+
"tabular-nums",
|
|
1735
|
+
"diagonal-fractions",
|
|
1736
|
+
"stacked-fractions"
|
|
1737
|
+
]);
|
|
1738
|
+
if (FONT_VARIANT_CLASSES.has(value)) {
|
|
1739
|
+
className += value;
|
|
1740
|
+
classes.push(className);
|
|
1741
|
+
continue;
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
if (rawKey === "textWrap") {
|
|
1745
|
+
className += `text-${value}`;
|
|
1746
|
+
classes.push(className);
|
|
1747
|
+
continue;
|
|
1748
|
+
}
|
|
1749
|
+
if (rawKey === "break") {
|
|
1750
|
+
const wbMap = {
|
|
1751
|
+
normal: "break-normal",
|
|
1752
|
+
all: "break-all",
|
|
1753
|
+
keep: "break-keep",
|
|
1754
|
+
"break-normal": "break-normal",
|
|
1755
|
+
"break-all": "break-all",
|
|
1756
|
+
"break-keep": "break-keep"
|
|
1757
|
+
};
|
|
1758
|
+
className += wbMap[value] || `break-${value}`;
|
|
1759
|
+
classes.push(className);
|
|
1760
|
+
continue;
|
|
1761
|
+
}
|
|
1762
|
+
if (rawKey === "wrap") {
|
|
1763
|
+
const owMap = {
|
|
1764
|
+
normal: "wrap-normal",
|
|
1765
|
+
"break-word": "wrap-break-word",
|
|
1766
|
+
anywhere: "wrap-anywhere",
|
|
1767
|
+
"wrap-normal": "wrap-normal",
|
|
1768
|
+
"wrap-break-word": "wrap-break-word",
|
|
1769
|
+
"wrap-anywhere": "wrap-anywhere"
|
|
1770
|
+
};
|
|
1771
|
+
className += owMap[value] || `wrap-${value}`;
|
|
1772
|
+
classes.push(className);
|
|
1773
|
+
continue;
|
|
1774
|
+
}
|
|
1775
|
+
if (rawKey === "textOverflow") {
|
|
1776
|
+
if (value === "ellipsis" || value === "clip") {
|
|
1777
|
+
classes.push(`${prefix}text-${value}`);
|
|
1778
|
+
} else {
|
|
1779
|
+
classes.push(`${prefix}text-[${value}]`);
|
|
1780
|
+
}
|
|
1781
|
+
continue;
|
|
1782
|
+
}
|
|
1783
|
+
if (rawKey === "lineClamp") {
|
|
1784
|
+
const sValue = String(value);
|
|
1785
|
+
if (sValue.startsWith("--")) {
|
|
1786
|
+
className += `line-clamp-(${sValue})`;
|
|
1787
|
+
} else {
|
|
1788
|
+
const numVal = Number(sValue);
|
|
1789
|
+
if (!Number.isNaN(numVal) && Number.isInteger(numVal)) {
|
|
1790
|
+
className += `line-clamp-${sValue}`;
|
|
1791
|
+
} else {
|
|
1792
|
+
className += `line-clamp-[${sValue}]`;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
classes.push(className);
|
|
1796
|
+
continue;
|
|
1797
|
+
}
|
|
1798
|
+
if (rawKey === "list" || rawKey === "listStyle") {
|
|
1799
|
+
const sValue = String(value);
|
|
1800
|
+
if (sValue.startsWith("--")) {
|
|
1801
|
+
className += `list-(${sValue})`;
|
|
1802
|
+
} else if (LIST_STYLE_STANDARD.has(sValue)) {
|
|
1803
|
+
className += `list-${sValue}`;
|
|
1804
|
+
} else {
|
|
1805
|
+
className += `list-[${sValue}]`;
|
|
1806
|
+
}
|
|
1807
|
+
classes.push(className);
|
|
1808
|
+
continue;
|
|
1809
|
+
}
|
|
1810
|
+
if (rawKey === "listPos") {
|
|
1811
|
+
className += `list-${value}`;
|
|
1812
|
+
classes.push(className);
|
|
1813
|
+
continue;
|
|
1814
|
+
}
|
|
1815
|
+
if (rawKey === "divideStyle") {
|
|
1816
|
+
className += `divide-${value}`;
|
|
1817
|
+
classes.push(className);
|
|
1818
|
+
continue;
|
|
1819
|
+
}
|
|
1820
|
+
if (rawKey === "decorationStyle" || rawKey === "textDecorationStyle") {
|
|
1821
|
+
className += `decoration-${value}`;
|
|
1822
|
+
classes.push(className);
|
|
1823
|
+
continue;
|
|
1824
|
+
}
|
|
1825
|
+
if (rawKey === "decorationColor" || rawKey === "textDecorationColor") {
|
|
1826
|
+
className += `decoration-${value}`;
|
|
1827
|
+
classes.push(className);
|
|
1828
|
+
continue;
|
|
1829
|
+
}
|
|
1830
|
+
if (rawKey === "decorationThickness" || rawKey === "textDecorationThickness") {
|
|
1831
|
+
if (needsArbitraryBrackets(value)) {
|
|
1832
|
+
className += `decoration-[${normalizeArbitraryValue(value)}]`;
|
|
1833
|
+
} else if (value.startsWith("--")) {
|
|
1834
|
+
className += `decoration-(${value})`;
|
|
1835
|
+
} else {
|
|
1836
|
+
className += `decoration-${value}`;
|
|
1837
|
+
}
|
|
1838
|
+
classes.push(className);
|
|
1839
|
+
continue;
|
|
1840
|
+
}
|
|
1841
|
+
if (rawKey === "fontStretch") {
|
|
1842
|
+
const sValue = String(value);
|
|
1843
|
+
if (FONT_STRETCH_KEYWORDS.has(sValue)) {
|
|
1844
|
+
className += `font-${sValue}`;
|
|
1845
|
+
} else if (sValue.startsWith("--")) {
|
|
1846
|
+
className += `font-stretch-(${sValue})`;
|
|
1847
|
+
} else if (/^\d+(\.\d+)?%$/.test(sValue)) {
|
|
1848
|
+
const valNum = parseFloat(sValue);
|
|
1849
|
+
if (sValue.includes(".") || !Number.isInteger(valNum)) {
|
|
1850
|
+
className += `font-stretch-[${sValue}]`;
|
|
1851
|
+
} else {
|
|
1852
|
+
className += `font-stretch-${sValue}`;
|
|
1853
|
+
}
|
|
1854
|
+
} else {
|
|
1855
|
+
className += `font-stretch-[${sValue}]`;
|
|
1856
|
+
}
|
|
1857
|
+
classes.push(className);
|
|
1858
|
+
continue;
|
|
1859
|
+
}
|
|
1860
|
+
if (rawKey === "maxW" && value === "container") {
|
|
1861
|
+
classes.push("container");
|
|
1862
|
+
continue;
|
|
1863
|
+
}
|
|
1864
|
+
if (rawKey === "shadowColor") {
|
|
1865
|
+
if (String(value).startsWith("--")) {
|
|
1866
|
+
classes.push(`shadow-(color:${value})`);
|
|
1867
|
+
} else {
|
|
1868
|
+
classes.push(`shadow-${value}`);
|
|
1869
|
+
}
|
|
1870
|
+
continue;
|
|
1871
|
+
}
|
|
1872
|
+
if (rawKey === "insetShadowColor") {
|
|
1873
|
+
if (String(value).startsWith("--")) {
|
|
1874
|
+
classes.push(`${prefix}inset-shadow-(color:${value})`);
|
|
1875
|
+
} else {
|
|
1876
|
+
classes.push(`${prefix}inset-shadow-${value}`);
|
|
1877
|
+
}
|
|
1878
|
+
continue;
|
|
1879
|
+
}
|
|
1880
|
+
if (rawKey === "brightness" || rawKey === "contrast" || rawKey === "saturate" || rawKey === "scale" || rawKey === "backdropBrightness" || rawKey === "backdropContrast" || rawKey === "backdropSaturate") {
|
|
1881
|
+
const prop = rawKey.startsWith("backdrop") ? `backdrop-${rawKey.slice(8).toLowerCase()}` : rawKey;
|
|
1882
|
+
const sValue = String(value);
|
|
1883
|
+
if (sValue === "3d" && rawKey === "scale") {
|
|
1884
|
+
classes.push(`${prefix}scale-3d`);
|
|
1885
|
+
} else if (sValue.startsWith("--")) {
|
|
1886
|
+
classes.push(`${prop}-(${sValue})`);
|
|
1887
|
+
} else {
|
|
1888
|
+
classes.push(`${prop}-[${sValue}]`);
|
|
1889
|
+
}
|
|
1890
|
+
continue;
|
|
1891
|
+
}
|
|
1892
|
+
if (rawKey === "textShadow") {
|
|
1893
|
+
if (value === "none") {
|
|
1894
|
+
className += "text-shadow-none";
|
|
1895
|
+
} else if (value === "") {
|
|
1896
|
+
className += "text-shadow";
|
|
1897
|
+
} else if (needsArbitraryBrackets(value)) {
|
|
1898
|
+
className += `text-shadow-[${normalizeArbitraryValue(value)}]`;
|
|
1899
|
+
} else {
|
|
1900
|
+
className += `text-shadow-${value}`;
|
|
1901
|
+
}
|
|
1902
|
+
classes.push(className);
|
|
1903
|
+
continue;
|
|
1904
|
+
}
|
|
1905
|
+
if (rawKey === "textShadowColor") {
|
|
1906
|
+
className += `text-shadow-${value}`;
|
|
1907
|
+
classes.push(className);
|
|
1908
|
+
continue;
|
|
1909
|
+
}
|
|
1910
|
+
if (rawKey === "fromPos" || rawKey === "viaPos" || rawKey === "toPos") {
|
|
1911
|
+
const gradPrefix = rawKey.replace("Pos", "");
|
|
1912
|
+
const sValue = String(value);
|
|
1913
|
+
if (value.startsWith("--")) {
|
|
1914
|
+
classes.push(`${gradPrefix}-(${value})`);
|
|
1915
|
+
} else if (/^\d+%$/.test(sValue)) {
|
|
1916
|
+
classes.push(`${gradPrefix}-${sValue}`);
|
|
1917
|
+
} else {
|
|
1918
|
+
classes.push(`${gradPrefix}-[${sValue}]`);
|
|
1919
|
+
}
|
|
1920
|
+
continue;
|
|
1921
|
+
}
|
|
1922
|
+
if (rawKey === "bgImg") {
|
|
1923
|
+
const v = String(value).trim();
|
|
1924
|
+
if (v === "none") {
|
|
1925
|
+
classes.push(`${prefix}bg-none`);
|
|
1926
|
+
continue;
|
|
1927
|
+
}
|
|
1928
|
+
const vNorm = v.startsWith("-") ? v.slice(1) : v;
|
|
1929
|
+
if (vNorm.startsWith("repeating-")) {
|
|
1930
|
+
classes.push(`${prefix}bg-[${normalizeArbitraryValue(v)}]`);
|
|
1931
|
+
continue;
|
|
1932
|
+
}
|
|
1933
|
+
if (vNorm.startsWith("linear-") || vNorm.startsWith("radial") || vNorm.startsWith("conic") || vNorm.startsWith("gradient-to-")) {
|
|
1934
|
+
const vMapped = vNorm.startsWith("gradient-to-") ? vNorm.replace("gradient-to-", "linear-to-") : vNorm;
|
|
1935
|
+
if (v.startsWith("-")) {
|
|
1936
|
+
classes.push(`${prefix}-bg-${vMapped}`);
|
|
1937
|
+
} else {
|
|
1938
|
+
classes.push(`${prefix}bg-${vMapped}`);
|
|
1939
|
+
}
|
|
1940
|
+
continue;
|
|
1941
|
+
}
|
|
1942
|
+
if (v.startsWith("--")) {
|
|
1943
|
+
classes.push(`${prefix}bg-(image:${v})`);
|
|
1944
|
+
continue;
|
|
1945
|
+
}
|
|
1946
|
+
if (v.startsWith("url(")) {
|
|
1947
|
+
classes.push(`${prefix}bg-[${v}]`);
|
|
1948
|
+
continue;
|
|
1949
|
+
}
|
|
1950
|
+
classes.push(`${prefix}bg-[url(${v})]`);
|
|
1951
|
+
continue;
|
|
1952
|
+
}
|
|
1953
|
+
if (rawKey === "bgPos") {
|
|
1954
|
+
const sVal = String(value);
|
|
1955
|
+
if (sVal.startsWith("--")) {
|
|
1956
|
+
classes.push(`${prefix}bg-(${sVal})`);
|
|
1957
|
+
} else if (sVal.includes("_") || needsArbitraryBrackets(sVal)) {
|
|
1958
|
+
classes.push(`${prefix}bg-[${normalizeArbitraryValue(sVal)}]`);
|
|
1959
|
+
} else {
|
|
1960
|
+
classes.push(`${prefix}bg-${sVal}`);
|
|
1961
|
+
}
|
|
1962
|
+
continue;
|
|
1963
|
+
}
|
|
1964
|
+
if (rawKey === "bgSize") {
|
|
1965
|
+
const sVal = String(value);
|
|
1966
|
+
if (sVal === "auto" || sVal === "cover" || sVal === "contain") {
|
|
1967
|
+
classes.push(`${prefix}bg-${sVal}`);
|
|
1968
|
+
} else if (sVal.startsWith("--")) {
|
|
1969
|
+
classes.push(`${prefix}bg-size-(${sVal})`);
|
|
1970
|
+
} else {
|
|
1971
|
+
classes.push(`${prefix}bg-size-[${normalizeArbitraryValue(sVal)}]`);
|
|
1972
|
+
}
|
|
1973
|
+
continue;
|
|
1974
|
+
}
|
|
1975
|
+
if (rawKey === "maskPos") {
|
|
1976
|
+
className += `mask-${value}`;
|
|
1977
|
+
classes.push(className);
|
|
1978
|
+
continue;
|
|
1979
|
+
}
|
|
1980
|
+
if (rawKey === "maskRepeat") {
|
|
1981
|
+
if (value === "repeat") {
|
|
1982
|
+
className += "mask-repeat";
|
|
1983
|
+
} else if (value === "no-repeat") {
|
|
1984
|
+
className += "mask-no-repeat";
|
|
1985
|
+
} else {
|
|
1986
|
+
className += `mask-${value}`;
|
|
1987
|
+
}
|
|
1988
|
+
classes.push(className);
|
|
1989
|
+
continue;
|
|
1990
|
+
}
|
|
1991
|
+
if (rawKey === "bgRepeat" || rawKey === "backgroundRepeat") {
|
|
1992
|
+
if (value === "repeat") {
|
|
1993
|
+
className += "bg-repeat";
|
|
1994
|
+
} else if (value === "no-repeat") {
|
|
1995
|
+
className += "bg-no-repeat";
|
|
1996
|
+
} else {
|
|
1997
|
+
const suffix = value.startsWith("repeat-") ? value.slice(7) : value;
|
|
1998
|
+
className += `bg-repeat-${suffix}`;
|
|
1999
|
+
}
|
|
2000
|
+
classes.push(className);
|
|
2001
|
+
continue;
|
|
2002
|
+
}
|
|
2003
|
+
if (rawKey === "maskSize") {
|
|
2004
|
+
className += `mask-${value}`;
|
|
2005
|
+
classes.push(className);
|
|
2006
|
+
continue;
|
|
2007
|
+
}
|
|
2008
|
+
if (rawKey === "maskShape") {
|
|
2009
|
+
className += `mask-${value}`;
|
|
2010
|
+
classes.push(className);
|
|
2011
|
+
continue;
|
|
2012
|
+
}
|
|
2013
|
+
if (rawKey === "maskComposite") {
|
|
2014
|
+
className += `mask-${value}`;
|
|
2015
|
+
classes.push(className);
|
|
2016
|
+
continue;
|
|
2017
|
+
}
|
|
2018
|
+
if (rawKey === "maskMode") {
|
|
2019
|
+
className += `mask-${value}`;
|
|
2020
|
+
classes.push(className);
|
|
2021
|
+
continue;
|
|
2022
|
+
}
|
|
2023
|
+
if (rawKey === "maskType") {
|
|
2024
|
+
className += `mask-type-${value}`;
|
|
2025
|
+
classes.push(className);
|
|
2026
|
+
continue;
|
|
2027
|
+
}
|
|
2028
|
+
if (rawKey === "alignContent") {
|
|
2029
|
+
className += `content-${value}`;
|
|
2030
|
+
classes.push(className);
|
|
2031
|
+
continue;
|
|
2032
|
+
}
|
|
2033
|
+
if (rawKey === "content") {
|
|
2034
|
+
if (value === "none") {
|
|
2035
|
+
className += "content-none";
|
|
2036
|
+
} else if (value.startsWith("--")) {
|
|
2037
|
+
className += `content-(${value})`;
|
|
2038
|
+
} else {
|
|
2039
|
+
const inner = value.startsWith('"') && value.endsWith('"') && value.length >= 2 ? `'${value.slice(1, -1)}'` : value;
|
|
2040
|
+
className += `content-[${inner}]`;
|
|
2041
|
+
}
|
|
2042
|
+
classes.push(className);
|
|
2043
|
+
continue;
|
|
2044
|
+
}
|
|
2045
|
+
if (rawKey === "borderTColor") {
|
|
2046
|
+
className += `border-t-${value}`;
|
|
2047
|
+
classes.push(className);
|
|
2048
|
+
continue;
|
|
2049
|
+
}
|
|
2050
|
+
if (rawKey === "borderRColor") {
|
|
2051
|
+
className += `border-r-${value}`;
|
|
2052
|
+
classes.push(className);
|
|
2053
|
+
continue;
|
|
2054
|
+
}
|
|
2055
|
+
if (rawKey === "borderBColor") {
|
|
2056
|
+
className += `border-b-${value}`;
|
|
2057
|
+
classes.push(className);
|
|
2058
|
+
continue;
|
|
2059
|
+
}
|
|
2060
|
+
if (rawKey === "borderLColor") {
|
|
2061
|
+
className += `border-l-${value}`;
|
|
2062
|
+
classes.push(className);
|
|
2063
|
+
continue;
|
|
2064
|
+
}
|
|
2065
|
+
if (rawKey === "borderXColor") {
|
|
2066
|
+
className += `border-x-${value}`;
|
|
2067
|
+
classes.push(className);
|
|
2068
|
+
continue;
|
|
2069
|
+
}
|
|
2070
|
+
if (rawKey === "borderYColor") {
|
|
2071
|
+
className += `border-y-${value}`;
|
|
2072
|
+
classes.push(className);
|
|
2073
|
+
continue;
|
|
2074
|
+
}
|
|
2075
|
+
if (rawKey === "transitionBehavior") {
|
|
2076
|
+
className += `transition-${value}`;
|
|
2077
|
+
classes.push(className);
|
|
2078
|
+
continue;
|
|
2079
|
+
}
|
|
2080
|
+
if (rawKey === "dropShadowColor") {
|
|
2081
|
+
if (value.startsWith("--")) {
|
|
2082
|
+
className += `drop-shadow-(color:${value})`;
|
|
2083
|
+
} else {
|
|
2084
|
+
className += `drop-shadow-${value}`;
|
|
2085
|
+
}
|
|
2086
|
+
classes.push(className);
|
|
2087
|
+
continue;
|
|
2088
|
+
}
|
|
2089
|
+
if (rawKey === "origin" || rawKey === "ease" || rawKey === "animate" || rawKey === "filter" || rawKey === "backdropFilter" || rawKey === "dropShadow") {
|
|
2090
|
+
const sVal = String(value);
|
|
2091
|
+
const prop = PROPERTY_MAP[rawKey] || rawKey;
|
|
2092
|
+
if (needsArbitraryBrackets(sVal) || sVal.includes("(") || sVal.includes("_") || sVal.includes("%")) {
|
|
2093
|
+
classes.push(`${className}${prop}-[${normalizeArbitraryValue(sVal)}]`);
|
|
2094
|
+
continue;
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
if (rawKey === "transformStyle") {
|
|
2098
|
+
className += `transform-${value}`;
|
|
2099
|
+
classes.push(className);
|
|
2100
|
+
continue;
|
|
2101
|
+
}
|
|
2102
|
+
if (rawKey === "perspective") {
|
|
2103
|
+
const STANDARD_PERSPECTIVE = /* @__PURE__ */ new Set(["none", "normal", "dramatic", "midrange"]);
|
|
2104
|
+
if (STANDARD_PERSPECTIVE.has(value)) {
|
|
2105
|
+
className += `perspective-${value}`;
|
|
2106
|
+
} else if (value.startsWith("--")) {
|
|
2107
|
+
className += `perspective-(${value})`;
|
|
2108
|
+
} else if (needsArbitraryBrackets(value)) {
|
|
2109
|
+
className += `perspective-[${normalizeArbitraryValue(value)}]`;
|
|
2110
|
+
} else {
|
|
2111
|
+
className += `perspective-${value}`;
|
|
2112
|
+
}
|
|
2113
|
+
classes.push(className);
|
|
2114
|
+
continue;
|
|
2115
|
+
}
|
|
2116
|
+
if (rawKey === "perspectiveOrigin") {
|
|
2117
|
+
const STANDARD_ORIGINS = /* @__PURE__ */ new Set([
|
|
2118
|
+
"center",
|
|
2119
|
+
"top",
|
|
2120
|
+
"right",
|
|
2121
|
+
"bottom",
|
|
2122
|
+
"left",
|
|
2123
|
+
"top-left",
|
|
2124
|
+
"top-right",
|
|
2125
|
+
"bottom-left",
|
|
2126
|
+
"bottom-right"
|
|
2127
|
+
]);
|
|
2128
|
+
if (STANDARD_ORIGINS.has(value)) {
|
|
2129
|
+
className += `perspective-origin-${value}`;
|
|
2130
|
+
} else {
|
|
2131
|
+
className += `perspective-origin-[${value}]`;
|
|
2132
|
+
}
|
|
2133
|
+
classes.push(className);
|
|
2134
|
+
continue;
|
|
2135
|
+
}
|
|
2136
|
+
if (rawKey === "backface") {
|
|
2137
|
+
className += `backface-${value}`;
|
|
2138
|
+
classes.push(className);
|
|
2139
|
+
continue;
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
if (process.env.NODE_ENV !== "production" && typeof window === "undefined") {
|
|
2143
|
+
const isKnown = PROPERTY_MAP[rawKey] || BOOLEAN_SHORTHANDS.has(rawKey) || SNAP_DIRECT_MAP[rawKey] || rawKey === "fromPos" || rawKey === "viaPos" || rawKey === "toPos" || rawKey.startsWith("--") || rawKey.startsWith("[") || rawKey.startsWith("@") || // Variants that fell through (e.g. empty object)
|
|
2144
|
+
KNOWN_VARIANTS.has(rawKey) || // Groups/Peers
|
|
2145
|
+
rawKey === "group" || rawKey === "peer" || // Special variant objects
|
|
2146
|
+
rawKey === "has" || rawKey === "not" || rawKey === "data" || rawKey === "aria" || rawKey === "supports" || rawKey === "min" || rawKey === "max";
|
|
2147
|
+
if (!isKnown) {
|
|
2148
|
+
const suggestion = SUGGESTION_MAP[rawKey];
|
|
2149
|
+
if (suggestion) {
|
|
2150
|
+
console.warn(
|
|
2151
|
+
`[csszyx] Use the canonical key "${suggestion}" instead of "${rawKey}".`
|
|
2152
|
+
);
|
|
2153
|
+
} else {
|
|
2154
|
+
console.warn(
|
|
2155
|
+
`[csszyx] Unknown property "${rawKey}" in sz prop. This will be ignored. Check for typos.`
|
|
2156
|
+
);
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
if (value === true) {
|
|
2161
|
+
if (BOOLEAN_SHORTHANDS.has(rawKey)) {
|
|
2162
|
+
const mappedClass = BOOLEAN_TO_CLASS[rawKey] || key;
|
|
2163
|
+
className += mappedClass;
|
|
2164
|
+
} else {
|
|
2165
|
+
className += key;
|
|
2166
|
+
}
|
|
2167
|
+
classes.push(className);
|
|
2168
|
+
continue;
|
|
2169
|
+
}
|
|
2170
|
+
if (rawKey === "animationDelay") {
|
|
2171
|
+
const ms = typeof value === "number" ? `${value}ms` : String(value);
|
|
2172
|
+
classes.push(`${className}[animation-delay:${ms}]`);
|
|
2173
|
+
continue;
|
|
2174
|
+
}
|
|
2175
|
+
if (typeof value === "number") {
|
|
2176
|
+
if (value < 0 && NEGATIVE_ALLOWED.has(key)) {
|
|
2177
|
+
className += `-${key}-${Math.abs(value)}`;
|
|
2178
|
+
} else {
|
|
2179
|
+
className += `${key}-${value}`;
|
|
2180
|
+
}
|
|
2181
|
+
classes.push(className);
|
|
2182
|
+
continue;
|
|
2183
|
+
}
|
|
2184
|
+
if (typeof value === "string") {
|
|
2185
|
+
const { value: cleanValue, important } = handleImportant(value);
|
|
2186
|
+
let finalValue = cleanValue;
|
|
2187
|
+
if (finalValue.startsWith("--")) {
|
|
2188
|
+
const typeHint = CSS_VAR_TYPE_HINTS[rawKey];
|
|
2189
|
+
if (typeHint) {
|
|
2190
|
+
finalValue = `(${typeHint}:${finalValue})`;
|
|
2191
|
+
} else {
|
|
2192
|
+
finalValue = `(${finalValue})`;
|
|
2193
|
+
}
|
|
2194
|
+
} else if (finalValue.startsWith("var(")) {
|
|
2195
|
+
finalValue = `[${normalizeArbitraryValue(finalValue)}]`;
|
|
2196
|
+
} else if (/^\d+\/\d+$/.test(finalValue)) {
|
|
2197
|
+
if (!FRACTION_SUPPORTED_PROPS.has(rawKey)) {
|
|
2198
|
+
finalValue = `[${finalValue}]`;
|
|
2199
|
+
}
|
|
2200
|
+
} else if (key === "aspect" && /^[0-9]+(?:\.[0-9]+)?\/[0-9]+(?:\.[0-9]+)?$/.test(finalValue)) {
|
|
2201
|
+
if (finalValue === "auto" || finalValue === "square" || finalValue === "video" || /^\d+\/\d+$/.test(finalValue)) ; else {
|
|
2202
|
+
finalValue = `[${finalValue}]`;
|
|
2203
|
+
}
|
|
2204
|
+
} else if (needsArbitraryBrackets(finalValue) || /^\d+\.\d+%$/.test(finalValue)) {
|
|
2205
|
+
finalValue = `[${normalizeArbitraryValue(finalValue)}]`;
|
|
2206
|
+
}
|
|
2207
|
+
if (finalValue.startsWith("-") && NEGATIVE_ALLOWED.has(key)) {
|
|
2208
|
+
className = `-${prefix}${key}-${finalValue.substring(1)}`;
|
|
2209
|
+
} else {
|
|
2210
|
+
className += `${key}-${finalValue}`;
|
|
2211
|
+
}
|
|
2212
|
+
if (important) {
|
|
2213
|
+
className += "!";
|
|
2214
|
+
}
|
|
2215
|
+
classes.push(className);
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
let mergedClasses = classes;
|
|
2219
|
+
const textSizePattern = /^((?:[a-z0-9\-[\]@/:]*:)*)text-(xs|sm|base|lg|[2-9]?xl|\[.+\]|\(.+\))$/;
|
|
2220
|
+
const leadingPattern = /^((?:[a-z0-9\-[\]@/:]*:)*)leading-(.+)$/;
|
|
2221
|
+
const textEntries = [];
|
|
2222
|
+
const leadingEntries = [];
|
|
2223
|
+
for (let i = 0; i < classes.length; i++) {
|
|
2224
|
+
const cls = classes[i];
|
|
2225
|
+
const tm = textSizePattern.exec(cls);
|
|
2226
|
+
if (tm) {
|
|
2227
|
+
textEntries.push({ index: i, prefix: tm[1], size: tm[2] });
|
|
2228
|
+
}
|
|
2229
|
+
const lm = leadingPattern.exec(cls);
|
|
2230
|
+
if (lm) {
|
|
2231
|
+
leadingEntries.push({ index: i, prefix: lm[1], value: lm[2] });
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
if (textEntries.length > 0 && leadingEntries.length > 0) {
|
|
2235
|
+
const removeIndices = /* @__PURE__ */ new Set();
|
|
2236
|
+
const consumedLeading = /* @__PURE__ */ new Set();
|
|
2237
|
+
for (const te of textEntries) {
|
|
2238
|
+
const matchingLeading = leadingEntries.find(
|
|
2239
|
+
(le) => le.prefix === te.prefix && !consumedLeading.has(le.index)
|
|
2240
|
+
);
|
|
2241
|
+
if (matchingLeading) {
|
|
2242
|
+
mergedClasses[te.index] = `${te.prefix}text-${te.size}/${matchingLeading.value}`;
|
|
2243
|
+
removeIndices.add(matchingLeading.index);
|
|
2244
|
+
consumedLeading.add(matchingLeading.index);
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
if (removeIndices.size > 0) {
|
|
2248
|
+
mergedClasses = mergedClasses.filter((_, i) => !removeIndices.has(i));
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
const finalClasses = mergedClasses.filter(Boolean);
|
|
2252
|
+
if (mangleMap) {
|
|
2253
|
+
const mangledClasses = finalClasses.map((cls) => mangleMap[cls] || cls);
|
|
2254
|
+
return {
|
|
2255
|
+
className: mangledClasses.join(" "),
|
|
2256
|
+
attributes
|
|
2257
|
+
};
|
|
2258
|
+
}
|
|
2259
|
+
return {
|
|
2260
|
+
className: finalClasses.join(" "),
|
|
2261
|
+
attributes
|
|
2262
|
+
};
|
|
2263
|
+
}
|
|
2264
|
+
function isValidSzProp(szProp) {
|
|
2265
|
+
return szProp !== null && szProp !== void 0 && typeof szProp === "object" && !Array.isArray(szProp);
|
|
2266
|
+
}
|
|
2267
|
+
function normalizeClassName(className) {
|
|
2268
|
+
return className.split(/\s+/).filter(Boolean).join(" ");
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
export { BOOLEAN_SHORTHANDS as B, COLOR_PROPERTIES as C, KNOWN_VARIANTS as K, PROPERTY_MAP as P, SUGGESTION_MAP as S, VARIANT_MAP as V, PropertyCategory as a, getVariantPrefix as b, getPropertyCategory as c, PROPERTY_CATEGORY_MAP as d, normalizeArbitraryValue as e, normalizeArbitraryVariant as f, getCSSVariableName as g, isValidSzProp as i, normalizeClassName as n, stripInvalidColorStrings as s, transform as t };
|