@unocss/preset-mini 0.57.7 → 0.58.1

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