@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.
@@ -2,7 +2,6 @@
2
2
 
3
3
  const utilities = require('./utilities.cjs');
4
4
  const core = require('@unocss/core');
5
- const pseudo = require('./pseudo.cjs');
6
5
 
7
6
  const verticalAlignAlias = {
8
7
  mid: "middle",
@@ -33,27 +32,42 @@ const appearance = [
33
32
  "-webkit-appearance": "none"
34
33
  }]
35
34
  ];
35
+ const willChangeProperty = (prop) => {
36
+ return utilities.handler.properties.auto.global(prop) ?? {
37
+ contents: "contents",
38
+ scroll: "scroll-position"
39
+ }[prop];
40
+ };
36
41
  const willChange = [
37
- [/^will-change-(.+)/, ([, p]) => ({ "will-change": utilities.handler.properties.auto.global(p) })]
42
+ [/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
38
43
  ];
39
44
 
40
45
  const borders = [
41
46
  [/^(?:border|b)()(?:-(.+))?$/, handlerBorder],
42
47
  [/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
43
48
  [/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
44
- [/^(?:border|b)-()size-(.+)$/, handlerBorderSize],
45
- [/^(?:border|b)-([xy])-size-(.+)$/, handlerBorderSize],
46
- [/^(?:border|b)-([rltbse])-size-(.+)$/, handlerBorderSize],
49
+ [/^(?:border|b)-(block|inline)(?:-(.+))?$/, handlerBorder],
50
+ [/^(?:border|b)-([bi][se])(?:-(.+))?$/, handlerBorder],
51
+ [/^(?:border|b)-()(?:width|size)-(.+)$/, handlerBorderSize],
52
+ [/^(?:border|b)-([xy])-(?:width|size)-(.+)$/, handlerBorderSize],
53
+ [/^(?:border|b)-([rltbse])-(?:width|size)-(.+)$/, handlerBorderSize],
54
+ [/^(?:border|b)-(block|inline)-(?:width|size)-(.+)$/, handlerBorderSize],
55
+ [/^(?:border|b)-([bi][se])-(?:width|size)-(.+)$/, handlerBorderSize],
47
56
  [/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor],
48
57
  [/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
49
58
  [/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
59
+ [/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/, handlerBorderColor],
60
+ [/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/, handlerBorderColor],
50
61
  [/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity],
51
62
  [/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
52
63
  [/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
64
+ [/^(?:border|b)-(block|inline)-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
65
+ [/^(?:border|b)-([bi][se])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
53
66
  [/^(?:border-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded],
54
- [/^(?:border-)?(?:rounded|rd)-([xy])(?:-(.+))?$/, handlerRounded],
55
67
  [/^(?:border-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
56
68
  [/^(?:border-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
69
+ [/^(?:border-)?(?:rounded|rd)-([bi][se])(?:-(.+))?$/, handlerRounded],
70
+ [/^(?:border-)?(?:rounded|rd)-([bi][se]-[bi][se])(?:-(.+))?$/, handlerRounded],
57
71
  ["border-solid", { "border-style": "solid" }],
58
72
  ["border-dashed", { "border-style": "dashed" }],
59
73
  ["border-dotted", { "border-style": "dotted" }],
@@ -196,6 +210,117 @@ const flex = [
196
210
  ["flex-nowrap", { "flex-wrap": "nowrap" }]
197
211
  ];
198
212
 
213
+ const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
214
+ const displays = [
215
+ ["inline", { display: "inline" }],
216
+ ["block", { display: "block" }],
217
+ ["inline-block", { display: "inline-block" }],
218
+ ["contents", { display: "contents" }],
219
+ ["flow-root", { display: "flow-root" }],
220
+ ["list-item", { display: "list-item" }],
221
+ ["hidden", { display: "none" }]
222
+ ];
223
+ const appearances = [
224
+ ["visible", { visibility: "visible" }],
225
+ ["invisible", { visibility: "hidden" }],
226
+ ["backface-visible", { "backface-visibility": "visible" }],
227
+ ["backface-hidden", { "backface-visibility": "hidden" }]
228
+ ];
229
+ const cursors = [
230
+ [/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
231
+ ];
232
+ const pointerEvents = [
233
+ ["pointer-events-auto", { "pointer-events": "auto" }],
234
+ ["pointer-events-none", { "pointer-events": "none" }]
235
+ ];
236
+ const resizes = [
237
+ ["resize-x", { resize: "horizontal" }],
238
+ ["resize-y", { resize: "vertical" }],
239
+ ["resize", { resize: "both" }],
240
+ ["resize-none", { resize: "none" }]
241
+ ];
242
+ const userSelects = [
243
+ ["select-auto", { "user-select": "auto" }],
244
+ ["select-all", { "user-select": "all" }],
245
+ ["select-text", { "user-select": "text" }],
246
+ ["select-none", { "user-select": "none" }]
247
+ ];
248
+ const whitespaces = [
249
+ [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
250
+ ];
251
+ const contents = [
252
+ ["content-empty", { content: '""' }],
253
+ ["content-none", { content: '""' }]
254
+ ];
255
+ const breaks = [
256
+ ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
257
+ ["break-words", { "overflow-wrap": "break-word" }],
258
+ ["break-all", { "word-break": "break-all" }]
259
+ ];
260
+ const textOverflows = [
261
+ ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
262
+ ["text-ellipsis", { "text-overflow": "ellipsis" }],
263
+ ["text-clip", { "text-overflow": "clip" }]
264
+ ];
265
+ const textTransforms = [
266
+ ["case-upper", { "text-transform": "uppercase" }],
267
+ ["case-lower", { "text-transform": "lowercase" }],
268
+ ["case-capital", { "text-transform": "capitalize" }],
269
+ ["case-normal", { "text-transform": "none" }]
270
+ ];
271
+ const fontStyles = [
272
+ ["italic", { "font-style": "italic" }],
273
+ ["not-italic", { "font-style": "normal" }]
274
+ ];
275
+ const fontSmoothings = [
276
+ ["antialiased", {
277
+ "-webkit-font-smoothing": "antialiased",
278
+ "-moz-osx-font-smoothing": "grayscale",
279
+ "font-smoothing": "grayscale"
280
+ }],
281
+ ["subpixel-antialiased", {
282
+ "-webkit-font-smoothing": "auto",
283
+ "-moz-osx-font-smoothing": "auto",
284
+ "font-smoothing": "auto"
285
+ }]
286
+ ];
287
+
288
+ const shadowBase = {
289
+ [core.CONTROL_SHORTCUT_NO_MERGE]: "",
290
+ "--un-ring-offset-shadow": "0 0 #0000",
291
+ "--un-ring-shadow": "0 0 #0000",
292
+ "--un-shadow-inset": varEmpty,
293
+ "--un-shadow": "0 0 #0000"
294
+ };
295
+ const colorableShadows = (shadows, colorVar) => {
296
+ const colored = [];
297
+ shadows = core.toArray(shadows);
298
+ for (let i = 0; i < shadows.length; i++) {
299
+ const [size, color] = shadows[i].split(/\s(\S+)$/);
300
+ if (color.split("(").length !== color.split(")").length)
301
+ return shadows;
302
+ colored.push(`${size} var(${colorVar}, ${color})`);
303
+ }
304
+ return colored;
305
+ };
306
+ const boxShadows = [
307
+ [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
308
+ const v = theme.boxShadow?.[d || "DEFAULT"];
309
+ if (v) {
310
+ return [
311
+ shadowBase,
312
+ {
313
+ "--un-shadow": colorableShadows(v, "--un-shadow-color").join(","),
314
+ "box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
315
+ }
316
+ ];
317
+ }
318
+ }],
319
+ [/^shadow-(.+)$/, utilities.colorResolver("--un-shadow-color", "shadow")],
320
+ [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": utilities.handler.bracket.percent.cssvar(opacity) })],
321
+ ["shadow-inset", { "--un-shadow-inset": "inset" }]
322
+ ];
323
+
199
324
  const weightMap = {
200
325
  thin: "100",
201
326
  extralight: "200",
@@ -210,17 +335,15 @@ const weightMap = {
210
335
  const fonts = [
211
336
  [/^font-(\w+)$/, ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] })],
212
337
  [/^text-(.+)$/, ([, s = "base"], { theme }) => {
213
- const size = utilities.handler.bracket.auto.rem(s);
214
- if (size)
215
- return { "font-size": size };
216
338
  const themed = core.toArray(theme.fontSize?.[s]);
217
339
  if (themed?.[0]) {
218
- const [size2, height] = themed;
340
+ const [size, height = "1"] = themed;
219
341
  return {
220
- "font-size": size2,
342
+ "font-size": size,
221
343
  "line-height": height
222
344
  };
223
345
  }
346
+ return { "font-size": utilities.handler.bracket.auto.rem(s) };
224
347
  }],
225
348
  [/^text-size-(.+)$/, ([, s]) => ({ "font-size": utilities.handler.bracket.auto.rem(s) })],
226
349
  [/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || utilities.handler.number(s) })],
@@ -249,7 +372,18 @@ const textStrokes = [
249
372
  [/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": utilities.handler.bracket.percent(opacity) })]
250
373
  ];
251
374
  const textShadows = [
252
- [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => ({ "text-shadow": theme.textShadow?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar(s) })]
375
+ [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
376
+ const v = theme.textShadow?.[s || "DEFAULT"];
377
+ if (v != null) {
378
+ return {
379
+ "--un-text-shadow": colorableShadows(v, "--un-text-shadow-color").join(","),
380
+ "text-shadow": "var(--un-text-shadow)"
381
+ };
382
+ }
383
+ return { "text-shadow": utilities.handler.bracket.cssvar(s) };
384
+ }],
385
+ [/^text-shadow-color-(.+)$/, utilities.colorResolver("--un-text-shadow-color", "text-shadow")],
386
+ [/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": utilities.handler.bracket.percent(opacity) })]
253
387
  ];
254
388
 
255
389
  const directions = {
@@ -385,16 +519,19 @@ const placements = [
385
519
  ["place-self-stretch", { "place-self": "stretch" }]
386
520
  ];
387
521
  function handleInsetValue(v) {
388
- return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.auto.rem(v);
522
+ return utilities.handler.bracket.fraction.cssvar.auto.rem(v);
389
523
  }
390
524
  function handleInsetValues([, d, v]) {
391
525
  const r = handleInsetValue(v);
392
- if (r != null && d in utilities.directionMap)
393
- return utilities.directionMap[d].map((i) => [i.slice(1), r]);
526
+ if (r != null && d in utilities.insetMap)
527
+ return utilities.insetMap[d].map((i) => [i.slice(1), r]);
394
528
  }
395
529
  const insets = [
396
530
  [/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
397
531
  [/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
532
+ [/^(?:position-|pos-)?inset-([rltbse])-(.+)$/, handleInsetValues],
533
+ [/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
534
+ [/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
398
535
  [/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
399
536
  ];
400
537
  const floats = [
@@ -415,93 +552,25 @@ const boxSizing = [
415
552
  ["box-content", { "box-sizing": "content-box" }]
416
553
  ];
417
554
 
418
- const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
419
- const displays = [
420
- ["inline", { display: "inline" }],
421
- ["block", { display: "block" }],
422
- ["inline-block", { display: "inline-block" }],
423
- ["contents", { display: "contents" }],
424
- ["flow-root", { display: "flow-root" }],
425
- ["list-item", { display: "list-item" }],
426
- ["hidden", { display: "none" }]
427
- ];
428
- const appearances = [
429
- ["visible", { visibility: "visible" }],
430
- ["invisible", { visibility: "hidden" }],
431
- ["backface-visible", { "backface-visibility": "visible" }],
432
- ["backface-hidden", { "backface-visibility": "hidden" }]
433
- ];
434
- const cursors = [
435
- [/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
436
- ];
437
- const pointerEvents = [
438
- ["pointer-events-auto", { "pointer-events": "auto" }],
439
- ["pointer-events-none", { "pointer-events": "none" }]
440
- ];
441
- const resizes = [
442
- ["resize-x", { resize: "horizontal" }],
443
- ["resize-y", { resize: "vertical" }],
444
- ["resize", { resize: "both" }],
445
- ["resize-none", { resize: "none" }]
446
- ];
447
- const userSelects = [
448
- ["select-auto", { "user-select": "auto" }],
449
- ["select-all", { "user-select": "all" }],
450
- ["select-text", { "user-select": "text" }],
451
- ["select-none", { "user-select": "none" }]
452
- ];
453
- const whitespaces = [
454
- [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
455
- ];
456
- const contents = [
457
- ["content-empty", { content: '""' }]
458
- ];
459
- const breaks = [
460
- ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
461
- ["break-words", { "overflow-wrap": "break-word" }],
462
- ["break-all", { "word-break": "break-all" }]
463
- ];
464
- const textOverflows = [
465
- ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
466
- ["text-ellipsis", { "text-overflow": "ellipsis" }],
467
- ["text-clip", { "text-overflow": "clip" }]
468
- ];
469
- const textTransforms = [
470
- ["case-upper", { "text-transform": "uppercase" }],
471
- ["case-lower", { "text-transform": "lowercase" }],
472
- ["case-capital", { "text-transform": "capitalize" }],
473
- ["case-normal", { "text-transform": "none" }]
474
- ];
475
- const fontStyles = [
476
- ["italic", { "font-style": "italic" }],
477
- ["not-italic", { "font-style": "normal" }]
478
- ];
479
- const fontSmoothings = [
480
- ["antialiased", {
481
- "-webkit-font-smoothing": "antialiased",
482
- "-moz-osx-font-smoothing": "grayscale",
483
- "font-smoothing": "grayscale"
484
- }],
485
- ["subpixel-antialiased", {
486
- "-webkit-font-smoothing": "auto",
487
- "-moz-osx-font-smoothing": "auto",
488
- "font-smoothing": "auto"
489
- }]
490
- ];
491
-
555
+ const ringBase = {
556
+ "--un-ring-inset": varEmpty,
557
+ "--un-ring-offset-width": "0px",
558
+ "--un-ring-offset-color": "#fff",
559
+ "--un-ring-color": "rgba(147,197,253,0.5)",
560
+ ...shadowBase
561
+ };
492
562
  const rings = [
493
563
  [/^ring(?:-(.+))?$/, ([, d]) => {
494
564
  const value = utilities.handler.px(d || "1");
495
565
  if (value) {
496
- return {
497
- "--un-ring-inset": varEmpty,
498
- "--un-ring-offset-width": "0px",
499
- "--un-ring-offset-color": "#fff",
500
- "--un-ring-color": "rgba(147, 197, 253, .5)",
501
- "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
502
- "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
503
- "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
504
- };
566
+ return [
567
+ ringBase,
568
+ {
569
+ "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
570
+ "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
571
+ "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
572
+ }
573
+ ];
505
574
  }
506
575
  }],
507
576
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
@@ -513,46 +582,17 @@ const rings = [
513
582
  ["ring-inset", { "--un-ring-inset": "inset" }]
514
583
  ];
515
584
 
516
- const shadowColorResolver = (body, theme) => {
517
- const data = utilities.parseColor(body, theme);
518
- if (!data)
519
- return;
520
- const { color, rgba } = data;
521
- if (!color)
522
- return;
523
- if (rgba) {
524
- return {
525
- "--un-shadow-color": `${rgba.slice(0, 3).join(",")}`
526
- };
527
- } else {
528
- return {
529
- "--un-shadow-color": color
530
- };
531
- }
585
+ const sizeMapping = {
586
+ h: "height",
587
+ w: "width",
588
+ inline: "inline-size",
589
+ block: "block-size"
532
590
  };
533
- const boxShadows = [
534
- [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
535
- const value = theme.boxShadow?.[d || "DEFAULT"];
536
- if (value) {
537
- return {
538
- "--un-shadow-inset": varEmpty,
539
- "--un-shadow-color": "0,0,0",
540
- "--un-shadow": value,
541
- "box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
542
- };
543
- }
544
- }],
545
- [/^shadow-(.+)$/, ([, d], { theme }) => shadowColorResolver(d, theme)],
546
- ["shadow-inset", { "--un-shadow-inset": "inset" }]
547
- ];
548
-
549
591
  function getPropName(minmax, hw) {
550
- return `${minmax ? `${minmax}-` : ""}${hw === "h" ? "height" : "width"}`;
592
+ return `${minmax || ""}${sizeMapping[hw]}`;
551
593
  }
552
594
  function getSizeValue(minmax, hw, theme, prop) {
553
- let str = `${hw === "h" ? "height" : "width"}`;
554
- if (minmax)
555
- str = `${minmax}${utilities.capitalize(str)}`;
595
+ const str = getPropName(minmax, hw).replace(/-(\w)/g, (_, p) => p.toUpperCase());
556
596
  const v = theme[str]?.[prop];
557
597
  if (v != null)
558
598
  return v;
@@ -565,8 +605,9 @@ function getSizeValue(minmax, hw, theme, prop) {
565
605
  return utilities.handler.bracket.cssvar.fraction.auto.rem(prop);
566
606
  }
567
607
  const sizes = [
568
- [/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
569
- [/^(?:(min|max)-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
608
+ [/^(min-|max-)?([wh])-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
609
+ [/^(min-|max-)?(block|inline)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
610
+ [/^(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
570
611
  ];
571
612
  function getAspectRatio(prop) {
572
613
  if (/^\d+\/\d+$/.test(prop))
@@ -586,24 +627,53 @@ const aspectRatio = [
586
627
  const paddings = [
587
628
  [/^pa?()-?(-?.+)$/, utilities.directionSize("padding")],
588
629
  [/^p-?([xy])-?(-?.+)$/, utilities.directionSize("padding")],
589
- [/^p-?([rltbse])-?(-?.+)$/, utilities.directionSize("padding")]
630
+ [/^p-?([rltbse])-?(-?.+)$/, utilities.directionSize("padding")],
631
+ [/^p-(inline|block)-(-?.+)$/, utilities.directionSize("padding")],
632
+ [/^p-?([bi][se])-?(-?.+)$/, utilities.directionSize("padding")]
590
633
  ];
591
634
  const margins = [
592
635
  [/^ma?()-?(-?.+)$/, utilities.directionSize("margin")],
593
636
  [/^m-?([xy])-?(-?.+)$/, utilities.directionSize("margin")],
594
- [/^m-?([rltbse])-?(-?.+)$/, utilities.directionSize("margin")]
637
+ [/^m-?([rltbse])-?(-?.+)$/, utilities.directionSize("margin")],
638
+ [/^m-(inline|block)-(-?.+)$/, utilities.directionSize("margin")],
639
+ [/^m-?([bi][se])-?(-?.+)$/, utilities.directionSize("margin")]
595
640
  ];
596
641
 
597
642
  const transformGpu = {
598
- 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))",
599
- [pseudo.CONTROL_BYPASS_PSEUDO_CLASS]: ""
643
+ "--un-transform": [
644
+ "translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
645
+ "rotate(var(--un-rotate))",
646
+ "rotateX(var(--un-rotate-x))",
647
+ "rotateY(var(--un-rotate-y))",
648
+ "rotateZ(var(--un-rotate-z))",
649
+ "skewX(var(--un-skew-x))",
650
+ "skewY(var(--un-skew-y))",
651
+ "scaleX(var(--un-scale-x))",
652
+ "scaleY(var(--un-scale-y))",
653
+ "scaleZ(var(--un-scale-z))"
654
+ ].join(" ")
600
655
  };
601
656
  const transformCpu = {
602
- 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))",
603
- [pseudo.CONTROL_BYPASS_PSEUDO_CLASS]: ""
657
+ "--un-transform": [
658
+ "translateX(var(--un-translate-x))",
659
+ "translateY(var(--un-translate-y))",
660
+ "translateZ(var(--un-translate-z))",
661
+ "rotate(var(--un-rotate))",
662
+ "rotateX(var(--un-rotate-x))",
663
+ "rotateY(var(--un-rotate-y))",
664
+ "rotateZ(var(--un-rotate-z))",
665
+ "skewX(var(--un-skew-x))",
666
+ "skewY(var(--un-skew-y))",
667
+ "scaleX(var(--un-scale-x))",
668
+ "scaleY(var(--un-scale-y))",
669
+ "scaleZ(var(--un-scale-z))"
670
+ ].join(" ")
604
671
  };
605
672
  const transformBase = {
606
673
  "--un-rotate": 0,
674
+ "--un-rotate-x": 0,
675
+ "--un-rotate-y": 0,
676
+ "--un-rotate-z": 0,
607
677
  "--un-scale-x": 1,
608
678
  "--un-scale-y": 1,
609
679
  "--un-scale-z": 1,
@@ -612,20 +682,43 @@ const transformBase = {
612
682
  "--un-translate-x": 0,
613
683
  "--un-translate-y": 0,
614
684
  "--un-translate-z": 0,
615
- ...transformCpu
685
+ ...transformCpu,
686
+ [core.CONTROL_SHORTCUT_NO_MERGE]: ""
616
687
  };
617
688
  const transforms = [
618
- ["transform", transformBase],
619
689
  [/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] })],
690
+ [/^perspect-(.+)$/, ([, s]) => {
691
+ const v = utilities.handler.px.numberWithUnit(s);
692
+ if (v != null) {
693
+ return {
694
+ "-webkit-perspective": v,
695
+ "perspective": v
696
+ };
697
+ }
698
+ }],
699
+ [/^perspect-origin-(.+)$/, ([, s]) => {
700
+ const v = utilities.handler.bracket(s) ?? (s.length >= 3 ? utilities.positionMap[s] : void 0);
701
+ if (v != null) {
702
+ return {
703
+ "-webkit-perspective-origin": v,
704
+ "perspective-origin": v
705
+ };
706
+ }
707
+ }],
620
708
  [/^translate-()(.+)$/, handleTranslate],
621
709
  [/^translate-([xyz])-(.+)$/, handleTranslate],
622
- [/^rotate-(.+)$/, handleRotate],
710
+ [/^rotate-()(.+)$/, handleRotate],
711
+ [/^rotate(-[xyz])-(.+)$/, handleRotate],
623
712
  [/^skew-()(.+)$/, handleSkew],
624
713
  [/^skew-([xy])-(.+)$/, handleSkew],
625
714
  [/^scale-()(.+)$/, handleScale],
626
715
  [/^scale-([xyz])-(.+)$/, handleScale],
627
716
  ["preserve-3d", { "transform-style": "preserve-3d" }],
628
717
  ["preserve-flat", { "transform-style": "flat" }],
718
+ [/^transform$/, () => [
719
+ transformBase,
720
+ { transform: "var(--un-transform)" }
721
+ ]],
629
722
  ["transform-gpu", transformGpu],
630
723
  ["transform-cpu", transformCpu],
631
724
  ["transform-none", { transform: "none" }]
@@ -635,7 +728,10 @@ function handleTranslate([, d, b]) {
635
728
  if (v != null) {
636
729
  return [
637
730
  transformBase,
638
- utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v])
731
+ [
732
+ ...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v]),
733
+ ["transform", "var(--un-transform)"]
734
+ ]
639
735
  ];
640
736
  }
641
737
  }
@@ -644,16 +740,22 @@ function handleScale([, d, b]) {
644
740
  if (v != null) {
645
741
  return [
646
742
  transformBase,
647
- utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v])
743
+ [
744
+ ...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v]),
745
+ ["transform", "var(--un-transform)"]
746
+ ]
648
747
  ];
649
748
  }
650
749
  }
651
- function handleRotate([, b]) {
750
+ function handleRotate([, d, b]) {
652
751
  const v = utilities.handler.bracket.degree(b);
653
752
  if (v != null) {
654
753
  return [
655
754
  transformBase,
656
- { "--un-rotate": v }
755
+ {
756
+ [`--un-rotate${d || ""}`]: v,
757
+ transform: "var(--un-transform)"
758
+ }
657
759
  ];
658
760
  }
659
761
  }
@@ -662,7 +764,10 @@ function handleSkew([, d, b]) {
662
764
  if (v != null) {
663
765
  return [
664
766
  transformBase,
665
- { [`--un-skew-${d}`]: v }
767
+ {
768
+ [`--un-skew-${d}`]: v,
769
+ transform: "var(--un-transform)"
770
+ }
666
771
  ];
667
772
  }
668
773
  }
@@ -698,6 +803,9 @@ const cssVariables = [
698
803
  return { [prop]: `var(--${varname})` };
699
804
  }]
700
805
  ];
806
+ const cssProperty = [
807
+ [/^\[(.+):(.+)\]$/, ([, prop, value]) => ({ [prop]: utilities.handler.bracket(`[${value}]`) })]
808
+ ];
701
809
 
702
810
  const questionMark = [
703
811
  [
@@ -738,14 +846,25 @@ const svgUtilities = [
738
846
  [/^fill-(.+)$/, utilities.colorResolver("fill", "fill")],
739
847
  [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
740
848
  ["fill-none", { fill: "none" }],
741
- [/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => ({ "stroke-width": utilities.handler.bracket.fraction.px.number(s) })],
849
+ [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": utilities.handler.bracket.fraction.px.number(s) })],
850
+ [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": utilities.handler.bracket.number(s) })],
851
+ [/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": utilities.handler.bracket.px.numberWithUnit(s) })],
742
852
  [/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke")],
743
853
  [/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
854
+ ["stroke-cap-square", { "stroke-linecap": "square" }],
855
+ ["stroke-cap-round", { "stroke-linecap": "round" }],
856
+ ["stroke-cap-auto", { "stroke-linecap": "butt" }],
857
+ ["stroke-join-arcs", { "stroke-linejoin": "arcs" }],
858
+ ["stroke-join-bevel", { "stroke-linejoin": "bevel" }],
859
+ ["stroke-join-clip", { "stroke-linejoin": "miter-clip" }],
860
+ ["stroke-join-round", { "stroke-linejoin": "round" }],
861
+ ["stroke-join-auto", { "stroke-linejoin": "miter" }],
744
862
  ["stroke-none", { stroke: "none" }]
745
863
  ];
746
864
 
747
865
  const rules = [
748
866
  cssVariables,
867
+ cssProperty,
749
868
  paddings,
750
869
  margins,
751
870
  displays,
@@ -809,7 +928,9 @@ exports.borders = borders;
809
928
  exports.boxShadows = boxShadows;
810
929
  exports.boxSizing = boxSizing;
811
930
  exports.breaks = breaks;
931
+ exports.colorableShadows = colorableShadows;
812
932
  exports.contents = contents;
933
+ exports.cssProperty = cssProperty;
813
934
  exports.cssVariables = cssVariables;
814
935
  exports.cursors = cursors;
815
936
  exports.displays = displays;
@@ -835,6 +956,7 @@ exports.questionMark = questionMark;
835
956
  exports.resizes = resizes;
836
957
  exports.rings = rings;
837
958
  exports.rules = rules;
959
+ exports.shadowBase = shadowBase;
838
960
  exports.sizes = sizes;
839
961
  exports.svgUtilities = svgUtilities;
840
962
  exports.tabSizes = tabSizes;