@unocss/preset-mini 0.22.2 → 0.22.6

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.
@@ -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.px(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.px(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")],
@@ -166,19 +166,14 @@ const transitions = [
166
166
  if (p) {
167
167
  return {
168
168
  "transition-property": p,
169
- "transition-timing-function": "cubic-bezier(0.4,0,0.2,1)",
169
+ "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
170
170
  "transition-duration": `${duration}ms`
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) })],
177
- ["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
178
- ["ease-linear", { "transition-timing-function": "linear" }],
179
- ["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
180
- ["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
181
- ["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
174
+ [/^(?:transition-)?duration-(.+)$/, ([, d]) => ({ "transition-duration": handler.bracket.cssvar.time(d) })],
175
+ [/^(?:transition-)?delay-(.+)$/, ([, d]) => ({ "transition-delay": handler.bracket.cssvar.time(d) })],
176
+ [/^(?:transition-)?ease(?:-(.+))?$/, ([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? handler.bracket.cssvar(d) })],
182
177
  [/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": handler.global(v) || transitionProperty(v) })],
183
178
  ["transition-property-none", { "transition-property": "none" }],
184
179
  ["property-none", { "transition-property": "none" }],
@@ -198,7 +193,7 @@ const flex = [
198
193
  [/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
199
194
  [/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
200
195
  [/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
201
- [/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": handler.bracket.fraction.auto.rem(d) })],
196
+ [/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": handler.bracket.cssvar.auto.fraction.rem(d) })],
202
197
  ["flex-row", { "flex-direction": "row" }],
203
198
  ["flex-row-reverse", { "flex-direction": "row-reverse" }],
204
199
  ["flex-col", { "flex-direction": "column" }],
@@ -225,7 +220,7 @@ const appearances = [
225
220
  ["backface-hidden", { "backface-visibility": "hidden" }]
226
221
  ];
227
222
  const cursors = [
228
- [/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
223
+ [/^cursor-(.+)$/, ([, c]) => ({ cursor: handler.bracket.cssvar(c) || c })]
229
224
  ];
230
225
  const pointerEvents = [
231
226
  ["pointer-events-auto", { "pointer-events": "auto" }],
@@ -315,7 +310,7 @@ const boxShadows = [
315
310
  }
316
311
  }],
317
312
  [/^shadow-(.+)$/, colorResolver("--un-shadow-color", "shadow")],
318
- [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": handler.bracket.percent.cssvar(opacity) })],
313
+ [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": handler.bracket.percent(opacity) })],
319
314
  ["shadow-inset", { "--un-shadow-inset": "inset" }]
320
315
  ];
321
316
 
@@ -341,17 +336,17 @@ const fonts = [
341
336
  "line-height": height
342
337
  };
343
338
  }
344
- return { "font-size": handler.bracket.auto.rem(s) };
339
+ return { "font-size": handler.bracket.rem(s) };
345
340
  }],
346
- [/^text-size-(.+)$/, ([, s]) => ({ "font-size": handler.bracket.auto.rem(s) })],
341
+ [/^text-size-(.+)$/, ([, s]) => ({ "font-size": handler.bracket.cssvar.rem(s) })],
347
342
  [/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || handler.number(s) })],
348
- [/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || handler.bracket.auto.rem(s) })],
349
- [/^tracking-([^-]+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || handler.bracket.auto.rem(s) })],
350
- [/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || handler.bracket.auto.rem(s) })]
343
+ [/^(?:leading|lh)-(.+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || handler.bracket.cssvar.rem(s) })],
344
+ [/^tracking-(.+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || handler.bracket.cssvar.rem(s) })],
345
+ [/^word-spacing-(.+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || handler.bracket.cssvar.rem(s) })]
351
346
  ];
352
347
  const tabSizes = [
353
- [/^tab(?:-([^-]+))?$/, ([, s]) => {
354
- const v = handler.bracket.global.number(s || "4");
348
+ [/^tab(?:-(.+))?$/, ([, s]) => {
349
+ const v = handler.bracket.cssvar.global.number(s || "4");
355
350
  if (v != null) {
356
351
  return {
357
352
  "-moz-tab-size": v,
@@ -362,7 +357,7 @@ const tabSizes = [
362
357
  }]
363
358
  ];
364
359
  const textIndents = [
365
- [/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.auto.rem(s) })]
360
+ [/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.rem(s) })]
366
361
  ];
367
362
  const textStrokes = [
368
363
  [/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || handler.bracket.cssvar.px(s) })],
