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