@unocss/preset-mini 0.35.3 → 0.37.0

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,5 +1,6 @@
1
- import { g as globalKeywords, h as handler, c as colorResolver, d as directionMap, a as hasParseableColor, p as parseColor, b as colorToString, e as cornerMap, f as colorableShadows, i as insetMap, r as resolveVerticalBreakpoints, j as resolveBreakpoints, k as directionSize, C as CONTROL_MINI_NO_NEGATIVE, l as positionMap, x as xyzMap } from './utilities.mjs';
2
- import { toArray, CONTROL_SHORTCUT_NO_MERGE } from '@unocss/core';
1
+ import { g as globalKeywords, h as handler, c as colorResolver, d as directionMap, a as hasParseableColor, p as parseColor, b as colorToString, e as cornerMap, f as colorableShadows, i as insetMap, r as resolveVerticalBreakpoints, j as resolveBreakpoints, k as directionSize } from './utilities.mjs';
2
+ import { toArray } from '@unocss/core';
3
+ import { d as displays, c as contents, a as textOverflows, e as textTransforms, f as fontStyles, g as fontSmoothings, h as boxShadows, i as rings, j as cursors, k as appearances, p as pointerEvents, l as resizes, u as userSelects, w as whitespaces, m as breaks, n as transforms } from './transform.mjs';
3
4
 
