@unocss/preset-mini 0.21.0 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
- import { h as handler, c as colorResolver, d as directionMap, p as parseColor, a as cornerMap, b as capitalize, e as directionSize, f as positionMap, x as xyzMap } from './utilities.mjs';
2
- import { toArray } from '@unocss/core';
3
- import { C as CONTROL_BYPASS_PSEUDO_CLASS } from './pseudo.mjs';
1
+ import { h as handler, c as colorResolver, d as directionMap, p as parseColor, a as cornerMap, i as insetMap, b as directionSize, e as positionMap, x as xyzMap } from './utilities.mjs';
2
+ import { toArray, CONTROL_SHORTCUT_NO_MERGE } from '@unocss/core';
4
3
 
5
4
  const verticalAlignAlias = {
6
5
  mid: "middle",
@@ -31,27 +30,42 @@ const appearance = [
31
30
  "-webkit-appearance": "none"
32
31
  }]
33
32
  ];
33
+ const willChangeProperty = (prop) => {
34
+ return handler.properties.auto.global(prop) ?? {
35
+ contents: "contents",
36
+ scroll: "scroll-position"
37
+ }[prop];
38
+ };
34
39
  const willChange = [
35
- [/^will-change-(.+)/, ([, p]) => ({ "will-change": handler.properties.auto.global(p) })]
40
+ [/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
36
41
  ];
37
42
 
38
43
  const borders = [
39
44
  [/^(?:border|b)()(?:-(.+))?$/, handlerBorder],
40
45
  [/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
41
46
  [/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
42
- [/^(?:border|b)-()size-(.+)$/, handlerBorderSize],
43
- [/^(?:border|b)-([xy])-size-(.+)$/, handlerBorderSize],
44
- [/^(?:border|b)-([rltbse])-size-(.+)$/, handlerBorderSize],
47
+ [/^(?:border|b)-(block|inline)(?:-(.+))?$/, handlerBorder],
48
+ [/^(?:border|b)-([bi][se])(?:-(.+))?$/, handlerBorder],
49
+ [/^(?:border|b)-()(?:width|size)-(.+)$/, handlerBorderSize],
50
+ [/^(?:border|b)-([xy])-(?:width|size)-(.+)$/, handlerBorderSize],
51
+ [/^(?:border|b)-([rltbse])-(?:width|size)-(.+)$/, handlerBorderSize],
52
+ [/^(?:border|b)-(block|inline)-(?:width|size)-(.+)$/, handlerBorderSize],
53
+ [/^(?:border|b)-([bi][se])-(?:width|size)-(.+)$/, handlerBorderSize],
45
54
  [/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor],
46
55
  [/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
47
56
  [/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
57
+ [/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/, handlerBorderColor],
58
+ [/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/, handlerBorderColor],
48
59
  [/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity],
49
60
  [/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
50
61
  [/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
62
+ [/^(?:border|b)-(block|inline)-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
63
+ [/^(?:border|b)-([bi][se])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
51
64
  [/^(?:border-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded],
52
- [/^(?:border-)?(?:rounded|rd)-([xy])(?:-(.+))?$/, handlerRounded],
53
65
  [/^(?:border-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
54
66
  [/^(?:border-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
67
+ [/^(?:border-)?(?:rounded|rd)-([bi][se])(?:-(.+))?$/, handlerRounded],
68
+ [/^(?:border-)?(?:rounded|rd)-([bi][se]-[bi][se])(?:-(.+))?$/, handlerRounded],
55
69
  ["border-solid", { "border-style": "solid" }],
56
70
  ["border-dashed", { "border-style": "dashed" }],
57
71
  ["border-dotted", { "border-style": "dotted" }],
@@ -208,17 +222,15 @@ const weightMap = {
208
222
  const fonts = [
209
223
  [/^font-(\w+)$/, ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] })],
210
224
  [/^text-(.+)$/, ([, s = "base"], { theme }) => {
211
- const size = handler.bracket.auto.rem(s);
212
- if (size)
213
- return { "font-size": size };
214
225
  const themed = toArray(theme.fontSize?.[s]);
215
226
  if (themed?.[0]) {
216
- const [size2, height] = themed;
227
+ const [size, height = "1"] = themed;
217
228
  return {
218
- "font-size": size2,
229
+ "font-size": size,
219
230
  "line-height": height
220
231
  };
221
232
  }
233
+ return { "font-size": handler.bracket.auto.rem(s) };
222
234
  }],
223
235
  [/^text-size-(.+)$/, ([, s]) => ({ "font-size": handler.bracket.auto.rem(s) })],
224
236
  [/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || handler.number(s) })],
@@ -247,7 +259,29 @@ const textStrokes = [
247
259
  [/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity) })]
248
260
  ];
249
261
  const textShadows = [
250
- [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => ({ "text-shadow": theme.textShadow?.[s || "DEFAULT"] || handler.bracket.cssvar(s) })]
262
+ [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
263
+ const v = theme.textShadow?.[s || "DEFAULT"];
264
+ if (v != null) {
265
+ const shadow = toArray(v);
266
+ const colored = shadow.map((s2) => s2.replace(/\s\S+$/, " var(--un-text-shadow-color)"));
267
+ return {
268
+ "--un-text-shadow": shadow.join(","),
269
+ "--un-text-shadow-colored": colored.join(","),
270
+ "text-shadow": "var(--un-text-shadow)"
271
+ };
272
+ }
273
+ return { "text-shadow": handler.bracket.cssvar(s) };
274
+ }],
275
+ [/^text-shadow-color-(.+)$/, (m, ctx) => {
276
+ const color = colorResolver("--un-text-shadow-color", "text-shadow")(m, ctx);
277
+ if (color) {
278
+ return {
279
+ ...color,
280
+ "--un-text-shadow": "var(--un-text-shadow-colored)"
281
+ };
282
+ }
283
+ }],
284
+ [/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": handler.bracket.percent(opacity) })]
251
285
  ];
252
286
 
253
287
  const directions = {
@@ -383,16 +417,18 @@ const placements = [
383
417
  ["place-self-stretch", { "place-self": "stretch" }]
384
418
  ];
385
419
  function handleInsetValue(v) {
386
- return { auto: "auto", full: "100%" }[v] ?? handler.bracket.fraction.cssvar.auto.rem(v);
420
+ return handler.bracket.fraction.cssvar.auto.rem(v);
387
421
  }
388
422
  function handleInsetValues([, d, v]) {
389
423
  const r = handleInsetValue(v);
390
- if (r != null && d in directionMap)
391
- return directionMap[d].map((i) => [i.slice(1), r]);
424
+ if (r != null && d in insetMap)
425
+ return insetMap[d].map((i) => [i.slice(1), r]);
392
426
  }
393
427
  const insets = [
394
428
  [/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
395
429
  [/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
430
+ [/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
431
+ [/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
396
432
  [/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
397
433
  ];
398
434
  const floats = [
@@ -452,7 +488,8 @@ const whitespaces = [
452
488
  [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
453
489
  ];
454
490
  const contents = [
455
- ["content-empty", { content: '""' }]
491
+ ["content-empty", { content: '""' }],
492
+ ["content-none", { content: '""' }]
456
493
  ];
457
494
  const breaks = [
458
495
  ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
@@ -487,19 +524,62 @@ const fontSmoothings = [
487
524
  }]
488
525
  ];
489
526
 
527
+ const shadowBase = {
528
+ [CONTROL_SHORTCUT_NO_MERGE]: "",
529
+ "--un-ring-offset-shadow": "0 0 #0000",
530
+ "--un-ring-shadow": "0 0 #0000",
531
+ "--un-shadow-inset": varEmpty,
532
+ "--un-shadow": "0 0 #0000",
533
+ "--un-shadow-colored": "0 0 #0000"
534
+ };
535
+ const boxShadows = [
536
+ [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
537
+ const v = theme.boxShadow?.[d || "DEFAULT"];
538
+ if (v) {
539
+ const shadow = toArray(v);
540
+ const colored = shadow.map((s) => s.replace(/\s\S+$/, " var(--un-shadow-color)"));
541
+ return [
542
+ shadowBase,
543
+ {
544
+ "--un-shadow": shadow.join(","),
545
+ "--un-shadow-colored": colored.join(","),
546
+ "box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
547
+ }
548
+ ];
549
+ }
550
+ }],
551
+ [/^shadow-(.+)$/, (m, ctx) => {
552
+ const color = colorResolver("--un-shadow-color", "shadow")(m, ctx);
553
+ if (color) {
554
+ return {
555
+ ...color,
556
+ "--un-shadow": "var(--un-shadow-colored)"
557
+ };
558
+ }
559
+ }],
560
+ [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": handler.bracket.percent.cssvar(opacity) })],
561
+ ["shadow-inset", { "--un-shadow-inset": "inset" }]
562
+ ];
563
+
564
+ const ringBase = {
565
+ "--un-ring-inset": varEmpty,
566
+ "--un-ring-offset-width": "0px",
567
+ "--un-ring-offset-color": "#fff",
568
+ "--un-ring-color": "rgba(147,197,253,0.5)",
569
+ ...shadowBase
570
+ };
490
571
  const rings = [
491
572
  [/^ring(?:-(.+))?$/, ([, d]) => {
492
573
  const value = handler.px(d || "1");
493
574
  if (value) {
494
- return {
495
- "--un-ring-inset": varEmpty,
496
- "--un-ring-offset-width": "0px",
497
- "--un-ring-offset-color": "#fff",
498
- "--un-ring-color": "rgba(147, 197, 253, .5)",
499
- "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
500
- "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
501
- "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
502
- };
575
+ return [
576
+ ringBase,
577
+ {
578
+ "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
579
+ "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
580
+ "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
581
+ }
582
+ ];
503
583
  }
504
584
  }],
505
585
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
@@ -511,46 +591,17 @@ const rings = [
511
591
  ["ring-inset", { "--un-ring-inset": "inset" }]
512
592
  ];
513
593
 
514
- const shadowColorResolver = (body, theme) => {
515
- const data = parseColor(body, theme);
516
- if (!data)
517
- return;
518
- const { color, rgba } = data;
519
- if (!color)
520
- return;
521
- if (rgba) {
522
- return {
523
- "--un-shadow-color": `${rgba.slice(0, 3).join(",")}`
524
- };
525
- } else {
526
- return {
527
- "--un-shadow-color": color
528
- };
529
- }
594
+ const sizeMapping = {
595
+ h: "height",
596
+ w: "width",
597
+ inline: "inline-size",
598
+ block: "block-size"
530
599
  };
531
- const boxShadows = [
532
- [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
533
- const value = theme.boxShadow?.[d || "DEFAULT"];
534
- if (value) {
535
- return {
536
- "--un-shadow-inset": varEmpty,
537
- "--un-shadow-color": "0,0,0",
538
- "--un-shadow": value,
539
- "box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
540
- };
541
- }
542
- }],
543
- [/^shadow-(.+)$/, ([, d], { theme }) => shadowColorResolver(d, theme)],
544
- ["shadow-inset", { "--un-shadow-inset": "inset" }]
545
- ];
546
-
547
600
  function getPropName(minmax, hw) {
548
- return `${minmax ? `${minmax}-` : ""}${hw === "h" ? "height" : "width"}`;
601
+ return `${minmax || ""}${sizeMapping[hw]}`;
549
602
  }
550
603
  function getSizeValue(minmax, hw, theme, prop) {
551
- let str = `${hw === "h" ? "height" : "width"}`;
552
- if (minmax)
553
- str = `${minmax}${capitalize(str)}`;
604
+ const str = getPropName(minmax, hw).replace(/-(\w)/g, (_, p) => p.toUpperCase());
554
605
  const v = theme[str]?.[prop];
555
606
  if (v != null)
556
607
  return v;
@@ -563,8 +614,9 @@ function getSizeValue(minmax, hw, theme, prop) {
563
614
  return handler.bracket.cssvar.fraction.auto.rem(prop);
564
615
  }
565
616
  const sizes = [
566
- [/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
567
- [/^(?:(min|max)-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
617
+ [/^(min-|max-)?([wh])-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
618
+ [/^(min-|max-)?(block|inline)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
619
+ [/^(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
568
620
  ];
569
621
  function getAspectRatio(prop) {
570
622
  if (/^\d+\/\d+$/.test(prop))
@@ -584,24 +636,53 @@ const aspectRatio = [
584
636
  const paddings = [
585
637
  [/^pa?()-?(-?.+)$/, directionSize("padding")],
586
638
  [/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
587
- [/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")]
639
+ [/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")],
640
+ [/^p-(inline|block)-(-?.+)$/, directionSize("padding")],
641
+ [/^p-?([bi][se])-?(-?.+)$/, directionSize("padding")]
588
642
  ];
589
643
  const margins = [
590
644
  [/^ma?()-?(-?.+)$/, directionSize("margin")],
591
645
  [/^m-?([xy])-?(-?.+)$/, directionSize("margin")],
592
- [/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")]
646
+ [/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")],
647
+ [/^m-(inline|block)-(-?.+)$/, directionSize("margin")],
648
+ [/^m-?([bi][se])-?(-?.+)$/, directionSize("margin")]
593
649
  ];
594
650
 
595
651
  const transformGpu = {
596
- transform: "rotate(var(--un-rotate)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
597
- [CONTROL_BYPASS_PSEUDO_CLASS]: ""
652
+ "--un-transform": [
653
+ "translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
654
+ "rotate(var(--un-rotate))",
655
+ "rotateX(var(--un-rotate-x))",
656
+ "rotateY(var(--un-rotate-y))",
657
+ "rotateZ(var(--un-rotate-z))",
658
+ "skewX(var(--un-skew-x))",
659
+ "skewY(var(--un-skew-y))",
660
+ "scaleX(var(--un-scale-x))",
661
+ "scaleY(var(--un-scale-y))",
662
+ "scaleZ(var(--un-scale-z))"
663
+ ].join(" ")
598
664
  };
599
665
  const transformCpu = {
600
- transform: "rotate(var(--un-rotate)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) translateX(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z))",
601
- [CONTROL_BYPASS_PSEUDO_CLASS]: ""
666
+ "--un-transform": [
667
+ "translateX(var(--un-translate-x))",
668
+ "translateY(var(--un-translate-y))",
669
+ "translateZ(var(--un-translate-z))",
670
+ "rotate(var(--un-rotate))",
671
+ "rotateX(var(--un-rotate-x))",
672
+ "rotateY(var(--un-rotate-y))",
673
+ "rotateZ(var(--un-rotate-z))",
674
+ "skewX(var(--un-skew-x))",
675
+ "skewY(var(--un-skew-y))",
676
+ "scaleX(var(--un-scale-x))",
677
+ "scaleY(var(--un-scale-y))",
678
+ "scaleZ(var(--un-scale-z))"
679
+ ].join(" ")
602
680
  };
603
681
  const transformBase = {
604
682
  "--un-rotate": 0,
683
+ "--un-rotate-x": 0,
684
+ "--un-rotate-y": 0,
685
+ "--un-rotate-z": 0,
605
686
  "--un-scale-x": 1,
606
687
  "--un-scale-y": 1,
607
688
  "--un-scale-z": 1,
@@ -610,20 +691,43 @@ const transformBase = {
610
691
  "--un-translate-x": 0,
611
692
  "--un-translate-y": 0,
612
693
  "--un-translate-z": 0,
613
- ...transformCpu
694
+ ...transformCpu,
695
+ [CONTROL_SHORTCUT_NO_MERGE]: ""
614
696
  };
615
697
  const transforms = [
616
- ["transform", transformBase],
617
698
  [/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": positionMap[s] })],
699
+ [/^perspect-(.+)$/, ([, s]) => {
700
+ const v = handler.px.numberWithUnit(s);
701
+ if (v != null) {
702
+ return {
703
+ "-webkit-perspective": v,
704
+ "perspective": v
705
+ };
706
+ }
707
+ }],
708
+ [/^perspect-origin-(.+)$/, ([, s]) => {
709
+ const v = handler.bracket(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
710
+ if (v != null) {
711
+ return {
712
+ "-webkit-perspective-origin": v,
713
+ "perspective-origin": v
714
+ };
715
+ }
716
+ }],
618
717
  [/^translate-()(.+)$/, handleTranslate],
619
718
  [/^translate-([xyz])-(.+)$/, handleTranslate],
620
- [/^rotate-(.+)$/, handleRotate],
719
+ [/^rotate-()(.+)$/, handleRotate],
720
+ [/^rotate(-[xyz])-(.+)$/, handleRotate],
621
721
  [/^skew-()(.+)$/, handleSkew],
622
722
  [/^skew-([xy])-(.+)$/, handleSkew],
623
723
  [/^scale-()(.+)$/, handleScale],
624
724
  [/^scale-([xyz])-(.+)$/, handleScale],
625
725
  ["preserve-3d", { "transform-style": "preserve-3d" }],
626
726
  ["preserve-flat", { "transform-style": "flat" }],
727
+ [/^transform$/, () => [
728
+ transformBase,
729
+ { transform: "var(--un-transform)" }
730
+ ]],
627
731
  ["transform-gpu", transformGpu],
628
732
  ["transform-cpu", transformCpu],
629
733
  ["transform-none", { transform: "none" }]
@@ -633,7 +737,10 @@ function handleTranslate([, d, b]) {
633
737
  if (v != null) {
634
738
  return [
635
739
  transformBase,
636
- xyzMap[d].map((i) => [`--un-translate${i}`, v])
740
+ [
741
+ ...xyzMap[d].map((i) => [`--un-translate${i}`, v]),
742
+ ["transform", "var(--un-transform)"]
743
+ ]
637
744
  ];
638
745
  }
639
746
  }
@@ -642,16 +749,22 @@ function handleScale([, d, b]) {
642
749
  if (v != null) {
643
750
  return [
644
751
  transformBase,
645
- xyzMap[d].map((i) => [`--un-scale${i}`, v])
752
+ [
753
+ ...xyzMap[d].map((i) => [`--un-scale${i}`, v]),
754
+ ["transform", "var(--un-transform)"]
755
+ ]
646
756
  ];
647
757
  }
648
758
  }
649
- function handleRotate([, b]) {
759
+ function handleRotate([, d, b]) {
650
760
  const v = handler.bracket.degree(b);
651
761
  if (v != null) {
652
762
  return [
653
763
  transformBase,
654
- { "--un-rotate": v }
764
+ {
765
+ [`--un-rotate${d || ""}`]: v,
766
+ transform: "var(--un-transform)"
767
+ }
655
768
  ];
656
769
  }
657
770
  }
@@ -660,7 +773,10 @@ function handleSkew([, d, b]) {
660
773
  if (v != null) {
661
774
  return [
662
775
  transformBase,
663
- { [`--un-skew-${d}`]: v }
776
+ {
777
+ [`--un-skew-${d}`]: v,
778
+ transform: "var(--un-transform)"
779
+ }
664
780
  ];
665
781
  }
666
782
  }
@@ -696,6 +812,9 @@ const cssVariables = [
696
812
  return { [prop]: `var(--${varname})` };
697
813
  }]
698
814
  ];
815
+ const cssProperty = [
816
+ [/^\[(.+):(.+)\]$/, ([, prop, value]) => ({ [prop]: handler.bracket(`[${value}]`) })]
817
+ ];
699
818
 
700
819
  const questionMark = [
701
820
  [
@@ -736,14 +855,25 @@ const svgUtilities = [
736
855
  [/^fill-(.+)$/, colorResolver("fill", "fill")],
737
856
  [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
738
857
  ["fill-none", { fill: "none" }],
739
- [/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.fraction.px.number(s) })],
858
+ [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.fraction.px.number(s) })],
859
+ [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": handler.bracket.number(s) })],
860
+ [/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": handler.bracket.px.numberWithUnit(s) })],
740
861
  [/^stroke-(.+)$/, colorResolver("stroke", "stroke")],
741
862
  [/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": handler.bracket.percent(opacity) })],
863
+ ["stroke-cap-square", { "stroke-linecap": "square" }],
864
+ ["stroke-cap-round", { "stroke-linecap": "round" }],
865
+ ["stroke-cap-auto", { "stroke-linecap": "butt" }],
866
+ ["stroke-join-arcs", { "stroke-linejoin": "arcs" }],
867
+ ["stroke-join-bevel", { "stroke-linejoin": "bevel" }],
868
+ ["stroke-join-clip", { "stroke-linejoin": "miter-clip" }],
869
+ ["stroke-join-round", { "stroke-linejoin": "round" }],
870
+ ["stroke-join-auto", { "stroke-linejoin": "miter" }],
742
871
  ["stroke-none", { stroke: "none" }]
743
872
  ];
744
873
 
745
874
  const rules = [
746
875
  cssVariables,
876
+ cssProperty,
747
877
  paddings,
748
878
  margins,
749
879
  displays,
@@ -798,4 +928,4 @@ const rules = [
798
928
  questionMark
799
929
  ].flat(1);
800
930
 
801
- export { textDecorations as $, sizes as A, aspectRatio as B, paddings as C, margins as D, varEmpty as E, displays as F, appearances as G, cursors as H, pointerEvents as I, resizes as J, userSelects as K, whitespaces as L, contents as M, breaks as N, textOverflows as O, textTransforms as P, fontStyles as Q, fontSmoothings as R, svgUtilities as S, transforms as T, transitions as U, fonts as V, tabSizes as W, textIndents as X, textStrokes as Y, textShadows as Z, cssVariables as _, appearance as a, borders as b, opacity as c, textColors as d, bgColors as e, flex as f, gaps as g, grids as h, overflows as i, justifies as j, orders as k, alignments as l, placements as m, insets as n, outline as o, positions as p, floats as q, rules as r, boxSizing as s, textAligns as t, questionMark as u, verticalAligns as v, willChange as w, rings as x, boxShadows as y, zIndexes as z };
931
+ export { cssVariables as $, boxShadows as A, sizes as B, aspectRatio as C, paddings as D, margins as E, varEmpty as F, displays as G, appearances as H, cursors as I, pointerEvents as J, resizes as K, userSelects as L, whitespaces as M, contents as N, breaks as O, textOverflows as P, textTransforms as Q, fontStyles as R, fontSmoothings as S, svgUtilities as T, transforms as U, transitions as V, fonts as W, tabSizes as X, textIndents as Y, textStrokes as Z, textShadows as _, appearance as a, cssProperty as a0, textDecorations as a1, borders as b, opacity as c, textColors as d, bgColors as e, flex as f, gaps as g, grids as h, overflows as i, justifies as j, orders as k, alignments as l, placements as m, insets as n, outline as o, positions as p, floats as q, rules as r, boxSizing as s, textAligns as t, questionMark as u, verticalAligns as v, willChange as w, rings as x, shadowBase as y, zIndexes as z };
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const variants$1 = require('./variants.cjs');
4
- const pseudo = require('./pseudo.cjs');
4
+ const core = require('@unocss/core');
5
5
 
6
6
  const regexCache = {};
7
7
  const variantBreakpoints = (matcher, { theme }) => {
@@ -110,6 +110,156 @@ const variantOrientations = [
110
110
 
111
111
  const variantPrint = variants$1.variantParentMatcher("print", "@media print");
112
112
 
113
+ const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
114
+ const PseudoClasses = Object.fromEntries([
115
+ "any-link",
116
+ "link",
117
+ "visited",
118
+ "target",
119
+ ["open", "[open]"],
120
+ "hover",
121
+ "active",
122
+ "focus-visible",
123
+ "focus-within",
124
+ "focus",
125
+ "autofill",
126
+ "enabled",
127
+ "disabled",
128
+ "read-only",
129
+ "read-write",
130
+ "placeholder-shown",
131
+ "default",
132
+ "checked",
133
+ "indeterminate",
134
+ "valid",
135
+ "invalid",
136
+ "in-range",
137
+ "out-of-range",
138
+ "required",
139
+ "optional",
140
+ "root",
141
+ "empty",
142
+ ["even-of-type", ":nth-of-type(even)"],
143
+ ["even", ":nth-child(even)"],
144
+ ["odd-of-type", ":nth-of-type(odd)"],
145
+ ["odd", ":nth-child(odd)"],
146
+ "first-of-type",
147
+ ["first", ":first-child"],
148
+ "last-of-type",
149
+ ["last", ":last-child"],
150
+ "only-child",
151
+ "only-of-type"
152
+ ].map(core.toArray));
153
+ const PseudoElements = Object.fromEntries([
154
+ "placeholder",
155
+ "before",
156
+ "after",
157
+ "first-letter",
158
+ "first-line",
159
+ "selection",
160
+ "marker",
161
+ ["file", "::file-selector-button"]
162
+ ].map(core.toArray));
163
+ const PseudoClassFunctions = [
164
+ "not",
165
+ "is",
166
+ "where",
167
+ "has"
168
+ ];
169
+ const PseudoElementsStr = Object.keys(PseudoElements).join("|");
170
+ const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
171
+ const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
172
+ const PartClassesRE = /(part-\[(.+)]:)(.+)/;
173
+ const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
174
+ const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
175
+ 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
+ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
180
+ const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
181
+ const rawRe = new RegExp(`^${core.escapeRegExp(parent)}:`);
182
+ return (input) => {
183
+ const match = input.match(re);
184
+ if (match) {
185
+ let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
186
+ if (match[2])
187
+ pseudo = `:${match[2]}(${pseudo})`;
188
+ return {
189
+ 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
+ }
193
+ };
194
+ }
195
+ };
196
+ };
197
+ const variantPseudoElements = (input) => {
198
+ const match = input.match(PseudoElementsRE);
199
+ if (match) {
200
+ const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
201
+ return {
202
+ matcher: input.slice(match[1].length + 1),
203
+ selector: (s) => `${s}${pseudo}`
204
+ };
205
+ }
206
+ };
207
+ const variantPseudoClasses = {
208
+ match: (input) => {
209
+ const match = input.match(PseudoClassesRE);
210
+ if (match) {
211
+ const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
212
+ return {
213
+ matcher: input.slice(match[1].length + 1),
214
+ selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
215
+ };
216
+ }
217
+ },
218
+ multiPass: true
219
+ };
220
+ const variantPseudoClassFunctions = {
221
+ match: (input) => {
222
+ const match = input.match(PseudoClassFunctionsRE);
223
+ if (match) {
224
+ const fn = match[1];
225
+ const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
226
+ return {
227
+ matcher: input.slice(match[1].length + match[2].length + 2),
228
+ selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
229
+ };
230
+ }
231
+ },
232
+ multiPass: true
233
+ };
234
+ const variantTaggedPseudoClasses = (options = {}) => {
235
+ const attributify = !!options?.attributifyPseudo;
236
+ return [
237
+ {
238
+ match: taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
239
+ multiPass: true
240
+ },
241
+ {
242
+ match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
243
+ multiPass: true
244
+ }
245
+ ];
246
+ };
247
+ const partClasses = {
248
+ match: (input) => {
249
+ const match = input.match(PartClassesRE);
250
+ if (match) {
251
+ const part = `part(${match[2]})`;
252
+ return {
253
+ matcher: input.slice(match[1].length),
254
+ selector: (s, body) => {
255
+ return shouldAdd(body) && `${s}::${part}`;
256
+ }
257
+ };
258
+ }
259
+ },
260
+ multiPass: true
261
+ };
262
+
113
263
  const variants = (options) => [
114
264
  variantNegative,
115
265
  variantImportant,
@@ -118,15 +268,17 @@ const variants = (options) => [
118
268
  ...variantMotions,
119
269
  variantBreakpoints,
120
270
  ...variantCombinators,
121
- pseudo.variantPseudoClasses,
122
- pseudo.variantPseudoClassFunctions,
123
- ...pseudo.variantTaggedPseudoClasses(options),
124
- pseudo.variantPseudoElements,
125
- pseudo.partClasses,
271
+ variantPseudoClasses,
272
+ variantPseudoClassFunctions,
273
+ ...variantTaggedPseudoClasses(options),
274
+ variantPseudoElements,
275
+ partClasses,
126
276
  ...variantColorsMediaOrClass(options),
127
277
  ...variantLanguageDirections
128
278
  ];
129
279
 
280
+ exports.CONTROL_BYPASS_PSEUDO_CLASS = CONTROL_BYPASS_PSEUDO_CLASS;
281
+ exports.partClasses = partClasses;
130
282
  exports.variantBreakpoints = variantBreakpoints;
131
283
  exports.variantColorsMediaOrClass = variantColorsMediaOrClass;
132
284
  exports.variantCombinators = variantCombinators;
@@ -136,4 +288,8 @@ exports.variantMotions = variantMotions;
136
288
  exports.variantNegative = variantNegative;
137
289
  exports.variantOrientations = variantOrientations;
138
290
  exports.variantPrint = variantPrint;
291
+ exports.variantPseudoClassFunctions = variantPseudoClassFunctions;
292
+ exports.variantPseudoClasses = variantPseudoClasses;
293
+ exports.variantPseudoElements = variantPseudoElements;
294
+ exports.variantTaggedPseudoClasses = variantTaggedPseudoClasses;
139
295
  exports.variants = variants;