@unocss/preset-mini 0.21.1 → 0.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/default.cjs +25 -19
- package/dist/chunks/default.mjs +25 -19
- package/dist/chunks/default2.cjs +273 -151
- package/dist/chunks/default2.mjs +273 -154
- package/dist/chunks/default3.cjs +162 -6
- package/dist/chunks/default3.mjs +152 -2
- package/dist/chunks/utilities.cjs +33 -4
- package/dist/chunks/utilities.mjs +33 -5
- 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-13c33ba5.d.ts +56 -0
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +5 -55
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +6 -7
- package/dist/variants.d.ts +4 -3
- 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",
|
|
@@ -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" }],
|
|
@@ -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: 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.cssvar(opacity) })],
|
|
319
|
+
["shadow-inset", { "--un-shadow-inset": "inset" }]
|
|
320
|
+
];
|
|
321
|
+
|
|
197
322
|
const weightMap = {
|
|
198
323
|
thin: "100",
|
|
199
324
|
extralight: "200",
|
|
@@ -208,17 +333,15 @@ 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
346
|
[/^text-size-(.+)$/, ([, s]) => ({ "font-size": handler.bracket.auto.rem(s) })],
|
|
224
347
|
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || handler.number(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 = {
|
|
@@ -383,16 +517,19 @@ const placements = [
|
|
|
383
517
|
["place-self-stretch", { "place-self": "stretch" }]
|
|
384
518
|
];
|
|
385
519
|
function handleInsetValue(v) {
|
|
386
|
-
return
|
|
520
|
+
return handler.bracket.fraction.cssvar.auto.rem(v);
|
|
387
521
|
}
|
|
388
522
|
function handleInsetValues([, d, v]) {
|
|
389
523
|
const r = handleInsetValue(v);
|
|
390
|
-
if (r != null && d in
|
|
391
|
-
return
|
|
524
|
+
if (r != null && d in insetMap)
|
|
525
|
+
return insetMap[d].map((i) => [i.slice(1), r]);
|
|
392
526
|
}
|
|
393
527
|
const insets = [
|
|
394
528
|
[/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
|
|
395
529
|
[/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
|
|
530
|
+
[/^(?:position-|pos-)?inset-([rltbse])-(.+)$/, handleInsetValues],
|
|
531
|
+
[/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
|
|
532
|
+
[/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
|
|
396
533
|
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
|
|
397
534
|
];
|
|
398
535
|
const floats = [
|
|
@@ -413,93 +550,25 @@ const boxSizing = [
|
|
|
413
550
|
["box-content", { "box-sizing": "content-box" }]
|
|
414
551
|
];
|
|
415
552
|
|
|
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
|
-
|
|
553
|
+
const ringBase = {
|
|
554
|
+
"--un-ring-inset": varEmpty,
|
|
555
|
+
"--un-ring-offset-width": "0px",
|
|
556
|
+
"--un-ring-offset-color": "#fff",
|
|
557
|
+
"--un-ring-color": "rgba(147,197,253,0.5)",
|
|
558
|
+
...shadowBase
|
|
559
|
+
};
|
|
490
560
|
const rings = [
|
|
491
561
|
[/^ring(?:-(.+))?$/, ([, d]) => {
|
|
492
562
|
const value = handler.px(d || "1");
|
|
493
563
|
if (value) {
|
|
494
|
-
return
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
};
|
|
564
|
+
return [
|
|
565
|
+
ringBase,
|
|
566
|
+
{
|
|
567
|
+
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
568
|
+
"--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
|
|
569
|
+
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
|
|
570
|
+
}
|
|
571
|
+
];
|
|
503
572
|
}
|
|
504
573
|
}],
|
|
505
574
|
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
@@ -511,46 +580,17 @@ const rings = [
|
|
|
511
580
|
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
512
581
|
];
|
|
513
582
|
|
|
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
|
-
}
|
|
583
|
+
const sizeMapping = {
|
|
584
|
+
h: "height",
|
|
585
|
+
w: "width",
|
|
586
|
+
inline: "inline-size",
|
|
587
|
+
block: "block-size"
|
|
530
588
|
};
|
|
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
589
|
function getPropName(minmax, hw) {
|
|
548
|
-
return `${minmax
|
|
590
|
+
return `${minmax || ""}${sizeMapping[hw]}`;
|
|
549
591
|
}
|
|
550
592
|
function getSizeValue(minmax, hw, theme, prop) {
|
|
551
|
-
|
|
552
|
-
if (minmax)
|
|
553
|
-
str = `${minmax}${capitalize(str)}`;
|
|
593
|
+
const str = getPropName(minmax, hw).replace(/-(\w)/g, (_, p) => p.toUpperCase());
|
|
554
594
|
const v = theme[str]?.[prop];
|
|
555
595
|
if (v != null)
|
|
556
596
|
return v;
|
|
@@ -563,8 +603,9 @@ function getSizeValue(minmax, hw, theme, prop) {
|
|
|
563
603
|
return handler.bracket.cssvar.fraction.auto.rem(prop);
|
|
564
604
|
}
|
|
565
605
|
const sizes = [
|
|
566
|
-
[/^(
|
|
567
|
-
[/^(
|
|
606
|
+
[/^(min-|max-)?([wh])-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
|
|
607
|
+
[/^(min-|max-)?(block|inline)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
|
|
608
|
+
[/^(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
|
|
568
609
|
];
|
|
569
610
|
function getAspectRatio(prop) {
|
|
570
611
|
if (/^\d+\/\d+$/.test(prop))
|
|
@@ -584,24 +625,53 @@ const aspectRatio = [
|
|
|
584
625
|
const paddings = [
|
|
585
626
|
[/^pa?()-?(-?.+)$/, directionSize("padding")],
|
|
586
627
|
[/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
|
|
587
|
-
[/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")]
|
|
628
|
+
[/^p-?([rltbse])-?(-?.+)$/, directionSize("padding")],
|
|
629
|
+
[/^p-(inline|block)-(-?.+)$/, directionSize("padding")],
|
|
630
|
+
[/^p-?([bi][se])-?(-?.+)$/, directionSize("padding")]
|
|
588
631
|
];
|
|
589
632
|
const margins = [
|
|
590
633
|
[/^ma?()-?(-?.+)$/, directionSize("margin")],
|
|
591
634
|
[/^m-?([xy])-?(-?.+)$/, directionSize("margin")],
|
|
592
|
-
[/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")]
|
|
635
|
+
[/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")],
|
|
636
|
+
[/^m-(inline|block)-(-?.+)$/, directionSize("margin")],
|
|
637
|
+
[/^m-?([bi][se])-?(-?.+)$/, directionSize("margin")]
|
|
593
638
|
];
|
|
594
639
|
|
|
595
640
|
const transformGpu = {
|
|
596
|
-
|
|
597
|
-
|
|
641
|
+
"--un-transform": [
|
|
642
|
+
"translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
|
|
643
|
+
"rotate(var(--un-rotate))",
|
|
644
|
+
"rotateX(var(--un-rotate-x))",
|
|
645
|
+
"rotateY(var(--un-rotate-y))",
|
|
646
|
+
"rotateZ(var(--un-rotate-z))",
|
|
647
|
+
"skewX(var(--un-skew-x))",
|
|
648
|
+
"skewY(var(--un-skew-y))",
|
|
649
|
+
"scaleX(var(--un-scale-x))",
|
|
650
|
+
"scaleY(var(--un-scale-y))",
|
|
651
|
+
"scaleZ(var(--un-scale-z))"
|
|
652
|
+
].join(" ")
|
|
598
653
|
};
|
|
599
654
|
const transformCpu = {
|
|
600
|
-
|
|
601
|
-
|
|
655
|
+
"--un-transform": [
|
|
656
|
+
"translateX(var(--un-translate-x))",
|
|
657
|
+
"translateY(var(--un-translate-y))",
|
|
658
|
+
"translateZ(var(--un-translate-z))",
|
|
659
|
+
"rotate(var(--un-rotate))",
|
|
660
|
+
"rotateX(var(--un-rotate-x))",
|
|
661
|
+
"rotateY(var(--un-rotate-y))",
|
|
662
|
+
"rotateZ(var(--un-rotate-z))",
|
|
663
|
+
"skewX(var(--un-skew-x))",
|
|
664
|
+
"skewY(var(--un-skew-y))",
|
|
665
|
+
"scaleX(var(--un-scale-x))",
|
|
666
|
+
"scaleY(var(--un-scale-y))",
|
|
667
|
+
"scaleZ(var(--un-scale-z))"
|
|
668
|
+
].join(" ")
|
|
602
669
|
};
|
|
603
670
|
const transformBase = {
|
|
604
671
|
"--un-rotate": 0,
|
|
672
|
+
"--un-rotate-x": 0,
|
|
673
|
+
"--un-rotate-y": 0,
|
|
674
|
+
"--un-rotate-z": 0,
|
|
605
675
|
"--un-scale-x": 1,
|
|
606
676
|
"--un-scale-y": 1,
|
|
607
677
|
"--un-scale-z": 1,
|
|
@@ -610,20 +680,43 @@ const transformBase = {
|
|
|
610
680
|
"--un-translate-x": 0,
|
|
611
681
|
"--un-translate-y": 0,
|
|
612
682
|
"--un-translate-z": 0,
|
|
613
|
-
...transformCpu
|
|
683
|
+
...transformCpu,
|
|
684
|
+
[CONTROL_SHORTCUT_NO_MERGE]: ""
|
|
614
685
|
};
|
|
615
686
|
const transforms = [
|
|
616
|
-
["transform", transformBase],
|
|
617
687
|
[/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": positionMap[s] })],
|
|
688
|
+
[/^perspect-(.+)$/, ([, s]) => {
|
|
689
|
+
const v = handler.px.numberWithUnit(s);
|
|
690
|
+
if (v != null) {
|
|
691
|
+
return {
|
|
692
|
+
"-webkit-perspective": v,
|
|
693
|
+
"perspective": v
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
}],
|
|
697
|
+
[/^perspect-origin-(.+)$/, ([, s]) => {
|
|
698
|
+
const v = handler.bracket(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
|
|
699
|
+
if (v != null) {
|
|
700
|
+
return {
|
|
701
|
+
"-webkit-perspective-origin": v,
|
|
702
|
+
"perspective-origin": v
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
}],
|
|
618
706
|
[/^translate-()(.+)$/, handleTranslate],
|
|
619
707
|
[/^translate-([xyz])-(.+)$/, handleTranslate],
|
|
620
|
-
[/^rotate-(.+)$/, handleRotate],
|
|
708
|
+
[/^rotate-()(.+)$/, handleRotate],
|
|
709
|
+
[/^rotate(-[xyz])-(.+)$/, handleRotate],
|
|
621
710
|
[/^skew-()(.+)$/, handleSkew],
|
|
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" }]
|
|
@@ -633,7 +726,10 @@ function handleTranslate([, d, 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
|
}
|
|
@@ -642,16 +738,22 @@ function handleScale([, d, 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]) {
|
|
748
|
+
function handleRotate([, d, b]) {
|
|
650
749
|
const v = handler.bracket.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
|
}
|
|
@@ -660,7 +762,10 @@ function handleSkew([, d, 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
|
}
|
|
@@ -696,6 +801,9 @@ const cssVariables = [
|
|
|
696
801
|
return { [prop]: `var(--${varname})` };
|
|
697
802
|
}]
|
|
698
803
|
];
|
|
804
|
+
const cssProperty = [
|
|
805
|
+
[/^\[(.+):(.+)\]$/, ([, prop, value]) => ({ [prop]: handler.bracket(`[${value}]`) })]
|
|
806
|
+
];
|
|
699
807
|
|
|
700
808
|
const questionMark = [
|
|
701
809
|
[
|
|
@@ -736,14 +844,25 @@ const svgUtilities = [
|
|
|
736
844
|
[/^fill-(.+)$/, colorResolver("fill", "fill")],
|
|
737
845
|
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
|
|
738
846
|
["fill-none", { fill: "none" }],
|
|
739
|
-
[/^stroke-(?:size
|
|
847
|
+
[/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.fraction.px.number(s) })],
|
|
848
|
+
[/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": handler.bracket.number(s) })],
|
|
849
|
+
[/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": handler.bracket.px.numberWithUnit(s) })],
|
|
740
850
|
[/^stroke-(.+)$/, colorResolver("stroke", "stroke")],
|
|
741
851
|
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": handler.bracket.percent(opacity) })],
|
|
852
|
+
["stroke-cap-square", { "stroke-linecap": "square" }],
|
|
853
|
+
["stroke-cap-round", { "stroke-linecap": "round" }],
|
|
854
|
+
["stroke-cap-auto", { "stroke-linecap": "butt" }],
|
|
855
|
+
["stroke-join-arcs", { "stroke-linejoin": "arcs" }],
|
|
856
|
+
["stroke-join-bevel", { "stroke-linejoin": "bevel" }],
|
|
857
|
+
["stroke-join-clip", { "stroke-linejoin": "miter-clip" }],
|
|
858
|
+
["stroke-join-round", { "stroke-linejoin": "round" }],
|
|
859
|
+
["stroke-join-auto", { "stroke-linejoin": "miter" }],
|
|
742
860
|
["stroke-none", { stroke: "none" }]
|
|
743
861
|
];
|
|
744
862
|
|
|
745
863
|
const rules = [
|
|
746
864
|
cssVariables,
|
|
865
|
+
cssProperty,
|
|
747
866
|
paddings,
|
|
748
867
|
margins,
|
|
749
868
|
displays,
|
|
@@ -798,4 +917,4 @@ const rules = [
|
|
|
798
917
|
questionMark
|
|
799
918
|
].flat(1);
|
|
800
919
|
|
|
801
|
-
export {
|
|
920
|
+
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 };
|