@unocss/preset-mini 0.20.2 → 0.21.2
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 +172 -163
- package/dist/chunks/default2.mjs +173 -164
- package/dist/chunks/default3.cjs +14 -32
- package/dist/chunks/default3.mjs +15 -32
- package/dist/chunks/pseudo.cjs +21 -16
- package/dist/chunks/pseudo.mjs +21 -16
- package/dist/chunks/utilities.cjs +67 -34
- package/dist/chunks/utilities.mjs +67 -35
- 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 +0 -1
- package/dist/variants.d.ts +7 -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 }) => {
|
|
@@ -105,22 +105,25 @@ function handlerBorder(m) {
|
|
|
105
105
|
];
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
function handlerBorderSize([, a, b]) {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
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]);
|
|
113
112
|
}
|
|
114
|
-
function handlerBorderColor([, a, c], ctx) {
|
|
115
|
-
if (borderHasColor(c, ctx)) {
|
|
116
|
-
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)));
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
|
-
function
|
|
120
|
-
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 }) {
|
|
121
124
|
const v = theme.borderRadius?.[s] || utilities.handler.auto.rem.fraction.bracket.cssvar(s);
|
|
122
|
-
if (v
|
|
123
|
-
return utilities.cornerMap[
|
|
125
|
+
if (a in utilities.cornerMap && v != null)
|
|
126
|
+
return utilities.cornerMap[a].map((i) => [`border${i}-radius`, v]);
|
|
124
127
|
}
|
|
125
128
|
|
|
126
129
|
const opacity = [
|
|
@@ -135,12 +138,19 @@ const bgColors = [
|
|
|
135
138
|
[/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
136
139
|
];
|
|
137
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
|
+
};
|
|
138
148
|
const transitionProperty = (prop) => {
|
|
139
|
-
return utilities.handler.properties(prop)
|
|
149
|
+
return utilities.handler.properties(prop) ?? transitionPropertyGroup[prop];
|
|
140
150
|
};
|
|
141
151
|
const transitions = [
|
|
142
|
-
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop
|
|
143
|
-
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(",");
|
|
144
154
|
if (p) {
|
|
145
155
|
return {
|
|
146
156
|
"transition-property": p,
|
|
@@ -149,14 +159,14 @@ const transitions = [
|
|
|
149
159
|
};
|
|
150
160
|
}
|
|
151
161
|
}],
|
|
152
|
-
[/^
|
|
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) })],
|
|
153
165
|
["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
154
166
|
["ease-linear", { "transition-timing-function": "linear" }],
|
|
155
167
|
["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
|
|
156
168
|
["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
|
|
157
169
|
["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
170
|
[/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) })],
|
|
161
171
|
["transition-property-none", { "transition-property": "none" }],
|
|
162
172
|
["property-none", { "transition-property": "none" }],
|
|
@@ -172,10 +182,11 @@ const flex = [
|
|
|
172
182
|
["flex-initial", { flex: "0 1 auto" }],
|
|
173
183
|
["flex-none", { flex: "none" }],
|
|
174
184
|
[/^flex-(\[.+\])$/, ([, d]) => ({ flex: utilities.handler.bracket(d).replace(/\d+\/\d+/, ($1) => utilities.handler.fraction($1)) })],
|
|
175
|
-
[
|
|
176
|
-
[
|
|
177
|
-
[
|
|
178
|
-
[
|
|
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) })],
|
|
179
190
|
["flex-row", { "flex-direction": "row" }],
|
|
180
191
|
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
181
192
|
["flex-col", { "flex-direction": "column" }],
|
|
@@ -218,7 +229,7 @@ const fonts = [
|
|
|
218
229
|
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s) })]
|
|
219
230
|
];
|
|
220
231
|
const tabSizes = [
|
|
221
|
-
[/^tab
|
|
232
|
+
[/^tab(?:-([^-]+))?$/, ([, s]) => {
|
|
222
233
|
const v = utilities.handler.bracket.global.number(s || "4");
|
|
223
234
|
if (v != null) {
|
|
224
235
|
return {
|
|
@@ -243,68 +254,64 @@ const textShadows = [
|
|
|
243
254
|
|
|
244
255
|
const directions = {
|
|
245
256
|
"": "",
|
|
246
|
-
"x
|
|
247
|
-
"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
|
+
}
|
|
248
268
|
};
|
|
249
269
|
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
|
-
}]
|
|
270
|
+
[/^(?:flex-|grid-)?gap-()([^-]+)$/, handleGap],
|
|
271
|
+
[/^(?:flex-|grid-)?gap-([xy])-([^-]+)$/, handleGap]
|
|
259
272
|
];
|
|
260
273
|
|
|
261
|
-
const
|
|
274
|
+
const rowCol = (s) => s.replace("col", "column");
|
|
262
275
|
const autoDirection = (selector, theme) => {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
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);
|
|
270
288
|
};
|
|
271
289
|
const grids = [
|
|
272
290
|
["grid", { display: "grid" }],
|
|
273
291
|
["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 = utilities.handler.number.bracket(parts[1]);
|
|
290
|
-
if (raw)
|
|
291
|
-
return { [key]: `span ${raw}/span ${raw}` };
|
|
292
|
-
}
|
|
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}` };
|
|
293
299
|
}],
|
|
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
|
-
[
|
|
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" }]
|
|
303
309
|
];
|
|
304
310
|
|
|
305
311
|
const overflowValues = [
|
|
306
312
|
"auto",
|
|
307
313
|
"hidden",
|
|
314
|
+
"clip",
|
|
308
315
|
"visible",
|
|
309
316
|
"scroll"
|
|
310
317
|
];
|
|
@@ -313,7 +320,6 @@ const overflows = [
|
|
|
313
320
|
[/^(?:overflow|of)-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]
|
|
314
321
|
];
|
|
315
322
|
|
|
316
|
-
const basicSet = ["auto", "start", "end", "center", "stretch"];
|
|
317
323
|
const positions = [
|
|
318
324
|
[/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v })],
|
|
319
325
|
[/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
|
|
@@ -325,8 +331,15 @@ const justifies = [
|
|
|
325
331
|
["justify-between", { "justify-content": "space-between" }],
|
|
326
332
|
["justify-around", { "justify-content": "space-around" }],
|
|
327
333
|
["justify-evenly", { "justify-content": "space-evenly" }],
|
|
328
|
-
|
|
329
|
-
|
|
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" }]
|
|
330
343
|
];
|
|
331
344
|
const orders = [
|
|
332
345
|
[/^order-(.+)$/, ([, v]) => ({ order: utilities.handler.bracket.number(v) })],
|
|
@@ -335,9 +348,9 @@ const orders = [
|
|
|
335
348
|
["order-none", { order: "0" }]
|
|
336
349
|
];
|
|
337
350
|
const alignments = [
|
|
351
|
+
["content-center", { "align-content": "center" }],
|
|
338
352
|
["content-start", { "align-content": "flex-start" }],
|
|
339
353
|
["content-end", { "align-content": "flex-end" }],
|
|
340
|
-
["content-center", { "align-content": "center" }],
|
|
341
354
|
["content-between", { "align-content": "space-between" }],
|
|
342
355
|
["content-around", { "align-content": "space-around" }],
|
|
343
356
|
["content-evenly", { "align-content": "space-evenly" }],
|
|
@@ -350,29 +363,39 @@ const alignments = [
|
|
|
350
363
|
["self-start", { "align-self": "flex-start" }],
|
|
351
364
|
["self-end", { "align-self": "flex-end" }],
|
|
352
365
|
["self-center", { "align-self": "center" }],
|
|
353
|
-
["self-stretch", { "align-self": "stretch" }]
|
|
366
|
+
["self-stretch", { "align-self": "stretch" }],
|
|
367
|
+
["self-baseline", { "align-self": "baseline" }]
|
|
354
368
|
];
|
|
355
369
|
const placements = [
|
|
370
|
+
["place-content-center", { "place-content": "center" }],
|
|
356
371
|
["place-content-start", { "place-content": "start" }],
|
|
357
372
|
["place-content-end", { "place-content": "end" }],
|
|
358
|
-
["place-content-center", { "place-content": "center" }],
|
|
359
373
|
["place-content-between", { "place-content": "space-between" }],
|
|
360
374
|
["place-content-around", { "place-content": "space-around" }],
|
|
361
375
|
["place-content-evenly", { "place-content": "space-evenly" }],
|
|
362
376
|
["place-content-stretch", { "place-content": "stretch" }],
|
|
363
|
-
|
|
364
|
-
|
|
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" }]
|
|
365
386
|
];
|
|
366
387
|
function handleInsetValue(v) {
|
|
367
388
|
return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.auto.rem(v);
|
|
368
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
|
+
}
|
|
369
395
|
const insets = [
|
|
370
|
-
[/^(?:position-|pos-)?
|
|
371
|
-
[/^(?:position-|pos-)?inset-([xy])-(.+)$/,
|
|
372
|
-
|
|
373
|
-
if (r != null && d in utilities.directionMap)
|
|
374
|
-
return utilities.directionMap[d].map((i) => [i.slice(1), r]);
|
|
375
|
-
}]
|
|
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) })]
|
|
376
399
|
];
|
|
377
400
|
const floats = [
|
|
378
401
|
["float-left", { float: "left" }],
|
|
@@ -435,7 +458,7 @@ const contents = [
|
|
|
435
458
|
];
|
|
436
459
|
const breaks = [
|
|
437
460
|
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
438
|
-
["break-
|
|
461
|
+
["break-words", { "overflow-wrap": "break-word" }],
|
|
439
462
|
["break-all", { "word-break": "break-all" }]
|
|
440
463
|
];
|
|
441
464
|
const textOverflows = [
|
|
@@ -467,14 +490,14 @@ const fontSmoothings = [
|
|
|
467
490
|
];
|
|
468
491
|
|
|
469
492
|
const rings = [
|
|
470
|
-
[/^ring
|
|
493
|
+
[/^ring(?:-(.+))?$/, ([, d]) => {
|
|
471
494
|
const value = utilities.handler.px(d || "1");
|
|
472
495
|
if (value) {
|
|
473
496
|
return {
|
|
474
497
|
"--un-ring-inset": varEmpty,
|
|
475
498
|
"--un-ring-offset-width": "0px",
|
|
476
499
|
"--un-ring-offset-color": "#fff",
|
|
477
|
-
"--un-ring-color": "rgba(
|
|
500
|
+
"--un-ring-color": "rgba(147, 197, 253, .5)",
|
|
478
501
|
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
479
502
|
"--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
|
|
480
503
|
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
|
|
@@ -508,7 +531,7 @@ const shadowColorResolver = (body, theme) => {
|
|
|
508
531
|
}
|
|
509
532
|
};
|
|
510
533
|
const boxShadows = [
|
|
511
|
-
[/^shadow
|
|
534
|
+
[/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
|
|
512
535
|
const value = theme.boxShadow?.[d || "DEFAULT"];
|
|
513
536
|
if (value) {
|
|
514
537
|
return {
|
|
@@ -526,27 +549,38 @@ const boxShadows = [
|
|
|
526
549
|
function getPropName(minmax, hw) {
|
|
527
550
|
return `${minmax ? `${minmax}-` : ""}${hw === "h" ? "height" : "width"}`;
|
|
528
551
|
}
|
|
529
|
-
function
|
|
552
|
+
function getSizeValue(minmax, hw, theme, prop) {
|
|
530
553
|
let str = `${hw === "h" ? "height" : "width"}`;
|
|
531
554
|
if (minmax)
|
|
532
555
|
str = `${minmax}${utilities.capitalize(str)}`;
|
|
533
|
-
|
|
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);
|
|
534
566
|
}
|
|
535
567
|
const sizes = [
|
|
536
|
-
[/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
return
|
|
545
|
-
|
|
546
|
-
|
|
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
|
+
}
|
|
547
582
|
const aspectRatio = [
|
|
548
|
-
[
|
|
549
|
-
[/^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) })]
|
|
550
584
|
];
|
|
551
585
|
|
|
552
586
|
const paddings = [
|
|
@@ -582,27 +616,19 @@ const transformBase = {
|
|
|
582
616
|
};
|
|
583
617
|
const transforms = [
|
|
584
618
|
["transform", transformBase],
|
|
585
|
-
[/^
|
|
586
|
-
[/^translate()
|
|
619
|
+
[/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] })],
|
|
620
|
+
[/^translate-()(.+)$/, handleTranslate],
|
|
587
621
|
[/^translate-([xyz])-(.+)$/, handleTranslate],
|
|
588
|
-
[/^scale()-(.+)$/, handleScale],
|
|
589
|
-
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
590
622
|
[/^rotate-(.+)$/, handleRotate],
|
|
591
|
-
[/^
|
|
623
|
+
[/^skew-()(.+)$/, handleSkew],
|
|
592
624
|
[/^skew-([xy])-(.+)$/, handleSkew],
|
|
593
|
-
[/^
|
|
625
|
+
[/^scale-()(.+)$/, handleScale],
|
|
626
|
+
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
627
|
+
["preserve-3d", { "transform-style": "preserve-3d" }],
|
|
628
|
+
["preserve-flat", { "transform-style": "flat" }],
|
|
594
629
|
["transform-gpu", transformGpu],
|
|
595
630
|
["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" }]
|
|
631
|
+
["transform-none", { transform: "none" }]
|
|
606
632
|
];
|
|
607
633
|
function handleTranslate([, d, b]) {
|
|
608
634
|
const v = utilities.handler.bracket.fraction.auto.rem(b);
|
|
@@ -622,17 +648,8 @@ function handleScale([, d, b]) {
|
|
|
622
648
|
];
|
|
623
649
|
}
|
|
624
650
|
}
|
|
625
|
-
function handleRotateWithUnit([, b]) {
|
|
626
|
-
const v = utilities.handler.bracket.number(b);
|
|
627
|
-
if (v != null) {
|
|
628
|
-
return [
|
|
629
|
-
transformBase,
|
|
630
|
-
{ "--un-rotate": `${v}deg` }
|
|
631
|
-
];
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
651
|
function handleRotate([, b]) {
|
|
635
|
-
const v = utilities.handler.bracket(b);
|
|
652
|
+
const v = utilities.handler.bracket.degree(b);
|
|
636
653
|
if (v != null) {
|
|
637
654
|
return [
|
|
638
655
|
transformBase,
|
|
@@ -640,17 +657,8 @@ function handleRotate([, b]) {
|
|
|
640
657
|
];
|
|
641
658
|
}
|
|
642
659
|
}
|
|
643
|
-
function handleSkewWithUnit([, d, b]) {
|
|
644
|
-
const v = utilities.handler.bracket.number(b);
|
|
645
|
-
if (v != null) {
|
|
646
|
-
return [
|
|
647
|
-
transformBase,
|
|
648
|
-
{ [`--un-skew-${d}`]: `${v}deg` }
|
|
649
|
-
];
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
660
|
function handleSkew([, d, b]) {
|
|
653
|
-
const v = utilities.handler.bracket(b);
|
|
661
|
+
const v = utilities.handler.bracket.degree(b);
|
|
654
662
|
if (v != null) {
|
|
655
663
|
return [
|
|
656
664
|
transformBase,
|
|
@@ -703,10 +711,11 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
703
711
|
];
|
|
704
712
|
|
|
705
713
|
const textDecorations = [
|
|
706
|
-
["underline", { "text-decoration": "underline" }],
|
|
707
|
-
["
|
|
708
|
-
["
|
|
709
|
-
["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" }],
|
|
710
719
|
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": utilities.handler.bracket.px(s) })],
|
|
711
720
|
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
|
|
712
721
|
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|