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