4
5
  const verticalAlignAlias = {
5
6
  "mid": "middle",
@@ -503,146 +504,6 @@ const boxSizing = [
503
504
  ["box-content", { "box-sizing": "content-box" }]
504
505
  ];
505
506
 
506
- const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
507
- const displays = [
508
- ["inline", { display: "inline" }],
509
- ["block", { display: "block" }],
510
- ["inline-block", { display: "inline-block" }],
511
- ["contents", { display: "contents" }],
512
- ["flow-root", { display: "flow-root" }],
513
- ["list-item", { display: "list-item" }],
514
- ["hidden", { display: "none" }],
515
- [/^display-(.+)$/, ([, c]) => ({ display: handler.bracket.cssvar(c) || c })]
516
- ];
517
- const appearances = [
518
- ["visible", { visibility: "visible" }],
519
- ["invisible", { visibility: "hidden" }],
520
- ["backface-visible", { "backface-visibility": "visible" }],
521
- ["backface-hidden", { "backface-visibility": "hidden" }]
522
- ];
523
- const cursors = [
524
- [/^cursor-(.+)$/, ([, c]) => ({ cursor: handler.bracket.cssvar(c) || c })]
525
- ];
526
- const pointerEvents = [
527
- ["pointer-events-auto", { "pointer-events": "auto" }],
528
- ["pointer-events-none", { "pointer-events": "none" }]
529
- ];
530
- const resizes = [
531
- ["resize-x", { resize: "horizontal" }],
532
- ["resize-y", { resize: "vertical" }],
533
- ["resize", { resize: "both" }],
534
- ["resize-none", { resize: "none" }]
535
- ];
536
- const userSelects = [
537
- ["select-auto", { "user-select": "auto" }],
538
- ["select-all", { "user-select": "all" }],
539
- ["select-text", { "user-select": "text" }],
540
- ["select-none", { "user-select": "none" }]
541
- ];
542
- const whitespaces = [
543
- [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)$/, ([, v]) => ({ "white-space": v }), { autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)" }]
544
- ];
545
- const contents = [
546
- [/^content-(.+)$/, ([, v]) => {
547
- const c = handler.bracket.cssvar(v);
548
- return { content: c == null ? `"${v}"` : c };
549
- }],
550
- ["content-empty", { content: '""' }],
551
- ["content-none", { content: '""' }]
552
- ];
553
- const breaks = [
554
- ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
555
- ["break-words", { "overflow-wrap": "break-word" }],
556
- ["break-all", { "word-break": "break-all" }]
557
- ];
558
- const textOverflows = [
559
- ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
560
- ["text-ellipsis", { "text-overflow": "ellipsis" }],
561
- ["text-clip", { "text-overflow": "clip" }]
562
- ];
563
- const textTransforms = [
564
- ["case-upper", { "text-transform": "uppercase" }],
565
- ["case-lower", { "text-transform": "lowercase" }],
566
- ["case-capital", { "text-transform": "capitalize" }],
567
- ["case-normal", { "text-transform": "none" }]
568
- ];
569
- const fontStyles = [
570
- ["italic", { "font-style": "italic" }],
571
- ["not-italic", { "font-style": "normal" }],
572
- ["font-italic", { "font-style": "italic" }],
573
- ["font-not-italic", { "font-style": "normal" }],
574
- ["oblique", { "font-style": "oblique" }],
575
- ["not-oblique", { "font-style": "normal" }],
576
- ["font-oblique", { "font-style": "oblique" }],
577
- ["font-not-oblique", { "font-style": "normal" }]
578
- ];
579
- const fontSmoothings = [
580
- ["antialiased", {
581
- "-webkit-font-smoothing": "antialiased",
582
- "-moz-osx-font-smoothing": "grayscale",
583
- "font-smoothing": "grayscale"
584
- }],
585
- ["subpixel-antialiased", {
586
- "-webkit-font-smoothing": "auto",
587
- "-moz-osx-font-smoothing": "auto",
588
- "font-smoothing": "auto"
589
- }]
590
- ];
591
-
592
- const rings = [
593
- [/^ring(?:-(.+))?$/, ([, d], { theme }) => {
594
- const value = theme.ringWidth?.[d || "DEFAULT"] ?? handler.px(d || "1");
595
- if (value) {
596
- return [
597
- {
598
- [CONTROL_SHORTCUT_NO_MERGE]: "",
599
- "--un-ring-inset": varEmpty,
600
- "--un-ring-offset-width": "0px",
601
- "--un-ring-offset-color": "#fff",
602
- "--un-ring-width": "0px",
603
- "--un-ring-color": "rgba(147,197,253,0.5)"
604
- },
605
- {
606
- "--un-ring-width": value,
607
- "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
608
- "--un-ring-shadow": "var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color)",
609
- "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
610
- }
611
- ];
612
- }
613
- }, { autocomplete: "ring-$ringWidth" }],
614
- [/^ring-(?:width-|size-)(.+)$/, ([, d], { theme }) => ({ "--un-ring-width": theme.lineWidth?.[d] ?? handler.bracket.cssvar.px(d) }), { autocomplete: "ring-(width|size)-$lineWidth" }],
615
- ["ring-offset", { "--un-ring-offset-width": "1px" }],
616
- [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? handler.bracket.cssvar.px(d) }), { autocomplete: "ring-offset-(width|size)-$lineWidth" }],
617
- [/^ring-(.+)$/, colorResolver("--un-ring-color", "ring"), { autocomplete: "ring-$colors" }],
618
- [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
619
- [/^ring-offset-(.+)$/, colorResolver("--un-ring-offset-color", "ring-offset"), { autocomplete: "ring-offset-$colors" }],
620
- [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": handler.bracket.percent(opacity) }), { autocomplete: "ring-offset-(op|opacity)-<percent>" }],
621
- ["ring-inset", { "--un-ring-inset": "inset" }]
622
- ];
623
-
624
- const boxShadows = [
625
- [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
626
- const v = theme.boxShadow?.[d || "DEFAULT"];
627
- if (v) {
628
- return [
629
- {
630
- [CONTROL_SHORTCUT_NO_MERGE]: "",
631
- "--un-shadow-inset": varEmpty,
632
- "--un-shadow": "0 0 #0000"
633
- },
634
- {
635
- "--un-shadow": colorableShadows(v, "--un-shadow-color").join(","),
636
- "box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
637
- }
638
- ];
639
- }
640
- }, { autocomplete: "shadow-$boxShadow" }],
641
- [/^shadow-(.+)$/, colorResolver("--un-shadow-color", "shadow"), { autocomplete: "shadow-$colors" }],
642
- [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": handler.bracket.percent(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }],
643
- ["shadow-inset", { "--un-shadow-inset": "inset" }]
644
- ];
645
-
646
507
  const sizeMapping = {
647
508
  h: "height",
648
509
  w: "width",
@@ -721,153 +582,6 @@ const margins = [
721
582
  [/^m-?([bi][se])(?:-?(-?.+))?$/, directionSize("margin")]
722
583
  ];
723
584
 
724
- const transformGpu = {
725
- "--un-transform": [
726
- "translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
727
- "rotate(var(--un-rotate))",
728
- "rotateX(var(--un-rotate-x))",
729
- "rotateY(var(--un-rotate-y))",
730
- "rotateZ(var(--un-rotate-z))",
731
- "skewX(var(--un-skew-x))",
732
- "skewY(var(--un-skew-y))",
733
- "scaleX(var(--un-scale-x))",
734
- "scaleY(var(--un-scale-y))",
735
- "scaleZ(var(--un-scale-z))"
736
- ].join(" ")
737
- };
738
- const transformCpu = {
739
- "--un-transform": [
740
- "translateX(var(--un-translate-x))",
741
- "translateY(var(--un-translate-y))",
742
- "translateZ(var(--un-translate-z))",
743
- "rotate(var(--un-rotate))",
744
- "rotateX(var(--un-rotate-x))",
745
- "rotateY(var(--un-rotate-y))",
746
- "rotateZ(var(--un-rotate-z))",
747
- "skewX(var(--un-skew-x))",
748
- "skewY(var(--un-skew-y))",
749
- "scaleX(var(--un-scale-x))",
750
- "scaleY(var(--un-scale-y))",
751
- "scaleZ(var(--un-scale-z))"
752
- ].join(" ")
753
- };
754
- const transformBase = {
755
- "--un-rotate": 0,
756
- "--un-rotate-x": 0,
757
- "--un-rotate-y": 0,
758
- "--un-rotate-z": 0,
759
- "--un-scale-x": 1,
760
- "--un-scale-y": 1,
761
- "--un-scale-z": 1,
762
- "--un-skew-x": 0,
763
- "--un-skew-y": 0,
764
- "--un-translate-x": 0,
765
- "--un-translate-y": 0,
766
- "--un-translate-z": 0,
767
- ...transformCpu,
768
- [CONTROL_SHORTCUT_NO_MERGE]: "",
769
- [CONTROL_MINI_NO_NEGATIVE]: ""
770
- };
771
- const transforms = [
772
- [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": positionMap[s] ?? handler.bracket.cssvar(s) }), { autocomplete: [`transform-origin-(${Object.keys(positionMap).join("|")})`, `origin-(${Object.keys(positionMap).join("|")})`] }],
773
- [/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
774
- const v = handler.bracket.cssvar.px.numberWithUnit(s);
775
- if (v != null) {
776
- return {
777
- "-webkit-perspective": v,
778
- "perspective": v
779
- };
780
- }
781
- }],
782
- [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
783
- const v = handler.bracket.cssvar(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
784
- if (v != null) {
785
- return {
786
- "-webkit-perspective-origin": v,
787
- "perspective-origin": v
788
- };
789
- }
790
- }],
791
- [/^(?:transform-)?translate-()(.+)$/, handleTranslate],
792
- [/^(?:transform-)?translate-([xyz])-(.+)$/, handleTranslate],
793
- [/^(?:transform-)?rotate-()(.+)$/, handleRotate],
794
- [/^(?:transform-)?rotate-([xyz])-(.+)$/, handleRotate],
795
- [/^(?:transform-)?skew-([xy])-(.+)$/, handleSkew],
796
- [/^(?:transform-)?scale-()(.+)$/, handleScale],
797
- [/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale],
798
- [/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
799
- [/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
800
- [/^transform$/, () => [
801
- transformBase,
802
- { transform: "var(--un-transform)" }
803
- ]],
804
- ["transform-gpu", transformGpu],
805
- ["transform-cpu", transformCpu],
806
- ["transform-none", { transform: "none" }]
807
- ];
808
- function handleTranslate([, d, b], { theme }) {
809
- const v = theme.spacing?.[b] ?? handler.bracket.cssvar.fraction.rem(b);
810
- if (v != null) {
811
- return [
812
- transformBase,
813
- [
814
- ...xyzMap[d].map((i) => [`--un-translate${i}`, v]),
815
- ["transform", "var(--un-transform)"]
816
- ]
817
- ];
818
- }
819
- }
820
- function handleScale([, d, b]) {
821
- const v = handler.bracket.cssvar.fraction.percent(b);
822
- if (v != null) {
823
- return [
824
- transformBase,
825
- [
826
- ...xyzMap[d].map((i) => [`--un-scale${i}`, v]),
827
- ["transform", "var(--un-transform)"]
828
- ]
829
- ];
830
- }
831
- }
832
- function handleRotate([, d = "", b]) {
833
- const v = handler.bracket.cssvar.degree(b);
834
- if (v != null) {
835
- if (d) {
836
- return [
837
- transformBase,
838
- {
839
- "--un-rotate": 0,
840
- [`--un-rotate-${d}`]: v,
841
- "transform": "var(--un-transform)"
842
- }
843
- ];
844
- } else {
845
- return [
846
- transformBase,
847
- {
848
- "--un-rotate-x": 0,
849
- "--un-rotate-y": 0,
850
- "--un-rotate-z": 0,
851
- "--un-rotate": v,
852
- "transform": "var(--un-transform)"
853
- }
854
- ];
855
- }
856
- }
857
- }
858
- function handleSkew([, d, b]) {
859
- const v = handler.bracket.cssvar.degree(b);
860
- if (v != null) {
861
- return [
862
- transformBase,
863
- {
864
- [`--un-skew-${d}`]: v,
865
- transform: "var(--un-transform)"
866
- }
867
- ];
868
- }
869
- }
870
-
871
585
  const variablesAbbrMap = {
872
586
  backface: "backface-visibility",
873
587
  break: "word-break",
@@ -1003,4 +717,4 @@ const rules = [
1003
717
  questionMark
1004
718
  ].flat(1);
1005
719
 
1006
- export { cssProperty 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, textDecorations as a0, 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 };
720
+ export { paddings as A, margins as B, svgUtilities as C, transitions as D, fonts as E, tabSizes as F, textIndents as G, textStrokes as H, textShadows as I, cssVariables as J, cssProperty as K, textDecorations as L, 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, sizes as x, aspectRatio as y, zIndexes as z };
@@ -123,10 +123,22 @@ const variantSelector = {
123
123
  }
124
124
  }
125
125
  };
126
- const variantLayer = {
126
+ const variantCssLayer = {
127
127
  name: "layer",
128
128
  match(matcher) {
129
129
  const match = matcher.match(/^layer-([_\d\w]+)[:-]/);
130
+ if (match) {
131
+ return {
132
+ matcher: matcher.slice(match[0].length),
133
+ parent: `@layer ${match[1]}`
134
+ };
135
+ }
136
+ }
137
+ };
138
+ const variantInternalLayer = {
139
+ name: "uno-layer",
140
+ match(matcher) {
141
+ const match = matcher.match(/^uno-layer-([_\d\w]+)[:-]/);
130
142
  if (match) {
131
143
  return {
132
144
  matcher: matcher.slice(match[0].length),
@@ -352,8 +364,9 @@ const partClasses = {
352
364
  };
353
365
 
354
366
  const variants = (options) => [
367
+ variantCssLayer,
355
368
  variantSelector,
356
- variantLayer,
369
+ variantInternalLayer,
357
370
  variantNegative,
358
371
  variantImportant,
359
372
  variantPrint,
@@ -373,10 +386,11 @@ exports.partClasses = partClasses;
373
386
  exports.variantBreakpoints = variantBreakpoints;
374
387
  exports.variantColorsMediaOrClass = variantColorsMediaOrClass;
375
388
  exports.variantCombinators = variantCombinators;
389
+ exports.variantCssLayer = variantCssLayer;
376
390
  exports.variantCustomMedia = variantCustomMedia;
377
391
  exports.variantImportant = variantImportant;
392
+ exports.variantInternalLayer = variantInternalLayer;
378
393
  exports.variantLanguageDirections = variantLanguageDirections;
379
- exports.variantLayer = variantLayer;
380
394
  exports.variantNegative = variantNegative;
381
395
  exports.variantPrint = variantPrint;
382
396
  exports.variantPseudoClassFunctions = variantPseudoClassFunctions;
@@ -121,10 +121,22 @@ const variantSelector = {
121
121
  }
122
122
  }
123
123
  };
124
- const variantLayer = {
124
+ const variantCssLayer = {
125
125
  name: "layer",
126
126
  match(matcher) {
127
127
  const match = matcher.match(/^layer-([_\d\w]+)[:-]/);
128
+ if (match) {
129
+ return {
130
+ matcher: matcher.slice(match[0].length),
131
+ parent: `@layer ${match[1]}`
132
+ };
133
+ }
134
+ }
135
+ };
136
+ const variantInternalLayer = {
137
+ name: "uno-layer",
138
+ match(matcher) {
139
+ const match = matcher.match(/^uno-layer-([_\d\w]+)[:-]/);
128
140
  if (match) {
129
141
  return {
130
142
  matcher: matcher.slice(match[0].length),
@@ -350,8 +362,9 @@ const partClasses = {
350
362
  };
351
363
 
352
364
  const variants = (options) => [
365
+ variantCssLayer,
353
366
  variantSelector,
354
- variantLayer,
367
+ variantInternalLayer,
355
368
  variantNegative,
356
369
  variantImportant,
357
370
  variantPrint,
@@ -367,4 +380,4 @@ const variants = (options) => [
367
380
  variantScope
368
381
  ];
369
382
 
370
- export { variantBreakpoints as a, variantCombinators as b, variantPrint as c, variantCustomMedia as d, variantColorsMediaOrClass as e, variantLanguageDirections as f, variantSelector as g, variantLayer as h, variantScope as i, variantImportant as j, variantNegative as k, variantPseudoClassesAndElements as l, variantPseudoClassFunctions as m, variantTaggedPseudoClasses as n, partClasses as p, variants as v };
383
+ export { variantBreakpoints as a, variantCombinators as b, variantPrint as c, variantCustomMedia as d, variantColorsMediaOrClass as e, variantLanguageDirections as f, variantSelector as g, variantCssLayer as h, variantInternalLayer as i, variantScope as j, variantImportant as k, variantNegative as l, variantPseudoClassesAndElements as m, variantPseudoClassFunctions as n, variantTaggedPseudoClasses as o, partClasses as p, variants as v };