@@ -390,7 +385,7 @@ const directions = {
390
385
  "y": "row-"
391
386
  };
392
387
  const handleGap = ([, d = "", s]) => {
393
- const v = handler.bracket.auto.rem(s);
388
+ const v = handler.bracket.cssvar.rem(s);
394
389
  if (v != null) {
395
390
  return {
396
391
  [`grid-${directions[d]}gap`]: v,
@@ -416,12 +411,12 @@ const autoDirection = (selector, theme) => {
416
411
  case "fr":
417
412
  return "minmax(0,1fr)";
418
413
  }
419
- return handler.bracket.auto.rem(selector);
414
+ return handler.bracket.cssvar.auto.rem(selector);
420
415
  };
421
416
  const grids = [
422
417
  ["grid", { display: "grid" }],
423
418
  ["inline-grid", { display: "inline-grid" }],
424
- [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: handler.bracket.auto(v) })],
419
+ [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: handler.bracket.cssvar.auto(v) })],
425
420
  [/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
426
421
  if (s === "full")
427
422
  return { [`grid-${rowCol(c)}`]: "1/-1" };
@@ -429,11 +424,12 @@ const grids = [
429
424
  if (v != null)
430
425
  return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
431
426
  }],
432
- [/^(?:grid-)?(row|col)-start-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: v })],
433
- [/^(?:grid-)?(row|col)-end-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: v })],
434
- [/^(?:grid-)?auto-(rows|cols)-([\w.-]+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) })],
427
+ [/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: handler.bracket.cssvar(v) ?? v })],
428
+ [/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: handler.bracket.cssvar(v) ?? v })],
429
+ [/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) })],
430
+ [/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": handler.bracket.cssvar(v) })],
435
431
  [/^(?:grid-auto-flow|auto-flow|grid-flow)-((?:row|col)(?:-dense)?)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
436
- [/^grid-(rows|cols)-(\[.+\])$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: handler.bracket(v) })],
432
+ [/^grid-(rows|cols)-(.+)$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: handler.bracket.cssvar(v) })],
437
433
  [/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
438
434
  [/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
439
435
  ["grid-rows-none", { "grid-template-rows": "none" }],
@@ -474,7 +470,7 @@ const justifies = [
474
470
  ["justify-self-stretch", { "justify-self": "stretch" }]
475
471
  ];
476
472
  const orders = [
477
- [/^order-(.+)$/, ([, v]) => ({ order: handler.bracket.number(v) })],
473
+ [/^order-(.+)$/, ([, v]) => ({ order: handler.bracket.cssvar.number(v) })],
478
474
  ["order-first", { order: "-9999" }],
479
475
  ["order-last", { order: "9999" }],
480
476
  ["order-none", { order: "0" }]
@@ -517,7 +513,7 @@ const placements = [
517
513
  ["place-self-stretch", { "place-self": "stretch" }]
518
514
  ];
519
515
  function handleInsetValue(v) {
520
- return handler.bracket.fraction.cssvar.auto.rem(v);
516
+ return handler.bracket.cssvar.auto.fraction.rem(v);
521
517
  }
522
518
  function handleInsetValues([, d, v]) {
523
519
  const r = handleInsetValue(v);
@@ -542,8 +538,8 @@ const floats = [
542
538
  ["clear-none", { clear: "none" }]
543
539
  ];
544
540
  const zIndexes = [
545
- ["z-auto", { "z-index": "auto" }],
546
- [/^z-([^-]+)$/, ([, v]) => ({ "z-index": handler.number(v) })]
541
+ [/^z-(.+)$/, ([, v]) => ({ "z-index": handler.bracket.cssvar.number(v) })],
542
+ ["z-auto", { "z-index": "auto" }]
547
543
  ];
548
544
  const boxSizing = [
549
545
  ["box-border", { "box-sizing": "border-box" }],
@@ -551,11 +547,12 @@ const boxSizing = [
551
547
  ];
552
548
 
553
549
  const ringBase = {
550
+ ...shadowBase,
554
551
  "--un-ring-inset": varEmpty,
555
552
  "--un-ring-offset-width": "0px",
556
553
  "--un-ring-offset-color": "#fff",
557
- "--un-ring-color": "rgba(147,197,253,0.5)",
558
- ...shadowBase
554
+ "--un-ring-width": "0px",
555
+ "--un-ring-color": "rgba(147,197,253,0.5)"
559
556
  };
560
557
  const rings = [
561
558
  [/^ring(?:-(.+))?$/, ([, d]) => {
@@ -564,15 +561,17 @@ const rings = [
564
561
  return [
565
562
  ringBase,
566
563
  {
564
+ "--un-ring-width": value,
567
565
  "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
568
- "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
566
+ "--un-ring-shadow": "var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color)",
569
567
  "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
570
568
  }
571
569
  ];
572
570
  }
573
571
  }],
572
+ [/^ring-(?:width-|size-)(.+)$/, ([, d]) => ({ "--un-ring-width": handler.bracket.cssvar.px(d) })],
574
573
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
575
- [/^ring-offset-(.+)$/, ([, d]) => ({ "--un-ring-offset-width": handler.px(d || "1") })],
574
+ [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d]) => ({ "--un-ring-offset-width": handler.bracket.cssvar.px(d) })],
576
575
  [/^ring-(.+)$/, colorResolver("--un-ring-color", "ring")],
577
576
  [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity) })],
578
577
  [/^ring-offset-(.+)$/, colorResolver("--un-ring-offset-color", "ring-offset")],
@@ -600,7 +599,7 @@ function getSizeValue(minmax, hw, theme, prop) {
600
599
  case "min":
601
600
  return `${prop}-content`;
602
601
  }
603
- return handler.bracket.cssvar.fraction.auto.rem(prop);
602
+ return handler.bracket.cssvar.auto.fraction.rem(prop);
604
603
  }
