@unocss/preset-mini 0.22.1 → 0.22.5

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,5 +1,5 @@
1
1
  import { h as handler, c as colorResolver, d as directionMap, p as parseColor, a as cornerMap, i as insetMap, b as directionSize, e as positionMap, x as xyzMap } from './utilities.mjs';
2
- import { toArray, CONTROL_SHORTCUT_NO_MERGE } from '@unocss/core';
2
+ import { CONTROL_SHORTCUT_NO_MERGE, toArray } from '@unocss/core';
3
3
 
4
4
  const verticalAlignAlias = {
5
5
  mid: "middle",
@@ -17,9 +17,9 @@ const textAligns = [
17
17
  ];
18
18
 
19
19
  const outline = [
20
- [/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": handler.bracket.fraction.auto.rem(d) })],
20
+ [/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": handler.bracket.cssvar.fraction.rem(d) })],
21
21
  [/^outline-(?:color-)?(.+)$/, colorResolver("outline-color", "outline-color")],
22
- [/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": handler.bracket.fraction.auto.rem(d) })],
22
+ [/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": handler.bracket.cssvar.fraction.rem(d) })],
23
23
  ["outline", { "outline-style": "solid" }],
24
24
  [/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
25
25
  ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
@@ -118,7 +118,7 @@ function handlerBorder(m) {
118
118
  }
119
119
  }
120
120
  function handlerBorderSize([, a = "", b = "1"]) {
121
- const v = handler.bracket.px(b);
121
+ const v = handler.bracket.cssvar.px(b);
122
122
  if (a in directionMap && v != null)
123
123
  return directionMap[a].map((i) => [`border${i}-width`, v]);
124
124
  }
@@ -133,7 +133,7 @@ function handlerBorderOpacity([, a = "", opacity]) {
133
133
  return directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
134
134
  }
135
135
  function handlerRounded([, a = "", s = "DEFAULT"], { theme }) {
136
- const v = theme.borderRadius?.[s] || handler.auto.rem.fraction.bracket.cssvar(s);
136
+ const v = theme.borderRadius?.[s] || handler.bracket.cssvar.fraction.rem(s);
137
137
  if (a in cornerMap && v != null)
138
138
  return cornerMap[a].map((i) => [`border${i}-radius`, v]);
139
139
  }
@@ -143,7 +143,7 @@ const opacity = [
143
143
  ];
144
144
  const textColors = [
145
145
  [/^(?:text|color|c)-(.+)$/, colorResolver("color", "text")],
146
- [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent.cssvar(opacity2) })]
146
+ [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent(opacity2) })]
147
147
  ];
148
148
  const bgColors = [
149
149
  [/^bg-(.+)$/, colorResolver("background-color", "bg")],
@@ -171,9 +171,9 @@ const transitions = [
171
171
  };
172
172
  }
173
173
  }],
