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