@unocss/preset-mini 0.22.0 → 0.22.4
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 +289 -203
- package/dist/chunks/default2.mjs +289 -206
- package/dist/chunks/default3.cjs +15 -26
- package/dist/chunks/default3.mjs +16 -26
- 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.d.ts +5 -5
- package/dist/rules.cjs +3 -0
- package/dist/rules.d.ts +11 -2
- package/dist/rules.mjs +1 -1
- package/dist/theme.d.ts +8 -8
- package/dist/{types-a2d2b52f.d.ts → types-c14b808b.d.ts} +8 -2
- package/dist/{utilities-22a522e2.d.ts → utilities-29b01158.d.ts} +2 -3
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +4 -3
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +0 -1
- package/dist/variants.d.ts +11 -15
- package/dist/variants.mjs +1 -1
- package/package.json +2 -2
package/dist/chunks/default2.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as handler, c as colorResolver, d as directionMap, p as parseColor, a as cornerMap,
|
|
2
|
-
import {
|
|
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';
|
|
3
3
|
|
|
4
4
|
const verticalAlignAlias = {
|
|
5
5
|
mid: "middle",
|
|
@@ -17,9 +17,9 @@ const textAligns = [
|
|
|
17
17
|
];
|
|
18
18
|
|
|
19
19
|
const outline = [
|
|
20
|
-
[/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": handler.bracket.fraction.
|
|
20
|
+
[/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": handler.bracket.cssvar.fraction.rem(d) })],
|
|
21
21
|
[/^outline-(?:color-)?(.+)$/, colorResolver("outline-color", "outline-color")],
|
|
22
|
-
[/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": handler.bracket.fraction.
|
|
22
|
+
[/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": handler.bracket.cssvar.fraction.rem(d) })],
|
|
23
23
|
["outline", { "outline-style": "solid" }],
|
|
24
24
|
[/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
|
|
25
25
|
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
@@ -44,19 +44,28 @@ const borders = [
|
|
|
44
44
|
[/^(?:border|b)()(?:-(.+))?$/, handlerBorder],
|
|
45
45
|
[/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
|
|
46
46
|
[/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
|
|
47
|
-
[/^(?:border|b)-()
|
|
48
|
-
[/^(?:border|b)-([
|
|
49
|
-
[/^(?: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],
|
|
50
54
|
[/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor],
|
|
51
55
|
[/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
52
56
|
[/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
57
|
+
[/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/, handlerBorderColor],
|
|
58
|
+
[/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
53
59
|
[/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
54
60
|
[/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
55
61
|
[/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
62
|
+
[/^(?:border|b)-(block|inline)-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
63
|
+
[/^(?:border|b)-([bi][se])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
56
64
|
[/^(?:border-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded],
|
|
57
|
-
[/^(?:border-)?(?:rounded|rd)-([xy])(?:-(.+))?$/, handlerRounded],
|
|
58
65
|
[/^(?:border-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
|
|
59
66
|
[/^(?:border-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
|
|
67
|
+
[/^(?:border-)?(?:rounded|rd)-([bi][se])(?:-(.+))?$/, handlerRounded],
|
|
68
|
+
[/^(?:border-)?(?:rounded|rd)-([bi][se]-[bi][se])(?:-(.+))?$/, handlerRounded],
|
|
60
69
|
["border-solid", { "border-style": "solid" }],
|
|
61
70
|
["border-dashed", { "border-style": "dashed" }],
|
|
62
71
|
["border-dotted", { "border-style": "dotted" }],
|
|
@@ -109,7 +118,7 @@ function handlerBorder(m) {
|
|
|
109
118
|
}
|
|
110
119
|
}
|
|
111
120
|
function handlerBorderSize([, a = "", b = "1"]) {
|
|
112
|
-
const v = handler.bracket.px(b);
|
|
121
|
+
const v = handler.bracket.cssvar.px(b);
|
|
113
122
|
if (a in directionMap && v != null)
|
|
114
123
|
return directionMap[a].map((i) => [`border${i}-width`, v]);
|
|
115
124
|
}
|
|
@@ -124,7 +133,7 @@ function handlerBorderOpacity([, a = "", opacity]) {
|
|
|
124
133
|
return directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
|
|
125
134
|
}
|
|
126
135
|
function handlerRounded([, a = "", s = "DEFAULT"], { theme }) {
|
|
127
|
-
const v = theme.borderRadius?.[s] || handler.
|
|
136
|
+
const v = theme.borderRadius?.[s] || handler.bracket.cssvar.fraction.rem(s);
|
|
128
137
|
if (a in cornerMap && v != null)
|
|
129
138
|
return cornerMap[a].map((i) => [`border${i}-radius`, v]);
|
|
130
139
|
}
|
|
@@ -134,7 +143,7 @@ const opacity = [
|
|
|
134
143
|
];
|
|
135
144
|
const textColors = [
|
|
136
145
|
[/^(?:text|color|c)-(.+)$/, colorResolver("color", "text")],
|
|
137
|
-
[/^(?: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) })]
|
|
138
147
|
];
|
|
139
148
|
const bgColors = [
|
|
140
149
|
[/^bg-(.+)$/, colorResolver("background-color", "bg")],
|
|
@@ -162,9 +171,9 @@ const transitions = [
|
|
|
162
171
|
};
|
|
163
172
|
}
|
|
164
173
|
}],
|
|
165
|
-
[/^(?:transition-)?
|
|
166
|
-
[/^(?:transition-)?
|
|
167
|
-
[/^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) })],
|
|
168
177
|
["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
169
178
|
["ease-linear", { "transition-timing-function": "linear" }],
|
|
170
179
|
["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
|
|
@@ -189,7 +198,7 @@ const flex = [
|
|
|
189
198
|
[/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
|
|
190
199
|
[/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
|
|
191
200
|
[/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
|
|
192
|
-
[/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": handler.bracket.
|
|
201
|
+
[/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": handler.bracket.cssvar.auto.fraction.rem(d) })],
|
|
193
202
|
["flex-row", { "flex-direction": "row" }],
|
|
194
203
|
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
195
204
|
["flex-col", { "flex-direction": "column" }],
|
|
@@ -199,6 +208,117 @@ const flex = [
|
|
|
199
208
|
["flex-nowrap", { "flex-wrap": "nowrap" }]
|
|
200
209
|
];
|
|
201
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
|
+
|
|
202
322
|
const weightMap = {
|
|
203
323
|
thin: "100",
|
|
204
324
|
extralight: "200",
|
|
@@ -221,17 +341,17 @@ const fonts = [
|
|
|
221
341
|
"line-height": height
|
|
222
342
|
};
|
|
223
343
|
}
|
|
224
|
-
return { "font-size": handler.bracket.
|
|
344
|
+
return { "font-size": handler.bracket.rem(s) };
|
|
225
345
|
}],
|
|
226
|
-
[/^text-size-(.+)$/, ([, s]) => ({ "font-size": handler.bracket.
|
|
346
|
+
[/^text-size-(.+)$/, ([, s]) => ({ "font-size": handler.bracket.cssvar.rem(s) })],
|
|
227
347
|
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || handler.number(s) })],
|
|
228
|
-
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || handler.bracket.
|
|
229
|
-
[/^tracking-([^-]+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || handler.bracket.
|
|
230
|
-
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || handler.bracket.
|
|
348
|
+
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || handler.bracket.rem(s) })],
|
|
349
|
+
[/^tracking-([^-]+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || handler.bracket.rem(s) })],
|
|
350
|
+
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || handler.bracket.rem(s) })]
|
|
231
351
|
];
|
|
232
352
|
const tabSizes = [
|
|
233
|
-
[/^tab(?:-(
|
|
234
|
-
const v = handler.bracket.global.number(s || "4");
|
|
353
|
+
[/^tab(?:-(.+))?$/, ([, s]) => {
|
|
354
|
+
const v = handler.bracket.cssvar.global.number(s || "4");
|
|
235
355
|
if (v != null) {
|
|
236
356
|
return {
|
|
237
357
|
"-moz-tab-size": v,
|
|
@@ -242,7 +362,7 @@ const tabSizes = [
|
|
|
242
362
|
}]
|
|
243
363
|
];
|
|
244
364
|
const textIndents = [
|
|
245
|
-
[/^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.fraction.rem(s) })]
|
|
246
366
|
];
|
|
247
367
|
const textStrokes = [
|
|
248
368
|
[/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || handler.bracket.cssvar.px(s) })],
|
|
@@ -250,7 +370,18 @@ const textStrokes = [
|
|
|
250
370
|
[/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity) })]
|
|
251
371
|
];
|
|
252
372
|
const textShadows = [
|
|
253
|
-
[/^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) })]
|
|
254
385
|
];
|
|
255
386
|
|
|
256
387
|
const directions = {
|
|
@@ -259,7 +390,7 @@ const directions = {
|
|
|
259
390
|
"y": "row-"
|
|
260
391
|
};
|
|
261
392
|
const handleGap = ([, d = "", s]) => {
|
|
262
|
-
const v = handler.bracket.
|
|
393
|
+
const v = handler.bracket.cssvar.rem(s);
|
|
263
394
|
if (v != null) {
|
|
264
395
|
return {
|
|
265
396
|
[`grid-${directions[d]}gap`]: v,
|
|
@@ -285,12 +416,12 @@ const autoDirection = (selector, theme) => {
|
|
|
285
416
|
case "fr":
|
|
286
417
|
return "minmax(0,1fr)";
|
|
287
418
|
}
|
|
288
|
-
return handler.bracket.auto.rem(selector);
|
|
419
|
+
return handler.bracket.cssvar.auto.rem(selector);
|
|
289
420
|
};
|
|
290
421
|
const grids = [
|
|
291
422
|
["grid", { display: "grid" }],
|
|
292
423
|
["inline-grid", { display: "inline-grid" }],
|
|
293
|
-
[/^(?: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) })],
|
|
294
425
|
[/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
|
|
295
426
|
if (s === "full")
|
|
296
427
|
return { [`grid-${rowCol(c)}`]: "1/-1" };
|
|
@@ -298,11 +429,12 @@ const grids = [
|
|
|
298
429
|
if (v != null)
|
|
299
430
|
return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
|
|
300
431
|
}],
|
|
301
|
-
[/^(?:grid-)?(row|col)-start-(
|
|
302
|
-
[/^(?:grid-)?(row|col)-end-(
|
|
303
|
-
[/^(?: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) })],
|
|
304
436
|
[/^(?:grid-auto-flow|auto-flow|grid-flow)-((?:row|col)(?:-dense)?)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
|
|
305
|
-
[/^grid-(rows|cols)-(
|
|
437
|
+
[/^grid-(rows|cols)-(.+)$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: handler.bracket.cssvar(v) })],
|
|
306
438
|
[/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
307
439
|
[/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
|
|
308
440
|
["grid-rows-none", { "grid-template-rows": "none" }],
|
|
@@ -343,7 +475,7 @@ const justifies = [
|
|
|
343
475
|
["justify-self-stretch", { "justify-self": "stretch" }]
|
|
344
476
|
];
|
|
345
477
|
const orders = [
|
|
346
|
-
[/^order-(.+)$/, ([, v]) => ({ order: handler.bracket.number(v) })],
|
|
478
|
+
[/^order-(.+)$/, ([, v]) => ({ order: handler.bracket.cssvar.number(v) })],
|
|
347
479
|
["order-first", { order: "-9999" }],
|
|
348
480
|
["order-last", { order: "9999" }],
|
|
349
481
|
["order-none", { order: "0" }]
|
|
@@ -386,16 +518,19 @@ const placements = [
|
|
|
386
518
|
["place-self-stretch", { "place-self": "stretch" }]
|
|
387
519
|
];
|
|
388
520
|
function handleInsetValue(v) {
|
|
389
|
-
return
|
|
521
|
+
return handler.bracket.cssvar.auto.fraction.rem(v);
|
|
390
522
|
}
|
|
391
523
|
function handleInsetValues([, d, v]) {
|
|
392
524
|
const r = handleInsetValue(v);
|
|
393
|
-
if (r != null && d in
|
|
394
|
-
return
|
|
525
|
+
if (r != null && d in insetMap)
|
|
526
|
+
return insetMap[d].map((i) => [i.slice(1), r]);
|
|
395
527
|
}
|
|
396
528
|
const insets = [
|
|
397
529
|
[/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
|
|
398
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],
|
|
399
534
|
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
|
|
400
535
|
];
|
|
401
536
|
const floats = [
|
|
@@ -408,106 +543,37 @@ const floats = [
|
|
|
408
543
|
["clear-none", { clear: "none" }]
|
|
409
544
|
];
|
|
410
545
|
const zIndexes = [
|
|
411
|
-
[
|
|
412
|
-
[
|
|
546
|
+
[/^z-(.+)$/, ([, v]) => ({ "z-index": handler.bracket.cssvar.number(v) })],
|
|
547
|
+
["z-auto", { "z-index": "auto" }]
|
|
413
548
|
];
|
|
414
549
|
const boxSizing = [
|
|
415
550
|
["box-border", { "box-sizing": "border-box" }],
|
|
416
551
|
["box-content", { "box-sizing": "content-box" }]
|
|
417
552
|
];
|
|
418
553
|
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
["list-item", { display: "list-item" }],
|
|
427
|
-
["hidden", { display: "none" }]
|
|
428
|
-
];
|
|
429
|
-
const appearances = [
|
|
430
|
-
["visible", { visibility: "visible" }],
|
|
431
|
-
["invisible", { visibility: "hidden" }],
|
|
432
|
-
["backface-visible", { "backface-visibility": "visible" }],
|
|
433
|
-
["backface-hidden", { "backface-visibility": "hidden" }]
|
|
434
|
-
];
|
|
435
|
-
const cursors = [
|
|
436
|
-
[/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
|
|
437
|
-
];
|
|
438
|
-
const pointerEvents = [
|
|
439
|
-
["pointer-events-auto", { "pointer-events": "auto" }],
|
|
440
|
-
["pointer-events-none", { "pointer-events": "none" }]
|
|
441
|
-
];
|
|
442
|
-
const resizes = [
|
|
443
|
-
["resize-x", { resize: "horizontal" }],
|
|
444
|
-
["resize-y", { resize: "vertical" }],
|
|
445
|
-
["resize", { resize: "both" }],
|
|
446
|
-
["resize-none", { resize: "none" }]
|
|
447
|
-
];
|
|
448
|
-
const userSelects = [
|
|
449
|
-
["select-auto", { "user-select": "auto" }],
|
|
450
|
-
["select-all", { "user-select": "all" }],
|
|
451
|
-
["select-text", { "user-select": "text" }],
|
|
452
|
-
["select-none", { "user-select": "none" }]
|
|
453
|
-
];
|
|
454
|
-
const whitespaces = [
|
|
455
|
-
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
456
|
-
];
|
|
457
|
-
const contents = [
|
|
458
|
-
["content-empty", { content: '""' }],
|
|
459
|
-
["content-none", { content: '""' }]
|
|
460
|
-
];
|
|
461
|
-
const breaks = [
|
|
462
|
-
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
463
|
-
["break-words", { "overflow-wrap": "break-word" }],
|
|
464
|
-
["break-all", { "word-break": "break-all" }]
|
|
465
|
-
];
|
|
466
|
-
const textOverflows = [
|
|
467
|
-
["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
|
|
468
|
-
["text-ellipsis", { "text-overflow": "ellipsis" }],
|
|
469
|
-
["text-clip", { "text-overflow": "clip" }]
|
|
470
|
-
];
|
|
471
|
-
const textTransforms = [
|
|
472
|
-
["case-upper", { "text-transform": "uppercase" }],
|
|
473
|
-
["case-lower", { "text-transform": "lowercase" }],
|
|
474
|
-
["case-capital", { "text-transform": "capitalize" }],
|
|
475
|
-
["case-normal", { "text-transform": "none" }]
|
|
476
|
-
];
|
|
477
|
-
const fontStyles = [
|
|
478
|
-
["italic", { "font-style": "italic" }],
|
|
479
|
-
["not-italic", { "font-style": "normal" }]
|
|
480
|
-
];
|
|
481
|
-
const fontSmoothings = [
|
|
482
|
-
["antialiased", {
|
|
483
|
-
"-webkit-font-smoothing": "antialiased",
|
|
484
|
-
"-moz-osx-font-smoothing": "grayscale",
|
|
485
|
-
"font-smoothing": "grayscale"
|
|
486
|
-
}],
|
|
487
|
-
["subpixel-antialiased", {
|
|
488
|
-
"-webkit-font-smoothing": "auto",
|
|
489
|
-
"-moz-osx-font-smoothing": "auto",
|
|
490
|
-
"font-smoothing": "auto"
|
|
491
|
-
}]
|
|
492
|
-
];
|
|
493
|
-
|
|
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
|
+
};
|
|
494
561
|
const rings = [
|
|
495
562
|
[/^ring(?:-(.+))?$/, ([, d]) => {
|
|
496
563
|
const value = handler.px(d || "1");
|
|
497
564
|
if (value) {
|
|
498
|
-
return
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
};
|
|
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
|
+
];
|
|
507
573
|
}
|
|
508
574
|
}],
|
|
509
575
|
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
510
|
-
[/^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) })],
|
|
511
577
|
[/^ring-(.+)$/, colorResolver("--un-ring-color", "ring")],
|
|
512
578
|
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity) })],
|
|
513
579
|
[/^ring-offset-(.+)$/, colorResolver("--un-ring-offset-color", "ring-offset")],
|
|
@@ -515,46 +581,17 @@ const rings = [
|
|
|
515
581
|
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
516
582
|
];
|
|
517
583
|
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
if (!color)
|
|
524
|
-
return;
|
|
525
|
-
if (rgba) {
|
|
526
|
-
return {
|
|
527
|
-
"--un-shadow-color": `${rgba.slice(0, 3).join(",")}`
|
|
528
|
-
};
|
|
529
|
-
} else {
|
|
530
|
-
return {
|
|
531
|
-
"--un-shadow-color": color
|
|
532
|
-
};
|
|
533
|
-
}
|
|
584
|
+
const sizeMapping = {
|
|
585
|
+
h: "height",
|
|
586
|
+
w: "width",
|
|
587
|
+
inline: "inline-size",
|
|
588
|
+
block: "block-size"
|
|
534
589
|
};
|
|
535
|
-
const boxShadows = [
|
|
536
|
-
[/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
|
|
537
|
-
const value = theme.boxShadow?.[d || "DEFAULT"];
|
|
538
|
-
if (value) {
|
|
539
|
-
return {
|
|
540
|
-
"--un-shadow-inset": varEmpty,
|
|
541
|
-
"--un-shadow-color": "0,0,0",
|
|
542
|
-
"--un-shadow": value,
|
|
543
|
-
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
544
|
-
};
|
|
545
|
-
}
|
|
546
|
-
}],
|
|
547
|
-
[/^shadow-(.+)$/, ([, d], { theme }) => shadowColorResolver(d, theme)],
|
|
548
|
-
["shadow-inset", { "--un-shadow-inset": "inset" }]
|
|
549
|
-
];
|
|
550
|
-
|
|
551
590
|
function getPropName(minmax, hw) {
|
|
552
|
-
return `${minmax
|
|
591
|
+
return `${minmax || ""}${sizeMapping[hw]}`;
|
|
553
592
|
}
|
|
554
593
|
function getSizeValue(minmax, hw, theme, prop) {
|
|
555
|
-
|
|
556
|
-
if (minmax)
|
|
557
|
-
str = `${minmax}${capitalize(str)}`;
|
|
594
|
+
const str = getPropName(minmax, hw).replace(/-(\w)/g, (_, p) => p.toUpperCase());
|
|
558
595
|
const v = theme[str]?.[prop];
|
|
559
596
|
if (v != null)
|
|
560
597
|
return v;
|
|
@@ -564,11 +601,12 @@ function getSizeValue(minmax, hw, theme, prop) {
|
|
|
564
601
|
case "min":
|
|
565
602
|
return `${prop}-content`;
|
|
566
603
|
}
|
|
567
|
-
return handler.bracket.cssvar.fraction.
|
|
604
|
+
return handler.bracket.cssvar.auto.fraction.rem(prop);
|
|
568
605
|
}
|
|
569
606
|
const sizes = [
|
|
570
|
-
[/^(
|
|
571
|
-
[/^(
|
|
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] })]
|
|
572
610
|
];
|
|
573
611
|
function getAspectRatio(prop) {
|
|
574
612
|
if (/^\d+\/\d+$/.test(prop))
|
|
@@ -588,22 +626,53 @@ const aspectRatio = [
|
|
|
588
626
|
const paddings = [
|
|
589
627
|
[/^pa?()-?(-?.+)$/, directionSize("padding")],
|
|
590
628
|
[/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
|
|
591
|
-
[/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")]
|
|
629
|
+
[/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")],
|
|
630
|
+
[/^p-(block|inline)-(-?.+)$/, directionSize("padding")],
|
|
631
|
+
[/^p-?([bi][se])-?(-?.+)$/, directionSize("padding")]
|
|
592
632
|
];
|
|
593
633
|
const margins = [
|
|
594
634
|
[/^ma?()-?(-?.+)$/, directionSize("margin")],
|
|
595
635
|
[/^m-?([xy])-?(-?.+)$/, directionSize("margin")],
|
|
596
|
-
[/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")]
|
|
636
|
+
[/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")],
|
|
637
|
+
[/^m-(block|inline)-(-?.+)$/, directionSize("margin")],
|
|
638
|
+
[/^m-?([bi][se])-?(-?.+)$/, directionSize("margin")]
|
|
597
639
|
];
|
|
598
640
|
|
|
599
641
|
const transformGpu = {
|
|
600
|
-
"--un-transform":
|
|
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(" ")
|
|
601
654
|
};
|
|
602
655
|
const transformCpu = {
|
|
603
|
-
"--un-transform":
|
|
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(" ")
|
|
604
670
|
};
|
|
605
671
|
const transformBase = {
|
|
606
672
|
"--un-rotate": 0,
|
|
673
|
+
"--un-rotate-x": 0,
|
|
674
|
+
"--un-rotate-y": 0,
|
|
675
|
+
"--un-rotate-z": 0,
|
|
607
676
|
"--un-scale-x": 1,
|
|
608
677
|
"--un-scale-y": 1,
|
|
609
678
|
"--un-scale-z": 1,
|
|
@@ -616,9 +685,9 @@ const transformBase = {
|
|
|
616
685
|
[CONTROL_SHORTCUT_NO_MERGE]: ""
|
|
617
686
|
};
|
|
618
687
|
const transforms = [
|
|
619
|
-
[/^origin-(
|
|
688
|
+
[/^origin-(.+)$/, ([, s]) => ({ "transform-origin": positionMap[s] ?? handler.bracket.cssvar(s) })],
|
|
620
689
|
[/^perspect-(.+)$/, ([, s]) => {
|
|
621
|
-
const v = handler.px.numberWithUnit(s);
|
|
690
|
+
const v = handler.bracket.cssvar.px.numberWithUnit(s);
|
|
622
691
|
if (v != null) {
|
|
623
692
|
return {
|
|
624
693
|
"-webkit-perspective": v,
|
|
@@ -627,7 +696,7 @@ const transforms = [
|
|
|
627
696
|
}
|
|
628
697
|
}],
|
|
629
698
|
[/^perspect-origin-(.+)$/, ([, s]) => {
|
|
630
|
-
const v = handler.bracket(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
|
|
699
|
+
const v = handler.bracket.cssvar(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
|
|
631
700
|
if (v != null) {
|
|
632
701
|
return {
|
|
633
702
|
"-webkit-perspective-origin": v,
|
|
@@ -637,8 +706,8 @@ const transforms = [
|
|
|
637
706
|
}],
|
|
638
707
|
[/^translate-()(.+)$/, handleTranslate],
|
|
639
708
|
[/^translate-([xyz])-(.+)$/, handleTranslate],
|
|
640
|
-
[/^rotate-(.+)$/, handleRotate],
|
|
641
|
-
[/^
|
|
709
|
+
[/^rotate-()(.+)$/, handleRotate],
|
|
710
|
+
[/^rotate-([xyz])-(.+)$/, handleRotate],
|
|
642
711
|
[/^skew-([xy])-(.+)$/, handleSkew],
|
|
643
712
|
[/^scale-()(.+)$/, handleScale],
|
|
644
713
|
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
@@ -653,7 +722,7 @@ const transforms = [
|
|
|
653
722
|
["transform-none", { transform: "none" }]
|
|
654
723
|
];
|
|
655
724
|
function handleTranslate([, d, b]) {
|
|
656
|
-
const v = handler.bracket.fraction.
|
|
725
|
+
const v = handler.bracket.cssvar.fraction.rem(b);
|
|
657
726
|
if (v != null) {
|
|
658
727
|
return [
|
|
659
728
|
transformBase,
|
|
@@ -665,7 +734,7 @@ function handleTranslate([, d, b]) {
|
|
|
665
734
|
}
|
|
666
735
|
}
|
|
667
736
|
function handleScale([, d, b]) {
|
|
668
|
-
const v = handler.bracket.fraction.percent(b);
|
|
737
|
+
const v = handler.bracket.cssvar.fraction.percent(b);
|
|
669
738
|
if (v != null) {
|
|
670
739
|
return [
|
|
671
740
|
transformBase,
|
|
@@ -676,20 +745,34 @@ function handleScale([, d, b]) {
|
|
|
676
745
|
];
|
|
677
746
|
}
|
|
678
747
|
}
|
|
679
|
-
function handleRotate([, b]) {
|
|
680
|
-
const v = handler.bracket.degree(b);
|
|
748
|
+
function handleRotate([, d = "", b]) {
|
|
749
|
+
const v = handler.bracket.cssvar.degree(b);
|
|
681
750
|
if (v != null) {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
751
|
+
if (d) {
|
|
752
|
+
return [
|
|
753
|
+
transformBase,
|
|
754
|
+
{
|
|
755
|
+
"--un-rotate": 0,
|
|
756
|
+
[`--un-rotate-${d}`]: v,
|
|
757
|
+
"transform": "var(--un-transform)"
|
|
758
|
+
}
|
|
759
|
+
];
|
|
760
|
+
} else {
|
|
761
|
+
return [
|
|
762
|
+
transformBase,
|
|
763
|
+
{
|
|
764
|
+
"--un-rotate-x": 0,
|
|
765
|
+
"--un-rotate-y": 0,
|
|
766
|
+
"--un-rotate-z": 0,
|
|
767
|
+
"--un-rotate": v,
|
|
768
|
+
"transform": "var(--un-transform)"
|
|
769
|
+
}
|
|
770
|
+
];
|
|
771
|
+
}
|
|
689
772
|
}
|
|
690
773
|
}
|
|
691
774
|
function handleSkew([, d, b]) {
|
|
692
|
-
const v = handler.bracket.degree(b);
|
|
775
|
+
const v = handler.bracket.cssvar.degree(b);
|
|
693
776
|
if (v != null) {
|
|
694
777
|
return [
|
|
695
778
|
transformBase,
|
|
@@ -702,36 +785,35 @@ function handleSkew([, d, b]) {
|
|
|
702
785
|
}
|
|
703
786
|
|
|
704
787
|
const variablesAbbrMap = {
|
|
705
|
-
"visible": "visibility",
|
|
706
|
-
"select": "user-select",
|
|
707
|
-
"vertical": "vertical-align",
|
|
708
788
|
"backface": "backface-visibility",
|
|
709
|
-
"whitespace": "white-space",
|
|
710
789
|
"break": "word-break",
|
|
711
790
|
"case": "text-transform",
|
|
712
|
-
"origin": "transform-origin",
|
|
713
|
-
"bg-opacity": "background-opacity",
|
|
714
|
-
"tab": "tab-size",
|
|
715
|
-
"underline": "text-decoration-thickness",
|
|
716
|
-
"underline-offset": "text-underline-offset",
|
|
717
|
-
"grid-cols": "grid-template-columns",
|
|
718
|
-
"grid-rows": "grid-template-rows",
|
|
719
|
-
"auto-flow": "grid-auto-flow",
|
|
720
|
-
"row-start": "grid-row-start",
|
|
721
|
-
"row-end": "grid-row-end",
|
|
722
|
-
"justify": "justify-content",
|
|
723
791
|
"content": "align-content",
|
|
792
|
+
"flex": "flex",
|
|
793
|
+
"fw": "font-weight",
|
|
724
794
|
"items": "align-items",
|
|
795
|
+
"justify": "justify-content",
|
|
796
|
+
"leading": "line-height",
|
|
797
|
+
"lh": "line-height",
|
|
798
|
+
"select": "user-select",
|
|
725
799
|
"self": "align-self",
|
|
726
|
-
"
|
|
800
|
+
"tracking": "letter-spacing",
|
|
801
|
+
"vertical": "vertical-align",
|
|
802
|
+
"visible": "visibility",
|
|
803
|
+
"whitespace": "white-space",
|
|
804
|
+
"word-spacing": "word-spacing",
|
|
805
|
+
"ws": "white-space"
|
|
727
806
|
};
|
|
728
807
|
const cssVariables = [
|
|
729
|
-
[/^(
|
|
730
|
-
const prop = variablesAbbrMap[name];
|
|
808
|
+
[/^([^$]+)(?<=-)\$(.+)$/, ([, name, varname]) => {
|
|
809
|
+
const prop = variablesAbbrMap[name.slice(0, -1)];
|
|
731
810
|
if (prop)
|
|
732
811
|
return { [prop]: `var(--${varname})` };
|
|
733
812
|
}]
|
|
734
813
|
];
|
|
814
|
+
const cssProperty = [
|
|
815
|
+
[/^\[([^:]+):(.+)\]$/, ([, prop, value]) => ({ [prop]: handler.bracket(`[${value}]`) })]
|
|
816
|
+
];
|
|
735
817
|
|
|
736
818
|
const questionMark = [
|
|
737
819
|
[
|
|
@@ -750,7 +832,7 @@ const textDecorations = [
|
|
|
750
832
|
["line-through", { "text-decoration-line": "line-through" }],
|
|
751
833
|
["decoration-underline", { "text-decoration-line": "underline" }],
|
|
752
834
|
["decoration-line-through", { "text-decoration-line": "line-through" }],
|
|
753
|
-
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.px(s) })],
|
|
835
|
+
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.cssvar.px(s) })],
|
|
754
836
|
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
|
|
755
837
|
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|
|
756
838
|
const result = colorResolver("text-decoration-color", "line")(match, ctx);
|
|
@@ -762,7 +844,7 @@ const textDecorations = [
|
|
|
762
844
|
}
|
|
763
845
|
}],
|
|
764
846
|
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) })],
|
|
765
|
-
[/^underline-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": handler.auto.bracket.px(s) })],
|
|
847
|
+
[/^(?:underline|decoration)-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": handler.auto.bracket.cssvar.px(s) })],
|
|
766
848
|
[/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d })],
|
|
767
849
|
["no-underline", { "text-decoration": "none" }],
|
|
768
850
|
["decoration-none", { "text-decoration": "none" }]
|
|
@@ -772,9 +854,9 @@ const svgUtilities = [
|
|
|
772
854
|
[/^fill-(.+)$/, colorResolver("fill", "fill")],
|
|
773
855
|
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
|
|
774
856
|
["fill-none", { fill: "none" }],
|
|
775
|
-
[/^stroke-(?:size
|
|
776
|
-
[/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": handler.bracket.number(s) })],
|
|
777
|
-
[/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": handler.bracket.px.numberWithUnit(s) })],
|
|
857
|
+
[/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.fraction.px.number(s) })],
|
|
858
|
+
[/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": handler.bracket.cssvar.number(s) })],
|
|
859
|
+
[/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": handler.bracket.cssvar.px.numberWithUnit(s) })],
|
|
778
860
|
[/^stroke-(.+)$/, colorResolver("stroke", "stroke")],
|
|
779
861
|
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": handler.bracket.percent(opacity) })],
|
|
780
862
|
["stroke-cap-square", { "stroke-linecap": "square" }],
|
|
@@ -790,6 +872,7 @@ const svgUtilities = [
|
|
|
790
872
|
|
|
791
873
|
const rules = [
|
|
792
874
|
cssVariables,
|
|
875
|
+
cssProperty,
|
|
793
876
|
paddings,
|
|
794
877
|
margins,
|
|
795
878
|
displays,
|
|
@@ -844,4 +927,4 @@ const rules = [
|
|
|
844
927
|
questionMark
|
|
845
928
|
].flat(1);
|
|
846
929
|
|
|
847
|
-
export {
|
|
930
|
+
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 };
|