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