@unocss/preset-mini 0.40.0 → 0.41.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/default3.cjs +43 -18
- package/dist/chunks/default3.mjs +43 -18
- package/dist/chunks/utilities.cjs +1 -1
- package/dist/chunks/utilities.mjs +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.mjs +4 -2
- package/package.json +2 -2
package/dist/chunks/default3.cjs
CHANGED
|
@@ -32,22 +32,35 @@ const variantBreakpoints = {
|
|
|
32
32
|
order -= idx + 1;
|
|
33
33
|
return {
|
|
34
34
|
matcher: m,
|
|
35
|
-
|
|
35
|
+
handle: (input, next) => next({
|
|
36
|
+
...input,
|
|
37
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}@media (max-width: ${calcMaxWidthBySize(size)})`,
|
|
38
|
+
parentOrder: order
|
|
39
|
+
})
|
|
36
40
|
};
|
|
37
41
|
}
|
|
38
42
|
order += idx + 1;
|
|
39
43
|
if (isAtPrefix && idx < variantEntries.length - 1) {
|
|
40
44
|
return {
|
|
41
45
|
matcher: m,
|
|
42
|
-
|
|
46
|
+
handle: (input, next) => next({
|
|
47
|
+
...input,
|
|
48
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}@media (min-width: ${size}) and (max-width: ${calcMaxWidthBySize(variantEntries[idx + 1][1])})`,
|
|
49
|
+
parentOrder: order
|
|
50
|
+
})
|
|
43
51
|
};
|
|
44
52
|
}
|
|
45
53
|
return {
|
|
46
54
|
matcher: m,
|
|
47
|
-
|
|
55
|
+
handle: (input, next) => next({
|
|
56
|
+
...input,
|
|
57
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}@media (min-width: ${size})`,
|
|
58
|
+
parentOrder: order
|
|
59
|
+
})
|
|
48
60
|
};
|
|
49
61
|
}
|
|
50
62
|
},
|
|
63
|
+
multiPass: true,
|
|
51
64
|
autocomplete: "(at-|lt-|)$breakpoints:"
|
|
52
65
|
};
|
|
53
66
|
|
|
@@ -87,17 +100,21 @@ const variantCustomMedia = {
|
|
|
87
100
|
const media = theme.media?.[match[1]] ?? `(--${match[1]})`;
|
|
88
101
|
return {
|
|
89
102
|
matcher: matcher.slice(match[0].length),
|
|
90
|
-
|
|
103
|
+
handle: (input, next) => next({
|
|
104
|
+
...input,
|
|
105
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}@media ${media}`
|
|
106
|
+
})
|
|
91
107
|
};
|
|
92
108
|
}
|
|
93
|
-
}
|
|
109
|
+
},
|
|
110
|
+
multiPass: true
|
|
94
111
|
};
|
|
95
112
|
|
|
96
113
|
const variantColorsMediaOrClass = (options = {}) => {
|
|
97
114
|
if (options?.dark === "class") {
|
|
98
115
|
return [
|
|
99
|
-
variants$1.variantMatcher("dark", (input) => ({ prefix:
|
|
100
|
-
variants$1.variantMatcher("light", (input) => ({ prefix:
|
|
116
|
+
variants$1.variantMatcher("dark", (input) => ({ prefix: `.dark $$ ${input.prefix}` })),
|
|
117
|
+
variants$1.variantMatcher("light", (input) => ({ prefix: `.light $$ ${input.prefix}` }))
|
|
101
118
|
];
|
|
102
119
|
}
|
|
103
120
|
return [
|
|
@@ -107,8 +124,8 @@ const variantColorsMediaOrClass = (options = {}) => {
|
|
|
107
124
|
};
|
|
108
125
|
|
|
109
126
|
const variantLanguageDirections = [
|
|
110
|
-
variants$1.variantMatcher("rtl", (input) => ({ prefix:
|
|
111
|
-
variants$1.variantMatcher("ltr", (input) => ({ prefix:
|
|
127
|
+
variants$1.variantMatcher("rtl", (input) => ({ prefix: `[dir="rtl"] $$ ${input.prefix}` })),
|
|
128
|
+
variants$1.variantMatcher("ltr", (input) => ({ prefix: `[dir="ltr"] $$ ${input.prefix}` }))
|
|
112
129
|
];
|
|
113
130
|
|
|
114
131
|
const variantSelector = {
|
|
@@ -130,7 +147,10 @@ const variantCssLayer = {
|
|
|
130
147
|
if (match) {
|
|
131
148
|
return {
|
|
132
149
|
matcher: matcher.slice(match[0].length),
|
|
133
|
-
|
|
150
|
+
handle: (input, next) => next({
|
|
151
|
+
...input,
|
|
152
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}@layer ${match[1]}`
|
|
153
|
+
})
|
|
134
154
|
};
|
|
135
155
|
}
|
|
136
156
|
}
|
|
@@ -162,17 +182,22 @@ const variantScope = {
|
|
|
162
182
|
const variantVariables = {
|
|
163
183
|
name: "variables",
|
|
164
184
|
match(matcher) {
|
|
165
|
-
const match = matcher.match(/^(\[
|
|
185
|
+
const match = matcher.match(/^(\[.+?\]):/);
|
|
166
186
|
if (match) {
|
|
167
187
|
const variant = utilities.handler.bracket(match[1]) ?? "";
|
|
168
|
-
const updates = variant.startsWith("@") ? {
|
|
169
|
-
parent: variant
|
|
170
|
-
} : {
|
|
171
|
-
selector: (s) => variant.replace(/&/g, s)
|
|
172
|
-
};
|
|
173
188
|
return {
|
|
174
189
|
matcher: matcher.slice(match[0].length),
|
|
175
|
-
|
|
190
|
+
handle(input, next) {
|
|
191
|
+
const updates = variant.startsWith("@") ? {
|
|
192
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}${variant}`
|
|
193
|
+
} : {
|
|
194
|
+
selector: variant.replace(/&/g, input.selector)
|
|
195
|
+
};
|
|
196
|
+
return next({
|
|
197
|
+
...input,
|
|
198
|
+
...updates
|
|
199
|
+
});
|
|
200
|
+
}
|
|
176
201
|
};
|
|
177
202
|
}
|
|
178
203
|
},
|
|
@@ -316,7 +341,7 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
316
341
|
matcher: input.slice(match[0].length),
|
|
317
342
|
handle: (input2, next) => next({
|
|
318
343
|
...input2,
|
|
319
|
-
prefix: rawRe.test(input2.prefix) ? input2.prefix.replace(rawRe, `${parent}${pseudo}:`) : `${
|
|
344
|
+
prefix: rawRe.test(input2.prefix) ? input2.prefix.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${input2.prefix}`,
|
|
320
345
|
sort: sortValue(match[3])
|
|
321
346
|
})
|
|
322
347
|
};
|
package/dist/chunks/default3.mjs
CHANGED
|
@@ -30,22 +30,35 @@ const variantBreakpoints = {
|
|
|
30
30
|
order -= idx + 1;
|
|
31
31
|
return {
|
|
32
32
|
matcher: m,
|
|
33
|
-
|
|
33
|
+
handle: (input, next) => next({
|
|
34
|
+
...input,
|
|
35
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}@media (max-width: ${calcMaxWidthBySize(size)})`,
|
|
36
|
+
parentOrder: order
|
|
37
|
+
})
|
|
34
38
|
};
|
|
35
39
|
}
|
|
36
40
|
order += idx + 1;
|
|
37
41
|
if (isAtPrefix && idx < variantEntries.length - 1) {
|
|
38
42
|
return {
|
|
39
43
|
matcher: m,
|
|
40
|
-
|
|
44
|
+
handle: (input, next) => next({
|
|
45
|
+
...input,
|
|
46
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}@media (min-width: ${size}) and (max-width: ${calcMaxWidthBySize(variantEntries[idx + 1][1])})`,
|
|
47
|
+
parentOrder: order
|
|
48
|
+
})
|
|
41
49
|
};
|
|
42
50
|
}
|
|
43
51
|
return {
|
|
44
52
|
matcher: m,
|
|
45
|
-
|
|
53
|
+
handle: (input, next) => next({
|
|
54
|
+
...input,
|
|
55
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}@media (min-width: ${size})`,
|
|
56
|
+
parentOrder: order
|
|
57
|
+
})
|
|
46
58
|
};
|
|
47
59
|
}
|
|
48
60
|
},
|
|
61
|
+
multiPass: true,
|
|
49
62
|
autocomplete: "(at-|lt-|)$breakpoints:"
|
|
50
63
|
};
|
|
51
64
|
|
|
@@ -85,17 +98,21 @@ const variantCustomMedia = {
|
|
|
85
98
|
const media = theme.media?.[match[1]] ?? `(--${match[1]})`;
|
|
86
99
|
return {
|
|
87
100
|
matcher: matcher.slice(match[0].length),
|
|
88
|
-
|
|
101
|
+
handle: (input, next) => next({
|
|
102
|
+
...input,
|
|
103
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}@media ${media}`
|
|
104
|
+
})
|
|
89
105
|
};
|
|
90
106
|
}
|
|
91
|
-
}
|
|
107
|
+
},
|
|
108
|
+
multiPass: true
|
|
92
109
|
};
|
|
93
110
|
|
|
94
111
|
const variantColorsMediaOrClass = (options = {}) => {
|
|
95
112
|
if (options?.dark === "class") {
|
|
96
113
|
return [
|
|
97
|
-
variantMatcher("dark", (input) => ({ prefix:
|
|
98
|
-
variantMatcher("light", (input) => ({ prefix:
|
|
114
|
+
variantMatcher("dark", (input) => ({ prefix: `.dark $$ ${input.prefix}` })),
|
|
115
|
+
variantMatcher("light", (input) => ({ prefix: `.light $$ ${input.prefix}` }))
|
|
99
116
|
];
|
|
100
117
|
}
|
|
101
118
|
return [
|
|
@@ -105,8 +122,8 @@ const variantColorsMediaOrClass = (options = {}) => {
|
|
|
105
122
|
};
|
|
106
123
|
|
|
107
124
|
const variantLanguageDirections = [
|
|
108
|
-
variantMatcher("rtl", (input) => ({ prefix:
|
|
109
|
-
variantMatcher("ltr", (input) => ({ prefix:
|
|
125
|
+
variantMatcher("rtl", (input) => ({ prefix: `[dir="rtl"] $$ ${input.prefix}` })),
|
|
126
|
+
variantMatcher("ltr", (input) => ({ prefix: `[dir="ltr"] $$ ${input.prefix}` }))
|
|
110
127
|
];
|
|
111
128
|
|
|
112
129
|
const variantSelector = {
|
|
@@ -128,7 +145,10 @@ const variantCssLayer = {
|
|
|
128
145
|
if (match) {
|
|
129
146
|
return {
|
|
130
147
|
matcher: matcher.slice(match[0].length),
|
|
131
|
-
|
|
148
|
+
handle: (input, next) => next({
|
|
149
|
+
...input,
|
|
150
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}@layer ${match[1]}`
|
|
151
|
+
})
|
|
132
152
|
};
|
|
133
153
|
}
|
|
134
154
|
}
|
|
@@ -160,17 +180,22 @@ const variantScope = {
|
|
|
160
180
|
const variantVariables = {
|
|
161
181
|
name: "variables",
|
|
162
182
|
match(matcher) {
|
|
163
|
-
const match = matcher.match(/^(\[
|
|
183
|
+
const match = matcher.match(/^(\[.+?\]):/);
|
|
164
184
|
if (match) {
|
|
165
185
|
const variant = handler.bracket(match[1]) ?? "";
|
|
166
|
-
const updates = variant.startsWith("@") ? {
|
|
167
|
-
parent: variant
|
|
168
|
-
} : {
|
|
169
|
-
selector: (s) => variant.replace(/&/g, s)
|
|
170
|
-
};
|
|
171
186
|
return {
|
|
172
187
|
matcher: matcher.slice(match[0].length),
|
|
173
|
-
|
|
188
|
+
handle(input, next) {
|
|
189
|
+
const updates = variant.startsWith("@") ? {
|
|
190
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ""}${variant}`
|
|
191
|
+
} : {
|
|
192
|
+
selector: variant.replace(/&/g, input.selector)
|
|
193
|
+
};
|
|
194
|
+
return next({
|
|
195
|
+
...input,
|
|
196
|
+
...updates
|
|
197
|
+
});
|
|
198
|
+
}
|
|
174
199
|
};
|
|
175
200
|
}
|
|
176
201
|
},
|
|
@@ -314,7 +339,7 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
314
339
|
matcher: input.slice(match[0].length),
|
|
315
340
|
handle: (input2, next) => next({
|
|
316
341
|
...input2,
|
|
317
|
-
prefix: rawRe.test(input2.prefix) ? input2.prefix.replace(rawRe, `${parent}${pseudo}:`) : `${
|
|
342
|
+
prefix: rawRe.test(input2.prefix) ? input2.prefix.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${input2.prefix}`,
|
|
318
343
|
sort: sortValue(match[3])
|
|
319
344
|
})
|
|
320
345
|
};
|
|
@@ -449,7 +449,7 @@ function bracketWithType(str, type) {
|
|
|
449
449
|
else if (type && match[1] === type)
|
|
450
450
|
base = str.slice(match[0].length, -1);
|
|
451
451
|
if (base !== void 0) {
|
|
452
|
-
return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/([^\\])_/g, "$1 ").replace(/calc\((.*)/g, (v) => {
|
|
452
|
+
return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/([^\\])_/g, "$1 ").replace(/(?:calc|clamp|max|min)\((.*)/g, (v) => {
|
|
453
453
|
return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
|
|
454
454
|
});
|
|
455
455
|
}
|
|
@@ -447,7 +447,7 @@ function bracketWithType(str, type) {
|
|
|
447
447
|
else if (type && match[1] === type)
|
|
448
448
|
base = str.slice(match[0].length, -1);
|
|
449
449
|
if (base !== void 0) {
|
|
450
|
-
return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/([^\\])_/g, "$1 ").replace(/calc\((.*)/g, (v) => {
|
|
450
|
+
return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/([^\\])_/g, "$1 ").replace(/(?:calc|clamp|max|min)\((.*)/g, (v) => {
|
|
451
451
|
return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ");
|
|
452
452
|
});
|
|
453
453
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -15,8 +15,10 @@ const preflights = [
|
|
|
15
15
|
{
|
|
16
16
|
layer: "preflights",
|
|
17
17
|
getCSS(ctx) {
|
|
18
|
-
if (ctx.theme.preflightBase)
|
|
19
|
-
|
|
18
|
+
if (ctx.theme.preflightBase) {
|
|
19
|
+
const css = core.entriesToCss(Object.entries(ctx.theme.preflightBase));
|
|
20
|
+
return `*,::before,::after{${css}}::backdrop{${css}}`;
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
];
|
package/dist/index.mjs
CHANGED
|
@@ -12,8 +12,10 @@ const preflights = [
|
|
|
12
12
|
{
|
|
13
13
|
layer: "preflights",
|
|
14
14
|
getCSS(ctx) {
|
|
15
|
-
if (ctx.theme.preflightBase)
|
|
16
|
-
|
|
15
|
+
if (ctx.theme.preflightBase) {
|
|
16
|
+
const css = entriesToCss(Object.entries(ctx.theme.preflightBase));
|
|
17
|
+
return `*,::before,::after{${css}}::backdrop{${css}}`;
|
|
18
|
+
}
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-mini",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "The minimal preset for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"*.css"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@unocss/core": "0.
|
|
64
|
+
"@unocss/core": "0.41.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|