@unocss/preset-mini 66.5.10 → 66.5.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/chunk-gol_9zmq.mjs +36 -0
  2. package/dist/colors-C9l2trjD.d.mts +431 -0
  3. package/dist/colors-Cxq9P2g9.mjs +362 -0
  4. package/dist/colors.d.mts +2 -354
  5. package/dist/colors.mjs +2 -360
  6. package/dist/index-CnsmLem5.d.mts +71 -0
  7. package/dist/index.d.mts +5 -76
  8. package/dist/index.mjs +67 -70
  9. package/dist/rules-CuP-xMI2.mjs +1683 -0
  10. package/dist/rules.d.mts +72 -48
  11. package/dist/rules.mjs +4 -5
  12. package/dist/theme-5nLH7UVx.d.mts +1085 -0
  13. package/dist/theme-DeYMqZAV.mjs +347 -0
  14. package/dist/theme.d.mts +3 -338
  15. package/dist/theme.mjs +5 -6
  16. package/dist/utils-CNv_IKMQ.d.mts +122 -0
  17. package/dist/utils-DLpYZ57Q.mjs +638 -0
  18. package/dist/utils.d.mts +5 -77
  19. package/dist/utils.mjs +5 -3
  20. package/dist/variants.d.mts +38 -24
  21. package/dist/variants.mjs +661 -4
  22. package/package.json +7 -8
  23. package/colors.d.ts +0 -1
  24. package/dist/colors.d.ts +0 -354
  25. package/dist/index.d.ts +0 -76
  26. package/dist/rules.d.ts +0 -130
  27. package/dist/shared/preset-mini.BSnAbT9I.d.mts +0 -748
  28. package/dist/shared/preset-mini.B_2UJsV2.mjs +0 -693
  29. package/dist/shared/preset-mini.BjJC-NnU.d.mts +0 -79
  30. package/dist/shared/preset-mini.BjJC-NnU.d.ts +0 -79
  31. package/dist/shared/preset-mini.CRliz1QB.d.ts +0 -76
  32. package/dist/shared/preset-mini.CVEK1uAa.mjs +0 -355
  33. package/dist/shared/preset-mini.CoOfBKs_.d.ts +0 -748
  34. package/dist/shared/preset-mini.DBTjVFxS.mjs +0 -580
  35. package/dist/shared/preset-mini.QLusboLD.mjs +0 -1064
  36. package/dist/shared/preset-mini.kmtdc_h1.mjs +0 -324
  37. package/dist/shared/preset-mini.oF7XTPi1.d.mts +0 -76
  38. package/dist/theme.d.ts +0 -338
  39. package/dist/utils.d.ts +0 -77
  40. package/dist/variants.d.ts +0 -52
  41. package/rules.d.ts +0 -1
  42. package/theme.d.ts +0 -1
  43. package/utils.d.ts +0 -1
  44. package/variants.d.ts +0 -1
