@unocss/preset-mini 0.22.3 → 0.22.7

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.
@@ -124,6 +124,13 @@ const boxShadow = {
124
124
  "inner": "inset 0 2px 4px 0 rgba(0,0,0,0.05)",
125
125
  "none": "0 0 #0000"
126
126
  };
127
+ const easing = {
128
+ "DEFAULT": "cubic-bezier(0.4, 0, 0.2, 1)",
129
+ "linear": "linear",
130
+ "in": "cubic-bezier(0.4, 0, 1, 1)",
131
+ "out": "cubic-bezier(0, 0, 0.2, 1)",
132
+ "in-out": "cubic-bezier(0.4, 0, 0.2, 1)"
133
+ };
127
134
 
128
135
  const blur = {
129
136
  "DEFAULT": "8px",
@@ -206,7 +213,8 @@ const theme = {
206
213
  textShadow,
207
214
  textStrokeWidth,
208
215
  blur,
209
- dropShadow
216
+ dropShadow,
217
+ easing
210
218
  };
211
219
 
212
220
  exports.baseSize = baseSize;
@@ -215,6 +223,7 @@ exports.borderRadius = borderRadius;
215
223
  exports.boxShadow = boxShadow;
216
224
  exports.breakpoints = breakpoints;
217
225
  exports.dropShadow = dropShadow;
226
+ exports.easing = easing;
218
227
  exports.fontFamily = fontFamily;
219
228
  exports.fontSize = fontSize;
220
229
  exports.height = height;
@@ -122,6 +122,13 @@ const boxShadow = {
122
122
  "inner": "inset 0 2px 4px 0 rgba(0,0,0,0.05)",
123
123
  "none": "0 0 #0000"
124
124
  };
125
+ const easing = {
126
+ "DEFAULT": "cubic-bezier(0.4, 0, 0.2, 1)",
127
+ "linear": "linear",
128
+ "in": "cubic-bezier(0.4, 0, 1, 1)",
129
+ "out": "cubic-bezier(0, 0, 0.2, 1)",
130
+ "in-out": "cubic-bezier(0.4, 0, 0.2, 1)"
131
+ };
125
132
 
126
133
  const blur = {
127
134
  "DEFAULT": "8px",
@@ -204,7 +211,8 @@ const theme = {
204
211
  textShadow,
205
212
  textStrokeWidth,
206
213
  blur,
207
- dropShadow
214
+ dropShadow,
215
+ easing
208
216
  };
209
217
 
210
- export { fontSize as a, blur as b, textIndent as c, dropShadow as d, textStrokeWidth as e, fontFamily as f, textShadow as g, letterSpacing as h, breakpoints as i, borderRadius as j, boxShadow as k, lineHeight as l, baseSize as m, width as n, maxWidth as o, height as p, maxHeight as q, theme as t, wordSpacing as w };
218
+ export { fontSize as a, blur as b, textIndent as c, dropShadow as d, textStrokeWidth as e, fontFamily as f, textShadow as g, letterSpacing as h, breakpoints as i, borderRadius as j, boxShadow as k, lineHeight as l, easing as m, baseSize as n, width as o, maxWidth as p, height as q, maxHeight as r, theme as t, wordSpacing as w };
@@ -19,9 +19,9 @@ const textAligns = [
19
19
  ];
20
20
 
21
21
  const outline = [
22
- [/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": utilities.handler.bracket.cssvar.auto.fraction.rem(d) })],
22
+ [/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": utilities.handler.bracket.cssvar.px(d) })],
23
23
  [/^outline-(?:color-)?(.+)$/, utilities.colorResolver("outline-color", "outline-color")],
24
- [/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": utilities.handler.bracket.cssvar.auto.fraction.rem(d) })],
24
+ [/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": utilities.handler.bracket.cssvar.px(d) })],
25
25
  ["outline", { "outline-style": "solid" }],
26
26
  [/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
27
27
  ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
@@ -135,7 +135,7 @@ function handlerBorderOpacity([, a = "", opacity]) {
135
135
  return utilities.directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
136
136
  }
137
137
  function handlerRounded([, a = "", s = "DEFAULT"], { theme }) {
138
- const v = theme.borderRadius?.[s] || utilities.handler.bracket.cssvar.auto.fraction.rem(s);
138
+ const v = theme.borderRadius?.[s] || utilities.handler.bracket.cssvar.fraction.rem(s);
139
139
  if (a in utilities.cornerMap && v != null)
140
140
  return utilities.cornerMap[a].map((i) => [`border${i}-radius`, v]);
141
141
  }
@@ -168,19 +168,14 @@ const transitions = [
168
168
  if (p) {
169
169
  return {
170
170
  "transition-property": p,
171
- "transition-timing-function": "cubic-bezier(0.4,0,0.2,1)",
171
+ "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
172
172
  "transition-duration": `${duration}ms`
173
173
  };
174
174
  }
175
175
  }],
176
176
  [/^(?:transition-)?duration-(.+)$/, ([, d]) => ({ "transition-duration": utilities.handler.bracket.cssvar.time(d) })],
177
177
  [/^(?:transition-)?delay-(.+)$/, ([, d]) => ({ "transition-delay": utilities.handler.bracket.cssvar.time(d) })],
178
- [/^ease-(.+)$/, ([, d]) => ({ "transition-timing-function": utilities.handler.bracket.cssvar(d) })],
179
- ["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
180
- ["ease-linear", { "transition-timing-function": "linear" }],
181
- ["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
182
- ["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
183
- ["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
178
+ [/^(?:transition-)?ease(?:-(.+))?$/, ([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? utilities.handler.bracket.cssvar(d) })],
184
179
  [/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) })],
185
180
  ["transition-property-none", { "transition-property": "none" }],
186
181
  ["property-none", { "transition-property": "none" }],
@@ -343,13 +338,13 @@ const fonts = [
343
338
  "line-height": height
344
339
  };
345
340
  }
346
- return { "font-size": utilities.handler.bracket.auto.rem(s) };
341
+ return { "font-size": utilities.handler.bracket.rem(s) };
347
342
  }],
348
- [/^text-size-(.+)$/, ([, s]) => ({ "font-size": utilities.handler.bracket.cssvar.auto.rem(s) })],
343
+ [/^text-size-(.+)$/, ([, s]) => ({ "font-size": utilities.handler.bracket.cssvar.rem(s) })],
349
344
  [/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || utilities.handler.number(s) })],
350
- [/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || utilities.handler.bracket.auto.rem(s) })],
351
- [/^tracking-([^-]+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || utilities.handler.bracket.auto.rem(s) })],
352
- [/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s) })]
345
+ [/^(?:leading|lh)-(.+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || utilities.handler.bracket.cssvar.rem(s) })],
346
+ [/^tracking-(.+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || utilities.handler.bracket.cssvar.rem(s) })],
347
+ [/^word-spacing-(.+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || utilities.handler.bracket.cssvar.rem(s) })]
353
348
  ];
