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