@unocss/preset-mini 0.21.2 → 0.22.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.
- package/dist/chunks/default2.cjs +64 -18
- package/dist/chunks/default2.mjs +65 -19
- package/dist/chunks/default3.cjs +162 -6
- package/dist/chunks/default3.mjs +152 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -2
- package/dist/rules.cjs +0 -1
- package/dist/rules.mjs +0 -1
- package/dist/utilities-22a522e2.d.ts +56 -0
- package/dist/utils.d.ts +4 -55
- package/dist/variants.cjs +6 -7
- package/dist/variants.d.ts +1 -0
- package/dist/variants.mjs +1 -2
- package/package.json +2 -2
- package/dist/chunks/pseudo.cjs +0 -160
- package/dist/chunks/pseudo.mjs +0 -153
package/dist/chunks/default2.cjs
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const utilities = require('./utilities.cjs');
|
|
4
4
|
const core = require('@unocss/core');
|
|
5
|
-
const pseudo = require('./pseudo.cjs');
|
|
6
5
|
|
|
7
6
|
const verticalAlignAlias = {
|
|
8
7
|
mid: "middle",
|
|
@@ -33,8 +32,14 @@ const appearance = [
|
|
|
33
32
|
"-webkit-appearance": "none"
|
|
34
33
|
}]
|
|
35
34
|
];
|
|
35
|
+
const willChangeProperty = (prop) => {
|
|
36
|
+
return utilities.handler.properties.auto.global(prop) ?? {
|
|
37
|
+
contents: "contents",
|
|
38
|
+
scroll: "scroll-position"
|
|
39
|
+
}[prop];
|
|
40
|
+
};
|
|
36
41
|
const willChange = [
|
|
37
|
-
[/^will-change-(.+)/, ([, p]) => ({ "will-change":
|
|
42
|
+
[/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
|
|
38
43
|
];
|
|
39
44
|
|
|
40
45
|
const borders = [
|
|
@@ -210,17 +215,15 @@ const weightMap = {
|
|
|
210
215
|
const fonts = [
|
|
211
216
|
[/^font-(\w+)$/, ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] })],
|
|
212
217
|
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
213
|
-
const size = utilities.handler.bracket.auto.rem(s);
|
|
214
|
-
if (size)
|
|
215
|
-
return { "font-size": size };
|
|
216
218
|
const themed = core.toArray(theme.fontSize?.[s]);
|
|
217
219
|
if (themed?.[0]) {
|
|
218
|
-
const [
|
|
220
|
+
const [size, height = "1"] = themed;
|
|
219
221
|
return {
|
|
220
|
-
"font-size":
|
|
222
|
+
"font-size": size,
|
|
221
223
|
"line-height": height
|
|
222
224
|
};
|
|
223
225
|
}
|
|
226
|
+
return { "font-size": utilities.handler.bracket.auto.rem(s) };
|
|
224
227
|
}],
|
|
225
228
|
[/^text-size-(.+)$/, ([, s]) => ({ "font-size": utilities.handler.bracket.auto.rem(s) })],
|
|
226
229
|
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || utilities.handler.number(s) })],
|
|
@@ -454,7 +457,8 @@ const whitespaces = [
|
|
|
454
457
|
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
455
458
|
];
|
|
456
459
|
const contents = [
|
|
457
|
-
["content-empty", { content: '""' }]
|
|
460
|
+
["content-empty", { content: '""' }],
|
|
461
|
+
["content-none", { content: '""' }]
|
|
458
462
|
];
|
|
459
463
|
const breaks = [
|
|
460
464
|
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
@@ -595,12 +599,10 @@ const margins = [
|
|
|
595
599
|
];
|
|
596
600
|
|
|
597
601
|
const transformGpu = {
|
|
598
|
-
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))"
|
|
599
|
-
[pseudo.CONTROL_BYPASS_PSEUDO_CLASS]: ""
|
|
602
|
+
"--un-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))"
|
|
600
603
|
};
|
|
601
604
|
const transformCpu = {
|
|
602
|
-
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))"
|
|
603
|
-
[pseudo.CONTROL_BYPASS_PSEUDO_CLASS]: ""
|
|
605
|
+
"--un-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))"
|
|
604
606
|
};
|
|
605
607
|
const transformBase = {
|
|
606
608
|
"--un-rotate": 0,
|
|
@@ -612,11 +614,29 @@ const transformBase = {
|
|
|
612
614
|
"--un-translate-x": 0,
|
|
613
615
|
"--un-translate-y": 0,
|
|
614
616
|
"--un-translate-z": 0,
|
|
615
|
-
...transformCpu
|
|
617
|
+
...transformCpu,
|
|
618
|
+
[core.CONTROL_SHORTCUT_NO_MERGE]: ""
|
|
616
619
|
};
|
|
617
620
|
const transforms = [
|
|
618
|
-
["transform", transformBase],
|
|
619
621
|
[/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] })],
|
|
622
|
+
[/^perspect-(.+)$/, ([, s]) => {
|
|
623
|
+
const v = utilities.handler.px.numberWithUnit(s);
|
|
624
|
+
if (v != null) {
|
|
625
|
+
return {
|
|
626
|
+
"-webkit-perspective": v,
|
|
627
|
+
"perspective": v
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
}],
|
|
631
|
+
[/^perspect-origin-(.+)$/, ([, s]) => {
|
|
632
|
+
const v = utilities.handler.bracket(s) ?? (s.length >= 3 ? utilities.positionMap[s] : void 0);
|
|
633
|
+
if (v != null) {
|
|
634
|
+
return {
|
|
635
|
+
"-webkit-perspective-origin": v,
|
|
636
|
+
"perspective-origin": v
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
}],
|
|
620
640
|
[/^translate-()(.+)$/, handleTranslate],
|
|
621
641
|
[/^translate-([xyz])-(.+)$/, handleTranslate],
|
|
622
642
|
[/^rotate-(.+)$/, handleRotate],
|
|
@@ -626,6 +646,10 @@ const transforms = [
|
|
|
626
646
|
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
627
647
|
["preserve-3d", { "transform-style": "preserve-3d" }],
|
|
628
648
|
["preserve-flat", { "transform-style": "flat" }],
|
|
649
|
+
[/^transform$/, () => [
|
|
650
|
+
transformBase,
|
|
651
|
+
{ transform: "var(--un-transform)" }
|
|
652
|
+
]],
|
|
629
653
|
["transform-gpu", transformGpu],
|
|
630
654
|
["transform-cpu", transformCpu],
|
|
631
655
|
["transform-none", { transform: "none" }]
|
|
@@ -635,7 +659,10 @@ function handleTranslate([, d, b]) {
|
|
|
635
659
|
if (v != null) {
|
|
636
660
|
return [
|
|
637
661
|
transformBase,
|
|
638
|
-
|
|
662
|
+
[
|
|
663
|
+
...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v]),
|
|
664
|
+
["transform", "var(--un-transform)"]
|
|
665
|
+
]
|
|
639
666
|
];
|
|
640
667
|
}
|
|
641
668
|
}
|
|
@@ -644,7 +671,10 @@ function handleScale([, d, b]) {
|
|
|
644
671
|
if (v != null) {
|
|
645
672
|
return [
|
|
646
673
|
transformBase,
|
|
647
|
-
|
|
674
|
+
[
|
|
675
|
+
...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v]),
|
|
676
|
+
["transform", "var(--un-transform)"]
|
|
677
|
+
]
|
|
648
678
|
];
|
|
649
679
|
}
|
|
650
680
|
}
|
|
@@ -653,7 +683,10 @@ function handleRotate([, b]) {
|
|
|
653
683
|
if (v != null) {
|
|
654
684
|
return [
|
|
655
685
|
transformBase,
|
|
656
|
-
{
|
|
686
|
+
{
|
|
687
|
+
"--un-rotate": v,
|
|
688
|
+
"transform": "var(--un-transform)"
|
|
689
|
+
}
|
|
657
690
|
];
|
|
658
691
|
}
|
|
659
692
|
}
|
|
@@ -662,7 +695,10 @@ function handleSkew([, d, b]) {
|
|
|
662
695
|
if (v != null) {
|
|
663
696
|
return [
|
|
664
697
|
transformBase,
|
|
665
|
-
{
|
|
698
|
+
{
|
|
699
|
+
[`--un-skew-${d}`]: v,
|
|
700
|
+
transform: "var(--un-transform)"
|
|
701
|
+
}
|
|
666
702
|
];
|
|
667
703
|
}
|
|
668
704
|
}
|
|
@@ -739,8 +775,18 @@ const svgUtilities = [
|
|
|
739
775
|
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
740
776
|
["fill-none", { fill: "none" }],
|
|
741
777
|
[/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => ({ "stroke-width": utilities.handler.bracket.fraction.px.number(s) })],
|
|
778
|
+
[/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": utilities.handler.bracket.number(s) })],
|
|
779
|
+
[/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": utilities.handler.bracket.px.numberWithUnit(s) })],
|
|
742
780
|
[/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke")],
|
|
743
781
|
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
782
|
+
["stroke-cap-square", { "stroke-linecap": "square" }],
|
|
783
|
+
["stroke-cap-round", { "stroke-linecap": "round" }],
|
|
784
|
+
["stroke-cap-auto", { "stroke-linecap": "butt" }],
|
|
785
|
+
["stroke-join-arcs", { "stroke-linejoin": "arcs" }],
|
|
786
|
+
["stroke-join-bevel", { "stroke-linejoin": "bevel" }],
|
|
787
|
+
["stroke-join-clip", { "stroke-linejoin": "miter-clip" }],
|
|
788
|
+
["stroke-join-round", { "stroke-linejoin": "round" }],
|
|
789
|
+
["stroke-join-auto", { "stroke-linejoin": "miter" }],
|
|
744
790
|
["stroke-none", { stroke: "none" }]
|
|
745
791
|
];
|
|
746
792
|
|
package/dist/chunks/default2.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
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';
|
|
2
|
+
import { toArray, CONTROL_SHORTCUT_NO_MERGE } from '@unocss/core';
|
|
4
3
|
|
|
5
4
|
const verticalAlignAlias = {
|
|
6
5
|
mid: "middle",
|
|
@@ -31,8 +30,14 @@ 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":
|
|
40
|
+
[/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
|
|
36
41
|
];
|
|
37
42
|
|
|
38
43
|
const borders = [
|
|
@@ -208,17 +213,15 @@ const weightMap = {
|
|
|
208
213
|
const fonts = [
|
|
209
214
|
[/^font-(\w+)$/, ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] })],
|
|
210
215
|
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
211
|
-
const size = handler.bracket.auto.rem(s);
|
|
212
|
-
if (size)
|
|
213
|
-
return { "font-size": size };
|
|
214
216
|
const themed = toArray(theme.fontSize?.[s]);
|
|
215
217
|
if (themed?.[0]) {
|
|
216
|
-
const [
|
|
218
|
+
const [size, height = "1"] = themed;
|
|
217
219
|
return {
|
|
218
|
-
"font-size":
|
|
220
|
+
"font-size": size,
|
|
219
221
|
"line-height": height
|
|
220
222
|
};
|
|
221
223
|
}
|
|
224
|
+
return { "font-size": handler.bracket.auto.rem(s) };
|
|
222
225
|
}],
|
|
223
226
|
[/^text-size-(.+)$/, ([, s]) => ({ "font-size": handler.bracket.auto.rem(s) })],
|
|
224
227
|
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || handler.number(s) })],
|
|
@@ -452,7 +455,8 @@ const whitespaces = [
|
|
|
452
455
|
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
453
456
|
];
|
|
454
457
|
const contents = [
|
|
455
|
-
["content-empty", { content: '""' }]
|
|
458
|
+
["content-empty", { content: '""' }],
|
|
459
|
+
["content-none", { content: '""' }]
|
|
456
460
|
];
|
|
457
461
|
const breaks = [
|
|
458
462
|
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
@@ -593,12 +597,10 @@ const margins = [
|
|
|
593
597
|
];
|
|
594
598
|
|
|
595
599
|
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]: ""
|
|
600
|
+
"--un-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))"
|
|
598
601
|
};
|
|
599
602
|
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]: ""
|
|
603
|
+
"--un-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))"
|
|
602
604
|
};
|
|
603
605
|
const transformBase = {
|
|
604
606
|
"--un-rotate": 0,
|
|
@@ -610,11 +612,29 @@ const transformBase = {
|
|
|
610
612
|
"--un-translate-x": 0,
|
|
611
613
|
"--un-translate-y": 0,
|
|
612
614
|
"--un-translate-z": 0,
|
|
613
|
-
...transformCpu
|
|
615
|
+
...transformCpu,
|
|
616
|
+
[CONTROL_SHORTCUT_NO_MERGE]: ""
|
|
614
617
|
};
|
|
615
618
|
const transforms = [
|
|
616
|
-
["transform", transformBase],
|
|
617
619
|
[/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": positionMap[s] })],
|
|
620
|
+
[/^perspect-(.+)$/, ([, s]) => {
|
|
621
|
+
const v = handler.px.numberWithUnit(s);
|
|
622
|
+
if (v != null) {
|
|
623
|
+
return {
|
|
624
|
+
"-webkit-perspective": v,
|
|
625
|
+
"perspective": v
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
}],
|
|
629
|
+
[/^perspect-origin-(.+)$/, ([, s]) => {
|
|
630
|
+
const v = handler.bracket(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
|
|
631
|
+
if (v != null) {
|
|
632
|
+
return {
|
|
633
|
+
"-webkit-perspective-origin": v,
|
|
634
|
+
"perspective-origin": v
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
}],
|
|
618
638
|
[/^translate-()(.+)$/, handleTranslate],
|
|
619
639
|
[/^translate-([xyz])-(.+)$/, handleTranslate],
|
|
620
640
|
[/^rotate-(.+)$/, handleRotate],
|
|
@@ -624,6 +644,10 @@ const transforms = [
|
|
|
624
644
|
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
625
645
|
["preserve-3d", { "transform-style": "preserve-3d" }],
|
|
626
646
|
["preserve-flat", { "transform-style": "flat" }],
|
|
647
|
+
[/^transform$/, () => [
|
|
648
|
+
transformBase,
|
|
649
|
+
{ transform: "var(--un-transform)" }
|
|
650
|
+
]],
|
|
627
651
|
["transform-gpu", transformGpu],
|
|
628
652
|
["transform-cpu", transformCpu],
|
|
629
653
|
["transform-none", { transform: "none" }]
|
|
@@ -633,7 +657,10 @@ function handleTranslate([, d, b]) {
|
|
|
633
657
|
if (v != null) {
|
|
634
658
|
return [
|
|
635
659
|
transformBase,
|
|
636
|
-
|
|
660
|
+
[
|
|
661
|
+
...xyzMap[d].map((i) => [`--un-translate${i}`, v]),
|
|
662
|
+
["transform", "var(--un-transform)"]
|
|
663
|
+
]
|
|
637
664
|
];
|
|
638
665
|
}
|
|
639
666
|
}
|
|
@@ -642,7 +669,10 @@ function handleScale([, d, b]) {
|
|
|
642
669
|
if (v != null) {
|
|
643
670
|
return [
|
|
644
671
|
transformBase,
|
|
645
|
-
|
|
672
|
+
[
|
|
673
|
+
...xyzMap[d].map((i) => [`--un-scale${i}`, v]),
|
|
674
|
+
["transform", "var(--un-transform)"]
|
|
675
|
+
]
|
|
646
676
|
];
|
|
647
677
|
}
|
|
648
678
|
}
|
|
@@ -651,7 +681,10 @@ function handleRotate([, b]) {
|
|
|
651
681
|
if (v != null) {
|
|
652
682
|
return [
|
|
653
683
|
transformBase,
|
|
654
|
-
{
|
|
684
|
+
{
|
|
685
|
+
"--un-rotate": v,
|
|
686
|
+
"transform": "var(--un-transform)"
|
|
687
|
+
}
|
|
655
688
|
];
|
|
656
689
|
}
|
|
657
690
|
}
|
|
@@ -660,7 +693,10 @@ function handleSkew([, d, b]) {
|
|
|
660
693
|
if (v != null) {
|
|
661
694
|
return [
|
|
662
695
|
transformBase,
|
|
663
|
-
{
|
|
696
|
+
{
|
|
697
|
+
[`--un-skew-${d}`]: v,
|
|
698
|
+
transform: "var(--un-transform)"
|
|
699
|
+
}
|
|
664
700
|
];
|
|
665
701
|
}
|
|
666
702
|
}
|
|
@@ -737,8 +773,18 @@ const svgUtilities = [
|
|
|
737
773
|
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
|
|
738
774
|
["fill-none", { fill: "none" }],
|
|
739
775
|
[/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.fraction.px.number(s) })],
|
|
776
|
+
[/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": handler.bracket.number(s) })],
|
|
777
|
+
[/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": handler.bracket.px.numberWithUnit(s) })],
|
|
740
778
|
[/^stroke-(.+)$/, colorResolver("stroke", "stroke")],
|
|
741
779
|
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": handler.bracket.percent(opacity) })],
|
|
780
|
+
["stroke-cap-square", { "stroke-linecap": "square" }],
|
|
781
|
+
["stroke-cap-round", { "stroke-linecap": "round" }],
|
|
782
|
+
["stroke-cap-auto", { "stroke-linecap": "butt" }],
|
|
783
|
+
["stroke-join-arcs", { "stroke-linejoin": "arcs" }],
|
|
784
|
+
["stroke-join-bevel", { "stroke-linejoin": "bevel" }],
|
|
785
|
+
["stroke-join-clip", { "stroke-linejoin": "miter-clip" }],
|
|
786
|
+
["stroke-join-round", { "stroke-linejoin": "round" }],
|
|
787
|
+
["stroke-join-auto", { "stroke-linejoin": "miter" }],
|
|
742
788
|
["stroke-none", { stroke: "none" }]
|
|
743
789
|
];
|
|
744
790
|
|
package/dist/chunks/default3.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const variants$1 = require('./variants.cjs');
|
|
4
|
-
const
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
...
|
|
124
|
-
|
|
125
|
-
|
|
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;
|
package/dist/chunks/default3.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v as variantMatcher, a as variantParentMatcher } from './variants.mjs';
|
|
2
|
-
import {
|
|
2
|
+
import { toArray, escapeRegExp } from '@unocss/core';
|
|
3
3
|
|
|
4
4
|
const regexCache = {};
|
|
5
5
|
const variantBreakpoints = (matcher, { theme }) => {
|
|
@@ -108,6 +108,156 @@ const variantOrientations = [
|
|
|
108
108
|
|
|
109
109
|
const variantPrint = variantParentMatcher("print", "@media print");
|
|
110
110
|
|
|
111
|
+
const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
112
|
+
const PseudoClasses = Object.fromEntries([
|
|
113
|
+
"any-link",
|
|
114
|
+
"link",
|
|
115
|
+
"visited",
|
|
116
|
+
"target",
|
|
117
|
+
["open", "[open]"],
|
|
118
|
+
"hover",
|
|
119
|
+
"active",
|
|
120
|
+
"focus-visible",
|
|
121
|
+
"focus-within",
|
|
122
|
+
"focus",
|
|
123
|
+
"autofill",
|
|
124
|
+
"enabled",
|
|
125
|
+
"disabled",
|
|
126
|
+
"read-only",
|
|
127
|
+
"read-write",
|
|
128
|
+
"placeholder-shown",
|
|
129
|
+
"default",
|
|
130
|
+
"checked",
|
|
131
|
+
"indeterminate",
|
|
132
|
+
"valid",
|
|
133
|
+
"invalid",
|
|
134
|
+
"in-range",
|
|
135
|
+
"out-of-range",
|
|
136
|
+
"required",
|
|
137
|
+
"optional",
|
|
138
|
+
"root",
|
|
139
|
+
"empty",
|
|
140
|
+
["even-of-type", ":nth-of-type(even)"],
|
|
141
|
+
["even", ":nth-child(even)"],
|
|
142
|
+
["odd-of-type", ":nth-of-type(odd)"],
|
|
143
|
+
["odd", ":nth-child(odd)"],
|
|
144
|
+
"first-of-type",
|
|
145
|
+
["first", ":first-child"],
|
|
146
|
+
"last-of-type",
|
|
147
|
+
["last", ":last-child"],
|
|
148
|
+
"only-child",
|
|
149
|
+
"only-of-type"
|
|
150
|
+
].map(toArray));
|
|
151
|
+
const PseudoElements = Object.fromEntries([
|
|
152
|
+
"placeholder",
|
|
153
|
+
"before",
|
|
154
|
+
"after",
|
|
155
|
+
"first-letter",
|
|
156
|
+
"first-line",
|
|
157
|
+
"selection",
|
|
158
|
+
"marker",
|
|
159
|
+
["file", "::file-selector-button"]
|
|
160
|
+
].map(toArray));
|
|
161
|
+
const PseudoClassFunctions = [
|
|
162
|
+
"not",
|
|
163
|
+
"is",
|
|
164
|
+
"where",
|
|
165
|
+
"has"
|
|
166
|
+
];
|
|
167
|
+
const PseudoElementsStr = Object.keys(PseudoElements).join("|");
|
|
168
|
+
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
169
|
+
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
170
|
+
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
171
|
+
const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
|
|
172
|
+
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
173
|
+
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
|
+
const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
178
|
+
const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
179
|
+
const rawRe = new RegExp(`^${escapeRegExp(parent)}:`);
|
|
180
|
+
return (input) => {
|
|
181
|
+
const match = input.match(re);
|
|
182
|
+
if (match) {
|
|
183
|
+
let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
|
|
184
|
+
if (match[2])
|
|
185
|
+
pseudo = `:${match[2]}(${pseudo})`;
|
|
186
|
+
return {
|
|
187
|
+
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
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
const variantPseudoElements = (input) => {
|
|
196
|
+
const match = input.match(PseudoElementsRE);
|
|
197
|
+
if (match) {
|
|
198
|
+
const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
|
|
199
|
+
return {
|
|
200
|
+
matcher: input.slice(match[1].length + 1),
|
|
201
|
+
selector: (s) => `${s}${pseudo}`
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const variantPseudoClasses = {
|
|
206
|
+
match: (input) => {
|
|
207
|
+
const match = input.match(PseudoClassesRE);
|
|
208
|
+
if (match) {
|
|
209
|
+
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
210
|
+
return {
|
|
211
|
+
matcher: input.slice(match[1].length + 1),
|
|
212
|
+
selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
multiPass: true
|
|
217
|
+
};
|
|
218
|
+
const variantPseudoClassFunctions = {
|
|
219
|
+
match: (input) => {
|
|
220
|
+
const match = input.match(PseudoClassFunctionsRE);
|
|
221
|
+
if (match) {
|
|
222
|
+
const fn = match[1];
|
|
223
|
+
const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
|
|
224
|
+
return {
|
|
225
|
+
matcher: input.slice(match[1].length + match[2].length + 2),
|
|
226
|
+
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
multiPass: true
|
|
231
|
+
};
|
|
232
|
+
const variantTaggedPseudoClasses = (options = {}) => {
|
|
233
|
+
const attributify = !!options?.attributifyPseudo;
|
|
234
|
+
return [
|
|
235
|
+
{
|
|
236
|
+
match: taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
|
|
237
|
+
multiPass: true
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
|
|
241
|
+
multiPass: true
|
|
242
|
+
}
|
|
243
|
+
];
|
|
244
|
+
};
|
|
245
|
+
const partClasses = {
|
|
246
|
+
match: (input) => {
|
|
247
|
+
const match = input.match(PartClassesRE);
|
|
248
|
+
if (match) {
|
|
249
|
+
const part = `part(${match[2]})`;
|
|
250
|
+
return {
|
|
251
|
+
matcher: input.slice(match[1].length),
|
|
252
|
+
selector: (s, body) => {
|
|
253
|
+
return shouldAdd(body) && `${s}::${part}`;
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
multiPass: true
|
|
259
|
+
};
|
|
260
|
+
|
|
111
261
|
const variants = (options) => [
|
|
112
262
|
variantNegative,
|
|
113
263
|
variantImportant,
|
|
@@ -125,4 +275,4 @@ const variants = (options) => [
|
|
|
125
275
|
...variantLanguageDirections
|
|
126
276
|
];
|
|
127
277
|
|
|
128
|
-
export { 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, variants as v };
|
|
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 };
|
package/dist/index.cjs
CHANGED
|
@@ -6,9 +6,8 @@ const _default = require('./chunks/default.cjs');
|
|
|
6
6
|
const _default$1 = require('./chunks/default2.cjs');
|
|
7
7
|
const _default$2 = require('./chunks/default3.cjs');
|
|
8
8
|
const colors = require('./chunks/colors.cjs');
|
|
9
|
-
require('./chunks/utilities.cjs');
|
|
9
|
+
const utilities = require('./chunks/utilities.cjs');
|
|
10
10
|
require('@unocss/core');
|
|
11
|
-
require('./chunks/pseudo.cjs');
|
|
12
11
|
require('./chunks/variants.cjs');
|
|
13
12
|
|
|
14
13
|
const presetMini = (options = {}) => {
|
|
@@ -35,5 +34,6 @@ function VarPrefixPostprocessor(prefix) {
|
|
|
35
34
|
|
|
36
35
|
exports.theme = _default.theme;
|
|
37
36
|
exports.colors = colors.colors;
|
|
37
|
+
exports.parseColor = utilities.parseColor;
|
|
38
38
|
exports["default"] = presetMini;
|
|
39
39
|
exports.presetMini = presetMini;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { T as Theme } from './types-a2d2b52f';
|
|
|
3
3
|
export { T as Theme, a as ThemeAnimation } from './types-a2d2b52f';
|
|
4
4
|
export { t as theme } from './default-958434b6';
|
|
5
5
|
export { c as colors } from './colors-6d634692';
|
|
6
|
+
export { p as parseColor } from './utilities-22a522e2';
|
|
6
7
|
|
|
7
8
|
interface PresetMiniOptions extends PresetOptions {
|
|
8
9
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -3,9 +3,8 @@ export { t as theme } from './chunks/default.mjs';
|
|
|
3
3
|
import { r as rules } from './chunks/default2.mjs';
|
|
4
4
|
import { v as variants } from './chunks/default3.mjs';
|
|
5
5
|
export { c as colors } from './chunks/colors.mjs';
|
|
6
|
-
|
|
6
|
+
export { p as parseColor } from './chunks/utilities.mjs';
|
|
7
7
|
import '@unocss/core';
|
|
8
|
-
import './chunks/pseudo.mjs';
|
|
9
8
|
import './chunks/variants.mjs';
|
|
10
9
|
|
|
11
10
|
const presetMini = (options = {}) => {
|
package/dist/rules.cjs
CHANGED
package/dist/rules.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { l as alignments, a as appearance, G as appearances, B as aspectRatio, e as bgColors, b as borders, y as boxShadows, s as boxSizing, N as breaks, M as contents, _ as cssVariables, H as cursors, F as displays, f as flex, q as floats, R as fontSmoothings, Q as fontStyles, V as fonts, g as gaps, h as grids, n as insets, j as justifies, D as margins, c as opacity, k as orders, o as outline, i as overflows, C as paddings, m as placements, I as pointerEvents, p as positions, u as questionMark, J as resizes, x as rings, r as rules, A as sizes, S as svgUtilities, W as tabSizes, t as textAligns, d as textColors, $ as textDecorations, X as textIndents, O as textOverflows, Z as textShadows, Y as textStrokes, P as textTransforms, T as transforms, U as transitions, K as userSelects, E as varEmpty, v as verticalAligns, L as whitespaces, w as willChange, z as zIndexes } from './chunks/default2.mjs';
|
|
2
2
|
import './chunks/utilities.mjs';
|
|
3
3
|
import '@unocss/core';
|
|
4
|
-
import './chunks/pseudo.mjs';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DynamicMatcher, ParsedColorValue } from '@unocss/core';
|
|
2
|
+
import { T as Theme } from './types-a2d2b52f';
|
|
3
|
+
|
|
4
|
+
declare function capitalize<T extends string>(str: T): Capitalize<T>;
|
|
5
|
+
/**
|
|
6
|
+
* Provide {@link DynamicMatcher} function returning spacing definition. See spacing rules.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} propertyPrefix - Property for the css value to be created. Postfix will be appended according to direction matched.
|
|
9
|
+
* @return {DynamicMatcher} {@link DynamicMatcher}
|
|
10
|
+
* @see {@link directionMap}
|
|
11
|
+
*/
|
|
12
|
+
declare const directionSize: (propertyPrefix: string) => DynamicMatcher;
|
|
13
|
+
/**
|
|
14
|
+
* Parse color string into rgba (if possible) with opacity. Color value will be matched to theme object before converting to rgb value.
|
|
15
|
+
*
|
|
16
|
+
* @example Parseable strings:
|
|
17
|
+
* 'red' // From theme, if 'red' is available
|
|
18
|
+
* 'red-100' // From theme, plus scale
|
|
19
|
+
* 'red-100/20' // From theme, plus scale/opacity
|
|
20
|
+
* '#f12' // Hex color
|
|
21
|
+
* 'hex-f12' // Alternative hex color
|
|
22
|
+
* '[rgb(100,2,3)]/[var(--op)]' // Bracket with rgb color and bracket with opacity
|
|
23
|
+
*
|
|
24
|
+
* @param {string} body - Color string to be parsed.
|
|
25
|
+
* @param {Theme} theme - {@link Theme} object.
|
|
26
|
+
* @return {ParsedColorValue|undefined} {@link ParsedColorValue} object if string is parseable.
|
|
27
|
+
*/
|
|
28
|
+
declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Provide {@link DynamicMatcher} function to produce color value matched from rule.
|
|
31
|
+
*
|
|
32
|
+
* @see {@link parseColor}
|
|
33
|
+
*
|
|
34
|
+
* @example Resolving 'red' from theme:
|
|
35
|
+
* colorResolver('background-color', 'background')('', 'red')
|
|
36
|
+
* return { 'background-color': '#f12' }
|
|
37
|
+
*
|
|
38
|
+
* @example Resolving 'red-100' from theme:
|
|
39
|
+
* colorResolver('background-color', 'background')('', 'red-100')
|
|
40
|
+
* return { '--un-background-opacity': '1', 'background-color': 'rgba(254,226,226,var(--un-bg-opacity))' }
|
|
41
|
+
*
|
|
42
|
+
* @example Resolving 'red-100/20' from theme:
|
|
43
|
+
* colorResolver('background-color', 'background')('', 'red-100/20')
|
|
44
|
+
* return { 'background-color': 'rgba(204,251,241,0.22)' }
|
|
45
|
+
*
|
|
46
|
+
* @example Resolving 'hex-124':
|
|
47
|
+
* colorResolver('color', 'text')('', 'hex-124')
|
|
48
|
+
* return { '--un-text-opacity': '1', 'color': 'rgba(17,34,68,var(--un-text-opacity))' }
|
|
49
|
+
*
|
|
50
|
+
* @param {string} property - Property for the css value to be created.
|
|
51
|
+
* @param {string} varName - Base name for the opacity variable.
|
|
52
|
+
* @return {DynamicMatcher} {@link DynamicMatcher} object.
|
|
53
|
+
*/
|
|
54
|
+
declare const colorResolver: (property: string, varName: string) => DynamicMatcher;
|
|
55
|
+
|
|
56
|
+
export { colorResolver as a, capitalize as c, directionSize as d, parseColor as p };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _unocss_core from '@unocss/core';
|
|
2
|
-
import { VariantHandler
|
|
3
|
-
|
|
2
|
+
import { VariantHandler } from '@unocss/core';
|
|
3
|
+
export { c as capitalize, a as colorResolver, d as directionSize, p as parseColor } from './utilities-22a522e2';
|
|
4
|
+
import './types-a2d2b52f';
|
|
4
5
|
|
|
5
6
|
declare const directionMap: Record<string, string[]>;
|
|
6
7
|
declare const cornerMap: Record<string, string[]>;
|
|
@@ -58,56 +59,4 @@ declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit"
|
|
|
58
59
|
declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
|
|
59
60
|
declare const variantParentMatcher: (name: string, parent: string) => (input: string) => VariantHandler | undefined;
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Provide {@link DynamicMatcher} function returning spacing definition. See spacing rules.
|
|
64
|
-
*
|
|
65
|
-
* @param {string} propertyPrefix - Property for the css value to be created. Postfix will be appended according to direction matched.
|
|
66
|
-
* @return {DynamicMatcher} {@link DynamicMatcher}
|
|
67
|
-
* @see {@link directionMap}
|
|
68
|
-
*/
|
|
69
|
-
declare const directionSize: (propertyPrefix: string) => DynamicMatcher;
|
|
70
|
-
/**
|
|
71
|
-
* Parse color string into rgba (if possible) with opacity opacity. Color value will be matched to theme object before converting to rgb value.
|
|
72
|
-
*
|
|
73
|
-
* @example Parseable strings:
|
|
74
|
-
* 'red' // From theme, if 'red' is available
|
|
75
|
-
* 'red-100' // From theme, plus scale
|
|
76
|
-
* 'red-100/20' // From theme, plus scale/opacity
|
|
77
|
-
* '#f12' // Hex color
|
|
78
|
-
* 'hex-f12' // Alternative hex color
|
|
79
|
-
* '[rgb(100,2,3)]/[var(--op)]' // Bracket with rgb color and bracket with opacity
|
|
80
|
-
*
|
|
81
|
-
* @param {string} body - Color string to be parsed.
|
|
82
|
-
* @param {Theme} theme - {@link Theme} object.
|
|
83
|
-
* @return {ParsedColorValue|undefined} {@link ParsedColorValue} object if string is parseable.
|
|
84
|
-
*/
|
|
85
|
-
declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* Provide {@link DynamicMatcher} function to produce color value matched from rule.
|
|
88
|
-
*
|
|
89
|
-
* @see {@link parseColor}
|
|
90
|
-
*
|
|
91
|
-
* @example Resolving 'red' from theme:
|
|
92
|
-
* colorResolver('background-color', 'background')('', 'red')
|
|
93
|
-
* return { 'background-color': '#f12' }
|
|
94
|
-
*
|
|
95
|
-
* @example Resolving 'red-100' from theme:
|
|
96
|
-
* colorResolver('background-color', 'background')('', 'red-100')
|
|
97
|
-
* return { '--un-background-opacity': '1', 'background-color': 'rgba(254,226,226,var(--un-bg-opacity))' }
|
|
98
|
-
*
|
|
99
|
-
* @example Resolving 'red-100/20' from theme:
|
|
100
|
-
* colorResolver('background-color', 'background')('', 'red-100/20')
|
|
101
|
-
* return { 'background-color': 'rgba(204,251,241,0.22)' }
|
|
102
|
-
*
|
|
103
|
-
* @example Resolving 'hex-124':
|
|
104
|
-
* colorResolver('color', 'text')('', 'hex-124')
|
|
105
|
-
* return { '--un-text-opacity': '1', 'color': 'rgba(17,34,68,var(--un-text-opacity))' }
|
|
106
|
-
*
|
|
107
|
-
* @param {string} property - Property for the css value to be created.
|
|
108
|
-
* @param {string} varName - Base name for the opacity variable.
|
|
109
|
-
* @return {DynamicMatcher} {@link DynamicMatcher} object.
|
|
110
|
-
*/
|
|
111
|
-
declare const colorResolver: (property: string, varName: string) => DynamicMatcher;
|
|
112
|
-
|
|
113
|
-
export { capitalize, colorResolver, cornerMap, directionMap, directionSize, h, handler, parseColor, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
|
|
62
|
+
export { cornerMap, directionMap, h, handler, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
|
package/dist/variants.cjs
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const _default = require('./chunks/default3.cjs');
|
|
6
|
-
const pseudo = require('./chunks/pseudo.cjs');
|
|
7
6
|
require('./chunks/variants.cjs');
|
|
8
7
|
require('@unocss/core');
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
|
|
11
|
+
exports.CONTROL_BYPASS_PSEUDO_CLASS = _default.CONTROL_BYPASS_PSEUDO_CLASS;
|
|
12
|
+
exports.partClasses = _default.partClasses;
|
|
12
13
|
exports.variantBreakpoints = _default.variantBreakpoints;
|
|
13
14
|
exports.variantColorsMediaOrClass = _default.variantColorsMediaOrClass;
|
|
14
15
|
exports.variantCombinators = _default.variantCombinators;
|
|
@@ -18,10 +19,8 @@ exports.variantMotions = _default.variantMotions;
|
|
|
18
19
|
exports.variantNegative = _default.variantNegative;
|
|
19
20
|
exports.variantOrientations = _default.variantOrientations;
|
|
20
21
|
exports.variantPrint = _default.variantPrint;
|
|
22
|
+
exports.variantPseudoClassFunctions = _default.variantPseudoClassFunctions;
|
|
23
|
+
exports.variantPseudoClasses = _default.variantPseudoClasses;
|
|
24
|
+
exports.variantPseudoElements = _default.variantPseudoElements;
|
|
25
|
+
exports.variantTaggedPseudoClasses = _default.variantTaggedPseudoClasses;
|
|
21
26
|
exports.variants = _default.variants;
|
|
22
|
-
exports.CONTROL_BYPASS_PSEUDO_CLASS = pseudo.CONTROL_BYPASS_PSEUDO_CLASS;
|
|
23
|
-
exports.partClasses = pseudo.partClasses;
|
|
24
|
-
exports.variantPseudoClassFunctions = pseudo.variantPseudoClassFunctions;
|
|
25
|
-
exports.variantPseudoClasses = pseudo.variantPseudoClasses;
|
|
26
|
-
exports.variantPseudoElements = pseudo.variantPseudoElements;
|
|
27
|
-
exports.variantTaggedPseudoClasses = pseudo.variantTaggedPseudoClasses;
|
package/dist/variants.d.ts
CHANGED
package/dist/variants.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { a as variantBreakpoints, c as variantColorsMediaOrClass, b as variantCombinators, e as variantImportant, d as variantLanguageDirections, g as variantMotions, f as variantNegative, h as variantOrientations, i as variantPrint, v as variants } from './chunks/default3.mjs';
|
|
2
|
-
export { C as CONTROL_BYPASS_PSEUDO_CLASS, p as partClasses, a as variantPseudoClassFunctions, v as variantPseudoClasses, c as variantPseudoElements, b as variantTaggedPseudoClasses } from './chunks/pseudo.mjs';
|
|
1
|
+
export { C as CONTROL_BYPASS_PSEUDO_CLASS, p as partClasses, a as variantBreakpoints, c as variantColorsMediaOrClass, b as variantCombinators, e as variantImportant, d as variantLanguageDirections, g as variantMotions, f as variantNegative, h as variantOrientations, i as variantPrint, l as variantPseudoClassFunctions, k as variantPseudoClasses, j as variantPseudoElements, m as variantTaggedPseudoClasses, v as variants } from './chunks/default3.mjs';
|
|
3
2
|
import './chunks/variants.mjs';
|
|
4
3
|
import '@unocss/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-mini",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "The minimal preset for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"*.css"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@unocss/core": "0.
|
|
64
|
+
"@unocss/core": "0.22.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|
package/dist/chunks/pseudo.cjs
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const core = require('@unocss/core');
|
|
4
|
-
|
|
5
|
-
const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
6
|
-
const PseudoClasses = Object.fromEntries([
|
|
7
|
-
"any-link",
|
|
8
|
-
"link",
|
|
9
|
-
"visited",
|
|
10
|
-
"target",
|
|
11
|
-
["open", "[open]"],
|
|
12
|
-
"hover",
|
|
13
|
-
"active",
|
|
14
|
-
"focus-visible",
|
|
15
|
-
"focus-within",
|
|
16
|
-
"focus",
|
|
17
|
-
"autofill",
|
|
18
|
-
"enabled",
|
|
19
|
-
"disabled",
|
|
20
|
-
"read-only",
|
|
21
|
-
"read-write",
|
|
22
|
-
"placeholder-shown",
|
|
23
|
-
"default",
|
|
24
|
-
"checked",
|
|
25
|
-
"indeterminate",
|
|
26
|
-
"valid",
|
|
27
|
-
"invalid",
|
|
28
|
-
"in-range",
|
|
29
|
-
"out-of-range",
|
|
30
|
-
"required",
|
|
31
|
-
"optional",
|
|
32
|
-
"root",
|
|
33
|
-
"empty",
|
|
34
|
-
["even-of-type", ":nth-of-type(even)"],
|
|
35
|
-
["even", ":nth-child(even)"],
|
|
36
|
-
["odd-of-type", ":nth-of-type(odd)"],
|
|
37
|
-
["odd", ":nth-child(odd)"],
|
|
38
|
-
"first-of-type",
|
|
39
|
-
["first", ":first-child"],
|
|
40
|
-
"last-of-type",
|
|
41
|
-
["last", ":last-child"],
|
|
42
|
-
"only-child",
|
|
43
|
-
"only-of-type"
|
|
44
|
-
].map(core.toArray));
|
|
45
|
-
const PseudoElements = Object.fromEntries([
|
|
46
|
-
"placeholder",
|
|
47
|
-
"before",
|
|
48
|
-
"after",
|
|
49
|
-
"first-letter",
|
|
50
|
-
"first-line",
|
|
51
|
-
"selection",
|
|
52
|
-
"marker",
|
|
53
|
-
["file", "::file-selector-button"]
|
|
54
|
-
].map(core.toArray));
|
|
55
|
-
const PseudoClassFunctions = [
|
|
56
|
-
"not",
|
|
57
|
-
"is",
|
|
58
|
-
"where",
|
|
59
|
-
"has"
|
|
60
|
-
];
|
|
61
|
-
const PseudoElementsStr = Object.keys(PseudoElements).join("|");
|
|
62
|
-
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
63
|
-
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
64
|
-
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
65
|
-
const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
|
|
66
|
-
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
67
|
-
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
68
|
-
function shouldAdd(entires) {
|
|
69
|
-
return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
|
|
70
|
-
}
|
|
71
|
-
const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
72
|
-
const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
73
|
-
const rawRe = new RegExp(`^${core.escapeRegExp(parent)}:`);
|
|
74
|
-
return (input) => {
|
|
75
|
-
const match = input.match(re);
|
|
76
|
-
if (match) {
|
|
77
|
-
let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
|
|
78
|
-
if (match[2])
|
|
79
|
-
pseudo = `:${match[2]}(${pseudo})`;
|
|
80
|
-
return {
|
|
81
|
-
matcher: input.slice(match[1].length + tag.length + 2),
|
|
82
|
-
selector: (s, body) => {
|
|
83
|
-
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
const variantPseudoElements = (input) => {
|
|
90
|
-
const match = input.match(PseudoElementsRE);
|
|
91
|
-
if (match) {
|
|
92
|
-
const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
|
|
93
|
-
return {
|
|
94
|
-
matcher: input.slice(match[1].length + 1),
|
|
95
|
-
selector: (s) => `${s}${pseudo}`
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const variantPseudoClasses = {
|
|
100
|
-
match: (input) => {
|
|
101
|
-
const match = input.match(PseudoClassesRE);
|
|
102
|
-
if (match) {
|
|
103
|
-
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
104
|
-
return {
|
|
105
|
-
matcher: input.slice(match[1].length + 1),
|
|
106
|
-
selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
multiPass: true
|
|
111
|
-
};
|
|
112
|
-
const variantPseudoClassFunctions = {
|
|
113
|
-
match: (input) => {
|
|
114
|
-
const match = input.match(PseudoClassFunctionsRE);
|
|
115
|
-
if (match) {
|
|
116
|
-
const fn = match[1];
|
|
117
|
-
const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
|
|
118
|
-
return {
|
|
119
|
-
matcher: input.slice(match[1].length + match[2].length + 2),
|
|
120
|
-
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
multiPass: true
|
|
125
|
-
};
|
|
126
|
-
const variantTaggedPseudoClasses = (options = {}) => {
|
|
127
|
-
const attributify = !!options?.attributifyPseudo;
|
|
128
|
-
return [
|
|
129
|
-
{
|
|
130
|
-
match: taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
|
|
131
|
-
multiPass: true
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
|
|
135
|
-
multiPass: true
|
|
136
|
-
}
|
|
137
|
-
];
|
|
138
|
-
};
|
|
139
|
-
const partClasses = {
|
|
140
|
-
match: (input) => {
|
|
141
|
-
const match = input.match(PartClassesRE);
|
|
142
|
-
if (match) {
|
|
143
|
-
const part = `part(${match[2]})`;
|
|
144
|
-
return {
|
|
145
|
-
matcher: input.slice(match[1].length),
|
|
146
|
-
selector: (s, body) => {
|
|
147
|
-
return shouldAdd(body) && `${s}::${part}`;
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
multiPass: true
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
exports.CONTROL_BYPASS_PSEUDO_CLASS = CONTROL_BYPASS_PSEUDO_CLASS;
|
|
156
|
-
exports.partClasses = partClasses;
|
|
157
|
-
exports.variantPseudoClassFunctions = variantPseudoClassFunctions;
|
|
158
|
-
exports.variantPseudoClasses = variantPseudoClasses;
|
|
159
|
-
exports.variantPseudoElements = variantPseudoElements;
|
|
160
|
-
exports.variantTaggedPseudoClasses = variantTaggedPseudoClasses;
|
package/dist/chunks/pseudo.mjs
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { toArray, escapeRegExp } from '@unocss/core';
|
|
2
|
-
|
|
3
|
-
const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
4
|
-
const PseudoClasses = Object.fromEntries([
|
|
5
|
-
"any-link",
|
|
6
|
-
"link",
|
|
7
|
-
"visited",
|
|
8
|
-
"target",
|
|
9
|
-
["open", "[open]"],
|
|
10
|
-
"hover",
|
|
11
|
-
"active",
|
|
12
|
-
"focus-visible",
|
|
13
|
-
"focus-within",
|
|
14
|
-
"focus",
|
|
15
|
-
"autofill",
|
|
16
|
-
"enabled",
|
|
17
|
-
"disabled",
|
|
18
|
-
"read-only",
|
|
19
|
-
"read-write",
|
|
20
|
-
"placeholder-shown",
|
|
21
|
-
"default",
|
|
22
|
-
"checked",
|
|
23
|
-
"indeterminate",
|
|
24
|
-
"valid",
|
|
25
|
-
"invalid",
|
|
26
|
-
"in-range",
|
|
27
|
-
"out-of-range",
|
|
28
|
-
"required",
|
|
29
|
-
"optional",
|
|
30
|
-
"root",
|
|
31
|
-
"empty",
|
|
32
|
-
["even-of-type", ":nth-of-type(even)"],
|
|
33
|
-
["even", ":nth-child(even)"],
|
|
34
|
-
["odd-of-type", ":nth-of-type(odd)"],
|
|
35
|
-
["odd", ":nth-child(odd)"],
|
|
36
|
-
"first-of-type",
|
|
37
|
-
["first", ":first-child"],
|
|
38
|
-
"last-of-type",
|
|
39
|
-
["last", ":last-child"],
|
|
40
|
-
"only-child",
|
|
41
|
-
"only-of-type"
|
|
42
|
-
].map(toArray));
|
|
43
|
-
const PseudoElements = Object.fromEntries([
|
|
44
|
-
"placeholder",
|
|
45
|
-
"before",
|
|
46
|
-
"after",
|
|
47
|
-
"first-letter",
|
|
48
|
-
"first-line",
|
|
49
|
-
"selection",
|
|
50
|
-
"marker",
|
|
51
|
-
["file", "::file-selector-button"]
|
|
52
|
-
].map(toArray));
|
|
53
|
-
const PseudoClassFunctions = [
|
|
54
|
-
"not",
|
|
55
|
-
"is",
|
|
56
|
-
"where",
|
|
57
|
-
"has"
|
|
58
|
-
];
|
|
59
|
-
const PseudoElementsStr = Object.keys(PseudoElements).join("|");
|
|
60
|
-
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
61
|
-
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
62
|
-
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
63
|
-
const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
|
|
64
|
-
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
65
|
-
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
66
|
-
function shouldAdd(entires) {
|
|
67
|
-
return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
|
|
68
|
-
}
|
|
69
|
-
const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
70
|
-
const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
|
|
71
|
-
const rawRe = new RegExp(`^${escapeRegExp(parent)}:`);
|
|
72
|
-
return (input) => {
|
|
73
|
-
const match = input.match(re);
|
|
74
|
-
if (match) {
|
|
75
|
-
let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
|
|
76
|
-
if (match[2])
|
|
77
|
-
pseudo = `:${match[2]}(${pseudo})`;
|
|
78
|
-
return {
|
|
79
|
-
matcher: input.slice(match[1].length + tag.length + 2),
|
|
80
|
-
selector: (s, body) => {
|
|
81
|
-
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`;
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
const variantPseudoElements = (input) => {
|
|
88
|
-
const match = input.match(PseudoElementsRE);
|
|
89
|
-
if (match) {
|
|
90
|
-
const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
|
|
91
|
-
return {
|
|
92
|
-
matcher: input.slice(match[1].length + 1),
|
|
93
|
-
selector: (s) => `${s}${pseudo}`
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
const variantPseudoClasses = {
|
|
98
|
-
match: (input) => {
|
|
99
|
-
const match = input.match(PseudoClassesRE);
|
|
100
|
-
if (match) {
|
|
101
|
-
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
102
|
-
return {
|
|
103
|
-
matcher: input.slice(match[1].length + 1),
|
|
104
|
-
selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
multiPass: true
|
|
109
|
-
};
|
|
110
|
-
const variantPseudoClassFunctions = {
|
|
111
|
-
match: (input) => {
|
|
112
|
-
const match = input.match(PseudoClassFunctionsRE);
|
|
113
|
-
if (match) {
|
|
114
|
-
const fn = match[1];
|
|
115
|
-
const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
|
|
116
|
-
return {
|
|
117
|
-
matcher: input.slice(match[1].length + match[2].length + 2),
|
|
118
|
-
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
multiPass: true
|
|
123
|
-
};
|
|
124
|
-
const variantTaggedPseudoClasses = (options = {}) => {
|
|
125
|
-
const attributify = !!options?.attributifyPseudo;
|
|
126
|
-
return [
|
|
127
|
-
{
|
|
128
|
-
match: taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
|
|
129
|
-
multiPass: true
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
match: taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
|
|
133
|
-
multiPass: true
|
|
134
|
-
}
|
|
135
|
-
];
|
|
136
|
-
};
|
|
137
|
-
const partClasses = {
|
|
138
|
-
match: (input) => {
|
|
139
|
-
const match = input.match(PartClassesRE);
|
|
140
|
-
if (match) {
|
|
141
|
-
const part = `part(${match[2]})`;
|
|
142
|
-
return {
|
|
143
|
-
matcher: input.slice(match[1].length),
|
|
144
|
-
selector: (s, body) => {
|
|
145
|
-
return shouldAdd(body) && `${s}::${part}`;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
multiPass: true
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export { CONTROL_BYPASS_PSEUDO_CLASS as C, variantPseudoClassFunctions as a, variantTaggedPseudoClasses as b, variantPseudoElements as c, partClasses as p, variantPseudoClasses as v };
|