@@ -0,0 +1,1683 @@
1
+ import { C as globalKeywords, S as directionMap, T as positionMap, a as colorableShadows, c as isCSSMathFn, d as parseColor, f as resolveBreakpoints, g as h, h as transformXYZ, i as colorResolver, l as isSize, m as splitShorthand, o as directionSize, s as hasParseableColor, u as makeGlobalStaticRules, w as insetMap, y as cornerMap } from "./utils-DLpYZ57Q.mjs";
2
+ import { toArray } from "@unocss/core";
3
+ import { colorOpacityToString, colorToString } from "@unocss/rule-utils";
4
+
5
+ //#region src/_rules/align.ts
6
+ const verticalAlignAlias = {
7
+ "mid": "middle",
8
+ "base": "baseline",
9
+ "btm": "bottom",
10
+ "baseline": "baseline",
11
+ "top": "top",
12
+ "start": "top",
13
+ "middle": "middle",
14
+ "bottom": "bottom",
15
+ "end": "bottom",
16
+ "text-top": "text-top",
17
+ "text-bottom": "text-bottom",
18
+ "sub": "sub",
19
+ "super": "super",
20
+ ...Object.fromEntries(globalKeywords.map((x) => [x, x]))
21
+ };
22
+ const verticalAligns = [[
23
+ /^(?:vertical|align|v)-(.+)$/,
24
+ ([, v]) => ({ "vertical-align": verticalAlignAlias[v] ?? h.bracket.cssvar.numberWithUnit(v) }),
25
+ { autocomplete: [`(vertical|align|v)-(${Object.keys(verticalAlignAlias).join("|")})`, "(vertical|align|v)-<percentage>"] }
26
+ ]];
27
+ const textAlignValues = [
28
+ "center",
29
+ "left",
30
+ "right",
31
+ "justify",
32
+ "start",
33
+ "end"
34
+ ];
35
+ const textAligns = [...textAlignValues.map((v) => [`text-${v}`, { "text-align": v }]), ...[...globalKeywords, ...textAlignValues].map((v) => [`text-align-${v}`, { "text-align": v }])];
36
+
37
+ //#endregion
38
+ //#region src/_rules/behaviors.ts
39
+ const outline = [
40
+ [
41
+ /^outline-(?:width-|size-)?(.+)$/,
42
+ handleWidth$3,
43
+ { autocomplete: "outline-(width|size)-<num>" }
44
+ ],
45
+ [
46
+ /^outline-(?:color-)?(.+)$/,
47
+ handleColorOrWidth$3,
48
+ { autocomplete: "outline-$colors" }
49
+ ],
50
+ [
51
+ /^outline-offset-(.+)$/,
52
+ ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? h.bracket.cssvar.global.px(d) }),
53
+ { autocomplete: "outline-(offset)-<num>" }
54
+ ],
55
+ ["outline", { "outline-style": "solid" }],
56
+ ...[
57
+ "auto",
58
+ "dashed",
59
+ "dotted",
60
+ "double",
61
+ "hidden",
62
+ "solid",
63
+ "groove",
64
+ "ridge",
65
+ "inset",
66
+ "outset",
67
+ ...globalKeywords
68
+ ].map((v) => [`outline-${v}`, { "outline-style": v }]),
69
+ ["outline-none", {
70
+ "outline": "2px solid transparent",
71
+ "outline-offset": "2px"
72
+ }]
73
+ ];
74
+ function handleWidth$3([, b], { theme }) {
75
+ return { "outline-width": theme.lineWidth?.[b] ?? h.bracket.cssvar.global.px(b) };
76
+ }
77
+ function handleColorOrWidth$3(match, ctx) {
78
+ if (isCSSMathFn(h.bracket(match[1]))) return handleWidth$3(match, ctx);
79
+ return colorResolver("outline-color", "outline-color", "borderColor")(match, ctx);
80
+ }
81
+ const appearance = [["appearance-auto", {
82
+ "-webkit-appearance": "auto",
83
+ "appearance": "auto"
84
+ }], ["appearance-none", {
85
+ "-webkit-appearance": "none",
86
+ "appearance": "none"
87
+ }]];
88
+ function willChangeProperty(prop) {
89
+ return h.properties.auto.global(prop) ?? {
90
+ contents: "contents",
91
+ scroll: "scroll-position"
92
+ }[prop];
93
+ }
94
+ const willChange = [[/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]];
95
+
96
+ //#endregion
97
+ //#region src/_rules/border.ts
98
+ const borderStyles = [
99
+ "solid",
100
+ "dashed",
101
+ "dotted",
102
+ "double",
103
+ "hidden",
104
+ "none",
105
+ "groove",
106
+ "ridge",
107
+ "inset",
108
+ "outset",
109
+ ...globalKeywords
110
+ ];
111
+ const borders = [
112
+ [
113
+ /^(?:border|b)()(?:-(.+))?$/,
114
+ handlerBorderSize,
115
+ { autocomplete: "(border|b)-<directions>" }
116
+ ],
117
+ [/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorderSize],
118
+ [/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorderSize],
119
+ [/^(?:border|b)-(block|inline)(?:-(.+))?$/, handlerBorderSize],
120
+ [/^(?:border|b)-([bi][se])(?:-(.+))?$/, handlerBorderSize],
121
+ [
122
+ /^(?:border|b)-()(?:width|size)-(.+)$/,
123
+ handlerBorderSize,
124
+ { autocomplete: ["(border|b)-<num>", "(border|b)-<directions>-<num>"] }
125
+ ],
126
+ [/^(?:border|b)-([xy])-(?:width|size)-(.+)$/, handlerBorderSize],
127
+ [/^(?:border|b)-([rltbse])-(?:width|size)-(.+)$/, handlerBorderSize],
128
+ [/^(?:border|b)-(block|inline)-(?:width|size)-(.+)$/, handlerBorderSize],
129
+ [/^(?:border|b)-([bi][se])-(?:width|size)-(.+)$/, handlerBorderSize],
130
+ [
131
+ /^(?:border|b)-()(?:color-)?(.+)$/,
132
+ handlerBorderColorOrSize,
133
+ { autocomplete: ["(border|b)-$colors", "(border|b)-<directions>-$colors"] }
134
+ ],
135
+ [/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColorOrSize],
136
+ [/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColorOrSize],
137
+ [/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/, handlerBorderColorOrSize],
138
+ [/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/, handlerBorderColorOrSize],
139
+ [
140
+ /^(?:border|b)-()op(?:acity)?-?(.+)$/,
141
+ handlerBorderOpacity,
142
+ { autocomplete: "(border|b)-(op|opacity)-<percent>" }
143
+ ],
144
+ [/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
145
+ [/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
146
+ [/^(?:border|b)-(block|inline)-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
147
+ [/^(?:border|b)-([bi][se])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
148
+ [
149
+ /^(?:border-|b-)?(?:rounded|rd)()(?:-(.+))?$/,
150
+ handlerRounded,
151
+ { autocomplete: [
152
+ "(border|b)-(rounded|rd)",
153
+ "(border|b)-(rounded|rd)-$borderRadius",
154
+ "(rounded|rd)",
155
+ "(rounded|rd)-$borderRadius"
156
+ ] }
157
+ ],
158
+ [/^(?:border-|b-)?(?:rounded|rd)-([rltbse])(?:-(.+))?$/, handlerRounded],
159
+ [/^(?:border-|b-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
160
+ [/^(?:border-|b-)?(?:rounded|rd)-([bise][se])(?:-(.+))?$/, handlerRounded],
161
+ [/^(?:border-|b-)?(?:rounded|rd)-([bi][se]-[bi][se])(?:-(.+))?$/, handlerRounded],
162
+ [
163
+ /^(?:border|b)-(?:style-)?()(.+)$/,
164
+ handlerBorderStyle,
165
+ { autocomplete: [
166
+ "(border|b)-style",
167
+ `(border|b)-(${borderStyles.join("|")})`,
168
+ "(border|b)-<directions>-style",
169
+ `(border|b)-<directions>-(${borderStyles.join("|")})`,
170
+ `(border|b)-<directions>-style-(${borderStyles.join("|")})`,
171
+ `(border|b)-style-(${borderStyles.join("|")})`
172
+ ] }
173
+ ],
174
+ [/^(?:border|b)-([xy])-(?:style-)?(.+)$/, handlerBorderStyle],
175
+ [/^(?:border|b)-([rltbse])-(?:style-)?(.+)$/, handlerBorderStyle],
176
+ [/^(?:border|b)-(block|inline)-(?:style-)?(.+)$/, handlerBorderStyle],
177
+ [/^(?:border|b)-([bi][se])-(?:style-)?(.+)$/, handlerBorderStyle]
178
+ ];
179
+ function transformBorderColor(color, alpha, direction) {
180
+ if (alpha != null) return { [`border${direction}-color`]: colorToString(color, alpha) };
181
+ if (direction === "") {
182
+ const object = {};
183
+ const opacityVar = `--un-border-opacity`;
184
+ const result = colorToString(color, `var(${opacityVar})`);
185
+ if (result.includes(opacityVar)) object[opacityVar] = typeof color === "string" ? 1 : colorOpacityToString(color);
186
+ object["border-color"] = result;
187
+ return object;
188
+ } else {
189
+ const object = {};
190
+ const opacityVar = "--un-border-opacity";
191
+ const opacityDirectionVar = `--un-border${direction}-opacity`;
192
+ const result = colorToString(color, `var(${opacityDirectionVar})`);
193
+ if (result.includes(opacityDirectionVar)) {
194
+ object[opacityVar] = typeof color === "string" ? 1 : colorOpacityToString(color);
195
+ object[opacityDirectionVar] = `var(${opacityVar})`;
196
+ }
197
+ object[`border${direction}-color`] = result;
198
+ return object;
199
+ }
200
+ }
201
+ function borderColorResolver(direction) {
202
+ return ([, body], theme) => {
203
+ const data = parseColor(body, theme, "borderColor");
204
+ if (!data) return;
205
+ const { alpha, color, cssColor } = data;
206
+ if (cssColor) return transformBorderColor(cssColor, alpha, direction);
207
+ else if (color) return transformBorderColor(color, alpha, direction);
208
+ };
209
+ }
210
+ function handlerBorderSize([, a = "", b], { theme }) {
211
+ const v = theme.lineWidth?.[b || "DEFAULT"] ?? h.bracket.cssvar.global.px(b || "1");
212
+ if (a in directionMap && v != null) return directionMap[a].map((i) => [`border${i}-width`, v]);
213
+ }
214
+ function handlerBorderColorOrSize([, a = "", b], ctx) {
215
+ if (a in directionMap) {
216
+ if (isCSSMathFn(h.bracket(b))) return handlerBorderSize([
217
+ "",
218
+ a,
219
+ b
220
+ ], ctx);
221
+ if (hasParseableColor(b, ctx.theme, "borderColor")) return Object.assign({}, ...directionMap[a].map((i) => borderColorResolver(i)(["", b], ctx.theme)));
222
+ }
223
+ }
224
+ function handlerBorderOpacity([, a = "", opacity$1]) {
225
+ const v = h.bracket.percent.cssvar(opacity$1);
226
+ if (a in directionMap && v != null) return directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
227
+ }
228
+ function handlerRounded([, a = "", s], { theme }) {
229
+ const v = theme.borderRadius?.[s || "DEFAULT"] || h.bracket.cssvar.global.fraction.rem(s || "1");
230
+ if (a in cornerMap && v != null) return cornerMap[a].map((i) => [`border${i}-radius`, v]);
231
+ }
232
+ function handlerBorderStyle([, a = "", s]) {
233
+ if (borderStyles.includes(s) && a in directionMap) return directionMap[a].map((i) => [`border${i}-style`, s]);
234
+ }
235
+
236
+ //#endregion
237
+ //#region src/_rules/color.ts
238
+ /**
239
+ * @example op10 op-30 opacity-100
240
+ */
241
+ const opacity = [[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: h.bracket.percent.cssvar(d) })]];
242
+ const bgUrlRE = /^\[url\(.+\)\]$/;
243
+ const bgLengthRE = /^\[(?:length|size):.+\]$/;
244
+ const bgPositionRE = /^\[position:.+\]$/;
245
+ const bgGradientRE = /^\[(?:linear|conic|radial)-gradient\(.+\)\]$/;
246
+ const bgImageRE = /^\[image:.+\]$/;
247
+ const bgColors = [[
248
+ /^bg-(.+)$/,
249
+ (...args) => {
250
+ const d = args[0][1];
251
+ if (bgUrlRE.test(d)) return {
252
+ "--un-url": h.bracket(d),
253
+ "background-image": "var(--un-url)"
254
+ };
255
+ if (bgLengthRE.test(d) && h.bracketOfLength(d) != null) return { "background-size": h.bracketOfLength(d).split(" ").map((e) => h.fraction.auto.px.cssvar(e) ?? e).join(" ") };
256
+ if ((isSize(d) || bgPositionRE.test(d)) && h.bracketOfPosition(d) != null) return { "background-position": h.bracketOfPosition(d).split(" ").map((e) => h.position.fraction.auto.px.cssvar(e) ?? e).join(" ") };
257
+ if (bgGradientRE.test(d) || bgImageRE.test(d)) {
258
+ const s = h.bracket(d);
259
+ if (s) {
260
+ const url = s.startsWith("http") ? `url(${s})` : h.cssvar(s);
261
+ return { "background-image": url ?? s };
262
+ }
263
+ }
264
+ return colorResolver("background-color", "bg", "backgroundColor")(...args);
265
+ },
266
+ { autocomplete: "bg-$colors" }
267
+ ], [
268
+ /^bg-op(?:acity)?-?(.+)$/,
269
+ ([, opacity$1]) => ({ "--un-bg-opacity": h.bracket.percent.cssvar(opacity$1) }),
270
+ { autocomplete: "bg-(op|opacity)-<percent>" }
271
+ ]];
272
+ const colorScheme = [[/^color-scheme-(\w+)$/, ([, v]) => ({ "color-scheme": v })]];
273
+
274
+ //#endregion
275
+ //#region src/_rules/container.ts
276
+ const containerParent = [[/^@container(?:\/(\w+))?(?:-(normal|inline-size|size))?$/, ([, l, v]) => {
277
+ return {
278
+ "container-type": v ?? "inline-size",
279
+ "container-name": l
280
+ };
281
+ }]];
282
+
283
+ //#endregion
284
+ //#region src/_rules/decoration.ts
285
+ const decorationStyles = [
286
+ "solid",
287
+ "double",
288
+ "dotted",
289
+ "dashed",
290
+ "wavy",
291
+ ...globalKeywords
292
+ ];
293
+ const textDecorations = [
294
+ [
295
+ /^(?:decoration-)?(underline|overline|line-through)$/,
296
+ ([, s]) => ({ "text-decoration-line": s }),
297
+ { autocomplete: "decoration-(underline|overline|line-through)" }
298
+ ],
299
+ [
300
+ /^(?:underline|decoration)-(?:size-)?(.+)$/,
301
+ handleWidth$2,
302
+ { autocomplete: "(underline|decoration)-<num>" }
303
+ ],
304
+ [
305
+ /^(?:underline|decoration)-(auto|from-font)$/,
306
+ ([, s]) => ({ "text-decoration-thickness": s }),
307
+ { autocomplete: "(underline|decoration)-(auto|from-font)" }
308
+ ],
309
+ [
310
+ /^(?:underline|decoration)-(.+)$/,
311
+ handleColorOrWidth$2,
312
+ { autocomplete: "(underline|decoration)-$colors" }
313
+ ],
314
+ [
315
+ /^(?:underline|decoration)-op(?:acity)?-?(.+)$/,
316
+ ([, opacity$1]) => ({ "--un-line-opacity": h.bracket.percent.cssvar(opacity$1) }),
317
+ { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }
318
+ ],
319
+ [
320
+ /^(?:underline|decoration)-offset-(.+)$/,
321
+ ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? h.auto.bracket.cssvar.global.px(s) }),
322
+ { autocomplete: "(underline|decoration)-(offset)-<num>" }
323
+ ],
324
+ ...decorationStyles.map((v) => [`underline-${v}`, { "text-decoration-style": v }]),
325
+ ...decorationStyles.map((v) => [`decoration-${v}`, { "text-decoration-style": v }]),
326
+ ["no-underline", { "text-decoration": "none" }],
327
+ ["decoration-none", { "text-decoration": "none" }]
328
+ ];
329
+ function handleWidth$2([, b], { theme }) {
330
+ return { "text-decoration-thickness": theme.lineWidth?.[b] ?? h.bracket.cssvar.global.px(b) };
331
+ }
332
+ function handleColorOrWidth$2(match, ctx) {
333
+ if (isCSSMathFn(h.bracket(match[1]))) return handleWidth$2(match, ctx);
334
+ const result = colorResolver("text-decoration-color", "line", "borderColor")(match, ctx);
335
+ if (result) return {
336
+ "-webkit-text-decoration-color": result["text-decoration-color"],
337
+ ...result
338
+ };
339
+ }
340
+
341
+ //#endregion
342
+ //#region src/_rules/flex.ts
343
+ const flex = [
344
+ ["flex", { display: "flex" }],
345
+ ["inline-flex", { display: "inline-flex" }],
346
+ ["flex-inline", { display: "inline-flex" }],
347
+ [/^flex-(.*)$/, ([, d]) => ({ flex: h.bracket(d) != null ? h.bracket(d).split(" ").map((e) => h.cssvar.fraction(e) ?? e).join(" ") : h.cssvar.fraction(d) })],
348
+ ["flex-1", { flex: "1 1 0%" }],
349
+ ["flex-auto", { flex: "1 1 auto" }],
350
+ ["flex-initial", { flex: "0 1 auto" }],
351
+ ["flex-none", { flex: "none" }],
352
+ [
353
+ /^(?:flex-)?shrink(?:-(.*))?$/,
354
+ ([, d = ""]) => ({ "flex-shrink": h.bracket.cssvar.number(d) ?? 1 }),
355
+ { autocomplete: ["flex-shrink-<num>", "shrink-<num>"] }
356
+ ],
357
+ [
358
+ /^(?:flex-)?grow(?:-(.*))?$/,
359
+ ([, d = ""]) => ({ "flex-grow": h.bracket.cssvar.number(d) ?? 1 }),
360
+ { autocomplete: ["flex-grow-<num>", "grow-<num>"] }
361
+ ],
362
+ [
363
+ /^(?:flex-)?basis-(.+)$/,
364
+ ([, d], { theme }) => ({ "flex-basis": theme.spacing?.[d] ?? h.bracket.cssvar.auto.fraction.rem(d) }),
365
+ { autocomplete: ["flex-basis-$spacing", "basis-$spacing"] }
366
+ ],
367
+ ["flex-row", { "flex-direction": "row" }],
368
+ ["flex-row-reverse", { "flex-direction": "row-reverse" }],
369
+ ["flex-col", { "flex-direction": "column" }],
370
+ ["flex-col-reverse", { "flex-direction": "column-reverse" }],
371
+ ["flex-wrap", { "flex-wrap": "wrap" }],
372
+ ["flex-wrap-reverse", { "flex-wrap": "wrap-reverse" }],
373
+ ["flex-nowrap", { "flex-wrap": "nowrap" }]
374
+ ];
375
+
376
+ //#endregion
377
+ //#region src/_rules/gap.ts
378
+ const directions = {
379
+ "": "",
380
+ "x": "column-",
381
+ "y": "row-",
382
+ "col": "column-",
383
+ "row": "row-"
384
+ };
385
+ function handleGap([, d = "", s], { theme }) {
386
+ const v = theme.spacing?.[s] ?? h.bracket.cssvar.global.rem(s);
387
+ if (v != null) return { [`${directions[d]}gap`]: v };
388
+ }
389
+ const gaps = [
390
+ [
391
+ /^(?:flex-|grid-)?gap-?()(.+)$/,
392
+ handleGap,
393
+ { autocomplete: ["gap-$spacing", "gap-<num>"] }
394
+ ],
395
+ [
396
+ /^(?:flex-|grid-)?gap-([xy])-?(.+)$/,
397
+ handleGap,
398
+ { autocomplete: ["gap-(x|y)-$spacing", "gap-(x|y)-<num>"] }
399
+ ],
400
+ [
401
+ /^(?:flex-|grid-)?gap-(col|row)-?(.+)$/,
402
+ handleGap,
403
+ { autocomplete: ["gap-(col|row)-$spacing", "gap-(col|row)-<num>"] }
404
+ ]
405
+ ];
406
+
407
+ //#endregion
408
+ //#region src/_rules/grid.ts
409
+ function rowCol(s) {
410
+ return s.replace("col", "column");
411
+ }
412
+ function rowColTheme(s) {
413
+ return s[0] === "r" ? "Row" : "Column";
414
+ }
415
+ function autoDirection(c, theme, prop) {
416
+ const v = theme[`gridAuto${rowColTheme(c)}`]?.[prop];
417
+ if (v != null) return v;
418
+ switch (prop) {
419
+ case "min": return "min-content";
420
+ case "max": return "max-content";
421
+ case "fr": return "minmax(0,1fr)";
422
+ }
423
+ return h.bracket.cssvar.auto.rem(prop);
424
+ }
425
+ const grids = [
426
+ ["grid", { display: "grid" }],
427
+ ["inline-grid", { display: "inline-grid" }],
428
+ [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-${rowCol(c)}`]: theme[`grid${rowColTheme(c)}`]?.[v] ?? h.bracket.cssvar.auto(v) })],
429
+ [
430
+ /^(?:grid-)?(row|col)-span-(.+)$/,
431
+ ([, c, s]) => {
432
+ if (s === "full") return { [`grid-${rowCol(c)}`]: "1/-1" };
433
+ const v = h.bracket.number(s);
434
+ if (v != null) return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
435
+ },
436
+ { autocomplete: "(grid-row|grid-col|row|col)-span-<num>" }
437
+ ],
438
+ [/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: h.bracket.cssvar(v) ?? v })],
439
+ [
440
+ /^(?:grid-)?(row|col)-end-(.+)$/,
441
+ ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: h.bracket.cssvar(v) ?? v }),
442
+ { autocomplete: "(grid-row|grid-col|row|col)-(start|end)-<num>" }
443
+ ],
444
+ [
445
+ /^(?:grid-)?auto-(rows|cols)-(.+)$/,
446
+ ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(c, theme, v) }),
447
+ { autocomplete: "(grid-auto|auto)-(rows|cols)-<num>" }
448
+ ],
449
+ [/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": h.bracket.cssvar(v) })],
450
+ [
451
+ /^(?:grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)$/,
452
+ ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") }),
453
+ { autocomplete: ["(grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)"] }
454
+ ],
455
+ [/^(?:grid-)?(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-template-${rowCol(c)}`]: theme[`gridTemplate${rowColTheme(c)}`]?.[v] ?? h.bracket.cssvar(v) })],
456
+ [/^(?:grid-)?(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
457
+ [
458
+ /^(?:grid-)?(rows|cols)-(\d+)$/,
459
+ ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` }),
460
+ { autocomplete: "(grid-rows|grid-cols|rows|cols)-<num>" }
461
+ ],
462
+ [/^grid-area(s)?-(.+)$/, ([, s, v]) => {
463
+ if (s != null) return { "grid-template-areas": h.cssvar(v) ?? v.split("-").map((s$1) => `"${h.bracket(s$1)}"`).join(" ") };
464
+ return { "grid-area": h.bracket.cssvar(v) };
465
+ }],
466
+ ["grid-rows-none", { "grid-template-rows": "none" }],
467
+ ["grid-cols-none", { "grid-template-columns": "none" }],
468
+ ["grid-rows-subgrid", { "grid-template-rows": "subgrid" }],
469
+ ["grid-cols-subgrid", { "grid-template-columns": "subgrid" }]
470
+ ];
471
+
472
+ //#endregion
473
+ //#region src/_rules/layout.ts
474
+ const overflowValues = [
475
+ "auto",
476
+ "hidden",
477
+ "clip",
478
+ "visible",
479
+ "scroll",
480
+ "overlay",
481
+ ...globalKeywords
482
+ ];
483
+ const overflows = [[
484
+ /^(?:overflow|of)-(.+)$/,
485
+ ([, v]) => overflowValues.includes(v) ? { overflow: v } : void 0,
486
+ { autocomplete: [`(overflow|of)-(${overflowValues.join("|")})`, `(overflow|of)-(x|y)-(${overflowValues.join("|")})`] }
487
+ ], [/^(?:overflow|of)-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]];
488
+
489
+ //#endregion
490
+ //#region src/_rules/position.ts
491
+ const positions = [
492
+ [
493
+ /^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/,
494
+ ([, v]) => ({ position: v }),
495
+ { autocomplete: [
496
+ "(position|pos)-<position>",
497
+ "(position|pos)-<globalKeyword>",
498
+ "<position>"
499
+ ] }
500
+ ],
501
+ [/^(?:position-|pos-)([-\w]+)$/, ([, v]) => globalKeywords.includes(v) ? { position: v } : void 0],
502
+ [/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
503
+ ];
504
+ const justifies = [
505
+ ["justify-start", { "justify-content": "flex-start" }],
506
+ ["justify-end", { "justify-content": "flex-end" }],
507
+ ["justify-center", { "justify-content": "center" }],
508
+ ["justify-between", { "justify-content": "space-between" }],
509
+ ["justify-around", { "justify-content": "space-around" }],
510
+ ["justify-evenly", { "justify-content": "space-evenly" }],
511
+ ["justify-stretch", { "justify-content": "stretch" }],
512
+ ["justify-left", { "justify-content": "left" }],
513
+ ["justify-right", { "justify-content": "right" }],
514
+ ["justify-center-safe", { "justify-content": "safe center" }],
515
+ ["justify-end-safe", { "justify-content": "safe flex-end" }],
516
+ ["justify-normal", { "justify-content": "normal" }],
517
+ ...makeGlobalStaticRules("justify", "justify-content"),
518
+ ["justify-items-start", { "justify-items": "start" }],
519
+ ["justify-items-end", { "justify-items": "end" }],
520
+ ["justify-items-center", { "justify-items": "center" }],
521
+ ["justify-items-stretch", { "justify-items": "stretch" }],
522
+ ["justify-items-center-safe", { "justify-items": "safe center" }],
523
+ ["justify-items-end-safe", { "justify-items": "safe flex-end" }],
524
+ ...makeGlobalStaticRules("justify-items"),
525
+ ["justify-self-auto", { "justify-self": "auto" }],
526
+ ["justify-self-start", { "justify-self": "start" }],
527
+ ["justify-self-end", { "justify-self": "end" }],
528
+ ["justify-self-center", { "justify-self": "center" }],
529
+ ["justify-self-stretch", { "justify-self": "stretch" }],
530
+ ["justify-self-baseline", { "justify-self": "baseline" }],
531
+ ["justify-self-center-safe", { "justify-self": "safe center" }],
532
+ ["justify-self-end-safe", { "justify-self": "safe flex-end" }],
533
+ ...makeGlobalStaticRules("justify-self")
534
+ ];
535
+ const orders = [
536
+ [/^order-(.+)$/, ([, v]) => ({ order: h.bracket.cssvar.number(v) })],
537
+ ["order-first", { order: "-9999" }],
538
+ ["order-last", { order: "9999" }],
539
+ ["order-none", { order: "0" }]
540
+ ];
541
+ const alignments = [
542
+ ["content-center", { "align-content": "center" }],
543
+ ["content-start", { "align-content": "flex-start" }],
544
+ ["content-end", { "align-content": "flex-end" }],
545
+ ["content-between", { "align-content": "space-between" }],
546
+ ["content-around", { "align-content": "space-around" }],
547
+ ["content-evenly", { "align-content": "space-evenly" }],
548
+ ["content-baseline", { "align-content": "baseline" }],
549
+ ["content-center-safe", { "align-content": "safe center" }],
550
+ ["content-end-safe", { "align-content": "safe flex-end" }],
551
+ ["content-stretch", { "align-content": "stretch" }],
552
+ ["content-normal", { "align-content": "normal" }],
553
+ ...makeGlobalStaticRules("content", "align-content"),
554
+ ["items-start", { "align-items": "flex-start" }],
555
+ ["items-end", { "align-items": "flex-end" }],
556
+ ["items-center", { "align-items": "center" }],
557
+ ["items-baseline", { "align-items": "baseline" }],
558
+ ["items-stretch", { "align-items": "stretch" }],
559
+ ["items-baseline-last", { "align-items": "last baseline" }],
560
+ ["items-center-safe", { "align-items": "safe center" }],
561
+ ["items-end-safe", { "align-items": "safe flex-end" }],
562
+ ...makeGlobalStaticRules("items", "align-items"),
563
+ ["self-auto", { "align-self": "auto" }],
564
+ ["self-start", { "align-self": "flex-start" }],
565
+ ["self-end", { "align-self": "flex-end" }],
566
+ ["self-center", { "align-self": "center" }],
567
+ ["self-stretch", { "align-self": "stretch" }],
568
+ ["self-baseline", { "align-self": "baseline" }],
569
+ ["self-baseline-last", { "align-self": "last baseline" }],
570
+ ["self-center-safe", { "align-self": "safe center" }],
571
+ ["self-end-safe", { "align-self": "safe flex-end" }],
572
+ ...makeGlobalStaticRules("self", "align-self")
573
+ ];
574
+ const placements = [
575
+ ["place-content-center", { "place-content": "center" }],
576
+ ["place-content-start", { "place-content": "start" }],
577
+ ["place-content-end", { "place-content": "end" }],
578
+ ["place-content-between", { "place-content": "space-between" }],
579
+ ["place-content-around", { "place-content": "space-around" }],
580
+ ["place-content-evenly", { "place-content": "space-evenly" }],
581
+ ["place-content-stretch", { "place-content": "stretch" }],
582
+ ["place-content-baseline", { "place-content": "baseline" }],
583
+ ["place-content-center-safe", { "place-content": "safe center" }],
584
+ ["place-content-end-safe", { "place-content": "safe flex-end" }],
585
+ ...makeGlobalStaticRules("place-content"),
586
+ ["place-items-start", { "place-items": "start" }],
587
+ ["place-items-end", { "place-items": "end" }],
588
+ ["place-items-center", { "place-items": "center" }],
589
+ ["place-items-stretch", { "place-items": "stretch" }],
590
+ ["place-items-baseline", { "place-items": "baseline" }],
591
+ ["place-items-center-safe", { "place-items": "safe center" }],
592
+ ["place-items-end-safe", { "place-items": "safe flex-end" }],
593
+ ...makeGlobalStaticRules("place-items"),
594
+ ["place-self-auto", { "place-self": "auto" }],
595
+ ["place-self-start", { "place-self": "start" }],
596
+ ["place-self-end", { "place-self": "end" }],
597
+ ["place-self-center", { "place-self": "center" }],
598
+ ["place-self-stretch", { "place-self": "stretch" }],
599
+ ["place-self-center-safe", { "place-self": "safe center" }],
600
+ ["place-self-end-safe", { "place-self": "safe flex-end" }],
601
+ ...makeGlobalStaticRules("place-self")
602
+ ];
603
+ /**
604
+ * This is to add `flex-` and `grid-` prefix to the alignment rules,
605
+ * supporting `flex="~ items-center"` in attributify mode.
606
+ */
607
+ const flexGridJustifiesAlignments = [
608
+ ...justifies,
609
+ ...alignments,
610
+ ...placements
611
+ ].flatMap(([k, v]) => [[`flex-${k}`, v], [`grid-${k}`, v]]);
612
+ function handleInsetValue(v, { theme }) {
613
+ return theme.spacing?.[v] ?? h.bracket.cssvar.global.auto.fraction.rem(v);
614
+ }
615
+ function handleInsetValues([, d, v], ctx) {
616
+ const r = handleInsetValue(v, ctx);
617
+ if (r != null && d in insetMap) return insetMap[d].map((i) => [i.slice(1), r]);
618
+ }
619
+ const insets = [
620
+ [
621
+ /^(?:position-|pos-)?inset-(.+)$/,
622
+ ([, v], ctx) => ({ inset: handleInsetValue(v, ctx) }),
623
+ { autocomplete: [
624
+ "(position|pos)-inset-<directions>-$spacing",
625
+ "(position|pos)-inset-(block|inline)-$spacing",
626
+ "(position|pos)-inset-(bs|be|is|ie)-$spacing",
627
+ "(position|pos)-(top|left|right|bottom)-$spacing"
628
+ ] }
629
+ ],
630
+ [/^(?:position-|pos-)?(start|end)-(.+)$/, handleInsetValues],
631
+ [/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
632
+ [/^(?:position-|pos-)?inset-([rltbse])-(.+)$/, handleInsetValues],
633
+ [/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
634
+ [/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
635
+ [/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v], ctx) => ({ [d]: handleInsetValue(v, ctx) })]
636
+ ];
637
+ const floats = [
638
+ ["float-left", { float: "left" }],
639
+ ["float-right", { float: "right" }],
640
+ ["float-start", { float: "inline-start" }],
641
+ ["float-end", { float: "inline-end" }],
642
+ ["float-none", { float: "none" }],
643
+ ...makeGlobalStaticRules("float"),
644
+ ["clear-left", { clear: "left" }],
645
+ ["clear-right", { clear: "right" }],
646
+ ["clear-both", { clear: "both" }],
647
+ ["clear-start", { clear: "inline-start" }],
648
+ ["clear-end", { clear: "inline-end" }],
649
+ ["clear-none", { clear: "none" }],
650
+ ...makeGlobalStaticRules("clear")
651
+ ];
652
+ const zIndexes = [[/^(?:position-|pos-)?z([\d.]+)$/, ([, v]) => ({ "z-index": h.number(v) })], [
653
+ /^(?:position-|pos-)?z-(.+)$/,
654
+ ([, v], { theme }) => ({ "z-index": theme.zIndex?.[v] ?? h.bracket.cssvar.global.auto.number(v) }),
655
+ { autocomplete: "z-<num>" }
656
+ ]];
657
+ const boxSizing = [
658
+ ["box-border", { "box-sizing": "border-box" }],
659
+ ["box-content", { "box-sizing": "content-box" }],
660
+ ...makeGlobalStaticRules("box", "box-sizing")
661
+ ];
662
+
663
+ //#endregion
664
+ //#region src/_rules/question-mark.ts
665
+ /**
666
+ * Used for debugging, only available in development mode.
667
+ *
668
+ * @example `?` / `where`
669
+ */
670
+ const questionMark = [[/^(where|\?)$/, (_, { constructCSS, generator }) => {
671
+ if (generator.userConfig.envMode === "dev") return `@keyframes __un_qm{0%{box-shadow:inset 4px 4px #ff1e90, inset -4px -4px #ff1e90}100%{box-shadow:inset 8px 8px #3399ff, inset -8px -8px #3399ff}} ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
672
+ }]];
673
+
674
+ //#endregion
675
+ //#region src/_rules/static.ts
676
+ const cursorValues = [
677
+ "auto",
678
+ "default",
679
+ "none",
680
+ "context-menu",
681
+ "help",
682
+ "pointer",
683
+ "progress",
684
+ "wait",
685
+ "cell",
686
+ "crosshair",
687
+ "text",
688
+ "vertical-text",
689
+ "alias",
690
+ "copy",
691
+ "move",
692
+ "no-drop",
693
+ "not-allowed",
694
+ "grab",
695
+ "grabbing",
696
+ "all-scroll",
697
+ "col-resize",
698
+ "row-resize",
699
+ "n-resize",
700
+ "e-resize",
701
+ "s-resize",
702
+ "w-resize",
703
+ "ne-resize",
704
+ "nw-resize",
705
+ "se-resize",
706
+ "sw-resize",
707
+ "ew-resize",
708
+ "ns-resize",
709
+ "nesw-resize",
710
+ "nwse-resize",
711
+ "zoom-in",
712
+ "zoom-out"
713
+ ];
714
+ const containValues = [
715
+ "none",
716
+ "strict",
717
+ "content",
718
+ "size",
719
+ "inline-size",
720
+ "layout",
721
+ "style",
722
+ "paint"
723
+ ];
724
+ const varEmpty = " ";
725
+ const displays = [
726
+ ["inline", { display: "inline" }],
727
+ ["block", { display: "block" }],
728
+ ["inline-block", { display: "inline-block" }],
729
+ ["contents", { display: "contents" }],
730
+ ["flow-root", { display: "flow-root" }],
731
+ ["list-item", { display: "list-item" }],
732
+ ["hidden", { display: "none" }],
733
+ [/^display-(.+)$/, ([, c]) => ({ display: h.bracket.cssvar.global(c) })]
734
+ ];
735
+ const appearances = [
736
+ ["visible", { visibility: "visible" }],
737
+ ["invisible", { visibility: "hidden" }],
738
+ ["backface-visible", { "backface-visibility": "visible" }],
739
+ ["backface-hidden", { "backface-visibility": "hidden" }],
740
+ ...makeGlobalStaticRules("backface", "backface-visibility")
741
+ ];
742
+ const cursors = [[/^cursor-(.+)$/, ([, c]) => ({ cursor: h.bracket.cssvar.global(c) })], ...cursorValues.map((v) => [`cursor-${v}`, { cursor: v }])];
743
+ const contains = [[/^contain-(.*)$/, ([, d]) => {
744
+ if (h.bracket(d) != null) return { contain: h.bracket(d).split(" ").map((e) => h.cssvar.fraction(e) ?? e).join(" ") };
745
+ return containValues.includes(d) ? { contain: d } : void 0;
746
+ }]];
747
+ const pointerEvents = [
748
+ ["pointer-events-auto", { "pointer-events": "auto" }],
749
+ ["pointer-events-none", { "pointer-events": "none" }],
750
+ ...makeGlobalStaticRules("pointer-events")
751
+ ];
752
+ const resizes = [
753
+ ["resize-x", { resize: "horizontal" }],
754
+ ["resize-y", { resize: "vertical" }],
755
+ ["resize", { resize: "both" }],
756
+ ["resize-none", { resize: "none" }],
757
+ ...makeGlobalStaticRules("resize")
758
+ ];
759
+ const userSelects = [
760
+ ["select-auto", {
761
+ "-webkit-user-select": "auto",
762
+ "user-select": "auto"
763
+ }],
764
+ ["select-all", {
765
+ "-webkit-user-select": "all",
766
+ "user-select": "all"
767
+ }],
768
+ ["select-text", {
769
+ "-webkit-user-select": "text",
770
+ "user-select": "text"
771
+ }],
772
+ ["select-none", {
773
+ "-webkit-user-select": "none",
774
+ "user-select": "none"
775
+ }],
776
+ ...makeGlobalStaticRules("select", "user-select")
777
+ ];
778
+ const whitespaces = [[
779
+ /^(?:whitespace-|ws-)([-\w]+)$/,
780
+ ([, v]) => [
781
+ "normal",
782
+ "nowrap",
783
+ "pre",
784
+ "pre-line",
785
+ "pre-wrap",
786
+ "break-spaces",
787
+ ...globalKeywords
788
+ ].includes(v) ? { "white-space": v } : void 0,
789
+ { autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)" }
790
+ ]];
791
+ const contentVisibility = [
792
+ [
793
+ /^intrinsic-size-(.+)$/,
794
+ ([, d]) => ({ "contain-intrinsic-size": h.bracket.cssvar.global.fraction.rem(d) }),
795
+ { autocomplete: "intrinsic-size-<num>" }
796
+ ],
797
+ ["content-visibility-visible", { "content-visibility": "visible" }],
798
+ ["content-visibility-hidden", { "content-visibility": "hidden" }],
799
+ ["content-visibility-auto", { "content-visibility": "auto" }],
800
+ ...makeGlobalStaticRules("content-visibility")
801
+ ];
802
+ const contents = [
803
+ [/^content-(.+)$/, ([, v]) => ({ content: h.bracket.cssvar(v) })],
804
+ ["content-empty", { content: "\"\"" }],
805
+ ["content-none", { content: "none" }]
806
+ ];
807
+ const breaks = [
808
+ ["break-normal", {
809
+ "overflow-wrap": "normal",
810
+ "word-break": "normal"
811
+ }],
812
+ ["break-words", { "overflow-wrap": "break-word" }],
813
+ ["break-all", { "word-break": "break-all" }],
814
+ ["break-keep", { "word-break": "keep-all" }],
815
+ ["break-anywhere", { "overflow-wrap": "anywhere" }]
816
+ ];
817
+ const textWraps = [
818
+ ["text-wrap", { "text-wrap": "wrap" }],
819
+ ["text-nowrap", { "text-wrap": "nowrap" }],
820
+ ["text-balance", { "text-wrap": "balance" }],
821
+ ["text-pretty", { "text-wrap": "pretty" }]
822
+ ];
823
+ const textOverflows = [
824
+ ["truncate", {
825
+ "overflow": "hidden",
826
+ "text-overflow": "ellipsis",
827
+ "white-space": "nowrap"
828
+ }],
829
+ ["text-truncate", {
830
+ "overflow": "hidden",
831
+ "text-overflow": "ellipsis",
832
+ "white-space": "nowrap"
833
+ }],
834
+ ["text-ellipsis", { "text-overflow": "ellipsis" }],
835
+ ["text-clip", { "text-overflow": "clip" }]
836
+ ];
837
+ const textTransforms = [
838
+ ["case-upper", { "text-transform": "uppercase" }],
839
+ ["case-lower", { "text-transform": "lowercase" }],
840
+ ["case-capital", { "text-transform": "capitalize" }],
841
+ ["case-normal", { "text-transform": "none" }],
842
+ ...makeGlobalStaticRules("case", "text-transform")
843
+ ];
844
+ const fontStyles = [
845
+ ["italic", { "font-style": "italic" }],
846
+ ["not-italic", { "font-style": "normal" }],
847
+ ["font-italic", { "font-style": "italic" }],
848
+ ["font-not-italic", { "font-style": "normal" }],
849
+ ["oblique", { "font-style": "oblique" }],
850
+ ["not-oblique", { "font-style": "normal" }],
851
+ ["font-oblique", { "font-style": "oblique" }],
852
+ ["font-not-oblique", { "font-style": "normal" }]
853
+ ];
854
+ const fontSmoothings = [["antialiased", {
855
+ "-webkit-font-smoothing": "antialiased",
856
+ "-moz-osx-font-smoothing": "grayscale"
857
+ }], ["subpixel-antialiased", {
858
+ "-webkit-font-smoothing": "auto",
859
+ "-moz-osx-font-smoothing": "auto"
860
+ }]];
861
+ const fieldSizing = [["field-sizing-fixed", { "field-sizing": "fixed" }], ["field-sizing-content", { "field-sizing": "content" }]];
862
+
863
+ //#endregion
864
+ //#region src/_rules/ring.ts
865
+ const ringBase = {
866
+ "--un-ring-inset": varEmpty,
867
+ "--un-ring-offset-width": "0px",
868
+ "--un-ring-offset-color": "#fff",
869
+ "--un-ring-width": "0px",
870
+ "--un-ring-color": "rgb(147 197 253 / 0.5)",
871
+ "--un-shadow": "0 0 rgb(0 0 0 / 0)"
872
+ };
873
+ const preflightKeys$2 = Object.keys(ringBase);
874
+ const rings = [
875
+ [
876
+ /^ring(?:-(.+))?$/,
877
+ ([, d], { theme }) => {
878
+ const value = theme.ringWidth?.[d || "DEFAULT"] ?? h.px(d || "1");
879
+ if (value) return {
880
+ "--un-ring-width": value,
881
+ "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
882
+ "--un-ring-shadow": "var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color)",
883
+ "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
884
+ };
885
+ },
886
+ {
887
+ custom: { preflightKeys: preflightKeys$2 },
888
+ autocomplete: "ring-$ringWidth"
889
+ }
890
+ ],
891
+ [
892
+ /^ring-(?:width-|size-)(.+)$/,
893
+ handleWidth$1,
894
+ { autocomplete: "ring-(width|size)-$lineWidth" }
895
+ ],
896
+ ["ring-offset", { "--un-ring-offset-width": "1px" }],
897
+ [
898
+ /^ring-offset-(?:width-|size-)?(.+)$/,
899
+ ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? h.bracket.cssvar.px(d) }),
900
+ { autocomplete: "ring-offset-(width|size)-$lineWidth" }
901
+ ],
902
+ [
903
+ /^ring-(.+)$/,
904
+ handleColorOrWidth$1,
905
+ { autocomplete: "ring-$colors" }
906
+ ],
907
+ [
908
+ /^ring-op(?:acity)?-?(.+)$/,
909
+ ([, opacity$1]) => ({ "--un-ring-opacity": h.bracket.percent.cssvar(opacity$1) }),
910
+ { autocomplete: "ring-(op|opacity)-<percent>" }
911
+ ],
912
+ [
913
+ /^ring-offset-(.+)$/,
914
+ colorResolver("--un-ring-offset-color", "ring-offset", "borderColor"),
915
+ { autocomplete: "ring-offset-$colors" }
916
+ ],
917
+ [
918
+ /^ring-offset-op(?:acity)?-?(.+)$/,
919
+ ([, opacity$1]) => ({ "--un-ring-offset-opacity": h.bracket.percent.cssvar(opacity$1) }),
920
+ { autocomplete: "ring-offset-(op|opacity)-<percent>" }
921
+ ],
922
+ ["ring-inset", { "--un-ring-inset": "inset" }]
923
+ ];
924
+ function handleWidth$1([, b], { theme }) {
925
+ return { "--un-ring-width": theme.ringWidth?.[b] ?? h.bracket.cssvar.px(b) };
926
+ }
927
+ function handleColorOrWidth$1(match, ctx) {
928
+ if (isCSSMathFn(h.bracket(match[1]))) return handleWidth$1(match, ctx);
929
+ return colorResolver("--un-ring-color", "ring", "borderColor")(match, ctx);
930
+ }
931
+
932
+ //#endregion
933
+ //#region src/_rules/shadow.ts
934
+ const boxShadowsBase = {
935
+ "--un-ring-offset-shadow": "0 0 rgb(0 0 0 / 0)",
936
+ "--un-ring-shadow": "0 0 rgb(0 0 0 / 0)",
937
+ "--un-shadow-inset": varEmpty,
938
+ "--un-shadow": "0 0 rgb(0 0 0 / 0)"
939
+ };
940
+ const preflightKeys$1 = Object.keys(boxShadowsBase);
941
+ const boxShadows = [
942
+ [
943
+ /^shadow(?:-(.+))?$/,
944
+ (match, context) => {
945
+ const [, d] = match;
946
+ const { theme } = context;
947
+ const v = theme.boxShadow?.[d || "DEFAULT"];
948
+ const c = d ? h.bracket.cssvar(d) : void 0;
949
+ if ((v != null || c != null) && !hasParseableColor(c, theme, "shadowColor")) return {
950
+ "--un-shadow": colorableShadows(v || c, "--un-shadow-color").join(","),
951
+ "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
952
+ };
953
+ return colorResolver("--un-shadow-color", "shadow", "shadowColor")(match, context);
954
+ },
955
+ {
956
+ custom: { preflightKeys: preflightKeys$1 },
957
+ autocomplete: ["shadow-$colors", "shadow-$boxShadow"]
958
+ }
959
+ ],
960
+ [
961
+ /^shadow-op(?:acity)?-?(.+)$/,
962
+ ([, opacity$1]) => ({ "--un-shadow-opacity": h.bracket.percent.cssvar(opacity$1) }),
963
+ { autocomplete: "shadow-(op|opacity)-<percent>" }
964
+ ],
965
+ ["shadow-inset", { "--un-shadow-inset": "inset" }]
966
+ ];
967
+
968
+ //#endregion
969
+ //#region src/_rules/size.ts
970
+ const sizeMapping = {
971
+ h: "height",
972
+ w: "width",
973
+ inline: "inline-size",
974
+ block: "block-size"
975
+ };
976
+ function getPropName(minmax, hw) {
977
+ return `${minmax || ""}${sizeMapping[hw]}`;
978
+ }
979
+ function getSizeValue(minmax, hw, theme, prop) {
980
+ const v = theme[getPropName(minmax, hw).replace(/-(\w)/g, (_, p) => p.toUpperCase())]?.[prop];
981
+ if (v != null) return v;
982
+ switch (prop) {
983
+ case "fit":
984
+ case "max":
985
+ case "min": return `${prop}-content`;
986
+ }
987
+ return h.bracket.cssvar.global.auto.fraction.rem(prop);
988
+ }
989
+ const sizes = [
990
+ [/^size-(min-|max-)?(.+)$/, ([, m, s], { theme }) => ({
991
+ [getPropName(m, "w")]: getSizeValue(m, "w", theme, s),
992
+ [getPropName(m, "h")]: getSizeValue(m, "h", theme, s)
993
+ })],
994
+ [/^(?:size-)?(min-|max-)?([wh])-?(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
995
+ [
996
+ /^(?:size-)?(min-|max-)?(block|inline)-(.+)$/,
997
+ ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) }),
998
+ { autocomplete: [
999
+ "(w|h)-$width|height|maxWidth|maxHeight|minWidth|minHeight|inlineSize|blockSize|maxInlineSize|maxBlockSize|minInlineSize|minBlockSize",
1000
+ "(block|inline)-$width|height|maxWidth|maxHeight|minWidth|minHeight|inlineSize|blockSize|maxInlineSize|maxBlockSize|minInlineSize|minBlockSize",
1001
+ "(max|min)-(w|h|block|inline)",
1002
+ "(max|min)-(w|h|block|inline)-$width|height|maxWidth|maxHeight|minWidth|minHeight|inlineSize|blockSize|maxInlineSize|maxBlockSize|minInlineSize|minBlockSize",
1003
+ "(w|h)-full",
1004
+ "(max|min)-(w|h)-full"
1005
+ ] }
1006
+ ],
1007
+ [/^(?:size-)?(min-|max-)?(h)-screen-(.+)$/, ([, m, h$1, p], context) => ({ [getPropName(m, h$1)]: handleBreakpoint(context, p, "verticalBreakpoints") })],
1008
+ [
1009
+ /^(?:size-)?(min-|max-)?(w)-screen-(.+)$/,
1010
+ ([, m, w, p], context) => ({ [getPropName(m, w)]: handleBreakpoint(context, p) }),
1011
+ { autocomplete: [
1012
+ "(w|h)-screen",
1013
+ "(min|max)-(w|h)-screen",
1014
+ "h-screen-$verticalBreakpoints",
1015
+ "(min|max)-h-screen-$verticalBreakpoints",
1016
+ "w-screen-$breakpoints",
1017
+ "(min|max)-w-screen-$breakpoints"
1018
+ ] }
1019
+ ]
1020
+ ];
1021
+ function handleBreakpoint(context, point, key = "breakpoints") {
1022
+ const bp = resolveBreakpoints(context, key);
1023
+ if (bp) return bp.find((i) => i.point === point)?.size;
1024
+ }
1025
+ function getAspectRatio(prop) {
1026
+ if (/^\d+\/\d+$/.test(prop)) return prop;
1027
+ switch (prop) {
1028
+ case "square": return "1/1";
1029
+ case "video": return "16/9";
1030
+ }
1031
+ return h.bracket.cssvar.global.auto.number(prop);
1032
+ }
1033
+ const aspectRatio = [[
1034
+ /^(?:size-)?aspect-(?:ratio-)?(.+)$/,
1035
+ ([, d]) => ({ "aspect-ratio": getAspectRatio(d) }),
1036
+ { autocomplete: ["aspect-(square|video|ratio)", "aspect-ratio-(square|video)"] }
1037
+ ]];
1038
+
1039
+ //#endregion
1040
+ //#region src/_rules/spacing.ts
1041
+ const paddings = [
1042
+ [
1043
+ /^pa?()-?(.+)$/,
1044
+ directionSize("padding"),
1045
+ { autocomplete: ["(m|p)<num>", "(m|p)-<num>"] }
1046
+ ],
1047
+ [
1048
+ /^p-?xy()()$/,
1049
+ directionSize("padding"),
1050
+ { autocomplete: "(m|p)-(xy)" }
1051
+ ],
1052
+ [/^p-?([xy])(?:-?(.+))?$/, directionSize("padding")],
1053
+ [
1054
+ /^p-?([rltbse])(?:-?(.+))?$/,
1055
+ directionSize("padding"),
1056
+ { autocomplete: "(m|p)<directions>-<num>" }
1057
+ ],
1058
+ [
1059
+ /^p-(block|inline)(?:-(.+))?$/,
1060
+ directionSize("padding"),
1061
+ { autocomplete: "(m|p)-(block|inline)-<num>" }
1062
+ ],
1063
+ [
1064
+ /^p-?([bi][se])(?:-?(.+))?$/,
1065
+ directionSize("padding"),
1066
+ { autocomplete: "(m|p)-(bs|be|is|ie)-<num>" }
1067
+ ]
1068
+ ];
1069
+ const margins = [
1070
+ [/^ma?()-?(.+)$/, directionSize("margin")],
1071
+ [/^m-?xy()()$/, directionSize("margin")],
1072
+ [/^m-?([xy])(?:-?(.+))?$/, directionSize("margin")],
1073
+ [/^m-?([rltbse])(?:-?(.+))?$/, directionSize("margin")],
1074
+ [/^m-(block|inline)(?:-(.+))?$/, directionSize("margin")],
1075
+ [/^m-?([bi][se])(?:-?(.+))?$/, directionSize("margin")]
1076
+ ];
1077
+
1078
+ //#endregion
1079
+ //#region src/_rules/svg.ts
1080
+ const svgUtilities = [
1081
+ [
1082
+ /^fill-(.+)$/,
1083
+ colorResolver("fill", "fill", "backgroundColor"),
1084
+ { autocomplete: "fill-$colors" }
1085
+ ],
1086
+ [
1087
+ /^fill-op(?:acity)?-?(.+)$/,
1088
+ ([, opacity$1]) => ({ "--un-fill-opacity": h.bracket.percent.cssvar(opacity$1) }),
1089
+ { autocomplete: "fill-(op|opacity)-<percent>" }
1090
+ ],
1091
+ ["fill-none", { fill: "none" }],
1092
+ [
1093
+ /^stroke-(?:width-|size-)?(.+)$/,
1094
+ handleWidth,
1095
+ { autocomplete: ["stroke-width-$lineWidth", "stroke-size-$lineWidth"] }
1096
+ ],
1097
+ [
1098
+ /^stroke-dash-(.+)$/,
1099
+ ([, s]) => ({ "stroke-dasharray": h.bracket.cssvar.number(s) }),
1100
+ { autocomplete: "stroke-dash-<num>" }
1101
+ ],
1102
+ [
1103
+ /^stroke-offset-(.+)$/,
1104
+ ([, s], { theme }) => ({ "stroke-dashoffset": theme.lineWidth?.[s] ?? h.bracket.cssvar.px.numberWithUnit(s) }),
1105
+ { autocomplete: "stroke-offset-$lineWidth" }
1106
+ ],
1107
+ [
1108
+ /^stroke-(.+)$/,
1109
+ handleColorOrWidth,
1110
+ { autocomplete: "stroke-$colors" }
1111
+ ],
1112
+ [
1113
+ /^stroke-op(?:acity)?-?(.+)$/,
1114
+ ([, opacity$1]) => ({ "--un-stroke-opacity": h.bracket.percent.cssvar(opacity$1) }),
1115
+ { autocomplete: "stroke-(op|opacity)-<percent>" }
1116
+ ],
1117
+ ["stroke-cap-square", { "stroke-linecap": "square" }],
1118
+ ["stroke-cap-round", { "stroke-linecap": "round" }],
1119
+ ["stroke-cap-auto", { "stroke-linecap": "butt" }],
1120
+ ["stroke-join-arcs", { "stroke-linejoin": "arcs" }],
1121
+ ["stroke-join-bevel", { "stroke-linejoin": "bevel" }],
1122
+ ["stroke-join-clip", { "stroke-linejoin": "miter-clip" }],
1123
+ ["stroke-join-round", { "stroke-linejoin": "round" }],
1124
+ ["stroke-join-auto", { "stroke-linejoin": "miter" }],
1125
+ ["stroke-none", { stroke: "none" }]
1126
+ ];
1127
+ function handleWidth([, b], { theme }) {
1128
+ return { "stroke-width": theme.lineWidth?.[b] ?? h.bracket.cssvar.fraction.px.number(b) };
1129
+ }
1130
+ function handleColorOrWidth(match, ctx) {
1131
+ if (isCSSMathFn(h.bracket(match[1]))) return handleWidth(match, ctx);
1132
+ return colorResolver("stroke", "stroke", "borderColor")(match, ctx);
1133
+ }
1134
+
1135
+ //#endregion
1136
+ //#region src/_rules/transform.ts
1137
+ const transformValues = [
1138
+ "translate",
1139
+ "rotate",
1140
+ "scale"
1141
+ ];
1142
+ const transformCpu = [
1143
+ "translateX(var(--un-translate-x))",
1144
+ "translateY(var(--un-translate-y))",
1145
+ "rotate(var(--un-rotate))",
1146
+ "rotateZ(var(--un-rotate-z))",
1147
+ "skewX(var(--un-skew-x))",
1148
+ "skewY(var(--un-skew-y))",
1149
+ "scaleX(var(--un-scale-x))",
1150
+ "scaleY(var(--un-scale-y))"
1151
+ ].join(" ");
1152
+ const transform = [
1153
+ "translateX(var(--un-translate-x))",
1154
+ "translateY(var(--un-translate-y))",
1155
+ "translateZ(var(--un-translate-z))",
1156
+ "rotate(var(--un-rotate))",
1157
+ "rotateX(var(--un-rotate-x))",
1158
+ "rotateY(var(--un-rotate-y))",
1159
+ "rotateZ(var(--un-rotate-z))",
1160
+ "skewX(var(--un-skew-x))",
1161
+ "skewY(var(--un-skew-y))",
1162
+ "scaleX(var(--un-scale-x))",
1163
+ "scaleY(var(--un-scale-y))",
1164
+ "scaleZ(var(--un-scale-z))"
1165
+ ].join(" ");
1166
+ const transformGpu = [
1167
+ "translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
1168
+ "rotate(var(--un-rotate))",
1169
+ "rotateX(var(--un-rotate-x))",
1170
+ "rotateY(var(--un-rotate-y))",
1171
+ "rotateZ(var(--un-rotate-z))",
1172
+ "skewX(var(--un-skew-x))",
1173
+ "skewY(var(--un-skew-y))",
1174
+ "scaleX(var(--un-scale-x))",
1175
+ "scaleY(var(--un-scale-y))",
1176
+ "scaleZ(var(--un-scale-z))"
1177
+ ].join(" ");
1178
+ const transformBase = {
1179
+ "--un-rotate": 0,
1180
+ "--un-rotate-x": 0,
1181
+ "--un-rotate-y": 0,
1182
+ "--un-rotate-z": 0,
1183
+ "--un-scale-x": 1,
1184
+ "--un-scale-y": 1,
1185
+ "--un-scale-z": 1,
1186
+ "--un-skew-x": 0,
1187
+ "--un-skew-y": 0,
1188
+ "--un-translate-x": 0,
1189
+ "--un-translate-y": 0,
1190
+ "--un-translate-z": 0
1191
+ };
1192
+ const preflightKeys = Object.keys(transformBase);
1193
+ const transforms = [
1194
+ [
1195
+ /^(?:transform-)?origin-(.+)$/,
1196
+ ([, s]) => ({ "transform-origin": positionMap[s] ?? h.bracket.cssvar(s) }),
1197
+ { autocomplete: [`transform-origin-(${Object.keys(positionMap).join("|")})`, `origin-(${Object.keys(positionMap).join("|")})`] }
1198
+ ],
1199
+ [/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
1200
+ const v = h.bracket.cssvar.px.numberWithUnit(s);
1201
+ if (v != null) return {
1202
+ "-webkit-perspective": v,
1203
+ "perspective": v
1204
+ };
1205
+ }],
1206
+ [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
1207
+ const v = h.bracket.cssvar(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
1208
+ if (v != null) return {
1209
+ "-webkit-perspective-origin": v,
1210
+ "perspective-origin": v
1211
+ };
1212
+ }],
1213
+ [
1214
+ /^(?:transform-)?translate-()(.+)$/,
1215
+ handleTranslate,
1216
+ { custom: { preflightKeys } }
1217
+ ],
1218
+ [
1219
+ /^(?:transform-)?translate-([xyz])-(.+)$/,
1220
+ handleTranslate,
1221
+ { custom: { preflightKeys } }
1222
+ ],
1223
+ [
1224
+ /^(?:transform-)?rotate-()(.+)$/,
1225
+ handleRotate,
1226
+ { custom: { preflightKeys } }
1227
+ ],
1228
+ [
1229
+ /^(?:transform-)?rotate-([xyz])-(.+)$/,
1230
+ handleRotate,
1231
+ { custom: { preflightKeys } }
1232
+ ],
1233
+ [
1234
+ /^(?:transform-)?skew-()(.+)$/,
1235
+ handleSkew,
1236
+ { custom: { preflightKeys } }
1237
+ ],
1238
+ [
1239
+ /^(?:transform-)?skew-([xy])-(.+)$/,
1240
+ handleSkew,
1241
+ {
1242
+ custom: { preflightKeys },
1243
+ autocomplete: ["transform-skew-(x|y)-<percent>", "skew-(x|y)-<percent>"]
1244
+ }
1245
+ ],
1246
+ [
1247
+ /^(?:transform-)?scale-()(.+)$/,
1248
+ handleScale,
1249
+ { custom: { preflightKeys } }
1250
+ ],
1251
+ [
1252
+ /^(?:transform-)?scale-([xyz])-(.+)$/,
1253
+ handleScale,
1254
+ {
1255
+ custom: { preflightKeys },
1256
+ autocomplete: [
1257
+ `transform-(${transformValues.join("|")})-<percent>`,
1258
+ `transform-(${transformValues.join("|")})-(x|y|z)-<percent>`,
1259
+ `(${transformValues.join("|")})-<percent>`,
1260
+ `(${transformValues.join("|")})-(x|y|z)-<percent>`
1261
+ ]
1262
+ }
1263
+ ],
1264
+ [/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
1265
+ [/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
1266
+ [
1267
+ "transform",
1268
+ { transform },
1269
+ { custom: { preflightKeys } }
1270
+ ],
1271
+ [
1272
+ "transform-cpu",
1273
+ { transform: transformCpu },
1274
+ { custom: { preflightKeys: [
1275
+ "--un-translate-x",
1276
+ "--un-translate-y",
1277
+ "--un-rotate",
1278
+ "--un-rotate-z",
1279
+ "--un-skew-x",
1280
+ "--un-skew-y",
1281
+ "--un-scale-x",
1282
+ "--un-scale-y"
1283
+ ] } }
1284
+ ],
1285
+ [
1286
+ "transform-gpu",
1287
+ { transform: transformGpu },
1288
+ { custom: { preflightKeys } }
1289
+ ],
1290
+ ["transform-none", { transform: "none" }],
1291
+ ...makeGlobalStaticRules("transform")
1292
+ ];
1293
+ function handleTranslate([, d, b], { theme }) {
1294
+ const v = theme.spacing?.[b] ?? h.bracket.cssvar.fraction.rem(b);
1295
+ if (v != null) return [...transformXYZ(d, v, "translate"), ["transform", transform]];
1296
+ }
1297
+ function handleScale([, d, b]) {
1298
+ const v = h.bracket.cssvar.fraction.percent(b);
1299
+ if (v != null) return [...transformXYZ(d, v, "scale"), ["transform", transform]];
1300
+ }
1301
+ function handleRotate([, d = "", b]) {
1302
+ const v = h.bracket.cssvar.degree(b);
1303
+ if (v != null) if (d) return {
1304
+ "--un-rotate": 0,
1305
+ [`--un-rotate-${d}`]: v,
1306
+ "transform": transform
1307
+ };
1308
+ else return {
1309
+ "--un-rotate-x": 0,
1310
+ "--un-rotate-y": 0,
1311
+ "--un-rotate-z": 0,
1312
+ "--un-rotate": v,
1313
+ "transform": transform
1314
+ };
1315
+ }
1316
+ function handleSkew([, d, b]) {
1317
+ const v = h.bracket.cssvar.degree(b);
1318
+ if (v != null) return [...transformXYZ(d, v, "skew"), ["transform", transform]];
1319
+ }
1320
+
1321
+ //#endregion
1322
+ //#region src/_rules/transition.ts
1323
+ function resolveTransitionProperty(prop, theme) {
1324
+ let p;
1325
+ if (h.cssvar(prop) != null) p = h.cssvar(prop);
1326
+ else {
1327
+ if (prop.startsWith("[") && prop.endsWith("]")) prop = prop.slice(1, -1);
1328
+ const props = prop.split(",").map((p$1) => theme.transitionProperty?.[p$1] ?? h.properties(p$1));
1329
+ if (props.every(Boolean)) p = props.join(",");
1330
+ }
1331
+ return p;
1332
+ }
1333
+ const transitions = [
1334
+ [
1335
+ /^transition(?:-(\D+?))?(?:-(\d+))?$/,
1336
+ ([, prop, d], { theme }) => {
1337
+ if (!prop && !d) return {
1338
+ "transition-property": theme.transitionProperty?.DEFAULT,
1339
+ "transition-timing-function": theme.easing?.DEFAULT,
1340
+ "transition-duration": theme.duration?.DEFAULT ?? h.time("150")
1341
+ };
1342
+ else if (prop != null) {
1343
+ const p = resolveTransitionProperty(prop, theme);
1344
+ const duration = theme.duration?.[d || "DEFAULT"] ?? h.time(d || "150");
1345
+ if (p) return {
1346
+ "transition-property": p,
1347
+ "transition-timing-function": theme.easing?.DEFAULT,
1348
+ "transition-duration": duration
1349
+ };
1350
+ } else if (d != null) return {
1351
+ "transition-property": theme.transitionProperty?.DEFAULT,
1352
+ "transition-timing-function": theme.easing?.DEFAULT,
1353
+ "transition-duration": theme.duration?.[d] ?? h.time(d)
1354
+ };
1355
+ },
1356
+ { autocomplete: "transition-$transitionProperty-$duration" }
1357
+ ],
1358
+ [
1359
+ /^(?:transition-)?duration-(.+)$/,
1360
+ ([, d], { theme }) => ({ "transition-duration": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d) }),
1361
+ { autocomplete: ["transition-duration-$duration", "duration-$duration"] }
1362
+ ],
1363
+ [
1364
+ /^(?:transition-)?delay-(.+)$/,
1365
+ ([, d], { theme }) => ({ "transition-delay": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d) }),
1366
+ { autocomplete: ["transition-delay-$duration", "delay-$duration"] }
1367
+ ],
1368
+ [
1369
+ /^(?:transition-)?ease(?:-(.+))?$/,
1370
+ ([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? h.bracket.cssvar(d) }),
1371
+ { autocomplete: ["transition-ease-(linear|in|out|in-out|DEFAULT)", "ease-(linear|in|out|in-out|DEFAULT)"] }
1372
+ ],
1373
+ [
1374
+ /^(?:transition-)?property-(.+)$/,
1375
+ ([, v], { theme }) => {
1376
+ const p = h.global(v) || resolveTransitionProperty(v, theme);
1377
+ if (p) return { "transition-property": p };
1378
+ },
1379
+ { autocomplete: [
1380
+ `transition-property-(${[...globalKeywords].join("|")})`,
1381
+ "transition-property-$transitionProperty",
1382
+ "property-$transitionProperty"
1383
+ ] }
1384
+ ],
1385
+ ["transition-none", { transition: "none" }],
1386
+ ...makeGlobalStaticRules("transition"),
1387
+ ["transition-discrete", { "transition-behavior": "allow-discrete" }],
1388
+ ["transition-normal", { "transition-behavior": "normal" }]
1389
+ ];
1390
+
1391
+ //#endregion
1392
+ //#region src/_rules/typography.ts
1393
+ const fonts = [
1394
+ [
1395
+ /^text-(.+)$/,
1396
+ handleText,
1397
+ { autocomplete: "text-$fontSize" }
1398
+ ],
1399
+ [
1400
+ /^(?:text|font)-size-(.+)$/,
1401
+ handleSize,
1402
+ { autocomplete: "text-size-$fontSize" }
1403
+ ],
1404
+ [
1405
+ /^text-(?:color-)?(.+)$/,
1406
+ handlerColorOrSize,
1407
+ { autocomplete: "text-$colors" }
1408
+ ],
1409
+ [
1410
+ /^(?:color|c)-(.+)$/,
1411
+ colorResolver("color", "text", "textColor"),
1412
+ { autocomplete: "(color|c)-$colors" }
1413
+ ],
1414
+ [
1415
+ /^(?:text|color|c)-(.+)$/,
1416
+ ([, v]) => globalKeywords.includes(v) ? { color: v } : void 0,
1417
+ { autocomplete: `(text|color|c)-(${globalKeywords.join("|")})` }
1418
+ ],
1419
+ [
1420
+ /^(?:text|color|c)-op(?:acity)?-?(.+)$/,
1421
+ ([, opacity$1]) => ({ "--un-text-opacity": h.bracket.percent.cssvar(opacity$1) }),
1422
+ { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }
1423
+ ],
1424
+ [
1425
+ /^(?:font|fw)-?([^-]+)$/,
1426
+ ([, s], { theme }) => ({ "font-weight": theme.fontWeight?.[s] || h.bracket.global.number(s) }),
1427
+ { autocomplete: ["(font|fw)-(100|200|300|400|500|600|700|800|900)", "(font|fw)-$fontWeight"] }
1428
+ ],
1429
+ [
1430
+ /^(?:font-)?(?:leading|lh|line-height)-(.+)$/,
1431
+ ([, s], { theme }) => ({ "line-height": handleThemeByKey(s, theme, "lineHeight") }),
1432
+ { autocomplete: "(leading|lh|line-height)-$lineHeight" }
1433
+ ],
1434
+ ["font-synthesis-weight", { "font-synthesis": "weight" }],
1435
+ ["font-synthesis-style", { "font-synthesis": "style" }],
1436
+ ["font-synthesis-small-caps", { "font-synthesis": "small-caps" }],
1437
+ ["font-synthesis-none", { "font-synthesis": "none" }],
1438
+ [/^font-synthesis-(.+)$/, ([, s]) => ({ "font-synthesis": h.bracket.cssvar.global(s) })],
1439
+ [
1440
+ /^(?:font-)?tracking-(.+)$/,
1441
+ ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || h.bracket.cssvar.global.rem(s) }),
1442
+ { autocomplete: "tracking-$letterSpacing" }
1443
+ ],
1444
+ [
1445
+ /^(?:font-)?word-spacing-(.+)$/,
1446
+ ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || h.bracket.cssvar.global.rem(s) }),
1447
+ { autocomplete: "word-spacing-$wordSpacing" }
1448
+ ],
1449
+ ["font-stretch-normal", { "font-stretch": "normal" }],
1450
+ ["font-stretch-ultra-condensed", { "font-stretch": "ultra-condensed" }],
1451
+ ["font-stretch-extra-condensed", { "font-stretch": "extra-condensed" }],
1452
+ ["font-stretch-condensed", { "font-stretch": "condensed" }],
1453
+ ["font-stretch-semi-condensed", { "font-stretch": "semi-condensed" }],
1454
+ ["font-stretch-semi-expanded", { "font-stretch": "semi-expanded" }],
1455
+ ["font-stretch-expanded", { "font-stretch": "expanded" }],
1456
+ ["font-stretch-extra-expanded", { "font-stretch": "extra-expanded" }],
1457
+ ["font-stretch-ultra-expanded", { "font-stretch": "ultra-expanded" }],
1458
+ [
1459
+ /^font-stretch-(.+)$/,
1460
+ ([, s]) => ({ "font-stretch": h.bracket.cssvar.fraction.global(s) }),
1461
+ { autocomplete: "font-stretch-<percentage>" }
1462
+ ],
1463
+ [
1464
+ /^font-(.+)$/,
1465
+ ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] || h.bracket.cssvar.global(d) }),
1466
+ { autocomplete: "font-$fontFamily" }
1467
+ ]
1468
+ ];
1469
+ const tabSizes = [[/^tab(?:-(.+))?$/, ([, s]) => {
1470
+ const v = h.bracket.cssvar.global.number(s || "4");
1471
+ if (v != null) return {
1472
+ "-moz-tab-size": v,
1473
+ "-o-tab-size": v,
1474
+ "tab-size": v
1475
+ };
1476
+ }]];
1477
+ const textIndents = [[
1478
+ /^indent(?:-(.+))?$/,
1479
+ ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || h.bracket.cssvar.global.fraction.rem(s) }),
1480
+ { autocomplete: "indent-$textIndent" }
1481
+ ]];
1482
+ const textStrokes = [
1483
+ [
1484
+ /^text-stroke(?:-(.+))?$/,
1485
+ ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || h.bracket.cssvar.px(s) }),
1486
+ { autocomplete: "text-stroke-$textStrokeWidth" }
1487
+ ],
1488
+ [
1489
+ /^text-stroke-(.+)$/,
1490
+ colorResolver("-webkit-text-stroke-color", "text-stroke", "borderColor"),
1491
+ { autocomplete: "text-stroke-$colors" }
1492
+ ],
1493
+ [
1494
+ /^text-stroke-op(?:acity)?-?(.+)$/,
1495
+ ([, opacity$1]) => ({ "--un-text-stroke-opacity": h.bracket.percent.cssvar(opacity$1) }),
1496
+ { autocomplete: "text-stroke-(op|opacity)-<percent>" }
1497
+ ]
1498
+ ];
1499
+ const textShadows = [
1500
+ [
1501
+ /^text-shadow(?:-(.+))?$/,
1502
+ ([, s], { theme }) => {
1503
+ const v = theme.textShadow?.[s || "DEFAULT"];
1504
+ if (v != null) return {
1505
+ "--un-text-shadow": colorableShadows(v, "--un-text-shadow-color").join(","),
1506
+ "text-shadow": "var(--un-text-shadow)"
1507
+ };
1508
+ return { "text-shadow": h.bracket.cssvar.global(s) };
1509
+ },
1510
+ { autocomplete: "text-shadow-$textShadow" }
1511
+ ],
1512
+ [
1513
+ /^text-shadow-color-(.+)$/,
1514
+ colorResolver("--un-text-shadow-color", "text-shadow", "shadowColor"),
1515
+ { autocomplete: "text-shadow-color-$colors" }
1516
+ ],
1517
+ [
1518
+ /^text-shadow-color-op(?:acity)?-?(.+)$/,
1519
+ ([, opacity$1]) => ({ "--un-text-shadow-opacity": h.bracket.percent.cssvar(opacity$1) }),
1520
+ { autocomplete: "text-shadow-color-(op|opacity)-<percent>" }
1521
+ ]
1522
+ ];
1523
+ function handleThemeByKey(s, theme, key) {
1524
+ return theme[key]?.[s] || h.bracket.cssvar.global.rem(s);
1525
+ }
1526
+ function handleSize([, s], { theme }) {
1527
+ const size = toArray(theme.fontSize?.[s])?.[0] ?? h.bracket.cssvar.global.rem(s);
1528
+ if (size != null) return { "font-size": size };
1529
+ }
1530
+ function handlerColorOrSize(match, ctx) {
1531
+ if (isCSSMathFn(h.bracket(match[1]))) return handleSize(match, ctx);
1532
+ return colorResolver("color", "text", "textColor")(match, ctx);
1533
+ }
1534
+ function handleText([, s = "base"], { theme }) {
1535
+ const split = splitShorthand(s, "length");
1536
+ if (!split) return;
1537
+ const [size, leading] = split;
1538
+ const sizePairs = toArray(theme.fontSize?.[size]);
1539
+ const lineHeight = leading ? handleThemeByKey(leading, theme, "lineHeight") : void 0;
1540
+ if (sizePairs?.[0]) {
1541
+ const [fontSize$1, height, letterSpacing] = sizePairs;
1542
+ if (typeof height === "object") return {
1543
+ "font-size": fontSize$1,
1544
+ ...height
1545
+ };
1546
+ return {
1547
+ "font-size": fontSize$1,
1548
+ "line-height": lineHeight ?? height ?? "1",
1549
+ "letter-spacing": letterSpacing ? handleThemeByKey(letterSpacing, theme, "letterSpacing") : void 0
1550
+ };
1551
+ }
1552
+ const fontSize = h.bracketOfLength.rem(size);
1553
+ if (lineHeight && fontSize) return {
1554
+ "font-size": fontSize,
1555
+ "line-height": lineHeight
1556
+ };
1557
+ return { "font-size": h.bracketOfLength.rem(s) };
1558
+ }
1559
+
1560
+ //#endregion
1561
+ //#region src/_rules/variables.ts
1562
+ const variablesAbbrMap = {
1563
+ backface: "backface-visibility",
1564
+ break: "word-break",
1565
+ case: "text-transform",
1566
+ content: "align-content",
1567
+ fw: "font-weight",
1568
+ items: "align-items",
1569
+ justify: "justify-content",
1570
+ select: "user-select",
1571
+ self: "align-self",
1572
+ vertical: "vertical-align",
1573
+ visible: "visibility",
1574
+ whitespace: "white-space",
1575
+ ws: "white-space"
1576
+ };
1577
+ const cssVariables = [[/^(.+?)-(\$.+)$/, ([, name, varname]) => {
1578
+ const prop = variablesAbbrMap[name];
1579
+ if (prop) return { [prop]: h.cssvar(varname) };
1580
+ }]];
1581
+ const cssProperty = [[/^\[(.*)\]$/, ([_, body]) => {
1582
+ if (!body.includes(":")) return;
1583
+ const [prop, ...rest] = body.split(":");
1584
+ const value = rest.join(":");
1585
+ if (!isURI(body) && /^[\w-]+$/.test(prop) && isValidCSSBody(value)) {
1586
+ const parsed = h.bracket(`[${value}]`);
1587
+ if (parsed) return { [prop]: parsed };
1588
+ }
1589
+ }]];
1590
+ function isValidCSSBody(body) {
1591
+ let i = 0;
1592
+ function findUntil(c) {
1593
+ while (i < body.length) {
1594
+ i += 1;
1595
+ if (body[i] === c) return true;
1596
+ }
1597
+ return false;
1598
+ }
1599
+ for (i = 0; i < body.length; i++) {
1600
+ const c = body[i];
1601
+ if ("\"`'".includes(c)) {
1602
+ if (!findUntil(c)) return false;
1603
+ } else if (c === "(") {
1604
+ if (!findUntil(")")) return false;
1605
+ } else if ("[]{}:".includes(c)) return false;
1606
+ }
1607
+ return true;
1608
+ }
1609
+ function isURI(declaration) {
1610
+ if (!declaration.includes("://")) return false;
1611
+ try {
1612
+ return new URL(declaration).host !== "";
1613
+ } catch {
1614
+ return false;
1615
+ }
1616
+ }
1617
+
1618
+ //#endregion
1619
+ //#region src/_rules/default.ts
1620
+ const rules = [
1621
+ cssVariables,
1622
+ cssProperty,
1623
+ contains,
1624
+ pointerEvents,
1625
+ appearances,
1626
+ positions,
1627
+ insets,
1628
+ zIndexes,
1629
+ orders,
1630
+ grids,
1631
+ floats,
1632
+ margins,
1633
+ boxSizing,
1634
+ displays,
1635
+ aspectRatio,
1636
+ sizes,
1637
+ flex,
1638
+ transforms,
1639
+ cursors,
1640
+ userSelects,
1641
+ resizes,
1642
+ appearance,
1643
+ placements,
1644
+ alignments,
1645
+ justifies,
1646
+ gaps,
1647
+ flexGridJustifiesAlignments,
1648
+ overflows,
1649
+ textOverflows,
1650
+ whitespaces,
1651
+ breaks,
1652
+ borders,
1653
+ bgColors,
1654
+ colorScheme,
1655
+ svgUtilities,
1656
+ paddings,
1657
+ textAligns,
1658
+ textIndents,
1659
+ textWraps,
1660
+ verticalAligns,
1661
+ fonts,
1662
+ textTransforms,
1663
+ fontStyles,
1664
+ textDecorations,
1665
+ fontSmoothings,
1666
+ tabSizes,
1667
+ textStrokes,
1668
+ textShadows,
1669
+ opacity,
1670
+ boxShadows,
1671
+ outline,
1672
+ rings,
1673
+ transitions,
1674
+ willChange,
1675
+ contentVisibility,
1676
+ contents,
1677
+ containerParent,
1678
+ fieldSizing,
1679
+ questionMark
1680
+ ].flat(1);
1681
+
1682
+ //#endregion
1683
+ export { flex as $, fontStyles as A, alignments as B, contains as C, displays as D, cursors as E, textWraps as F, justifies as G, flexGridJustifiesAlignments as H, userSelects as I, positions as J, orders as K, varEmpty as L, resizes as M, textOverflows as N, fieldSizing as O, textTransforms as P, gaps as Q, whitespaces as R, breaks as S, contents as T, floats as U, boxSizing as V, insets as W, overflows as X, zIndexes as Y, grids as Z, boxShadows as _, tabSizes as a, borderStyles as at, rings as b, textStrokes as c, appearance as ct, transforms as d, textAligns as dt, textDecorations as et, svgUtilities as f, verticalAligns as ft, sizes as g, aspectRatio as h, fonts as i, opacity as it, pointerEvents as j, fontSmoothings as k, transitions as l, outline as lt, paddings as m, cssProperty as n, bgColors as nt, textIndents as o, borders as ot, margins as p, placements as q, cssVariables as r, colorScheme as rt, textShadows as s, handlerBorderStyle as st, rules as t, containerParent as tt, transformBase as u, willChange as ut, boxShadowsBase as v, contentVisibility as w, appearances as x, ringBase as y, questionMark as z };