@unocss/preset-mini 0.20.2 → 0.21.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.
@@ -1,4 +1,4 @@
1
- import { h as handler, c as colorResolver, d as directionMap, p as parseColor, a as cornerMap, b as capitalize, e as directionSize, x as xyzMap } from './utilities.mjs';
1
+ import { h as handler, c as colorResolver, d as directionMap, p as parseColor, a as cornerMap, b as capitalize, e as directionSize, f as positionMap, x as xyzMap } from './utilities.mjs';
2
2
  import { toArray } from '@unocss/core';
3
3
  import { C as CONTROL_BYPASS_PSEUDO_CLASS } from './pseudo.mjs';
4
4
 
@@ -8,7 +8,7 @@ const verticalAlignAlias = {
8
8
  btm: "bottom"
9
9
  };
10
10
  const verticalAligns = [
11
- [/^(?:vertical|align|v)-(baseline|top|bottom|middle|text-top|text-bottom|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v })]
11
+ [/^(?:vertical|align|v)-(baseline|top|middle|bottom|text-top|text-bottom|sub|super|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v })]
12
12
  ];
13
13
  const textAligns = [
14
14
  ["text-center", { "text-align": "center" }],
@@ -22,7 +22,7 @@ const outline = [
22
22
  [/^outline-(?:color-)?(.+)$/, colorResolver("outline-color", "outline-color")],
23
23
  [/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": handler.bracket.fraction.auto.rem(d) })],
24
24
  ["outline", { "outline-style": "solid" }],
25
- [/^outline-(auto|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
25
+ [/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
26
26
  ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
27
27
  ];
28
28
  const appearance = [
@@ -32,31 +32,31 @@ const appearance = [
32
32
  }]
33
33
  ];
34
34
  const willChange = [
35
- [/^will-change-(.+)/, ([, p]) => ({ "will-change": handler.properties.global(p) })]
35
+ [/^will-change-(.+)/, ([, p]) => ({ "will-change": handler.properties.auto.global(p) })]
36
36
  ];
37
37
 
38
38
  const borders = [
39
- [/^border$/, handlerBorder],
40
- [/^(?:border|b)()-(.+)$/, handlerBorder],
41
- [/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorder],
42
- [/^(?:border|b)()-size-(.+)$/, handlerBorderSize],
43
- [/^(?:border|b)-([^-]+)-size-(.+)$/, handlerBorderSize],
44
- [/^(?:border|b)()-(.+)$/, handlerBorderColor],
45
- [/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
46
- [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": handler.bracket.percent(opacity) })],
47
- [/^(?:border|b)-([^-]+)-op(?:acity)?-?(.+)$/, ([, a, opacity]) => {
48
- const v = handler.bracket.percent(opacity);
49
- const d = directionMap[a];
50
- if (v !== void 0 && d)
51
- return d.map((i) => [`--un-border${i}-opacity`, v]);
52
- }],
53
- [/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
54
- [/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
55
- [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded],
39
+ [/^(?:border|b)()(?:-(.+))?$/, handlerBorder],
40
+ [/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
41
+ [/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
42
+ [/^(?:border|b)-()size-(.+)$/, handlerBorderSize],
43
+ [/^(?:border|b)-([xy])-size-(.+)$/, handlerBorderSize],
44
+ [/^(?:border|b)-([rltbse])-size-(.+)$/, handlerBorderSize],
45
+ [/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor],
46
+ [/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
47
+ [/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
48
+ [/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity],
49
+ [/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
50
+ [/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
51
+ [/^(?:border-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded],
52
+ [/^(?:border-)?(?:rounded|rd)-([xy])(?:-(.+))?$/, handlerRounded],
53
+ [/^(?:border-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
54
+ [/^(?:border-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
56
55
  ["border-solid", { "border-style": "solid" }],
57
56
  ["border-dashed", { "border-style": "dashed" }],
58
57
  ["border-dotted", { "border-style": "dotted" }],
59
58
  ["border-double", { "border-style": "double" }],
59
+ ["border-hidden", { "border-style": "hidden" }],
60
60
  ["border-none", { "border-style": "none" }]
61
61
  ];
62
62
  const borderHasColor = (color, { theme }) => {
@@ -103,22 +103,25 @@ function handlerBorder(m) {
103
103
  ];
104
104
  }
105
105
  }
106
- function handlerBorderSize([, a, b]) {
107
- const [d, s = "1"] = directionMap[a] ? [a, b] : ["", a];
108
- const v = handler.bracket.px(s);
109
- if (v !== void 0)
110
- return directionMap[d].map((i) => [`border${i}-width`, v]);
106
+ function handlerBorderSize([, a = "", b = "1"]) {
107
+ const v = handler.bracket.px(b);
108
+ if (a in directionMap && v != null)
109
+ return directionMap[a].map((i) => [`border${i}-width`, v]);
111
110
  }
112
- function handlerBorderColor([, a, c], ctx) {
113
- if (borderHasColor(c, ctx)) {
114
- return Object.assign({}, ...directionMap[directionMap[a] ? a : ""].map((i) => borderColorResolver(i)(["", c], ctx)));
111
+ function handlerBorderColor([, a = "", c], ctx) {
112
+ if (a in directionMap && borderHasColor(c, ctx)) {
113
+ return Object.assign({}, ...directionMap[a].map((i) => borderColorResolver(i)(["", c], ctx)));
115
114
  }
116
115
  }
117
- function handlerRounded([, a, b], { theme }) {
118
- const [d, s = "DEFAULT"] = cornerMap[a] ? [a, b] : ["", a];
116
+ function handlerBorderOpacity([, a = "", opacity]) {
117
+ const v = handler.bracket.percent(opacity);
118
+ if (a in directionMap && v != null)
119
+ return directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
120
+ }
121
+ function handlerRounded([, a = "", s = "DEFAULT"], { theme }) {
119
122
  const v = theme.borderRadius?.[s] || handler.auto.rem.fraction.bracket.cssvar(s);
120
- if (v !== void 0)
121
- return cornerMap[d].map((i) => [`border${i}-radius`, v]);
123
+ if (a in cornerMap && v != null)
124
+ return cornerMap[a].map((i) => [`border${i}-radius`, v]);
122
125
  }
123
126
 
124
127
  const opacity = [
@@ -133,12 +136,19 @@ const bgColors = [
133
136
  [/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": handler.bracket.percent(opacity2) })]
134
137
  ];
135
138
 
139
+ const transitionPropertyGroup = {
140
+ all: "all",
141
+ colors: ["color", "background-color", "border-color", "text-decoration-color", "fill", "stroke"].join(","),
142
+ opacity: "opacity",
143
+ shadow: "box-shadow",
144
+ transform: "transform"
145
+ };
136
146
  const transitionProperty = (prop) => {
137
- return handler.properties(prop) || (prop === "all" ? prop : void 0);
147
+ return handler.properties(prop) ?? transitionPropertyGroup[prop];
138
148
  };
139
149
  const transitions = [
140
- [/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop = "all", duration = "150"]) => {
141
- const p = transitionProperty(prop);
150
+ [/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
151
+ const p = prop != null ? transitionProperty(prop) : [transitionPropertyGroup.colors, "opacity", "box-shadow", "transform", "filter", "backdrop-filter"].join(",");
142
152
  if (p) {
143
153
  return {
144
154
  "transition-property": p,
@@ -147,14 +157,14 @@ const transitions = [
147
157
  };
148
158
  }
149
159
  }],
150
- [/^duration-(\d+)$/, ([, duration = "150"]) => ({ "transition-duration": `${duration}ms` })],
160
+ [/^(?:transition-)?delay-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-delay": handler.bracket.time(d) })],
161
+ [/^(?:transition-)?duration-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-duration": handler.bracket.time(d) })],
162
+ [/^ease-(.+)$/, ([, d]) => ({ "transition-timing-function": handler.bracket(d) })],
151
163
  ["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
152
164
  ["ease-linear", { "transition-timing-function": "linear" }],
153
165
  ["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
154
166
  ["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
155
167
  ["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
156
- [/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
157
- [/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
158
168
  [/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": handler.global(v) || transitionProperty(v) })],
159
169
  ["transition-property-none", { "transition-property": "none" }],
160
170
  ["property-none", { "transition-property": "none" }],
@@ -170,10 +180,11 @@ const flex = [
170
180
  ["flex-initial", { flex: "0 1 auto" }],
171
181
  ["flex-none", { flex: "none" }],
172
182
  [/^flex-(\[.+\])$/, ([, d]) => ({ flex: handler.bracket(d).replace(/\d+\/\d+/, ($1) => handler.fraction($1)) })],
173
- ["flex-shrink", { "flex-shrink": 1 }],
174
- ["flex-shrink-0", { "flex-shrink": 0 }],
175
- ["flex-grow", { "flex-grow": 1 }],
176
- ["flex-grow-0", { "flex-grow": 0 }],
183
+ [/^(?:flex-)?shrink$/, () => ({ "flex-shrink": 1 })],
184
+ [/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
185
+ [/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
186
+ [/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
187
+ [/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": handler.bracket.fraction.auto.rem(d) })],
177
188
  ["flex-row", { "flex-direction": "row" }],
178
189
  ["flex-row-reverse", { "flex-direction": "row-reverse" }],
179
190
  ["flex-col", { "flex-direction": "column" }],
@@ -216,7 +227,7 @@ const fonts = [
216
227
  [/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || handler.bracket.auto.rem(s) })]
217
228
  ];
218
229
  const tabSizes = [
219
- [/^tab-?([^-]*)$/, ([, s]) => {
230
+ [/^tab(?:-([^-]+))?$/, ([, s]) => {
220
231
  const v = handler.bracket.global.number(s || "4");
221
232
  if (v != null) {
222
233
  return {
@@ -241,68 +252,64 @@ const textShadows = [
241
252
 
242
253
  const directions = {
243
254
  "": "",
244
- "x-": "column-",
245
- "y-": "row-"
255
+ "x": "column-",
256
+ "y": "row-"
257
+ };
258
+ const handleGap = ([, d = "", s]) => {
259
+ const v = handler.bracket.auto.rem(s);
260
+ if (v != null) {
261
+ return {
262
+ [`grid-${directions[d]}gap`]: v,
263
+ [`${directions[d]}gap`]: v
264
+ };
265
+ }
246
266
  };
247
267
  const gaps = [
248
- [/^(?:flex-|grid-)?gap-(x-|y-)?([^-]+)$/, ([, d = "", s]) => {
249
- const v = handler.bracket.auto.rem(s);
250
- if (v != null) {
251
- return {
252
- [`grid-${directions[d]}gap`]: v,
253
- [`${directions[d]}gap`]: v
254
- };
255
- }
256
- }]
268
+ [/^(?:flex-|grid-)?gap-()([^-]+)$/, handleGap],
269
+ [/^(?:flex-|grid-)?gap-([xy])-([^-]+)$/, handleGap]
257
270
  ];
258
271
 
259
- const calSize = (s, theme) => toArray(theme.fontSize?.[s] || handler.bracket.auto.rem(s))[0];
272
+ const rowCol = (s) => s.replace("col", "column");
260
273
  const autoDirection = (selector, theme) => {
261
- if (selector === "min")
262
- return "min-content";
263
- else if (selector === "max")
264
- return "max-content";
265
- else if (selector === "fr")
266
- return "minmax(0,1fr)";
267
- return calSize(selector, theme);
274
+ const v = theme.fontSize?.[selector];
275
+ if (v != null)
276
+ return toArray(v)[0];
277
+ switch (selector) {
278
+ case "min":
279
+ return "min-content";
280
+ case "max":
281
+ return "max-content";
282
+ case "fr":
283
+ return "minmax(0,1fr)";
284
+ }
285
+ return handler.bracket.auto.rem(selector);
268
286
  };
269
287
  const grids = [
270
288
  ["grid", { display: "grid" }],
271
289
  ["inline-grid", { display: "inline-grid" }],
272
- [/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": v })],
273
- [/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": v })],
274
- [/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": v })],
275
- [/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": v })],
276
- [/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
277
- const key = d === "row" ? "grid-row" : "grid-column";
278
- let raw = handler.bracket(v);
279
- if (raw)
280
- return { [key]: raw };
281
- const parts = v.split("-");
282
- if (parts.length === 1 && parts[0] === "auto")
283
- return { [key]: parts[0] };
284
- if (parts[0] === "span") {
285
- if (parts[1] === "full")
286
- return { [key]: "1/-1" };
287
- raw = handler.number.bracket(parts[1]);
288
- if (raw)
289
- return { [key]: `span ${raw}/span ${raw}` };
290
- }
290
+ [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: handler.bracket.auto(v) })],
291
+ [/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
292
+ if (s === "full")
293
+ return { [`grid-${rowCol(c)}`]: "1/-1" };
294
+ const v = handler.bracket.number(s);
295
+ if (v != null)
296
+ return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
291
297
  }],
292
- [/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": autoDirection(v, theme) })],
293
- [/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": v.replace("col", "column").split("-").join(" ") })],
294
- [/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": autoDirection(v, theme) })],
295
- [/^grid-cols-(.+)$/, ([, v]) => ({ "grid-template-columns": handler.bracket(v) })],
296
- [/^grid-rows-(.+)$/, ([, v]) => ({ "grid-template-rows": handler.bracket(v) })],
297
- [/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,minmax(${d},1fr))` })],
298
- [/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,minmax(${d},1fr))` })],
299
- [/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
300
- [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })]
298
+ [/^(?:grid-)?(row|col)-start-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: v })],
299
+ [/^(?:grid-)?(row|col)-end-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: v })],
300
+ [/^(?:grid-)?auto-(rows|cols)-([\w.-]+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) })],
301
+ [/^(?:grid-auto-flow|auto-flow|grid-flow)-((?:row|col)(?:-dense)?)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
302
+ [/^grid-(rows|cols)-(\[.+\])$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: handler.bracket(v) })],
303
+ [/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
304
+ [/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
305
+ ["grid-rows-none", { "grid-template-rows": "none" }],
306
+ ["grid-cols-none", { "grid-template-columns": "none" }]
301
307
  ];
302
308
 
303
309
  const overflowValues = [
304
310
  "auto",
305
311
  "hidden",
312
+ "clip",
306
313
  "visible",
307
314
  "scroll"
308
315
  ];
@@ -311,7 +318,6 @@ const overflows = [
311
318
  [/^(?:overflow|of)-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]
312
319
  ];
313
320
 
314
- const basicSet = ["auto", "start", "end", "center", "stretch"];
315
321
  const positions = [
316
322
  [/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v })],
317
323
  [/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
@@ -323,8 +329,15 @@ const justifies = [
323
329
  ["justify-between", { "justify-content": "space-between" }],
324
330
  ["justify-around", { "justify-content": "space-around" }],
325
331
  ["justify-evenly", { "justify-content": "space-evenly" }],
326
- ...basicSet.map((i) => [`justify-items-${i}`, { "justify-items": i }]),
327
- ...basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }])
332
+ ["justify-items-start", { "justify-items": "start" }],
333
+ ["justify-items-end", { "justify-items": "end" }],
334
+ ["justify-items-center", { "justify-items": "center" }],
335
+ ["justify-items-stretch", { "justify-items": "stretch" }],
336
+ ["justify-self-auto", { "justify-self": "auto" }],
337
+ ["justify-self-start", { "justify-self": "start" }],
338
+ ["justify-self-end", { "justify-self": "end" }],
339
+ ["justify-self-center", { "justify-self": "center" }],
340
+ ["justify-self-stretch", { "justify-self": "stretch" }]
328
341
  ];
329
342
  const orders = [
330
343
  [/^order-(.+)$/, ([, v]) => ({ order: handler.bracket.number(v) })],
@@ -333,9 +346,9 @@ const orders = [
333
346
  ["order-none", { order: "0" }]
334
347
  ];
335
348
  const alignments = [
349
+ ["content-center", { "align-content": "center" }],
336
350
  ["content-start", { "align-content": "flex-start" }],
337
351
  ["content-end", { "align-content": "flex-end" }],
338
- ["content-center", { "align-content": "center" }],
339
352
  ["content-between", { "align-content": "space-between" }],
340
353
  ["content-around", { "align-content": "space-around" }],
341
354
  ["content-evenly", { "align-content": "space-evenly" }],
@@ -348,29 +361,39 @@ const alignments = [
348
361
  ["self-start", { "align-self": "flex-start" }],
349
362
  ["self-end", { "align-self": "flex-end" }],
350
363
  ["self-center", { "align-self": "center" }],
351
- ["self-stretch", { "align-self": "stretch" }]
364
+ ["self-stretch", { "align-self": "stretch" }],
365
+ ["self-baseline", { "align-self": "baseline" }]
352
366
  ];
353
367
  const placements = [
368
+ ["place-content-center", { "place-content": "center" }],
354
369
  ["place-content-start", { "place-content": "start" }],
355
370
  ["place-content-end", { "place-content": "end" }],
356
- ["place-content-center", { "place-content": "center" }],
357
371
  ["place-content-between", { "place-content": "space-between" }],
358
372
  ["place-content-around", { "place-content": "space-around" }],
359
373
  ["place-content-evenly", { "place-content": "space-evenly" }],
360
374
  ["place-content-stretch", { "place-content": "stretch" }],
361
- ...basicSet.map((i) => [`place-items-${i}`, { "place-items": i }]),
362
- ...basicSet.map((i) => [`place-self-${i}`, { "place-self": i }])
375
+ ["place-items-start", { "place-items": "start" }],
376
+ ["place-items-end", { "place-items": "end" }],
377
+ ["place-items-center", { "place-items": "center" }],
378
+ ["place-items-stretch", { "place-items": "stretch" }],
379
+ ["place-self-auto", { "place-self": "auto" }],
380
+ ["place-self-start", { "place-self": "start" }],
381
+ ["place-self-end", { "place-self": "end" }],
382
+ ["place-self-center", { "place-self": "center" }],
383
+ ["place-self-stretch", { "place-self": "stretch" }]
363
384
  ];
364
385
  function handleInsetValue(v) {
365
386
  return { auto: "auto", full: "100%" }[v] ?? handler.bracket.fraction.cssvar.auto.rem(v);
366
387
  }
388
+ function handleInsetValues([, d, v]) {
389
+ const r = handleInsetValue(v);
390
+ if (r != null && d in directionMap)
391
+ return directionMap[d].map((i) => [i.slice(1), r]);
392
+ }
367
393
  const insets = [
368
- [/^(?:position-|pos-)?(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
369
- [/^(?:position-|pos-)?inset-([xy])-(.+)$/, ([, d, v]) => {
370
- const r = handleInsetValue(v);
371
- if (r != null && d in directionMap)
372
- return directionMap[d].map((i) => [i.slice(1), r]);
373
- }]
394
+ [/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
395
+ [/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
396
+ [/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
374
397
  ];
375
398
  const floats = [
376
399
  ["float-left", { float: "left" }],
@@ -433,7 +456,7 @@ const contents = [
433
456
  ];
434
457
  const breaks = [
435
458
  ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
436
- ["break-word", { "overflow-wrap": "break-word" }],
459
+ ["break-words", { "overflow-wrap": "break-word" }],
437
460
  ["break-all", { "word-break": "break-all" }]
438
461
  ];
439
462
  const textOverflows = [
@@ -465,14 +488,14 @@ const fontSmoothings = [
465
488
  ];
466
489
 
467
490
  const rings = [
468
- [/^ring-?(.*)$/, ([, d]) => {
491
+ [/^ring(?:-(.+))?$/, ([, d]) => {
469
492
  const value = handler.px(d || "1");
470
493
  if (value) {
471
494
  return {
472
495
  "--un-ring-inset": varEmpty,
473
496
  "--un-ring-offset-width": "0px",
474
497
  "--un-ring-offset-color": "#fff",
475
- "--un-ring-color": "rgba(59, 130, 246, .5)",
498
+ "--un-ring-color": "rgba(147, 197, 253, .5)",
476
499
  "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
477
500
  "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
478
501
  "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
@@ -506,7 +529,7 @@ const shadowColorResolver = (body, theme) => {
506
529
  }
507
530
  };
508
531
  const boxShadows = [
509
- [/^shadow-?(.*)$/, ([, d], { theme }) => {
532
+ [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
510
533
  const value = theme.boxShadow?.[d || "DEFAULT"];
511
534
  if (value) {
512
535
  return {
@@ -524,27 +547,38 @@ const boxShadows = [
524
547
  function getPropName(minmax, hw) {
525
548
  return `${minmax ? `${minmax}-` : ""}${hw === "h" ? "height" : "width"}`;
526
549
  }
527
- function getThemeValue(minmax, hw, theme, prop) {
550
+ function getSizeValue(minmax, hw, theme, prop) {
528
551
  let str = `${hw === "h" ? "height" : "width"}`;
529
552
  if (minmax)
530
553
  str = `${minmax}${capitalize(str)}`;
531
- return theme[str]?.[prop];
554
+ const v = theme[str]?.[prop];
555
+ if (v != null)
556
+ return v;
557
+ switch (prop) {
558
+ case "fit":
559
+ case "max":
560
+ case "min":
561
+ return `${prop}-content`;
562
+ }
563
+ return handler.bracket.cssvar.fraction.auto.rem(prop);
532
564
  }
533
565
  const sizes = [
534
- [/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
535
- const v = getThemeValue(m, w, theme, s) || handler.bracket.cssvar.fraction.auto.rem(s);
536
- if (v != null)
537
- return { [getPropName(m, w)]: v };
538
- }],
539
- [/^(?:(min|max)-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => {
540
- const v = theme.breakpoints?.[s];
541
- if (v != null)
542
- return { [getPropName(m, w)]: v };
543
- }]
544
- ];
566
+ [/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
567
+ [/^(?:(min|max)-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
568
+ ];
569
+ function getAspectRatio(prop) {
570
+ if (/^\d+\/\d+$/.test(prop))
571
+ return prop;
572
+ switch (prop) {
573
+ case "square":
574
+ return "1/1";
575
+ case "video":
576
+ return "16/9";
577
+ }
578
+ return handler.bracket.cssvar.auto.number(prop);
579
+ }
545
580
  const aspectRatio = [
546
- ["aspect-ratio-auto", { "aspect-ratio": "auto" }],
547
- [/^aspect-ratio-(.+)$/, ([, d]) => ({ "aspect-ratio": (/^\d+\/\d+$/.test(d) ? d : null) || handler.bracket.cssvar.number(d) })]
581
+ [/^aspect-(?:ratio-)?(.+)$/, ([, d]) => ({ "aspect-ratio": getAspectRatio(d) })]
548
582
  ];
549
583
 
550
584
  const paddings = [
@@ -580,27 +614,19 @@ const transformBase = {
580
614
  };
581
615
  const transforms = [
582
616
  ["transform", transformBase],
583
- [/^preserve-(3d|flat)$/, ([, value]) => ({ "transform-style": value === "3d" ? `preserve-${value}` : value })],
584
- [/^translate()-(.+)$/, handleTranslate],
617
+ [/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": positionMap[s] })],
618
+ [/^translate-()(.+)$/, handleTranslate],
585
619
  [/^translate-([xyz])-(.+)$/, handleTranslate],
586
- [/^scale()-(.+)$/, handleScale],
587
- [/^scale-([xyz])-(.+)$/, handleScale],
588
620
  [/^rotate-(.+)$/, handleRotate],
589
- [/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
621
+ [/^skew-()(.+)$/, handleSkew],
590
622
  [/^skew-([xy])-(.+)$/, handleSkew],
591
- [/^skew-([xy])-((?!\[)[^-]+?)(?:deg)?$/, handleSkewWithUnit],
623
+ [/^scale-()(.+)$/, handleScale],
624
+ [/^scale-([xyz])-(.+)$/, handleScale],
625
+ ["preserve-3d", { "transform-style": "preserve-3d" }],
626
+ ["preserve-flat", { "transform-style": "flat" }],
592
627
  ["transform-gpu", transformGpu],
593
628
  ["transform-cpu", transformCpu],
594
- ["transform-none", { transform: "none" }],
595
- ["origin-center", { "transform-origin": "center" }],
596
- ["origin-top", { "transform-origin": "top" }],
597
- ["origin-top-right", { "transform-origin": "top right" }],
598
- ["origin-right", { "transform-origin": "right" }],
599
- ["origin-bottom-right", { "transform-origin": "bottom right" }],
600
- ["origin-bottom", { "transform-origin": "bottom" }],
601
- ["origin-bottom-left", { "transform-origin": "bottom left" }],
602
- ["origin-left", { "transform-origin": "left" }],
603
- ["origin-top-left", { "transform-origin": "top left" }]
629
+ ["transform-none", { transform: "none" }]
604
630
  ];
605
631
  function handleTranslate([, d, b]) {
606
632
  const v = handler.bracket.fraction.auto.rem(b);
@@ -620,17 +646,8 @@ function handleScale([, d, b]) {
620
646
  ];
621
647
  }
622
648
  }
623
- function handleRotateWithUnit([, b]) {
624
- const v = handler.bracket.number(b);
625
- if (v != null) {
626
- return [
627
- transformBase,
628
- { "--un-rotate": `${v}deg` }
629
- ];
630
- }
631
- }
632
649
  function handleRotate([, b]) {
633
- const v = handler.bracket(b);
650
+ const v = handler.bracket.degree(b);
634
651
  if (v != null) {
635
652
  return [
636
653
  transformBase,
@@ -638,17 +655,8 @@ function handleRotate([, b]) {
638
655
  ];
639
656
  }
640
657
  }
641
- function handleSkewWithUnit([, d, b]) {
642
- const v = handler.bracket.number(b);
643
- if (v != null) {
644
- return [
645
- transformBase,
646
- { [`--un-skew-${d}`]: `${v}deg` }
647
- ];
648
- }
649
- }
650
658
  function handleSkew([, d, b]) {
651
- const v = handler.bracket(b);
659
+ const v = handler.bracket.degree(b);
652
660
  if (v != null) {
653
661
  return [
654
662
  transformBase,
@@ -701,10 +709,11 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
701
709
  ];
702
710
 
703
711
  const textDecorations = [
704
- ["underline", { "text-decoration": "underline" }],
705
- ["line-through", { "text-decoration": "line-through" }],
706
- ["decoration-underline", { "text-decoration": "underline" }],
707
- ["decoration-line-through", { "text-decoration": "line-through" }],
712
+ ["underline", { "text-decoration-line": "underline" }],
713
+ ["overline", { "text-decoration-line": "overline" }],
714
+ ["line-through", { "text-decoration-line": "line-through" }],
715
+ ["decoration-underline", { "text-decoration-line": "underline" }],
716
+ ["decoration-line-through", { "text-decoration-line": "line-through" }],
708
717
  [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.px(s) })],
709
718
  [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
710
719
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
@@ -46,24 +46,18 @@ const variantCombinators = [
46
46
  variants$1.variantMatcher("svg", (input) => `${input} svg *`)
47
47
  ];
48
48
 
49
- const variantColorsMediaOrClass = [
50
- (v, { options: { dark } }) => {
51
- if (dark === "class")
52
- return variants$1.variantMatcher("dark", (input) => `.dark $$ ${input}`)(v);
53
- },
54
- (v, { options: { dark } }) => {
55
- if (dark === "class")
56
- return variants$1.variantMatcher("light", (input) => `.light $$ ${input}`)(v);
57
- },
58
- (v, { options: { dark } }) => {
59
- if (dark === "media")
60
- return variants$1.variantParentMatcher("dark", "@media (prefers-color-scheme: dark)")(v);
61
- },
62
- (v, { options: { dark } }) => {
63
- if (dark === "media")
64
- return variants$1.variantParentMatcher("light", "@media (prefers-color-scheme: light)")(v);
49
+ const variantColorsMediaOrClass = (options = {}) => {
50
+ if (options?.dark === "class") {
51
+ return [
52
+ variants$1.variantMatcher("dark", (input) => `.dark $$ ${input}`),
53
+ variants$1.variantMatcher("light", (input) => `.light $$ ${input}`)
54
+ ];
65
55
  }
66
- ];
56
+ return [
57
+ variants$1.variantParentMatcher("dark", "@media (prefers-color-scheme: dark)"),
58
+ variants$1.variantParentMatcher("light", "@media (prefers-color-scheme: light)")
59
+ ];
60
+ };
67
61
 
68
62
  const variantLanguageDirections = [
69
63
  variants$1.variantMatcher("rtl", (input) => `[dir="rtl"] $$ ${input}`),
@@ -103,16 +97,6 @@ const variantNegative = {
103
97
  }
104
98
  }
105
99
  };
106
- const variantSpace = (matcher) => {
107
- if (/^space-?([xy])-?(-?.+)$/.test(matcher) || /^divide-/.test(matcher)) {
108
- return {
109
- matcher,
110
- selector: (input) => {
111
- return `${input}>:not([hidden])~:not([hidden])`;
112
- }
113
- };
114
- }
115
- };
116
100
 
117
101
  const variantMotions = [
118
102
  variants$1.variantParentMatcher("motion-reduce", "@media (prefers-reduced-motion: reduce)"),
@@ -126,8 +110,7 @@ const variantOrientations = [
126
110
 
127
111
  const variantPrint = variants$1.variantParentMatcher("print", "@media print");
128
112
 
129
- const variants = [
130
- variantSpace,
113
+ const variants = (options) => [
131
114
  variantNegative,
132
115
  variantImportant,
133
116
  variantPrint,
@@ -137,10 +120,10 @@ const variants = [
137
120
  ...variantCombinators,
138
121
  pseudo.variantPseudoClasses,
139
122
  pseudo.variantPseudoClassFunctions,
140
- pseudo.variantTaggedPseudoClasses,
123
+ ...pseudo.variantTaggedPseudoClasses(options),
141
124
  pseudo.variantPseudoElements,
142
125
  pseudo.partClasses,
143
- ...variantColorsMediaOrClass,
126
+ ...variantColorsMediaOrClass(options),
144
127
  ...variantLanguageDirections
145
128
  ];
146
129
 
@@ -153,5 +136,4 @@ exports.variantMotions = variantMotions;
153
136
  exports.variantNegative = variantNegative;
154
137
  exports.variantOrientations = variantOrientations;
155
138
  exports.variantPrint = variantPrint;
156
- exports.variantSpace = variantSpace;
157
139
  exports.variants = variants;