@unocss/preset-mini 0.20.4 → 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/default.cjs +8 -10
- package/dist/chunks/default.mjs +8 -10
- package/dist/chunks/default2.cjs +147 -123
- package/dist/chunks/default2.mjs +148 -124
- package/dist/chunks/default3.cjs +175 -25
- package/dist/chunks/default3.mjs +166 -22
- package/dist/chunks/utilities.cjs +23 -15
- package/dist/chunks/utilities.mjs +23 -15
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +2 -3
- package/dist/rules.cjs +0 -1
- package/dist/rules.mjs +0 -1
- package/dist/theme.d.ts +0 -10
- package/dist/utilities-22a522e2.d.ts +56 -0
- package/dist/utils.d.ts +9 -57
- package/dist/variants.cjs +6 -7
- package/dist/variants.d.ts +7 -3
- package/dist/variants.mjs +1 -2
- package/package.json +2 -2
- package/dist/chunks/pseudo.cjs +0 -158
- package/dist/chunks/pseudo.mjs +0 -151
package/dist/chunks/default.cjs
CHANGED
|
@@ -74,7 +74,7 @@ const textShadow = {
|
|
|
74
74
|
DEFAULT: "0px 0px 1px rgb(0 0 0/20%), 0px 0px 1px rgb(1 0 5/10%)",
|
|
75
75
|
sm: "1px 1px 3px rgb(36 37 47 / 25%)",
|
|
76
76
|
md: "0px 1px 2px rgb(30 29 39 / 19%), 1px 2px 4px rgb(54 64 147 / 18%)",
|
|
77
|
-
lg: "3px 3px 6px rgb(0 0 0 / 26%),
|
|
77
|
+
lg: "3px 3px 6px rgb(0 0 0 / 26%), 0px 0px 5px rgb(15 3 86 / 22%)",
|
|
78
78
|
xl: "1px 1px 3px rgb(0 0 0 / 29%), 2px 4px 7px rgb(73 64 125 / 35%)",
|
|
79
79
|
none: "none"
|
|
80
80
|
};
|
|
@@ -115,14 +115,14 @@ const borderRadius = {
|
|
|
115
115
|
"full": "9999px"
|
|
116
116
|
};
|
|
117
117
|
const boxShadow = {
|
|
118
|
-
"DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 1px 2px
|
|
118
|
+
"DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 1px 2px -1px rgba(var(--un-shadow-color), 0.1)",
|
|
119
119
|
"sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.05)",
|
|
120
|
-
"md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 2px 4px -
|
|
121
|
-
"lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 4px 6px -
|
|
122
|
-
"xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0
|
|
120
|
+
"md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 2px 4px -2px rgba(var(--un-shadow-color), 0.1)",
|
|
121
|
+
"lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 4px 6px -4px rgba(var(--un-shadow-color), 0.1)",
|
|
122
|
+
"xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 8px 10px -6px rgba(var(--un-shadow-color), 0.1)",
|
|
123
123
|
"2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(var(--un-shadow-color), 0.25)",
|
|
124
|
-
"inner": "inset 0 2px 4px 0 rgba(var(--un-shadow-color), 0.
|
|
125
|
-
"none": "
|
|
124
|
+
"inner": "inset 0 2px 4px 0 rgba(var(--un-shadow-color), 0.05)",
|
|
125
|
+
"none": "0 0 #0000"
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
const blur = {
|
|
@@ -137,7 +137,7 @@ const blur = {
|
|
|
137
137
|
};
|
|
138
138
|
const dropShadow = {
|
|
139
139
|
"DEFAULT": ["0 1px 2px rgba(0, 0, 0, 0.1)", "0 1px 1px rgba(0, 0, 0, 0.06)"],
|
|
140
|
-
"sm": "0 1px 1px rgba(0,0,0,0.05)",
|
|
140
|
+
"sm": "0 1px 1px rgba(0, 0, 0, 0.05)",
|
|
141
141
|
"md": ["0 4px 3px rgba(0, 0, 0, 0.07)", "0 2px 2px rgba(0, 0, 0, 0.06)"],
|
|
142
142
|
"lg": ["0 10px 8px rgba(0, 0, 0, 0.04)", "0 4px 3px rgba(0, 0, 0, 0.1)"],
|
|
143
143
|
"xl": ["0 20px 13px rgba(0, 0, 0, 0.03)", "0 8px 5px rgba(0, 0, 0, 0.08)"],
|
|
@@ -157,8 +157,6 @@ const baseSize = {
|
|
|
157
157
|
"5xl": "64rem",
|
|
158
158
|
"6xl": "72rem",
|
|
159
159
|
"7xl": "80rem",
|
|
160
|
-
"min": "min-content",
|
|
161
|
-
"max": "max-content",
|
|
162
160
|
"prose": "65ch"
|
|
163
161
|
};
|
|
164
162
|
const width = {
|
package/dist/chunks/default.mjs
CHANGED
|
@@ -72,7 +72,7 @@ const textShadow = {
|
|
|
72
72
|
DEFAULT: "0px 0px 1px rgb(0 0 0/20%), 0px 0px 1px rgb(1 0 5/10%)",
|
|
73
73
|
sm: "1px 1px 3px rgb(36 37 47 / 25%)",
|
|
74
74
|
md: "0px 1px 2px rgb(30 29 39 / 19%), 1px 2px 4px rgb(54 64 147 / 18%)",
|
|
75
|
-
lg: "3px 3px 6px rgb(0 0 0 / 26%),
|
|
75
|
+
lg: "3px 3px 6px rgb(0 0 0 / 26%), 0px 0px 5px rgb(15 3 86 / 22%)",
|
|
76
76
|
xl: "1px 1px 3px rgb(0 0 0 / 29%), 2px 4px 7px rgb(73 64 125 / 35%)",
|
|
77
77
|
none: "none"
|
|
78
78
|
};
|
|
@@ -113,14 +113,14 @@ const borderRadius = {
|
|
|
113
113
|
"full": "9999px"
|
|
114
114
|
};
|
|
115
115
|
const boxShadow = {
|
|
116
|
-
"DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 1px 2px
|
|
116
|
+
"DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 1px 2px -1px rgba(var(--un-shadow-color), 0.1)",
|
|
117
117
|
"sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.05)",
|
|
118
|
-
"md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 2px 4px -
|
|
119
|
-
"lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 4px 6px -
|
|
120
|
-
"xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0
|
|
118
|
+
"md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 2px 4px -2px rgba(var(--un-shadow-color), 0.1)",
|
|
119
|
+
"lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 4px 6px -4px rgba(var(--un-shadow-color), 0.1)",
|
|
120
|
+
"xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 8px 10px -6px rgba(var(--un-shadow-color), 0.1)",
|
|
121
121
|
"2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(var(--un-shadow-color), 0.25)",
|
|
122
|
-
"inner": "inset 0 2px 4px 0 rgba(var(--un-shadow-color), 0.
|
|
123
|
-
"none": "
|
|
122
|
+
"inner": "inset 0 2px 4px 0 rgba(var(--un-shadow-color), 0.05)",
|
|
123
|
+
"none": "0 0 #0000"
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
const blur = {
|
|
@@ -135,7 +135,7 @@ const blur = {
|
|
|
135
135
|
};
|
|
136
136
|
const dropShadow = {
|
|
137
137
|
"DEFAULT": ["0 1px 2px rgba(0, 0, 0, 0.1)", "0 1px 1px rgba(0, 0, 0, 0.06)"],
|
|
138
|
-
"sm": "0 1px 1px rgba(0,0,0,0.05)",
|
|
138
|
+
"sm": "0 1px 1px rgba(0, 0, 0, 0.05)",
|
|
139
139
|
"md": ["0 4px 3px rgba(0, 0, 0, 0.07)", "0 2px 2px rgba(0, 0, 0, 0.06)"],
|
|
140
140
|
"lg": ["0 10px 8px rgba(0, 0, 0, 0.04)", "0 4px 3px rgba(0, 0, 0, 0.1)"],
|
|
141
141
|
"xl": ["0 20px 13px rgba(0, 0, 0, 0.03)", "0 8px 5px rgba(0, 0, 0, 0.08)"],
|
|
@@ -155,8 +155,6 @@ const baseSize = {
|
|
|
155
155
|
"5xl": "64rem",
|
|
156
156
|
"6xl": "72rem",
|
|
157
157
|
"7xl": "80rem",
|
|
158
|
-
"min": "min-content",
|
|
159
|
-
"max": "max-content",
|
|
160
158
|
"prose": "65ch"
|
|
161
159
|
};
|
|
162
160
|
const width = {
|
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",
|
|
@@ -10,7 +9,7 @@ const verticalAlignAlias = {
|
|
|
10
9
|
btm: "bottom"
|
|
11
10
|
};
|
|
12
11
|
const verticalAligns = [
|
|
13
|
-
[/^(?:vertical|align|v)-(baseline|top|bottom|
|
|
12
|
+
[/^(?:vertical|align|v)-(baseline|top|middle|bottom|text-top|text-bottom|sub|super|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v })]
|
|
14
13
|
];
|
|
15
14
|
const textAligns = [
|
|
16
15
|
["text-center", { "text-align": "center" }],
|
|
@@ -24,7 +23,7 @@ const outline = [
|
|
|
24
23
|
[/^outline-(?:color-)?(.+)$/, utilities.colorResolver("outline-color", "outline-color")],
|
|
25
24
|
[/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": utilities.handler.bracket.fraction.auto.rem(d) })],
|
|
26
25
|
["outline", { "outline-style": "solid" }],
|
|
27
|
-
[/^outline-(auto|dotted|
|
|
26
|
+
[/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
|
|
28
27
|
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
29
28
|
];
|
|
30
29
|
const appearance = [
|
|
@@ -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 = [
|
|
@@ -182,10 +187,10 @@ const flex = [
|
|
|
182
187
|
["flex-initial", { flex: "0 1 auto" }],
|
|
183
188
|
["flex-none", { flex: "none" }],
|
|
184
189
|
[/^flex-(\[.+\])$/, ([, d]) => ({ flex: utilities.handler.bracket(d).replace(/\d+\/\d+/, ($1) => utilities.handler.fraction($1)) })],
|
|
185
|
-
[
|
|
186
|
-
[
|
|
187
|
-
[
|
|
188
|
-
[
|
|
190
|
+
[/^(?:flex-)?shrink$/, () => ({ "flex-shrink": 1 })],
|
|
191
|
+
[/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
|
|
192
|
+
[/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
|
|
193
|
+
[/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
|
|
189
194
|
[/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": utilities.handler.bracket.fraction.auto.rem(d) })],
|
|
190
195
|
["flex-row", { "flex-direction": "row" }],
|
|
191
196
|
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
@@ -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) })],
|
|
@@ -229,7 +232,7 @@ const fonts = [
|
|
|
229
232
|
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s) })]
|
|
230
233
|
];
|
|
231
234
|
const tabSizes = [
|
|
232
|
-
[/^tab
|
|
235
|
+
[/^tab(?:-([^-]+))?$/, ([, s]) => {
|
|
233
236
|
const v = utilities.handler.bracket.global.number(s || "4");
|
|
234
237
|
if (v != null) {
|
|
235
238
|
return {
|
|
@@ -271,53 +274,47 @@ const gaps = [
|
|
|
271
274
|
[/^(?:flex-|grid-)?gap-([xy])-([^-]+)$/, handleGap]
|
|
272
275
|
];
|
|
273
276
|
|
|
274
|
-
const
|
|
277
|
+
const rowCol = (s) => s.replace("col", "column");
|
|
275
278
|
const autoDirection = (selector, theme) => {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
279
|
+
const v = theme.fontSize?.[selector];
|
|
280
|
+
if (v != null)
|
|
281
|
+
return core.toArray(v)[0];
|
|
282
|
+
switch (selector) {
|
|
283
|
+
case "min":
|
|
284
|
+
return "min-content";
|
|
285
|
+
case "max":
|
|
286
|
+
return "max-content";
|
|
287
|
+
case "fr":
|
|
288
|
+
return "minmax(0,1fr)";
|
|
289
|
+
}
|
|
290
|
+
return utilities.handler.bracket.auto.rem(selector);
|
|
283
291
|
};
|
|
284
292
|
const grids = [
|
|
285
293
|
["grid", { display: "grid" }],
|
|
286
294
|
["inline-grid", { display: "inline-grid" }],
|
|
287
|
-
[/^(?:grid-)?col-
|
|
288
|
-
[/^(?:grid-)?col-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
if (raw)
|
|
295
|
-
return { [key]: raw };
|
|
296
|
-
const parts = v.split("-");
|
|
297
|
-
if (parts.length === 1 && parts[0] === "auto")
|
|
298
|
-
return { [key]: parts[0] };
|
|
299
|
-
if (parts[0] === "span") {
|
|
300
|
-
if (parts[1] === "full")
|
|
301
|
-
return { [key]: "1/-1" };
|
|
302
|
-
raw = utilities.handler.number.bracket(parts[1]);
|
|
303
|
-
if (raw)
|
|
304
|
-
return { [key]: `span ${raw}/span ${raw}` };
|
|
305
|
-
}
|
|
295
|
+
[/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: utilities.handler.bracket.auto(v) })],
|
|
296
|
+
[/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
|
|
297
|
+
if (s === "full")
|
|
298
|
+
return { [`grid-${rowCol(c)}`]: "1/-1" };
|
|
299
|
+
const v = utilities.handler.bracket.number(s);
|
|
300
|
+
if (v != null)
|
|
301
|
+
return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
|
|
306
302
|
}],
|
|
307
|
-
[/^(?:grid-)?
|
|
308
|
-
[/^(?:grid-)?
|
|
309
|
-
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({
|
|
310
|
-
[/^grid-
|
|
311
|
-
[/^grid-rows-(
|
|
312
|
-
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({
|
|
313
|
-
[/^grid-rows-
|
|
314
|
-
[
|
|
315
|
-
[
|
|
303
|
+
[/^(?:grid-)?(row|col)-start-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: v })],
|
|
304
|
+
[/^(?:grid-)?(row|col)-end-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: v })],
|
|
305
|
+
[/^(?:grid-)?auto-(rows|cols)-([\w.-]+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) })],
|
|
306
|
+
[/^(?:grid-auto-flow|auto-flow|grid-flow)-((?:row|col)(?:-dense)?)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
|
|
307
|
+
[/^grid-(rows|cols)-(\[.+\])$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: utilities.handler.bracket(v) })],
|
|
308
|
+
[/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
309
|
+
[/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
|
|
310
|
+
["grid-rows-none", { "grid-template-rows": "none" }],
|
|
311
|
+
["grid-cols-none", { "grid-template-columns": "none" }]
|
|
316
312
|
];
|
|
317
313
|
|
|
318
314
|
const overflowValues = [
|
|
319
315
|
"auto",
|
|
320
316
|
"hidden",
|
|
317
|
+
"clip",
|
|
321
318
|
"visible",
|
|
322
319
|
"scroll"
|
|
323
320
|
];
|
|
@@ -399,7 +396,7 @@ function handleInsetValues([, d, v]) {
|
|
|
399
396
|
return utilities.directionMap[d].map((i) => [i.slice(1), r]);
|
|
400
397
|
}
|
|
401
398
|
const insets = [
|
|
402
|
-
[/^(?:position-|pos-)?inset-(
|
|
399
|
+
[/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
|
|
403
400
|
[/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
|
|
404
401
|
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
|
|
405
402
|
];
|
|
@@ -460,11 +457,12 @@ const whitespaces = [
|
|
|
460
457
|
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
461
458
|
];
|
|
462
459
|
const contents = [
|
|
463
|
-
["content-empty", { content: '""' }]
|
|
460
|
+
["content-empty", { content: '""' }],
|
|
461
|
+
["content-none", { content: '""' }]
|
|
464
462
|
];
|
|
465
463
|
const breaks = [
|
|
466
464
|
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
467
|
-
["break-
|
|
465
|
+
["break-words", { "overflow-wrap": "break-word" }],
|
|
468
466
|
["break-all", { "word-break": "break-all" }]
|
|
469
467
|
];
|
|
470
468
|
const textOverflows = [
|
|
@@ -496,14 +494,14 @@ const fontSmoothings = [
|
|
|
496
494
|
];
|
|
497
495
|
|
|
498
496
|
const rings = [
|
|
499
|
-
[/^ring
|
|
497
|
+
[/^ring(?:-(.+))?$/, ([, d]) => {
|
|
500
498
|
const value = utilities.handler.px(d || "1");
|
|
501
499
|
if (value) {
|
|
502
500
|
return {
|
|
503
501
|
"--un-ring-inset": varEmpty,
|
|
504
502
|
"--un-ring-offset-width": "0px",
|
|
505
503
|
"--un-ring-offset-color": "#fff",
|
|
506
|
-
"--un-ring-color": "rgba(
|
|
504
|
+
"--un-ring-color": "rgba(147, 197, 253, .5)",
|
|
507
505
|
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
508
506
|
"--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
|
|
509
507
|
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
|
|
@@ -537,7 +535,7 @@ const shadowColorResolver = (body, theme) => {
|
|
|
537
535
|
}
|
|
538
536
|
};
|
|
539
537
|
const boxShadows = [
|
|
540
|
-
[/^shadow
|
|
538
|
+
[/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
|
|
541
539
|
const value = theme.boxShadow?.[d || "DEFAULT"];
|
|
542
540
|
if (value) {
|
|
543
541
|
return {
|
|
@@ -555,37 +553,38 @@ const boxShadows = [
|
|
|
555
553
|
function getPropName(minmax, hw) {
|
|
556
554
|
return `${minmax ? `${minmax}-` : ""}${hw === "h" ? "height" : "width"}`;
|
|
557
555
|
}
|
|
558
|
-
function
|
|
556
|
+
function getSizeValue(minmax, hw, theme, prop) {
|
|
559
557
|
let str = `${hw === "h" ? "height" : "width"}`;
|
|
560
558
|
if (minmax)
|
|
561
559
|
str = `${minmax}${utilities.capitalize(str)}`;
|
|
562
|
-
|
|
560
|
+
const v = theme[str]?.[prop];
|
|
561
|
+
if (v != null)
|
|
562
|
+
return v;
|
|
563
|
+
switch (prop) {
|
|
564
|
+
case "fit":
|
|
565
|
+
case "max":
|
|
566
|
+
case "min":
|
|
567
|
+
return `${prop}-content`;
|
|
568
|
+
}
|
|
569
|
+
return utilities.handler.bracket.cssvar.fraction.auto.rem(prop);
|
|
563
570
|
}
|
|
564
571
|
const sizes = [
|
|
565
|
-
[/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
return
|
|
574
|
-
|
|
575
|
-
|
|
572
|
+
[/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
|
|
573
|
+
[/^(?:(min|max)-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
|
|
574
|
+
];
|
|
575
|
+
function getAspectRatio(prop) {
|
|
576
|
+
if (/^\d+\/\d+$/.test(prop))
|
|
577
|
+
return prop;
|
|
578
|
+
switch (prop) {
|
|
579
|
+
case "square":
|
|
580
|
+
return "1/1";
|
|
581
|
+
case "video":
|
|
582
|
+
return "16/9";
|
|
583
|
+
}
|
|
584
|
+
return utilities.handler.bracket.cssvar.auto.number(prop);
|
|
585
|
+
}
|
|
576
586
|
const aspectRatio = [
|
|
577
|
-
[/^aspect-(?:ratio-)?(.+)$/, ([, d]) => {
|
|
578
|
-
if (/^\d+\/\d+$/.test(d))
|
|
579
|
-
return { "aspect-ratio": d };
|
|
580
|
-
const v = {
|
|
581
|
-
auto: "auto",
|
|
582
|
-
square: "1/1",
|
|
583
|
-
video: "16/9"
|
|
584
|
-
}[d];
|
|
585
|
-
if (v != null)
|
|
586
|
-
return { "aspect-ratio": v };
|
|
587
|
-
return { "aspect-ratio": utilities.handler.bracket.cssvar.number(d) };
|
|
588
|
-
}]
|
|
587
|
+
[/^aspect-(?:ratio-)?(.+)$/, ([, d]) => ({ "aspect-ratio": getAspectRatio(d) })]
|
|
589
588
|
];
|
|
590
589
|
|
|
591
590
|
const paddings = [
|
|
@@ -600,12 +599,10 @@ const margins = [
|
|
|
600
599
|
];
|
|
601
600
|
|
|
602
601
|
const transformGpu = {
|
|
603
|
-
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))"
|
|
604
|
-
[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))"
|
|
605
603
|
};
|
|
606
604
|
const transformCpu = {
|
|
607
|
-
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))"
|
|
608
|
-
[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))"
|
|
609
606
|
};
|
|
610
607
|
const transformBase = {
|
|
611
608
|
"--un-rotate": 0,
|
|
@@ -617,30 +614,55 @@ const transformBase = {
|
|
|
617
614
|
"--un-translate-x": 0,
|
|
618
615
|
"--un-translate-y": 0,
|
|
619
616
|
"--un-translate-z": 0,
|
|
620
|
-
...transformCpu
|
|
617
|
+
...transformCpu,
|
|
618
|
+
[core.CONTROL_SHORTCUT_NO_MERGE]: ""
|
|
621
619
|
};
|
|
622
620
|
const transforms = [
|
|
623
|
-
["transform"
|
|
624
|
-
[/^
|
|
625
|
-
|
|
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
|
+
}],
|
|
640
|
+
[/^translate-()(.+)$/, handleTranslate],
|
|
626
641
|
[/^translate-([xyz])-(.+)$/, handleTranslate],
|
|
627
|
-
[/^scale()-(.+)$/, handleScale],
|
|
628
|
-
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
629
642
|
[/^rotate-(.+)$/, handleRotate],
|
|
630
|
-
[/^
|
|
643
|
+
[/^skew-()(.+)$/, handleSkew],
|
|
631
644
|
[/^skew-([xy])-(.+)$/, handleSkew],
|
|
632
|
-
[/^
|
|
645
|
+
[/^scale-()(.+)$/, handleScale],
|
|
646
|
+
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
647
|
+
["preserve-3d", { "transform-style": "preserve-3d" }],
|
|
648
|
+
["preserve-flat", { "transform-style": "flat" }],
|
|
649
|
+
[/^transform$/, () => [
|
|
650
|
+
transformBase,
|
|
651
|
+
{ transform: "var(--un-transform)" }
|
|
652
|
+
]],
|
|
633
653
|
["transform-gpu", transformGpu],
|
|
634
654
|
["transform-cpu", transformCpu],
|
|
635
|
-
["transform-none", { transform: "none" }]
|
|
636
|
-
[/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] })]
|
|
655
|
+
["transform-none", { transform: "none" }]
|
|
637
656
|
];
|
|
638
657
|
function handleTranslate([, d, b]) {
|
|
639
658
|
const v = utilities.handler.bracket.fraction.auto.rem(b);
|
|
640
659
|
if (v != null) {
|
|
641
660
|
return [
|
|
642
661
|
transformBase,
|
|
643
|
-
|
|
662
|
+
[
|
|
663
|
+
...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v]),
|
|
664
|
+
["transform", "var(--un-transform)"]
|
|
665
|
+
]
|
|
644
666
|
];
|
|
645
667
|
}
|
|
646
668
|
}
|
|
@@ -649,43 +671,34 @@ function handleScale([, d, b]) {
|
|
|
649
671
|
if (v != null) {
|
|
650
672
|
return [
|
|
651
673
|
transformBase,
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
function handleRotateWithUnit([, b]) {
|
|
657
|
-
const v = utilities.handler.bracket.number(b);
|
|
658
|
-
if (v != null) {
|
|
659
|
-
return [
|
|
660
|
-
transformBase,
|
|
661
|
-
{ "--un-rotate": `${v}deg` }
|
|
674
|
+
[
|
|
675
|
+
...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v]),
|
|
676
|
+
["transform", "var(--un-transform)"]
|
|
677
|
+
]
|
|
662
678
|
];
|
|
663
679
|
}
|
|
664
680
|
}
|
|
665
681
|
function handleRotate([, b]) {
|
|
666
|
-
const v = utilities.handler.bracket(b);
|
|
667
|
-
if (v != null) {
|
|
668
|
-
return [
|
|
669
|
-
transformBase,
|
|
670
|
-
{ "--un-rotate": v }
|
|
671
|
-
];
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
function handleSkewWithUnit([, d, b]) {
|
|
675
|
-
const v = utilities.handler.bracket.number(b);
|
|
682
|
+
const v = utilities.handler.bracket.degree(b);
|
|
676
683
|
if (v != null) {
|
|
677
684
|
return [
|
|
678
685
|
transformBase,
|
|
679
|
-
{
|
|
686
|
+
{
|
|
687
|
+
"--un-rotate": v,
|
|
688
|
+
"transform": "var(--un-transform)"
|
|
689
|
+
}
|
|
680
690
|
];
|
|
681
691
|
}
|
|
682
692
|
}
|
|
683
693
|
function handleSkew([, d, b]) {
|
|
684
|
-
const v = utilities.handler.bracket(b);
|
|
694
|
+
const v = utilities.handler.bracket.degree(b);
|
|
685
695
|
if (v != null) {
|
|
686
696
|
return [
|
|
687
697
|
transformBase,
|
|
688
|
-
{
|
|
698
|
+
{
|
|
699
|
+
[`--un-skew-${d}`]: v,
|
|
700
|
+
transform: "var(--un-transform)"
|
|
701
|
+
}
|
|
689
702
|
];
|
|
690
703
|
}
|
|
691
704
|
}
|
|
@@ -734,10 +747,11 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
734
747
|
];
|
|
735
748
|
|
|
736
749
|
const textDecorations = [
|
|
737
|
-
["underline", { "text-decoration": "underline" }],
|
|
738
|
-
["
|
|
739
|
-
["
|
|
740
|
-
["decoration-
|
|
750
|
+
["underline", { "text-decoration-line": "underline" }],
|
|
751
|
+
["overline", { "text-decoration-line": "overline" }],
|
|
752
|
+
["line-through", { "text-decoration-line": "line-through" }],
|
|
753
|
+
["decoration-underline", { "text-decoration-line": "underline" }],
|
|
754
|
+
["decoration-line-through", { "text-decoration-line": "line-through" }],
|
|
741
755
|
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": utilities.handler.bracket.px(s) })],
|
|
742
756
|
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
|
|
743
757
|
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|
|
@@ -761,8 +775,18 @@ const svgUtilities = [
|
|
|
761
775
|
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
762
776
|
["fill-none", { fill: "none" }],
|
|
763
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) })],
|
|
764
780
|
[/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke")],
|
|
765
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" }],
|
|
766
790
|
["stroke-none", { stroke: "none" }]
|
|
767
791
|
];
|
|
768
792
|
|