354
349
  const tabSizes = [
355
350
  [/^tab(?:-(.+))?$/, ([, s]) => {
@@ -364,7 +359,7 @@ const tabSizes = [
364
359
  }]
365
360
  ];
366
361
  const textIndents = [
367
- [/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.auto.fraction.rem(s) })]
362
+ [/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.rem(s) })]
368
363
  ];
369
364
  const textStrokes = [
370
365
  [/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.px(s) })],
@@ -392,7 +387,7 @@ const directions = {
392
387
  "y": "row-"
393
388
  };
394
389
  const handleGap = ([, d = "", s]) => {
395
- const v = utilities.handler.bracket.cssvar.auto.rem(s);
390
+ const v = utilities.handler.bracket.cssvar.rem(s);
396
391
  if (v != null) {
397
392
  return {
398
393
  [`grid-${directions[d]}gap`]: v,
@@ -554,11 +549,12 @@ const boxSizing = [
554
549
  ];
555
550
 
556
551
  const ringBase = {
552
+ ...shadowBase,
557
553
  "--un-ring-inset": varEmpty,
558
554
  "--un-ring-offset-width": "0px",
559
555
  "--un-ring-offset-color": "#fff",
560
- "--un-ring-color": "rgba(147,197,253,0.5)",
561
- ...shadowBase
556
+ "--un-ring-width": "0px",
557
+ "--un-ring-color": "rgba(147,197,253,0.5)"
562
558
  };
563
559
  const rings = [
564
560
  [/^ring(?:-(.+))?$/, ([, d]) => {
@@ -567,13 +563,15 @@ const rings = [
567
563
  return [
568
564
  ringBase,
569
565
  {
566
+ "--un-ring-width": value,
570
567
  "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
571
- "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
568
+ "--un-ring-shadow": "var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color)",
572
569
  "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
573
570
  }
574
571
  ];
575
572
  }
576
573
  }],
574
+ [/^ring-(?:width-|size-)(.+)$/, ([, d]) => ({ "--un-ring-width": utilities.handler.bracket.cssvar.px(d) })],
577
575
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
578
576
  [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d]) => ({ "--un-ring-offset-width": utilities.handler.bracket.cssvar.px(d) })],
579
577
  [/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring")],
@@ -687,8 +685,8 @@ const transformBase = {
687
685
  [core.CONTROL_SHORTCUT_NO_MERGE]: ""
688
686
  };
689
687
  const transforms = [
690
- [/^origin-(.+)$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] ?? utilities.handler.bracket.cssvar(s) })],
691
- [/^perspect-(.+)$/, ([, s]) => {
688
+ [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] ?? utilities.handler.bracket.cssvar(s) })],
689
+ [/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
692
690
  const v = utilities.handler.bracket.cssvar.px.numberWithUnit(s);
693
691
  if (v != null) {
694
692
  return {
@@ -697,7 +695,7 @@ const transforms = [
697
695
  };
698
696
  }
699
697
  }],
