@unocss/preset-mini 0.21.2 → 0.22.3
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 +320 -202
- package/dist/chunks/default2.mjs +320 -205
- package/dist/chunks/default3.cjs +161 -16
- package/dist/chunks/default3.mjs +152 -12
- package/dist/chunks/utilities.cjs +36 -11
- package/dist/chunks/utilities.mjs +36 -11
- 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 +3 -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-29b01158.d.ts +55 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +5 -55
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +5 -7
- package/dist/variants.d.ts +11 -14
- 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/default2.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { h as handler, c as colorResolver, d as directionMap, p as parseColor, a as cornerMap,
|
|
2
|
-
import { toArray } from '@unocss/core';
|
|
3
|
-
import { C as CONTROL_BYPASS_PSEUDO_CLASS } from './pseudo.mjs';
|
|
1
|
+
import { h as handler, c as colorResolver, d as directionMap, p as parseColor, a as cornerMap, i as insetMap, b as directionSize, e as positionMap, x as xyzMap } from './utilities.mjs';
|
|
2
|
+
import { CONTROL_SHORTCUT_NO_MERGE, toArray } from '@unocss/core';
|
|
4
3
|
|
|
5
4
|
const verticalAlignAlias = {
|
|
6
5
|
mid: "middle",
|
|
@@ -18,9 +17,9 @@ const textAligns = [
|
|
|
18
17
|
];
|
|
19
18
|
|
|
20
19
|
const outline = [
|
|
21
|
-
[/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": handler.bracket.
|
|
20
|
+
[/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": handler.bracket.cssvar.auto.fraction.rem(d) })],
|
|
22
21
|
[/^outline-(?:color-)?(.+)$/, colorResolver("outline-color", "outline-color")],
|
|
23
|
-
[/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": handler.bracket.
|
|
22
|
+
[/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": handler.bracket.cssvar.auto.fraction.rem(d) })],
|
|
24
23
|
["outline", { "outline-style": "solid" }],
|
|
25
24
|
[/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
|
|
26
25
|
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
@@ -31,27 +30,42 @@ const appearance = [
|
|
|
31
30
|
"-webkit-appearance": "none"
|
|
32
31
|
}]
|
|
33
32
|
];
|
|
33
|
+
const willChangeProperty = (prop) => {
|
|
34
|
+
return handler.properties.auto.global(prop) ?? {
|
|
35
|
+
contents: "contents",
|
|
36
|
+
scroll: "scroll-position"
|
|
37
|
+
}[prop];
|
|
38
|
+
};
|
|
34
39
|
const willChange = [
|
|
35
|
-
[/^will-change-(.+)/, ([, p]) => ({ "will-change":
|
|
40
|
+
[/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
|
|
36
41
|
];
|
|
37
42
|
|
|
38
43
|
const borders = [
|
|
39
44
|
[/^(?:border|b)()(?:-(.+))?$/, handlerBorder],
|
|
40
45
|
[/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
|
|
41
46
|
[/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
|
|
42
|
-
[/^(?:border|b)-()
|
|
43
|
-
[/^(?:border|b)-([
|
|
44
|
-
[/^(?:border|b)-(
|
|
47
|
+
[/^(?:border|b)-(block|inline)(?:-(.+))?$/, handlerBorder],
|
|
48
|
+
[/^(?:border|b)-([bi][se])(?:-(.+))?$/, handlerBorder],
|
|
49
|
+
[/^(?:border|b)-()(?:width|size)-(.+)$/, handlerBorderSize],
|
|
50
|
+
[/^(?:border|b)-([xy])-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
51
|
+
[/^(?:border|b)-([rltbse])-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
52
|
+
[/^(?:border|b)-(block|inline)-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
53
|
+
[/^(?:border|b)-([bi][se])-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
45
54
|
[/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor],
|
|
46
55
|
[/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
47
56
|
[/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
57
|
+
[/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/, handlerBorderColor],
|
|
58
|
+
[/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
48
59
|
[/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
49
60
|
[/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
50
61
|
[/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
62
|
+
[/^(?:border|b)-(block|inline)-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
63
|
+
[/^(?:border|b)-([bi][se])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
51
64
|
[/^(?:border-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded],
|
|
52
|
-
[/^(?:border-)?(?:rounded|rd)-([xy])(?:-(.+))?$/, handlerRounded],
|
|
53
65
|
[/^(?:border-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
|
|
54
66
|
[/^(?:border-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
|
|
67
|
+
[/^(?:border-)?(?:rounded|rd)-([bi][se])(?:-(.+))?$/, handlerRounded],
|
|
68
|
+
[/^(?:border-)?(?:rounded|rd)-([bi][se]-[bi][se])(?:-(.+))?$/, handlerRounded],
|
|
55
69
|
["border-solid", { "border-style": "solid" }],
|
|
56
70
|
["border-dashed", { "border-style": "dashed" }],
|
|
57
71
|
["border-dotted", { "border-style": "dotted" }],
|
|
@@ -104,7 +118,7 @@ function handlerBorder(m) {
|
|
|
104
118
|
}
|
|
105
119
|
}
|
|
106
120
|
function handlerBorderSize([, a = "", b = "1"]) {
|
|
107
|
-
const v = handler.bracket.px(b);
|
|
121
|
+
const v = handler.bracket.cssvar.px(b);
|
|
108
122
|
if (a in directionMap && v != null)
|
|
109
123
|
return directionMap[a].map((i) => [`border${i}-width`, v]);
|
|
110
124
|
}
|
|
@@ -119,7 +133,7 @@ function handlerBorderOpacity([, a = "", opacity]) {
|
|
|
119
133
|
return directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
|
|
120
134
|
}
|
|
121
135
|
function handlerRounded([, a = "", s = "DEFAULT"], { theme }) {
|
|
122
|
-
const v = theme.borderRadius?.[s] || handler.auto.
|
|
136
|
+
const v = theme.borderRadius?.[s] || handler.bracket.cssvar.auto.fraction.rem(s);
|
|
123
137
|
if (a in cornerMap && v != null)
|
|
124
138
|
return cornerMap[a].map((i) => [`border${i}-radius`, v]);
|
|
125
139
|
}
|
|
@@ -129,7 +143,7 @@ const opacity = [
|
|
|
129
143
|
];
|
|
130
144
|
const textColors = [
|
|
131
145
|
[/^(?:text|color|c)-(.+)$/, colorResolver("color", "text")],
|
|
132
|
-
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent
|
|
146
|
+
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent(opacity2) })]
|
|
133
147
|
];
|
|
134
148
|
const bgColors = [
|
|
135
149
|
[/^bg-(.+)$/, colorResolver("background-color", "bg")],
|
|
@@ -157,9 +171,9 @@ const transitions = [
|
|
|
157
171
|
};
|
|
158
172
|
}
|
|
159
173
|
}],
|
|
160
|
-
[/^(?:transition-)?
|
|
161
|
-
[/^(?:transition-)?
|
|
162
|
-
[/^ease-(.+)$/, ([, d]) => ({ "transition-timing-function": handler.bracket(d) })],
|
|
174
|
+
[/^(?:transition-)?duration-(.+)$/, ([, d]) => ({ "transition-duration": handler.bracket.cssvar.time(d) })],
|
|
175
|
+
[/^(?:transition-)?delay-(.+)$/, ([, d]) => ({ "transition-delay": handler.bracket.cssvar.time(d) })],
|
|
176
|
+
[/^ease-(.+)$/, ([, d]) => ({ "transition-timing-function": handler.bracket.cssvar(d) })],
|
|
163
177
|
["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
164
178
|
["ease-linear", { "transition-timing-function": "linear" }],
|
|
165
179
|
["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
|
|
@@ -184,7 +198,7 @@ const flex = [
|
|
|
184
198
|
[/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
|
|
185
199
|
[/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
|
|
186
200
|
[/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
|
|
187
|
-
[/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": handler.bracket.
|
|
201
|
+
[/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": handler.bracket.cssvar.auto.fraction.rem(d) })],
|
|
188
202
|
["flex-row", { "flex-direction": "row" }],
|
|
189
203
|
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
190
204
|
["flex-col", { "flex-direction": "column" }],
|
|
@@ -194,6 +208,117 @@ const flex = [
|
|
|
194
208
|
["flex-nowrap", { "flex-wrap": "nowrap" }]
|
|
195
209
|
];
|
|
196
210
|
|
|
211
|
+
const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
|
|
212
|
+
const displays = [
|
|
213
|
+
["inline", { display: "inline" }],
|
|
214
|
+
["block", { display: "block" }],
|
|
215
|
+
["inline-block", { display: "inline-block" }],
|
|
216
|
+
["contents", { display: "contents" }],
|
|
217
|
+
["flow-root", { display: "flow-root" }],
|
|
218
|
+
["list-item", { display: "list-item" }],
|
|
219
|
+
["hidden", { display: "none" }]
|
|
220
|
+
];
|
|
221
|
+
const appearances = [
|
|
222
|
+
["visible", { visibility: "visible" }],
|
|
223
|
+
["invisible", { visibility: "hidden" }],
|
|
224
|
+
["backface-visible", { "backface-visibility": "visible" }],
|
|
225
|
+
["backface-hidden", { "backface-visibility": "hidden" }]
|
|
226
|
+
];
|
|
227
|
+
const cursors = [
|
|
228
|
+
[/^cursor-(.+)$/, ([, c]) => ({ cursor: handler.bracket.cssvar(c) || c })]
|
|
229
|
+
];
|
|
230
|
+
const pointerEvents = [
|
|
231
|
+
["pointer-events-auto", { "pointer-events": "auto" }],
|
|
232
|
+
["pointer-events-none", { "pointer-events": "none" }]
|
|
233
|
+
];
|
|
234
|
+
const resizes = [
|
|
235
|
+
["resize-x", { resize: "horizontal" }],
|
|
236
|
+
["resize-y", { resize: "vertical" }],
|
|
237
|
+
["resize", { resize: "both" }],
|
|
238
|
+
["resize-none", { resize: "none" }]
|
|
239
|
+
];
|
|
240
|
+
const userSelects = [
|
|
241
|
+
["select-auto", { "user-select": "auto" }],
|
|
242
|
+
["select-all", { "user-select": "all" }],
|
|
243
|
+
["select-text", { "user-select": "text" }],
|
|
244
|
+
["select-none", { "user-select": "none" }]
|
|
245
|
+
];
|
|
246
|
+
const whitespaces = [
|
|
247
|
+
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
248
|
+
];
|
|
249
|
+
const contents = [
|
|
250
|
+
["content-empty", { content: '""' }],
|
|
251
|
+
["content-none", { content: '""' }]
|
|
252
|
+
];
|
|
253
|
+
const breaks = [
|
|
254
|
+
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
255
|
+
["break-words", { "overflow-wrap": "break-word" }],
|
|
256
|
+
["break-all", { "word-break": "break-all" }]
|
|
257
|
+
];
|
|
258
|
+
const textOverflows = [
|
|
259
|
+
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
260
|
+
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
261
|
+
["text-clip", { "text-overflow": "clip" }]
|
|
262
|
+
];
|
|
263
|
+
const textTransforms = [
|
|
264
|
+
["case-upper", { "text-transform": "uppercase" }],
|
|
265
|
+
["case-lower", { "text-transform": "lowercase" }],
|
|
266
|
+
["case-capital", { "text-transform": "capitalize" }],
|
|
267
|
+
["case-normal", { "text-transform": "none" }]
|
|
268
|
+
];
|
|
269
|
+
const fontStyles = [
|
|
270
|
+
["italic", { "font-style": "italic" }],
|
|
271
|
+
["not-italic", { "font-style": "normal" }]
|
|
272
|
+
];
|
|
273
|
+
const fontSmoothings = [
|
|
274
|
+
["antialiased", {
|
|
275
|
+
"-webkit-font-smoothing": "antialiased",
|
|
276
|
+
"-moz-osx-font-smoothing": "grayscale",
|
|
277
|
+
"font-smoothing": "grayscale"
|
|
278
|
+
}],
|
|
279
|
+
["subpixel-antialiased", {
|
|
280
|
+
"-webkit-font-smoothing": "auto",
|
|
281
|
+
"-moz-osx-font-smoothing": "auto",
|
|
282
|
+
"font-smoothing": "auto"
|
|
283
|
+
}]
|
|
284
|
+
];
|
|
285
|
+
|
|
286
|
+
const shadowBase = {
|
|
287
|
+
[CONTROL_SHORTCUT_NO_MERGE]: "",
|
|
288
|
+
"--un-ring-offset-shadow": "0 0 #0000",
|
|
289
|
+
"--un-ring-shadow": "0 0 #0000",
|
|
290
|
+
"--un-shadow-inset": varEmpty,
|
|
291
|
+
"--un-shadow": "0 0 #0000"
|
|
292
|
+
};
|
|
293
|
+
const colorableShadows = (shadows, colorVar) => {
|
|
294
|
+
const colored = [];
|
|
295
|
+
shadows = toArray(shadows);
|
|
296
|
+
for (let i = 0; i < shadows.length; i++) {
|
|
297
|
+
const [size, color] = shadows[i].split(/\s(\S+)$/);
|
|
298
|
+
if (color.split("(").length !== color.split(")").length)
|
|
299
|
+
return shadows;
|
|
300
|
+
colored.push(`${size} var(${colorVar}, ${color})`);
|
|
301
|
+
}
|
|
302
|
+
return colored;
|
|
303
|
+
};
|
|
304
|
+
const boxShadows = [
|
|
305
|
+
[/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
|
|
306
|
+
const v = theme.boxShadow?.[d || "DEFAULT"];
|
|
307
|
+
if (v) {
|
|
308
|
+
return [
|
|
309
|
+
shadowBase,
|
|
310
|
+
{
|
|
311
|
+
"--un-shadow": colorableShadows(v, "--un-shadow-color").join(","),
|
|
312
|
+
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
313
|
+
}
|
|
314
|
+
];
|
|
315
|
+
}
|
|
316
|
+
}],
|
|
317
|
+
[/^shadow-(.+)$/, colorResolver("--un-shadow-color", "shadow")],
|
|
318
|
+
[/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": handler.bracket.percent(opacity) })],
|
|
319
|
+
["shadow-inset", { "--un-shadow-inset": "inset" }]
|
|
320
|
+
];
|
|
321
|
+
|
|
197
322
|
const weightMap = {
|
|
198
323
|
thin: "100",
|
|
199
324
|
extralight: "200",
|
|
@@ -208,27 +333,25 @@ const weightMap = {
|
|
|
208
333
|
const fonts = [
|
|
209
334
|
[/^font-(\w+)$/, ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] })],
|
|
210
335
|
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
211
|
-
const size = handler.bracket.auto.rem(s);
|
|
212
|
-
if (size)
|
|
213
|
-
return { "font-size": size };
|
|
214
336
|
const themed = toArray(theme.fontSize?.[s]);
|
|
215
337
|
if (themed?.[0]) {
|
|
216
|
-
const [
|
|
338
|
+
const [size, height = "1"] = themed;
|
|
217
339
|
return {
|
|
218
|
-
"font-size":
|
|
340
|
+
"font-size": size,
|
|
219
341
|
"line-height": height
|
|
220
342
|
};
|
|
221
343
|
}
|
|
344
|
+
return { "font-size": handler.bracket.auto.rem(s) };
|
|
222
345
|
}],
|
|
223
|
-
[/^text-size-(.+)$/, ([, s]) => ({ "font-size": handler.bracket.auto.rem(s) })],
|
|
346
|
+
[/^text-size-(.+)$/, ([, s]) => ({ "font-size": handler.bracket.cssvar.auto.rem(s) })],
|
|
224
347
|
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || handler.number(s) })],
|
|
225
348
|
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || handler.bracket.auto.rem(s) })],
|
|
226
349
|
[/^tracking-([^-]+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || handler.bracket.auto.rem(s) })],
|
|
227
350
|
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || handler.bracket.auto.rem(s) })]
|
|
228
351
|
];
|
|
229
352
|
const tabSizes = [
|
|
230
|
-
[/^tab(?:-(
|
|
231
|
-
const v = handler.bracket.global.number(s || "4");
|
|
353
|
+
[/^tab(?:-(.+))?$/, ([, s]) => {
|
|
354
|
+
const v = handler.bracket.cssvar.global.number(s || "4");
|
|
232
355
|
if (v != null) {
|
|
233
356
|
return {
|
|
234
357
|
"-moz-tab-size": v,
|
|
@@ -239,7 +362,7 @@ const tabSizes = [
|
|
|
239
362
|
}]
|
|
240
363
|
];
|
|
241
364
|
const textIndents = [
|
|
242
|
-
[/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.
|
|
365
|
+
[/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.auto.fraction.rem(s) })]
|
|
243
366
|
];
|
|
244
367
|
const textStrokes = [
|
|
245
368
|
[/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || handler.bracket.cssvar.px(s) })],
|
|
@@ -247,7 +370,18 @@ const textStrokes = [
|
|
|
247
370
|
[/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity) })]
|
|
248
371
|
];
|
|
249
372
|
const textShadows = [
|
|
250
|
-
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) =>
|
|
373
|
+
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
|
|
374
|
+
const v = theme.textShadow?.[s || "DEFAULT"];
|
|
375
|
+
if (v != null) {
|
|
376
|
+
return {
|
|
377
|
+
"--un-text-shadow": colorableShadows(v, "--un-text-shadow-color").join(","),
|
|
378
|
+
"text-shadow": "var(--un-text-shadow)"
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
return { "text-shadow": handler.bracket.cssvar(s) };
|
|
382
|
+
}],
|
|
383
|
+
[/^text-shadow-color-(.+)$/, colorResolver("--un-text-shadow-color", "text-shadow")],
|
|
384
|
+
[/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": handler.bracket.percent(opacity) })]
|
|
251
385
|
];
|
|
252
386
|
|
|
253
387
|
const directions = {
|
|
@@ -256,7 +390,7 @@ const directions = {
|
|
|
256
390
|
"y": "row-"
|
|
257
391
|
};
|
|
258
392
|
const handleGap = ([, d = "", s]) => {
|
|
259
|
-
const v = handler.bracket.auto.rem(s);
|
|
393
|
+
const v = handler.bracket.cssvar.auto.rem(s);
|
|
260
394
|
if (v != null) {
|
|
261
395
|
return {
|
|
262
396
|
[`grid-${directions[d]}gap`]: v,
|
|
@@ -282,12 +416,12 @@ const autoDirection = (selector, theme) => {
|
|
|
282
416
|
case "fr":
|
|
283
417
|
return "minmax(0,1fr)";
|
|
284
418
|
}
|
|
285
|
-
return handler.bracket.auto.rem(selector);
|
|
419
|
+
return handler.bracket.cssvar.auto.rem(selector);
|
|
286
420
|
};
|
|
287
421
|
const grids = [
|
|
288
422
|
["grid", { display: "grid" }],
|
|
289
423
|
["inline-grid", { display: "inline-grid" }],
|
|
290
|
-
[/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: handler.bracket.auto(v) })],
|
|
424
|
+
[/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: handler.bracket.cssvar.auto(v) })],
|
|
291
425
|
[/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
|
|
292
426
|
if (s === "full")
|
|
293
427
|
return { [`grid-${rowCol(c)}`]: "1/-1" };
|
|
@@ -295,11 +429,12 @@ const grids = [
|
|
|
295
429
|
if (v != null)
|
|
296
430
|
return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
|
|
297
431
|
}],
|
|
298
|
-
[/^(?:grid-)?(row|col)-start-(
|
|
299
|
-
[/^(?:grid-)?(row|col)-end-(
|
|
300
|
-
[/^(?:grid-)?auto-(rows|cols)-(
|
|
432
|
+
[/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: handler.bracket.cssvar(v) ?? v })],
|
|
433
|
+
[/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: handler.bracket.cssvar(v) ?? v })],
|
|
434
|
+
[/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) })],
|
|
435
|
+
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": handler.bracket.cssvar(v) })],
|
|
301
436
|
[/^(?:grid-auto-flow|auto-flow|grid-flow)-((?:row|col)(?:-dense)?)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
|
|
302
|
-
[/^grid-(rows|cols)-(
|
|
437
|
+
[/^grid-(rows|cols)-(.+)$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: handler.bracket.cssvar(v) })],
|
|
303
438
|
[/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
304
439
|
[/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
|
|
305
440
|
["grid-rows-none", { "grid-template-rows": "none" }],
|
|
@@ -340,7 +475,7 @@ const justifies = [
|
|
|
340
475
|
["justify-self-stretch", { "justify-self": "stretch" }]
|
|
341
476
|
];
|
|
342
477
|
const orders = [
|
|
343
|
-
[/^order-(.+)$/, ([, v]) => ({ order: handler.bracket.number(v) })],
|
|
478
|
+
[/^order-(.+)$/, ([, v]) => ({ order: handler.bracket.cssvar.number(v) })],
|
|
344
479
|
["order-first", { order: "-9999" }],
|
|
345
480
|
["order-last", { order: "9999" }],
|
|
346
481
|
["order-none", { order: "0" }]
|
|
@@ -383,16 +518,19 @@ const placements = [
|
|
|
383
518
|
["place-self-stretch", { "place-self": "stretch" }]
|
|
384
519
|
];
|
|
385
520
|
function handleInsetValue(v) {
|
|
386
|
-
return
|
|
521
|
+
return handler.bracket.cssvar.auto.fraction.rem(v);
|
|
387
522
|
}
|
|
388
523
|
function handleInsetValues([, d, v]) {
|
|
389
524
|
const r = handleInsetValue(v);
|
|
390
|
-
if (r != null && d in
|
|
391
|
-
return
|
|
525
|
+
if (r != null && d in insetMap)
|
|
526
|
+
return insetMap[d].map((i) => [i.slice(1), r]);
|
|
392
527
|
}
|
|
393
528
|
const insets = [
|
|
394
529
|
[/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
|
|
395
530
|
[/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
|
|
531
|
+
[/^(?:position-|pos-)?inset-([rltbse])-(.+)$/, handleInsetValues],
|
|
532
|
+
[/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
|
|
533
|
+
[/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
|
|
396
534
|
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
|
|
397
535
|
];
|
|
398
536
|
const floats = [
|
|
@@ -405,105 +543,37 @@ const floats = [
|
|
|
405
543
|
["clear-none", { clear: "none" }]
|
|
406
544
|
];
|
|
407
545
|
const zIndexes = [
|
|
408
|
-
[
|
|
409
|
-
[
|
|
546
|
+
[/^z-(.+)$/, ([, v]) => ({ "z-index": handler.bracket.cssvar.number(v) })],
|
|
547
|
+
["z-auto", { "z-index": "auto" }]
|
|
410
548
|
];
|
|
411
549
|
const boxSizing = [
|
|
412
550
|
["box-border", { "box-sizing": "border-box" }],
|
|
413
551
|
["box-content", { "box-sizing": "content-box" }]
|
|
414
552
|
];
|
|
415
553
|
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
["list-item", { display: "list-item" }],
|
|
424
|
-
["hidden", { display: "none" }]
|
|
425
|
-
];
|
|
426
|
-
const appearances = [
|
|
427
|
-
["visible", { visibility: "visible" }],
|
|
428
|
-
["invisible", { visibility: "hidden" }],
|
|
429
|
-
["backface-visible", { "backface-visibility": "visible" }],
|
|
430
|
-
["backface-hidden", { "backface-visibility": "hidden" }]
|
|
431
|
-
];
|
|
432
|
-
const cursors = [
|
|
433
|
-
[/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
|
|
434
|
-
];
|
|
435
|
-
const pointerEvents = [
|
|
436
|
-
["pointer-events-auto", { "pointer-events": "auto" }],
|
|
437
|
-
["pointer-events-none", { "pointer-events": "none" }]
|
|
438
|
-
];
|
|
439
|
-
const resizes = [
|
|
440
|
-
["resize-x", { resize: "horizontal" }],
|
|
441
|
-
["resize-y", { resize: "vertical" }],
|
|
442
|
-
["resize", { resize: "both" }],
|
|
443
|
-
["resize-none", { resize: "none" }]
|
|
444
|
-
];
|
|
445
|
-
const userSelects = [
|
|
446
|
-
["select-auto", { "user-select": "auto" }],
|
|
447
|
-
["select-all", { "user-select": "all" }],
|
|
448
|
-
["select-text", { "user-select": "text" }],
|
|
449
|
-
["select-none", { "user-select": "none" }]
|
|
450
|
-
];
|
|
451
|
-
const whitespaces = [
|
|
452
|
-
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
453
|
-
];
|
|
454
|
-
const contents = [
|
|
455
|
-
["content-empty", { content: '""' }]
|
|
456
|
-
];
|
|
457
|
-
const breaks = [
|
|
458
|
-
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
459
|
-
["break-words", { "overflow-wrap": "break-word" }],
|
|
460
|
-
["break-all", { "word-break": "break-all" }]
|
|
461
|
-
];
|
|
462
|
-
const textOverflows = [
|
|
463
|
-
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
464
|
-
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
465
|
-
["text-clip", { "text-overflow": "clip" }]
|
|
466
|
-
];
|
|
467
|
-
const textTransforms = [
|
|
468
|
-
["case-upper", { "text-transform": "uppercase" }],
|
|
469
|
-
["case-lower", { "text-transform": "lowercase" }],
|
|
470
|
-
["case-capital", { "text-transform": "capitalize" }],
|
|
471
|
-
["case-normal", { "text-transform": "none" }]
|
|
472
|
-
];
|
|
473
|
-
const fontStyles = [
|
|
474
|
-
["italic", { "font-style": "italic" }],
|
|
475
|
-
["not-italic", { "font-style": "normal" }]
|
|
476
|
-
];
|
|
477
|
-
const fontSmoothings = [
|
|
478
|
-
["antialiased", {
|
|
479
|
-
"-webkit-font-smoothing": "antialiased",
|
|
480
|
-
"-moz-osx-font-smoothing": "grayscale",
|
|
481
|
-
"font-smoothing": "grayscale"
|
|
482
|
-
}],
|
|
483
|
-
["subpixel-antialiased", {
|
|
484
|
-
"-webkit-font-smoothing": "auto",
|
|
485
|
-
"-moz-osx-font-smoothing": "auto",
|
|
486
|
-
"font-smoothing": "auto"
|
|
487
|
-
}]
|
|
488
|
-
];
|
|
489
|
-
|
|
554
|
+
const ringBase = {
|
|
555
|
+
"--un-ring-inset": varEmpty,
|
|
556
|
+
"--un-ring-offset-width": "0px",
|
|
557
|
+
"--un-ring-offset-color": "#fff",
|
|
558
|
+
"--un-ring-color": "rgba(147,197,253,0.5)",
|
|
559
|
+
...shadowBase
|
|
560
|
+
};
|
|
490
561
|
const rings = [
|
|
491
562
|
[/^ring(?:-(.+))?$/, ([, d]) => {
|
|
492
563
|
const value = handler.px(d || "1");
|
|
493
564
|
if (value) {
|
|
494
|
-
return
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
};
|
|
565
|
+
return [
|
|
566
|
+
ringBase,
|
|
567
|
+
{
|
|
568
|
+
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
569
|
+
"--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
|
|
570
|
+
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
|
|
571
|
+
}
|
|
572
|
+
];
|
|
503
573
|
}
|
|
504
574
|
}],
|
|
505
575
|
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
506
|
-
[/^ring-offset-(.+)$/, ([, d]) => ({ "--un-ring-offset-width": handler.px(d
|
|
576
|
+
[/^ring-offset-(?:width-|size-)?(.+)$/, ([, d]) => ({ "--un-ring-offset-width": handler.bracket.cssvar.px(d) })],
|
|
507
577
|
[/^ring-(.+)$/, colorResolver("--un-ring-color", "ring")],
|
|
508
578
|
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity) })],
|
|
509
579
|
[/^ring-offset-(.+)$/, colorResolver("--un-ring-offset-color", "ring-offset")],
|
|
@@ -511,46 +581,17 @@ const rings = [
|
|
|
511
581
|
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
512
582
|
];
|
|
513
583
|
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
if (!color)
|
|
520
|
-
return;
|
|
521
|
-
if (rgba) {
|
|
522
|
-
return {
|
|
523
|
-
"--un-shadow-color": `${rgba.slice(0, 3).join(",")}`
|
|
524
|
-
};
|
|
525
|
-
} else {
|
|
526
|
-
return {
|
|
527
|
-
"--un-shadow-color": color
|
|
528
|
-
};
|
|
529
|
-
}
|
|
584
|
+
const sizeMapping = {
|
|
585
|
+
h: "height",
|
|
586
|
+
w: "width",
|
|
587
|
+
inline: "inline-size",
|
|
588
|
+
block: "block-size"
|
|
530
589
|
};
|
|
531
|
-
const boxShadows = [
|
|
532
|
-
[/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
|
|
533
|
-
const value = theme.boxShadow?.[d || "DEFAULT"];
|
|
534
|
-
if (value) {
|
|
535
|
-
return {
|
|
536
|
-
"--un-shadow-inset": varEmpty,
|
|
537
|
-
"--un-shadow-color": "0,0,0",
|
|
538
|
-
"--un-shadow": value,
|
|
539
|
-
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
540
|
-
};
|
|
541
|
-
}
|
|
542
|
-
}],
|
|
543
|
-
[/^shadow-(.+)$/, ([, d], { theme }) => shadowColorResolver(d, theme)],
|
|
544
|
-
["shadow-inset", { "--un-shadow-inset": "inset" }]
|
|
545
|
-
];
|
|
546
|
-
|
|
547
590
|
function getPropName(minmax, hw) {
|
|
548
|
-
return `${minmax
|
|
591
|
+
return `${minmax || ""}${sizeMapping[hw]}`;
|
|
549
592
|
}
|
|
550
593
|
function getSizeValue(minmax, hw, theme, prop) {
|
|
551
|
-
|
|
552
|
-
if (minmax)
|
|
553
|
-
str = `${minmax}${capitalize(str)}`;
|
|
594
|
+
const str = getPropName(minmax, hw).replace(/-(\w)/g, (_, p) => p.toUpperCase());
|
|
554
595
|
const v = theme[str]?.[prop];
|
|
555
596
|
if (v != null)
|
|
556
597
|
return v;
|
|
@@ -560,11 +601,12 @@ function getSizeValue(minmax, hw, theme, prop) {
|
|
|
560
601
|
case "min":
|
|
561
602
|
return `${prop}-content`;
|
|
562
603
|
}
|
|
563
|
-
return handler.bracket.cssvar.fraction.
|
|
604
|
+
return handler.bracket.cssvar.auto.fraction.rem(prop);
|
|
564
605
|
}
|
|
565
606
|
const sizes = [
|
|
566
|
-
[/^(
|
|
567
|
-
[/^(
|
|
607
|
+
[/^(min-|max-)?([wh])-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
|
|
608
|
+
[/^(min-|max-)?(block|inline)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
|
|
609
|
+
[/^(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
|
|
568
610
|
];
|
|
569
611
|
function getAspectRatio(prop) {
|
|
570
612
|
if (/^\d+\/\d+$/.test(prop))
|
|
@@ -584,24 +626,53 @@ const aspectRatio = [
|
|
|
584
626
|
const paddings = [
|
|
585
627
|
[/^pa?()-?(-?.+)$/, directionSize("padding")],
|
|
586
628
|
[/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
|
|
587
|
-
[/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")]
|
|
629
|
+
[/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")],
|
|
630
|
+
[/^p-(block|inline)-(-?.+)$/, directionSize("padding")],
|
|
631
|
+
[/^p-?([bi][se])-?(-?.+)$/, directionSize("padding")]
|
|
588
632
|
];
|
|
589
633
|
const margins = [
|
|
590
634
|
[/^ma?()-?(-?.+)$/, directionSize("margin")],
|
|
591
635
|
[/^m-?([xy])-?(-?.+)$/, directionSize("margin")],
|
|
592
|
-
[/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")]
|
|
636
|
+
[/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")],
|
|
637
|
+
[/^m-(block|inline)-(-?.+)$/, directionSize("margin")],
|
|
638
|
+
[/^m-?([bi][se])-?(-?.+)$/, directionSize("margin")]
|
|
593
639
|
];
|
|
594
640
|
|
|
595
641
|
const transformGpu = {
|
|
596
|
-
|
|
597
|
-
|
|
642
|
+
"--un-transform": [
|
|
643
|
+
"translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
|
|
644
|
+
"rotate(var(--un-rotate))",
|
|
645
|
+
"rotateX(var(--un-rotate-x))",
|
|
646
|
+
"rotateY(var(--un-rotate-y))",
|
|
647
|
+
"rotateZ(var(--un-rotate-z))",
|
|
648
|
+
"skewX(var(--un-skew-x))",
|
|
649
|
+
"skewY(var(--un-skew-y))",
|
|
650
|
+
"scaleX(var(--un-scale-x))",
|
|
651
|
+
"scaleY(var(--un-scale-y))",
|
|
652
|
+
"scaleZ(var(--un-scale-z))"
|
|
653
|
+
].join(" ")
|
|
598
654
|
};
|
|
599
655
|
const transformCpu = {
|
|
600
|
-
|
|
601
|
-
|
|
656
|
+
"--un-transform": [
|
|
657
|
+
"translateX(var(--un-translate-x))",
|
|
658
|
+
"translateY(var(--un-translate-y))",
|
|
659
|
+
"translateZ(var(--un-translate-z))",
|
|
660
|
+
"rotate(var(--un-rotate))",
|
|
661
|
+
"rotateX(var(--un-rotate-x))",
|
|
662
|
+
"rotateY(var(--un-rotate-y))",
|
|
663
|
+
"rotateZ(var(--un-rotate-z))",
|
|
664
|
+
"skewX(var(--un-skew-x))",
|
|
665
|
+
"skewY(var(--un-skew-y))",
|
|
666
|
+
"scaleX(var(--un-scale-x))",
|
|
667
|
+
"scaleY(var(--un-scale-y))",
|
|
668
|
+
"scaleZ(var(--un-scale-z))"
|
|
669
|
+
].join(" ")
|
|
602
670
|
};
|
|
603
671
|
const transformBase = {
|
|
604
672
|
"--un-rotate": 0,
|
|
673
|
+
"--un-rotate-x": 0,
|
|
674
|
+
"--un-rotate-y": 0,
|
|
675
|
+
"--un-rotate-z": 0,
|
|
605
676
|
"--un-scale-x": 1,
|
|
606
677
|
"--un-scale-y": 1,
|
|
607
678
|
"--un-scale-z": 1,
|
|
@@ -610,92 +681,125 @@ const transformBase = {
|
|
|
610
681
|
"--un-translate-x": 0,
|
|
611
682
|
"--un-translate-y": 0,
|
|
612
683
|
"--un-translate-z": 0,
|
|
613
|
-
...transformCpu
|
|
684
|
+
...transformCpu,
|
|
685
|
+
[CONTROL_SHORTCUT_NO_MERGE]: ""
|
|
614
686
|
};
|
|
615
687
|
const transforms = [
|
|
616
|
-
["transform"
|
|
617
|
-
[/^
|
|
688
|
+
[/^origin-(.+)$/, ([, s]) => ({ "transform-origin": positionMap[s] ?? handler.bracket.cssvar(s) })],
|
|
689
|
+
[/^perspect-(.+)$/, ([, s]) => {
|
|
690
|
+
const v = handler.bracket.cssvar.px.numberWithUnit(s);
|
|
691
|
+
if (v != null) {
|
|
692
|
+
return {
|
|
693
|
+
"-webkit-perspective": v,
|
|
694
|
+
"perspective": v
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
}],
|
|
698
|
+
[/^perspect-origin-(.+)$/, ([, s]) => {
|
|
699
|
+
const v = handler.bracket.cssvar(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
|
|
700
|
+
if (v != null) {
|
|
701
|
+
return {
|
|
702
|
+
"-webkit-perspective-origin": v,
|
|
703
|
+
"perspective-origin": v
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
}],
|
|
618
707
|
[/^translate-()(.+)$/, handleTranslate],
|
|
619
708
|
[/^translate-([xyz])-(.+)$/, handleTranslate],
|
|
620
|
-
[/^rotate-(.+)$/, handleRotate],
|
|
621
|
-
[/^
|
|
709
|
+
[/^rotate-()(.+)$/, handleRotate],
|
|
710
|
+
[/^rotate(-[xyz])-(.+)$/, handleRotate],
|
|
622
711
|
[/^skew-([xy])-(.+)$/, handleSkew],
|
|
623
712
|
[/^scale-()(.+)$/, handleScale],
|
|
624
713
|
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
625
714
|
["preserve-3d", { "transform-style": "preserve-3d" }],
|
|
626
715
|
["preserve-flat", { "transform-style": "flat" }],
|
|
716
|
+
[/^transform$/, () => [
|
|
717
|
+
transformBase,
|
|
718
|
+
{ transform: "var(--un-transform)" }
|
|
719
|
+
]],
|
|
627
720
|
["transform-gpu", transformGpu],
|
|
628
721
|
["transform-cpu", transformCpu],
|
|
629
722
|
["transform-none", { transform: "none" }]
|
|
630
723
|
];
|
|
631
724
|
function handleTranslate([, d, b]) {
|
|
632
|
-
const v = handler.bracket.fraction.
|
|
725
|
+
const v = handler.bracket.cssvar.fraction.rem(b);
|
|
633
726
|
if (v != null) {
|
|
634
727
|
return [
|
|
635
728
|
transformBase,
|
|
636
|
-
|
|
729
|
+
[
|
|
730
|
+
...xyzMap[d].map((i) => [`--un-translate${i}`, v]),
|
|
731
|
+
["transform", "var(--un-transform)"]
|
|
732
|
+
]
|
|
637
733
|
];
|
|
638
734
|
}
|
|
639
735
|
}
|
|
640
736
|
function handleScale([, d, b]) {
|
|
641
|
-
const v = handler.bracket.fraction.percent(b);
|
|
737
|
+
const v = handler.bracket.cssvar.fraction.percent(b);
|
|
642
738
|
if (v != null) {
|
|
643
739
|
return [
|
|
644
740
|
transformBase,
|
|
645
|
-
|
|
741
|
+
[
|
|
742
|
+
...xyzMap[d].map((i) => [`--un-scale${i}`, v]),
|
|
743
|
+
["transform", "var(--un-transform)"]
|
|
744
|
+
]
|
|
646
745
|
];
|
|
647
746
|
}
|
|
648
747
|
}
|
|
649
|
-
function handleRotate([, b]) {
|
|
650
|
-
const v = handler.bracket.degree(b);
|
|
748
|
+
function handleRotate([, d, b]) {
|
|
749
|
+
const v = handler.bracket.cssvar.degree(b);
|
|
651
750
|
if (v != null) {
|
|
652
751
|
return [
|
|
653
752
|
transformBase,
|
|
654
|
-
{
|
|
753
|
+
{
|
|
754
|
+
[`--un-rotate${d || ""}`]: v,
|
|
755
|
+
transform: "var(--un-transform)"
|
|
756
|
+
}
|
|
655
757
|
];
|
|
656
758
|
}
|
|
657
759
|
}
|
|
658
760
|
function handleSkew([, d, b]) {
|
|
659
|
-
const v = handler.bracket.degree(b);
|
|
761
|
+
const v = handler.bracket.cssvar.degree(b);
|
|
660
762
|
if (v != null) {
|
|
661
763
|
return [
|
|
662
764
|
transformBase,
|
|
663
|
-
{
|
|
765
|
+
{
|
|
766
|
+
[`--un-skew-${d}`]: v,
|
|
767
|
+
transform: "var(--un-transform)"
|
|
768
|
+
}
|
|
664
769
|
];
|
|
665
770
|
}
|
|
666
771
|
}
|
|
667
772
|
|
|
668
773
|
const variablesAbbrMap = {
|
|
669
|
-
"visible": "visibility",
|
|
670
|
-
"select": "user-select",
|
|
671
|
-
"vertical": "vertical-align",
|
|
672
774
|
"backface": "backface-visibility",
|
|
673
|
-
"whitespace": "white-space",
|
|
674
775
|
"break": "word-break",
|
|
675
776
|
"case": "text-transform",
|
|
676
|
-
"origin": "transform-origin",
|
|
677
|
-
"bg-opacity": "background-opacity",
|
|
678
|
-
"tab": "tab-size",
|
|
679
|
-
"underline": "text-decoration-thickness",
|
|
680
|
-
"underline-offset": "text-underline-offset",
|
|
681
|
-
"grid-cols": "grid-template-columns",
|
|
682
|
-
"grid-rows": "grid-template-rows",
|
|
683
|
-
"auto-flow": "grid-auto-flow",
|
|
684
|
-
"row-start": "grid-row-start",
|
|
685
|
-
"row-end": "grid-row-end",
|
|
686
|
-
"justify": "justify-content",
|
|
687
777
|
"content": "align-content",
|
|
778
|
+
"flex": "flex",
|
|
779
|
+
"fw": "font-weight",
|
|
688
780
|
"items": "align-items",
|
|
781
|
+
"justify": "justify-content",
|
|
782
|
+
"leading": "line-height",
|
|
783
|
+
"lh": "line-height",
|
|
784
|
+
"select": "user-select",
|
|
689
785
|
"self": "align-self",
|
|
690
|
-
"
|
|
786
|
+
"tracking": "letter-spacing",
|
|
787
|
+
"vertical": "vertical-align",
|
|
788
|
+
"visible": "visibility",
|
|
789
|
+
"whitespace": "white-space",
|
|
790
|
+
"word-spacing": "word-spacing",
|
|
791
|
+
"ws": "white-space"
|
|
691
792
|
};
|
|
692
793
|
const cssVariables = [
|
|
693
|
-
[/^(
|
|
694
|
-
const prop = variablesAbbrMap[name];
|
|
794
|
+
[/^([^$]+)(?<=-)\$(.+)$/, ([, name, varname]) => {
|
|
795
|
+
const prop = variablesAbbrMap[name.slice(0, -1)];
|
|
695
796
|
if (prop)
|
|
696
797
|
return { [prop]: `var(--${varname})` };
|
|
697
798
|
}]
|
|
698
799
|
];
|
|
800
|
+
const cssProperty = [
|
|
801
|
+
[/^\[([^:]+):(.+)\]$/, ([, prop, value]) => ({ [prop]: handler.bracket(`[${value}]`) })]
|
|
802
|
+
];
|
|
699
803
|
|
|
700
804
|
const questionMark = [
|
|
701
805
|
[
|
|
@@ -714,7 +818,7 @@ const textDecorations = [
|
|
|
714
818
|
["line-through", { "text-decoration-line": "line-through" }],
|
|
715
819
|
["decoration-underline", { "text-decoration-line": "underline" }],
|
|
716
820
|
["decoration-line-through", { "text-decoration-line": "line-through" }],
|
|
717
|
-
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.px(s) })],
|
|
821
|
+
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.cssvar.px(s) })],
|
|
718
822
|
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
|
|
719
823
|
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|
|
720
824
|
const result = colorResolver("text-decoration-color", "line")(match, ctx);
|
|
@@ -726,7 +830,7 @@ const textDecorations = [
|
|
|
726
830
|
}
|
|
727
831
|
}],
|
|
728
832
|
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) })],
|
|
729
|
-
[/^underline-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": handler.auto.bracket.px(s) })],
|
|
833
|
+
[/^underline-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": handler.auto.bracket.cssvar.px(s) })],
|
|
730
834
|
[/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d })],
|
|
731
835
|
["no-underline", { "text-decoration": "none" }],
|
|
732
836
|
["decoration-none", { "text-decoration": "none" }]
|
|
@@ -736,14 +840,25 @@ const svgUtilities = [
|
|
|
736
840
|
[/^fill-(.+)$/, colorResolver("fill", "fill")],
|
|
737
841
|
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
|
|
738
842
|
["fill-none", { fill: "none" }],
|
|
739
|
-
[/^stroke-(?:size
|
|
843
|
+
[/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.fraction.px.number(s) })],
|
|
844
|
+
[/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": handler.bracket.cssvar.number(s) })],
|
|
845
|
+
[/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": handler.bracket.cssvar.px.numberWithUnit(s) })],
|
|
740
846
|
[/^stroke-(.+)$/, colorResolver("stroke", "stroke")],
|
|
741
847
|
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": handler.bracket.percent(opacity) })],
|
|
848
|
+
["stroke-cap-square", { "stroke-linecap": "square" }],
|
|
849
|
+
["stroke-cap-round", { "stroke-linecap": "round" }],
|
|
850
|
+
["stroke-cap-auto", { "stroke-linecap": "butt" }],
|
|
851
|
+
["stroke-join-arcs", { "stroke-linejoin": "arcs" }],
|
|
852
|
+
["stroke-join-bevel", { "stroke-linejoin": "bevel" }],
|
|
853
|
+
["stroke-join-clip", { "stroke-linejoin": "miter-clip" }],
|
|
854
|
+
["stroke-join-round", { "stroke-linejoin": "round" }],
|
|
855
|
+
["stroke-join-auto", { "stroke-linejoin": "miter" }],
|
|
742
856
|
["stroke-none", { stroke: "none" }]
|
|
743
857
|
];
|
|
744
858
|
|
|
745
859
|
const rules = [
|
|
746
860
|
cssVariables,
|
|
861
|
+
cssProperty,
|
|
747
862
|
paddings,
|
|
748
863
|
margins,
|
|
749
864
|
displays,
|
|
@@ -798,4 +913,4 @@ const rules = [
|
|
|
798
913
|
questionMark
|
|
799
914
|
].flat(1);
|
|
800
915
|
|
|
801
|
-
export {
|
|
916
|
+
export { textShadows as $, colorableShadows as A, boxShadows as B, sizes as C, aspectRatio as D, paddings as E, margins as F, varEmpty as G, displays as H, appearances as I, cursors as J, pointerEvents as K, resizes as L, userSelects as M, whitespaces as N, contents as O, breaks as P, textOverflows as Q, textTransforms as R, fontStyles as S, fontSmoothings as T, svgUtilities as U, transforms as V, transitions as W, fonts as X, tabSizes as Y, textIndents as Z, textStrokes as _, appearance as a, cssVariables as a0, cssProperty as a1, textDecorations as a2, borders as b, opacity as c, textColors as d, bgColors as e, flex as f, gaps as g, grids as h, overflows as i, justifies as j, orders as k, alignments as l, placements as m, insets as n, outline as o, positions as p, floats as q, rules as r, boxSizing as s, textAligns as t, questionMark as u, verticalAligns as v, willChange as w, rings as x, shadowBase as y, zIndexes as z };
|