605
604
  const sizes = [
606
605
  [/^(min-|max-)?([wh])-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
@@ -626,14 +625,14 @@ const paddings = [
626
625
  [/^pa?()-?(-?.+)$/, directionSize("padding")],
627
626
  [/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
628
627
  [/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")],
629
- [/^p-(inline|block)-(-?.+)$/, directionSize("padding")],
628
+ [/^p-(block|inline)-(-?.+)$/, directionSize("padding")],
630
629
  [/^p-?([bi][se])-?(-?.+)$/, directionSize("padding")]
631
630
  ];
632
631
  const margins = [
633
632
  [/^ma?()-?(-?.+)$/, directionSize("margin")],
634
633
  [/^m-?([xy])-?(-?.+)$/, directionSize("margin")],
635
634
  [/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")],
636
- [/^m-(inline|block)-(-?.+)$/, directionSize("margin")],
635
+ [/^m-(block|inline)-(-?.+)$/, directionSize("margin")],
637
636
  [/^m-?([bi][se])-?(-?.+)$/, directionSize("margin")]
638
637
  ];
639
638
 
@@ -684,9 +683,9 @@ const transformBase = {
684
683
  [CONTROL_SHORTCUT_NO_MERGE]: ""
685
684
  };
686
685
  const transforms = [
687
- [/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": positionMap[s] })],
688
- [/^perspect-(.+)$/, ([, s]) => {
689
- const v = handler.px.numberWithUnit(s);
686
+ [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": positionMap[s] ?? handler.bracket.cssvar(s) })],
687
+ [/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
688
+ const v = handler.bracket.cssvar.px.numberWithUnit(s);
690
689
  if (v != null) {
691
690
  return {
692
691
  "-webkit-perspective": v,
@@ -694,8 +693,8 @@ const transforms = [
694
693
  };
695
694
  }
696
695
  }],
697
- [/^perspect-origin-(.+)$/, ([, s]) => {
698
- const v = handler.bracket(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
696
+ [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
697
+ const v = handler.bracket.cssvar(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
699
698
  if (v != null) {
700
699
  return {
701
700
  "-webkit-perspective-origin": v,
@@ -703,16 +702,15 @@ const transforms = [
703
702
  };
704
703
  }
705
704
  }],
706
- [/^translate-()(.+)$/, handleTranslate],
707
- [/^translate-([xyz])-(.+)$/, handleTranslate],
708
- [/^rotate-()(.+)$/, handleRotate],
709
- [/^rotate(-[xyz])-(.+)$/, handleRotate],
710
- [/^skew-()(.+)$/, handleSkew],
711
- [/^skew-([xy])-(.+)$/, handleSkew],
712
- [/^scale-()(.+)$/, handleScale],
713
- [/^scale-([xyz])-(.+)$/, handleScale],
714
- ["preserve-3d", { "transform-style": "preserve-3d" }],
715
- ["preserve-flat", { "transform-style": "flat" }],
705
+ [/^(?:transform-)?translate-()(.+)$/, handleTranslate],
706
+ [/^(?:transform-)?translate-([xyz])-(.+)$/, handleTranslate],
707
+ [/^(?:transform-)?rotate-()(.+)$/, handleRotate],
708
+ [/^(?:transform-)?rotate-([xyz])-(.+)$/, handleRotate],
709
+ [/^(?:transform-)?skew-([xy])-(.+)$/, handleSkew],
710
+ [/^(?:transform-)?scale-()(.+)$/, handleScale],
711
+ [/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale],
712
+ [/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
713
+ [/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
716
714
  [/^transform$/, () => [
717
715
  transformBase,
718
716
  { transform: "var(--un-transform)" }
@@ -722,7 +720,7 @@ const transforms = [
722
720
  ["transform-none", { transform: "none" }]
723
721
  ];
724
722
  function handleTranslate([, d, b]) {
725
- const v = handler.bracket.fraction.auto.rem(b);
723
+ const v = handler.bracket.cssvar.fraction.rem(b);
726
724
  if (v != null) {
727
725
  return [
728
726
  transformBase,
@@ -734,7 +732,7 @@ function handleTranslate([, d, b]) {
734
732
  }
735
733
  }
736
734
  function handleScale([, d, b]) {
737
- const v = handler.bracket.fraction.percent(b);
735
+ const v = handler.bracket.cssvar.fraction.percent(b);
738
736
  if (v != null) {
739
737
  return [
740
738
  transformBase,
@@ -745,20 +743,34 @@ function handleScale([, d, b]) {
745
743
  ];
746
744
  }
747
745
  }
748
- function handleRotate([, d, b]) {
749
- const v = handler.bracket.degree(b);
746
+ function handleRotate([, d = "", b]) {
747
+ const v = handler.bracket.cssvar.degree(b);
750
748
  if (v != null) {
751
- return [
752
- transformBase,
753
- {
754
- [`--un-rotate${d || ""}`]: v,
755
- transform: "var(--un-transform)"
756
- }
757
- ];
749
+ if (d) {
750
+ return [
751
+ transformBase,
752
+ {
753
+ "--un-rotate": 0,
754
+ [`--un-rotate-${d}`]: v,
755
+ "transform": "var(--un-transform)"
756
+ }
757
+ ];
758
+ } else {
759
+ return [
760
+ transformBase,
761
+ {
762
+ "--un-rotate-x": 0,
763
+ "--un-rotate-y": 0,
764
+ "--un-rotate-z": 0,
765
+ "--un-rotate": v,
766
+ "transform": "var(--un-transform)"
767
+ }
768
+ ];
769
+ }
758
770
  }
759
771
  }
760
772
  function handleSkew([, d, b]) {
761
- const v = handler.bracket.degree(b);
773
+ const v = handler.bracket.cssvar.degree(b);
762
774
  if (v != null) {
763
775
  return [
764
776
  transformBase,
@@ -771,38 +783,30 @@ function handleSkew([, d, b]) {
771
783
  }
772
784
 
773
785
  const variablesAbbrMap = {
774
- "visible": "visibility",
775
- "select": "user-select",
776
- "vertical": "vertical-align",
777
- "backface": "backface-visibility",
778
- "whitespace": "white-space",
779
- "break": "word-break",
780
- "case": "text-transform",
781
- "origin": "transform-origin",
782
- "bg-opacity": "background-opacity",
783
- "tab": "tab-size",
784
- "underline": "text-decoration-thickness",
785
- "underline-offset": "text-underline-offset",
786
- "grid-cols": "grid-template-columns",
787
- "grid-rows": "grid-template-rows",
788
- "auto-flow": "grid-auto-flow",
789
- "row-start": "grid-row-start",
790
- "row-end": "grid-row-end",
791
- "justify": "justify-content",
792
- "content": "align-content",
793
- "items": "align-items",
794
- "self": "align-self",
795
- "object": "object-fit"
786
+ backface: "backface-visibility",
787
+ break: "word-break",
788
+ case: "text-transform",
789
+ content: "align-content",
790
+ flex: "flex",
791
+ fw: "font-weight",
792
+ items: "align-items",
793
+ justify: "justify-content",
794
+ select: "user-select",
795
+ self: "align-self",
796
+ vertical: "vertical-align",
797
+ visible: "visibility",
798
+ whitespace: "white-space",
799
+ ws: "white-space"
796
800
  };
797
801
  const cssVariables = [
798
- [/^(.+)-\$(.+)$/, ([, name, varname]) => {
802
+ [/^(.+?)-(\$.+)$/, ([, name, varname]) => {
799
803
  const prop = variablesAbbrMap[name];
800
804
  if (prop)
801
- return { [prop]: `var(--${varname})` };
805
+ return { [prop]: handler.cssvar(varname) };
802
806
  }]
803
807
  ];
804
808
  const cssProperty = [
805
- [/^\[(.+):(.+)\]$/, ([, prop, value]) => ({ [prop]: handler.bracket(`[${value}]`) })]
809
+ [/^\[([^:]+):(.+)\]$/, ([, prop, value]) => ({ [prop]: handler.bracket(`[${value}]`) })]
806
810
  ];
807
811
 
808
812
  const questionMark = [
@@ -822,7 +826,7 @@ const textDecorations = [
822
826
  ["line-through", { "text-decoration-line": "line-through" }],
823
827
  ["decoration-underline", { "text-decoration-line": "underline" }],
824
828
  ["decoration-line-through", { "text-decoration-line": "line-through" }],
825
- [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.px(s) })],
829
+ [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.cssvar.px(s) })],
826
830
  [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
827
831
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
828
832
  const result = colorResolver("text-decoration-color", "line")(match, ctx);
@@ -834,7 +838,7 @@ const textDecorations = [
834
838
  }
835
839
  }],
836
840
  [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) })],
837
- [/^underline-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": handler.auto.bracket.px(s) })],
841
+ [/^(?:underline|decoration)-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": handler.auto.bracket.cssvar.px(s) })],
838
842
  [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d })],
839
843
  ["no-underline", { "text-decoration": "none" }],
840
844
  ["decoration-none", { "text-decoration": "none" }]
@@ -844,9 +848,9 @@ const svgUtilities = [
844
848
  [/^fill-(.+)$/, colorResolver("fill", "fill")],
845
849
  [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
846
850
  ["fill-none", { fill: "none" }],
847
- [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.fraction.px.number(s) })],
848
- [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": handler.bracket.number(s) })],
849
- [/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": handler.bracket.px.numberWithUnit(s) })],
851
+ [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.cssvar.fraction.px.number(s) })],
852
+ [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": handler.bracket.cssvar.number(s) })],
853
+ [/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": handler.bracket.cssvar.px.numberWithUnit(s) })],
850
854
  [/^stroke-(.+)$/, colorResolver("stroke", "stroke")],
851
855
  [/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": handler.bracket.percent(opacity) })],
852
856
  ["stroke-cap-square", { "stroke-linecap": "square" }],
@@ -43,9 +43,19 @@ const variantCombinators = [
43
43
  variants$1.variantMatcher("next", (input) => `${input}+*`),
44
44
  variants$1.variantMatcher("sibling", (input) => `${input}+*`),
45
45
  variants$1.variantMatcher("siblings", (input) => `${input}~*`),
46
- variants$1.variantMatcher("svg", (input) => `${input} svg *`)
46
+ variants$1.variantMatcher("svg", (input) => `${input} svg`)
47
47
  ];
48
48
 
49
+ const variantMotions = [
50
+ variants$1.variantParentMatcher("motion-reduce", "@media (prefers-reduced-motion: reduce)"),
51
+ variants$1.variantParentMatcher("motion-safe", "@media (prefers-reduced-motion: no-preference)")
52
+ ];
53
+ const variantOrientations = [
54
+ variants$1.variantParentMatcher("landscape", "@media (orientation: landscape)"),
55
+ variants$1.variantParentMatcher("portrait", "@media (orientation: portrait)")
56
+ ];
57
+ const variantPrint = variants$1.variantParentMatcher("print", "@media print");
58
+
49
59
  const variantColorsMediaOrClass = (options = {}) => {
50
60
  if (options?.dark === "class") {
51
61
  return [
@@ -98,19 +108,6 @@ const variantNegative = {
98
108
  }
99
109
  };
100
110
 
101
- const variantMotions = [
102
- variants$1.variantParentMatcher("motion-reduce", "@media (prefers-reduced-motion: reduce)"),
103
- variants$1.variantParentMatcher("motion-safe", "@media (prefers-reduced-motion: no-preference)")
104
- ];
105
-
106
- const variantOrientations = [
107
- variants$1.variantParentMatcher("landscape", "@media (orientation: landscape)"),
108
- variants$1.variantParentMatcher("portrait", "@media (orientation: portrait)")
109
- ];
110
-
111
- const variantPrint = variants$1.variantParentMatcher("print", "@media print");
112
-
113
- const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
114
111
  const PseudoClasses = Object.fromEntries([
115
112
  "any-link",
116
113
  "link",
@@ -173,9 +170,6 @@ const PartClassesRE = /(part-\[(.+)]:)(.+)/;
173
170
  const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
174
171
  const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
175
172
  const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
176
- function shouldAdd(entires) {
177
- return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
178
- }
179
173
  const taggedPseudoClassMatcher = (tag, parent, combinator) => {
180
174
  const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
181
175
  const rawRe = new RegExp(`^${core.escapeRegExp(parent)}:`);
@@ -187,9 +181,7 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
187
181
  pseudo = `:${match[2]}(${pseudo})`;
188
182
  return {
189
183
  matcher: input.slice(match[1].length + tag.length + 2),
190
- selector: (s, body) => {
191
- return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`;
192
- }
184
+ selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`
193
185
  };
194
186
  }
195
187
  };
@@ -211,7 +203,7 @@ const variantPseudoClasses = {
211
203
  const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
212
204
  return {
213
205
  matcher: input.slice(match[1].length + 1),
214
- selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
206
+ selector: (s) => `${s}${pseudo}`
215
207
  };
216
208
  }
217
209
  },
@@ -225,7 +217,7 @@ const variantPseudoClassFunctions = {
225
217
  const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
226
218
  return {
227
219
  matcher: input.slice(match[1].length + match[2].length + 2),
228
- selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
220
+ selector: (s) => `${s}:${fn}(${pseudo})`
229
221
  };
230
222
  }
231
223
  },
@@ -251,9 +243,7 @@ const partClasses = {
251
243
  const part = `part(${match[2]})`;
252
244
  return {
253
245
  matcher: input.slice(match[1].length),
254
- selector: (s, body) => {
255
- return shouldAdd(body) && `${s}::${part}`;
256
- }
246
+ selector: (s) => `${s}::${part}`
257
247
  };
258
248
  }
259
249
  },
@@ -277,7 +267,6 @@ const variants = (options) => [
277
267
  ...variantLanguageDirections
278
268
  ];
279
269
 
280
- exports.CONTROL_BYPASS_PSEUDO_CLASS = CONTROL_BYPASS_PSEUDO_CLASS;
281
270
  exports.partClasses = partClasses;
282
271
  exports.variantBreakpoints = variantBreakpoints;
283
272
  exports.variantColorsMediaOrClass = variantColorsMediaOrClass;
@@ -41,9 +41,19 @@ const variantCombinators = [
41
41
  variantMatcher("next", (input) => `${input}+*`),
42
42
  variantMatcher("sibling", (input) => `${input}+*`),
43
43
  variantMatcher("siblings", (input) => `${input}~*`),
44
- variantMatcher("svg", (input) => `${input} svg *`)
44
+ variantMatcher("svg", (input) => `${input} svg`)
45
45
  ];
46
46
 
47
+ const variantMotions = [
48
+ variantParentMatcher("motion-reduce", "@media (prefers-reduced-motion: reduce)"),
49
+ variantParentMatcher("motion-safe", "@media (prefers-reduced-motion: no-preference)")
50
+ ];
51
+ const variantOrientations = [
52
+ variantParentMatcher("landscape", "@media (orientation: landscape)"),
53
+ variantParentMatcher("portrait", "@media (orientation: portrait)")
54
+ ];
55
+ const variantPrint = variantParentMatcher("print", "@media print");
56
+
47
57
  const variantColorsMediaOrClass = (options = {}) => {
48
58
  if (options?.dark === "class") {
49
59
  return [
@@ -96,19 +106,6 @@ const variantNegative = {
96
106
  }
97
107
  };
98
108
 
99
- const variantMotions = [
100
- variantParentMatcher("motion-reduce", "@media (prefers-reduced-motion: reduce)"),
101
- variantParentMatcher("motion-safe", "@media (prefers-reduced-motion: no-preference)")
102
- ];
103
-
104
- const variantOrientations = [
105
- variantParentMatcher("landscape", "@media (orientation: landscape)"),
106
- variantParentMatcher("portrait", "@media (orientation: portrait)")
107
- ];
108
-
109
- const variantPrint = variantParentMatcher("print", "@media print");
110
-
111
- const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
112
109
  const PseudoClasses = Object.fromEntries([
113
110
  "any-link",
114
111
  "link",
@@ -171,9 +168,6 @@ const PartClassesRE = /(part-\[(.+)]:)(.+)/;
171
168
  const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
172
169
  const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
173
170
  const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
174
- function shouldAdd(entires) {
175
- return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
176
- }
177
171
  const taggedPseudoClassMatcher = (tag, parent, combinator) => {
178
172
  const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
179
173
  const rawRe = new RegExp(`^${escapeRegExp(parent)}:`);
@@ -185,9 +179,7 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
185
179
  pseudo = `:${match[2]}(${pseudo})`;
186
180
  return {
187
181
  matcher: input.slice(match[1].length + tag.length + 2),
188
- selector: (s, body) => {
189
- return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`;
190
- }
182
+ selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`
191
183
  };
192
184
  }
193
185
  };
@@ -209,7 +201,7 @@ const variantPseudoClasses = {
209
201
  const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
210
202
  return {
211
203
  matcher: input.slice(match[1].length + 1),
212
- selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
204
+ selector: (s) => `${s}${pseudo}`
213
205
  };
214
206
  }
215
207
  },
@@ -223,7 +215,7 @@ const variantPseudoClassFunctions = {
223
215
  const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
224
216
  return {
225
217
  matcher: input.slice(match[1].length + match[2].length + 2),
226
- selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
218
+ selector: (s) => `${s}:${fn}(${pseudo})`
227
219
  };
228
220
  }
229
221
  },
@@ -249,9 +241,7 @@ const partClasses = {
249
241
  const part = `part(${match[2]})`;
250
242
  return {
251
243
  matcher: input.slice(match[1].length),
252
- selector: (s, body) => {
253
- return shouldAdd(body) && `${s}::${part}`;
254
- }
244
+ selector: (s) => `${s}::${part}`
255
245
  };
256
246
  }
257
247
  },
@@ -275,4 +265,4 @@ const variants = (options) => [
275
265
  ...variantLanguageDirections
276
266
  ];
277
267
 
278
- export { CONTROL_BYPASS_PSEUDO_CLASS as C, variantBreakpoints as a, variantCombinators as b, variantColorsMediaOrClass as c, variantLanguageDirections as d, variantImportant as e, variantNegative as f, variantMotions as g, variantOrientations as h, variantPrint as i, variantPseudoElements as j, variantPseudoClasses as k, variantPseudoClassFunctions as l, variantTaggedPseudoClasses as m, partClasses as p, variants as v };
268
+ export { variantBreakpoints as a, variantCombinators as b, variantMotions as c, variantOrientations as d, variantPrint as e, variantColorsMediaOrClass as f, variantLanguageDirections as g, variantImportant as h, variantNegative as i, variantPseudoElements as j, variantPseudoClasses as k, variantPseudoClassFunctions as l, variantTaggedPseudoClasses as m, partClasses as p, variants as v };