@unocss/preset-mini 0.58.0 → 0.58.2

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 (48) hide show
  1. package/dist/colors.d.cts +1 -1
  2. package/dist/colors.d.mts +1 -1
  3. package/dist/colors.d.ts +1 -1
  4. package/dist/index.cjs +11 -11
  5. package/dist/index.d.cts +4 -4
  6. package/dist/index.d.mts +4 -4
  7. package/dist/index.d.ts +4 -4
  8. package/dist/index.mjs +6 -6
  9. package/dist/rules.cjs +50 -1008
  10. package/dist/rules.d.cts +1 -1
  11. package/dist/rules.d.mts +1 -1
  12. package/dist/rules.d.ts +1 -1
  13. package/dist/rules.mjs +5 -968
  14. package/dist/shared/{preset-mini.qLxuqSG-.cjs → preset-mini.-3Qybdh5.cjs} +38 -38
  15. package/dist/shared/preset-mini.0CcynBZx.mjs +537 -0
  16. package/dist/shared/{preset-mini.5jRPR_fm.mjs → preset-mini.0UJFjS_1.mjs} +2 -2
  17. package/dist/shared/{preset-mini.WoiFygE2.d.cts → preset-mini.20fUBpHS.d.cts} +1 -1
  18. package/dist/shared/{preset-mini.zVYE2D2j.d.ts → preset-mini.8w2rXvMk.d.ts} +1 -1
  19. package/dist/shared/preset-mini.AVP8I7_j.mjs +747 -0
  20. package/dist/shared/preset-mini.ORVb5Lu8.mjs +978 -0
  21. package/dist/shared/preset-mini.UhMMbd34.cjs +560 -0
  22. package/dist/shared/{preset-mini.4DxDu2I8.d.mts → preset-mini.YxT4AwuI.d.cts} +1 -1
  23. package/dist/shared/preset-mini.fgwIVvur.cjs +322 -0
  24. package/dist/shared/preset-mini.g6cWGZM2.cjs +1021 -0
  25. package/dist/shared/{preset-mini.5daNC9yh.d.ts → preset-mini.gVNz4b9u.d.ts} +1 -1
  26. package/dist/shared/{preset-mini.7XoWRZIl.d.cts → preset-mini.hpPpX7ws.d.cts} +1 -1
  27. package/dist/shared/{preset-mini.7XoWRZIl.d.mts → preset-mini.hpPpX7ws.d.mts} +1 -1
  28. package/dist/shared/{preset-mini.7XoWRZIl.d.ts → preset-mini.hpPpX7ws.d.ts} +1 -1
  29. package/dist/shared/preset-mini.jXC5Sr98.cjs +772 -0
  30. package/dist/shared/{preset-mini.WMGBnRDa.d.mts → preset-mini.nzD7Hw_0.d.mts} +1 -1
  31. package/dist/shared/{preset-mini.5-XKlNyK.d.cts → preset-mini.vMrmsD3H.d.mts} +1 -1
  32. package/dist/shared/preset-mini.zC_vZg74.mjs +291 -0
  33. package/dist/theme.cjs +34 -318
  34. package/dist/theme.d.cts +3 -3
  35. package/dist/theme.d.mts +3 -3
  36. package/dist/theme.d.ts +3 -3
  37. package/dist/theme.mjs +5 -293
  38. package/dist/utils.cjs +28 -545
  39. package/dist/utils.d.cts +4 -4
  40. package/dist/utils.d.mts +4 -4
  41. package/dist/utils.d.ts +4 -4
  42. package/dist/utils.mjs +2 -524
  43. package/dist/variants.cjs +31 -770
  44. package/dist/variants.d.cts +3 -3
  45. package/dist/variants.d.mts +3 -3
  46. package/dist/variants.d.ts +3 -3
  47. package/dist/variants.mjs +4 -747
  48. package/package.json +4 -4
