@unocss/preset-mini 0.20.1 → 0.21.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 +8 -10
- package/dist/chunks/default.mjs +8 -10
- package/dist/chunks/default2.cjs +177 -170
- package/dist/chunks/default2.mjs +178 -171
- package/dist/chunks/default3.cjs +34 -31
- package/dist/chunks/default3.mjs +32 -31
- package/dist/chunks/pseudo.cjs +38 -29
- package/dist/chunks/pseudo.mjs +38 -29
- package/dist/chunks/utilities.cjs +83 -41
- package/dist/chunks/utilities.mjs +83 -42
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/theme.d.ts +0 -10
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +8 -4
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +3 -1
- package/dist/variants.d.ts +13 -5
- package/dist/variants.mjs +1 -1
- package/package.json +2 -2
package/dist/chunks/default2.cjs
CHANGED
|
@@ -10,7 +10,7 @@ const verticalAlignAlias = {
|
|
|
10
10
|
btm: "bottom"
|
|
11
11
|
};
|
|
12
12
|
const verticalAligns = [
|
|
13
|
-
[/^(?:vertical|align|v)-(baseline|top|bottom|
|
|
13
|
+
[/^(?:vertical|align|v)-(baseline|top|middle|bottom|text-top|text-bottom|sub|super|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v })]
|
|
14
14
|
];
|
|
15
15
|
const textAligns = [
|
|
16
16
|
["text-center", { "text-align": "center" }],
|
|
@@ -24,7 +24,7 @@ const outline = [
|
|
|
24
24
|
[/^outline-(?:color-)?(.+)$/, utilities.colorResolver("outline-color", "outline-color")],
|
|
25
25
|
[/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": utilities.handler.bracket.fraction.auto.rem(d) })],
|
|
26
26
|
["outline", { "outline-style": "solid" }],
|
|
27
|
-
[/^outline-(auto|dotted|
|
|
27
|
+
[/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
|
|
28
28
|
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
29
29
|
];
|
|
30
30
|
const appearance = [
|
|
@@ -34,31 +34,31 @@ const appearance = [
|
|
|
34
34
|
}]
|
|
35
35
|
];
|
|
36
36
|
const willChange = [
|
|
37
|
-
[/^will-change-(.+)/, ([, p]) => ({ "will-change": utilities.handler.properties.global(p) })]
|
|
37
|
+
[/^will-change-(.+)/, ([, p]) => ({ "will-change": utilities.handler.properties.auto.global(p) })]
|
|
38
38
|
];
|
|
39
39
|
|
|
40
40
|
const borders = [
|
|
41
|
-
[/^border
|
|
42
|
-
[/^(?:border|b)()
|
|
43
|
-
[/^(?:border|b)-([
|
|
44
|
-
[/^(?:border|b)()
|
|
45
|
-
[/^(?:border|b)-([
|
|
46
|
-
[/^(?:border|b)()-(.+)$/,
|
|
47
|
-
[/^(?:border|b)-(
|
|
48
|
-
[/^(?:border|b)-
|
|
49
|
-
[/^(?:border|b)-([
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
[/^(?:border-)?(?:rounded|rd)
|
|
56
|
-
[/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
|
|
57
|
-
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded],
|
|
41
|
+
[/^(?:border|b)()(?:-(.+))?$/, handlerBorder],
|
|
42
|
+
[/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
|
|
43
|
+
[/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
|
|
44
|
+
[/^(?:border|b)-()size-(.+)$/, handlerBorderSize],
|
|
45
|
+
[/^(?:border|b)-([xy])-size-(.+)$/, handlerBorderSize],
|
|
46
|
+
[/^(?:border|b)-([rltbse])-size-(.+)$/, handlerBorderSize],
|
|
47
|
+
[/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor],
|
|
48
|
+
[/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
49
|
+
[/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
50
|
+
[/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
51
|
+
[/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
52
|
+
[/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
53
|
+
[/^(?:border-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded],
|
|
54
|
+
[/^(?:border-)?(?:rounded|rd)-([xy])(?:-(.+))?$/, handlerRounded],
|
|
55
|
+
[/^(?:border-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
|
|
56
|
+
[/^(?:border-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
|
|
58
57
|
["border-solid", { "border-style": "solid" }],
|
|
59
58
|
["border-dashed", { "border-style": "dashed" }],
|
|
60
59
|
["border-dotted", { "border-style": "dotted" }],
|
|
61
60
|
["border-double", { "border-style": "double" }],
|
|
61
|
+
["border-hidden", { "border-style": "hidden" }],
|
|
62
62
|
["border-none", { "border-style": "none" }]
|
|
63
63
|
];
|
|
64
64
|
const borderHasColor = (color, { theme }) => {
|
|
@@ -68,13 +68,11 @@ const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
|
68
68
|
const data = utilities.parseColor(body, theme);
|
|
69
69
|
if (!data)
|
|
70
70
|
return;
|
|
71
|
-
const { opacity, color, rgba } = data;
|
|
71
|
+
const { alpha, opacity, color, rgba } = data;
|
|
72
72
|
if (!color)
|
|
73
73
|
return;
|
|
74
|
-
const a = opacity ? opacity[0] === "[" ? utilities.handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
|
|
75
74
|
if (rgba) {
|
|
76
|
-
if (
|
|
77
|
-
rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
|
|
75
|
+
if (alpha != null) {
|
|
78
76
|
return {
|
|
79
77
|
[`border${direction}-color`]: `rgba(${rgba.join(",")})`
|
|
80
78
|
};
|
|
@@ -82,19 +80,19 @@ const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
|
82
80
|
if (direction === "") {
|
|
83
81
|
return {
|
|
84
82
|
"--un-border-opacity": (opacity && utilities.handler.cssvar(opacity)) ?? 1,
|
|
85
|
-
[`border${direction}-color`]: `rgba(${rgba.
|
|
83
|
+
[`border${direction}-color`]: `rgba(${rgba.join(",")},var(--un-border${direction}-opacity))`
|
|
86
84
|
};
|
|
87
85
|
} else {
|
|
88
86
|
return {
|
|
89
87
|
"--un-border-opacity": (opacity && utilities.handler.cssvar(opacity)) ?? 1,
|
|
90
88
|
[`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
|
|
91
|
-
[`border${direction}-color`]: `rgba(${rgba.
|
|
89
|
+
[`border${direction}-color`]: `rgba(${rgba.join(",")},var(--un-border${direction}-opacity))`
|
|
92
90
|
};
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
93
|
} else {
|
|
96
94
|
return {
|
|
97
|
-
[`border${direction}-color`]: color.replace("%alpha", `${
|
|
95
|
+
[`border${direction}-color`]: color.replace("%alpha", `${alpha || 1}`)
|
|
98
96
|
};
|
|
99
97
|
}
|
|
100
98
|
};
|
|
@@ -107,22 +105,25 @@ function handlerBorder(m) {
|
|
|
107
105
|
];
|
|
108
106
|
}
|
|
109
107
|
}
|
|
110
|
-
function handlerBorderSize([, a, b]) {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return utilities.directionMap[d].map((i) => [`border${i}-width`, v]);
|
|
108
|
+
function handlerBorderSize([, a = "", b = "1"]) {
|
|
109
|
+
const v = utilities.handler.bracket.px(b);
|
|
110
|
+
if (a in utilities.directionMap && v != null)
|
|
111
|
+
return utilities.directionMap[a].map((i) => [`border${i}-width`, v]);
|
|
115
112
|
}
|
|
116
|
-
function handlerBorderColor([, a, c], ctx) {
|
|
117
|
-
if (borderHasColor(c, ctx)) {
|
|
118
|
-
return Object.assign({}, ...utilities.directionMap[
|
|
113
|
+
function handlerBorderColor([, a = "", c], ctx) {
|
|
114
|
+
if (a in utilities.directionMap && borderHasColor(c, ctx)) {
|
|
115
|
+
return Object.assign({}, ...utilities.directionMap[a].map((i) => borderColorResolver(i)(["", c], ctx)));
|
|
119
116
|
}
|
|
120
117
|
}
|
|
121
|
-
function
|
|
122
|
-
const
|
|
118
|
+
function handlerBorderOpacity([, a = "", opacity]) {
|
|
119
|
+
const v = utilities.handler.bracket.percent(opacity);
|
|
120
|
+
if (a in utilities.directionMap && v != null)
|
|
121
|
+
return utilities.directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
|
|
122
|
+
}
|
|
123
|
+
function handlerRounded([, a = "", s = "DEFAULT"], { theme }) {
|
|
123
124
|
const v = theme.borderRadius?.[s] || utilities.handler.auto.rem.fraction.bracket.cssvar(s);
|
|
124
|
-
if (v
|
|
125
|
-
return utilities.cornerMap[
|
|
125
|
+
if (a in utilities.cornerMap && v != null)
|
|
126
|
+
return utilities.cornerMap[a].map((i) => [`border${i}-radius`, v]);
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
const opacity = [
|
|
@@ -137,12 +138,19 @@ const bgColors = [
|
|
|
137
138
|
[/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
138
139
|
];
|
|
139
140
|
|
|
141
|
+
const transitionPropertyGroup = {
|
|
142
|
+
all: "all",
|
|
143
|
+
colors: ["color", "background-color", "border-color", "text-decoration-color", "fill", "stroke"].join(","),
|
|
144
|
+
opacity: "opacity",
|
|
145
|
+
shadow: "box-shadow",
|
|
146
|
+
transform: "transform"
|
|
147
|
+
};
|
|
140
148
|
const transitionProperty = (prop) => {
|
|
141
|
-
return utilities.handler.properties(prop)
|
|
149
|
+
return utilities.handler.properties(prop) ?? transitionPropertyGroup[prop];
|
|
142
150
|
};
|
|
143
151
|
const transitions = [
|
|
144
|
-
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop
|
|
145
|
-
const p = transitionProperty(prop);
|
|
152
|
+
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
|
|
153
|
+
const p = prop != null ? transitionProperty(prop) : [transitionPropertyGroup.colors, "opacity", "box-shadow", "transform", "filter", "backdrop-filter"].join(",");
|
|
146
154
|
if (p) {
|
|
147
155
|
return {
|
|
148
156
|
"transition-property": p,
|
|
@@ -151,14 +159,14 @@ const transitions = [
|
|
|
151
159
|
};
|
|
152
160
|
}
|
|
153
161
|
}],
|
|
154
|
-
[/^
|
|
162
|
+
[/^(?:transition-)?delay-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-delay": utilities.handler.bracket.time(d) })],
|
|
163
|
+
[/^(?:transition-)?duration-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-duration": utilities.handler.bracket.time(d) })],
|
|
164
|
+
[/^ease-(.+)$/, ([, d]) => ({ "transition-timing-function": utilities.handler.bracket(d) })],
|
|
155
165
|
["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
156
166
|
["ease-linear", { "transition-timing-function": "linear" }],
|
|
157
167
|
["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
|
|
158
168
|
["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
|
|
159
169
|
["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
160
|
-
[/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
|
|
161
|
-
[/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
|
|
162
170
|
[/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) })],
|
|
163
171
|
["transition-property-none", { "transition-property": "none" }],
|
|
164
172
|
["property-none", { "transition-property": "none" }],
|
|
@@ -174,10 +182,11 @@ const flex = [
|
|
|
174
182
|
["flex-initial", { flex: "0 1 auto" }],
|
|
175
183
|
["flex-none", { flex: "none" }],
|
|
176
184
|
[/^flex-(\[.+\])$/, ([, d]) => ({ flex: utilities.handler.bracket(d).replace(/\d+\/\d+/, ($1) => utilities.handler.fraction($1)) })],
|
|
177
|
-
[
|
|
178
|
-
[
|
|
179
|
-
[
|
|
180
|
-
[
|
|
185
|
+
[/^(?:flex-)?shrink$/, () => ({ "flex-shrink": 1 })],
|
|
186
|
+
[/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
|
|
187
|
+
[/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
|
|
188
|
+
[/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
|
|
189
|
+
[/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": utilities.handler.bracket.fraction.auto.rem(d) })],
|
|
181
190
|
["flex-row", { "flex-direction": "row" }],
|
|
182
191
|
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
183
192
|
["flex-col", { "flex-direction": "column" }],
|
|
@@ -220,7 +229,7 @@ const fonts = [
|
|
|
220
229
|
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s) })]
|
|
221
230
|
];
|
|
222
231
|
const tabSizes = [
|
|
223
|
-
[/^tab
|
|
232
|
+
[/^tab(?:-([^-]+))?$/, ([, s]) => {
|
|
224
233
|
const v = utilities.handler.bracket.global.number(s || "4");
|
|
225
234
|
if (v != null) {
|
|
226
235
|
return {
|
|
@@ -245,68 +254,64 @@ const textShadows = [
|
|
|
245
254
|
|
|
246
255
|
const directions = {
|
|
247
256
|
"": "",
|
|
248
|
-
"x
|
|
249
|
-
"y
|
|
257
|
+
"x": "column-",
|
|
258
|
+
"y": "row-"
|
|
259
|
+
};
|
|
260
|
+
const handleGap = ([, d = "", s]) => {
|
|
261
|
+
const v = utilities.handler.bracket.auto.rem(s);
|
|
262
|
+
if (v != null) {
|
|
263
|
+
return {
|
|
264
|
+
[`grid-${directions[d]}gap`]: v,
|
|
265
|
+
[`${directions[d]}gap`]: v
|
|
266
|
+
};
|
|
267
|
+
}
|
|
250
268
|
};
|
|
251
269
|
const gaps = [
|
|
252
|
-
[/^(?:flex-|grid-)?gap-(
|
|
253
|
-
|
|
254
|
-
if (v != null) {
|
|
255
|
-
return {
|
|
256
|
-
[`grid-${directions[d]}gap`]: v,
|
|
257
|
-
[`${directions[d]}gap`]: v
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
}]
|
|
270
|
+
[/^(?:flex-|grid-)?gap-()([^-]+)$/, handleGap],
|
|
271
|
+
[/^(?:flex-|grid-)?gap-([xy])-([^-]+)$/, handleGap]
|
|
261
272
|
];
|
|
262
273
|
|
|
263
|
-
const
|
|
274
|
+
const rowCol = (s) => s.replace("col", "column");
|
|
264
275
|
const autoDirection = (selector, theme) => {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
276
|
+
const v = theme.fontSize?.[selector];
|
|
277
|
+
if (v != null)
|
|
278
|
+
return core.toArray(v)[0];
|
|
279
|
+
switch (selector) {
|
|
280
|
+
case "min":
|
|
281
|
+
return "min-content";
|
|
282
|
+
case "max":
|
|
283
|
+
return "max-content";
|
|
284
|
+
case "fr":
|
|
285
|
+
return "minmax(0,1fr)";
|
|
286
|
+
}
|
|
287
|
+
return utilities.handler.bracket.auto.rem(selector);
|
|
272
288
|
};
|
|
273
289
|
const grids = [
|
|
274
290
|
["grid", { display: "grid" }],
|
|
275
291
|
["inline-grid", { display: "inline-grid" }],
|
|
276
|
-
[/^(?:grid-)?col-
|
|
277
|
-
[/^(?:grid-)?col-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if (raw)
|
|
284
|
-
return { [key]: raw };
|
|
285
|
-
const parts = v.split("-");
|
|
286
|
-
if (parts.length === 1 && parts[0] === "auto")
|
|
287
|
-
return { [key]: parts[0] };
|
|
288
|
-
if (parts[0] === "span") {
|
|
289
|
-
if (parts[1] === "full")
|
|
290
|
-
return { [key]: "1/-1" };
|
|
291
|
-
raw = utilities.handler.number.bracket(parts[1]);
|
|
292
|
-
if (raw)
|
|
293
|
-
return { [key]: `span ${raw}/span ${raw}` };
|
|
294
|
-
}
|
|
292
|
+
[/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: utilities.handler.bracket.auto(v) })],
|
|
293
|
+
[/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
|
|
294
|
+
if (s === "full")
|
|
295
|
+
return { [`grid-${rowCol(c)}`]: "1/-1" };
|
|
296
|
+
const v = utilities.handler.bracket.number(s);
|
|
297
|
+
if (v != null)
|
|
298
|
+
return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
|
|
295
299
|
}],
|
|
296
|
-
[/^(?:grid-)?
|
|
297
|
-
[/^(?:grid-)?
|
|
298
|
-
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({
|
|
299
|
-
[/^grid-
|
|
300
|
-
[/^grid-rows-(
|
|
301
|
-
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({
|
|
302
|
-
[/^grid-rows-
|
|
303
|
-
[
|
|
304
|
-
[
|
|
300
|
+
[/^(?:grid-)?(row|col)-start-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: v })],
|
|
301
|
+
[/^(?:grid-)?(row|col)-end-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: v })],
|
|
302
|
+
[/^(?:grid-)?auto-(rows|cols)-([\w.-]+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) })],
|
|
303
|
+
[/^(?:grid-auto-flow|auto-flow|grid-flow)-((?:row|col)(?:-dense)?)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
|
|
304
|
+
[/^grid-(rows|cols)-(\[.+\])$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: utilities.handler.bracket(v) })],
|
|
305
|
+
[/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
306
|
+
[/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
|
|
307
|
+
["grid-rows-none", { "grid-template-rows": "none" }],
|
|
308
|
+
["grid-cols-none", { "grid-template-columns": "none" }]
|
|
305
309
|
];
|
|
306
310
|
|
|
307
311
|
const overflowValues = [
|
|
308
312
|
"auto",
|
|
309
313
|
"hidden",
|
|
314
|
+
"clip",
|
|
310
315
|
"visible",
|
|
311
316
|
"scroll"
|
|
312
317
|
];
|
|
@@ -315,7 +320,6 @@ const overflows = [
|
|
|
315
320
|
[/^(?:overflow|of)-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]
|
|
316
321
|
];
|
|
317
322
|
|
|
318
|
-
const basicSet = ["auto", "start", "end", "center", "stretch"];
|
|
319
323
|
const positions = [
|
|
320
324
|
[/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v })],
|
|
321
325
|
[/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
|
|
@@ -327,8 +331,15 @@ const justifies = [
|
|
|
327
331
|
["justify-between", { "justify-content": "space-between" }],
|
|
328
332
|
["justify-around", { "justify-content": "space-around" }],
|
|
329
333
|
["justify-evenly", { "justify-content": "space-evenly" }],
|
|
330
|
-
|
|
331
|
-
|
|
334
|
+
["justify-items-start", { "justify-items": "start" }],
|
|
335
|
+
["justify-items-end", { "justify-items": "end" }],
|
|
336
|
+
["justify-items-center", { "justify-items": "center" }],
|
|
337
|
+
["justify-items-stretch", { "justify-items": "stretch" }],
|
|
338
|
+
["justify-self-auto", { "justify-self": "auto" }],
|
|
339
|
+
["justify-self-start", { "justify-self": "start" }],
|
|
340
|
+
["justify-self-end", { "justify-self": "end" }],
|
|
341
|
+
["justify-self-center", { "justify-self": "center" }],
|
|
342
|
+
["justify-self-stretch", { "justify-self": "stretch" }]
|
|
332
343
|
];
|
|
333
344
|
const orders = [
|
|
334
345
|
[/^order-(.+)$/, ([, v]) => ({ order: utilities.handler.bracket.number(v) })],
|
|
@@ -337,9 +348,9 @@ const orders = [
|
|
|
337
348
|
["order-none", { order: "0" }]
|
|
338
349
|
];
|
|
339
350
|
const alignments = [
|
|
351
|
+
["content-center", { "align-content": "center" }],
|
|
340
352
|
["content-start", { "align-content": "flex-start" }],
|
|
341
353
|
["content-end", { "align-content": "flex-end" }],
|
|
342
|
-
["content-center", { "align-content": "center" }],
|
|
343
354
|
["content-between", { "align-content": "space-between" }],
|
|
344
355
|
["content-around", { "align-content": "space-around" }],
|
|
345
356
|
["content-evenly", { "align-content": "space-evenly" }],
|
|
@@ -352,29 +363,39 @@ const alignments = [
|
|
|
352
363
|
["self-start", { "align-self": "flex-start" }],
|
|
353
364
|
["self-end", { "align-self": "flex-end" }],
|
|
354
365
|
["self-center", { "align-self": "center" }],
|
|
355
|
-
["self-stretch", { "align-self": "stretch" }]
|
|
366
|
+
["self-stretch", { "align-self": "stretch" }],
|
|
367
|
+
["self-baseline", { "align-self": "baseline" }]
|
|
356
368
|
];
|
|
357
369
|
const placements = [
|
|
370
|
+
["place-content-center", { "place-content": "center" }],
|
|
358
371
|
["place-content-start", { "place-content": "start" }],
|
|
359
372
|
["place-content-end", { "place-content": "end" }],
|
|
360
|
-
["place-content-center", { "place-content": "center" }],
|
|
361
373
|
["place-content-between", { "place-content": "space-between" }],
|
|
362
374
|
["place-content-around", { "place-content": "space-around" }],
|
|
363
375
|
["place-content-evenly", { "place-content": "space-evenly" }],
|
|
364
376
|
["place-content-stretch", { "place-content": "stretch" }],
|
|
365
|
-
|
|
366
|
-
|
|
377
|
+
["place-items-start", { "place-items": "start" }],
|
|
378
|
+
["place-items-end", { "place-items": "end" }],
|
|
379
|
+
["place-items-center", { "place-items": "center" }],
|
|
380
|
+
["place-items-stretch", { "place-items": "stretch" }],
|
|
381
|
+
["place-self-auto", { "place-self": "auto" }],
|
|
382
|
+
["place-self-start", { "place-self": "start" }],
|
|
383
|
+
["place-self-end", { "place-self": "end" }],
|
|
384
|
+
["place-self-center", { "place-self": "center" }],
|
|
385
|
+
["place-self-stretch", { "place-self": "stretch" }]
|
|
367
386
|
];
|
|
368
387
|
function handleInsetValue(v) {
|
|
369
388
|
return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.auto.rem(v);
|
|
370
389
|
}
|
|
390
|
+
function handleInsetValues([, d, v]) {
|
|
391
|
+
const r = handleInsetValue(v);
|
|
392
|
+
if (r != null && d in utilities.directionMap)
|
|
393
|
+
return utilities.directionMap[d].map((i) => [i.slice(1), r]);
|
|
394
|
+
}
|
|
371
395
|
const insets = [
|
|
372
|
-
[/^(?:position-|pos-)?
|
|
373
|
-
[/^(?:position-|pos-)?inset-([xy])-(.+)$/,
|
|
374
|
-
|
|
375
|
-
if (r != null && d in utilities.directionMap)
|
|
376
|
-
return utilities.directionMap[d].map((i) => [i.slice(1), r]);
|
|
377
|
-
}]
|
|
396
|
+
[/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
|
|
397
|
+
[/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
|
|
398
|
+
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
|
|
378
399
|
];
|
|
379
400
|
const floats = [
|
|
380
401
|
["float-left", { float: "left" }],
|
|
@@ -437,7 +458,7 @@ const contents = [
|
|
|
437
458
|
];
|
|
438
459
|
const breaks = [
|
|
439
460
|
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
440
|
-
["break-
|
|
461
|
+
["break-words", { "overflow-wrap": "break-word" }],
|
|
441
462
|
["break-all", { "word-break": "break-all" }]
|
|
442
463
|
];
|
|
443
464
|
const textOverflows = [
|
|
@@ -469,14 +490,14 @@ const fontSmoothings = [
|
|
|
469
490
|
];
|
|
470
491
|
|
|
471
492
|
const rings = [
|
|
472
|
-
[/^ring
|
|
493
|
+
[/^ring(?:-(.+))?$/, ([, d]) => {
|
|
473
494
|
const value = utilities.handler.px(d || "1");
|
|
474
495
|
if (value) {
|
|
475
496
|
return {
|
|
476
497
|
"--un-ring-inset": varEmpty,
|
|
477
498
|
"--un-ring-offset-width": "0px",
|
|
478
499
|
"--un-ring-offset-color": "#fff",
|
|
479
|
-
"--un-ring-color": "rgba(
|
|
500
|
+
"--un-ring-color": "rgba(147, 197, 253, .5)",
|
|
480
501
|
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
481
502
|
"--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
|
|
482
503
|
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
|
|
@@ -510,7 +531,7 @@ const shadowColorResolver = (body, theme) => {
|
|
|
510
531
|
}
|
|
511
532
|
};
|
|
512
533
|
const boxShadows = [
|
|
513
|
-
[/^shadow
|
|
534
|
+
[/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
|
|
514
535
|
const value = theme.boxShadow?.[d || "DEFAULT"];
|
|
515
536
|
if (value) {
|
|
516
537
|
return {
|
|
@@ -528,27 +549,38 @@ const boxShadows = [
|
|
|
528
549
|
function getPropName(minmax, hw) {
|
|
529
550
|
return `${minmax ? `${minmax}-` : ""}${hw === "h" ? "height" : "width"}`;
|
|
530
551
|
}
|
|
531
|
-
function
|
|
552
|
+
function getSizeValue(minmax, hw, theme, prop) {
|
|
532
553
|
let str = `${hw === "h" ? "height" : "width"}`;
|
|
533
554
|
if (minmax)
|
|
534
555
|
str = `${minmax}${utilities.capitalize(str)}`;
|
|
535
|
-
|
|
556
|
+
const v = theme[str]?.[prop];
|
|
557
|
+
if (v != null)
|
|
558
|
+
return v;
|
|
559
|
+
switch (prop) {
|
|
560
|
+
case "fit":
|
|
561
|
+
case "max":
|
|
562
|
+
case "min":
|
|
563
|
+
return `${prop}-content`;
|
|
564
|
+
}
|
|
565
|
+
return utilities.handler.bracket.cssvar.fraction.auto.rem(prop);
|
|
536
566
|
}
|
|
537
567
|
const sizes = [
|
|
538
|
-
[/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
return
|
|
547
|
-
|
|
548
|
-
|
|
568
|
+
[/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
|
|
569
|
+
[/^(?:(min|max)-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
|
|
570
|
+
];
|
|
571
|
+
function getAspectRatio(prop) {
|
|
572
|
+
if (/^\d+\/\d+$/.test(prop))
|
|
573
|
+
return prop;
|
|
574
|
+
switch (prop) {
|
|
575
|
+
case "square":
|
|
576
|
+
return "1/1";
|
|
577
|
+
case "video":
|
|
578
|
+
return "16/9";
|
|
579
|
+
}
|
|
580
|
+
return utilities.handler.bracket.cssvar.auto.number(prop);
|
|
581
|
+
}
|
|
549
582
|
const aspectRatio = [
|
|
550
|
-
[
|
|
551
|
-
[/^aspect-ratio-(.+)$/, ([, d]) => ({ "aspect-ratio": (/^\d+\/\d+$/.test(d) ? d : null) || utilities.handler.bracket.cssvar.number(d) })]
|
|
583
|
+
[/^aspect-(?:ratio-)?(.+)$/, ([, d]) => ({ "aspect-ratio": getAspectRatio(d) })]
|
|
552
584
|
];
|
|
553
585
|
|
|
554
586
|
const paddings = [
|
|
@@ -584,27 +616,19 @@ const transformBase = {
|
|
|
584
616
|
};
|
|
585
617
|
const transforms = [
|
|
586
618
|
["transform", transformBase],
|
|
587
|
-
[/^
|
|
588
|
-
[/^translate()
|
|
619
|
+
[/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] })],
|
|
620
|
+
[/^translate-()(.+)$/, handleTranslate],
|
|
589
621
|
[/^translate-([xyz])-(.+)$/, handleTranslate],
|
|
590
|
-
[/^scale()-(.+)$/, handleScale],
|
|
591
|
-
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
592
622
|
[/^rotate-(.+)$/, handleRotate],
|
|
593
|
-
[/^
|
|
623
|
+
[/^skew-()(.+)$/, handleSkew],
|
|
594
624
|
[/^skew-([xy])-(.+)$/, handleSkew],
|
|
595
|
-
[/^
|
|
625
|
+
[/^scale-()(.+)$/, handleScale],
|
|
626
|
+
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
627
|
+
["preserve-3d", { "transform-style": "preserve-3d" }],
|
|
628
|
+
["preserve-flat", { "transform-style": "flat" }],
|
|
596
629
|
["transform-gpu", transformGpu],
|
|
597
630
|
["transform-cpu", transformCpu],
|
|
598
|
-
["transform-none", { transform: "none" }]
|
|
599
|
-
["origin-center", { "transform-origin": "center" }],
|
|
600
|
-
["origin-top", { "transform-origin": "top" }],
|
|
601
|
-
["origin-top-right", { "transform-origin": "top right" }],
|
|
602
|
-
["origin-right", { "transform-origin": "right" }],
|
|
603
|
-
["origin-bottom-right", { "transform-origin": "bottom right" }],
|
|
604
|
-
["origin-bottom", { "transform-origin": "bottom" }],
|
|
605
|
-
["origin-bottom-left", { "transform-origin": "bottom left" }],
|
|
606
|
-
["origin-left", { "transform-origin": "left" }],
|
|
607
|
-
["origin-top-left", { "transform-origin": "top left" }]
|
|
631
|
+
["transform-none", { transform: "none" }]
|
|
608
632
|
];
|
|
609
633
|
function handleTranslate([, d, b]) {
|
|
610
634
|
const v = utilities.handler.bracket.fraction.auto.rem(b);
|
|
@@ -624,17 +648,8 @@ function handleScale([, d, b]) {
|
|
|
624
648
|
];
|
|
625
649
|
}
|
|
626
650
|
}
|
|
627
|
-
function handleRotateWithUnit([, b]) {
|
|
628
|
-
const v = utilities.handler.bracket.number(b);
|
|
629
|
-
if (v != null) {
|
|
630
|
-
return [
|
|
631
|
-
transformBase,
|
|
632
|
-
{ "--un-rotate": `${v}deg` }
|
|
633
|
-
];
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
651
|
function handleRotate([, b]) {
|
|
637
|
-
const v = utilities.handler.bracket(b);
|
|
652
|
+
const v = utilities.handler.bracket.degree(b);
|
|
638
653
|
if (v != null) {
|
|
639
654
|
return [
|
|
640
655
|
transformBase,
|
|
@@ -642,17 +657,8 @@ function handleRotate([, b]) {
|
|
|
642
657
|
];
|
|
643
658
|
}
|
|
644
659
|
}
|
|
645
|
-
function handleSkewWithUnit([, d, b]) {
|
|
646
|
-
const v = utilities.handler.bracket.number(b);
|
|
647
|
-
if (v != null) {
|
|
648
|
-
return [
|
|
649
|
-
transformBase,
|
|
650
|
-
{ [`--un-skew-${d}`]: `${v}deg` }
|
|
651
|
-
];
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
660
|
function handleSkew([, d, b]) {
|
|
655
|
-
const v = utilities.handler.bracket(b);
|
|
661
|
+
const v = utilities.handler.bracket.degree(b);
|
|
656
662
|
if (v != null) {
|
|
657
663
|
return [
|
|
658
664
|
transformBase,
|
|
@@ -705,10 +711,11 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
705
711
|
];
|
|
706
712
|
|
|
707
713
|
const textDecorations = [
|
|
708
|
-
["underline", { "text-decoration": "underline" }],
|
|
709
|
-
["
|
|
710
|
-
["
|
|
711
|
-
["decoration-
|
|
714
|
+
["underline", { "text-decoration-line": "underline" }],
|
|
715
|
+
["overline", { "text-decoration-line": "overline" }],
|
|
716
|
+
["line-through", { "text-decoration-line": "line-through" }],
|
|
717
|
+
["decoration-underline", { "text-decoration-line": "underline" }],
|
|
718
|
+
["decoration-line-through", { "text-decoration-line": "line-through" }],
|
|
712
719
|
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": utilities.handler.bracket.px(s) })],
|
|
713
720
|
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
|
|
714
721
|
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|