174
- [/^(?:transition-)?delay-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-delay": handler.bracket.time(d) })],
175
- [/^(?:transition-)?duration-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-duration": handler.bracket.time(d) })],
176
- [/^ease-(.+)$/, ([, d]) => ({ "transition-timing-function": handler.bracket(d) })],
174
+ [/^(?:transition-)?duration-(.+)$/, ([, d]) => ({ "transition-duration": handler.bracket.cssvar.time(d) })],
175
+ [/^(?:transition-)?delay-(.+)$/, ([, d]) => ({ "transition-delay": handler.bracket.cssvar.time(d) })],
176
+ [/^ease-(.+)$/, ([, d]) => ({ "transition-timing-function": handler.bracket.cssvar(d) })],
177
177
  ["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
178
178
  ["ease-linear", { "transition-timing-function": "linear" }],
179
179
  ["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
@@ -198,7 +198,7 @@ const flex = [
198
198
  [/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
199
199
  [/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
200
200
  [/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
201
- [/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": handler.bracket.fraction.auto.rem(d) })],
201
+ [/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": handler.bracket.cssvar.auto.fraction.rem(d) })],
202
202
  ["flex-row", { "flex-direction": "row" }],
203
203
  ["flex-row-reverse", { "flex-direction": "row-reverse" }],
204
204
  ["flex-col", { "flex-direction": "column" }],
@@ -208,6 +208,117 @@ const flex = [
208
208
  ["flex-nowrap", { "flex-wrap": "nowrap" }]
209
209
  ];
210
210
 
211
+ const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
212
+ const displays = [
213
+ ["inline", { display: "inline" }],
214
+ ["block", { display: "block" }],
215
+ ["inline-block", { display: "inline-block" }],
216
+ ["contents", { display: "contents" }],
217
+ ["flow-root", { display: "flow-root" }],
218
+ ["list-item", { display: "list-item" }],
219
+ ["hidden", { display: "none" }]
220
+ ];
221
+ const appearances = [
222
+ ["visible", { visibility: "visible" }],
223
+ ["invisible", { visibility: "hidden" }],
224
+ ["backface-visible", { "backface-visibility": "visible" }],
225
+ ["backface-hidden", { "backface-visibility": "hidden" }]
226
+ ];
227
+ const cursors = [
228
+ [/^cursor-(.+)$/, ([, c]) => ({ cursor: handler.bracket.cssvar(c) || c })]
229
+ ];
230
+ const pointerEvents = [
231
+ ["pointer-events-auto", { "pointer-events": "auto" }],
232
+ ["pointer-events-none", { "pointer-events": "none" }]
233
+ ];
234
+ const resizes = [
235
+ ["resize-x", { resize: "horizontal" }],
236
+ ["resize-y", { resize: "vertical" }],
237
+ ["resize", { resize: "both" }],
238
+ ["resize-none", { resize: "none" }]
239
+ ];
240
+ const userSelects = [
241
+ ["select-auto", { "user-select": "auto" }],
242
+ ["select-all", { "user-select": "all" }],
243
+ ["select-text", { "user-select": "text" }],
244
+ ["select-none", { "user-select": "none" }]
245
+ ];
246
+ const whitespaces = [
247
+ [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
248
+ ];
249
+ const contents = [
250
+ ["content-empty", { content: '""' }],
251
+ ["content-none", { content: '""' }]
252
+ ];
253
+ const breaks = [
254
+ ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
255
+ ["break-words", { "overflow-wrap": "break-word" }],
256
+ ["break-all", { "word-break": "break-all" }]
257
+ ];
258
+ const textOverflows = [
259
+ ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
260
+ ["text-ellipsis", { "text-overflow": "ellipsis" }],
261
+ ["text-clip", { "text-overflow": "clip" }]
262
+ ];
263
+ const textTransforms = [
264
+ ["case-upper", { "text-transform": "uppercase" }],
265
+ ["case-lower", { "text-transform": "lowercase" }],
266
+ ["case-capital", { "text-transform": "capitalize" }],
267
+ ["case-normal", { "text-transform": "none" }]
268
+ ];
269
+ const fontStyles = [
270
+ ["italic", { "font-style": "italic" }],
271
+ ["not-italic", { "font-style": "normal" }]
272
+ ];
273
+ const fontSmoothings = [
274
+ ["antialiased", {
275
+ "-webkit-font-smoothing": "antialiased",
276
+ "-moz-osx-font-smoothing": "grayscale",
277
+ "font-smoothing": "grayscale"
278
+ }],
279
+ ["subpixel-antialiased", {
280
+ "-webkit-font-smoothing": "auto",
281
+ "-moz-osx-font-smoothing": "auto",
282
+ "font-smoothing": "auto"
283
+ }]
284
+ ];
285
+
286
+ const shadowBase = {
287
+ [CONTROL_SHORTCUT_NO_MERGE]: "",
288
+ "--un-ring-offset-shadow": "0 0 #0000",
289
+ "--un-ring-shadow": "0 0 #0000",
290
+ "--un-shadow-inset": varEmpty,
291
+ "--un-shadow": "0 0 #0000"
292
+ };
293
+ const colorableShadows = (shadows, colorVar) => {
294
+ const colored = [];
295
+ shadows = toArray(shadows);
296
+ for (let i = 0; i < shadows.length; i++) {
297
+ const [size, color] = shadows[i].split(/\s(\S+)$/);
298
+ if (color.split("(").length !== color.split(")").length)
299
+ return shadows;
300
+ colored.push(`${size} var(${colorVar}, ${color})`);
301
+ }
302
+ return colored;
303
+ };
304
+ const boxShadows = [
305
+ [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
306
+ const v = theme.boxShadow?.[d || "DEFAULT"];
307
+ if (v) {
308
+ return [
309
+ shadowBase,
310
+ {
311
+ "--un-shadow": colorableShadows(v, "--un-shadow-color").join(","),
312
+ "box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
313
+ }
314
+ ];
315
+ }
316
+ }],
317
+ [/^shadow-(.+)$/, colorResolver("--un-shadow-color", "shadow")],
318
+ [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": handler.bracket.percent(opacity) })],
319
+ ["shadow-inset", { "--un-shadow-inset": "inset" }]
320
+ ];
321
+
211
322
  const weightMap = {
212
323
  thin: "100",
213
324
  extralight: "200",
@@ -230,17 +341,17 @@ const fonts = [
230
341
  "line-height": height
231
342
  };
232
343
  }
233
- return { "font-size": handler.bracket.auto.rem(s) };
344
+ return { "font-size": handler.bracket.rem(s) };
234
345
  }],
235
- [/^text-size-(.+)$/, ([, s]) => ({ "font-size": handler.bracket.auto.rem(s) })],
346
+ [/^text-size-(.+)$/, ([, s]) => ({ "font-size": handler.bracket.cssvar.rem(s) })],
236
347
  [/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || handler.number(s) })],
237
- [/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || handler.bracket.auto.rem(s) })],
238
- [/^tracking-([^-]+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || handler.bracket.auto.rem(s) })],
239
- [/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || handler.bracket.auto.rem(s) })]
348
+ [/^(?:leading|lh)-(.+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || handler.bracket.cssvar.rem(s) })],
349
+ [/^tracking-(.+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || handler.bracket.cssvar.rem(s) })],
350
+ [/^word-spacing-(.+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || handler.bracket.cssvar.rem(s) })]
240
351
  ];
