@unocss/preset-mini 0.22.4 → 0.23.0

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.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.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" }]
@@ -155,6 +155,7 @@ const bgColors = [
155
155
  const transitionPropertyGroup = {
156
156
  all: "all",
157
157
  colors: ["color", "background-color", "border-color", "text-decoration-color", "fill", "stroke"].join(","),
158
+ none: "none",
158
159
  opacity: "opacity",
159
160
  shadow: "box-shadow",
160
161
  transform: "transform"
@@ -168,22 +169,15 @@ const transitions = [
168
169
  if (p) {
169
170
  return {
170
171
  "transition-property": p,
171
- "transition-timing-function": "cubic-bezier(0.4,0,0.2,1)",
172
+ "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
172
173
  "transition-duration": `${duration}ms`
173
174
  };
174
175
  }
175
176
  }],
176
177
  [/^(?:transition-)?duration-(.+)$/, ([, d]) => ({ "transition-duration": utilities.handler.bracket.cssvar.time(d) })],
177
178
  [/^(?: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)" }],
179
+ [/^(?:transition-)?ease(?:-(.+))?$/, ([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? utilities.handler.bracket.cssvar(d) })],
184
180
  [/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) })],
185
- ["transition-property-none", { "transition-property": "none" }],
186
- ["property-none", { "transition-property": "none" }],
187
181
  ["transition-none", { transition: "none" }]
188
182
  ];
189
183
 
@@ -218,7 +212,8 @@ const displays = [
218
212
  ["contents", { display: "contents" }],
219
213
  ["flow-root", { display: "flow-root" }],
220
214
  ["list-item", { display: "list-item" }],
221
- ["hidden", { display: "none" }]
215
+ ["hidden", { display: "none" }],
216
+ [/^display-(.+)$/, ([, c]) => ({ display: utilities.handler.bracket.cssvar(c) || c })]
222
217
  ];
223
218
  const appearances = [
224
219
  ["visible", { visibility: "visible" }],
@@ -347,9 +342,9 @@ const fonts = [
347
342
  }],
348
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.rem(s) })],
351
- [/^tracking-([^-]+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || utilities.handler.bracket.rem(s) })],
352
- [/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || utilities.handler.bracket.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]) => {
@@ -545,8 +540,7 @@ const floats = [
545
540
  ["clear-none", { clear: "none" }]
546
541
  ];
547
542
  const zIndexes = [
548
- [/^z-(.+)$/, ([, v]) => ({ "z-index": utilities.handler.bracket.cssvar.number(v) })],
549
- ["z-auto", { "z-index": "auto" }]
543
+ [/^z-(.+)$/, ([, v]) => ({ "z-index": utilities.handler.bracket.cssvar.auto.number(v) })]
550
544
  ];
551
545
  const boxSizing = [
552
546
  ["box-border", { "box-sizing": "border-box" }],
@@ -554,11 +548,12 @@ const boxSizing = [
554
548
  ];
555
549
 
556
550
  const ringBase = {
551
+ ...shadowBase,
557
552
  "--un-ring-inset": varEmpty,
558
553
  "--un-ring-offset-width": "0px",
559
554
  "--un-ring-offset-color": "#fff",
560
- "--un-ring-color": "rgba(147,197,253,0.5)",
561
- ...shadowBase
555
+ "--un-ring-width": "0px",
556
+ "--un-ring-color": "rgba(147,197,253,0.5)"
562
557
  };
563
558
  const rings = [
564
559
  [/^ring(?:-(.+))?$/, ([, d]) => {
@@ -567,13 +562,15 @@ const rings = [
567
562
  return [
568
563
  ringBase,
569
564
  {
565
+ "--un-ring-width": value,
570
566
  "--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)`,
567
+ "--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
568
  "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
573
569
  }
574
570
  ];
575
571
  }
576
572
  }],
573
+ [/^ring-(?:width-|size-)(.+)$/, ([, d]) => ({ "--un-ring-width": utilities.handler.bracket.cssvar.px(d) })],
577
574
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
578
575
  [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d]) => ({ "--un-ring-offset-width": utilities.handler.bracket.cssvar.px(d) })],
579
576
  [/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring")],
@@ -687,8 +684,8 @@ const transformBase = {
687
684
  [core.CONTROL_SHORTCUT_NO_MERGE]: ""
688
685
  };
689
686
  const transforms = [
690
- [/^origin-(.+)$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] ?? utilities.handler.bracket.cssvar(s) })],
691
- [/^perspect-(.+)$/, ([, s]) => {
687
+ [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] ?? utilities.handler.bracket.cssvar(s) })],
688
+ [/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
692
689
  const v = utilities.handler.bracket.cssvar.px.numberWithUnit(s);
693
690
  if (v != null) {
694
691
  return {
@@ -697,7 +694,7 @@ const transforms = [
697
694
  };
698
695
  }
699
696
  }],
