@unocss/preset-mini 0.21.0 → 0.22.1
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 +25 -19
- package/dist/chunks/default.mjs +25 -19
- package/dist/chunks/default2.cjs +210 -78
- package/dist/chunks/default2.mjs +211 -81
- package/dist/chunks/default3.cjs +162 -6
- package/dist/chunks/default3.mjs +152 -2
- package/dist/chunks/utilities.cjs +31 -4
- package/dist/chunks/utilities.mjs +31 -5
- package/dist/{colors-6d634692.d.ts → colors-338f482c.d.ts} +1 -1
- package/dist/colors.d.ts +2 -2
- package/dist/{default-958434b6.d.ts → default-17948303.d.ts} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.mjs +1 -2
- package/dist/rules.cjs +2 -1
- package/dist/rules.d.ts +11 -2
- package/dist/rules.mjs +1 -2
- package/dist/theme.d.ts +8 -8
- package/dist/{types-a2d2b52f.d.ts → types-c14b808b.d.ts} +8 -2
- package/dist/utilities-13c33ba5.d.ts +56 -0
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +5 -55
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +6 -7
- package/dist/variants.d.ts +4 -3
- package/dist/variants.mjs +1 -2
- package/package.json +2 -2
- package/dist/chunks/pseudo.cjs +0 -160
- package/dist/chunks/pseudo.mjs +0 -153
package/dist/chunks/default.cjs
CHANGED
|
@@ -71,12 +71,12 @@ const textStrokeWidth = {
|
|
|
71
71
|
lg: "thick"
|
|
72
72
|
};
|
|
73
73
|
const textShadow = {
|
|
74
|
-
DEFAULT: "
|
|
75
|
-
sm: "1px 1px 3px
|
|
76
|
-
md: "
|
|
77
|
-
lg: "3px 3px 6px
|
|
78
|
-
xl: "1px 1px 3px
|
|
79
|
-
none: "
|
|
74
|
+
DEFAULT: ["0 0 1px rgba(0,0,0,0.2)", "0 0 1px rgba(1,0,5,0.1)"],
|
|
75
|
+
sm: "1px 1px 3px rgba(36,37,47,0.25)",
|
|
76
|
+
md: ["0 1px 2px rgba(30,29,39,0.19)", "1px 2px 4px rgba(54,64,147,0.18)"],
|
|
77
|
+
lg: ["3px 3px 6px rgba(0,0,0,0.26)", "0 0 5px rgba(15,3,86,0.22)"],
|
|
78
|
+
xl: ["1px 1px 3px rgba(0,0,0,0.29)", "2px 4px 7px rgba(73,64,125,0.35)"],
|
|
79
|
+
none: "0 0 #0000"
|
|
80
80
|
};
|
|
81
81
|
const lineHeight = {
|
|
82
82
|
none: "1",
|
|
@@ -115,13 +115,13 @@ const borderRadius = {
|
|
|
115
115
|
"full": "9999px"
|
|
116
116
|
};
|
|
117
117
|
const boxShadow = {
|
|
118
|
-
"DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(
|
|
119
|
-
"sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(
|
|
120
|
-
"md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(
|
|
121
|
-
"lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(
|
|
122
|
-
"xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(
|
|
123
|
-
"2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(
|
|
124
|
-
"inner": "inset 0 2px 4px 0 rgba(
|
|
118
|
+
"DEFAULT": ["var(--un-shadow-inset) 0 1px 3px 0 rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 1px 2px -1px rgba(0,0,0,0.1)"],
|
|
119
|
+
"sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(0,0,0,0.05)",
|
|
120
|
+
"md": ["var(--un-shadow-inset) 0 4px 6px -1px rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 2px 4px -2px rgba(0,0,0,0.1)"],
|
|
121
|
+
"lg": ["var(--un-shadow-inset) 0 10px 15px -3px rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 4px 6px -4px rgba(0,0,0,0.1)"],
|
|
122
|
+
"xl": ["var(--un-shadow-inset) 0 20px 25px -5px rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 8px 10px -6px rgba(0,0,0,0.1)"],
|
|
123
|
+
"2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(0,0,0,0.25)",
|
|
124
|
+
"inner": "inset 0 2px 4px 0 rgba(0,0,0,0.05)",
|
|
125
125
|
"none": "0 0 #0000"
|
|
126
126
|
};
|
|
127
127
|
|
|
@@ -136,12 +136,12 @@ const blur = {
|
|
|
136
136
|
"3xl": "64px"
|
|
137
137
|
};
|
|
138
138
|
const dropShadow = {
|
|
139
|
-
"DEFAULT": ["0 1px 2px rgba(0,
|
|
140
|
-
"sm": "0 1px 1px rgba(0,
|
|
141
|
-
"md": ["0 4px 3px rgba(0,
|
|
142
|
-
"lg": ["0 10px 8px rgba(0,
|
|
143
|
-
"xl": ["0 20px 13px rgba(0,
|
|
144
|
-
"2xl": "0 25px 25px rgba(0,
|
|
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)",
|
|
141
|
+
"md": ["0 4px 3px rgba(0,0,0,0.07)", "0 2px 2px rgba(0,0,0,0.06)"],
|
|
142
|
+
"lg": ["0 10px 8px rgba(0,0,0,0.04)", "0 4px 3px rgba(0,0,0,0.1)"],
|
|
143
|
+
"xl": ["0 20px 13px rgba(0,0,0,0.03)", "0 8px 5px rgba(0,0,0,0.08)"],
|
|
144
|
+
"2xl": "0 25px 25px rgba(0,0,0,0.15)",
|
|
145
145
|
"none": "0 0 #0000"
|
|
146
146
|
};
|
|
147
147
|
|
|
@@ -187,6 +187,12 @@ const theme = {
|
|
|
187
187
|
maxHeight,
|
|
188
188
|
minWidth: maxWidth,
|
|
189
189
|
minHeight: maxHeight,
|
|
190
|
+
inlineSize: width,
|
|
191
|
+
blockSize: height,
|
|
192
|
+
maxInlineSize: maxWidth,
|
|
193
|
+
maxBlockSize: maxHeight,
|
|
194
|
+
minInlineSize: maxWidth,
|
|
195
|
+
minBlockSize: maxHeight,
|
|
190
196
|
colors: colors.colors,
|
|
191
197
|
fontFamily,
|
|
192
198
|
fontSize,
|
package/dist/chunks/default.mjs
CHANGED
|
@@ -69,12 +69,12 @@ const textStrokeWidth = {
|
|
|
69
69
|
lg: "thick"
|
|
70
70
|
};
|
|
71
71
|
const textShadow = {
|
|
72
|
-
DEFAULT: "
|
|
73
|
-
sm: "1px 1px 3px
|
|
74
|
-
md: "
|
|
75
|
-
lg: "3px 3px 6px
|
|
76
|
-
xl: "1px 1px 3px
|
|
77
|
-
none: "
|
|
72
|
+
DEFAULT: ["0 0 1px rgba(0,0,0,0.2)", "0 0 1px rgba(1,0,5,0.1)"],
|
|
73
|
+
sm: "1px 1px 3px rgba(36,37,47,0.25)",
|
|
74
|
+
md: ["0 1px 2px rgba(30,29,39,0.19)", "1px 2px 4px rgba(54,64,147,0.18)"],
|
|
75
|
+
lg: ["3px 3px 6px rgba(0,0,0,0.26)", "0 0 5px rgba(15,3,86,0.22)"],
|
|
76
|
+
xl: ["1px 1px 3px rgba(0,0,0,0.29)", "2px 4px 7px rgba(73,64,125,0.35)"],
|
|
77
|
+
none: "0 0 #0000"
|
|
78
78
|
};
|
|
79
79
|
const lineHeight = {
|
|
80
80
|
none: "1",
|
|
@@ -113,13 +113,13 @@ const borderRadius = {
|
|
|
113
113
|
"full": "9999px"
|
|
114
114
|
};
|
|
115
115
|
const boxShadow = {
|
|
116
|
-
"DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(
|
|
117
|
-
"sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(
|
|
118
|
-
"md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(
|
|
119
|
-
"lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(
|
|
120
|
-
"xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(
|
|
121
|
-
"2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(
|
|
122
|
-
"inner": "inset 0 2px 4px 0 rgba(
|
|
116
|
+
"DEFAULT": ["var(--un-shadow-inset) 0 1px 3px 0 rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 1px 2px -1px rgba(0,0,0,0.1)"],
|
|
117
|
+
"sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(0,0,0,0.05)",
|
|
118
|
+
"md": ["var(--un-shadow-inset) 0 4px 6px -1px rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 2px 4px -2px rgba(0,0,0,0.1)"],
|
|
119
|
+
"lg": ["var(--un-shadow-inset) 0 10px 15px -3px rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 4px 6px -4px rgba(0,0,0,0.1)"],
|
|
120
|
+
"xl": ["var(--un-shadow-inset) 0 20px 25px -5px rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 8px 10px -6px rgba(0,0,0,0.1)"],
|
|
121
|
+
"2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(0,0,0,0.25)",
|
|
122
|
+
"inner": "inset 0 2px 4px 0 rgba(0,0,0,0.05)",
|
|
123
123
|
"none": "0 0 #0000"
|
|
124
124
|
};
|
|
125
125
|
|
|
@@ -134,12 +134,12 @@ const blur = {
|
|
|
134
134
|
"3xl": "64px"
|
|
135
135
|
};
|
|
136
136
|
const dropShadow = {
|
|
137
|
-
"DEFAULT": ["0 1px 2px rgba(0,
|
|
138
|
-
"sm": "0 1px 1px rgba(0,
|
|
139
|
-
"md": ["0 4px 3px rgba(0,
|
|
140
|
-
"lg": ["0 10px 8px rgba(0,
|
|
141
|
-
"xl": ["0 20px 13px rgba(0,
|
|
142
|
-
"2xl": "0 25px 25px rgba(0,
|
|
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)",
|
|
139
|
+
"md": ["0 4px 3px rgba(0,0,0,0.07)", "0 2px 2px rgba(0,0,0,0.06)"],
|
|
140
|
+
"lg": ["0 10px 8px rgba(0,0,0,0.04)", "0 4px 3px rgba(0,0,0,0.1)"],
|
|
141
|
+
"xl": ["0 20px 13px rgba(0,0,0,0.03)", "0 8px 5px rgba(0,0,0,0.08)"],
|
|
142
|
+
"2xl": "0 25px 25px rgba(0,0,0,0.15)",
|
|
143
143
|
"none": "0 0 #0000"
|
|
144
144
|
};
|
|
145
145
|
|
|
@@ -185,6 +185,12 @@ const theme = {
|
|
|
185
185
|
maxHeight,
|
|
186
186
|
minWidth: maxWidth,
|
|
187
187
|
minHeight: maxHeight,
|
|
188
|
+
inlineSize: width,
|
|
189
|
+
blockSize: height,
|
|
190
|
+
maxInlineSize: maxWidth,
|
|
191
|
+
maxBlockSize: maxHeight,
|
|
192
|
+
minInlineSize: maxWidth,
|
|
193
|
+
minBlockSize: maxHeight,
|
|
188
194
|
colors,
|
|
189
195
|
fontFamily,
|
|
190
196
|
fontSize,
|
package/dist/chunks/default2.cjs
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const utilities = require('./utilities.cjs');
|
|
4
4
|
const core = require('@unocss/core');
|
|
5
|
-
const pseudo = require('./pseudo.cjs');
|
|
6
5
|
|
|
7
6
|
const verticalAlignAlias = {
|
|
8
7
|
mid: "middle",
|
|
@@ -33,27 +32,42 @@ 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 = [
|
|
41
46
|
[/^(?:border|b)()(?:-(.+))?$/, handlerBorder],
|
|
42
47
|
[/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
|
|
43
48
|
[/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
|
|
44
|
-
[/^(?:border|b)-()
|
|
45
|
-
[/^(?:border|b)-([
|
|
46
|
-
[/^(?:border|b)-(
|
|
49
|
+
[/^(?:border|b)-(block|inline)(?:-(.+))?$/, handlerBorder],
|
|
50
|
+
[/^(?:border|b)-([bi][se])(?:-(.+))?$/, handlerBorder],
|
|
51
|
+
[/^(?:border|b)-()(?:width|size)-(.+)$/, handlerBorderSize],
|
|
52
|
+
[/^(?:border|b)-([xy])-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
53
|
+
[/^(?:border|b)-([rltbse])-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
54
|
+
[/^(?:border|b)-(block|inline)-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
55
|
+
[/^(?:border|b)-([bi][se])-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
47
56
|
[/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor],
|
|
48
57
|
[/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
49
58
|
[/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
59
|
+
[/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/, handlerBorderColor],
|
|
60
|
+
[/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
50
61
|
[/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
51
62
|
[/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
52
63
|
[/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
64
|
+
[/^(?:border|b)-(block|inline)-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
65
|
+
[/^(?:border|b)-([bi][se])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
53
66
|
[/^(?:border-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded],
|
|
54
|
-
[/^(?:border-)?(?:rounded|rd)-([xy])(?:-(.+))?$/, handlerRounded],
|
|
55
67
|
[/^(?:border-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
|
|
56
68
|
[/^(?:border-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
|
|
69
|
+
[/^(?:border-)?(?:rounded|rd)-([bi][se])(?:-(.+))?$/, handlerRounded],
|
|
70
|
+
[/^(?:border-)?(?:rounded|rd)-([bi][se]-[bi][se])(?:-(.+))?$/, handlerRounded],
|
|
57
71
|
["border-solid", { "border-style": "solid" }],
|
|
58
72
|
["border-dashed", { "border-style": "dashed" }],
|
|
59
73
|
["border-dotted", { "border-style": "dotted" }],
|
|
@@ -210,17 +224,15 @@ const weightMap = {
|
|
|
210
224
|
const fonts = [
|
|
211
225
|
[/^font-(\w+)$/, ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] })],
|
|
212
226
|
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
213
|
-
const size = utilities.handler.bracket.auto.rem(s);
|
|
214
|
-
if (size)
|
|
215
|
-
return { "font-size": size };
|
|
216
227
|
const themed = core.toArray(theme.fontSize?.[s]);
|
|
217
228
|
if (themed?.[0]) {
|
|
218
|
-
const [
|
|
229
|
+
const [size, height = "1"] = themed;
|
|
219
230
|
return {
|
|
220
|
-
"font-size":
|
|
231
|
+
"font-size": size,
|
|
221
232
|
"line-height": height
|
|
222
233
|
};
|
|
223
234
|
}
|
|
235
|
+
return { "font-size": utilities.handler.bracket.auto.rem(s) };
|
|
224
236
|
}],
|
|
225
237
|
[/^text-size-(.+)$/, ([, s]) => ({ "font-size": utilities.handler.bracket.auto.rem(s) })],
|
|
226
238
|
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || utilities.handler.number(s) })],
|
|
@@ -249,7 +261,29 @@ const textStrokes = [
|
|
|
249
261
|
[/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": utilities.handler.bracket.percent(opacity) })]
|
|
250
262
|
];
|
|
251
263
|
const textShadows = [
|
|
252
|
-
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) =>
|
|
264
|
+
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
|
|
265
|
+
const v = theme.textShadow?.[s || "DEFAULT"];
|
|
266
|
+
if (v != null) {
|
|
267
|
+
const shadow = core.toArray(v);
|
|
268
|
+
const colored = shadow.map((s2) => s2.replace(/\s\S+$/, " var(--un-text-shadow-color)"));
|
|
269
|
+
return {
|
|
270
|
+
"--un-text-shadow": shadow.join(","),
|
|
271
|
+
"--un-text-shadow-colored": colored.join(","),
|
|
272
|
+
"text-shadow": "var(--un-text-shadow)"
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
return { "text-shadow": utilities.handler.bracket.cssvar(s) };
|
|
276
|
+
}],
|
|
277
|
+
[/^text-shadow-color-(.+)$/, (m, ctx) => {
|
|
278
|
+
const color = utilities.colorResolver("--un-text-shadow-color", "text-shadow")(m, ctx);
|
|
279
|
+
if (color) {
|
|
280
|
+
return {
|
|
281
|
+
...color,
|
|
282
|
+
"--un-text-shadow": "var(--un-text-shadow-colored)"
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
}],
|
|
286
|
+
[/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": utilities.handler.bracket.percent(opacity) })]
|
|
253
287
|
];
|
|
254
288
|
|
|
255
289
|
const directions = {
|
|
@@ -385,16 +419,18 @@ const placements = [
|
|
|
385
419
|
["place-self-stretch", { "place-self": "stretch" }]
|
|
386
420
|
];
|
|
387
421
|
function handleInsetValue(v) {
|
|
388
|
-
return
|
|
422
|
+
return utilities.handler.bracket.fraction.cssvar.auto.rem(v);
|
|
389
423
|
}
|
|
390
424
|
function handleInsetValues([, d, v]) {
|
|
391
425
|
const r = handleInsetValue(v);
|
|
392
|
-
if (r != null && d in utilities.
|
|
393
|
-
return utilities.
|
|
426
|
+
if (r != null && d in utilities.insetMap)
|
|
427
|
+
return utilities.insetMap[d].map((i) => [i.slice(1), r]);
|
|
394
428
|
}
|
|
395
429
|
const insets = [
|
|
396
430
|
[/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
|
|
397
431
|
[/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
|
|
432
|
+
[/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
|
|
433
|
+
[/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
|
|
398
434
|
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
|
|
399
435
|
];
|
|
400
436
|
const floats = [
|
|
@@ -454,7 +490,8 @@ const whitespaces = [
|
|
|
454
490
|
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
455
491
|
];
|
|
456
492
|
const contents = [
|
|
457
|
-
["content-empty", { content: '""' }]
|
|
493
|
+
["content-empty", { content: '""' }],
|
|
494
|
+
["content-none", { content: '""' }]
|
|
458
495
|
];
|
|
459
496
|
const breaks = [
|
|
460
497
|
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
@@ -489,19 +526,62 @@ const fontSmoothings = [
|
|
|
489
526
|
}]
|
|
490
527
|
];
|
|
491
528
|
|
|
529
|
+
const shadowBase = {
|
|
530
|
+
[core.CONTROL_SHORTCUT_NO_MERGE]: "",
|
|
531
|
+
"--un-ring-offset-shadow": "0 0 #0000",
|
|
532
|
+
"--un-ring-shadow": "0 0 #0000",
|
|
533
|
+
"--un-shadow-inset": varEmpty,
|
|
534
|
+
"--un-shadow": "0 0 #0000",
|
|
535
|
+
"--un-shadow-colored": "0 0 #0000"
|
|
536
|
+
};
|
|
537
|
+
const boxShadows = [
|
|
538
|
+
[/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
|
|
539
|
+
const v = theme.boxShadow?.[d || "DEFAULT"];
|
|
540
|
+
if (v) {
|
|
541
|
+
const shadow = core.toArray(v);
|
|
542
|
+
const colored = shadow.map((s) => s.replace(/\s\S+$/, " var(--un-shadow-color)"));
|
|
543
|
+
return [
|
|
544
|
+
shadowBase,
|
|
545
|
+
{
|
|
546
|
+
"--un-shadow": shadow.join(","),
|
|
547
|
+
"--un-shadow-colored": colored.join(","),
|
|
548
|
+
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
549
|
+
}
|
|
550
|
+
];
|
|
551
|
+
}
|
|
552
|
+
}],
|
|
553
|
+
[/^shadow-(.+)$/, (m, ctx) => {
|
|
554
|
+
const color = utilities.colorResolver("--un-shadow-color", "shadow")(m, ctx);
|
|
555
|
+
if (color) {
|
|
556
|
+
return {
|
|
557
|
+
...color,
|
|
558
|
+
"--un-shadow": "var(--un-shadow-colored)"
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
}],
|
|
562
|
+
[/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": utilities.handler.bracket.percent.cssvar(opacity) })],
|
|
563
|
+
["shadow-inset", { "--un-shadow-inset": "inset" }]
|
|
564
|
+
];
|
|
565
|
+
|
|
566
|
+
const ringBase = {
|
|
567
|
+
"--un-ring-inset": varEmpty,
|
|
568
|
+
"--un-ring-offset-width": "0px",
|
|
569
|
+
"--un-ring-offset-color": "#fff",
|
|
570
|
+
"--un-ring-color": "rgba(147,197,253,0.5)",
|
|
571
|
+
...shadowBase
|
|
572
|
+
};
|
|
492
573
|
const rings = [
|
|
493
574
|
[/^ring(?:-(.+))?$/, ([, d]) => {
|
|
494
575
|
const value = utilities.handler.px(d || "1");
|
|
495
576
|
if (value) {
|
|
496
|
-
return
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
};
|
|
577
|
+
return [
|
|
578
|
+
ringBase,
|
|
579
|
+
{
|
|
580
|
+
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
581
|
+
"--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
|
|
582
|
+
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
|
|
583
|
+
}
|
|
584
|
+
];
|
|
505
585
|
}
|
|
506
586
|
}],
|
|
507
587
|
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
@@ -513,46 +593,17 @@ const rings = [
|
|
|
513
593
|
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
514
594
|
];
|
|
515
595
|
|
|
516
|
-
const
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
if (!color)
|
|
522
|
-
return;
|
|
523
|
-
if (rgba) {
|
|
524
|
-
return {
|
|
525
|
-
"--un-shadow-color": `${rgba.slice(0, 3).join(",")}`
|
|
526
|
-
};
|
|
527
|
-
} else {
|
|
528
|
-
return {
|
|
529
|
-
"--un-shadow-color": color
|
|
530
|
-
};
|
|
531
|
-
}
|
|
596
|
+
const sizeMapping = {
|
|
597
|
+
h: "height",
|
|
598
|
+
w: "width",
|
|
599
|
+
inline: "inline-size",
|
|
600
|
+
block: "block-size"
|
|
532
601
|
};
|
|
533
|
-
const boxShadows = [
|
|
534
|
-
[/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
|
|
535
|
-
const value = theme.boxShadow?.[d || "DEFAULT"];
|
|
536
|
-
if (value) {
|
|
537
|
-
return {
|
|
538
|
-
"--un-shadow-inset": varEmpty,
|
|
539
|
-
"--un-shadow-color": "0,0,0",
|
|
540
|
-
"--un-shadow": value,
|
|
541
|
-
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
}],
|
|
545
|
-
[/^shadow-(.+)$/, ([, d], { theme }) => shadowColorResolver(d, theme)],
|
|
546
|
-
["shadow-inset", { "--un-shadow-inset": "inset" }]
|
|
547
|
-
];
|
|
548
|
-
|
|
549
602
|
function getPropName(minmax, hw) {
|
|
550
|
-
return `${minmax
|
|
603
|
+
return `${minmax || ""}${sizeMapping[hw]}`;
|
|
551
604
|
}
|
|
552
605
|
function getSizeValue(minmax, hw, theme, prop) {
|
|
553
|
-
|
|
554
|
-
if (minmax)
|
|
555
|
-
str = `${minmax}${utilities.capitalize(str)}`;
|
|
606
|
+
const str = getPropName(minmax, hw).replace(/-(\w)/g, (_, p) => p.toUpperCase());
|
|
556
607
|
const v = theme[str]?.[prop];
|
|
557
608
|
if (v != null)
|
|
558
609
|
return v;
|
|
@@ -565,8 +616,9 @@ function getSizeValue(minmax, hw, theme, prop) {
|
|
|
565
616
|
return utilities.handler.bracket.cssvar.fraction.auto.rem(prop);
|
|
566
617
|
}
|
|
567
618
|
const sizes = [
|
|
568
|
-
[/^(
|
|
569
|
-
[/^(
|
|
619
|
+
[/^(min-|max-)?([wh])-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
|
|
620
|
+
[/^(min-|max-)?(block|inline)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
|
|
621
|
+
[/^(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
|
|
570
622
|
];
|
|
571
623
|
function getAspectRatio(prop) {
|
|
572
624
|
if (/^\d+\/\d+$/.test(prop))
|
|
@@ -586,24 +638,53 @@ const aspectRatio = [
|
|
|
586
638
|
const paddings = [
|
|
587
639
|
[/^pa?()-?(-?.+)$/, utilities.directionSize("padding")],
|
|
588
640
|
[/^p-?([xy])-?(-?.+)$/, utilities.directionSize("padding")],
|
|
589
|
-
[/^p-?([rltbse])-?(-?.+)$/, utilities.directionSize("padding")]
|
|
641
|
+
[/^p-?([rltbse])-?(-?.+)$/, utilities.directionSize("padding")],
|
|
642
|
+
[/^p-(inline|block)-(-?.+)$/, utilities.directionSize("padding")],
|
|
643
|
+
[/^p-?([bi][se])-?(-?.+)$/, utilities.directionSize("padding")]
|
|
590
644
|
];
|
|
591
645
|
const margins = [
|
|
592
646
|
[/^ma?()-?(-?.+)$/, utilities.directionSize("margin")],
|
|
593
647
|
[/^m-?([xy])-?(-?.+)$/, utilities.directionSize("margin")],
|
|
594
|
-
[/^m-?([rltbse])-?(-?.+)$/, utilities.directionSize("margin")]
|
|
648
|
+
[/^m-?([rltbse])-?(-?.+)$/, utilities.directionSize("margin")],
|
|
649
|
+
[/^m-(inline|block)-(-?.+)$/, utilities.directionSize("margin")],
|
|
650
|
+
[/^m-?([bi][se])-?(-?.+)$/, utilities.directionSize("margin")]
|
|
595
651
|
];
|
|
596
652
|
|
|
597
653
|
const transformGpu = {
|
|
598
|
-
|
|
599
|
-
|
|
654
|
+
"--un-transform": [
|
|
655
|
+
"translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
|
|
656
|
+
"rotate(var(--un-rotate))",
|
|
657
|
+
"rotateX(var(--un-rotate-x))",
|
|
658
|
+
"rotateY(var(--un-rotate-y))",
|
|
659
|
+
"rotateZ(var(--un-rotate-z))",
|
|
660
|
+
"skewX(var(--un-skew-x))",
|
|
661
|
+
"skewY(var(--un-skew-y))",
|
|
662
|
+
"scaleX(var(--un-scale-x))",
|
|
663
|
+
"scaleY(var(--un-scale-y))",
|
|
664
|
+
"scaleZ(var(--un-scale-z))"
|
|
665
|
+
].join(" ")
|
|
600
666
|
};
|
|
601
667
|
const transformCpu = {
|
|
602
|
-
|
|
603
|
-
|
|
668
|
+
"--un-transform": [
|
|
669
|
+
"translateX(var(--un-translate-x))",
|
|
670
|
+
"translateY(var(--un-translate-y))",
|
|
671
|
+
"translateZ(var(--un-translate-z))",
|
|
672
|
+
"rotate(var(--un-rotate))",
|
|
673
|
+
"rotateX(var(--un-rotate-x))",
|
|
674
|
+
"rotateY(var(--un-rotate-y))",
|
|
675
|
+
"rotateZ(var(--un-rotate-z))",
|
|
676
|
+
"skewX(var(--un-skew-x))",
|
|
677
|
+
"skewY(var(--un-skew-y))",
|
|
678
|
+
"scaleX(var(--un-scale-x))",
|
|
679
|
+
"scaleY(var(--un-scale-y))",
|
|
680
|
+
"scaleZ(var(--un-scale-z))"
|
|
681
|
+
].join(" ")
|
|
604
682
|
};
|
|
605
683
|
const transformBase = {
|
|
606
684
|
"--un-rotate": 0,
|
|
685
|
+
"--un-rotate-x": 0,
|
|
686
|
+
"--un-rotate-y": 0,
|
|
687
|
+
"--un-rotate-z": 0,
|
|
607
688
|
"--un-scale-x": 1,
|
|
608
689
|
"--un-scale-y": 1,
|
|
609
690
|
"--un-scale-z": 1,
|
|
@@ -612,20 +693,43 @@ const transformBase = {
|
|
|
612
693
|
"--un-translate-x": 0,
|
|
613
694
|
"--un-translate-y": 0,
|
|
614
695
|
"--un-translate-z": 0,
|
|
615
|
-
...transformCpu
|
|
696
|
+
...transformCpu,
|
|
697
|
+
[core.CONTROL_SHORTCUT_NO_MERGE]: ""
|
|
616
698
|
};
|
|
617
699
|
const transforms = [
|
|
618
|
-
["transform", transformBase],
|
|
619
700
|
[/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] })],
|
|
701
|
+
[/^perspect-(.+)$/, ([, s]) => {
|
|
702
|
+
const v = utilities.handler.px.numberWithUnit(s);
|
|
703
|
+
if (v != null) {
|
|
704
|
+
return {
|
|
705
|
+
"-webkit-perspective": v,
|
|
706
|
+
"perspective": v
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
}],
|
|
710
|
+
[/^perspect-origin-(.+)$/, ([, s]) => {
|
|
711
|
+
const v = utilities.handler.bracket(s) ?? (s.length >= 3 ? utilities.positionMap[s] : void 0);
|
|
712
|
+
if (v != null) {
|
|
713
|
+
return {
|
|
714
|
+
"-webkit-perspective-origin": v,
|
|
715
|
+
"perspective-origin": v
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
}],
|
|
620
719
|
[/^translate-()(.+)$/, handleTranslate],
|
|
621
720
|
[/^translate-([xyz])-(.+)$/, handleTranslate],
|
|
622
|
-
[/^rotate-(.+)$/, handleRotate],
|
|
721
|
+
[/^rotate-()(.+)$/, handleRotate],
|
|
722
|
+
[/^rotate(-[xyz])-(.+)$/, handleRotate],
|
|
623
723
|
[/^skew-()(.+)$/, handleSkew],
|
|
624
724
|
[/^skew-([xy])-(.+)$/, handleSkew],
|
|
625
725
|
[/^scale-()(.+)$/, handleScale],
|
|
626
726
|
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
627
727
|
["preserve-3d", { "transform-style": "preserve-3d" }],
|
|
628
728
|
["preserve-flat", { "transform-style": "flat" }],
|
|
729
|
+
[/^transform$/, () => [
|
|
730
|
+
transformBase,
|
|
731
|
+
{ transform: "var(--un-transform)" }
|
|
732
|
+
]],
|
|
629
733
|
["transform-gpu", transformGpu],
|
|
630
734
|
["transform-cpu", transformCpu],
|
|
631
735
|
["transform-none", { transform: "none" }]
|
|
@@ -635,7 +739,10 @@ function handleTranslate([, d, b]) {
|
|
|
635
739
|
if (v != null) {
|
|
636
740
|
return [
|
|
637
741
|
transformBase,
|
|
638
|
-
|
|
742
|
+
[
|
|
743
|
+
...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v]),
|
|
744
|
+
["transform", "var(--un-transform)"]
|
|
745
|
+
]
|
|
639
746
|
];
|
|
640
747
|
}
|
|
641
748
|
}
|
|
@@ -644,16 +751,22 @@ function handleScale([, d, b]) {
|
|
|
644
751
|
if (v != null) {
|
|
645
752
|
return [
|
|
646
753
|
transformBase,
|
|
647
|
-
|
|
754
|
+
[
|
|
755
|
+
...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v]),
|
|
756
|
+
["transform", "var(--un-transform)"]
|
|
757
|
+
]
|
|
648
758
|
];
|
|
649
759
|
}
|
|
650
760
|
}
|
|
651
|
-
function handleRotate([, b]) {
|
|
761
|
+
function handleRotate([, d, b]) {
|
|
652
762
|
const v = utilities.handler.bracket.degree(b);
|
|
653
763
|
if (v != null) {
|
|
654
764
|
return [
|
|
655
765
|
transformBase,
|
|
656
|
-
{
|
|
766
|
+
{
|
|
767
|
+
[`--un-rotate${d || ""}`]: v,
|
|
768
|
+
transform: "var(--un-transform)"
|
|
769
|
+
}
|
|
657
770
|
];
|
|
658
771
|
}
|
|
659
772
|
}
|
|
@@ -662,7 +775,10 @@ function handleSkew([, d, b]) {
|
|
|
662
775
|
if (v != null) {
|
|
663
776
|
return [
|
|
664
777
|
transformBase,
|
|
665
|
-
{
|
|
778
|
+
{
|
|
779
|
+
[`--un-skew-${d}`]: v,
|
|
780
|
+
transform: "var(--un-transform)"
|
|
781
|
+
}
|
|
666
782
|
];
|
|
667
783
|
}
|
|
668
784
|
}
|
|
@@ -698,6 +814,9 @@ const cssVariables = [
|
|
|
698
814
|
return { [prop]: `var(--${varname})` };
|
|
699
815
|
}]
|
|
700
816
|
];
|
|
817
|
+
const cssProperty = [
|
|
818
|
+
[/^\[(.+):(.+)\]$/, ([, prop, value]) => ({ [prop]: utilities.handler.bracket(`[${value}]`) })]
|
|
819
|
+
];
|
|
701
820
|
|
|
702
821
|
const questionMark = [
|
|
703
822
|
[
|
|
@@ -738,14 +857,25 @@ const svgUtilities = [
|
|
|
738
857
|
[/^fill-(.+)$/, utilities.colorResolver("fill", "fill")],
|
|
739
858
|
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
740
859
|
["fill-none", { fill: "none" }],
|
|
741
|
-
[/^stroke-(?:size
|
|
860
|
+
[/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": utilities.handler.bracket.fraction.px.number(s) })],
|
|
861
|
+
[/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": utilities.handler.bracket.number(s) })],
|
|
862
|
+
[/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": utilities.handler.bracket.px.numberWithUnit(s) })],
|
|
742
863
|
[/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke")],
|
|
743
864
|
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
865
|
+
["stroke-cap-square", { "stroke-linecap": "square" }],
|
|
866
|
+
["stroke-cap-round", { "stroke-linecap": "round" }],
|
|
867
|
+
["stroke-cap-auto", { "stroke-linecap": "butt" }],
|
|
868
|
+
["stroke-join-arcs", { "stroke-linejoin": "arcs" }],
|
|
869
|
+
["stroke-join-bevel", { "stroke-linejoin": "bevel" }],
|
|
870
|
+
["stroke-join-clip", { "stroke-linejoin": "miter-clip" }],
|
|
871
|
+
["stroke-join-round", { "stroke-linejoin": "round" }],
|
|
872
|
+
["stroke-join-auto", { "stroke-linejoin": "miter" }],
|
|
744
873
|
["stroke-none", { stroke: "none" }]
|
|
745
874
|
];
|
|
746
875
|
|
|
747
876
|
const rules = [
|
|
748
877
|
cssVariables,
|
|
878
|
+
cssProperty,
|
|
749
879
|
paddings,
|
|
750
880
|
margins,
|
|
751
881
|
displays,
|
|
@@ -810,6 +940,7 @@ exports.boxShadows = boxShadows;
|
|
|
810
940
|
exports.boxSizing = boxSizing;
|
|
811
941
|
exports.breaks = breaks;
|
|
812
942
|
exports.contents = contents;
|
|
943
|
+
exports.cssProperty = cssProperty;
|
|
813
944
|
exports.cssVariables = cssVariables;
|
|
814
945
|
exports.cursors = cursors;
|
|
815
946
|
exports.displays = displays;
|
|
@@ -835,6 +966,7 @@ exports.questionMark = questionMark;
|
|
|
835
966
|
exports.resizes = resizes;
|
|
836
967
|
exports.rings = rings;
|
|
837
968
|
exports.rules = rules;
|
|
969
|
+
exports.shadowBase = shadowBase;
|
|
838
970
|
exports.sizes = sizes;
|
|
839
971
|
exports.svgUtilities = svgUtilities;
|
|
840
972
|
exports.tabSizes = tabSizes;
|