241
352
  const tabSizes = [
242
- [/^tab(?:-([^-]+))?$/, ([, s]) => {
243
- const v = handler.bracket.global.number(s || "4");
353
+ [/^tab(?:-(.+))?$/, ([, s]) => {
354
+ const v = handler.bracket.cssvar.global.number(s || "4");
244
355
  if (v != null) {
245
356
  return {
246
357
  "-moz-tab-size": v,
@@ -251,7 +362,7 @@ const tabSizes = [
251
362
  }]
252
363
  ];
253
364
  const textIndents = [
254
- [/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.auto.rem(s) })]
365
+ [/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.rem(s) })]
255
366
  ];
256
367
  const textStrokes = [
257
368
  [/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || handler.bracket.cssvar.px(s) })],
@@ -262,25 +373,14 @@ const textShadows = [
262
373
  [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
263
374
  const v = theme.textShadow?.[s || "DEFAULT"];
264
375
  if (v != null) {
265
- const shadow = toArray(v);
266
- const colored = shadow.map((s2) => s2.replace(/\s\S+$/, " var(--un-text-shadow-color)"));
267
376
  return {
268
- "--un-text-shadow": shadow.join(","),
269
- "--un-text-shadow-colored": colored.join(","),
377
+ "--un-text-shadow": colorableShadows(v, "--un-text-shadow-color").join(","),
270
378
  "text-shadow": "var(--un-text-shadow)"
271
379
  };
272
380
  }
273
381
  return { "text-shadow": handler.bracket.cssvar(s) };
274
382
  }],
275
- [/^text-shadow-color-(.+)$/, (m, ctx) => {
276
- const color = colorResolver("--un-text-shadow-color", "text-shadow")(m, ctx);
277
- if (color) {
278
- return {
279
- ...color,
280
- "--un-text-shadow": "var(--un-text-shadow-colored)"
281
- };
282
- }
283
- }],
383
+ [/^text-shadow-color-(.+)$/, colorResolver("--un-text-shadow-color", "text-shadow")],
284
384
  [/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": handler.bracket.percent(opacity) })]
285
385
  ];
286
386
 
@@ -290,7 +390,7 @@ const directions = {
290
390
  "y": "row-"
291
391
  };
292
392
  const handleGap = ([, d = "", s]) => {
293
- const v = handler.bracket.auto.rem(s);
393
+ const v = handler.bracket.cssvar.rem(s);
294
394
  if (v != null) {
295
395
  return {
296
396
  [`grid-${directions[d]}gap`]: v,
@@ -316,12 +416,12 @@ const autoDirection = (selector, theme) => {
316
416
  case "fr":
317
417
  return "minmax(0,1fr)";
318
418
  }
319
- return handler.bracket.auto.rem(selector);
419
+ return handler.bracket.cssvar.auto.rem(selector);
320
420
  };
321
421
  const grids = [
322
422
  ["grid", { display: "grid" }],
323
423
  ["inline-grid", { display: "inline-grid" }],
324
- [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: handler.bracket.auto(v) })],
424
+ [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: handler.bracket.cssvar.auto(v) })],
325
425
  [/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
326
426
  if (s === "full")
327
427
  return { [`grid-${rowCol(c)}`]: "1/-1" };
@@ -329,11 +429,12 @@ const grids = [
329
429
  if (v != null)
330
430
  return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
331
431
  }],
