@unocss/preset-mini 0.44.4 → 0.45.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.
@@ -0,0 +1,770 @@
1
+ 'use strict';
2
+
3
+ const colors = require('./colors.cjs');
4
+ const core = require('@unocss/core');
5
+
6
+ const verticalAlignAlias = {
7
+ "mid": "middle",
8
+ "base": "baseline",
9
+ "btm": "bottom",
10
+ "baseline": "baseline",
11
+ "top": "top",
12
+ "middle": "middle",
13
+ "bottom": "bottom",
14
+ "text-top": "text-top",
15
+ "text-bottom": "text-bottom",
16
+ "sub": "sub",
17
+ "super": "super",
18
+ ...Object.fromEntries(colors.globalKeywords.map((x) => [x, x]))
19
+ };
20
+ const verticalAligns = [
21
+ [/^(?:vertical|align|v)-([-\w]+)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] }), { autocomplete: `(vertical|align|v)-(${Object.keys(verticalAlignAlias).join("|")})` }]
22
+ ];
23
+ const textAligns = ["center", "left", "right", "justify", "start", "end", ...colors.globalKeywords].map((v) => [`text-${v}`, { "text-align": v }]);
24
+
25
+ const outline = [
26
+ [/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ?? colors.handler.bracket.cssvar.global.px(d) }), { autocomplete: "outline-(width|size)-<num>" }],
27
+ [/^outline-(?:color-)?(.+)$/, colors.colorResolver("outline-color", "outline-color"), { autocomplete: "outline-$colors" }],
28
+ [/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? colors.handler.bracket.cssvar.global.px(d) }), { autocomplete: "outline-(offset)-<num>" }],
29
+ ["outline", { "outline-style": "solid" }],
30
+ ...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset", ...colors.globalKeywords].map((v) => [`outline-${v}`, { "outline-style": v }]),
31
+ ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
32
+ ];
33
+ const appearance = [
34
+ ["appearance-none", {
35
+ "appearance": "none",
36
+ "-webkit-appearance": "none"
37
+ }]
38
+ ];
39
+ const willChangeProperty = (prop) => {
40
+ return colors.handler.properties.auto.global(prop) ?? {
41
+ contents: "contents",
42
+ scroll: "scroll-position"
43
+ }[prop];
44
+ };
45
+ const willChange = [
46
+ [/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
47
+ ];
48
+
49
+ const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset", ...colors.globalKeywords];
50
+ const borders = [
51
+ [/^(?:border|b)()(?:-(.+))?$/, handlerBorder, { autocomplete: "(border|b)-<directions>" }],
52
+ [/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
53
+ [/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
54
+ [/^(?:border|b)-(block|inline)(?:-(.+))?$/, handlerBorder],
55
+ [/^(?:border|b)-([bi][se])(?:-(.+))?$/, handlerBorder],
56
+ [/^(?:border|b)-()(?:width|size)-(.+)$/, handlerBorderSize, { autocomplete: ["(border|b)-<num>", "(border|b)-<directions>-<num>"] }],
57
+ [/^(?:border|b)-([xy])-(?:width|size)-(.+)$/, handlerBorderSize],
58
+ [/^(?:border|b)-([rltbse])-(?:width|size)-(.+)$/, handlerBorderSize],
59
+ [/^(?:border|b)-(block|inline)-(?:width|size)-(.+)$/, handlerBorderSize],
60
+ [/^(?:border|b)-([bi][se])-(?:width|size)-(.+)$/, handlerBorderSize],
61
+ [/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor, { autocomplete: ["(border|b)-$colors", "(border|b)-<directions>-$colors"] }],
62
+ [/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
63
+ [/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
64
+ [/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/, handlerBorderColor],
65
+ [/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/, handlerBorderColor],
66
+ [/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity, { autocomplete: "(border|b)-(op|opacity)-<percent>" }],
67
+ [/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
68
+ [/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
69
+ [/^(?:border|b)-(block|inline)-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
70
+ [/^(?:border|b)-([bi][se])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
71
+ [/^(?:border-|b-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded, { autocomplete: ["(border|b)-(rounded|rd)", "(border|b)-(rounded|rd)-<num>", "(rounded|rd)", "(rounded|rd)-<num>"] }],
72
+ [/^(?:border-|b-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
73
+ [/^(?:border-|b-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
74
+ [/^(?:border-|b-)?(?:rounded|rd)-([bi][se])(?:-(.+))?$/, handlerRounded],
75
+ [/^(?:border-|b-)?(?:rounded|rd)-([bi][se]-[bi][se])(?:-(.+))?$/, handlerRounded],
76
+ [/^(?: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("|")})`] }],
77
+ [/^(?:border|b)-([xy])-(?:style-)?(.+)$/, handlerBorderStyle],
78
+ [/^(?:border|b)-([rltbse])-(?:style-)?(.+)$/, handlerBorderStyle],
79
+ [/^(?:border|b)-(block|inline)-(?:style-)?(.+)$/, handlerBorderStyle],
80
+ [/^(?:border|b)-([bi][se])-(?:style-)?(.+)$/, handlerBorderStyle]
81
+ ];
82
+ const borderColorResolver = (direction) => ([, body], theme) => {
83
+ const data = colors.parseColor(body, theme);
84
+ if (!data)
85
+ return;
86
+ const { alpha, color, cssColor } = data;
87
+ if (cssColor) {
88
+ if (alpha != null) {
89
+ return {
90
+ [`border${direction}-color`]: colors.colorToString(cssColor, alpha)
91
+ };
92
+ }
93
+ if (direction === "") {
94
+ return {
95
+ "--un-border-opacity": colors.colorOpacityToString(cssColor),
96
+ "border-color": colors.colorToString(cssColor, "var(--un-border-opacity)")
97
+ };
98
+ } else {
99
+ return {
100
+ "--un-border-opacity": colors.colorOpacityToString(cssColor),
101
+ [`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
102
+ [`border${direction}-color`]: colors.colorToString(cssColor, `var(--un-border${direction}-opacity)`)
103
+ };
104
+ }
105
+ } else if (color) {
106
+ return {
107
+ [`border${direction}-color`]: colors.colorToString(color, alpha)
108
+ };
109
+ }
110
+ };
111
+ function handlerBorder(m, ctx) {
112
+ const borderSizes = handlerBorderSize(m, ctx);
113
+ const borderStyle = handlerBorderStyle(["", m[1], "solid"]);
114
+ if (borderSizes && borderStyle) {
115
+ return [
116
+ ...borderSizes,
117
+ ...borderStyle
118
+ ];
119
+ }
120
+ }
121
+ function handlerBorderSize([, a = "", b], { theme }) {
122
+ const v = theme.lineWidth?.[b || "DEFAULT"] ?? colors.handler.bracket.cssvar.global.px(b || "1");
123
+ if (a in colors.directionMap && v != null)
124
+ return colors.directionMap[a].map((i) => [`border${i}-width`, v]);
125
+ }
126
+ function handlerBorderColor([, a = "", c], { theme }) {
127
+ if (a in colors.directionMap && colors.hasParseableColor(c, theme)) {
128
+ return Object.assign(
129
+ {},
130
+ ...colors.directionMap[a].map((i) => borderColorResolver(i)(["", c], theme))
131
+ );
132
+ }
133
+ }
134
+ function handlerBorderOpacity([, a = "", opacity]) {
135
+ const v = colors.handler.bracket.percent(opacity);
136
+ if (a in colors.directionMap && v != null)
137
+ return colors.directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
138
+ }
139
+ function handlerRounded([, a = "", s], { theme }) {
140
+ const v = theme.borderRadius?.[s || "DEFAULT"] || colors.handler.bracket.cssvar.global.fraction.rem(s || "1");
141
+ if (a in colors.cornerMap && v != null)
142
+ return colors.cornerMap[a].map((i) => [`border${i}-radius`, v]);
143
+ }
144
+ function handlerBorderStyle([, a = "", s]) {
145
+ if (borderStyles.includes(s) && a in colors.directionMap)
146
+ return colors.directionMap[a].map((i) => [`border${i}-style`, s]);
147
+ }
148
+
149
+ const transitionPropertyGroup = {
150
+ all: "all",
151
+ colors: ["color", "background-color", "border-color", "text-decoration-color", "fill", "stroke"].join(","),
152
+ none: "none",
153
+ opacity: "opacity",
154
+ shadow: "box-shadow",
155
+ transform: "transform"
156
+ };
157
+ const transitionProperty = (prop) => {
158
+ return colors.handler.properties(prop) ?? transitionPropertyGroup[prop];
159
+ };
160
+ const transitions = [
161
+ [/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop, d], { theme }) => {
162
+ const p = prop != null ? transitionProperty(prop) : [transitionPropertyGroup.colors, "opacity", "box-shadow", "transform", "filter", "backdrop-filter"].join(",");
163
+ if (p) {
164
+ const duration = theme.duration?.[d || "DEFAULT"] ?? colors.handler.time(d || "150");
165
+ return {
166
+ "transition-property": p,
167
+ "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
168
+ "transition-duration": duration
169
+ };
170
+ }
171
+ }, { autocomplete: `transition-(${Object.keys(transitionPropertyGroup).join("|")})` }],
172
+ [
173
+ /^(?:transition-)?duration-(.+)$/,
174
+ ([, d], { theme }) => ({ "transition-duration": theme.duration?.[d || "DEFAULT"] ?? colors.handler.bracket.cssvar.time(d) }),
175
+ { autocomplete: ["transition-duration-$duration", "duration-$duration"] }
176
+ ],
177
+ [
178
+ /^(?:transition-)?delay-(.+)$/,
179
+ ([, d], { theme }) => ({ "transition-delay": theme.duration?.[d || "DEFAULT"] ?? colors.handler.bracket.cssvar.time(d) }),
180
+ { autocomplete: ["transition-delay-$duration", "delay-$duration"] }
181
+ ],
182
+ [
183
+ /^(?:transition-)?ease(?:-(.+))?$/,
184
+ ([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? colors.handler.bracket.cssvar(d) }),
185
+ { autocomplete: ["transition-ease-(linear|in|out|in-out|DEFAULT)", "ease-(linear|in|out|in-out|DEFAULT)"] }
186
+ ],
187
+ [
188
+ /^(?:transition-)?property-(.+)$/,
189
+ ([, v]) => ({ "transition-property": colors.handler.bracket.global(v) || transitionProperty(v) }),
190
+ { autocomplete: [`transition-property-(${[...colors.globalKeywords, ...Object.keys(transitionPropertyGroup)].join("|")})`] }
191
+ ],
192
+ ["transition-none", { transition: "none" }],
193
+ ...colors.makeGlobalStaticRules("transition")
194
+ ];
195
+
196
+ const weightMap = {
197
+ thin: "100",
198
+ extralight: "200",
199
+ light: "300",
200
+ normal: "400",
201
+ medium: "500",
202
+ semibold: "600",
203
+ bold: "700",
204
+ extrabold: "800",
205
+ black: "900"
206
+ };
207
+ const fonts = [
208
+ [
209
+ /^font-(.+)$/,
210
+ ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] || colors.handler.bracket.cssvar.global(d) }),
211
+ { autocomplete: "font-$fontFamily" }
212
+ ],
213
+ [
214
+ /^text-(.+)$/,
215
+ ([, s = "base"], { theme }) => {
216
+ const themed = core.toArray(theme.fontSize?.[s]);
217
+ if (themed?.[0]) {
218
+ const [size, height = "1"] = themed;
219
+ return {
220
+ "font-size": size,
221
+ "line-height": height
222
+ };
223
+ }
224
+ return { "font-size": colors.handler.bracketOfLength.rem(s) };
225
+ },
226
+ { autocomplete: "text-$fontSize" }
227
+ ],
228
+ [/^text-size-(.+)$/, ([, s], { theme }) => {
229
+ const themed = core.toArray(theme.fontSize?.[s]);
230
+ const size = themed?.[0] ?? colors.handler.bracket.cssvar.global.rem(s);
231
+ if (size != null)
232
+ return { "font-size": size };
233
+ }, { autocomplete: "text-size-$fontSize" }],
234
+ [
235
+ /^(?:font|fw)-?([^-]+)$/,
236
+ ([, s]) => ({ "font-weight": weightMap[s] || colors.handler.global.number(s) }),
237
+ { autocomplete: `(font|fw)-(100|200|300|400|500|600|700|800|900|${Object.keys(weightMap).join("|")})` }
238
+ ],
239
+ [
240
+ /^(?:font-)?(?:leading|lh)-(.+)$/,
241
+ ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || colors.handler.bracket.cssvar.global.rem(s) }),
242
+ { autocomplete: "(leading|lh)-$lineHeight" }
243
+ ],
244
+ ["font-synthesis-weight", { "font-synthesis": "weight" }],
245
+ ["font-synthesis-style", { "font-synthesis": "style" }],
246
+ ["font-synthesis-small-caps", { "font-synthesis": "small-caps" }],
247
+ ["font-synthesis-none", { "font-synthesis": "none" }],
248
+ [/^font-synthesis-(.+)$/, ([, s]) => ({ "font-synthesis": colors.handler.bracket.cssvar.global(s) })],
249
+ [
250
+ /^(?:font-)?tracking-(.+)$/,
251
+ ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || colors.handler.bracket.cssvar.global.rem(s) }),
252
+ { autocomplete: "tracking-$letterSpacing" }
253
+ ],
254
+ [
255
+ /^(?:font-)?word-spacing-(.+)$/,
256
+ ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || colors.handler.bracket.cssvar.global.rem(s) }),
257
+ { autocomplete: "word-spacing-$wordSpacing" }
258
+ ]
259
+ ];
260
+ const tabSizes = [
261
+ [/^tab(?:-(.+))?$/, ([, s]) => {
262
+ const v = colors.handler.bracket.cssvar.global.number(s || "4");
263
+ if (v != null) {
264
+ return {
265
+ "-moz-tab-size": v,
266
+ "-o-tab-size": v,
267
+ "tab-size": v
268
+ };
269
+ }
270
+ }]
271
+ ];
272
+ const textIndents = [
273
+ [/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || colors.handler.bracket.cssvar.global.fraction.rem(s) }), { autocomplete: "indent-$textIndent" }]
274
+ ];
275
+ const textStrokes = [
276
+ [/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || colors.handler.bracket.cssvar.px(s) }), { autocomplete: "text-stroke-$textStrokeWidth" }],
277
+ [/^text-stroke-(.+)$/, colors.colorResolver("-webkit-text-stroke-color", "text-stroke"), { autocomplete: "text-stroke-$colors" }],
278
+ [/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": colors.handler.bracket.percent(opacity) }), { autocomplete: "text-stroke-(op|opacity)-<percent>" }]
279
+ ];
280
+ const textShadows = [
281
+ [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
282
+ const v = theme.textShadow?.[s || "DEFAULT"];
283
+ if (v != null) {
284
+ return {
285
+ "--un-text-shadow": colors.colorableShadows(v, "--un-text-shadow-color").join(","),
286
+ "text-shadow": "var(--un-text-shadow)"
287
+ };
288
+ }
289
+ return { "text-shadow": colors.handler.bracket.cssvar.global(s) };
290
+ }, { autocomplete: "text-shadow-$textShadow" }],
291
+ [/^text-shadow-color-(.+)$/, colors.colorResolver("--un-text-shadow-color", "text-shadow"), { autocomplete: "text-shadow-color-$colors" }],
292
+ [/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": colors.handler.bracket.percent(opacity) }), { autocomplete: "text-shadow-color-(op|opacity)-<percent>" }]
293
+ ];
294
+
295
+ const overflowValues = [
296
+ "auto",
297
+ "hidden",
298
+ "clip",
299
+ "visible",
300
+ "scroll",
301
+ ...colors.globalKeywords
302
+ ];
303
+ const overflows = [
304
+ [/^(?:overflow|of)-(.+)$/, ([, v]) => overflowValues.includes(v) ? { overflow: v } : void 0, { autocomplete: [`(overflow|of)-(${overflowValues.join("|")})`, `(overflow|of)-(x|y)-(${overflowValues.join("|")})`] }],
305
+ [/^(?:overflow|of)-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]
306
+ ];
307
+
308
+ const positions = [
309
+ [/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v })],
310
+ [/^(?:position-|pos-)([-\w]+)$/, ([, v]) => colors.globalKeywords.includes(v) ? { position: v } : void 0],
311
+ [/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
312
+ ];
313
+ const justifies = [
314
+ ["justify-start", { "justify-content": "flex-start" }],
315
+ ["justify-end", { "justify-content": "flex-end" }],
316
+ ["justify-center", { "justify-content": "center" }],
317
+ ["justify-between", { "justify-content": "space-between" }],
318
+ ["justify-around", { "justify-content": "space-around" }],
319
+ ["justify-evenly", { "justify-content": "space-evenly" }],
320
+ ...colors.makeGlobalStaticRules("justify", "justify-content"),
321
+ ["justify-items-start", { "justify-items": "start" }],
322
+ ["justify-items-end", { "justify-items": "end" }],
323
+ ["justify-items-center", { "justify-items": "center" }],
324
+ ["justify-items-stretch", { "justify-items": "stretch" }],
325
+ ...colors.makeGlobalStaticRules("justify-items"),
326
+ ["justify-self-auto", { "justify-self": "auto" }],
327
+ ["justify-self-start", { "justify-self": "start" }],
328
+ ["justify-self-end", { "justify-self": "end" }],
329
+ ["justify-self-center", { "justify-self": "center" }],
330
+ ["justify-self-stretch", { "justify-self": "stretch" }],
331
+ ...colors.makeGlobalStaticRules("justify-self")
332
+ ];
333
+ const orders = [
334
+ [/^order-(.+)$/, ([, v]) => ({ order: colors.handler.bracket.cssvar.number(v) })],
335
+ ["order-first", { order: "-9999" }],
336
+ ["order-last", { order: "9999" }],
337
+ ["order-none", { order: "0" }]
338
+ ];
339
+ const alignments = [
340
+ ["content-center", { "align-content": "center" }],
341
+ ["content-start", { "align-content": "flex-start" }],
342
+ ["content-end", { "align-content": "flex-end" }],
343
+ ["content-between", { "align-content": "space-between" }],
344
+ ["content-around", { "align-content": "space-around" }],
345
+ ["content-evenly", { "align-content": "space-evenly" }],
346
+ ...colors.makeGlobalStaticRules("content", "align-content"),
347
+ ["items-start", { "align-items": "flex-start" }],
348
+ ["items-end", { "align-items": "flex-end" }],
349
+ ["items-center", { "align-items": "center" }],
350
+ ["items-baseline", { "align-items": "baseline" }],
351
+ ["items-stretch", { "align-items": "stretch" }],
352
+ ...colors.makeGlobalStaticRules("items", "align-items"),
353
+ ["self-auto", { "align-self": "auto" }],
354
+ ["self-start", { "align-self": "flex-start" }],
355
+ ["self-end", { "align-self": "flex-end" }],
356
+ ["self-center", { "align-self": "center" }],
357
+ ["self-stretch", { "align-self": "stretch" }],
358
+ ["self-baseline", { "align-self": "baseline" }],
359
+ ...colors.makeGlobalStaticRules("self", "align-self")
360
+ ];
361
+ const placements = [
362
+ ["place-content-center", { "place-content": "center" }],
363
+ ["place-content-start", { "place-content": "start" }],
364
+ ["place-content-end", { "place-content": "end" }],
365
+ ["place-content-between", { "place-content": "space-between" }],
366
+ ["place-content-around", { "place-content": "space-around" }],
367
+ ["place-content-evenly", { "place-content": "space-evenly" }],
368
+ ["place-content-stretch", { "place-content": "stretch" }],
369
+ ...colors.makeGlobalStaticRules("place-content"),
370
+ ["place-items-start", { "place-items": "start" }],
371
+ ["place-items-end", { "place-items": "end" }],
372
+ ["place-items-center", { "place-items": "center" }],
373
+ ["place-items-stretch", { "place-items": "stretch" }],
374
+ ...colors.makeGlobalStaticRules("place-items"),
375
+ ["place-self-auto", { "place-self": "auto" }],
376
+ ["place-self-start", { "place-self": "start" }],
377
+ ["place-self-end", { "place-self": "end" }],
378
+ ["place-self-center", { "place-self": "center" }],
379
+ ["place-self-stretch", { "place-self": "stretch" }],
380
+ ...colors.makeGlobalStaticRules("place-self")
381
+ ];
382
+ function handleInsetValue(v, { theme }) {
383
+ return theme.spacing?.[v] ?? colors.handler.bracket.cssvar.global.auto.fraction.rem(v);
384
+ }
385
+ function handleInsetValues([, d, v], ctx) {
386
+ const r = handleInsetValue(v, ctx);
387
+ if (r != null && d in colors.insetMap)
388
+ return colors.insetMap[d].map((i) => [i.slice(1), r]);
389
+ }
390
+ const insets = [
391
+ [
392
+ /^(?:position-|pos-)?inset-(.+)$/,
393
+ ([, v], ctx) => ({ inset: handleInsetValue(v, ctx) }),
394
+ {
395
+ autocomplete: [
396
+ "(position|pos)-inset-<directions>-$spacing",
397
+ "(position|pos)-inset-(block|inline)-$spacing",
398
+ "(position|pos)-inset-(bs|be|is|ie)-$spacing",
399
+ "(position|pos)-(top|left|right|bottom)-$spacing"
400
+ ]
401
+ }
402
+ ],
403
+ [/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
404
+ [/^(?:position-|pos-)?inset-([rltbse])-(.+)$/, handleInsetValues],
405
+ [/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
406
+ [/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
407
+ [/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v], ctx) => ({ [d]: handleInsetValue(v, ctx) })]
408
+ ];
409
+ const floats = [
410
+ ["float-left", { float: "left" }],
411
+ ["float-right", { float: "right" }],
412
+ ["float-none", { float: "none" }],
413
+ ...colors.makeGlobalStaticRules("float"),
414
+ ["clear-left", { clear: "left" }],
415
+ ["clear-right", { clear: "right" }],
416
+ ["clear-both", { clear: "both" }],
417
+ ["clear-none", { clear: "none" }],
418
+ ...colors.makeGlobalStaticRules("clear")
419
+ ];
420
+ const zIndexes = [
421
+ [/^z([\d.]+)$/, ([, v]) => ({ "z-index": colors.handler.number(v) })],
422
+ [/^z-(.+)$/, ([, v]) => ({ "z-index": colors.handler.bracket.cssvar.global.auto.number(v) }), { autocomplete: "z-<num>" }]
423
+ ];
424
+ const boxSizing = [
425
+ ["box-border", { "box-sizing": "border-box" }],
426
+ ["box-content", { "box-sizing": "content-box" }],
427
+ ...colors.makeGlobalStaticRules("box", "box-sizing")
428
+ ];
429
+
430
+ const cursorValues = ["auto", "default", "none", "context-menu", "help", "pointer", "progress", "wait", "cell", "crosshair", "text", "vertical-text", "alias", "copy", "move", "no-drop", "not-allowed", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out"];
431
+ const varEmpty = " ";
432
+ const displays = [
433
+ ["inline", { display: "inline" }],
434
+ ["block", { display: "block" }],
435
+ ["inline-block", { display: "inline-block" }],
436
+ ["contents", { display: "contents" }],
437
+ ["flow-root", { display: "flow-root" }],
438
+ ["list-item", { display: "list-item" }],
439
+ ["hidden", { display: "none" }],
440
+ [/^display-(.+)$/, ([, c]) => ({ display: colors.handler.bracket.cssvar.global(c) || c })]
441
+ ];
442
+ const appearances = [
443
+ ["visible", { visibility: "visible" }],
444
+ ["invisible", { visibility: "hidden" }],
445
+ ["backface-visible", { "backface-visibility": "visible" }],
446
+ ["backface-hidden", { "backface-visibility": "hidden" }],
447
+ ...colors.makeGlobalStaticRules("backface", "backface-visibility")
448
+ ];
449
+ const cursors = [
450
+ [/^cursor-(.+)$/, ([, c]) => ({ cursor: colors.handler.bracket.cssvar.global(c) })],
451
+ ...cursorValues.map((v) => [`cursor-${v}`, { cursor: v }])
452
+ ];
453
+ const pointerEvents = [
454
+ ["pointer-events-auto", { "pointer-events": "auto" }],
455
+ ["pointer-events-none", { "pointer-events": "none" }],
456
+ ...colors.makeGlobalStaticRules("pointer-events")
457
+ ];
458
+ const resizes = [
459
+ ["resize-x", { resize: "horizontal" }],
460
+ ["resize-y", { resize: "vertical" }],
461
+ ["resize", { resize: "both" }],
462
+ ["resize-none", { resize: "none" }],
463
+ ...colors.makeGlobalStaticRules("resize")
464
+ ];
465
+ const userSelects = [
466
+ ["select-auto", { "user-select": "auto" }],
467
+ ["select-all", { "user-select": "all" }],
468
+ ["select-text", { "user-select": "text" }],
469
+ ["select-none", { "user-select": "none" }],
470
+ ...colors.makeGlobalStaticRules("select", "user-select")
471
+ ];
472
+ const whitespaces = [
473
+ [
474
+ /^(?:whitespace-|ws-)([-\w]+)$/,
475
+ ([, v]) => ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces", ...colors.globalKeywords].includes(v) ? { "white-space": v } : void 0,
476
+ { autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)" }
477
+ ]
478
+ ];
479
+ const contents = [
480
+ [/^content-\[(.+)\]$/, ([, v]) => ({ content: `"${v}"` })],
481
+ [/^content-(\$.+)]$/, ([, v]) => ({ content: colors.handler.cssvar(v) })],
482
+ ["content-empty", { content: '""' }],
483
+ ["content-none", { content: '""' }]
484
+ ];
485
+ const breaks = [
486
+ ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
487
+ ["break-words", { "overflow-wrap": "break-word" }],
488
+ ["break-all", { "word-break": "break-all" }]
489
+ ];
490
+ const textOverflows = [
491
+ ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
492
+ ["text-ellipsis", { "text-overflow": "ellipsis" }],
493
+ ["text-clip", { "text-overflow": "clip" }]
494
+ ];
495
+ const textTransforms = [
496
+ ["case-upper", { "text-transform": "uppercase" }],
497
+ ["case-lower", { "text-transform": "lowercase" }],
498
+ ["case-capital", { "text-transform": "capitalize" }],
499
+ ["case-normal", { "text-transform": "none" }],
500
+ ...colors.makeGlobalStaticRules("case", "text-transform")
501
+ ];
502
+ const fontStyles = [
503
+ ["italic", { "font-style": "italic" }],
504
+ ["not-italic", { "font-style": "normal" }],
505
+ ["font-italic", { "font-style": "italic" }],
506
+ ["font-not-italic", { "font-style": "normal" }],
507
+ ["oblique", { "font-style": "oblique" }],
508
+ ["not-oblique", { "font-style": "normal" }],
509
+ ["font-oblique", { "font-style": "oblique" }],
510
+ ["font-not-oblique", { "font-style": "normal" }]
511
+ ];
512
+ const fontSmoothings = [
513
+ ["antialiased", {
514
+ "-webkit-font-smoothing": "antialiased",
515
+ "-moz-osx-font-smoothing": "grayscale",
516
+ "font-smoothing": "grayscale"
517
+ }],
518
+ ["subpixel-antialiased", {
519
+ "-webkit-font-smoothing": "auto",
520
+ "-moz-osx-font-smoothing": "auto",
521
+ "font-smoothing": "auto"
522
+ }]
523
+ ];
524
+
525
+ const ringBase = {
526
+ "--un-ring-inset": varEmpty,
527
+ "--un-ring-offset-width": "0px",
528
+ "--un-ring-offset-color": "#fff",
529
+ "--un-ring-width": "0px",
530
+ "--un-ring-color": "rgba(147,197,253,0.5)",
531
+ "--un-shadow": "0 0 rgba(0,0,0,0)"
532
+ };
533
+ const rings = [
534
+ [/^ring(?:-(.+))?$/, ([, d], { theme }) => {
535
+ const value = theme.ringWidth?.[d || "DEFAULT"] ?? colors.handler.px(d || "1");
536
+ if (value) {
537
+ return {
538
+ "--un-ring-width": value,
539
+ "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
540
+ "--un-ring-shadow": "var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color)",
541
+ "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
542
+ };
543
+ }
544
+ }, { autocomplete: "ring-$ringWidth" }],
545
+ [/^ring-(?:width-|size-)(.+)$/, ([, d], { theme }) => ({ "--un-ring-width": theme.lineWidth?.[d] ?? colors.handler.bracket.cssvar.px(d) }), { autocomplete: "ring-(width|size)-$lineWidth" }],
546
+ ["ring-offset", { "--un-ring-offset-width": "1px" }],
547
+ [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? colors.handler.bracket.cssvar.px(d) }), { autocomplete: "ring-offset-(width|size)-$lineWidth" }],
548
+ [/^ring-(.+)$/, colors.colorResolver("--un-ring-color", "ring"), { autocomplete: "ring-$colors" }],
549
+ [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": colors.handler.bracket.percent(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
550
+ [/^ring-offset-(.+)$/, colors.colorResolver("--un-ring-offset-color", "ring-offset"), { autocomplete: "ring-offset-$colors" }],
551
+ [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": colors.handler.bracket.percent(opacity) }), { autocomplete: "ring-offset-(op|opacity)-<percent>" }],
552
+ ["ring-inset", { "--un-ring-inset": "inset" }]
553
+ ];
554
+
555
+ const boxShadowsBase = {
556
+ "--un-ring-offset-shadow": "0 0 rgba(0,0,0,0)",
557
+ "--un-ring-shadow": "0 0 rgba(0,0,0,0)",
558
+ "--un-shadow-inset": varEmpty,
559
+ "--un-shadow": "0 0 rgba(0,0,0,0)"
560
+ };
561
+ const boxShadows = [
562
+ [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
563
+ const v = theme.boxShadow?.[d || "DEFAULT"];
564
+ if (v) {
565
+ return {
566
+ "--un-shadow": colors.colorableShadows(v, "--un-shadow-color").join(","),
567
+ "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
568
+ };
569
+ }
570
+ }, { autocomplete: "shadow-$boxShadow" }],
571
+ [/^shadow-(.+)$/, colors.colorResolver("--un-shadow-color", "shadow"), { autocomplete: "shadow-$colors" }],
572
+ [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": colors.handler.bracket.percent(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }],
573
+ ["shadow-inset", { "--un-shadow-inset": "inset" }]
574
+ ];
575
+
576
+ const transformValues = [
577
+ "translate",
578
+ "rotate",
579
+ "scale"
580
+ ];
581
+ const transformCpu = [
582
+ "translateX(var(--un-translate-x))",
583
+ "translateY(var(--un-translate-y))",
584
+ "translateZ(var(--un-translate-z))",
585
+ "rotate(var(--un-rotate))",
586
+ "rotateX(var(--un-rotate-x))",
587
+ "rotateY(var(--un-rotate-y))",
588
+ "rotateZ(var(--un-rotate-z))",
589
+ "skewX(var(--un-skew-x))",
590
+ "skewY(var(--un-skew-y))",
591
+ "scaleX(var(--un-scale-x))",
592
+ "scaleY(var(--un-scale-y))",
593
+ "scaleZ(var(--un-scale-z))"
594
+ ].join(" ");
595
+ const transformGpu = [
596
+ "translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
597
+ "rotate(var(--un-rotate))",
598
+ "rotateX(var(--un-rotate-x))",
599
+ "rotateY(var(--un-rotate-y))",
600
+ "rotateZ(var(--un-rotate-z))",
601
+ "skewX(var(--un-skew-x))",
602
+ "skewY(var(--un-skew-y))",
603
+ "scaleX(var(--un-scale-x))",
604
+ "scaleY(var(--un-scale-y))",
605
+ "scaleZ(var(--un-scale-z))"
606
+ ].join(" ");
607
+ const transformBase = {
608
+ "--un-rotate": 0,
609
+ "--un-rotate-x": 0,
610
+ "--un-rotate-y": 0,
611
+ "--un-rotate-z": 0,
612
+ "--un-scale-x": 1,
613
+ "--un-scale-y": 1,
614
+ "--un-scale-z": 1,
615
+ "--un-skew-x": 0,
616
+ "--un-skew-y": 0,
617
+ "--un-translate-x": 0,
618
+ "--un-translate-y": 0,
619
+ "--un-translate-z": 0
620
+ };
621
+ const transforms = [
622
+ [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": colors.positionMap[s] ?? colors.handler.bracket.cssvar(s) }), { autocomplete: [`transform-origin-(${Object.keys(colors.positionMap).join("|")})`, `origin-(${Object.keys(colors.positionMap).join("|")})`] }],
623
+ [/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
624
+ const v = colors.handler.bracket.cssvar.px.numberWithUnit(s);
625
+ if (v != null) {
626
+ return {
627
+ "-webkit-perspective": v,
628
+ "perspective": v
629
+ };
630
+ }
631
+ }],
632
+ [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
633
+ const v = colors.handler.bracket.cssvar(s) ?? (s.length >= 3 ? colors.positionMap[s] : void 0);
634
+ if (v != null) {
635
+ return {
636
+ "-webkit-perspective-origin": v,
637
+ "perspective-origin": v
638
+ };
639
+ }
640
+ }],
641
+ [/^(?:transform-)?translate-()(.+)$/, handleTranslate],
642
+ [/^(?:transform-)?translate-([xyz])-(.+)$/, handleTranslate],
643
+ [/^(?:transform-)?rotate-()(.+)$/, handleRotate],
644
+ [/^(?:transform-)?rotate-([xyz])-(.+)$/, handleRotate],
645
+ [/^(?:transform-)?skew-([xy])-(.+)$/, handleSkew, { autocomplete: ["transform-skew-(x|y)-<percent>"] }],
646
+ [/^(?:transform-)?scale-()(.+)$/, handleScale],
647
+ [/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale, { autocomplete: [`transform-(${transformValues.join("|")})-<percent>`, `transform-(${transformValues.join("|")})-(x|y|z)-<percent>`] }],
648
+ [/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
649
+ [/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
650
+ ["transform", { transform: transformCpu }],
651
+ ["transform-cpu", { transform: transformCpu }],
652
+ ["transform-gpu", { transform: transformGpu }],
653
+ ["transform-none", { transform: "none" }],
654
+ ...colors.makeGlobalStaticRules("transform")
655
+ ];
656
+ function handleTranslate([, d, b], { theme }) {
657
+ const v = theme.spacing?.[b] ?? colors.handler.bracket.cssvar.fraction.rem(b);
658
+ if (v != null) {
659
+ return [
660
+ ...colors.xyzMap[d].map((i) => [`--un-translate${i}`, v]),
661
+ ["transform", transformCpu]
662
+ ];
663
+ }
664
+ }
665
+ function handleScale([, d, b]) {
666
+ const v = colors.handler.bracket.cssvar.fraction.percent(b);
667
+ if (v != null) {
668
+ return [
669
+ ...colors.xyzMap[d].map((i) => [`--un-scale${i}`, v]),
670
+ ["transform", transformCpu]
671
+ ];
672
+ }
673
+ }
674
+ function handleRotate([, d = "", b]) {
675
+ const v = colors.handler.bracket.cssvar.degree(b);
676
+ if (v != null) {
677
+ if (d) {
678
+ return {
679
+ "--un-rotate": 0,
680
+ [`--un-rotate-${d}`]: v,
681
+ "transform": transformCpu
682
+ };
683
+ } else {
684
+ return {
685
+ "--un-rotate-x": 0,
686
+ "--un-rotate-y": 0,
687
+ "--un-rotate-z": 0,
688
+ "--un-rotate": v,
689
+ "transform": transformCpu
690
+ };
691
+ }
692
+ }
693
+ }
694
+ function handleSkew([, d, b]) {
695
+ const v = colors.handler.bracket.cssvar.degree(b);
696
+ if (v != null) {
697
+ return {
698
+ [`--un-skew-${d}`]: v,
699
+ transform: transformCpu
700
+ };
701
+ }
702
+ }
703
+
704
+ const decorationStyles = ["solid", "double", "dotted", "dashed", "wavy", ...colors.globalKeywords];
705
+ const textDecorations = [
706
+ [/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s }), { autocomplete: "decoration-(underline|overline|line-through)" }],
707
+ [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ?? colors.handler.bracket.cssvar.global.px(s) }), { autocomplete: "(underline|decoration)-<num>" }],
708
+ [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s }), { autocomplete: "(underline|decoration)-(auto|from-font)" }],
709
+ [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
710
+ const result = colors.colorResolver("text-decoration-color", "line")(match, ctx);
711
+ if (result) {
712
+ return {
713
+ "-webkit-text-decoration-color": result["text-decoration-color"],
714
+ ...result
715
+ };
716
+ }
717
+ }, { autocomplete: "(underline|decoration)-$colors" }],
718
+ [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": colors.handler.bracket.percent(opacity) }), { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }],
719
+ [/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? colors.handler.auto.bracket.cssvar.global.px(s) }), { autocomplete: "(underline|decoration)-(offset)-<num>" }],
720
+ ...decorationStyles.map((v) => [`underline-${v}`, { "text-decoration-style": v }]),
721
+ ...decorationStyles.map((v) => [`decoration-${v}`, { "text-decoration-style": v }]),
722
+ ["no-underline", { "text-decoration": "none" }],
723
+ ["decoration-none", { "text-decoration": "none" }]
724
+ ];
725
+
726
+ exports.alignments = alignments;
727
+ exports.appearance = appearance;
728
+ exports.appearances = appearances;
729
+ exports.borderStyles = borderStyles;
730
+ exports.borders = borders;
731
+ exports.boxShadows = boxShadows;
732
+ exports.boxShadowsBase = boxShadowsBase;
733
+ exports.boxSizing = boxSizing;
734
+ exports.breaks = breaks;
735
+ exports.contents = contents;
736
+ exports.cursors = cursors;
737
+ exports.displays = displays;
738
+ exports.floats = floats;
739
+ exports.fontSmoothings = fontSmoothings;
740
+ exports.fontStyles = fontStyles;
741
+ exports.fonts = fonts;
742
+ exports.handlerBorderStyle = handlerBorderStyle;
743
+ exports.insets = insets;
744
+ exports.justifies = justifies;
745
+ exports.orders = orders;
746
+ exports.outline = outline;
747
+ exports.overflows = overflows;
748
+ exports.placements = placements;
749
+ exports.pointerEvents = pointerEvents;
750
+ exports.positions = positions;
751
+ exports.resizes = resizes;
752
+ exports.ringBase = ringBase;
753
+ exports.rings = rings;
754
+ exports.tabSizes = tabSizes;
755
+ exports.textAligns = textAligns;
756
+ exports.textDecorations = textDecorations;
757
+ exports.textIndents = textIndents;
758
+ exports.textOverflows = textOverflows;
759
+ exports.textShadows = textShadows;
760
+ exports.textStrokes = textStrokes;
761
+ exports.textTransforms = textTransforms;
762
+ exports.transformBase = transformBase;
763
+ exports.transforms = transforms;
764
+ exports.transitions = transitions;
765
+ exports.userSelects = userSelects;
766
+ exports.varEmpty = varEmpty;
767
+ exports.verticalAligns = verticalAligns;
768
+ exports.whitespaces = whitespaces;
769
+ exports.willChange = willChange;
770
+ exports.zIndexes = zIndexes;