700
- [/^perspect-origin-(.+)$/, ([, s]) => {
698
+ [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
701
699
  const v = utilities.handler.bracket.cssvar(s) ?? (s.length >= 3 ? utilities.positionMap[s] : void 0);
702
700
  if (v != null) {
703
701
  return {
@@ -706,15 +704,15 @@ const transforms = [
706
704
  };
707
705
  }
708
706
  }],
709
- [/^translate-()(.+)$/, handleTranslate],
710
- [/^translate-([xyz])-(.+)$/, handleTranslate],
711
- [/^rotate-()(.+)$/, handleRotate],
712
- [/^rotate(-[xyz])-(.+)$/, handleRotate],
713
- [/^skew-([xy])-(.+)$/, handleSkew],
714
- [/^scale-()(.+)$/, handleScale],
715
- [/^scale-([xyz])-(.+)$/, handleScale],
716
- ["preserve-3d", { "transform-style": "preserve-3d" }],
717
- ["preserve-flat", { "transform-style": "flat" }],
707
+ [/^(?:transform-)?translate-()(.+)$/, handleTranslate],
708
+ [/^(?:transform-)?translate-([xyz])-(.+)$/, handleTranslate],
709
+ [/^(?:transform-)?rotate-()(.+)$/, handleRotate],
710
+ [/^(?:transform-)?rotate-([xyz])-(.+)$/, handleRotate],
711
+ [/^(?:transform-)?skew-([xy])-(.+)$/, handleSkew],
712
+ [/^(?:transform-)?scale-()(.+)$/, handleScale],
713
+ [/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale],
714
+ [/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
715
+ [/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
718
716
  [/^transform$/, () => [
719
717
  transformBase,
720
718
  { transform: "var(--un-transform)" }
@@ -747,16 +745,30 @@ function handleScale([, d, b]) {
747
745
  ];
748
746
  }
749
747
  }
750
- function handleRotate([, d, b]) {
748
+ function handleRotate([, d = "", b]) {
751
749
  const v = utilities.handler.bracket.cssvar.degree(b);
752
750
  if (v != null) {
753
- return [
754
- transformBase,
755
- {
756
- [`--un-rotate${d || ""}`]: v,
757
- transform: "var(--un-transform)"
758
- }
759
- ];
751
+ if (d) {
752
+ return [
753
+ transformBase,
754
+ {
755
+ "--un-rotate": 0,
756
+ [`--un-rotate-${d}`]: v,
757
+ "transform": "var(--un-transform)"
758
+ }
759
+ ];
760
+ } else {
761
+ return [
762
+ transformBase,
763
+ {
764
+ "--un-rotate-x": 0,
765
+ "--un-rotate-y": 0,
766
+ "--un-rotate-z": 0,
767
+ "--un-rotate": v,
768
+ "transform": "var(--un-transform)"
769
+ }
770
+ ];
771
+ }
760
772
  }
761
773
  }
762
774
  function handleSkew([, d, b]) {
@@ -773,30 +785,26 @@ function handleSkew([, d, b]) {
773
785
  }
774
786
 
775
787
  const variablesAbbrMap = {
776
- "backface": "backface-visibility",
777
- "break": "word-break",
778
- "case": "text-transform",
779
- "content": "align-content",
780
- "flex": "flex",
781
- "fw": "font-weight",
782
- "items": "align-items",
783
- "justify": "justify-content",
784
- "leading": "line-height",
785
- "lh": "line-height",
786
- "select": "user-select",
787
- "self": "align-self",
788
- "tracking": "letter-spacing",
789
- "vertical": "vertical-align",
790
- "visible": "visibility",
791
- "whitespace": "white-space",
792
- "word-spacing": "word-spacing",
793
- "ws": "white-space"
788
+ backface: "backface-visibility",
789
+ break: "word-break",
790
+ case: "text-transform",
791
+ content: "align-content",
792
+ flex: "flex",
793
+ fw: "font-weight",
794
+ items: "align-items",
795
+ justify: "justify-content",
796
+ select: "user-select",
797
+ self: "align-self",
798
+ vertical: "vertical-align",
799
+ visible: "visibility",
800
+ whitespace: "white-space",
801
+ ws: "white-space"
794
802
  };
795
803
  const cssVariables = [
796
- [/^([^$]+)(?<=-)\$(.+)$/, ([, name, varname]) => {
797
- const prop = variablesAbbrMap[name.slice(0, -1)];
804
+ [/^(.+?)-(\$.+)$/, ([, name, varname]) => {
805
+ const prop = variablesAbbrMap[name];
798
806
  if (prop)
799
- return { [prop]: `var(--${varname})` };
807
+ return { [prop]: utilities.handler.cssvar(varname) };
800
808
  }]
801
809
  ];
802
810
  const cssProperty = [
@@ -832,7 +840,7 @@ const textDecorations = [
832
840
  }
833
841
  }],
834
842
  [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) })],
835
- [/^underline-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": utilities.handler.auto.bracket.cssvar.px(s) })],
843
+ [/^(?:underline|decoration)-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": utilities.handler.auto.bracket.cssvar.px(s) })],
836
844
  [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d })],
837
845
  ["no-underline", { "text-decoration": "none" }],
838
846
  ["decoration-none", { "text-decoration": "none" }]
@@ -842,7 +850,7 @@ const svgUtilities = [
842
850
  [/^fill-(.+)$/, utilities.colorResolver("fill", "fill")],
843
851
  [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
844
852
  ["fill-none", { fill: "none" }],
845
- [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": utilities.handler.bracket.fraction.px.number(s) })],
853
+ [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": utilities.handler.bracket.cssvar.fraction.px.number(s) })],
846
854
  [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": utilities.handler.bracket.cssvar.number(s) })],
847
855
  [/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": utilities.handler.bracket.cssvar.px.numberWithUnit(s) })],
848
856
  [/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke")],
@@ -17,9 +17,9 @@ const textAligns = [
17
17
  ];
18
18
 
19
19
  const outline = [
20
- [/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": handler.bracket.cssvar.auto.fraction.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.cssvar.auto.fraction.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" }]
@@ -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.bracket.cssvar.auto.fraction.rem(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
  }
@@ -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
174
  [/^(?:transition-)?duration-(.+)$/, ([, d]) => ({ "transition-duration": handler.bracket.cssvar.time(d) })],
175
175
  [/^(?:transition-)?delay-(.+)$/, ([, d]) => ({ "transition-delay": handler.bracket.cssvar.time(d) })],
176
- [/^ease-(.+)$/, ([, d]) => ({ "transition-timing-function": handler.bracket.cssvar(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)" }],
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" }],
@@ -341,13 +336,13 @@ 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.cssvar.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
348
  [/^tab(?:-(.+))?$/, ([, s]) => {
@@ -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.auto.fraction.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.cssvar.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,
@@ -552,11 +547,12 @@ const boxSizing = [
552
547
  ];
553
548
 
554
549
  const ringBase = {
550
+ ...shadowBase,
555
551
  "--un-ring-inset": varEmpty,
556
552
  "--un-ring-offset-width": "0px",
557
553
  "--un-ring-offset-color": "#fff",
558
- "--un-ring-color": "rgba(147,197,253,0.5)",
559
- ...shadowBase
554
+ "--un-ring-width": "0px",
555
+ "--un-ring-color": "rgba(147,197,253,0.5)"
560
556
  };
561
557
  const rings = [
562
558
  [/^ring(?:-(.+))?$/, ([, d]) => {
@@ -565,13 +561,15 @@ const rings = [
565
561
  return [
566
562
  ringBase,
567
563
  {
564
+ "--un-ring-width": value,
568
565
  "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
569
- "--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)",
570
567
  "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
571
568
  }
572
569
  ];
573
570
  }
574
571
  }],
572
+ [/^ring-(?:width-|size-)(.+)$/, ([, d]) => ({ "--un-ring-width": handler.bracket.cssvar.px(d) })],
575
573
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
576
574
  [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d]) => ({ "--un-ring-offset-width": handler.bracket.cssvar.px(d) })],
577
575
  [/^ring-(.+)$/, colorResolver("--un-ring-color", "ring")],
@@ -685,8 +683,8 @@ const transformBase = {
685
683
  [CONTROL_SHORTCUT_NO_MERGE]: ""
686
684
  };
687
685
  const transforms = [
688
- [/^origin-(.+)$/, ([, s]) => ({ "transform-origin": positionMap[s] ?? handler.bracket.cssvar(s) })],
689
- [/^perspect-(.+)$/, ([, s]) => {
686
+ [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": positionMap[s] ?? handler.bracket.cssvar(s) })],
687
+ [/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
690
688
  const v = handler.bracket.cssvar.px.numberWithUnit(s);
691
689
  if (v != null) {
692
690
  return {
@@ -695,7 +693,7 @@ const transforms = [
695
693
  };
696
694
  }
697
695
  }],
698
- [/^perspect-origin-(.+)$/, ([, s]) => {
696
+ [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
699
697
  const v = handler.bracket.cssvar(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
700
698
  if (v != null) {
701
699
  return {
@@ -704,15 +702,15 @@ const transforms = [
704
702
  };
705
703
  }
706
704
  }],
707
- [/^translate-()(.+)$/, handleTranslate],
708
- [/^translate-([xyz])-(.+)$/, handleTranslate],
709
- [/^rotate-()(.+)$/, handleRotate],
710
- [/^rotate(-[xyz])-(.+)$/, handleRotate],
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)" }
@@ -745,16 +743,30 @@ function handleScale([, d, b]) {
745
743
  ];
746
744
  }
747
745
  }
748
- function handleRotate([, d, b]) {
746
+ function handleRotate([, d = "", b]) {
749
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]) {
@@ -771,30 +783,26 @@ function handleSkew([, d, b]) {
771
783
  }
772
784
 
773
785
  const variablesAbbrMap = {
774
- "backface": "backface-visibility",
775
- "break": "word-break",
776
- "case": "text-transform",
777
- "content": "align-content",
778
- "flex": "flex",
779
- "fw": "font-weight",
780
- "items": "align-items",
781
- "justify": "justify-content",
782
- "leading": "line-height",
783
- "lh": "line-height",
784
- "select": "user-select",
785
- "self": "align-self",
786
- "tracking": "letter-spacing",
787
- "vertical": "vertical-align",
788
- "visible": "visibility",
789
- "whitespace": "white-space",
790
- "word-spacing": "word-spacing",
791
- "ws": "white-space"
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"
792
800
  };
793
801
  const cssVariables = [
794
- [/^([^$]+)(?<=-)\$(.+)$/, ([, name, varname]) => {
795
- const prop = variablesAbbrMap[name.slice(0, -1)];
802
+ [/^(.+?)-(\$.+)$/, ([, name, varname]) => {
803
+ const prop = variablesAbbrMap[name];
796
804
  if (prop)
797
- return { [prop]: `var(--${varname})` };
805
+ return { [prop]: handler.cssvar(varname) };
798
806
  }]
799
807
  ];
800
808
  const cssProperty = [
@@ -830,7 +838,7 @@ const textDecorations = [
830
838
  }
831
839
  }],
832
840
  [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) })],
833
- [/^underline-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": handler.auto.bracket.cssvar.px(s) })],
841
+ [/^(?:underline|decoration)-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": handler.auto.bracket.cssvar.px(s) })],
834
842
  [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d })],
835
843
  ["no-underline", { "text-decoration": "none" }],
836
844
  ["decoration-none", { "text-decoration": "none" }]
@@ -840,7 +848,7 @@ const svgUtilities = [
840
848
  [/^fill-(.+)$/, colorResolver("fill", "fill")],
841
849
  [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
842
850
  ["fill-none", { fill: "none" }],
843
- [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.fraction.px.number(s) })],
851
+ [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.cssvar.fraction.px.number(s) })],
844
852
  [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": handler.bracket.cssvar.number(s) })],
845
853
  [/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": handler.bracket.cssvar.px.numberWithUnit(s) })],
846
854
  [/^stroke-(.+)$/, colorResolver("stroke", "stroke")],
@@ -43,7 +43,7 @@ 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
49
  const variantMotions = [
@@ -74,6 +74,17 @@ const variantLanguageDirections = [
74
74
  variants$1.variantMatcher("ltr", (input) => `[dir="ltr"] $$ ${input}`)
75
75
  ];
76
76
 
77
+ const variantLayer = {
78
+ match(matcher) {
79
+ const match = matcher.match(/layer-([\d\w]+)[:-]/);
80
+ if (match) {
81
+ return {
82
+ matcher: matcher.slice(match[0].length),
83
+ layer: match[1]
84
+ };
85
+ }
86
+ }
87
+ };
77
88
  const variantImportant = {
78
89
  match(matcher) {
79
90
  if (matcher.startsWith("!")) {
@@ -233,6 +244,10 @@ const variantTaggedPseudoClasses = (options = {}) => {
233
244
  {
234
245
  match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
235
246
  multiPass: true
247
+ },
248
+ {
249
+ match: taggedPseudoClassMatcher("parent", attributify ? '[parent=""]' : ".parent", ">"),
250
+ multiPass: true
236
251
  }
237
252
  ];
238
253
  };
@@ -251,6 +266,7 @@ const partClasses = {
251
266
  };
252
267
 
253
268
  const variants = (options) => [
269
+ variantLayer,
254
270
  variantNegative,
255
271
  variantImportant,
256
272
  variantPrint,
@@ -273,6 +289,7 @@ exports.variantColorsMediaOrClass = variantColorsMediaOrClass;
273
289
  exports.variantCombinators = variantCombinators;
274
290
  exports.variantImportant = variantImportant;
275
291
  exports.variantLanguageDirections = variantLanguageDirections;
292
+ exports.variantLayer = variantLayer;
276
293
  exports.variantMotions = variantMotions;
277
294
  exports.variantNegative = variantNegative;
278
295
  exports.variantOrientations = variantOrientations;