332
- [/^(?:grid-)?(row|col)-start-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: v })],
333
- [/^(?:grid-)?(row|col)-end-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: v })],
334
- [/^(?:grid-)?auto-(rows|cols)-([\w.-]+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) })],
432
+ [/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: handler.bracket.cssvar(v) ?? v })],
433
+ [/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: handler.bracket.cssvar(v) ?? v })],
434
+ [/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) })],
435
+ [/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": handler.bracket.cssvar(v) })],
335
436
  [/^(?:grid-auto-flow|auto-flow|grid-flow)-((?:row|col)(?:-dense)?)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
336
- [/^grid-(rows|cols)-(\[.+\])$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: handler.bracket(v) })],
437
+ [/^grid-(rows|cols)-(.+)$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: handler.bracket.cssvar(v) })],
337
438
  [/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
338
439
  [/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
339
440
  ["grid-rows-none", { "grid-template-rows": "none" }],
@@ -374,7 +475,7 @@ const justifies = [
374
475
  ["justify-self-stretch", { "justify-self": "stretch" }]
375
476
  ];
376
477
  const orders = [
377
- [/^order-(.+)$/, ([, v]) => ({ order: handler.bracket.number(v) })],
478
+ [/^order-(.+)$/, ([, v]) => ({ order: handler.bracket.cssvar.number(v) })],
378
479
  ["order-first", { order: "-9999" }],
379
480
  ["order-last", { order: "9999" }],
380
481
  ["order-none", { order: "0" }]
@@ -417,7 +518,7 @@ const placements = [
417
518
  ["place-self-stretch", { "place-self": "stretch" }]
418
519
  ];
419
520
  function handleInsetValue(v) {
420
- return handler.bracket.fraction.cssvar.auto.rem(v);
521
+ return handler.bracket.cssvar.auto.fraction.rem(v);
421
522
  }
422
523
  function handleInsetValues([, d, v]) {
423
524
  const r = handleInsetValue(v);
@@ -427,6 +528,7 @@ function handleInsetValues([, d, v]) {
427
528
  const insets = [
428
529
  [/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
429
530
  [/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
531
+ [/^(?:position-|pos-)?inset-([rltbse])-(.+)$/, handleInsetValues],
430
532
  [/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
431
533
  [/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
432
534
  [/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
@@ -441,132 +543,21 @@ const floats = [
441
543
  ["clear-none", { clear: "none" }]
442
544
  ];
443
545
  const zIndexes = [
444
- ["z-auto", { "z-index": "auto" }],
445
- [/^z-([^-]+)$/, ([, v]) => ({ "z-index": handler.number(v) })]
546
+ [/^z-(.+)$/, ([, v]) => ({ "z-index": handler.bracket.cssvar.number(v) })],
547
+ ["z-auto", { "z-index": "auto" }]
446
548
  ];
447
549
  const boxSizing = [
448
550
  ["box-border", { "box-sizing": "border-box" }],
449
551
  ["box-content", { "box-sizing": "content-box" }]
450
552
  ];
451
553
 
452
- const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
453
- const displays = [
454
- ["inline", { display: "inline" }],
455
- ["block", { display: "block" }],
456
- ["inline-block", { display: "inline-block" }],
457
- ["contents", { display: "contents" }],
458
- ["flow-root", { display: "flow-root" }],
459
- ["list-item", { display: "list-item" }],
460
- ["hidden", { display: "none" }]
461
- ];
462
- const appearances = [
463
- ["visible", { visibility: "visible" }],
464
- ["invisible", { visibility: "hidden" }],
465
- ["backface-visible", { "backface-visibility": "visible" }],
466
- ["backface-hidden", { "backface-visibility": "hidden" }]
467
- ];
468
- const cursors = [
469
- [/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
470
- ];
471
- const pointerEvents = [
472
- ["pointer-events-auto", { "pointer-events": "auto" }],
473
- ["pointer-events-none", { "pointer-events": "none" }]
474
- ];
475
- const resizes = [
476
- ["resize-x", { resize: "horizontal" }],
477
- ["resize-y", { resize: "vertical" }],
478
- ["resize", { resize: "both" }],
479
- ["resize-none", { resize: "none" }]
480
- ];
481
- const userSelects = [
482
- ["select-auto", { "user-select": "auto" }],
483
- ["select-all", { "user-select": "all" }],
484
- ["select-text", { "user-select": "text" }],
485
- ["select-none", { "user-select": "none" }]
486
- ];
487
- const whitespaces = [
488
- [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
489
- ];
490
- const contents = [
491
- ["content-empty", { content: '""' }],
492
- ["content-none", { content: '""' }]
493
- ];
494
- const breaks = [
495
- ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
496
- ["break-words", { "overflow-wrap": "break-word" }],
497
- ["break-all", { "word-break": "break-all" }]
498
- ];
499
- const textOverflows = [
500
- ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
501
- ["text-ellipsis", { "text-overflow": "ellipsis" }],
502
- ["text-clip", { "text-overflow": "clip" }]
503
- ];
504
- const textTransforms = [
505
- ["case-upper", { "text-transform": "uppercase" }],
506
- ["case-lower", { "text-transform": "lowercase" }],
507
- ["case-capital", { "text-transform": "capitalize" }],
508
- ["case-normal", { "text-transform": "none" }]
509
- ];
510
- const fontStyles = [
511
- ["italic", { "font-style": "italic" }],
512
- ["not-italic", { "font-style": "normal" }]
513
- ];
514
- const fontSmoothings = [
515
- ["antialiased", {
516
- "-webkit-font-smoothing": "antialiased",
517
- "-moz-osx-font-smoothing": "grayscale",
518
- "font-smoothing": "grayscale"
519
- }],
520
- ["subpixel-antialiased", {
521
- "-webkit-font-smoothing": "auto",
522
- "-moz-osx-font-smoothing": "auto",
523
- "font-smoothing": "auto"
524
- }]
525
- ];
526
-
527
- const shadowBase = {
528
- [CONTROL_SHORTCUT_NO_MERGE]: "",
529
- "--un-ring-offset-shadow": "0 0 #0000",
530
- "--un-ring-shadow": "0 0 #0000",
531
- "--un-shadow-inset": varEmpty,
532
- "--un-shadow": "0 0 #0000",
533
- "--un-shadow-colored": "0 0 #0000"
534
- };
535
- const boxShadows = [
536
- [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
537
- const v = theme.boxShadow?.[d || "DEFAULT"];
538
- if (v) {
539
- const shadow = toArray(v);
540
- const colored = shadow.map((s) => s.replace(/\s\S+$/, " var(--un-shadow-color)"));
541
- return [
542
- shadowBase,
543
- {
544
- "--un-shadow": shadow.join(","),
545
- "--un-shadow-colored": colored.join(","),
546
- "box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
547
- }
548
- ];
549
- }
550
- }],
551
- [/^shadow-(.+)$/, (m, ctx) => {
552
- const color = colorResolver("--un-shadow-color", "shadow")(m, ctx);
553
- if (color) {
554
- return {
555
- ...color,
556
- "--un-shadow": "var(--un-shadow-colored)"
557
- };
558
- }
559
- }],
560
- [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": handler.bracket.percent.cssvar(opacity) })],
561
- ["shadow-inset", { "--un-shadow-inset": "inset" }]
562
- ];
563
-
564
554
  const ringBase = {
555
+ ...shadowBase,
565
556
  "--un-ring-inset": varEmpty,
566
557
  "--un-ring-offset-width": "0px",
567
558
  "--un-ring-offset-color": "#fff",
568
- "--un-ring-color": "rgba(147,197,253,0.5)",
569
- ...shadowBase
559
+ "--un-ring-width": "0px",
560
+ "--un-ring-color": "rgba(147,197,253,0.5)"
570
561
  };
571
562
  const rings = [
572
563
  [/^ring(?:-(.+))?$/, ([, d]) => {
@@ -575,15 +566,17 @@ const rings = [
575
566
  return [
576
567
  ringBase,
577
568
  {
569
+ "--un-ring-width": value,
578
570
  "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
579
- "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
571
+ "--un-ring-shadow": "var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color)",
580
572
  "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
581
573
  }
582
574
  ];
583
575
  }
584
576
  }],
577
+ [/^ring-(?:width-|size-)(.+)$/, ([, d]) => ({ "--un-ring-width": handler.bracket.cssvar.px(d) })],
585
578
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
586
- [/^ring-offset-(.+)$/, ([, d]) => ({ "--un-ring-offset-width": handler.px(d || "1") })],
579
+ [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d]) => ({ "--un-ring-offset-width": handler.bracket.cssvar.px(d) })],
587
580
  [/^ring-(.+)$/, colorResolver("--un-ring-color", "ring")],
588
581
  [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity) })],
589
582
  [/^ring-offset-(.+)$/, colorResolver("--un-ring-offset-color", "ring-offset")],
@@ -611,7 +604,7 @@ function getSizeValue(minmax, hw, theme, prop) {
611
604
  case "min":
612
605
  return `${prop}-content`;
613
606
  }
614
- return handler.bracket.cssvar.fraction.auto.rem(prop);
607
+ return handler.bracket.cssvar.auto.fraction.rem(prop);
615
608
  }
616
609
  const sizes = [
617
610
  [/^(min-|max-)?([wh])-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
@@ -637,14 +630,14 @@ const paddings = [
637
630
  [/^pa?()-?(-?.+)$/, directionSize("padding")],
638
631
  [/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
639
632
  [/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")],
640
- [/^p-(inline|block)-(-?.+)$/, directionSize("padding")],
633
+ [/^p-(block|inline)-(-?.+)$/, directionSize("padding")],
641
634
  [/^p-?([bi][se])-?(-?.+)$/, directionSize("padding")]
642
635
  ];
643
636
  const margins = [
644
637
  [/^ma?()-?(-?.+)$/, directionSize("margin")],
645
638
  [/^m-?([xy])-?(-?.+)$/, directionSize("margin")],
646
639
  [/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")],
647
- [/^m-(inline|block)-(-?.+)$/, directionSize("margin")],
640
+ [/^m-(block|inline)-(-?.+)$/, directionSize("margin")],
648
641
  [/^m-?([bi][se])-?(-?.+)$/, directionSize("margin")]
649
642
  ];
650
643
 
@@ -695,9 +688,9 @@ const transformBase = {
695
688
  [CONTROL_SHORTCUT_NO_MERGE]: ""
696
689
  };
697
690
  const transforms = [
698
- [/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": positionMap[s] })],
699
- [/^perspect-(.+)$/, ([, s]) => {
700
- const v = handler.px.numberWithUnit(s);
691
+ [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": positionMap[s] ?? handler.bracket.cssvar(s) })],
692
+ [/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
693
+ const v = handler.bracket.cssvar.px.numberWithUnit(s);
701
694
  if (v != null) {
702
695
  return {
703
696
  "-webkit-perspective": v,
@@ -705,8 +698,8 @@ const transforms = [
705
698
  };
706
699
  }
707
700
  }],
708
- [/^perspect-origin-(.+)$/, ([, s]) => {
709
- const v = handler.bracket(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
701
+ [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
702
+ const v = handler.bracket.cssvar(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
710
703
  if (v != null) {
711
704
  return {
712
705
  "-webkit-perspective-origin": v,
@@ -714,16 +707,15 @@ const transforms = [
714
707
  };
715
708
  }
716
709
  }],
717
- [/^translate-()(.+)$/, handleTranslate],
718
- [/^translate-([xyz])-(.+)$/, handleTranslate],
719
- [/^rotate-()(.+)$/, handleRotate],
720
- [/^rotate(-[xyz])-(.+)$/, handleRotate],
721
- [/^skew-()(.+)$/, handleSkew],
722
- [/^skew-([xy])-(.+)$/, handleSkew],
723
- [/^scale-()(.+)$/, handleScale],
724
- [/^scale-([xyz])-(.+)$/, handleScale],
725
- ["preserve-3d", { "transform-style": "preserve-3d" }],
726
- ["preserve-flat", { "transform-style": "flat" }],
710
+ [/^(?:transform-)?translate-()(.+)$/, handleTranslate],
711
+ [/^(?:transform-)?translate-([xyz])-(.+)$/, handleTranslate],
712
+ [/^(?:transform-)?rotate-()(.+)$/, handleRotate],
713
+ [/^(?:transform-)?rotate-([xyz])-(.+)$/, handleRotate],
714
+ [/^(?:transform-)?skew-([xy])-(.+)$/, handleSkew],
715
+ [/^(?:transform-)?scale-()(.+)$/, handleScale],
716
+ [/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale],
717
+ [/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
718
+ [/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
727
719
  [/^transform$/, () => [
728
720
  transformBase,
729
721
  { transform: "var(--un-transform)" }
@@ -733,7 +725,7 @@ const transforms = [
733
725
  ["transform-none", { transform: "none" }]
734
726
  ];
735
727
  function handleTranslate([, d, b]) {
736
- const v = handler.bracket.fraction.auto.rem(b);
728
+ const v = handler.bracket.cssvar.fraction.rem(b);
737
729
  if (v != null) {
738
730
  return [
739
731
  transformBase,
@@ -745,7 +737,7 @@ function handleTranslate([, d, b]) {
745
737
  }
746
738
  }
747
739
  function handleScale([, d, b]) {
748
- const v = handler.bracket.fraction.percent(b);
740
+ const v = handler.bracket.cssvar.fraction.percent(b);
749
741
  if (v != null) {
750
742
  return [
751
743
  transformBase,
@@ -756,20 +748,34 @@ function handleScale([, d, b]) {
756
748
  ];
757
749
  }
758
750
  }
759
- function handleRotate([, d, b]) {
760
- const v = handler.bracket.degree(b);
751
+ function handleRotate([, d = "", b]) {
752
+ const v = handler.bracket.cssvar.degree(b);
761
753
  if (v != null) {
762
- return [
763
- transformBase,
764
- {
765
- [`--un-rotate${d || ""}`]: v,
766
- transform: "var(--un-transform)"
767
- }
768
- ];
754
+ if (d) {
755
+ return [
756
+ transformBase,
757
+ {
758
+ "--un-rotate": 0,
759
+ [`--un-rotate-${d}`]: v,
760
+ "transform": "var(--un-transform)"
761
+ }
762
+ ];
763
+ } else {
764
+ return [
765
+ transformBase,
766
+ {
767
+ "--un-rotate-x": 0,
768
+ "--un-rotate-y": 0,
769
+ "--un-rotate-z": 0,
770
+ "--un-rotate": v,
771
+ "transform": "var(--un-transform)"
772
+ }
773
+ ];
774
+ }
769
775
  }
770
776
  }
771
777
  function handleSkew([, d, b]) {
772
- const v = handler.bracket.degree(b);
778
+ const v = handler.bracket.cssvar.degree(b);
773
779
  if (v != null) {
774
780
  return [
775
781
  transformBase,
@@ -782,38 +788,30 @@ function handleSkew([, d, b]) {
782
788
  }
783
789
 
784
790
  const variablesAbbrMap = {
785
- "visible": "visibility",
786
- "select": "user-select",
787
- "vertical": "vertical-align",
788
- "backface": "backface-visibility",
789
- "whitespace": "white-space",
790
- "break": "word-break",
791
- "case": "text-transform",
792
- "origin": "transform-origin",
793
- "bg-opacity": "background-opacity",
794
- "tab": "tab-size",
795
- "underline": "text-decoration-thickness",
796
- "underline-offset": "text-underline-offset",
797
- "grid-cols": "grid-template-columns",
798
- "grid-rows": "grid-template-rows",
799
- "auto-flow": "grid-auto-flow",
800
- "row-start": "grid-row-start",
801
- "row-end": "grid-row-end",
802
- "justify": "justify-content",
803
- "content": "align-content",
804
- "items": "align-items",
805
- "self": "align-self",
806
- "object": "object-fit"
791
+ backface: "backface-visibility",
792
+ break: "word-break",
793
+ case: "text-transform",
794
+ content: "align-content",
795
+ flex: "flex",
796
+ fw: "font-weight",
797
+ items: "align-items",
798
+ justify: "justify-content",
799
+ select: "user-select",
800
+ self: "align-self",
801
+ vertical: "vertical-align",
802
+ visible: "visibility",
803
+ whitespace: "white-space",
804
+ ws: "white-space"
807
805
  };
808
806
  const cssVariables = [
809
- [/^(.+)-\$(.+)$/, ([, name, varname]) => {
807
+ [/^(.+?)-\$(.+)$/, ([, name, varname]) => {
810
808
  const prop = variablesAbbrMap[name];
811
809
  if (prop)
812
810
  return { [prop]: `var(--${varname})` };
813
811
  }]
814
812
  ];
815
813
  const cssProperty = [
816
- [/^\[(.+):(.+)\]$/, ([, prop, value]) => ({ [prop]: handler.bracket(`[${value}]`) })]
814
+ [/^\[([^:]+):(.+)\]$/, ([, prop, value]) => ({ [prop]: handler.bracket(`[${value}]`) })]
817
815
  ];
818
816
 
819
817
  const questionMark = [
@@ -833,7 +831,7 @@ const textDecorations = [
833
831
  ["line-through", { "text-decoration-line": "line-through" }],
834
832
  ["decoration-underline", { "text-decoration-line": "underline" }],
835
833
  ["decoration-line-through", { "text-decoration-line": "line-through" }],
836
- [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.px(s) })],
834
+ [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.cssvar.px(s) })],
837
835
  [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
838
836
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
839
837
  const result = colorResolver("text-decoration-color", "line")(match, ctx);
@@ -845,7 +843,7 @@ const textDecorations = [
845
843
  }
846
844
  }],
847
845
  [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) })],
848
- [/^underline-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": handler.auto.bracket.px(s) })],
846
+ [/^(?:underline|decoration)-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": handler.auto.bracket.cssvar.px(s) })],
849
847
  [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d })],
850
848
  ["no-underline", { "text-decoration": "none" }],
851
849
  ["decoration-none", { "text-decoration": "none" }]
@@ -855,9 +853,9 @@ const svgUtilities = [
855
853
  [/^fill-(.+)$/, colorResolver("fill", "fill")],
856
854
  [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
857
855
  ["fill-none", { fill: "none" }],
858
- [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.fraction.px.number(s) })],
859
- [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": handler.bracket.number(s) })],
860
- [/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": handler.bracket.px.numberWithUnit(s) })],
856
+ [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.cssvar.fraction.px.number(s) })],
857
+ [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": handler.bracket.cssvar.number(s) })],
858
+ [/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": handler.bracket.cssvar.px.numberWithUnit(s) })],
861
859
  [/^stroke-(.+)$/, colorResolver("stroke", "stroke")],
862
860
  [/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": handler.bracket.percent(opacity) })],
863
861
  ["stroke-cap-square", { "stroke-linecap": "square" }],
@@ -928,4 +926,4 @@ const rules = [
928
926
  questionMark
929
927
  ].flat(1);
930
928
 
931
- export { cssVariables as $, boxShadows as A, sizes as B, aspectRatio as C, paddings as D, margins as E, varEmpty as F, displays as G, appearances as H, cursors as I, pointerEvents as J, resizes as K, userSelects as L, whitespaces as M, contents as N, breaks as O, textOverflows as P, textTransforms as Q, fontStyles as R, fontSmoothings as S, svgUtilities as T, transforms as U, transitions as V, fonts as W, tabSizes as X, textIndents as Y, textStrokes as Z, textShadows as _, appearance as a, cssProperty as a0, textDecorations as a1, borders as b, opacity as c, textColors as d, bgColors as e, flex as f, gaps as g, grids as h, overflows as i, justifies as j, orders as k, alignments as l, placements as m, insets as n, outline as o, positions as p, floats as q, rules as r, boxSizing as s, textAligns as t, questionMark as u, verticalAligns as v, willChange as w, rings as x, shadowBase as y, zIndexes as z };
929
+ export { textShadows as $, colorableShadows as A, boxShadows as B, sizes as C, aspectRatio as D, paddings as E, margins as F, varEmpty as G, displays as H, appearances as I, cursors as J, pointerEvents as K, resizes as L, userSelects as M, whitespaces as N, contents as O, breaks as P, textOverflows as Q, textTransforms as R, fontStyles as S, fontSmoothings as T, svgUtilities as U, transforms as V, transitions as W, fonts as X, tabSizes as Y, textIndents as Z, textStrokes as _, appearance as a, cssVariables as a0, cssProperty as a1, textDecorations as a2, borders as b, opacity as c, textColors as d, bgColors as e, flex as f, gaps as g, grids as h, overflows as i, justifies as j, orders as k, alignments as l, placements as m, insets as n, outline as o, positions as p, floats as q, rules as r, boxSizing as s, textAligns as t, questionMark as u, verticalAligns as v, willChange as w, rings as x, shadowBase as y, zIndexes as z };