700
- [/^perspect-origin-(.+)$/, ([, s]) => {
697
+ [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
701
698
  const v = utilities.handler.bracket.cssvar(s) ?? (s.length >= 3 ? utilities.positionMap[s] : void 0);
702
699
  if (v != null) {
703
700
  return {
@@ -706,15 +703,15 @@ const transforms = [
706
703
  };
707
704
  }
708
705
  }],
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" }],
706
+ [/^(?:transform-)?translate-()(.+)$/, handleTranslate],
707
+ [/^(?:transform-)?translate-([xyz])-(.+)$/, handleTranslate],
708
+ [/^(?:transform-)?rotate-()(.+)$/, handleRotate],
709
+ [/^(?:transform-)?rotate-([xyz])-(.+)$/, handleRotate],
710
+ [/^(?:transform-)?skew-([xy])-(.+)$/, handleSkew],
711
+ [/^(?:transform-)?scale-()(.+)$/, handleScale],
712
+ [/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale],
713
+ [/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
714
+ [/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
718
715
  [/^transform$/, () => [
719
716
  transformBase,
720
717
  { transform: "var(--un-transform)" }
@@ -787,30 +784,26 @@ function handleSkew([, d, b]) {
787
784
  }
788
785
 
789
786
  const variablesAbbrMap = {
790
- "backface": "backface-visibility",
791
- "break": "word-break",
792
- "case": "text-transform",
793
- "content": "align-content",
794
- "flex": "flex",
795
- "fw": "font-weight",
796
- "items": "align-items",
797
- "justify": "justify-content",
798
- "leading": "line-height",
799
- "lh": "line-height",
800
- "select": "user-select",
801
- "self": "align-self",
802
- "tracking": "letter-spacing",
803
- "vertical": "vertical-align",
804
- "visible": "visibility",
805
- "whitespace": "white-space",
806
- "word-spacing": "word-spacing",
807
- "ws": "white-space"
787
+ backface: "backface-visibility",
788
+ break: "word-break",
789
+ case: "text-transform",
790
+ content: "align-content",
791
+ flex: "flex",
792
+ fw: "font-weight",
793
+ items: "align-items",
794
+ justify: "justify-content",
795
+ select: "user-select",
796
+ self: "align-self",
797
+ vertical: "vertical-align",
798
+ visible: "visibility",
799
+ whitespace: "white-space",
800
+ ws: "white-space"
808
801
  };
809
802
  const cssVariables = [
810
- [/^([^$]+)(?<=-)\$(.+)$/, ([, name, varname]) => {
811
- const prop = variablesAbbrMap[name.slice(0, -1)];
803
+ [/^(.+?)-(\$.+)$/, ([, name, varname]) => {
804
+ const prop = variablesAbbrMap[name];
812
805
  if (prop)
813
- return { [prop]: `var(--${varname})` };
806
+ return { [prop]: utilities.handler.cssvar(varname) };
814
807
  }]
815
808
  ];
816
809
  const cssProperty = [
@@ -829,11 +822,7 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
829
822
  ];
830
823
 
831
824
  const textDecorations = [
832
- ["underline", { "text-decoration-line": "underline" }],
833
- ["overline", { "text-decoration-line": "overline" }],
834
- ["line-through", { "text-decoration-line": "line-through" }],
835
- ["decoration-underline", { "text-decoration-line": "underline" }],
836
- ["decoration-line-through", { "text-decoration-line": "line-through" }],
825
+ [/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s })],
837
826
  [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": utilities.handler.bracket.cssvar.px(s) })],
838
827
  [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
839
828
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
@@ -856,7 +845,7 @@ const svgUtilities = [
856
845
  [/^fill-(.+)$/, utilities.colorResolver("fill", "fill")],
857
846
  [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
858
847
  ["fill-none", { fill: "none" }],
859
- [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": utilities.handler.bracket.fraction.px.number(s) })],
848
+ [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": utilities.handler.bracket.cssvar.fraction.px.number(s) })],
860
849
  [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": utilities.handler.bracket.cssvar.number(s) })],
861
850
  [/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": utilities.handler.bracket.cssvar.px.numberWithUnit(s) })],
862
851
  [/^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.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.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" }]
@@ -153,6 +153,7 @@ const bgColors = [
153
153
  const transitionPropertyGroup = {
154
154
  all: "all",
155
155
  colors: ["color", "background-color", "border-color", "text-decoration-color", "fill", "stroke"].join(","),
156
+ none: "none",
156
157
  opacity: "opacity",
157
158
  shadow: "box-shadow",
158
159
  transform: "transform"
@@ -166,22 +167,15 @@ const transitions = [
166
167
  if (p) {
167
168
  return {
168
169
  "transition-property": p,
169
- "transition-timing-function": "cubic-bezier(0.4,0,0.2,1)",
170
+ "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
170
171
  "transition-duration": `${duration}ms`
171
172
  };
172
173
  }
173
174
  }],
174
175
  [/^(?:transition-)?duration-(.+)$/, ([, d]) => ({ "transition-duration": handler.bracket.cssvar.time(d) })],
175
176
  [/^(?: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)" }],
177
+ [/^(?:transition-)?ease(?:-(.+))?$/, ([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? handler.bracket.cssvar(d) })],
182
178
  [/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": handler.global(v) || transitionProperty(v) })],
183
- ["transition-property-none", { "transition-property": "none" }],
184
- ["property-none", { "transition-property": "none" }],
185
179
  ["transition-none", { transition: "none" }]
186
180
  ];
187
181
 
@@ -216,7 +210,8 @@ const displays = [
216
210
  ["contents", { display: "contents" }],
217
211
  ["flow-root", { display: "flow-root" }],
218
212
  ["list-item", { display: "list-item" }],
219
- ["hidden", { display: "none" }]
213
+ ["hidden", { display: "none" }],
214
+ [/^display-(.+)$/, ([, c]) => ({ display: handler.bracket.cssvar(c) || c })]
220
215
  ];
221
216
  const appearances = [
222
217
  ["visible", { visibility: "visible" }],
@@ -345,9 +340,9 @@ const fonts = [
345
340
  }],
346
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.rem(s) })],
349
- [/^tracking-([^-]+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || handler.bracket.rem(s) })],
350
- [/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || handler.bracket.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]) => {
@@ -543,8 +538,7 @@ const floats = [
543
538
  ["clear-none", { clear: "none" }]
544
539
  ];
545
540
  const zIndexes = [
546
- [/^z-(.+)$/, ([, v]) => ({ "z-index": handler.bracket.cssvar.number(v) })],
547
- ["z-auto", { "z-index": "auto" }]
541
+ [/^z-(.+)$/, ([, v]) => ({ "z-index": handler.bracket.cssvar.auto.number(v) })]
548
542
  ];
549
543
  const boxSizing = [
550
544
  ["box-border", { "box-sizing": "border-box" }],
@@ -552,11 +546,12 @@ const boxSizing = [
552
546
  ];
553
547
 
554
548
  const ringBase = {
549
+ ...shadowBase,
555
550
  "--un-ring-inset": varEmpty,
556
551
  "--un-ring-offset-width": "0px",
557
552
  "--un-ring-offset-color": "#fff",
558
- "--un-ring-color": "rgba(147,197,253,0.5)",
559
- ...shadowBase
553
+ "--un-ring-width": "0px",
554
+ "--un-ring-color": "rgba(147,197,253,0.5)"
560
555
  };
561
556
  const rings = [
562
557
  [/^ring(?:-(.+))?$/, ([, d]) => {
@@ -565,13 +560,15 @@ const rings = [
565
560
  return [
566
561
  ringBase,
567
562
  {
563
+ "--un-ring-width": value,
568
564
  "--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)`,
565
+ "--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
566
  "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
571
567
  }
572
568
  ];
573
569
  }
574
570
  }],
571
+ [/^ring-(?:width-|size-)(.+)$/, ([, d]) => ({ "--un-ring-width": handler.bracket.cssvar.px(d) })],
575
572
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
576
573
  [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d]) => ({ "--un-ring-offset-width": handler.bracket.cssvar.px(d) })],
577
574
  [/^ring-(.+)$/, colorResolver("--un-ring-color", "ring")],
@@ -685,8 +682,8 @@ const transformBase = {
685
682
  [CONTROL_SHORTCUT_NO_MERGE]: ""
686
683
  };
687
684
  const transforms = [
688
- [/^origin-(.+)$/, ([, s]) => ({ "transform-origin": positionMap[s] ?? handler.bracket.cssvar(s) })],
689
- [/^perspect-(.+)$/, ([, s]) => {
685
+ [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": positionMap[s] ?? handler.bracket.cssvar(s) })],
686
+ [/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
690
687
  const v = handler.bracket.cssvar.px.numberWithUnit(s);
691
688
  if (v != null) {
692
689
  return {
@@ -695,7 +692,7 @@ const transforms = [
695
692
  };
696
693
  }
697
694
  }],
698
- [/^perspect-origin-(.+)$/, ([, s]) => {
695
+ [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
699
696
  const v = handler.bracket.cssvar(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
700
697
  if (v != null) {
701
698
  return {
@@ -704,15 +701,15 @@ const transforms = [
704
701
  };
705
702
  }
706
703
  }],
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" }],
704
+ [/^(?:transform-)?translate-()(.+)$/, handleTranslate],
705
+ [/^(?:transform-)?translate-([xyz])-(.+)$/, handleTranslate],
706
+ [/^(?:transform-)?rotate-()(.+)$/, handleRotate],
707
+ [/^(?:transform-)?rotate-([xyz])-(.+)$/, handleRotate],
708
+ [/^(?:transform-)?skew-([xy])-(.+)$/, handleSkew],
709
+ [/^(?:transform-)?scale-()(.+)$/, handleScale],
710
+ [/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale],
711
+ [/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
712
+ [/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
716
713
  [/^transform$/, () => [
717
714
  transformBase,
718
715
  { transform: "var(--un-transform)" }
@@ -785,30 +782,26 @@ function handleSkew([, d, b]) {
785
782
  }
786
783
 
787
784
  const variablesAbbrMap = {
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
- "leading": "line-height",
797
- "lh": "line-height",
798
- "select": "user-select",
799
- "self": "align-self",
800
- "tracking": "letter-spacing",
801
- "vertical": "vertical-align",
802
- "visible": "visibility",
803
- "whitespace": "white-space",
804
- "word-spacing": "word-spacing",
805
- "ws": "white-space"
785
+ backface: "backface-visibility",
786
+ break: "word-break",
787
+ case: "text-transform",
788
+ content: "align-content",
789
+ flex: "flex",
790
+ fw: "font-weight",
791
+ items: "align-items",
792
+ justify: "justify-content",
793
+ select: "user-select",
794
+ self: "align-self",
795
+ vertical: "vertical-align",
796
+ visible: "visibility",
797
+ whitespace: "white-space",
798
+ ws: "white-space"
806
799
  };
807
800
  const cssVariables = [
808
- [/^([^$]+)(?<=-)\$(.+)$/, ([, name, varname]) => {
809
- const prop = variablesAbbrMap[name.slice(0, -1)];
801
+ [/^(.+?)-(\$.+)$/, ([, name, varname]) => {
802
+ const prop = variablesAbbrMap[name];
810
803
  if (prop)
811
- return { [prop]: `var(--${varname})` };
804
+ return { [prop]: handler.cssvar(varname) };
812
805
  }]
813
806
  ];
814
807
  const cssProperty = [
@@ -827,11 +820,7 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
827
820
  ];
828
821
 
829
822
  const textDecorations = [
830
- ["underline", { "text-decoration-line": "underline" }],
831
- ["overline", { "text-decoration-line": "overline" }],
832
- ["line-through", { "text-decoration-line": "line-through" }],
833
- ["decoration-underline", { "text-decoration-line": "underline" }],
834
- ["decoration-line-through", { "text-decoration-line": "line-through" }],
823
+ [/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s })],
835
824
  [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.cssvar.px(s) })],
836
825
  [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
837
826
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
@@ -854,7 +843,7 @@ const svgUtilities = [
854
843
  [/^fill-(.+)$/, colorResolver("fill", "fill")],
855
844
  [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
856
845
  ["fill-none", { fill: "none" }],
857
- [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.fraction.px.number(s) })],
846
+ [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.cssvar.fraction.px.number(s) })],
858
847
  [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": handler.bracket.cssvar.number(s) })],
859
848
  [/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": handler.bracket.cssvar.px.numberWithUnit(s) })],
860
849
  [/^stroke-(.+)$/, colorResolver("stroke", "stroke")],
@@ -37,12 +37,28 @@ const variantBreakpoints = (matcher, { theme }) => {
37
37
  }
38
38
  };
39
39
 
40
+ const scopeMatcher = (strict, name, template) => {
41
+ const re = strict ? new RegExp(`^${name}(?:-\\[(.+?)\\])[:-]`) : new RegExp(`^${name}(?:-\\[(.+?)\\])?[:-]`);
42
+ return (matcher) => {
43
+ const match = matcher.match(re);
44
+ if (match) {
45
+ return {
46
+ matcher: matcher.slice(match[0].length),
47
+ selector: (s) => template.replace("&&-s", s).replace("&&-c", match[1] ?? "*")
48
+ };
49
+ }
50
+ };
51
+ };
40
52
  const variantCombinators = [
41
- variants$1.variantMatcher("all", (input) => `${input} *`),
42
- variants$1.variantMatcher("children", (input) => `${input}>*`),
43
- variants$1.variantMatcher("next", (input) => `${input}+*`),
44
- variants$1.variantMatcher("sibling", (input) => `${input}+*`),
45
- variants$1.variantMatcher("siblings", (input) => `${input}~*`),
53
+ scopeMatcher(false, "all", "&&-s &&-c"),
54
+ scopeMatcher(false, "children", "&&-s>&&-c"),
55
+ scopeMatcher(false, "next", "&&-s+&&-c"),
56
+ scopeMatcher(false, "sibling", "&&-s+&&-c"),
57
+ scopeMatcher(false, "siblings", "&&-s~&&-c"),
58
+ scopeMatcher(true, "group", "&&-c &&-s"),
59
+ scopeMatcher(true, "parent", "&&-c>&&-s"),
60
+ scopeMatcher(true, "previous", "&&-c+&&-s"),
61
+ scopeMatcher(true, "peer", "&&-c~&&-s"),
46
62
  variants$1.variantMatcher("svg", (input) => `${input} svg`)
47
63
  ];
48
64
 
@@ -74,6 +90,17 @@ const variantLanguageDirections = [
74
90
  variants$1.variantMatcher("ltr", (input) => `[dir="ltr"] $$ ${input}`)
75
91
  ];
76
92
 
93
+ const variantLayer = {
94
+ match(matcher) {
95
+ const match = matcher.match(/layer-([\d\w]+)[:-]/);
96
+ if (match) {
97
+ return {
98
+ matcher: matcher.slice(match[0].length),
99
+ layer: match[1]
100
+ };
101
+ }
102
+ }
103
+ };
77
104
  const variantImportant = {
78
105
  match(matcher) {
79
106
  if (matcher.startsWith("!")) {
@@ -180,7 +207,7 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
180
207
  if (match[2])
181
208
  pseudo = `:${match[2]}(${pseudo})`;
182
209
  return {
183
- matcher: input.slice(match[1].length + tag.length + 2),
210
+ matcher: input.slice(match[0].length),
184
211
  selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`
185
212
  };
186
213
  }
@@ -191,7 +218,7 @@ const variantPseudoElements = (input) => {
191
218
  if (match) {
192
219
  const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
193
220
  return {
194
- matcher: input.slice(match[1].length + 1),
221
+ matcher: input.slice(match[0].length),
195
222
  selector: (s) => `${s}${pseudo}`
196
223
  };
197
224
  }
@@ -202,7 +229,7 @@ const variantPseudoClasses = {
202
229
  if (match) {
203
230
  const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
204
231
  return {
205
- matcher: input.slice(match[1].length + 1),
232
+ matcher: input.slice(match[0].length),
206
233
  selector: (s) => `${s}${pseudo}`
207
234
  };
208
235
  }
@@ -216,7 +243,7 @@ const variantPseudoClassFunctions = {
216
243
  const fn = match[1];
217
244
  const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
218
245
  return {
219
- matcher: input.slice(match[1].length + match[2].length + 2),
246
+ matcher: input.slice(match[0].length),
220
247
  selector: (s) => `${s}:${fn}(${pseudo})`
221
248
  };
222
249
  }
@@ -233,6 +260,14 @@ const variantTaggedPseudoClasses = (options = {}) => {
233
260
  {
234
261
  match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
235
262
  multiPass: true
263
+ },
264
+ {
265
+ match: taggedPseudoClassMatcher("parent", attributify ? '[parent=""]' : ".parent", ">"),
266
+ multiPass: true
267
+ },
268
+ {
269
+ match: taggedPseudoClassMatcher("previous", attributify ? '[previous=""]' : ".previous", "+"),
270
+ multiPass: true
236
271
  }
237
272
  ];
238
273
  };
@@ -251,6 +286,7 @@ const partClasses = {
251
286
  };
252
287
 
253
288
  const variants = (options) => [
289
+ variantLayer,
254
290
  variantNegative,
255
291
  variantImportant,
256
292
  variantPrint,
@@ -273,6 +309,7 @@ exports.variantColorsMediaOrClass = variantColorsMediaOrClass;
273
309
  exports.variantCombinators = variantCombinators;
274
310
  exports.variantImportant = variantImportant;
275
311
  exports.variantLanguageDirections = variantLanguageDirections;
312
+ exports.variantLayer = variantLayer;
276
313
  exports.variantMotions = variantMotions;
277
314
  exports.variantNegative = variantNegative;
278
315
  exports.variantOrientations = variantOrientations;