@@ -0,0 +1,978 @@
1
+ import { g as globalKeywords, b as h, o as isCSSMathFn, j as colorResolver, d as directionMap, l as hasParseableColor, c as cornerMap, f as parseColor, q as isSize, n as makeGlobalStaticRules, k as colorableShadows, s as splitShorthand, i as insetMap, r as resolveBreakpoints, e as directionSize } from './preset-mini.0CcynBZx.mjs';
2
+ import { colorToString, colorOpacityToString, hasThemeFn, transformThemeFn } from '@unocss/rule-utils';
3
+ import { warnOnce, toArray } from '@unocss/core';
4
+ import { d as displays, i as contentVisibility, j as contents, l as textOverflows, m as textTransforms, n as fontStyles, o as fontSmoothings, c as boxShadows, a as rings, f as cursors, e as appearances, p as pointerEvents, h as resizes, u as userSelects, w as whitespaces, k as breaks, s as transforms, g as contains, t as textWraps } from './preset-mini.0UJFjS_1.mjs';
5
+
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
+ [
24
+ /^(?:vertical|align|v)-([-\w]+%?)$/,
25
+ ([, v]) => ({ "vertical-align": verticalAlignAlias[v] ?? h.numberWithUnit(v) }),
26
+ {
27
+ autocomplete: [
28
+ `(vertical|align|v)-(${Object.keys(verticalAlignAlias).join("|")})`,
29
+ "(vertical|align|v)-<percentage>"
30
+ ]
31
+ }
32
+ ]
33
+ ];
34
+ const textAligns = ["center", "left", "right", "justify", "start", "end"].map((v) => [`text-${v}`, { "text-align": v }]);
35
+
36
+ const outline = [
37
+ // size
38
+ [/^outline-(?:width-|size-)?(.+)$/, handleWidth$2, { autocomplete: "outline-(width|size)-<num>" }],
39
+ // color
40
+ [/^outline-(?:color-)?(.+)$/, handleColorOrWidth$2, { autocomplete: "outline-$colors" }],
41
+ // offset
42
+ [/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? h.bracket.cssvar.global.px(d) }), { autocomplete: "outline-(offset)-<num>" }],
43
+ // style
44
+ ["outline", { "outline-style": "solid" }],
45
+ ...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset", ...globalKeywords].map((v) => [`outline-${v}`, { "outline-style": v }]),
46
+ ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
47
+ ];
48
+ function handleWidth$2([, b], { theme }) {
49
+ return { "outline-width": theme.lineWidth?.[b] ?? h.bracket.cssvar.global.px(b) };
50
+ }
51
+ function handleColorOrWidth$2(match, ctx) {
52
+ if (isCSSMathFn(h.bracket(match[1])))
53
+ return handleWidth$2(match, ctx);
54
+ return colorResolver("outline-color", "outline-color", "borderColor")(match, ctx);
55
+ }
56
+ const appearance = [
57
+ ["appearance-none", {
58
+ "-webkit-appearance": "none",
59
+ "appearance": "none"
60
+ }]
61
+ ];
62
+ function willChangeProperty(prop) {
63
+ return h.properties.auto.global(prop) ?? {
64
+ contents: "contents",
65
+ scroll: "scroll-position"
66
+ }[prop];
67
+ }
68
+ const willChange = [
69
+ [/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
70
+ ];
71
+
72
+ const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset", ...globalKeywords];
73
+ const borders = [
74
+ // compound
75
+ [/^(?:border|b)()(?:-(.+))?$/, handlerBorderSize, { autocomplete: "(border|b)-<directions>" }],
76
+ [/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorderSize],
77
+ [/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorderSize],
78
+ [/^(?:border|b)-(block|inline)(?:-(.+))?$/, handlerBorderSize],
79
+ [/^(?:border|b)-([bi][se])(?:-(.+))?$/, handlerBorderSize],
80
+ // size
81
+ [/^(?:border|b)-()(?:width|size)-(.+)$/, handlerBorderSize, { autocomplete: ["(border|b)-<num>", "(border|b)-<directions>-<num>"] }],
82
+ [/^(?:border|b)-([xy])-(?:width|size)-(.+)$/, handlerBorderSize],
83
+ [/^(?:border|b)-([rltbse])-(?:width|size)-(.+)$/, handlerBorderSize],
84
+ [/^(?:border|b)-(block|inline)-(?:width|size)-(.+)$/, handlerBorderSize],
85
+ [/^(?:border|b)-([bi][se])-(?:width|size)-(.+)$/, handlerBorderSize],
86
+ // colors
87
+ [/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColorOrSize, { autocomplete: ["(border|b)-$colors", "(border|b)-<directions>-$colors"] }],
88
+ [/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColorOrSize],
89
+ [/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColorOrSize],
90
+ [/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/, handlerBorderColorOrSize],
91
+ [/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/, handlerBorderColorOrSize],
92
+ // opacity
93
+ [/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity, { autocomplete: "(border|b)-(op|opacity)-<percent>" }],
94
+ [/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
95
+ [/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
96
+ [/^(?:border|b)-(block|inline)-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
97
+ [/^(?:border|b)-([bi][se])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
98
+ // radius
99
+ [/^(?:border-|b-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded, { autocomplete: ["(border|b)-(rounded|rd)", "(border|b)-(rounded|rd)-<num>", "(rounded|rd)", "(rounded|rd)-<num>"] }],
100
+ [/^(?:border-|b-)?(?:rounded|rd)-([rltbse])(?:-(.+))?$/, handlerRounded],
101
+ [/^(?:border-|b-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
102
+ [/^(?:border-|b-)?(?:rounded|rd)-([bise][se])(?:-(.+))?$/, handlerRounded],
103
+ [/^(?:border-|b-)?(?:rounded|rd)-([bi][se]-[bi][se])(?:-(.+))?$/, handlerRounded],
104
+ // style
105
+ [/^(?:border|b)-(?:style-)?()(.+)$/, handlerBorderStyle, { autocomplete: ["(border|b)-style", `(border|b)-(${borderStyles.join("|")})`, "(border|b)-<directions>-style", `(border|b)-<directions>-(${borderStyles.join("|")})`, `(border|b)-<directions>-style-(${borderStyles.join("|")})`, `(border|b)-style-(${borderStyles.join("|")})`] }],
106
+ [/^(?:border|b)-([xy])-(?:style-)?(.+)$/, handlerBorderStyle],
107
+ [/^(?:border|b)-([rltbse])-(?:style-)?(.+)$/, handlerBorderStyle],
108
+ [/^(?:border|b)-(block|inline)-(?:style-)?(.+)$/, handlerBorderStyle],
109
+ [/^(?:border|b)-([bi][se])-(?:style-)?(.+)$/, handlerBorderStyle]
110
+ ];
111
+ function transformBorderColor(color, alpha, direction) {
112
+ if (alpha != null) {
113
+ return {
114
+ [`border${direction}-color`]: colorToString(color, alpha)
115
+ };
116
+ }
117
+ if (direction === "") {
118
+ const object = {};
119
+ const opacityVar = `--un-border-opacity`;
120
+ const result = colorToString(color, `var(${opacityVar})`);
121
+ if (result.includes(opacityVar))
122
+ object[opacityVar] = typeof color === "string" ? 1 : colorOpacityToString(color);
123
+ object["border-color"] = result;
124
+ return object;
125
+ } else {
126
+ const object = {};
127
+ const opacityVar = "--un-border-opacity";
128
+ const opacityDirectionVar = `--un-border${direction}-opacity`;
129
+ const result = colorToString(color, `var(${opacityDirectionVar})`);
130
+ if (result.includes(opacityDirectionVar)) {
131
+ object[opacityVar] = typeof color === "string" ? 1 : colorOpacityToString(color);
132
+ object[opacityDirectionVar] = `var(${opacityVar})`;
133
+ }
134
+ object[`border${direction}-color`] = result;
135
+ return object;
136
+ }
137
+ }
138
+ function borderColorResolver(direction) {
139
+ return ([, body], theme) => {
140
+ const data = parseColor(body, theme, "borderColor");
141
+ if (!data)
142
+ return;
143
+ const { alpha, color, cssColor } = data;
144
+ if (cssColor)
145
+ return transformBorderColor(cssColor, alpha, direction);
146
+ else if (color)
147
+ return transformBorderColor(color, alpha, direction);
148
+ };
149
+ }
150
+ function handlerBorderSize([, a = "", b], { theme }) {
151
+ const v = theme.lineWidth?.[b || "DEFAULT"] ?? h.bracket.cssvar.global.px(b || "1");
152
+ if (a in directionMap && v != null)
153
+ return directionMap[a].map((i) => [`border${i}-width`, v]);
154
+ }
155
+ function handlerBorderColorOrSize([, a = "", b], ctx) {
156
+ if (a in directionMap) {
157
+ if (isCSSMathFn(h.bracket(b)))
158
+ return handlerBorderSize(["", a, b], ctx);
159
+ if (hasParseableColor(b, ctx.theme, "borderColor")) {
160
+ return Object.assign(
161
+ {},
162
+ ...directionMap[a].map((i) => borderColorResolver(i)(["", b], ctx.theme))
163
+ );
164
+ }
165
+ }
166
+ }
167
+ function handlerBorderOpacity([, a = "", opacity]) {
168
+ const v = h.bracket.percent.cssvar(opacity);
169
+ if (a in directionMap && v != null)
170
+ return directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
171
+ }
172
+ function handlerRounded([, a = "", s], { theme }) {
173
+ const v = theme.borderRadius?.[s || "DEFAULT"] || h.bracket.cssvar.global.fraction.rem(s || "1");
174
+ if (a in cornerMap && v != null)
175
+ return cornerMap[a].map((i) => [`border${i}-radius`, v]);
176
+ }
177
+ function handlerBorderStyle([, a = "", s]) {
178
+ if (borderStyles.includes(s) && a in directionMap)
179
+ return directionMap[a].map((i) => [`border${i}-style`, s]);
180
+ }
181
+
182
+ const opacity = [
183
+ [/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: h.bracket.percent.cssvar(d) })]
184
+ ];
185
+ const bgUrlRE = /^\[url\(.+\)\]$/;
186
+ const bgLengthRE = /^\[length:.+\]$/;
187
+ const bgPositionRE = /^\[position:.+\]$/;
188
+ const bgColors = [
189
+ [/^bg-(.+)$/, (...args) => {
190
+ const d = args[0][1];
191
+ if (bgUrlRE.test(d))
192
+ return { "--un-url": h.bracket(d), "background-image": "var(--un-url)" };
193
+ if (bgLengthRE.test(d) && h.bracketOfLength(d) != null)
194
+ return { "background-size": h.bracketOfLength(d).split(" ").map((e) => h.fraction.auto.px.cssvar(e) ?? e).join(" ") };
195
+ if ((isSize(d) || bgPositionRE.test(d)) && h.bracketOfPosition(d) != null)
196
+ return { "background-position": h.bracketOfPosition(d).split(" ").map((e) => h.position.fraction.auto.px.cssvar(e) ?? e).join(" ") };
197
+ return colorResolver("background-color", "bg", "backgroundColor")(...args);
198
+ }],
199
+ [/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": h.bracket.percent.cssvar(opacity2) }), { autocomplete: "bg-(op|opacity)-<percent>" }]
200
+ ];
201
+ const colorScheme = [
202
+ [/^color-scheme-(\w+)$/, ([, v]) => ({ "color-scheme": v })]
203
+ ];
204
+
205
+ const containerParent = [
206
+ [/^@container(?:\/(\w+))?(?:-(normal))?$/, ([, l, v]) => {
207
+ warnOnce("The container query rule is experimental and may not follow semver.");
208
+ return {
209
+ "container-type": v ?? "inline-size",
210
+ "container-name": l
211
+ };
212
+ }]
213
+ ];
214
+
215
+ const decorationStyles = ["solid", "double", "dotted", "dashed", "wavy", ...globalKeywords];
216
+ const textDecorations = [
217
+ [/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s }), { autocomplete: "decoration-(underline|overline|line-through)" }],
218
+ // size
219
+ [/^(?:underline|decoration)-(?:size-)?(.+)$/, handleWidth$1, { autocomplete: "(underline|decoration)-<num>" }],
220
+ [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s }), { autocomplete: "(underline|decoration)-(auto|from-font)" }],
221
+ // colors
222
+ [/^(?:underline|decoration)-(.+)$/, handleColorOrWidth$1, { autocomplete: "(underline|decoration)-$colors" }],
223
+ [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }],
224
+ // offset
225
+ [/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? h.auto.bracket.cssvar.global.px(s) }), { autocomplete: "(underline|decoration)-(offset)-<num>" }],
226
+ // style
227
+ ...decorationStyles.map((v) => [`underline-${v}`, { "text-decoration-style": v }]),
228
+ ...decorationStyles.map((v) => [`decoration-${v}`, { "text-decoration-style": v }]),
229
+ ["no-underline", { "text-decoration": "none" }],
230
+ ["decoration-none", { "text-decoration": "none" }]
231
+ ];
232
+ function handleWidth$1([, b], { theme }) {
233
+ return { "text-decoration-thickness": theme.lineWidth?.[b] ?? h.bracket.cssvar.global.px(b) };
234
+ }
235
+ function handleColorOrWidth$1(match, ctx) {
236
+ if (isCSSMathFn(h.bracket(match[1])))
237
+ return handleWidth$1(match, ctx);
238
+ const result = colorResolver("text-decoration-color", "line", "borderColor")(match, ctx);
239
+ if (result) {
240
+ return {
241
+ "-webkit-text-decoration-color": result["text-decoration-color"],
242
+ ...result
243
+ };
244
+ }
245
+ }
246
+
247
+ const transitionPropertyGroup = {
248
+ all: "all",
249
+ colors: ["color", "background-color", "border-color", "outline-color", "text-decoration-color", "fill", "stroke"].join(","),
250
+ none: "none",
251
+ opacity: "opacity",
252
+ shadow: "box-shadow",
253
+ transform: "transform"
254
+ };
255
+ function transitionProperty(prop) {
256
+ return h.properties(prop) ?? transitionPropertyGroup[prop];
257
+ }
258
+ const transitions = [
259
+ // transition
260
+ [
261
+ /^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/,
262
+ ([, prop, d], { theme }) => {
263
+ const p = prop != null ? transitionProperty(prop) : [transitionPropertyGroup.colors, "opacity", "box-shadow", "transform", "filter", "backdrop-filter"].join(",");
264
+ if (p) {
265
+ const duration = theme.duration?.[d || "DEFAULT"] ?? h.time(d || "150");
266
+ return {
267
+ "transition-property": p,
268
+ "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
269
+ "transition-duration": duration
270
+ };
271
+ }
272
+ },
273
+ { autocomplete: `transition-(${Object.keys(transitionPropertyGroup).join("|")})` }
274
+ ],
275
+ // timings
276
+ [
277
+ /^(?:transition-)?duration-(.+)$/,
278
+ ([, d], { theme }) => ({ "transition-duration": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d) }),
279
+ { autocomplete: ["transition-duration-$duration", "duration-$duration"] }
280
+ ],
281
+ [
282
+ /^(?:transition-)?delay-(.+)$/,
283
+ ([, d], { theme }) => ({ "transition-delay": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d) }),
284
+ { autocomplete: ["transition-delay-$duration", "delay-$duration"] }
285
+ ],
286
+ [
287
+ /^(?:transition-)?ease(?:-(.+))?$/,
288
+ ([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? h.bracket.cssvar(d) }),
289
+ { autocomplete: ["transition-ease-(linear|in|out|in-out|DEFAULT)", "ease-(linear|in|out|in-out|DEFAULT)"] }
290
+ ],
291
+ // props
292
+ [
293
+ /^(?:transition-)?property-(.+)$/,
294
+ ([, v]) => ({ "transition-property": h.bracket.global(v) || transitionProperty(v) }),
295
+ { autocomplete: [`transition-property-(${[...globalKeywords, ...Object.keys(transitionPropertyGroup)].join("|")})`] }
296
+ ],
297
+ // none
298
+ ["transition-none", { transition: "none" }],
299
+ ...makeGlobalStaticRules("transition")
300
+ ];
301
+
302
+ const flex = [
303
+ // display
304
+ ["flex", { display: "flex" }],
305
+ ["inline-flex", { display: "inline-flex" }],
306
+ ["flex-inline", { display: "inline-flex" }],
307
+ // flex
308
+ [/^flex-(.*)$/, ([, d]) => ({ flex: h.bracket(d) != null ? h.bracket(d).split(" ").map((e) => h.cssvar.fraction(e) ?? e).join(" ") : h.cssvar.fraction(d) })],
309
+ ["flex-1", { flex: "1 1 0%" }],
310
+ ["flex-auto", { flex: "1 1 auto" }],
311
+ ["flex-initial", { flex: "0 1 auto" }],
312
+ ["flex-none", { flex: "none" }],
313
+ // shrink/grow/basis
314
+ [/^(?:flex-)?shrink(?:-(.*))?$/, ([, d = ""]) => ({ "flex-shrink": h.bracket.cssvar.number(d) ?? 1 }), { autocomplete: ["flex-shrink-<num>", "shrink-<num>"] }],
315
+ [/^(?:flex-)?grow(?:-(.*))?$/, ([, d = ""]) => ({ "flex-grow": h.bracket.cssvar.number(d) ?? 1 }), { autocomplete: ["flex-grow-<num>", "grow-<num>"] }],
316
+ [/^(?:flex-)?basis-(.+)$/, ([, d], { theme }) => ({ "flex-basis": theme.spacing?.[d] ?? h.bracket.cssvar.auto.fraction.rem(d) }), { autocomplete: ["flex-basis-$spacing", "basis-$spacing"] }],
317
+ // directions
318
+ ["flex-row", { "flex-direction": "row" }],
319
+ ["flex-row-reverse", { "flex-direction": "row-reverse" }],
320
+ ["flex-col", { "flex-direction": "column" }],
321
+ ["flex-col-reverse", { "flex-direction": "column-reverse" }],
322
+ // wraps
323
+ ["flex-wrap", { "flex-wrap": "wrap" }],
324
+ ["flex-wrap-reverse", { "flex-wrap": "wrap-reverse" }],
325
+ ["flex-nowrap", { "flex-wrap": "nowrap" }]
326
+ ];
327
+
328
+ const fonts = [
329
+ // text
330
+ [/^text-(.+)$/, handleText, { autocomplete: "text-$fontSize" }],
331
+ // text size
332
+ [/^(?:text|font)-size-(.+)$/, handleSize, { autocomplete: "text-size-$fontSize" }],
333
+ // text colors
334
+ [/^text-(?:color-)?(.+)$/, handlerColorOrSize, { autocomplete: "text-$colors" }],
335
+ // colors
336
+ [/^(?:color|c)-(.+)$/, colorResolver("color", "text", "textColor"), { autocomplete: "(color|c)-$colors" }],
337
+ // style
338
+ [/^(?:text|color|c)-(.+)$/, ([, v]) => globalKeywords.includes(v) ? { color: v } : void 0, { autocomplete: `(text|color|c)-(${globalKeywords.join("|")})` }],
339
+ // opacity
340
+ [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }],
341
+ // weights
342
+ [
343
+ /^(?:font|fw)-?([^-]+)$/,
344
+ ([, s], { theme }) => ({ "font-weight": theme.fontWeight?.[s] || h.bracket.global.number(s) }),
345
+ {
346
+ autocomplete: [
347
+ "(font|fw)-(100|200|300|400|500|600|700|800|900)",
348
+ "(font|fw)-$fontWeight"
349
+ ]
350
+ }
351
+ ],
352
+ // leadings
353
+ [
354
+ /^(?:font-)?(?:leading|lh|line-height)-(.+)$/,
355
+ ([, s], { theme }) => ({ "line-height": handleThemeByKey(s, theme, "lineHeight") }),
356
+ { autocomplete: "(leading|lh|line-height)-$lineHeight" }
357
+ ],
358
+ // synthesis
359
+ ["font-synthesis-weight", { "font-synthesis": "weight" }],
360
+ ["font-synthesis-style", { "font-synthesis": "style" }],
361
+ ["font-synthesis-small-caps", { "font-synthesis": "small-caps" }],
362
+ ["font-synthesis-none", { "font-synthesis": "none" }],
363
+ [/^font-synthesis-(.+)$/, ([, s]) => ({ "font-synthesis": h.bracket.cssvar.global(s) })],
364
+ // tracking
365
+ [
366
+ /^(?:font-)?tracking-(.+)$/,
367
+ ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || h.bracket.cssvar.global.rem(s) }),
368
+ { autocomplete: "tracking-$letterSpacing" }
369
+ ],
370
+ // word-spacing
371
+ [
372
+ /^(?:font-)?word-spacing-(.+)$/,
373
+ ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || h.bracket.cssvar.global.rem(s) }),
374
+ { autocomplete: "word-spacing-$wordSpacing" }
375
+ ],
376
+ // family
377
+ [
378
+ /^font-(.+)$/,
379
+ ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] || h.bracket.cssvar.global(d) }),
380
+ { autocomplete: "font-$fontFamily" }
381
+ ]
382
+ ];
383
+ const tabSizes = [
384
+ [/^tab(?:-(.+))?$/, ([, s]) => {
385
+ const v = h.bracket.cssvar.global.number(s || "4");
386
+ if (v != null) {
387
+ return {
388
+ "-moz-tab-size": v,
389
+ "-o-tab-size": v,
390
+ "tab-size": v
391
+ };
392
+ }
393
+ }]
394
+ ];
395
+ const textIndents = [
396
+ [/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || h.bracket.cssvar.global.fraction.rem(s) }), { autocomplete: "indent-$textIndent" }]
397
+ ];
398
+ const textStrokes = [
399
+ // widths
400
+ [/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || h.bracket.cssvar.px(s) }), { autocomplete: "text-stroke-$textStrokeWidth" }],
401
+ // colors
402
+ [/^text-stroke-(.+)$/, colorResolver("-webkit-text-stroke-color", "text-stroke", "borderColor"), { autocomplete: "text-stroke-$colors" }],
403
+ [/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "text-stroke-(op|opacity)-<percent>" }]
404
+ ];
405
+ const textShadows = [
406
+ [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
407
+ const v = theme.textShadow?.[s || "DEFAULT"];
408
+ if (v != null) {
409
+ return {
410
+ "--un-text-shadow": colorableShadows(v, "--un-text-shadow-color").join(","),
411
+ "text-shadow": "var(--un-text-shadow)"
412
+ };
413
+ }
414
+ return { "text-shadow": h.bracket.cssvar.global(s) };
415
+ }, { autocomplete: "text-shadow-$textShadow" }],
416
+ // colors
417
+ [/^text-shadow-color-(.+)$/, colorResolver("--un-text-shadow-color", "text-shadow", "shadowColor"), { autocomplete: "text-shadow-color-$colors" }],
418
+ [/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "text-shadow-color-(op|opacity)-<percent>" }]
419
+ ];
420
+ function handleThemeByKey(s, theme, key) {
421
+ return theme[key]?.[s] || h.bracket.cssvar.global.rem(s);
422
+ }
423
+ function handleSize([, s], { theme }) {
424
+ const themed = toArray(theme.fontSize?.[s]);
425
+ const size = themed?.[0] ?? h.bracket.cssvar.global.rem(s);
426
+ if (size != null)
427
+ return { "font-size": size };
428
+ }
429
+ function handlerColorOrSize(match, ctx) {
430
+ if (isCSSMathFn(h.bracket(match[1])))
431
+ return handleSize(match, ctx);
432
+ return colorResolver("color", "text", "textColor")(match, ctx);
433
+ }
434
+ function handleText([, s = "base"], { theme }) {
435
+ const split = splitShorthand(s, "length");
436
+ if (!split)
437
+ return;
438
+ const [size, leading] = split;
439
+ const sizePairs = toArray(theme.fontSize?.[size]);
440
+ const lineHeight = leading ? handleThemeByKey(leading, theme, "lineHeight") : void 0;
441
+ if (sizePairs?.[0]) {
442
+ const [fontSize2, height, letterSpacing] = sizePairs;
443
+ if (typeof height === "object") {
444
+ return {
445
+ "font-size": fontSize2,
446
+ ...height
447
+ };
448
+ }
449
+ return {
450
+ "font-size": fontSize2,
451
+ "line-height": lineHeight ?? height ?? "1",
452
+ "letter-spacing": letterSpacing ? handleThemeByKey(letterSpacing, theme, "letterSpacing") : void 0
453
+ };
454
+ }
455
+ const fontSize = h.bracketOfLength.rem(size);
456
+ if (lineHeight && fontSize) {
457
+ return {
458
+ "font-size": fontSize,
459
+ "line-height": lineHeight
460
+ };
461
+ }
462
+ return { "font-size": h.bracketOfLength.rem(s) };
463
+ }
464
+
465
+ const directions = {
466
+ "": "",
467
+ "x": "column-",
468
+ "y": "row-",
469
+ "col": "column-",
470
+ "row": "row-"
471
+ };
472
+ function handleGap([, d = "", s], { theme }) {
473
+ const v = theme.spacing?.[s] ?? h.bracket.cssvar.global.rem(s);
474
+ if (v != null) {
475
+ return {
476
+ [`${directions[d]}gap`]: v
477
+ };
478
+ }
479
+ }
480
+ const gaps = [
481
+ [/^(?:flex-|grid-)?gap-?()(.+)$/, handleGap, { autocomplete: ["gap-$spacing", "gap-<num>"] }],
482
+ [/^(?:flex-|grid-)?gap-([xy])-?(.+)$/, handleGap, { autocomplete: ["gap-(x|y)-$spacing", "gap-(x|y)-<num>"] }],
483
+ [/^(?:flex-|grid-)?gap-(col|row)-?(.+)$/, handleGap, { autocomplete: ["gap-(col|row)-$spacing", "gap-(col|row)-<num>"] }]
484
+ ];
485
+
486
+ function rowCol(s) {
487
+ return s.replace("col", "column");
488
+ }
489
+ function rowColTheme(s) {
490
+ return s[0] === "r" ? "Row" : "Column";
491
+ }
492
+ function autoDirection(c, theme, prop) {
493
+ const v = theme[`gridAuto${rowColTheme(c)}`]?.[prop];
494
+ if (v != null)
495
+ return v;
496
+ switch (prop) {
497
+ case "min":
498
+ return "min-content";
499
+ case "max":
500
+ return "max-content";
501
+ case "fr":
502
+ return "minmax(0,1fr)";
503
+ }
504
+ return h.bracket.cssvar.auto.rem(prop);
505
+ }
506
+ const grids = [
507
+ // displays
508
+ ["grid", { display: "grid" }],
509
+ ["inline-grid", { display: "inline-grid" }],
510
+ // global
511
+ [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v], { theme }) => ({
512
+ [`grid-${rowCol(c)}`]: theme[`grid${rowColTheme(c)}`]?.[v] ?? h.bracket.cssvar.auto(v)
513
+ })],
514
+ // span
515
+ [/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
516
+ if (s === "full")
517
+ return { [`grid-${rowCol(c)}`]: "1/-1" };
518
+ const v = h.bracket.number(s);
519
+ if (v != null)
520
+ return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
521
+ }, { autocomplete: ["grid-(row|col)-span-<num>", "(row|col)-span-<num>"] }],
522
+ // starts & ends
523
+ [/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: h.bracket.cssvar(v) ?? v })],
524
+ [/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: h.bracket.cssvar(v) ?? v }), { autocomplete: ["grid-(row|col)-(start|end)-<num>"] }],
525
+ // auto flows
526
+ [/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(c, theme, v) }), { autocomplete: ["grid-auto-(rows|cols)-<num>"] }],
527
+ // grid-auto-flow, auto-flow: uno
528
+ // grid-flow: wind
529
+ [/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": h.bracket.cssvar(v) })],
530
+ [/^(?:grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") }), { autocomplete: ["(grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)"] }],
531
+ // templates
532
+ [/^grid-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({
533
+ [`grid-template-${rowCol(c)}`]: theme[`gridTemplate${rowColTheme(c)}`]?.[v] ?? h.bracket.cssvar(v)
534
+ })],
535
+ [/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
536
+ [/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` }), { autocomplete: ["grid-(rows|cols)-<num>", "grid-(rows|cols)-none"] }],
537
+ // areas
538
+ [/^grid-area(s)?-(.+)$/, ([, s, v]) => {
539
+ if (s != null)
540
+ return { "grid-template-areas": h.cssvar(v) ?? v.split("-").map((s2) => `"${h.bracket(s2)}"`).join(" ") };
541
+ return { "grid-area": h.bracket.cssvar(v) };
542
+ }],
543
+ // template none
544
+ ["grid-rows-none", { "grid-template-rows": "none" }],
545
+ ["grid-cols-none", { "grid-template-columns": "none" }],
546
+ // template subgrid
547
+ ["grid-rows-subgrid", { "grid-template-rows": "subgrid" }],
548
+ ["grid-cols-subgrid", { "grid-template-columns": "subgrid" }]
549
+ ];
550
+
551
+ const overflowValues = [
552
+ "auto",
553
+ "hidden",
554
+ "clip",
555
+ "visible",
556
+ "scroll",
557
+ "overlay",
558
+ ...globalKeywords
559
+ ];
560
+ const overflows = [
561
+ [/^(?:overflow|of)-(.+)$/, ([, v]) => overflowValues.includes(v) ? { overflow: v } : void 0, { autocomplete: [`(overflow|of)-(${overflowValues.join("|")})`, `(overflow|of)-(x|y)-(${overflowValues.join("|")})`] }],
562
+ [/^(?:overflow|of)-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]
563
+ ];
564
+
565
+ const positions = [
566
+ [/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v }), {
567
+ autocomplete: [
568
+ "(position|pos)-<position>",
569
+ "(position|pos)-<globalKeyword>",
570
+ "<position>"
571
+ ]
572
+ }],
573
+ [/^(?:position-|pos-)([-\w]+)$/, ([, v]) => globalKeywords.includes(v) ? { position: v } : void 0],
574
+ [/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
575
+ ];
576
+ const justifies = [
577
+ // contents
578
+ ["justify-start", { "justify-content": "flex-start" }],
579
+ ["justify-end", { "justify-content": "flex-end" }],
580
+ ["justify-center", { "justify-content": "center" }],
581
+ ["justify-between", { "justify-content": "space-between" }],
582
+ ["justify-around", { "justify-content": "space-around" }],
583
+ ["justify-evenly", { "justify-content": "space-evenly" }],
584
+ ["justify-stretch", { "justify-content": "stretch" }],
585
+ ["justify-left", { "justify-content": "left" }],
586
+ ["justify-right", { "justify-content": "right" }],
587
+ ...makeGlobalStaticRules("justify", "justify-content"),
588
+ // items
589
+ ["justify-items-start", { "justify-items": "start" }],
590
+ ["justify-items-end", { "justify-items": "end" }],
591
+ ["justify-items-center", { "justify-items": "center" }],
592
+ ["justify-items-stretch", { "justify-items": "stretch" }],
593
+ ...makeGlobalStaticRules("justify-items"),
594
+ // selfs
595
+ ["justify-self-auto", { "justify-self": "auto" }],
596
+ ["justify-self-start", { "justify-self": "start" }],
597
+ ["justify-self-end", { "justify-self": "end" }],
598
+ ["justify-self-center", { "justify-self": "center" }],
599
+ ["justify-self-stretch", { "justify-self": "stretch" }],
600
+ ...makeGlobalStaticRules("justify-self")
601
+ ];
602
+ const orders = [
603
+ [/^order-(.+)$/, ([, v]) => ({ order: h.bracket.cssvar.number(v) })],
604
+ ["order-first", { order: "-9999" }],
605
+ ["order-last", { order: "9999" }],
606
+ ["order-none", { order: "0" }]
607
+ ];
608
+ const alignments = [
609
+ // contents
610
+ ["content-center", { "align-content": "center" }],
611
+ ["content-start", { "align-content": "flex-start" }],
612
+ ["content-end", { "align-content": "flex-end" }],
613
+ ["content-between", { "align-content": "space-between" }],
614
+ ["content-around", { "align-content": "space-around" }],
615
+ ["content-evenly", { "align-content": "space-evenly" }],
616
+ ...makeGlobalStaticRules("content", "align-content"),
617
+ // items
618
+ ["items-start", { "align-items": "flex-start" }],
619
+ ["items-end", { "align-items": "flex-end" }],
620
+ ["items-center", { "align-items": "center" }],
621
+ ["items-baseline", { "align-items": "baseline" }],
622
+ ["items-stretch", { "align-items": "stretch" }],
623
+ ...makeGlobalStaticRules("items", "align-items"),
624
+ // selfs
625
+ ["self-auto", { "align-self": "auto" }],
626
+ ["self-start", { "align-self": "flex-start" }],
627
+ ["self-end", { "align-self": "flex-end" }],
628
+ ["self-center", { "align-self": "center" }],
629
+ ["self-stretch", { "align-self": "stretch" }],
630
+ ["self-baseline", { "align-self": "baseline" }],
631
+ ...makeGlobalStaticRules("self", "align-self")
632
+ ];
633
+ const placements = [
634
+ // contents
635
+ ["place-content-center", { "place-content": "center" }],
636
+ ["place-content-start", { "place-content": "start" }],
637
+ ["place-content-end", { "place-content": "end" }],
638
+ ["place-content-between", { "place-content": "space-between" }],
639
+ ["place-content-around", { "place-content": "space-around" }],
640
+ ["place-content-evenly", { "place-content": "space-evenly" }],
641
+ ["place-content-stretch", { "place-content": "stretch" }],
642
+ ...makeGlobalStaticRules("place-content"),
643
+ // items
644
+ ["place-items-start", { "place-items": "start" }],
645
+ ["place-items-end", { "place-items": "end" }],
646
+ ["place-items-center", { "place-items": "center" }],
647
+ ["place-items-stretch", { "place-items": "stretch" }],
648
+ ...makeGlobalStaticRules("place-items"),
649
+ // selfs
650
+ ["place-self-auto", { "place-self": "auto" }],
651
+ ["place-self-start", { "place-self": "start" }],
652
+ ["place-self-end", { "place-self": "end" }],
653
+ ["place-self-center", { "place-self": "center" }],
654
+ ["place-self-stretch", { "place-self": "stretch" }],
655
+ ...makeGlobalStaticRules("place-self")
656
+ ];
657
+ const flexGridJustifiesAlignments = [...justifies, ...alignments].flatMap(([k, v]) => [
658
+ [`flex-${k}`, v],
659
+ [`grid-${k}`, v]
660
+ ]);
661
+ function handleInsetValue(v, { theme }) {
662
+ return theme.spacing?.[v] ?? h.bracket.cssvar.global.auto.fraction.rem(v);
663
+ }
664
+ function handleInsetValues([, d, v], ctx) {
665
+ const r = handleInsetValue(v, ctx);
666
+ if (r != null && d in insetMap)
667
+ return insetMap[d].map((i) => [i.slice(1), r]);
668
+ }
669
+ const insets = [
670
+ [
671
+ /^(?:position-|pos-)?inset-(.+)$/,
672
+ ([, v], ctx) => ({ inset: handleInsetValue(v, ctx) }),
673
+ {
674
+ autocomplete: [
675
+ "(position|pos)-inset-<directions>-$spacing",
676
+ "(position|pos)-inset-(block|inline)-$spacing",
677
+ "(position|pos)-inset-(bs|be|is|ie)-$spacing",
678
+ "(position|pos)-(top|left|right|bottom)-$spacing"
679
+ ]
680
+ }
681
+ ],
682
+ [/^(?:position-|pos-)?(start|end)-(.+)$/, handleInsetValues],
683
+ [/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
684
+ [/^(?:position-|pos-)?inset-([rltbse])-(.+)$/, handleInsetValues],
685
+ [/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
686
+ [/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
687
+ [/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v], ctx) => ({ [d]: handleInsetValue(v, ctx) })]
688
+ ];
689
+ const floats = [
690
+ // floats
691
+ ["float-left", { float: "left" }],
692
+ ["float-right", { float: "right" }],
693
+ ["float-none", { float: "none" }],
694
+ ...makeGlobalStaticRules("float"),
695
+ // clears
696
+ ["clear-left", { clear: "left" }],
697
+ ["clear-right", { clear: "right" }],
698
+ ["clear-both", { clear: "both" }],
699
+ ["clear-none", { clear: "none" }],
700
+ ...makeGlobalStaticRules("clear")
701
+ ];
702
+ const zIndexes = [
703
+ [/^(?:position-|pos-)?z([\d.]+)$/, ([, v]) => ({ "z-index": h.number(v) })],
704
+ [/^(?:position-|pos-)?z-(.+)$/, ([, v], { theme }) => ({ "z-index": theme.zIndex?.[v] ?? h.bracket.cssvar.global.auto.number(v) }), { autocomplete: "z-<num>" }]
705
+ ];
706
+ const boxSizing = [
707
+ ["box-border", { "box-sizing": "border-box" }],
708
+ ["box-content", { "box-sizing": "content-box" }],
709
+ ...makeGlobalStaticRules("box", "box-sizing")
710
+ ];
711
+
712
+ const sizeMapping = {
713
+ h: "height",
714
+ w: "width",
715
+ inline: "inline-size",
716
+ block: "block-size"
717
+ };
718
+ function getPropName(minmax, hw) {
719
+ return `${minmax || ""}${sizeMapping[hw]}`;
720
+ }
721
+ function getSizeValue(minmax, hw, theme, prop) {
722
+ const str = getPropName(minmax, hw).replace(/-(\w)/g, (_, p) => p.toUpperCase());
723
+ const v = theme[str]?.[prop];
724
+ if (v != null)
725
+ return v;
726
+ switch (prop) {
727
+ case "fit":
728
+ case "max":
729
+ case "min":
730
+ return `${prop}-content`;
731
+ }
732
+ return h.bracket.cssvar.global.auto.fraction.rem(prop);
733
+ }
734
+ const sizes = [
735
+ [/^size-(min-|max-)?(.+)$/, ([, m, s], { theme }) => ({ [getPropName(m, "w")]: getSizeValue(m, "w", theme, s), [getPropName(m, "h")]: getSizeValue(m, "h", theme, s) })],
736
+ [/^(?:size-)?(min-|max-)?([wh])-?(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
737
+ [/^(?:size-)?(min-|max-)?(block|inline)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) }), {
738
+ autocomplete: [
739
+ "(w|h)-$width|height|maxWidth|maxHeight|minWidth|minHeight|inlineSize|blockSize|maxInlineSize|maxBlockSize|minInlineSize|minBlockSize",
740
+ "(block|inline)-$width|height|maxWidth|maxHeight|minWidth|minHeight|inlineSize|blockSize|maxInlineSize|maxBlockSize|minInlineSize|minBlockSize",
741
+ "(max|min)-(w|h|block|inline)",
742
+ "(max|min)-(w|h|block|inline)-$width|height|maxWidth|maxHeight|minWidth|minHeight|inlineSize|blockSize|maxInlineSize|maxBlockSize|minInlineSize|minBlockSize",
743
+ "(w|h)-full",
744
+ "(max|min)-(w|h)-full"
745
+ ]
746
+ }],
747
+ [/^(?:size-)?(min-|max-)?(h)-screen-(.+)$/, ([, m, h2, p], context) => ({ [getPropName(m, h2)]: handleBreakpoint(context, p, "verticalBreakpoints") })],
748
+ [/^(?:size-)?(min-|max-)?(w)-screen-(.+)$/, ([, m, w, p], context) => ({ [getPropName(m, w)]: handleBreakpoint(context, p) }), {
749
+ autocomplete: [
750
+ "(w|h)-screen",
751
+ "(min|max)-(w|h)-screen",
752
+ "h-screen-$verticalBreakpoints",
753
+ "(min|max)-h-screen-$verticalBreakpoints",
754
+ "w-screen-$breakpoints",
755
+ "(min|max)-w-screen-$breakpoints"
756
+ ]
757
+ }]
758
+ ];
759
+ function handleBreakpoint(context, point, key = "breakpoints") {
760
+ const bp = resolveBreakpoints(context, key);
761
+ if (bp)
762
+ return bp.find((i) => i.point === point)?.size;
763
+ }
764
+ function getAspectRatio(prop) {
765
+ if (/^\d+\/\d+$/.test(prop))
766
+ return prop;
767
+ switch (prop) {
768
+ case "square":
769
+ return "1/1";
770
+ case "video":
771
+ return "16/9";
772
+ }
773
+ return h.bracket.cssvar.global.auto.number(prop);
774
+ }
775
+ const aspectRatio = [
776
+ [/^(?:size-)?aspect-(?:ratio-)?(.+)$/, ([, d]) => ({ "aspect-ratio": getAspectRatio(d) }), { autocomplete: ["aspect-(square|video|ratio)", "aspect-ratio-(square|video)"] }]
777
+ ];
778
+
779
+ const paddings = [
780
+ [/^pa?()-?(-?.+)$/, directionSize("padding"), { autocomplete: ["(m|p)<num>", "(m|p)-<num>"] }],
781
+ [/^p-?xy()()$/, directionSize("padding"), { autocomplete: "(m|p)-(xy)" }],
782
+ [/^p-?([xy])(?:-?(-?.+))?$/, directionSize("padding")],
783
+ [/^p-?([rltbse])(?:-?(-?.+))?$/, directionSize("padding"), { autocomplete: "(m|p)<directions>-<num>" }],
784
+ [/^p-(block|inline)(?:-(-?.+))?$/, directionSize("padding"), { autocomplete: "(m|p)-(block|inline)-<num>" }],
785
+ [/^p-?([bi][se])(?:-?(-?.+))?$/, directionSize("padding"), { autocomplete: "(m|p)-(bs|be|is|ie)-<num>" }]
786
+ ];
787
+ const margins = [
788
+ [/^ma?()-?(-?.+)$/, directionSize("margin")],
789
+ [/^m-?xy()()$/, directionSize("margin")],
790
+ [/^m-?([xy])(?:-?(-?.+))?$/, directionSize("margin")],
791
+ [/^m-?([rltbse])(?:-?(-?.+))?$/, directionSize("margin")],
792
+ [/^m-(block|inline)(?:-(-?.+))?$/, directionSize("margin")],
793
+ [/^m-?([bi][se])(?:-?(-?.+))?$/, directionSize("margin")]
794
+ ];
795
+
796
+ const variablesAbbrMap = {
797
+ backface: "backface-visibility",
798
+ break: "word-break",
799
+ case: "text-transform",
800
+ content: "align-content",
801
+ fw: "font-weight",
802
+ items: "align-items",
803
+ justify: "justify-content",
804
+ select: "user-select",
805
+ self: "align-self",
806
+ vertical: "vertical-align",
807
+ visible: "visibility",
808
+ whitespace: "white-space",
809
+ ws: "white-space"
810
+ };
811
+ const cssVariables = [
812
+ [/^(.+?)-(\$.+)$/, ([, name, varname]) => {
813
+ const prop = variablesAbbrMap[name];
814
+ if (prop)
815
+ return { [prop]: h.cssvar(varname) };
816
+ }]
817
+ ];
818
+ const cssProperty = [
819
+ [/^\[(.*)\]$/, ([_, body], { theme }) => {
820
+ if (!body.includes(":"))
821
+ return;
822
+ const [prop, ...rest] = body.split(":");
823
+ const value = rest.join(":");
824
+ if (!isURI(body) && /^[a-z-]+$/.test(prop) && isValidCSSBody(value)) {
825
+ let parsed;
826
+ if (hasThemeFn(value))
827
+ parsed = transformThemeFn(value, theme);
828
+ if (!parsed || parsed === value)
829
+ parsed = h.bracket(`[${value}]`);
830
+ if (parsed)
831
+ return { [prop]: parsed };
832
+ }
833
+ }]
834
+ ];
835
+ function isValidCSSBody(body) {
836
+ let i = 0;
837
+ function findUntil(c) {
838
+ while (i < body.length) {
839
+ i += 1;
840
+ const char = body[i];
841
+ if (char === c)
842
+ return true;
843
+ }
844
+ return false;
845
+ }
846
+ for (i = 0; i < body.length; i++) {
847
+ const c = body[i];
848
+ if ("\"`'".includes(c)) {
849
+ if (!findUntil(c))
850
+ return false;
851
+ } else if (c === "(") {
852
+ if (!findUntil(")"))
853
+ return false;
854
+ } else if ("[]{}:".includes(c)) {
855
+ return false;
856
+ }
857
+ }
858
+ return true;
859
+ }
860
+ function isURI(declaration) {
861
+ if (!declaration.includes("://"))
862
+ return false;
863
+ try {
864
+ return new URL(declaration).host !== "";
865
+ } catch (err) {
866
+ return false;
867
+ }
868
+ }
869
+
870
+ const questionMark = [
871
+ [
872
+ /^(where|\?)$/,
873
+ (_, { constructCSS, generator }) => {
874
+ if (generator.userConfig.envMode === "dev")
875
+ 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}}
876
+ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
877
+ }
878
+ ]
879
+ ];
880
+
881
+ const svgUtilities = [
882
+ // fills
883
+ [/^fill-(.+)$/, colorResolver("fill", "fill", "backgroundColor"), { autocomplete: "fill-$colors" }],
884
+ [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "fill-(op|opacity)-<percent>" }],
885
+ ["fill-none", { fill: "none" }],
886
+ // stroke size
887
+ [/^stroke-(?:width-|size-)?(.+)$/, handleWidth, { autocomplete: ["stroke-width-$lineWidth", "stroke-size-$lineWidth"] }],
888
+ // stroke dash
889
+ [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": h.bracket.cssvar.number(s) }), { autocomplete: "stroke-dash-<num>" }],
890
+ [/^stroke-offset-(.+)$/, ([, s], { theme }) => ({ "stroke-dashoffset": theme.lineWidth?.[s] ?? h.bracket.cssvar.px.numberWithUnit(s) }), { autocomplete: "stroke-offset-$lineWidth" }],
891
+ // stroke colors
892
+ [/^stroke-(.+)$/, handleColorOrWidth, { autocomplete: "stroke-$colors" }],
893
+ [/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "stroke-(op|opacity)-<percent>" }],
894
+ // line cap
895
+ ["stroke-cap-square", { "stroke-linecap": "square" }],
896
+ ["stroke-cap-round", { "stroke-linecap": "round" }],
897
+ ["stroke-cap-auto", { "stroke-linecap": "butt" }],
898
+ // line join
899
+ ["stroke-join-arcs", { "stroke-linejoin": "arcs" }],
900
+ ["stroke-join-bevel", { "stroke-linejoin": "bevel" }],
901
+ ["stroke-join-clip", { "stroke-linejoin": "miter-clip" }],
902
+ ["stroke-join-round", { "stroke-linejoin": "round" }],
903
+ ["stroke-join-auto", { "stroke-linejoin": "miter" }],
904
+ // none
905
+ ["stroke-none", { stroke: "none" }]
906
+ ];
907
+ function handleWidth([, b], { theme }) {
908
+ return { "stroke-width": theme.lineWidth?.[b] ?? h.bracket.cssvar.fraction.px.number(b) };
909
+ }
910
+ function handleColorOrWidth(match, ctx) {
911
+ if (isCSSMathFn(h.bracket(match[1])))
912
+ return handleWidth(match, ctx);
913
+ return colorResolver("stroke", "stroke", "borderColor")(match, ctx);
914
+ }
915
+
916
+ const rules = [
917
+ cssVariables,
918
+ cssProperty,
919
+ paddings,
920
+ margins,
921
+ displays,
922
+ opacity,
923
+ bgColors,
924
+ colorScheme,
925
+ svgUtilities,
926
+ borders,
927
+ contentVisibility,
928
+ contents,
929
+ fonts,
930
+ tabSizes,
931
+ textIndents,
932
+ textOverflows,
933
+ textDecorations,
934
+ textStrokes,
935
+ textShadows,
936
+ textTransforms,
937
+ textAligns,
938
+ fontStyles,
939
+ fontSmoothings,
940
+ boxShadows,
941
+ rings,
942
+ flex,
943
+ grids,
944
+ gaps,
945
+ positions,
946
+ sizes,
947
+ aspectRatio,
948
+ cursors,
949
+ appearances,
950
+ pointerEvents,
951
+ resizes,
952
+ verticalAligns,
953
+ userSelects,
954
+ whitespaces,
955
+ breaks,
956
+ overflows,
957
+ outline,
958
+ appearance,
959
+ orders,
960
+ justifies,
961
+ alignments,
962
+ placements,
963
+ flexGridJustifiesAlignments,
964
+ insets,
965
+ floats,
966
+ zIndexes,
967
+ boxSizing,
968
+ transitions,
969
+ transforms,
970
+ willChange,
971
+ containerParent,
972
+ contains,
973
+ textWraps,
974
+ // should be the last
975
+ questionMark
976
+ ].flat(1);
977
+
978
+ export { zIndexes as A, boxSizing as B, questionMark as C, sizes as D, aspectRatio as E, paddings as F, margins as G, svgUtilities as H, transitions as I, fonts as J, tabSizes as K, textIndents as L, textStrokes as M, textShadows as N, cssVariables as O, cssProperty as P, appearance as a, borderStyles as b, borders as c, opacity as d, bgColors as e, colorScheme as f, containerParent as g, handlerBorderStyle as h, textDecorations as i, flex as j, gaps as k, grids as l, overflows as m, justifies as n, outline as o, positions as p, orders as q, rules as r, alignments as s, textAligns as t, placements as u, verticalAligns as v, willChange as w, flexGridJustifiesAlignments as x, insets as y, floats as z };