@unocss/preset-mini 0.17.3 → 0.18.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 +67 -6
- package/dist/chunks/default2.mjs +68 -7
- package/dist/chunks/default3.cjs +4 -2
- package/dist/chunks/default3.mjs +6 -4
- package/dist/chunks/pseudo.cjs +34 -25
- package/dist/chunks/pseudo.mjs +35 -27
- package/dist/index.cjs +1 -4
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +2 -5
- package/dist/variants.cjs +1 -0
- package/dist/variants.d.ts +6 -2
- package/dist/variants.mjs +2 -2
- package/package.json +2 -2
package/dist/chunks/default2.cjs
CHANGED
|
@@ -46,6 +46,12 @@ const borders = [
|
|
|
46
46
|
[/^(?:border|b)()-(.+)$/, handlerBorderColor],
|
|
47
47
|
[/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
|
|
48
48
|
[/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
49
|
+
[/^(?:border|b)-([^-]+)-op(?:acity)?-?(.+)$/, ([, a, opacity]) => {
|
|
50
|
+
const v = utilities.handler.bracket.percent(opacity);
|
|
51
|
+
const d = utilities.directionMap[a];
|
|
52
|
+
if (v !== void 0 && d)
|
|
53
|
+
return d.map((i) => [`--un-border${i}-opacity`, v]);
|
|
54
|
+
}],
|
|
49
55
|
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
50
56
|
[/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
|
|
51
57
|
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded],
|
|
@@ -55,6 +61,43 @@ const borders = [
|
|
|
55
61
|
["border-double", { "border-style": "double" }],
|
|
56
62
|
["border-none", { "border-style": "none" }]
|
|
57
63
|
];
|
|
64
|
+
const borderHasColor = (color, { theme }) => {
|
|
65
|
+
return color !== void 0 && !!utilities.parseColor(color, theme)?.color;
|
|
66
|
+
};
|
|
67
|
+
const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
68
|
+
const data = utilities.parseColor(body, theme);
|
|
69
|
+
if (!data)
|
|
70
|
+
return;
|
|
71
|
+
const { opacity, color, rgba } = data;
|
|
72
|
+
if (!color)
|
|
73
|
+
return;
|
|
74
|
+
const a = opacity ? opacity[0] === "[" ? utilities.handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
75
|
+
if (rgba) {
|
|
76
|
+
if (a != null && !Number.isNaN(a)) {
|
|
77
|
+
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
78
|
+
return {
|
|
79
|
+
[`border${direction}-color`]: `rgba(${rgba.join(",")})`
|
|
80
|
+
};
|
|
81
|
+
} else {
|
|
82
|
+
if (direction === "") {
|
|
83
|
+
return {
|
|
84
|
+
"--un-border-opacity": 1,
|
|
85
|
+
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
86
|
+
};
|
|
87
|
+
} else {
|
|
88
|
+
return {
|
|
89
|
+
"--un-border-opacity": 1,
|
|
90
|
+
[`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
|
|
91
|
+
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
return {
|
|
97
|
+
[`border${direction}-color`]: color.replace("%alpha", `${a || 1}`)
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
};
|
|
58
101
|
function handlerBorder(m) {
|
|
59
102
|
const borderSizes = handlerBorderSize(m);
|
|
60
103
|
if (borderSizes) {
|
|
@@ -71,8 +114,8 @@ function handlerBorderSize([, a, b]) {
|
|
|
71
114
|
return utilities.directionMap[d].map((i) => [`border${i}-width`, v]);
|
|
72
115
|
}
|
|
73
116
|
function handlerBorderColor([, a, c], ctx) {
|
|
74
|
-
if (
|
|
75
|
-
return Object.assign({}, ...utilities.directionMap[utilities.directionMap[a] ? a : ""].map((i) =>
|
|
117
|
+
if (borderHasColor(c, ctx)) {
|
|
118
|
+
return Object.assign({}, ...utilities.directionMap[utilities.directionMap[a] ? a : ""].map((i) => borderColorResolver(i)(["", c], ctx)));
|
|
76
119
|
}
|
|
77
120
|
}
|
|
78
121
|
function handlerRounded([, a, b], { theme }) {
|
|
@@ -524,10 +567,8 @@ const boxShadows = [
|
|
|
524
567
|
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
525
568
|
};
|
|
526
569
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
return color;
|
|
530
|
-
}]
|
|
570
|
+
}],
|
|
571
|
+
[/^shadow-(.+)$/, ([, d], { theme }) => colorResolver(d, theme)]
|
|
531
572
|
];
|
|
532
573
|
|
|
533
574
|
function getPropName(minmax, hw) {
|
|
@@ -600,6 +641,8 @@ const transforms = [
|
|
|
600
641
|
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
601
642
|
[/^rotate-(.+)$/, handleRotate],
|
|
602
643
|
[/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
|
|
644
|
+
[/^skew-([xy])-(.+)$/, handleSkew],
|
|
645
|
+
[/^skew-([xy])-((?!\[)[^-]+?)(?:deg)?$/, handleSkewWithUnit],
|
|
603
646
|
["transform-gpu", transformGpu],
|
|
604
647
|
["transform-cpu", transformCpu],
|
|
605
648
|
["transform-none", { transform: "none" }],
|
|
@@ -653,6 +696,24 @@ function handleRotate([, b]) {
|
|
|
653
696
|
];
|
|
654
697
|
}
|
|
655
698
|
}
|
|
699
|
+
function handleSkewWithUnit([, d, b]) {
|
|
700
|
+
const v = utilities.handler.bracket.number(b);
|
|
701
|
+
if (v != null) {
|
|
702
|
+
return [
|
|
703
|
+
transformBase,
|
|
704
|
+
{ [`--un-skew-${d}`]: `${v}deg` }
|
|
705
|
+
];
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
function handleSkew([, d, b]) {
|
|
709
|
+
const v = utilities.handler.bracket(b);
|
|
710
|
+
if (v != null) {
|
|
711
|
+
return [
|
|
712
|
+
transformBase,
|
|
713
|
+
{ [`--un-skew-${d}`]: v }
|
|
714
|
+
];
|
|
715
|
+
}
|
|
716
|
+
}
|
|
656
717
|
|
|
657
718
|
const variablesAbbrMap = {
|
|
658
719
|
"visible": "visibility",
|
package/dist/chunks/default2.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as handler, c as colorResolver$1, d as directionMap,
|
|
1
|
+
import { h as handler, c as colorResolver$1, d as directionMap, p as parseColor, a as cornerMap, b as capitalize, e as directionSize, x as xyzMap } from './utilities.mjs';
|
|
2
2
|
import { toArray } from '@unocss/core';
|
|
3
3
|
import { C as CONTROL_BYPASS_PSEUDO_CLASS } from './pseudo.mjs';
|
|
4
4
|
|
|
@@ -44,6 +44,12 @@ const borders = [
|
|
|
44
44
|
[/^(?:border|b)()-(.+)$/, handlerBorderColor],
|
|
45
45
|
[/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
|
|
46
46
|
[/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": handler.bracket.percent(opacity) })],
|
|
47
|
+
[/^(?:border|b)-([^-]+)-op(?:acity)?-?(.+)$/, ([, a, opacity]) => {
|
|
48
|
+
const v = handler.bracket.percent(opacity);
|
|
49
|
+
const d = directionMap[a];
|
|
50
|
+
if (v !== void 0 && d)
|
|
51
|
+
return d.map((i) => [`--un-border${i}-opacity`, v]);
|
|
52
|
+
}],
|
|
47
53
|
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
48
54
|
[/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
|
|
49
55
|
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded],
|
|
@@ -53,6 +59,43 @@ const borders = [
|
|
|
53
59
|
["border-double", { "border-style": "double" }],
|
|
54
60
|
["border-none", { "border-style": "none" }]
|
|
55
61
|
];
|
|
62
|
+
const borderHasColor = (color, { theme }) => {
|
|
63
|
+
return color !== void 0 && !!parseColor(color, theme)?.color;
|
|
64
|
+
};
|
|
65
|
+
const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
66
|
+
const data = parseColor(body, theme);
|
|
67
|
+
if (!data)
|
|
68
|
+
return;
|
|
69
|
+
const { opacity, color, rgba } = data;
|
|
70
|
+
if (!color)
|
|
71
|
+
return;
|
|
72
|
+
const a = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
73
|
+
if (rgba) {
|
|
74
|
+
if (a != null && !Number.isNaN(a)) {
|
|
75
|
+
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
76
|
+
return {
|
|
77
|
+
[`border${direction}-color`]: `rgba(${rgba.join(",")})`
|
|
78
|
+
};
|
|
79
|
+
} else {
|
|
80
|
+
if (direction === "") {
|
|
81
|
+
return {
|
|
82
|
+
"--un-border-opacity": 1,
|
|
83
|
+
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
84
|
+
};
|
|
85
|
+
} else {
|
|
86
|
+
return {
|
|
87
|
+
"--un-border-opacity": 1,
|
|
88
|
+
[`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
|
|
89
|
+
[`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
return {
|
|
95
|
+
[`border${direction}-color`]: color.replace("%alpha", `${a || 1}`)
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
};
|
|
56
99
|
function handlerBorder(m) {
|
|
57
100
|
const borderSizes = handlerBorderSize(m);
|
|
58
101
|
if (borderSizes) {
|
|
@@ -69,8 +112,8 @@ function handlerBorderSize([, a, b]) {
|
|
|
69
112
|
return directionMap[d].map((i) => [`border${i}-width`, v]);
|
|
70
113
|
}
|
|
71
114
|
function handlerBorderColor([, a, c], ctx) {
|
|
72
|
-
if (
|
|
73
|
-
return Object.assign({}, ...directionMap[directionMap[a] ? a : ""].map((i) =>
|
|
115
|
+
if (borderHasColor(c, ctx)) {
|
|
116
|
+
return Object.assign({}, ...directionMap[directionMap[a] ? a : ""].map((i) => borderColorResolver(i)(["", c], ctx)));
|
|
74
117
|
}
|
|
75
118
|
}
|
|
76
119
|
function handlerRounded([, a, b], { theme }) {
|
|
@@ -522,10 +565,8 @@ const boxShadows = [
|
|
|
522
565
|
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
523
566
|
};
|
|
524
567
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
return color;
|
|
528
|
-
}]
|
|
568
|
+
}],
|
|
569
|
+
[/^shadow-(.+)$/, ([, d], { theme }) => colorResolver(d, theme)]
|
|
529
570
|
];
|
|
530
571
|
|
|
531
572
|
function getPropName(minmax, hw) {
|
|
@@ -598,6 +639,8 @@ const transforms = [
|
|
|
598
639
|
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
599
640
|
[/^rotate-(.+)$/, handleRotate],
|
|
600
641
|
[/^rotate-((?!\[)[^-]+?)(?:deg)?$/, handleRotateWithUnit],
|
|
642
|
+
[/^skew-([xy])-(.+)$/, handleSkew],
|
|
643
|
+
[/^skew-([xy])-((?!\[)[^-]+?)(?:deg)?$/, handleSkewWithUnit],
|
|
601
644
|
["transform-gpu", transformGpu],
|
|
602
645
|
["transform-cpu", transformCpu],
|
|
603
646
|
["transform-none", { transform: "none" }],
|
|
@@ -651,6 +694,24 @@ function handleRotate([, b]) {
|
|
|
651
694
|
];
|
|
652
695
|
}
|
|
653
696
|
}
|
|
697
|
+
function handleSkewWithUnit([, d, b]) {
|
|
698
|
+
const v = handler.bracket.number(b);
|
|
699
|
+
if (v != null) {
|
|
700
|
+
return [
|
|
701
|
+
transformBase,
|
|
702
|
+
{ [`--un-skew-${d}`]: `${v}deg` }
|
|
703
|
+
];
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
function handleSkew([, d, b]) {
|
|
707
|
+
const v = handler.bracket(b);
|
|
708
|
+
if (v != null) {
|
|
709
|
+
return [
|
|
710
|
+
transformBase,
|
|
711
|
+
{ [`--un-skew-${d}`]: v }
|
|
712
|
+
];
|
|
713
|
+
}
|
|
714
|
+
}
|
|
654
715
|
|
|
655
716
|
const variablesAbbrMap = {
|
|
656
717
|
"visible": "visibility",
|
package/dist/chunks/default3.cjs
CHANGED
|
@@ -113,15 +113,17 @@ const variantSpace = (matcher) => {
|
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
const variants = [
|
|
116
|
+
const variants = (options) => [
|
|
117
117
|
variantSpace,
|
|
118
118
|
variantNegative,
|
|
119
119
|
variantImportant,
|
|
120
120
|
variantBreakpoints,
|
|
121
121
|
...variantCombinators,
|
|
122
122
|
pseudo.variantPseudoClasses,
|
|
123
|
+
pseudo.variantTaggedPseudoClasses(options),
|
|
123
124
|
pseudo.variantPseudoElements,
|
|
124
|
-
pseudo.partClasses
|
|
125
|
+
pseudo.partClasses,
|
|
126
|
+
...options.dark === "media" ? variantColorsMedia : variantColorsClass
|
|
125
127
|
];
|
|
126
128
|
|
|
127
129
|
exports.variantBreakpoints = variantBreakpoints;
|
package/dist/chunks/default3.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v as variantMatcher } from './variants.mjs';
|
|
2
|
-
import { v as variantPseudoClasses, a as variantPseudoElements, p as partClasses } from './pseudo.mjs';
|
|
2
|
+
import { v as variantPseudoClasses, a as variantTaggedPseudoClasses, b as variantPseudoElements, p as partClasses } from './pseudo.mjs';
|
|
3
3
|
|
|
4
4
|
const regexCache = {};
|
|
5
5
|
const variantBreakpoints = (matcher, _, theme) => {
|
|
@@ -111,15 +111,17 @@ const variantSpace = (matcher) => {
|
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
-
const variants = [
|
|
114
|
+
const variants = (options) => [
|
|
115
115
|
variantSpace,
|
|
116
116
|
variantNegative,
|
|
117
117
|
variantImportant,
|
|
118
118
|
variantBreakpoints,
|
|
119
119
|
...variantCombinators,
|
|
120
120
|
variantPseudoClasses,
|
|
121
|
+
variantTaggedPseudoClasses(options),
|
|
121
122
|
variantPseudoElements,
|
|
122
|
-
partClasses
|
|
123
|
+
partClasses,
|
|
124
|
+
...options.dark === "media" ? variantColorsMedia : variantColorsClass
|
|
123
125
|
];
|
|
124
126
|
|
|
125
|
-
export {
|
|
127
|
+
export { variantBreakpoints as a, variantCombinators as b, variantColorsClass as c, variantColorsMedia as d, variantImportant as e, variantNegative as f, variantSpace as g, variants as v };
|
package/dist/chunks/pseudo.cjs
CHANGED
|
@@ -52,8 +52,27 @@ const PseudoElementsRE = new RegExp(`^(${PseudoElements.join("|")})[:-]`);
|
|
|
52
52
|
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
53
53
|
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
54
54
|
const PseudoClassesNotRE = new RegExp(`^not-(${PseudoClassesStr})[:-]`);
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
function shouldAdd(entires) {
|
|
56
|
+
return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
|
|
57
|
+
}
|
|
58
|
+
function taggedPseudoClassMatcher(tag, parent, combinator) {
|
|
59
|
+
const re = new RegExp(`^${tag}-((not-)?(${PseudoClassesStr}))[:-]`);
|
|
60
|
+
const rawRe = new RegExp(`^${core.escapeRegExp(parent)}:`);
|
|
61
|
+
return (input) => {
|
|
62
|
+
const match = input.match(re);
|
|
63
|
+
if (match) {
|
|
64
|
+
let pseudo = PseudoClasses[match[3]] || match[3];
|
|
65
|
+
if (match[2])
|
|
66
|
+
pseudo = `not(:${pseudo})`;
|
|
67
|
+
return {
|
|
68
|
+
matcher: input.slice(match[1].length + tag.length + 2),
|
|
69
|
+
selector: (s, body) => {
|
|
70
|
+
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}:${pseudo}:`) : `${parent}:${pseudo}${combinator}${s}`;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
57
76
|
const variantPseudoElements = (input) => {
|
|
58
77
|
const match = input.match(PseudoElementsRE);
|
|
59
78
|
if (match) {
|
|
@@ -63,9 +82,6 @@ const variantPseudoElements = (input) => {
|
|
|
63
82
|
};
|
|
64
83
|
}
|
|
65
84
|
};
|
|
66
|
-
function shouldAdd(entires) {
|
|
67
|
-
return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
|
|
68
|
-
}
|
|
69
85
|
const variantPseudoClasses = {
|
|
70
86
|
match: (input) => {
|
|
71
87
|
let match = input.match(PseudoClassesRE);
|
|
@@ -84,29 +100,21 @@ const variantPseudoClasses = {
|
|
|
84
100
|
selector: (s, body) => shouldAdd(body) && `${s}:not(:${pseudo})`
|
|
85
101
|
};
|
|
86
102
|
}
|
|
87
|
-
match = input.match(PseudoClassesGroupRE);
|
|
88
|
-
if (match) {
|
|
89
|
-
let pseudo = PseudoClasses[match[3]] || match[3];
|
|
90
|
-
if (match[2])
|
|
91
|
-
pseudo = `not(:${pseudo})`;
|
|
92
|
-
return {
|
|
93
|
-
matcher: input.slice(match[1].length + 7),
|
|
94
|
-
selector: (s, body) => shouldAdd(body) && s.includes(".group:") ? s.replace(/\.group:/, `.group:${pseudo}:`) : `.group:${pseudo} ${s}`
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
match = input.match(PseudoClassesPeerRE);
|
|
98
|
-
if (match) {
|
|
99
|
-
let pseudo = PseudoClasses[match[3]] || match[3];
|
|
100
|
-
if (match[2])
|
|
101
|
-
pseudo = `not(:${pseudo})`;
|
|
102
|
-
return {
|
|
103
|
-
matcher: input.slice(match[1].length + 6),
|
|
104
|
-
selector: (s, body) => shouldAdd(body) && s.includes(".peer:") ? s.replace(/\.peer:/, `.peer:${pseudo}:`) : `.peer:${pseudo}~${s}`
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
103
|
},
|
|
108
104
|
multiPass: true
|
|
109
105
|
};
|
|
106
|
+
const variantTaggedPseudoClasses = (options = {}) => ({
|
|
107
|
+
match: (input) => {
|
|
108
|
+
const attributify = !!options?.attributifyPseudo;
|
|
109
|
+
const g = taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " ")(input);
|
|
110
|
+
if (g)
|
|
111
|
+
return g;
|
|
112
|
+
const p = taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~")(input);
|
|
113
|
+
if (p)
|
|
114
|
+
return p;
|
|
115
|
+
},
|
|
116
|
+
multiPass: true
|
|
117
|
+
});
|
|
110
118
|
const partClasses = {
|
|
111
119
|
match: (input) => {
|
|
112
120
|
const match = input.match(PartClassesRE);
|
|
@@ -128,3 +136,4 @@ exports.PseudoClasses = PseudoClasses;
|
|
|
128
136
|
exports.partClasses = partClasses;
|
|
129
137
|
exports.variantPseudoClasses = variantPseudoClasses;
|
|
130
138
|
exports.variantPseudoElements = variantPseudoElements;
|
|
139
|
+
exports.variantTaggedPseudoClasses = variantTaggedPseudoClasses;
|
package/dist/chunks/pseudo.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toArray } from '@unocss/core';
|
|
1
|
+
import { toArray, escapeRegExp } from '@unocss/core';
|
|
2
2
|
|
|
3
3
|
const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
4
4
|
const PseudoClasses = Object.fromEntries([
|
|
@@ -50,8 +50,27 @@ const PseudoElementsRE = new RegExp(`^(${PseudoElements.join("|")})[:-]`);
|
|
|
50
50
|
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
51
51
|
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
52
52
|
const PseudoClassesNotRE = new RegExp(`^not-(${PseudoClassesStr})[:-]`);
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
function shouldAdd(entires) {
|
|
54
|
+
return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
|
|
55
|
+
}
|
|
56
|
+
function taggedPseudoClassMatcher(tag, parent, combinator) {
|
|
57
|
+
const re = new RegExp(`^${tag}-((not-)?(${PseudoClassesStr}))[:-]`);
|
|
58
|
+
const rawRe = new RegExp(`^${escapeRegExp(parent)}:`);
|
|
59
|
+
return (input) => {
|
|
60
|
+
const match = input.match(re);
|
|
61
|
+
if (match) {
|
|
62
|
+
let pseudo = PseudoClasses[match[3]] || match[3];
|
|
63
|
+
if (match[2])
|
|
64
|
+
pseudo = `not(:${pseudo})`;
|
|
65
|
+
return {
|
|
66
|
+
matcher: input.slice(match[1].length + tag.length + 2),
|
|
67
|
+
selector: (s, body) => {
|
|
68
|
+
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}:${pseudo}:`) : `${parent}:${pseudo}${combinator}${s}`;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
55
74
|
const variantPseudoElements = (input) => {
|
|
56
75
|
const match = input.match(PseudoElementsRE);
|
|
57
76
|
if (match) {
|
|
@@ -61,9 +80,6 @@ const variantPseudoElements = (input) => {
|
|
|
61
80
|
};
|
|
62
81
|
}
|
|
63
82
|
};
|
|
64
|
-
function shouldAdd(entires) {
|
|
65
|
-
return !entires.find((i) => i[0] === CONTROL_BYPASS_PSEUDO_CLASS) || void 0;
|
|
66
|
-
}
|
|
67
83
|
const variantPseudoClasses = {
|
|
68
84
|
match: (input) => {
|
|
69
85
|
let match = input.match(PseudoClassesRE);
|
|
@@ -82,29 +98,21 @@ const variantPseudoClasses = {
|
|
|
82
98
|
selector: (s, body) => shouldAdd(body) && `${s}:not(:${pseudo})`
|
|
83
99
|
};
|
|
84
100
|
}
|
|
85
|
-
match = input.match(PseudoClassesGroupRE);
|
|
86
|
-
if (match) {
|
|
87
|
-
let pseudo = PseudoClasses[match[3]] || match[3];
|
|
88
|
-
if (match[2])
|
|
89
|
-
pseudo = `not(:${pseudo})`;
|
|
90
|
-
return {
|
|
91
|
-
matcher: input.slice(match[1].length + 7),
|
|
92
|
-
selector: (s, body) => shouldAdd(body) && s.includes(".group:") ? s.replace(/\.group:/, `.group:${pseudo}:`) : `.group:${pseudo} ${s}`
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
match = input.match(PseudoClassesPeerRE);
|
|
96
|
-
if (match) {
|
|
97
|
-
let pseudo = PseudoClasses[match[3]] || match[3];
|
|
98
|
-
if (match[2])
|
|
99
|
-
pseudo = `not(:${pseudo})`;
|
|
100
|
-
return {
|
|
101
|
-
matcher: input.slice(match[1].length + 6),
|
|
102
|
-
selector: (s, body) => shouldAdd(body) && s.includes(".peer:") ? s.replace(/\.peer:/, `.peer:${pseudo}:`) : `.peer:${pseudo}~${s}`
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
101
|
},
|
|
106
102
|
multiPass: true
|
|
107
103
|
};
|
|
104
|
+
const variantTaggedPseudoClasses = (options = {}) => ({
|
|
105
|
+
match: (input) => {
|
|
106
|
+
const attributify = !!options?.attributifyPseudo;
|
|
107
|
+
const g = taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " ")(input);
|
|
108
|
+
if (g)
|
|
109
|
+
return g;
|
|
110
|
+
const p = taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~")(input);
|
|
111
|
+
if (p)
|
|
112
|
+
return p;
|
|
113
|
+
},
|
|
114
|
+
multiPass: true
|
|
115
|
+
});
|
|
108
116
|
const partClasses = {
|
|
109
117
|
match: (input) => {
|
|
110
118
|
const match = input.match(PartClassesRE);
|
|
@@ -121,4 +129,4 @@ const partClasses = {
|
|
|
121
129
|
multiPass: true
|
|
122
130
|
};
|
|
123
131
|
|
|
124
|
-
export { CONTROL_BYPASS_PSEUDO_CLASS as C, PseudoClasses as P,
|
|
132
|
+
export { CONTROL_BYPASS_PSEUDO_CLASS as C, PseudoClasses as P, variantTaggedPseudoClasses as a, variantPseudoElements as b, partClasses as p, variantPseudoClasses as v };
|
package/dist/index.cjs
CHANGED
|
@@ -15,10 +15,7 @@ const presetMini = (options = {}) => ({
|
|
|
15
15
|
name: "@unocss/preset-mini",
|
|
16
16
|
theme: _default.theme,
|
|
17
17
|
rules: _default$1.rules,
|
|
18
|
-
variants:
|
|
19
|
-
..._default$2.variants,
|
|
20
|
-
...options.dark === "media" ? _default$2.variantColorsMedia : _default$2.variantColorsClass
|
|
21
|
-
],
|
|
18
|
+
variants: _default$2.variants(options),
|
|
22
19
|
options
|
|
23
20
|
});
|
|
24
21
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as theme } from './chunks/default.mjs';
|
|
2
2
|
export { t as theme } from './chunks/default.mjs';
|
|
3
3
|
import { r as rules } from './chunks/default2.mjs';
|
|
4
|
-
import { v as variants
|
|
4
|
+
import { v as variants } from './chunks/default3.mjs';
|
|
5
5
|
export { c as colors } from './chunks/colors.mjs';
|
|
6
6
|
import './chunks/utilities.mjs';
|
|
7
7
|
import '@unocss/core';
|
|
@@ -12,10 +12,7 @@ const presetMini = (options = {}) => ({
|
|
|
12
12
|
name: "@unocss/preset-mini",
|
|
13
13
|
theme,
|
|
14
14
|
rules,
|
|
15
|
-
variants:
|
|
16
|
-
...variants,
|
|
17
|
-
...options.dark === "media" ? variantColorsMedia : variantColorsClass
|
|
18
|
-
],
|
|
15
|
+
variants: variants(options),
|
|
19
16
|
options
|
|
20
17
|
});
|
|
21
18
|
|
package/dist/variants.cjs
CHANGED
|
@@ -22,3 +22,4 @@ exports.PseudoClasses = pseudo.PseudoClasses;
|
|
|
22
22
|
exports.partClasses = pseudo.partClasses;
|
|
23
23
|
exports.variantPseudoClasses = pseudo.variantPseudoClasses;
|
|
24
24
|
exports.variantPseudoElements = pseudo.variantPseudoElements;
|
|
25
|
+
exports.variantTaggedPseudoClasses = pseudo.variantTaggedPseudoClasses;
|
package/dist/variants.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Variant, VariantFunction, VariantObject } from '@unocss/core';
|
|
2
2
|
import { T as Theme } from './types-7963d0b3';
|
|
3
|
+
import { PresetMiniOptions } from './index';
|
|
4
|
+
import './default-c7c67d23';
|
|
5
|
+
import './colors-d6b5a5b4';
|
|
3
6
|
|
|
4
7
|
declare const variantBreakpoints: Variant<Theme>;
|
|
5
8
|
|
|
@@ -8,7 +11,7 @@ declare const variantCombinators: Variant[];
|
|
|
8
11
|
declare const variantColorsClass: Variant[];
|
|
9
12
|
declare const variantColorsMedia: Variant[];
|
|
10
13
|
|
|
11
|
-
declare const variants: Variant<Theme>[];
|
|
14
|
+
declare const variants: (options: PresetMiniOptions) => Variant<Theme>[];
|
|
12
15
|
|
|
13
16
|
declare const variantImportant: Variant;
|
|
14
17
|
declare const variantNegative: Variant;
|
|
@@ -18,6 +21,7 @@ declare const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
|
18
21
|
declare const PseudoClasses: Record<string, string | undefined>;
|
|
19
22
|
declare const variantPseudoElements: VariantFunction;
|
|
20
23
|
declare const variantPseudoClasses: VariantObject;
|
|
24
|
+
declare const variantTaggedPseudoClasses: (options?: PresetMiniOptions) => VariantObject;
|
|
21
25
|
declare const partClasses: VariantObject;
|
|
22
26
|
|
|
23
|
-
export { CONTROL_BYPASS_PSEUDO_CLASS, PseudoClasses, partClasses, variantBreakpoints, variantColorsClass, variantColorsMedia, variantCombinators, variantImportant, variantNegative, variantPseudoClasses, variantPseudoElements, variantSpace, variants };
|
|
27
|
+
export { CONTROL_BYPASS_PSEUDO_CLASS, PseudoClasses, partClasses, variantBreakpoints, variantColorsClass, variantColorsMedia, variantCombinators, variantImportant, variantNegative, variantPseudoClasses, variantPseudoElements, variantSpace, variantTaggedPseudoClasses, variants };
|
package/dist/variants.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { C as CONTROL_BYPASS_PSEUDO_CLASS, P as PseudoClasses, p as partClasses, v as variantPseudoClasses,
|
|
1
|
+
export { a as variantBreakpoints, c as variantColorsClass, d as variantColorsMedia, b as variantCombinators, e as variantImportant, f as variantNegative, g as variantSpace, v as variants } from './chunks/default3.mjs';
|
|
2
|
+
export { C as CONTROL_BYPASS_PSEUDO_CLASS, P as PseudoClasses, p as partClasses, v as variantPseudoClasses, b as variantPseudoElements, a as variantTaggedPseudoClasses } from './chunks/pseudo.mjs';
|
|
3
3
|
import './chunks/variants.mjs';
|
|
4
4
|
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.18.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.18.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|