@unocss/preset-mini 0.18.1 → 0.20.2
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/default.cjs +6 -6
- package/dist/chunks/default.mjs +6 -6
- package/dist/chunks/default2.cjs +43 -115
- package/dist/chunks/default2.mjs +53 -125
- package/dist/chunks/default3.cjs +46 -26
- package/dist/chunks/default3.mjs +43 -26
- package/dist/chunks/pseudo.cjs +23 -20
- package/dist/chunks/pseudo.mjs +23 -20
- package/dist/chunks/utilities.cjs +20 -9
- package/dist/chunks/utilities.mjs +20 -9
- package/dist/chunks/variants.cjs +17 -2
- package/dist/chunks/variants.mjs +17 -3
- package/dist/index.cjs +21 -7
- package/dist/index.d.ts +6 -2
- package/dist/index.mjs +21 -7
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +2 -1
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +5 -2
- package/dist/variants.d.ts +13 -8
- package/dist/variants.mjs +1 -1
- package/package.json +2 -2
package/dist/chunks/pseudo.cjs
CHANGED
|
@@ -8,6 +8,7 @@ const PseudoClasses = Object.fromEntries([
|
|
|
8
8
|
"link",
|
|
9
9
|
"visited",
|
|
10
10
|
"target",
|
|
11
|
+
["open", "[open]"],
|
|
11
12
|
"hover",
|
|
12
13
|
"active",
|
|
13
14
|
"focus-visible",
|
|
@@ -24,18 +25,20 @@ const PseudoClasses = Object.fromEntries([
|
|
|
24
25
|
"indeterminate",
|
|
25
26
|
"valid",
|
|
26
27
|
"invalid",
|
|
28
|
+
"in-range",
|
|
29
|
+
"out-of-range",
|
|
27
30
|
"required",
|
|
28
31
|
"optional",
|
|
29
32
|
"root",
|
|
30
33
|
"empty",
|
|
31
|
-
["even-of-type", "nth-of-type(even)"],
|
|
32
|
-
["even", "nth-child(even)"],
|
|
33
|
-
["odd-of-type", "nth-of-type(odd)"],
|
|
34
|
-
["odd", "nth-child(odd)"],
|
|
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)"],
|
|
35
38
|
"first-of-type",
|
|
36
|
-
["first", "first-child"],
|
|
39
|
+
["first", ":first-child"],
|
|
37
40
|
"last-of-type",
|
|
38
|
-
["last", "last-child"],
|
|
41
|
+
["last", ":last-child"],
|
|
39
42
|
"only-child",
|
|
40
43
|
"only-of-type"
|
|
41
44
|
].map(core.toArray));
|
|
@@ -45,7 +48,8 @@ const PseudoElements = [
|
|
|
45
48
|
"after",
|
|
46
49
|
"first-letter",
|
|
47
50
|
"first-line",
|
|
48
|
-
"selection"
|
|
51
|
+
"selection",
|
|
52
|
+
"marker"
|
|
49
53
|
];
|
|
50
54
|
const PseudoClassFunctions = [
|
|
51
55
|
"not",
|
|
@@ -68,13 +72,13 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
68
72
|
return (input) => {
|
|
69
73
|
const match = input.match(re);
|
|
70
74
|
if (match) {
|
|
71
|
-
let pseudo = PseudoClasses[match[3]] || match[3]
|
|
75
|
+
let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
|
|
72
76
|
if (match[2])
|
|
73
|
-
pseudo =
|
|
77
|
+
pseudo = `:${match[2]}(${pseudo})`;
|
|
74
78
|
return {
|
|
75
79
|
matcher: input.slice(match[1].length + tag.length + 2),
|
|
76
80
|
selector: (s, body) => {
|
|
77
|
-
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}
|
|
81
|
+
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`;
|
|
78
82
|
}
|
|
79
83
|
};
|
|
80
84
|
}
|
|
@@ -93,10 +97,10 @@ const variantPseudoClasses = {
|
|
|
93
97
|
match: (input) => {
|
|
94
98
|
const match = input.match(PseudoClassesRE);
|
|
95
99
|
if (match) {
|
|
96
|
-
const pseudo = PseudoClasses[match[1]] || match[1]
|
|
100
|
+
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
97
101
|
return {
|
|
98
102
|
matcher: input.slice(match[1].length + 1),
|
|
99
|
-
selector: (s, body) => shouldAdd(body) && `${s}
|
|
103
|
+
selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
|
|
100
104
|
};
|
|
101
105
|
}
|
|
102
106
|
},
|
|
@@ -107,27 +111,26 @@ const variantPseudoClassFunctions = {
|
|
|
107
111
|
const match = input.match(PseudoClassFunctionsRE);
|
|
108
112
|
if (match) {
|
|
109
113
|
const fn = match[1];
|
|
110
|
-
const pseudo = PseudoClasses[match[2]] || match[2]
|
|
114
|
+
const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
|
|
111
115
|
return {
|
|
112
116
|
matcher: input.slice(match[1].length + match[2].length + 2),
|
|
113
|
-
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(
|
|
117
|
+
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
|
|
114
118
|
};
|
|
115
119
|
}
|
|
116
120
|
},
|
|
117
121
|
multiPass: true
|
|
118
122
|
};
|
|
119
|
-
const variantTaggedPseudoClasses =
|
|
120
|
-
match: (input) => {
|
|
121
|
-
const
|
|
122
|
-
const g = taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " ")(input);
|
|
123
|
+
const variantTaggedPseudoClasses = {
|
|
124
|
+
match: (input, { options: { attributifyPseudo } }) => {
|
|
125
|
+
const g = taggedPseudoClassMatcher("group", attributifyPseudo ? '[group=""]' : ".group", " ")(input);
|
|
123
126
|
if (g)
|
|
124
127
|
return g;
|
|
125
|
-
const p = taggedPseudoClassMatcher("peer",
|
|
128
|
+
const p = taggedPseudoClassMatcher("peer", attributifyPseudo ? '[peer=""]' : ".peer", "~")(input);
|
|
126
129
|
if (p)
|
|
127
130
|
return p;
|
|
128
131
|
},
|
|
129
132
|
multiPass: true
|
|
130
|
-
}
|
|
133
|
+
};
|
|
131
134
|
const partClasses = {
|
|
132
135
|
match: (input) => {
|
|
133
136
|
const match = input.match(PartClassesRE);
|
package/dist/chunks/pseudo.mjs
CHANGED
|
@@ -6,6 +6,7 @@ const PseudoClasses = Object.fromEntries([
|
|
|
6
6
|
"link",
|
|
7
7
|
"visited",
|
|
8
8
|
"target",
|
|
9
|
+
["open", "[open]"],
|
|
9
10
|
"hover",
|
|
10
11
|
"active",
|
|
11
12
|
"focus-visible",
|
|
@@ -22,18 +23,20 @@ const PseudoClasses = Object.fromEntries([
|
|
|
22
23
|
"indeterminate",
|
|
23
24
|
"valid",
|
|
24
25
|
"invalid",
|
|
26
|
+
"in-range",
|
|
27
|
+
"out-of-range",
|
|
25
28
|
"required",
|
|
26
29
|
"optional",
|
|
27
30
|
"root",
|
|
28
31
|
"empty",
|
|
29
|
-
["even-of-type", "nth-of-type(even)"],
|
|
30
|
-
["even", "nth-child(even)"],
|
|
31
|
-
["odd-of-type", "nth-of-type(odd)"],
|
|
32
|
-
["odd", "nth-child(odd)"],
|
|
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)"],
|
|
33
36
|
"first-of-type",
|
|
34
|
-
["first", "first-child"],
|
|
37
|
+
["first", ":first-child"],
|
|
35
38
|
"last-of-type",
|
|
36
|
-
["last", "last-child"],
|
|
39
|
+
["last", ":last-child"],
|
|
37
40
|
"only-child",
|
|
38
41
|
"only-of-type"
|
|
39
42
|
].map(toArray));
|
|
@@ -43,7 +46,8 @@ const PseudoElements = [
|
|
|
43
46
|
"after",
|
|
44
47
|
"first-letter",
|
|
45
48
|
"first-line",
|
|
46
|
-
"selection"
|
|
49
|
+
"selection",
|
|
50
|
+
"marker"
|
|
47
51
|
];
|
|
48
52
|
const PseudoClassFunctions = [
|
|
49
53
|
"not",
|
|
@@ -66,13 +70,13 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
66
70
|
return (input) => {
|
|
67
71
|
const match = input.match(re);
|
|
68
72
|
if (match) {
|
|
69
|
-
let pseudo = PseudoClasses[match[3]] || match[3]
|
|
73
|
+
let pseudo = PseudoClasses[match[3]] || `:${match[3]}`;
|
|
70
74
|
if (match[2])
|
|
71
|
-
pseudo =
|
|
75
|
+
pseudo = `:${match[2]}(${pseudo})`;
|
|
72
76
|
return {
|
|
73
77
|
matcher: input.slice(match[1].length + tag.length + 2),
|
|
74
78
|
selector: (s, body) => {
|
|
75
|
-
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}
|
|
79
|
+
return shouldAdd(body) && rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`;
|
|
76
80
|
}
|
|
77
81
|
};
|
|
78
82
|
}
|
|
@@ -91,10 +95,10 @@ const variantPseudoClasses = {
|
|
|
91
95
|
match: (input) => {
|
|
92
96
|
const match = input.match(PseudoClassesRE);
|
|
93
97
|
if (match) {
|
|
94
|
-
const pseudo = PseudoClasses[match[1]] || match[1]
|
|
98
|
+
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
95
99
|
return {
|
|
96
100
|
matcher: input.slice(match[1].length + 1),
|
|
97
|
-
selector: (s, body) => shouldAdd(body) && `${s}
|
|
101
|
+
selector: (s, body) => shouldAdd(body) && `${s}${pseudo}`
|
|
98
102
|
};
|
|
99
103
|
}
|
|
100
104
|
},
|
|
@@ -105,27 +109,26 @@ const variantPseudoClassFunctions = {
|
|
|
105
109
|
const match = input.match(PseudoClassFunctionsRE);
|
|
106
110
|
if (match) {
|
|
107
111
|
const fn = match[1];
|
|
108
|
-
const pseudo = PseudoClasses[match[2]] || match[2]
|
|
112
|
+
const pseudo = PseudoClasses[match[2]] || `:${match[2]}`;
|
|
109
113
|
return {
|
|
110
114
|
matcher: input.slice(match[1].length + match[2].length + 2),
|
|
111
|
-
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(
|
|
115
|
+
selector: (s, body) => shouldAdd(body) && `${s}:${fn}(${pseudo})`
|
|
112
116
|
};
|
|
113
117
|
}
|
|
114
118
|
},
|
|
115
119
|
multiPass: true
|
|
116
120
|
};
|
|
117
|
-
const variantTaggedPseudoClasses =
|
|
118
|
-
match: (input) => {
|
|
119
|
-
const
|
|
120
|
-
const g = taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " ")(input);
|
|
121
|
+
const variantTaggedPseudoClasses = {
|
|
122
|
+
match: (input, { options: { attributifyPseudo } }) => {
|
|
123
|
+
const g = taggedPseudoClassMatcher("group", attributifyPseudo ? '[group=""]' : ".group", " ")(input);
|
|
121
124
|
if (g)
|
|
122
125
|
return g;
|
|
123
|
-
const p = taggedPseudoClassMatcher("peer",
|
|
126
|
+
const p = taggedPseudoClassMatcher("peer", attributifyPseudo ? '[peer=""]' : ".peer", "~")(input);
|
|
124
127
|
if (p)
|
|
125
128
|
return p;
|
|
126
129
|
},
|
|
127
130
|
multiPass: true
|
|
128
|
-
}
|
|
131
|
+
};
|
|
129
132
|
const partClasses = {
|
|
130
133
|
match: (input) => {
|
|
131
134
|
const match = input.match(PartClassesRE);
|
|
@@ -225,8 +225,10 @@ const parseColor = (body, theme) => {
|
|
|
225
225
|
const bracketOrMain = bracket || main;
|
|
226
226
|
if (bracketOrMain.startsWith("#"))
|
|
227
227
|
color = bracketOrMain.slice(1);
|
|
228
|
-
if (bracketOrMain.startsWith("hex-"))
|
|
228
|
+
else if (bracketOrMain.startsWith("hex-"))
|
|
229
229
|
color = bracketOrMain.slice(4);
|
|
230
|
+
else if (main.startsWith("$"))
|
|
231
|
+
color = handler.cssvar(main);
|
|
230
232
|
color = color || bracket;
|
|
231
233
|
let no = "DEFAULT";
|
|
232
234
|
if (!color) {
|
|
@@ -247,37 +249,46 @@ const parseColor = (body, theme) => {
|
|
|
247
249
|
else if (no && colorData)
|
|
248
250
|
color = colorData[no];
|
|
249
251
|
}
|
|
252
|
+
const rgba = core.hex2rgba(color);
|
|
253
|
+
const alpha = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
254
|
+
const hasAlpha = alpha != null && !Number.isNaN(alpha);
|
|
255
|
+
if (rgba) {
|
|
256
|
+
if (hasAlpha) {
|
|
257
|
+
rgba[3] = typeof alpha === "string" && !alpha.includes("%") ? parseFloat(alpha) : alpha;
|
|
258
|
+
} else {
|
|
259
|
+
rgba.splice(3);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
250
262
|
return {
|
|
251
263
|
opacity,
|
|
252
264
|
name,
|
|
253
265
|
no,
|
|
254
266
|
color,
|
|
255
|
-
rgba
|
|
267
|
+
rgba,
|
|
268
|
+
alpha: hasAlpha ? alpha : void 0
|
|
256
269
|
};
|
|
257
270
|
};
|
|
258
271
|
const colorResolver = (property, varName) => ([, body], { theme }) => {
|
|
259
272
|
const data = parseColor(body, theme);
|
|
260
273
|
if (!data)
|
|
261
274
|
return;
|
|
262
|
-
const { opacity, color, rgba } = data;
|
|
275
|
+
const { alpha, opacity, color, rgba } = data;
|
|
263
276
|
if (!color)
|
|
264
277
|
return;
|
|
265
|
-
const a = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
266
278
|
if (rgba) {
|
|
267
|
-
if (
|
|
268
|
-
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
279
|
+
if (alpha != null) {
|
|
269
280
|
return {
|
|
270
281
|
[property]: `rgba(${rgba.join(",")})`
|
|
271
282
|
};
|
|
272
283
|
} else {
|
|
273
284
|
return {
|
|
274
|
-
[`--un-${varName}-opacity`]: 1,
|
|
275
|
-
[property]: `rgba(${rgba.
|
|
285
|
+
[`--un-${varName}-opacity`]: (opacity && handler.cssvar(opacity)) ?? 1,
|
|
286
|
+
[property]: `rgba(${rgba.join(",")},var(--un-${varName}-opacity))`
|
|
276
287
|
};
|
|
277
288
|
}
|
|
278
289
|
} else {
|
|
279
290
|
return {
|
|
280
|
-
[property]: color.replace("%alpha", `${
|
|
291
|
+
[property]: color.replace("%alpha", `${alpha || 1}`)
|
|
281
292
|
};
|
|
282
293
|
}
|
|
283
294
|
};
|
|
@@ -223,8 +223,10 @@ const parseColor = (body, theme) => {
|
|
|
223
223
|
const bracketOrMain = bracket || main;
|
|
224
224
|
if (bracketOrMain.startsWith("#"))
|
|
225
225
|
color = bracketOrMain.slice(1);
|
|
226
|
-
if (bracketOrMain.startsWith("hex-"))
|
|
226
|
+
else if (bracketOrMain.startsWith("hex-"))
|
|
227
227
|
color = bracketOrMain.slice(4);
|
|
228
|
+
else if (main.startsWith("$"))
|
|
229
|
+
color = handler.cssvar(main);
|
|
228
230
|
color = color || bracket;
|
|
229
231
|
let no = "DEFAULT";
|
|
230
232
|
if (!color) {
|
|
@@ -245,37 +247,46 @@ const parseColor = (body, theme) => {
|
|
|
245
247
|
else if (no && colorData)
|
|
246
248
|
color = colorData[no];
|
|
247
249
|
}
|
|
250
|
+
const rgba = hex2rgba(color);
|
|
251
|
+
const alpha = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
252
|
+
const hasAlpha = alpha != null && !Number.isNaN(alpha);
|
|
253
|
+
if (rgba) {
|
|
254
|
+
if (hasAlpha) {
|
|
255
|
+
rgba[3] = typeof alpha === "string" && !alpha.includes("%") ? parseFloat(alpha) : alpha;
|
|
256
|
+
} else {
|
|
257
|
+
rgba.splice(3);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
248
260
|
return {
|
|
249
261
|
opacity,
|
|
250
262
|
name,
|
|
251
263
|
no,
|
|
252
264
|
color,
|
|
253
|
-
rgba
|
|
265
|
+
rgba,
|
|
266
|
+
alpha: hasAlpha ? alpha : void 0
|
|
254
267
|
};
|
|
255
268
|
};
|
|
256
269
|
const colorResolver = (property, varName) => ([, body], { theme }) => {
|
|
257
270
|
const data = parseColor(body, theme);
|
|
258
271
|
if (!data)
|
|
259
272
|
return;
|
|
260
|
-
const { opacity, color, rgba } = data;
|
|
273
|
+
const { alpha, opacity, color, rgba } = data;
|
|
261
274
|
if (!color)
|
|
262
275
|
return;
|
|
263
|
-
const a = opacity ? opacity[0] === "[" ? handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
264
276
|
if (rgba) {
|
|
265
|
-
if (
|
|
266
|
-
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
277
|
+
if (alpha != null) {
|
|
267
278
|
return {
|
|
268
279
|
[property]: `rgba(${rgba.join(",")})`
|
|
269
280
|
};
|
|
270
281
|
} else {
|
|
271
282
|
return {
|
|
272
|
-
[`--un-${varName}-opacity`]: 1,
|
|
273
|
-
[property]: `rgba(${rgba.
|
|
283
|
+
[`--un-${varName}-opacity`]: (opacity && handler.cssvar(opacity)) ?? 1,
|
|
284
|
+
[property]: `rgba(${rgba.join(",")},var(--un-${varName}-opacity))`
|
|
274
285
|
};
|
|
275
286
|
}
|
|
276
287
|
} else {
|
|
277
288
|
return {
|
|
278
|
-
[property]: color.replace("%alpha", `${
|
|
289
|
+
[property]: color.replace("%alpha", `${alpha || 1}`)
|
|
279
290
|
};
|
|
280
291
|
}
|
|
281
292
|
};
|
package/dist/chunks/variants.cjs
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const core = require('@unocss/core');
|
|
4
|
+
|
|
3
5
|
const variantMatcher = (name, selector) => {
|
|
4
|
-
const re = new RegExp(
|
|
6
|
+
const re = new RegExp(`^${core.escapeRegExp(name)}[:-]`);
|
|
5
7
|
return (input) => {
|
|
6
8
|
const match = input.match(re);
|
|
7
9
|
if (match) {
|
|
8
10
|
return {
|
|
9
|
-
matcher: input.slice(match[
|
|
11
|
+
matcher: input.slice(match[0].length),
|
|
10
12
|
selector
|
|
11
13
|
};
|
|
12
14
|
}
|
|
13
15
|
};
|
|
14
16
|
};
|
|
17
|
+
const variantParentMatcher = (name, parent) => {
|
|
18
|
+
const re = new RegExp(`^${core.escapeRegExp(name)}[:-]`);
|
|
19
|
+
return (input) => {
|
|
20
|
+
const match = input.match(re);
|
|
21
|
+
if (match) {
|
|
22
|
+
return {
|
|
23
|
+
matcher: input.slice(match[0].length),
|
|
24
|
+
parent
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
15
29
|
|
|
16
30
|
exports.variantMatcher = variantMatcher;
|
|
31
|
+
exports.variantParentMatcher = variantParentMatcher;
|
package/dist/chunks/variants.mjs
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
|
+
import { escapeRegExp } from '@unocss/core';
|
|
2
|
+
|
|
1
3
|
const variantMatcher = (name, selector) => {
|
|
2
|
-
const re = new RegExp(
|
|
4
|
+
const re = new RegExp(`^${escapeRegExp(name)}[:-]`);
|
|
3
5
|
return (input) => {
|
|
4
6
|
const match = input.match(re);
|
|
5
7
|
if (match) {
|
|
6
8
|
return {
|
|
7
|
-
matcher: input.slice(match[
|
|
9
|
+
matcher: input.slice(match[0].length),
|
|
8
10
|
selector
|
|
9
11
|
};
|
|
10
12
|
}
|
|
11
13
|
};
|
|
12
14
|
};
|
|
15
|
+
const variantParentMatcher = (name, parent) => {
|
|
16
|
+
const re = new RegExp(`^${escapeRegExp(name)}[:-]`);
|
|
17
|
+
return (input) => {
|
|
18
|
+
const match = input.match(re);
|
|
19
|
+
if (match) {
|
|
20
|
+
return {
|
|
21
|
+
matcher: input.slice(match[0].length),
|
|
22
|
+
parent
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
13
27
|
|
|
14
|
-
export { variantMatcher as v };
|
|
28
|
+
export { variantParentMatcher as a, variantMatcher as v };
|
package/dist/index.cjs
CHANGED
|
@@ -11,13 +11,27 @@ require('@unocss/core');
|
|
|
11
11
|
require('./chunks/pseudo.cjs');
|
|
12
12
|
require('./chunks/variants.cjs');
|
|
13
13
|
|
|
14
|
-
const presetMini = (options = {}) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
const presetMini = (options = {}) => {
|
|
15
|
+
options.dark = options.dark ?? "class";
|
|
16
|
+
options.attributifyPseudo = options.attributifyPseudo ?? false;
|
|
17
|
+
return {
|
|
18
|
+
name: "@unocss/preset-mini",
|
|
19
|
+
theme: _default.theme,
|
|
20
|
+
rules: _default$1.rules,
|
|
21
|
+
variants: _default$2.variants,
|
|
22
|
+
options,
|
|
23
|
+
postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? VarPrefixPostprocessor(options.variablePrefix) : void 0
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
function VarPrefixPostprocessor(prefix) {
|
|
27
|
+
return (obj) => {
|
|
28
|
+
obj.entries.forEach((i) => {
|
|
29
|
+
i[0] = i[0].replace(/^--un-/, `--${prefix}`);
|
|
30
|
+
if (typeof i[1] === "string")
|
|
31
|
+
i[1] = i[1].replace(/var\(--un-/g, `var(--${prefix}`);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
}
|
|
21
35
|
|
|
22
36
|
exports.theme = _default.theme;
|
|
23
37
|
exports.colors = colors.colors;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Preset } from '@unocss/core';
|
|
1
|
+
import { PresetOptions, Preset } from '@unocss/core';
|
|
2
2
|
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
6
|
|
|
7
|
-
interface PresetMiniOptions {
|
|
7
|
+
interface PresetMiniOptions extends PresetOptions {
|
|
8
8
|
/**
|
|
9
9
|
* @default 'class'
|
|
10
10
|
*/
|
|
@@ -13,6 +13,10 @@ interface PresetMiniOptions {
|
|
|
13
13
|
* @default false
|
|
14
14
|
*/
|
|
15
15
|
attributifyPseudo?: Boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @default 'un-'
|
|
18
|
+
*/
|
|
19
|
+
variablePrefix?: string;
|
|
16
20
|
}
|
|
17
21
|
declare const presetMini: (options?: PresetMiniOptions) => Preset<Theme>;
|
|
18
22
|
|
package/dist/index.mjs
CHANGED
|
@@ -8,12 +8,26 @@ import '@unocss/core';
|
|
|
8
8
|
import './chunks/pseudo.mjs';
|
|
9
9
|
import './chunks/variants.mjs';
|
|
10
10
|
|
|
11
|
-
const presetMini = (options = {}) =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
const presetMini = (options = {}) => {
|
|
12
|
+
options.dark = options.dark ?? "class";
|
|
13
|
+
options.attributifyPseudo = options.attributifyPseudo ?? false;
|
|
14
|
+
return {
|
|
15
|
+
name: "@unocss/preset-mini",
|
|
16
|
+
theme,
|
|
17
|
+
rules,
|
|
18
|
+
variants,
|
|
19
|
+
options,
|
|
20
|
+
postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? VarPrefixPostprocessor(options.variablePrefix) : void 0
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
function VarPrefixPostprocessor(prefix) {
|
|
24
|
+
return (obj) => {
|
|
25
|
+
obj.entries.forEach((i) => {
|
|
26
|
+
i[0] = i[0].replace(/^--un-/, `--${prefix}`);
|
|
27
|
+
if (typeof i[1] === "string")
|
|
28
|
+
i[1] = i[1].replace(/var\(--un-/g, `var(--${prefix}`);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
}
|
|
18
32
|
|
|
19
33
|
export { presetMini as default, presetMini };
|
package/dist/utils.cjs
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ declare const handler: _unocss_core.ValueHandler<"number" | "auto" | "numberWith
|
|
|
52
52
|
declare const h: _unocss_core.ValueHandler<"number" | "auto" | "numberWithUnit" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global" | "properties">;
|
|
53
53
|
|
|
54
54
|
declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
|
|
55
|
+
declare const variantParentMatcher: (name: string, parent: string) => (input: string) => VariantHandler | undefined;
|
|
55
56
|
|
|
56
57
|
declare function capitalize<T extends string>(str: T): Capitalize<T>;
|
|
57
58
|
/**
|
|
@@ -105,4 +106,4 @@ declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | und
|
|
|
105
106
|
*/
|
|
106
107
|
declare const colorResolver: (property: string, varName: string) => DynamicMatcher;
|
|
107
108
|
|
|
108
|
-
export { capitalize, colorResolver, cornerMap, directionMap, directionSize, h, handler, parseColor, handlers as valueHandlers, variantMatcher, xyzMap };
|
|
109
|
+
export { capitalize, colorResolver, cornerMap, directionMap, directionSize, h, handler, parseColor, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
|
package/dist/utils.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { b as capitalize, c as colorResolver, a as cornerMap, d as directionMap, e as directionSize, f as h, h as handler, p as parseColor, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
|
|
2
|
-
export { v as variantMatcher } from './chunks/variants.mjs';
|
|
2
|
+
export { v as variantMatcher, a as variantParentMatcher } from './chunks/variants.mjs';
|
|
3
3
|
import '@unocss/core';
|
package/dist/variants.cjs
CHANGED
|
@@ -10,11 +10,14 @@ require('@unocss/core');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
exports.variantBreakpoints = _default.variantBreakpoints;
|
|
13
|
-
exports.
|
|
14
|
-
exports.variantColorsMedia = _default.variantColorsMedia;
|
|
13
|
+
exports.variantColorsMediaOrClass = _default.variantColorsMediaOrClass;
|
|
15
14
|
exports.variantCombinators = _default.variantCombinators;
|
|
16
15
|
exports.variantImportant = _default.variantImportant;
|
|
16
|
+
exports.variantLanguageDirections = _default.variantLanguageDirections;
|
|
17
|
+
exports.variantMotions = _default.variantMotions;
|
|
17
18
|
exports.variantNegative = _default.variantNegative;
|
|
19
|
+
exports.variantOrientations = _default.variantOrientations;
|
|
20
|
+
exports.variantPrint = _default.variantPrint;
|
|
18
21
|
exports.variantSpace = _default.variantSpace;
|
|
19
22
|
exports.variants = _default.variants;
|
|
20
23
|
exports.CONTROL_BYPASS_PSEUDO_CLASS = pseudo.CONTROL_BYPASS_PSEUDO_CLASS;
|
package/dist/variants.d.ts
CHANGED
|
@@ -1,27 +1,32 @@
|
|
|
1
|
+
import * as _unocss_core from '@unocss/core';
|
|
1
2
|
import { Variant, VariantFunction, VariantObject } from '@unocss/core';
|
|
2
3
|
import { T as Theme } from './types-a2d2b52f';
|
|
3
|
-
import { PresetMiniOptions } from './index';
|
|
4
|
-
import './default-958434b6';
|
|
5
|
-
import './colors-6d634692';
|
|
6
4
|
|
|
7
5
|
declare const variantBreakpoints: Variant<Theme>;
|
|
8
6
|
|
|
9
7
|
declare const variantCombinators: Variant[];
|
|
10
8
|
|
|
11
|
-
declare const
|
|
12
|
-
declare const variantColorsMedia: Variant[];
|
|
9
|
+
declare const variantColorsMediaOrClass: Variant[];
|
|
13
10
|
|
|
14
|
-
declare const
|
|
11
|
+
declare const variantLanguageDirections: Variant[];
|
|
12
|
+
|
|
13
|
+
declare const variants: Variant<Theme>[];
|
|
15
14
|
|
|
16
15
|
declare const variantImportant: Variant;
|
|
17
16
|
declare const variantNegative: Variant;
|
|
18
17
|
declare const variantSpace: Variant;
|
|
19
18
|
|
|
19
|
+
declare const variantMotions: Variant[];
|
|
20
|
+
|
|
21
|
+
declare const variantOrientations: Variant[];
|
|
22
|
+
|
|
23
|
+
declare const variantPrint: (input: string) => _unocss_core.VariantHandler | undefined;
|
|
24
|
+
|
|
20
25
|
declare const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
|
|
21
26
|
declare const variantPseudoElements: VariantFunction;
|
|
22
27
|
declare const variantPseudoClasses: VariantObject;
|
|
23
28
|
declare const variantPseudoClassFunctions: VariantObject;
|
|
24
|
-
declare const variantTaggedPseudoClasses:
|
|
29
|
+
declare const variantTaggedPseudoClasses: VariantObject;
|
|
25
30
|
declare const partClasses: VariantObject;
|
|
26
31
|
|
|
27
|
-
export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints,
|
|
32
|
+
export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantImportant, variantLanguageDirections, variantMotions, variantNegative, variantOrientations, variantPrint, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantSpace, variantTaggedPseudoClasses, variants };
|
package/dist/variants.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as variantBreakpoints, c as
|
|
1
|
+
export { a as variantBreakpoints, c as variantColorsMediaOrClass, b as variantCombinators, e as variantImportant, d as variantLanguageDirections, h as variantMotions, f as variantNegative, i as variantOrientations, j as variantPrint, g as variantSpace, v as variants } from './chunks/default3.mjs';
|
|
2
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';
|
|
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.20.2",
|
|
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.20.2"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|