@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.
@@ -1,6 +1,5 @@
1
- import { h as handler, c as colorResolver, d as directionMap, p as parseColor, a as cornerMap, b as capitalize, e as directionSize, f as positionMap, x as xyzMap } from './utilities.mjs';
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": handler.properties.auto.global(p) })]
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)-()size-(.+)$/, handlerBorderSize],
43
- [/^(?:border|b)-([xy])-size-(.+)$/, handlerBorderSize],
44
- [/^(?:border|b)-([rltbse])-size-(.+)$/, handlerBorderSize],
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 [size2, height] = themed;
338
+ const [size, height = "1"] = themed;
217
339
  return {
218
- "font-size": size2,
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 }) => ({ "text-shadow": theme.textShadow?.[s || "DEFAULT"] || handler.bracket.cssvar(s) })]
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 { auto: "auto", full: "100%" }[v] ?? handler.bracket.fraction.cssvar.auto.rem(v);
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 directionMap)
391
- return directionMap[d].map((i) => [i.slice(1), r]);
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 varEmpty = "var(--un-empty,/*!*/ /*!*/)";
417
- const displays = [
418
- ["inline", { display: "inline" }],
419
- ["block", { display: "block" }],
420
- ["inline-block", { display: "inline-block" }],
421
- ["contents", { display: "contents" }],
422
- ["flow-root", { display: "flow-root" }],
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
- "--un-ring-inset": varEmpty,
496
- "--un-ring-offset-width": "0px",
497
- "--un-ring-offset-color": "#fff",
498
- "--un-ring-color": "rgba(147, 197, 253, .5)",
499
- "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
500
- "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
501
- "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
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 shadowColorResolver = (body, theme) => {
515
- const data = parseColor(body, theme);
516
- if (!data)
517
- return;
518
- const { color, rgba } = data;
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 ? `${minmax}-` : ""}${hw === "h" ? "height" : "width"}`;
590
+ return `${minmax || ""}${sizeMapping[hw]}`;
549
591
  }
550
592
  function getSizeValue(minmax, hw, theme, prop) {
551
- let str = `${hw === "h" ? "height" : "width"}`;
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
- [/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
567
- [/^(?:(min|max)-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
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
- transform: "rotate(var(--un-rotate)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
597
- [CONTROL_BYPASS_PSEUDO_CLASS]: ""
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
- transform: "rotate(var(--un-rotate)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) translateX(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z))",
601
- [CONTROL_BYPASS_PSEUDO_CLASS]: ""
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
- xyzMap[d].map((i) => [`--un-translate${i}`, v])
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
- xyzMap[d].map((i) => [`--un-scale${i}`, v])
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
- { "--un-rotate": v }
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
- { [`--un-skew-${d}`]: v }
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-|width-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.fraction.px.number(s) })],
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 { textDecorations as $, sizes as A, aspectRatio as B, paddings as C, margins as D, varEmpty as E, displays as F, appearances as G, cursors as H, pointerEvents as I, resizes as J, userSelects as K, whitespaces as L, contents as M, breaks as N, textOverflows as O, textTransforms as P, fontStyles as Q, fontSmoothings as R, svgUtilities as S, transforms as T, transitions as U, fonts as V, tabSizes as W, textIndents as X, textStrokes as Y, textShadows as Z, cssVariables as _, appearance as a, 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, boxShadows as y, zIndexes as z };
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 };