@kbach/react 0.5.38 → 0.5.41
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/README.md +173 -98
- package/dist/{chunk-EJFQKJPT.mjs → chunk-AAPA3CRV.mjs} +40 -59
- package/dist/{chunk-W7UBSRE5.mjs → chunk-GOQNOKFN.mjs} +19 -12
- package/dist/{chunk-NWVL4BES.mjs → chunk-VCNP57PR.mjs} +408 -1019
- package/dist/index.d.mts +10 -20
- package/dist/index.d.ts +10 -20
- package/dist/index.js +443 -1051
- package/dist/index.mjs +40 -22
- package/dist/jsx-dev-runtime.d.mts +6 -4
- package/dist/jsx-dev-runtime.d.ts +6 -4
- package/dist/jsx-dev-runtime.js +445 -1078
- package/dist/jsx-dev-runtime.mjs +10 -5
- package/dist/jsx-runtime.d.mts +2 -3
- package/dist/jsx-runtime.d.ts +2 -3
- package/dist/jsx-runtime.js +443 -1076
- package/dist/jsx-runtime.mjs +5 -3
- package/dist/types-D-24rbXu.d.mts +126 -0
- package/dist/types-D-24rbXu.d.ts +126 -0
- package/dist/vite-plugin.d.mts +1 -1
- package/dist/vite-plugin.d.ts +1 -1
- package/dist/vite-plugin.js +303 -842
- package/dist/vite-plugin.mjs +76 -25
- package/package.json +4 -2
- package/types.d.ts +1 -0
- package/dist/types-CV5vXnSH.d.mts +0 -70
- package/dist/types-CV5vXnSH.d.ts +0 -70
package/dist/jsx-runtime.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var jsx_runtime_exports = {};
|
|
32
32
|
__export(jsx_runtime_exports, {
|
|
33
33
|
Fragment: () => import_react5.Fragment,
|
|
34
|
+
_invalidateDefaultFontCache: () => _invalidateDefaultFontCache,
|
|
34
35
|
jsx: () => jsx,
|
|
35
36
|
jsxs: () => jsxs
|
|
36
37
|
});
|
|
@@ -597,7 +598,11 @@ var LRUCache = class {
|
|
|
597
598
|
return this;
|
|
598
599
|
}
|
|
599
600
|
has(key) {
|
|
600
|
-
|
|
601
|
+
if (!this.cache.has(key)) return false;
|
|
602
|
+
const value = this.cache.get(key);
|
|
603
|
+
this.cache.delete(key);
|
|
604
|
+
this.cache.set(key, value);
|
|
605
|
+
return true;
|
|
601
606
|
}
|
|
602
607
|
delete(key) {
|
|
603
608
|
return this.cache.delete(key);
|
|
@@ -612,9 +617,10 @@ var LRUCache = class {
|
|
|
612
617
|
|
|
613
618
|
// src/core/platform.ts
|
|
614
619
|
var isWeb = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
620
|
+
var isNative = !isWeb && (typeof globalThis.HermesInternal !== "undefined" || typeof globalThis.__fbBatchedBridge !== "undefined" || typeof navigator !== "undefined" && navigator.product === "ReactNative");
|
|
615
621
|
var _cssGenMode = false;
|
|
616
622
|
function getEffectiveIsWeb() {
|
|
617
|
-
return isWeb || _cssGenMode;
|
|
623
|
+
return isWeb || _cssGenMode || !isNative;
|
|
618
624
|
}
|
|
619
625
|
function toNativeValue(raw) {
|
|
620
626
|
if (/^-?\d+(\.\d+)?px$/.test(raw)) return parseFloat(raw);
|
|
@@ -627,773 +633,116 @@ function escapeCSSSelector(cls) {
|
|
|
627
633
|
return cls.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
|
|
628
634
|
}
|
|
629
635
|
|
|
630
|
-
// src/core/
|
|
631
|
-
var
|
|
632
|
-
|
|
633
|
-
|
|
636
|
+
// src/core/registry.ts
|
|
637
|
+
var BUILTIN_MODIFIERS = {
|
|
638
|
+
// ── Mode ─────────────────────────────────────────────────────────────────
|
|
639
|
+
dark: { darkScheme: "dark", jsBehavior: "mode", jsMatch: (d) => d },
|
|
640
|
+
"not-light": { darkScheme: "dark", jsBehavior: "mode", jsMatch: (d) => d },
|
|
641
|
+
light: { darkScheme: "light", jsBehavior: "mode", jsMatch: (d) => !d },
|
|
642
|
+
"not-dark": { darkScheme: "light", jsBehavior: "mode", jsMatch: (d) => !d },
|
|
643
|
+
// ── Interactive — JS state + CSS pseudo ───────────────────────────────────
|
|
644
|
+
hover: { pseudo: ":hover", jsBehavior: "interactive", jsMatch: (_, s) => !!s.hover },
|
|
645
|
+
"not-hover": { pseudo: ":not(:hover)", jsBehavior: "interactive", jsMatch: (_, s) => !s.hover },
|
|
646
|
+
focus: { pseudo: ":focus", jsBehavior: "interactive", jsMatch: (_, s) => !!s.focus },
|
|
647
|
+
"not-focus": { pseudo: ":not(:focus)", jsBehavior: "interactive", jsMatch: (_, s) => !s.focus },
|
|
648
|
+
active: { pseudo: ":active", jsBehavior: "interactive", jsMatch: (_, s) => !!s.active || !!s.pressed },
|
|
649
|
+
"not-active": { pseudo: ":not(:active)", jsBehavior: "interactive", jsMatch: (_, s) => !s.active && !s.pressed },
|
|
650
|
+
pressed: { pseudo: ":active", jsBehavior: "interactive", jsMatch: (_, s) => !!s.pressed || !!s.active },
|
|
651
|
+
"not-pressed": { pseudo: ":not(:active)", jsBehavior: "interactive", jsMatch: (_, s) => !s.pressed && !s.active },
|
|
652
|
+
disabled: { pseudo: ":disabled", jsBehavior: "interactive", jsMatch: (_, s) => !!s.disabled },
|
|
653
|
+
"not-disabled": { pseudo: ":not(:disabled)", jsBehavior: "interactive", jsMatch: (_, s) => !s.disabled },
|
|
654
|
+
checked: { pseudo: ":checked", jsBehavior: "interactive", jsMatch: (_, s) => !!s.checked },
|
|
655
|
+
"not-checked": { pseudo: ":not(:checked)", jsBehavior: "interactive", jsMatch: (_, s) => !s.checked },
|
|
656
|
+
visited: { pseudo: ":visited", jsBehavior: "interactive", jsMatch: (_, s) => !!s.visited },
|
|
657
|
+
"not-visited": { pseudo: ":not(:visited)", jsBehavior: "interactive", jsMatch: (_, s) => !s.visited },
|
|
658
|
+
placeholder: { pseudo: "::placeholder", jsBehavior: "interactive", jsMatch: (_, s) => !!s.placeholder },
|
|
659
|
+
// ── CSS-only pseudo-classes (structural) ──────────────────────────────────
|
|
660
|
+
first: { pseudo: ":first-child", jsBehavior: "css-only", forcesImportant: true },
|
|
661
|
+
last: { pseudo: ":last-child", jsBehavior: "css-only", forcesImportant: true },
|
|
662
|
+
odd: { pseudo: ":nth-child(odd)", jsBehavior: "css-only", forcesImportant: true },
|
|
663
|
+
even: { pseudo: ":nth-child(even)", jsBehavior: "css-only", forcesImportant: true },
|
|
664
|
+
only: { pseudo: ":only-child", jsBehavior: "css-only", forcesImportant: true },
|
|
665
|
+
"focus-within": { pseudo: ":focus-within", jsBehavior: "css-only", forcesImportant: true },
|
|
666
|
+
"focus-visible": { pseudo: ":focus-visible", jsBehavior: "css-only", forcesImportant: true },
|
|
667
|
+
// ── CSS-only pseudo-elements ───────────────────────────────────────────────
|
|
668
|
+
before: { pseudo: "::before", jsBehavior: "css-only" },
|
|
669
|
+
after: { pseudo: "::after", jsBehavior: "css-only" },
|
|
670
|
+
selection: { pseudo: "::selection", jsBehavior: "css-only" },
|
|
671
|
+
"first-letter": { pseudo: "::first-letter", jsBehavior: "css-only" },
|
|
672
|
+
"first-line": { pseudo: "::first-line", jsBehavior: "css-only" },
|
|
673
|
+
marker: { pseudo: "::marker", jsBehavior: "css-only" },
|
|
674
|
+
// ── Group / peer ancestor selectors (CSS-only) ─────────────────────────────
|
|
675
|
+
"group-hover": { ancestorSelector: ".group:hover ", jsBehavior: "css-only", forcesImportant: true },
|
|
676
|
+
"group-focus": { ancestorSelector: ".group:focus ", jsBehavior: "css-only", forcesImportant: true },
|
|
677
|
+
"peer-hover": { ancestorSelector: ".peer:hover ~ ", jsBehavior: "css-only", forcesImportant: true },
|
|
678
|
+
"peer-focus": { ancestorSelector: ".peer:focus ~ ", jsBehavior: "css-only", forcesImportant: true },
|
|
679
|
+
// ── Responsive — both CSS (@media min-width) and JS (breakpoints set) ──────
|
|
680
|
+
sm: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("sm") },
|
|
681
|
+
md: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("md") },
|
|
682
|
+
lg: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("lg") },
|
|
683
|
+
xl: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("xl") },
|
|
684
|
+
"2xl": { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("2xl") },
|
|
685
|
+
// ── Print media (CSS-only) ─────────────────────────────────────────────────
|
|
686
|
+
print: { mediaQuery: "print", jsBehavior: "css-only", forcesImportant: true },
|
|
687
|
+
// ── Orientation / accessibility media (CSS-only) ───────────────────────────
|
|
688
|
+
landscape: { mediaQuery: "(orientation: landscape)", jsBehavior: "css-only", forcesImportant: true },
|
|
689
|
+
portrait: { mediaQuery: "(orientation: portrait)", jsBehavior: "css-only", forcesImportant: true },
|
|
690
|
+
"motion-reduce": { mediaQuery: "(prefers-reduced-motion: reduce)", jsBehavior: "css-only", forcesImportant: true },
|
|
691
|
+
"motion-safe": { mediaQuery: "(prefers-reduced-motion: no-preference)", jsBehavior: "css-only", forcesImportant: true },
|
|
692
|
+
"contrast-more": { mediaQuery: "(prefers-contrast: more)", jsBehavior: "css-only", forcesImportant: true },
|
|
693
|
+
"contrast-less": { mediaQuery: "(prefers-contrast: less)", jsBehavior: "css-only", forcesImportant: true },
|
|
694
|
+
// ── Directionality (CSS-only) ──────────────────────────────────────────────
|
|
695
|
+
rtl: { dirSelector: '[dir="rtl"] ', jsBehavior: "css-only", forcesImportant: true },
|
|
696
|
+
ltr: { dirSelector: '[dir="ltr"] ', jsBehavior: "css-only", forcesImportant: true }
|
|
697
|
+
};
|
|
698
|
+
var _pluginModifiers = {};
|
|
699
|
+
var _allNames = null;
|
|
700
|
+
var _interactiveNames = null;
|
|
701
|
+
var _modeNames = null;
|
|
702
|
+
var _responsiveNames = null;
|
|
703
|
+
function _invalidate() {
|
|
704
|
+
_allNames = null;
|
|
705
|
+
_interactiveNames = null;
|
|
706
|
+
_modeNames = null;
|
|
707
|
+
_responsiveNames = null;
|
|
708
|
+
}
|
|
709
|
+
function registerModifier(name, def) {
|
|
710
|
+
_pluginModifiers[name] = def;
|
|
711
|
+
_invalidate();
|
|
634
712
|
}
|
|
635
713
|
function clearPluginModifiers() {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
var MODIFIERS = /* @__PURE__ */ new Set([
|
|
639
|
-
// Theme
|
|
640
|
-
"dark",
|
|
641
|
-
"light",
|
|
642
|
-
"not-dark",
|
|
643
|
-
"not-light",
|
|
644
|
-
// Interaction
|
|
645
|
-
"hover",
|
|
646
|
-
"focus",
|
|
647
|
-
"active",
|
|
648
|
-
"visited",
|
|
649
|
-
"disabled",
|
|
650
|
-
"checked",
|
|
651
|
-
"pressed",
|
|
652
|
-
"placeholder",
|
|
653
|
-
"focus-within",
|
|
654
|
-
"focus-visible",
|
|
655
|
-
// Negated interaction
|
|
656
|
-
"not-hover",
|
|
657
|
-
"not-focus",
|
|
658
|
-
"not-active",
|
|
659
|
-
"not-visited",
|
|
660
|
-
"not-disabled",
|
|
661
|
-
"not-checked",
|
|
662
|
-
"not-pressed",
|
|
663
|
-
// Structural
|
|
664
|
-
"first",
|
|
665
|
-
"last",
|
|
666
|
-
"odd",
|
|
667
|
-
"even",
|
|
668
|
-
"only",
|
|
669
|
-
// Group / peer
|
|
670
|
-
"group-hover",
|
|
671
|
-
"group-focus",
|
|
672
|
-
"peer-hover",
|
|
673
|
-
"peer-focus",
|
|
674
|
-
// Responsive (handled separately but accepted)
|
|
675
|
-
"sm",
|
|
676
|
-
"md",
|
|
677
|
-
"lg",
|
|
678
|
-
"xl",
|
|
679
|
-
"2xl",
|
|
680
|
-
// Pseudo-elements (CSS-injection only; matchesMods returns false for these)
|
|
681
|
-
"before",
|
|
682
|
-
"after",
|
|
683
|
-
"selection",
|
|
684
|
-
"first-letter",
|
|
685
|
-
"first-line",
|
|
686
|
-
"marker",
|
|
687
|
-
// Print media modifier
|
|
688
|
-
"print",
|
|
689
|
-
// Orientation media modifiers (CSS-injection only)
|
|
690
|
-
"landscape",
|
|
691
|
-
"portrait",
|
|
692
|
-
// Accessibility media modifiers (CSS-injection only)
|
|
693
|
-
"motion-reduce",
|
|
694
|
-
"motion-safe",
|
|
695
|
-
"contrast-more",
|
|
696
|
-
"contrast-less",
|
|
697
|
-
// Directionality modifiers (CSS-injection only)
|
|
698
|
-
"rtl",
|
|
699
|
-
"ltr"
|
|
700
|
-
]);
|
|
701
|
-
var UTILITY_PREFIXES = [
|
|
702
|
-
// Multi-word flex
|
|
703
|
-
"flex-row-reverse",
|
|
704
|
-
"flex-col-reverse",
|
|
705
|
-
"flex-row",
|
|
706
|
-
"flex-col",
|
|
707
|
-
"flex-wrap-reverse",
|
|
708
|
-
"flex-wrap",
|
|
709
|
-
"flex-nowrap",
|
|
710
|
-
"flex-shrink-0",
|
|
711
|
-
"flex-shrink",
|
|
712
|
-
"flex-grow-0",
|
|
713
|
-
"flex-grow",
|
|
714
|
-
"items-start",
|
|
715
|
-
"items-end",
|
|
716
|
-
"items-center",
|
|
717
|
-
"items-baseline",
|
|
718
|
-
"items-stretch",
|
|
719
|
-
"justify-start",
|
|
720
|
-
"justify-end",
|
|
721
|
-
"justify-center",
|
|
722
|
-
"justify-between",
|
|
723
|
-
"justify-around",
|
|
724
|
-
"justify-evenly",
|
|
725
|
-
"content-start",
|
|
726
|
-
"content-end",
|
|
727
|
-
"content-center",
|
|
728
|
-
"content-between",
|
|
729
|
-
"content-around",
|
|
730
|
-
"content-evenly",
|
|
731
|
-
"self-start",
|
|
732
|
-
"self-end",
|
|
733
|
-
"self-center",
|
|
734
|
-
"self-auto",
|
|
735
|
-
"self-stretch",
|
|
736
|
-
"text-left",
|
|
737
|
-
"text-right",
|
|
738
|
-
"text-center",
|
|
739
|
-
"text-justify",
|
|
740
|
-
"font-thin",
|
|
741
|
-
"font-extralight",
|
|
742
|
-
"font-light",
|
|
743
|
-
"font-normal",
|
|
744
|
-
"font-medium",
|
|
745
|
-
"font-semibold",
|
|
746
|
-
"font-bold",
|
|
747
|
-
"font-extrabold",
|
|
748
|
-
"font-black",
|
|
749
|
-
"overflow-hidden",
|
|
750
|
-
"overflow-visible",
|
|
751
|
-
"overflow-scroll",
|
|
752
|
-
"overflow-auto",
|
|
753
|
-
"overflow-x-hidden",
|
|
754
|
-
"overflow-x-scroll",
|
|
755
|
-
"overflow-x-auto",
|
|
756
|
-
"overflow-y-hidden",
|
|
757
|
-
"overflow-y-scroll",
|
|
758
|
-
"overflow-y-auto",
|
|
759
|
-
"object-contain",
|
|
760
|
-
"object-cover",
|
|
761
|
-
"object-fill",
|
|
762
|
-
"object-none",
|
|
763
|
-
"object-scale-down",
|
|
764
|
-
"border-solid",
|
|
765
|
-
"border-dashed",
|
|
766
|
-
"border-dotted",
|
|
767
|
-
"border-none",
|
|
768
|
-
"border-t",
|
|
769
|
-
"border-r",
|
|
770
|
-
"border-b",
|
|
771
|
-
"border-l",
|
|
772
|
-
"rounded-tl",
|
|
773
|
-
"rounded-tr",
|
|
774
|
-
"rounded-bl",
|
|
775
|
-
"rounded-br",
|
|
776
|
-
"rounded-t",
|
|
777
|
-
"rounded-r",
|
|
778
|
-
"rounded-b",
|
|
779
|
-
"rounded-l",
|
|
780
|
-
"list-none",
|
|
781
|
-
"list-disc",
|
|
782
|
-
"list-decimal",
|
|
783
|
-
"cursor-auto",
|
|
784
|
-
"cursor-default",
|
|
785
|
-
"cursor-pointer",
|
|
786
|
-
"cursor-wait",
|
|
787
|
-
"cursor-text",
|
|
788
|
-
"cursor-move",
|
|
789
|
-
"cursor-not-allowed",
|
|
790
|
-
"select-none",
|
|
791
|
-
"select-text",
|
|
792
|
-
"select-all",
|
|
793
|
-
"select-auto",
|
|
794
|
-
"pointer-events-none",
|
|
795
|
-
"pointer-events-auto",
|
|
796
|
-
"whitespace-normal",
|
|
797
|
-
"whitespace-nowrap",
|
|
798
|
-
"whitespace-pre-wrap",
|
|
799
|
-
"whitespace-pre-line",
|
|
800
|
-
"whitespace-pre",
|
|
801
|
-
"break-normal",
|
|
802
|
-
"break-words",
|
|
803
|
-
"break-all",
|
|
804
|
-
"break-keep",
|
|
805
|
-
"bg-clip-border",
|
|
806
|
-
"bg-clip-padding",
|
|
807
|
-
"bg-clip-content",
|
|
808
|
-
"bg-clip-text",
|
|
809
|
-
"bg-gradient-to",
|
|
810
|
-
"resize-none",
|
|
811
|
-
"resize-y",
|
|
812
|
-
"resize-x",
|
|
813
|
-
"box-border",
|
|
814
|
-
"box-content",
|
|
815
|
-
"gap-x",
|
|
816
|
-
"gap-y",
|
|
817
|
-
"inset-x",
|
|
818
|
-
"inset-y",
|
|
819
|
-
"divide-x",
|
|
820
|
-
"divide-y",
|
|
821
|
-
"space-x",
|
|
822
|
-
"space-y",
|
|
823
|
-
"translate-x",
|
|
824
|
-
"translate-y",
|
|
825
|
-
"scale-x",
|
|
826
|
-
"scale-y",
|
|
827
|
-
"skew-x",
|
|
828
|
-
"skew-y",
|
|
829
|
-
// Transform origin (single prefix, value carries direction)
|
|
830
|
-
"origin",
|
|
831
|
-
"min-w",
|
|
832
|
-
"min-h",
|
|
833
|
-
"max-w",
|
|
834
|
-
"max-h",
|
|
835
|
-
"ring-offset",
|
|
836
|
-
"bg-opacity",
|
|
837
|
-
"text-opacity",
|
|
838
|
-
"border-opacity",
|
|
839
|
-
// Grid placement
|
|
840
|
-
"col-span",
|
|
841
|
-
"col-start",
|
|
842
|
-
"col-end",
|
|
843
|
-
"row-span",
|
|
844
|
-
"row-start",
|
|
845
|
-
"row-end",
|
|
846
|
-
"grid-cols",
|
|
847
|
-
"grid-rows",
|
|
848
|
-
"grid-flow",
|
|
849
|
-
"auto-cols",
|
|
850
|
-
"auto-rows",
|
|
851
|
-
// Grid alignment
|
|
852
|
-
"place-items",
|
|
853
|
-
"place-content",
|
|
854
|
-
"place-self",
|
|
855
|
-
"justify-items",
|
|
856
|
-
"justify-self",
|
|
857
|
-
// Backdrop filters (longer than 'backdrop' alone)
|
|
858
|
-
"backdrop-blur",
|
|
859
|
-
"backdrop-brightness",
|
|
860
|
-
"backdrop-contrast",
|
|
861
|
-
"backdrop-grayscale",
|
|
862
|
-
"backdrop-hue-rotate",
|
|
863
|
-
"backdrop-invert",
|
|
864
|
-
"backdrop-opacity",
|
|
865
|
-
"backdrop-saturate",
|
|
866
|
-
"backdrop-sepia",
|
|
867
|
-
"backdrop-filter",
|
|
868
|
-
// Filters
|
|
869
|
-
"drop-shadow",
|
|
870
|
-
"hue-rotate",
|
|
871
|
-
"text-shadow",
|
|
872
|
-
"underline-offset",
|
|
873
|
-
"outline-offset",
|
|
874
|
-
"will-change",
|
|
875
|
-
"mix-blend",
|
|
876
|
-
"bg-blend",
|
|
877
|
-
"decoration",
|
|
878
|
-
"perspective",
|
|
879
|
-
"tint",
|
|
880
|
-
"animate",
|
|
881
|
-
// Single-word prefixes last
|
|
882
|
-
"appearance-none",
|
|
883
|
-
"outline-none",
|
|
884
|
-
"outline",
|
|
885
|
-
"inline-flex",
|
|
886
|
-
"inline-block",
|
|
887
|
-
"inline-grid",
|
|
888
|
-
"italic",
|
|
889
|
-
"non-italic",
|
|
890
|
-
"underline",
|
|
891
|
-
"overline",
|
|
892
|
-
"line-through",
|
|
893
|
-
"no-underline",
|
|
894
|
-
"uppercase",
|
|
895
|
-
"lowercase",
|
|
896
|
-
"capitalize",
|
|
897
|
-
"normal-case",
|
|
898
|
-
"antialiased",
|
|
899
|
-
"subpixel-antialiased",
|
|
900
|
-
"overflow-ellipsis",
|
|
901
|
-
"truncate",
|
|
902
|
-
"sr-only",
|
|
903
|
-
"not-sr-only",
|
|
904
|
-
"relative",
|
|
905
|
-
"absolute",
|
|
906
|
-
"fixed",
|
|
907
|
-
"sticky",
|
|
908
|
-
"static",
|
|
909
|
-
"visible",
|
|
910
|
-
"invisible",
|
|
911
|
-
"hidden",
|
|
912
|
-
"contents",
|
|
913
|
-
"flow-root",
|
|
914
|
-
"block",
|
|
915
|
-
"inline",
|
|
916
|
-
"flex",
|
|
917
|
-
"grid",
|
|
918
|
-
"resize",
|
|
919
|
-
"appearance",
|
|
920
|
-
"border",
|
|
921
|
-
"rounded",
|
|
922
|
-
"shadow",
|
|
923
|
-
"size",
|
|
924
|
-
"opacity",
|
|
925
|
-
"leading",
|
|
926
|
-
"tracking",
|
|
927
|
-
"line-clamp",
|
|
928
|
-
"basis",
|
|
929
|
-
"grow",
|
|
930
|
-
"shrink",
|
|
931
|
-
"order",
|
|
932
|
-
"delay",
|
|
933
|
-
"duration",
|
|
934
|
-
"scale",
|
|
935
|
-
"rotate",
|
|
936
|
-
"aspect",
|
|
937
|
-
"columns",
|
|
938
|
-
"ring",
|
|
939
|
-
"gap",
|
|
940
|
-
"inset",
|
|
941
|
-
"filter",
|
|
942
|
-
"transform",
|
|
943
|
-
"blur",
|
|
944
|
-
"brightness",
|
|
945
|
-
"contrast",
|
|
946
|
-
"grayscale",
|
|
947
|
-
"invert",
|
|
948
|
-
"saturate",
|
|
949
|
-
"sepia",
|
|
950
|
-
"bg",
|
|
951
|
-
"text",
|
|
952
|
-
"font",
|
|
953
|
-
"caret",
|
|
954
|
-
"accent",
|
|
955
|
-
"from",
|
|
956
|
-
"via",
|
|
957
|
-
"to",
|
|
958
|
-
"divide",
|
|
959
|
-
"space",
|
|
960
|
-
"transition",
|
|
961
|
-
"px",
|
|
962
|
-
"py",
|
|
963
|
-
"pt",
|
|
964
|
-
"pr",
|
|
965
|
-
"pb",
|
|
966
|
-
"pl",
|
|
967
|
-
"p",
|
|
968
|
-
"mx",
|
|
969
|
-
"my",
|
|
970
|
-
"mt",
|
|
971
|
-
"mr",
|
|
972
|
-
"mb",
|
|
973
|
-
"ml",
|
|
974
|
-
"m",
|
|
975
|
-
"w",
|
|
976
|
-
"h",
|
|
977
|
-
"top",
|
|
978
|
-
"right",
|
|
979
|
-
"bottom",
|
|
980
|
-
"left",
|
|
981
|
-
"z",
|
|
982
|
-
"col",
|
|
983
|
-
"row"
|
|
984
|
-
];
|
|
985
|
-
var SORTED_PREFIXES = [...new Set(UTILITY_PREFIXES)].sort((a, b) => b.length - a.length);
|
|
986
|
-
var STANDALONE_UTILITIES = /* @__PURE__ */ new Set([
|
|
987
|
-
// Display
|
|
988
|
-
"flex",
|
|
989
|
-
"block",
|
|
990
|
-
"inline-block",
|
|
991
|
-
"inline",
|
|
992
|
-
"grid",
|
|
993
|
-
"inline-flex",
|
|
994
|
-
"inline-grid",
|
|
995
|
-
"grd",
|
|
996
|
-
"hidden",
|
|
997
|
-
"contents",
|
|
998
|
-
"flow-root",
|
|
999
|
-
// Position
|
|
1000
|
-
"relative",
|
|
1001
|
-
"absolute",
|
|
1002
|
-
"fixed",
|
|
1003
|
-
"sticky",
|
|
1004
|
-
"static",
|
|
1005
|
-
// Visibility
|
|
1006
|
-
"visible",
|
|
1007
|
-
"invisible",
|
|
1008
|
-
// Typography
|
|
1009
|
-
"uppercase",
|
|
1010
|
-
"lowercase",
|
|
1011
|
-
"capitalize",
|
|
1012
|
-
"normal-case",
|
|
1013
|
-
"italic",
|
|
1014
|
-
"non-italic",
|
|
1015
|
-
"underline",
|
|
1016
|
-
"overline",
|
|
1017
|
-
"line-through",
|
|
1018
|
-
"no-underline",
|
|
1019
|
-
"truncate",
|
|
1020
|
-
"antialiased",
|
|
1021
|
-
"sr-only",
|
|
1022
|
-
"not-sr-only",
|
|
1023
|
-
// Font variant numeric
|
|
1024
|
-
"normal-nums",
|
|
1025
|
-
"ordinal",
|
|
1026
|
-
"slashed-zero",
|
|
1027
|
-
"lining-nums",
|
|
1028
|
-
"oldstyle-nums",
|
|
1029
|
-
"proportional-nums",
|
|
1030
|
-
"tabular-nums",
|
|
1031
|
-
"diagonal-fractions",
|
|
1032
|
-
"stacked-fractions",
|
|
1033
|
-
// Flexbox
|
|
1034
|
-
"flex-row",
|
|
1035
|
-
"flex-col",
|
|
1036
|
-
"flex-row-reverse",
|
|
1037
|
-
"flex-col-reverse",
|
|
1038
|
-
"flex-wrap",
|
|
1039
|
-
"flex-wrap-reverse",
|
|
1040
|
-
"flex-nowrap",
|
|
1041
|
-
"flex-shrink",
|
|
1042
|
-
"flex-shrink-0",
|
|
1043
|
-
"flex-grow",
|
|
1044
|
-
"flex-grow-0",
|
|
1045
|
-
"items-start",
|
|
1046
|
-
"items-end",
|
|
1047
|
-
"items-center",
|
|
1048
|
-
"items-baseline",
|
|
1049
|
-
"items-stretch",
|
|
1050
|
-
"justify-start",
|
|
1051
|
-
"justify-end",
|
|
1052
|
-
"justify-center",
|
|
1053
|
-
"justify-between",
|
|
1054
|
-
"justify-around",
|
|
1055
|
-
"justify-evenly",
|
|
1056
|
-
"content-start",
|
|
1057
|
-
"content-end",
|
|
1058
|
-
"content-center",
|
|
1059
|
-
"content-between",
|
|
1060
|
-
"content-around",
|
|
1061
|
-
"content-evenly",
|
|
1062
|
-
"content-stretch",
|
|
1063
|
-
"self-start",
|
|
1064
|
-
"self-end",
|
|
1065
|
-
"self-center",
|
|
1066
|
-
"self-auto",
|
|
1067
|
-
"self-stretch",
|
|
1068
|
-
"self-baseline",
|
|
1069
|
-
// Text align
|
|
1070
|
-
"text-left",
|
|
1071
|
-
"text-right",
|
|
1072
|
-
"text-center",
|
|
1073
|
-
"text-justify",
|
|
1074
|
-
// Font weight shortcuts
|
|
1075
|
-
"font-thin",
|
|
1076
|
-
"font-extralight",
|
|
1077
|
-
"font-light",
|
|
1078
|
-
"font-normal",
|
|
1079
|
-
"font-medium",
|
|
1080
|
-
"font-semibold",
|
|
1081
|
-
"font-bold",
|
|
1082
|
-
"font-extrabold",
|
|
1083
|
-
"font-black",
|
|
1084
|
-
// Overflow
|
|
1085
|
-
"overflow-hidden",
|
|
1086
|
-
"overflow-visible",
|
|
1087
|
-
"overflow-scroll",
|
|
1088
|
-
"overflow-auto",
|
|
1089
|
-
"overflow-x-hidden",
|
|
1090
|
-
"overflow-x-scroll",
|
|
1091
|
-
"overflow-x-auto",
|
|
1092
|
-
"overflow-y-hidden",
|
|
1093
|
-
"overflow-y-scroll",
|
|
1094
|
-
"overflow-y-auto",
|
|
1095
|
-
// Object fit
|
|
1096
|
-
"object-contain",
|
|
1097
|
-
"object-cover",
|
|
1098
|
-
"object-fill",
|
|
1099
|
-
"object-none",
|
|
1100
|
-
"object-scale-down",
|
|
1101
|
-
// Object position
|
|
1102
|
-
"object-center",
|
|
1103
|
-
"object-top",
|
|
1104
|
-
"object-bottom",
|
|
1105
|
-
"object-left",
|
|
1106
|
-
"object-right",
|
|
1107
|
-
"object-left-top",
|
|
1108
|
-
"object-left-bottom",
|
|
1109
|
-
"object-right-top",
|
|
1110
|
-
"object-right-bottom",
|
|
1111
|
-
// Border
|
|
1112
|
-
"border-solid",
|
|
1113
|
-
"border-dashed",
|
|
1114
|
-
"border-dotted",
|
|
1115
|
-
"border-none",
|
|
1116
|
-
"border-t",
|
|
1117
|
-
"border-r",
|
|
1118
|
-
"border-b",
|
|
1119
|
-
"border-l",
|
|
1120
|
-
"border-collapse",
|
|
1121
|
-
"border-separate",
|
|
1122
|
-
// Lists
|
|
1123
|
-
"list-none",
|
|
1124
|
-
"list-disc",
|
|
1125
|
-
"list-decimal",
|
|
1126
|
-
"list-inside",
|
|
1127
|
-
"list-outside",
|
|
1128
|
-
// Cursor / select
|
|
1129
|
-
"cursor-auto",
|
|
1130
|
-
"cursor-default",
|
|
1131
|
-
"cursor-pointer",
|
|
1132
|
-
"cursor-wait",
|
|
1133
|
-
"cursor-text",
|
|
1134
|
-
"cursor-move",
|
|
1135
|
-
"cursor-not-allowed",
|
|
1136
|
-
"select-none",
|
|
1137
|
-
"select-text",
|
|
1138
|
-
"select-all",
|
|
1139
|
-
"select-auto",
|
|
1140
|
-
"pointer-events-none",
|
|
1141
|
-
"pointer-events-auto",
|
|
1142
|
-
// Whitespace / word break
|
|
1143
|
-
"whitespace-normal",
|
|
1144
|
-
"whitespace-nowrap",
|
|
1145
|
-
"whitespace-pre",
|
|
1146
|
-
"whitespace-pre-wrap",
|
|
1147
|
-
"whitespace-pre-line",
|
|
1148
|
-
"break-normal",
|
|
1149
|
-
"break-words",
|
|
1150
|
-
"break-all",
|
|
1151
|
-
// Background clip
|
|
1152
|
-
"bg-clip-border",
|
|
1153
|
-
"bg-clip-padding",
|
|
1154
|
-
"bg-clip-content",
|
|
1155
|
-
"bg-clip-text",
|
|
1156
|
-
// Background size
|
|
1157
|
-
"bg-auto",
|
|
1158
|
-
"bg-cover",
|
|
1159
|
-
"bg-contain",
|
|
1160
|
-
// Background position
|
|
1161
|
-
"bg-center",
|
|
1162
|
-
"bg-top",
|
|
1163
|
-
"bg-bottom",
|
|
1164
|
-
"bg-left",
|
|
1165
|
-
"bg-right",
|
|
1166
|
-
"bg-left-top",
|
|
1167
|
-
"bg-left-bottom",
|
|
1168
|
-
"bg-right-top",
|
|
1169
|
-
"bg-right-bottom",
|
|
1170
|
-
// Background repeat
|
|
1171
|
-
"bg-repeat",
|
|
1172
|
-
"bg-no-repeat",
|
|
1173
|
-
"bg-repeat-x",
|
|
1174
|
-
"bg-repeat-y",
|
|
1175
|
-
"bg-repeat-round",
|
|
1176
|
-
"bg-repeat-space",
|
|
1177
|
-
// Background attachment
|
|
1178
|
-
"bg-fixed",
|
|
1179
|
-
"bg-local",
|
|
1180
|
-
"bg-scroll",
|
|
1181
|
-
// Background image
|
|
1182
|
-
"bg-none",
|
|
1183
|
-
// Box sizing
|
|
1184
|
-
"box-border",
|
|
1185
|
-
"box-content",
|
|
1186
|
-
// Resize
|
|
1187
|
-
"resize",
|
|
1188
|
-
"resize-none",
|
|
1189
|
-
"resize-y",
|
|
1190
|
-
"resize-x",
|
|
1191
|
-
// Outline
|
|
1192
|
-
"appearance-none",
|
|
1193
|
-
"outline-none",
|
|
1194
|
-
"outline",
|
|
1195
|
-
// Table
|
|
1196
|
-
"table",
|
|
1197
|
-
"table-auto",
|
|
1198
|
-
"table-fixed",
|
|
1199
|
-
"caption-top",
|
|
1200
|
-
"caption-bottom",
|
|
1201
|
-
// CSS filters (standalone = default/full effect)
|
|
1202
|
-
"grayscale",
|
|
1203
|
-
"invert",
|
|
1204
|
-
"sepia",
|
|
1205
|
-
// Isolation
|
|
1206
|
-
"isolate",
|
|
1207
|
-
"isolation-auto",
|
|
1208
|
-
// Backface visibility (both platforms)
|
|
1209
|
-
"backface-visible",
|
|
1210
|
-
"backface-hidden",
|
|
1211
|
-
// Divide none
|
|
1212
|
-
"divide-none",
|
|
1213
|
-
// Group / peer markers (no-op style; needed so isKnownUtility recognises them)
|
|
1214
|
-
"group",
|
|
1215
|
-
"peer",
|
|
1216
|
-
// Text-wrap (web-only)
|
|
1217
|
-
"text-wrap",
|
|
1218
|
-
"text-nowrap",
|
|
1219
|
-
"text-balance",
|
|
1220
|
-
"text-pretty",
|
|
1221
|
-
// Screen sizing
|
|
1222
|
-
"w-screen",
|
|
1223
|
-
"min-h-screen",
|
|
1224
|
-
"max-h-screen",
|
|
1225
|
-
"min-w-screen",
|
|
1226
|
-
"max-w-screen",
|
|
1227
|
-
// max-w named container sizes (Tailwind compat)
|
|
1228
|
-
"max-w-none",
|
|
1229
|
-
"max-w-xs",
|
|
1230
|
-
"max-w-sm",
|
|
1231
|
-
"max-w-md",
|
|
1232
|
-
"max-w-lg",
|
|
1233
|
-
"max-w-xl",
|
|
1234
|
-
"max-w-2xl",
|
|
1235
|
-
"max-w-3xl",
|
|
1236
|
-
"max-w-4xl",
|
|
1237
|
-
"max-w-5xl",
|
|
1238
|
-
"max-w-6xl",
|
|
1239
|
-
"max-w-7xl",
|
|
1240
|
-
"max-w-prose",
|
|
1241
|
-
// Extended cursors (web-only)
|
|
1242
|
-
"cursor-grab",
|
|
1243
|
-
"cursor-grabbing",
|
|
1244
|
-
"cursor-zoom-in",
|
|
1245
|
-
"cursor-zoom-out",
|
|
1246
|
-
"cursor-crosshair",
|
|
1247
|
-
"cursor-help",
|
|
1248
|
-
"cursor-none",
|
|
1249
|
-
// Overflow clip (web-only)
|
|
1250
|
-
"overflow-clip",
|
|
1251
|
-
"overflow-x-clip",
|
|
1252
|
-
"overflow-y-clip",
|
|
1253
|
-
// Scroll behavior (web-only)
|
|
1254
|
-
"scroll-smooth",
|
|
1255
|
-
"scroll-auto",
|
|
1256
|
-
// Float & clear (web-only)
|
|
1257
|
-
"float-left",
|
|
1258
|
-
"float-right",
|
|
1259
|
-
"float-start",
|
|
1260
|
-
"float-end",
|
|
1261
|
-
"float-none",
|
|
1262
|
-
"clear-left",
|
|
1263
|
-
"clear-right",
|
|
1264
|
-
"clear-both",
|
|
1265
|
-
"clear-start",
|
|
1266
|
-
"clear-end",
|
|
1267
|
-
"clear-none",
|
|
1268
|
-
// Vertical align (web-only)
|
|
1269
|
-
"align-baseline",
|
|
1270
|
-
"align-top",
|
|
1271
|
-
"align-middle",
|
|
1272
|
-
"align-bottom",
|
|
1273
|
-
"align-text-top",
|
|
1274
|
-
"align-text-bottom",
|
|
1275
|
-
"align-sub",
|
|
1276
|
-
"align-super",
|
|
1277
|
-
// Touch action (web-only)
|
|
1278
|
-
"touch-auto",
|
|
1279
|
-
"touch-none",
|
|
1280
|
-
"touch-pan-x",
|
|
1281
|
-
"touch-pan-y",
|
|
1282
|
-
"touch-pan-left",
|
|
1283
|
-
"touch-pan-right",
|
|
1284
|
-
"touch-pan-up",
|
|
1285
|
-
"touch-pan-down",
|
|
1286
|
-
"touch-pinch-zoom",
|
|
1287
|
-
"touch-manipulation"
|
|
1288
|
-
]);
|
|
1289
|
-
function parseClass(className) {
|
|
1290
|
-
const trimmed = className.trim();
|
|
1291
|
-
if (!trimmed) return null;
|
|
1292
|
-
const modifiers = [];
|
|
1293
|
-
let remaining = trimmed;
|
|
1294
|
-
for (let i = 0; i < 3; i++) {
|
|
1295
|
-
const colonIdx = findOuterColon(remaining);
|
|
1296
|
-
if (colonIdx === -1) break;
|
|
1297
|
-
const candidate = remaining.slice(0, colonIdx);
|
|
1298
|
-
if (MODIFIERS.has(candidate) || PLUGIN_MODIFIERS.has(candidate)) {
|
|
1299
|
-
modifiers.push(candidate);
|
|
1300
|
-
remaining = remaining.slice(colonIdx + 1);
|
|
1301
|
-
} else {
|
|
1302
|
-
break;
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
let important = false;
|
|
1306
|
-
if (remaining.startsWith("!") && remaining.length > 1) {
|
|
1307
|
-
important = true;
|
|
1308
|
-
remaining = remaining.slice(1);
|
|
1309
|
-
}
|
|
1310
|
-
let negative = false;
|
|
1311
|
-
if (remaining.startsWith("-") && remaining.length > 1 && remaining[1] !== "-") {
|
|
1312
|
-
negative = true;
|
|
1313
|
-
remaining = remaining.slice(1);
|
|
1314
|
-
}
|
|
1315
|
-
const bracketStart = remaining.lastIndexOf("-[");
|
|
1316
|
-
if (bracketStart > 0 && remaining.endsWith("]")) {
|
|
1317
|
-
const utility = remaining.slice(0, bracketStart);
|
|
1318
|
-
const value = remaining.slice(bracketStart + 2, -1).replace(/_/g, " ");
|
|
1319
|
-
return { original: trimmed, modifiers, negative, important, utility, value, isArbitrary: true };
|
|
1320
|
-
}
|
|
1321
|
-
if (STANDALONE_UTILITIES.has(remaining)) {
|
|
1322
|
-
return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
|
|
1323
|
-
}
|
|
1324
|
-
for (const prefix of SORTED_PREFIXES) {
|
|
1325
|
-
if (remaining === prefix) {
|
|
1326
|
-
return { original: trimmed, modifiers, negative, important, utility: prefix, value: "", isArbitrary: false };
|
|
1327
|
-
}
|
|
1328
|
-
if (remaining.startsWith(prefix + "-")) {
|
|
1329
|
-
const value = remaining.slice(prefix.length + 1);
|
|
1330
|
-
return { original: trimmed, modifiers, negative, important, utility: prefix, value, isArbitrary: false };
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
const firstDash = remaining.indexOf("-");
|
|
1334
|
-
if (firstDash > 0) {
|
|
1335
|
-
return {
|
|
1336
|
-
original: trimmed,
|
|
1337
|
-
modifiers,
|
|
1338
|
-
negative,
|
|
1339
|
-
important,
|
|
1340
|
-
utility: remaining.slice(0, firstDash),
|
|
1341
|
-
value: remaining.slice(firstDash + 1),
|
|
1342
|
-
isArbitrary: false
|
|
1343
|
-
};
|
|
1344
|
-
}
|
|
1345
|
-
return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
|
|
714
|
+
for (const k of Object.keys(_pluginModifiers)) delete _pluginModifiers[k];
|
|
715
|
+
_invalidate();
|
|
1346
716
|
}
|
|
1347
|
-
function
|
|
1348
|
-
|
|
1349
|
-
let current = "";
|
|
1350
|
-
let depth = 0;
|
|
1351
|
-
for (let i = 0; i < classString.length; i++) {
|
|
1352
|
-
const ch = classString[i];
|
|
1353
|
-
if (ch === "[") {
|
|
1354
|
-
depth++;
|
|
1355
|
-
current += ch;
|
|
1356
|
-
continue;
|
|
1357
|
-
}
|
|
1358
|
-
if (ch === "]") {
|
|
1359
|
-
depth--;
|
|
1360
|
-
current += ch;
|
|
1361
|
-
continue;
|
|
1362
|
-
}
|
|
1363
|
-
if (/\s/.test(ch)) {
|
|
1364
|
-
if (depth === 0) {
|
|
1365
|
-
if (current) {
|
|
1366
|
-
tokens.push(current);
|
|
1367
|
-
current = "";
|
|
1368
|
-
}
|
|
1369
|
-
}
|
|
1370
|
-
} else {
|
|
1371
|
-
current += ch;
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
if (current) tokens.push(current);
|
|
1375
|
-
return tokens;
|
|
717
|
+
function getModifier(name) {
|
|
718
|
+
return BUILTIN_MODIFIERS[name] ?? _pluginModifiers[name];
|
|
1376
719
|
}
|
|
1377
|
-
function
|
|
1378
|
-
return
|
|
720
|
+
function isKnownModifier(name) {
|
|
721
|
+
return name in BUILTIN_MODIFIERS || name in _pluginModifiers;
|
|
1379
722
|
}
|
|
1380
|
-
function
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
723
|
+
function _allEntries() {
|
|
724
|
+
return [...Object.entries(BUILTIN_MODIFIERS), ...Object.entries(_pluginModifiers)];
|
|
725
|
+
}
|
|
726
|
+
function getInteractiveModifiers() {
|
|
727
|
+
if (!_interactiveNames) {
|
|
728
|
+
_interactiveNames = new Set(_allEntries().filter(([, d]) => d.jsBehavior === "interactive").map(([k]) => k));
|
|
1385
729
|
}
|
|
1386
|
-
return
|
|
730
|
+
return _interactiveNames;
|
|
1387
731
|
}
|
|
1388
|
-
function
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
const ch = s[i];
|
|
1392
|
-
if (ch === "[") depth++;
|
|
1393
|
-
else if (ch === "]") depth--;
|
|
1394
|
-
else if (ch === ":" && depth === 0) return i;
|
|
732
|
+
function getModeModifiers() {
|
|
733
|
+
if (!_modeNames) {
|
|
734
|
+
_modeNames = new Set(_allEntries().filter(([, d]) => d.jsBehavior === "mode").map(([k]) => k));
|
|
1395
735
|
}
|
|
1396
|
-
return
|
|
736
|
+
return _modeNames;
|
|
737
|
+
}
|
|
738
|
+
function getResponsiveModifiers() {
|
|
739
|
+
if (!_responsiveNames) {
|
|
740
|
+
_responsiveNames = new Set(_allEntries().filter(([, d]) => d.jsBehavior === "responsive").map(([k]) => k));
|
|
741
|
+
}
|
|
742
|
+
return _responsiveNames;
|
|
743
|
+
}
|
|
744
|
+
function matchModifier(name, isDark, state, breakpoints) {
|
|
745
|
+
return getModifier(name)?.jsMatch?.(isDark, state, breakpoints) ?? false;
|
|
1397
746
|
}
|
|
1398
747
|
|
|
1399
748
|
// src/core/utilities.ts
|
|
@@ -1487,6 +836,7 @@ function resolveSizing(value, spacing, isArbitrary) {
|
|
|
1487
836
|
if (raw !== void 0) return raw;
|
|
1488
837
|
if (/^\d+\/\d+$/.test(value)) {
|
|
1489
838
|
const [num, den] = value.split("/").map(Number);
|
|
839
|
+
if (!den) return null;
|
|
1490
840
|
return `${(num / den * 100).toFixed(6)}%`;
|
|
1491
841
|
}
|
|
1492
842
|
return null;
|
|
@@ -3001,10 +2351,10 @@ function resolveUtility(parsed, theme) {
|
|
|
3001
2351
|
if (!parsed.value) {
|
|
3002
2352
|
if (parsed.utility in PLUGIN_STANDALONE) return PLUGIN_STANDALONE[parsed.utility] ?? null;
|
|
3003
2353
|
if (parsed.utility === "grd" || parsed.utility === "grid") {
|
|
3004
|
-
return { display: "grid" };
|
|
2354
|
+
return getEffectiveIsWeb() ? { display: "grid" } : null;
|
|
3005
2355
|
}
|
|
3006
2356
|
if (parsed.utility === "inline-grid") {
|
|
3007
|
-
return { display: "inline-grid" };
|
|
2357
|
+
return getEffectiveIsWeb() ? { display: "inline-grid" } : null;
|
|
3008
2358
|
}
|
|
3009
2359
|
if (parsed.utility in getStandalone()) return getStandalone()[parsed.utility] ?? null;
|
|
3010
2360
|
}
|
|
@@ -3017,6 +2367,8 @@ var PLUGIN_RESOLVERS = {};
|
|
|
3017
2367
|
function clearPluginUtilities() {
|
|
3018
2368
|
for (const key of Object.keys(PLUGIN_STANDALONE)) delete PLUGIN_STANDALONE[key];
|
|
3019
2369
|
for (const key of Object.keys(PLUGIN_RESOLVERS)) delete PLUGIN_RESOLVERS[key];
|
|
2370
|
+
_sortedPrefixes = null;
|
|
2371
|
+
_standaloneNames = null;
|
|
3020
2372
|
}
|
|
3021
2373
|
function getPluginStandaloneMap() {
|
|
3022
2374
|
return PLUGIN_STANDALONE;
|
|
@@ -3024,6 +2376,129 @@ function getPluginStandaloneMap() {
|
|
|
3024
2376
|
function isKnownUtility(utility) {
|
|
3025
2377
|
return utility in getStandalone() || utility in RESOLVERS || utility in PLUGIN_STANDALONE || utility in PLUGIN_RESOLVERS;
|
|
3026
2378
|
}
|
|
2379
|
+
var _sortedPrefixes = null;
|
|
2380
|
+
var _standaloneNames = null;
|
|
2381
|
+
function getBuiltinUtilityPrefixes() {
|
|
2382
|
+
if (!_sortedPrefixes) {
|
|
2383
|
+
const all = [.../* @__PURE__ */ new Set([...Object.keys(RESOLVERS), ...Object.keys(PLUGIN_RESOLVERS)])];
|
|
2384
|
+
_sortedPrefixes = all.sort((a, b) => b.length - a.length);
|
|
2385
|
+
}
|
|
2386
|
+
return _sortedPrefixes;
|
|
2387
|
+
}
|
|
2388
|
+
function getBuiltinStandaloneNames() {
|
|
2389
|
+
if (!_standaloneNames) {
|
|
2390
|
+
_standaloneNames = /* @__PURE__ */ new Set([...Object.keys(getStandalone()), ...Object.keys(PLUGIN_STANDALONE)]);
|
|
2391
|
+
}
|
|
2392
|
+
return _standaloneNames;
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
// src/core/parser.ts
|
|
2396
|
+
function parseClass(className) {
|
|
2397
|
+
const trimmed = className.trim();
|
|
2398
|
+
if (!trimmed) return null;
|
|
2399
|
+
const modifiers = [];
|
|
2400
|
+
let remaining = trimmed;
|
|
2401
|
+
while (true) {
|
|
2402
|
+
const colonIdx = findOuterColon(remaining);
|
|
2403
|
+
if (colonIdx === -1) break;
|
|
2404
|
+
const candidate = remaining.slice(0, colonIdx);
|
|
2405
|
+
if (!isKnownModifier(candidate)) break;
|
|
2406
|
+
modifiers.push(candidate);
|
|
2407
|
+
remaining = remaining.slice(colonIdx + 1);
|
|
2408
|
+
}
|
|
2409
|
+
let important = false;
|
|
2410
|
+
if (remaining.startsWith("!") && remaining.length > 1) {
|
|
2411
|
+
important = true;
|
|
2412
|
+
remaining = remaining.slice(1);
|
|
2413
|
+
}
|
|
2414
|
+
let negative = false;
|
|
2415
|
+
if (remaining.startsWith("-") && remaining.length > 1 && remaining[1] !== "-") {
|
|
2416
|
+
negative = true;
|
|
2417
|
+
remaining = remaining.slice(1);
|
|
2418
|
+
}
|
|
2419
|
+
const bracketStart = remaining.lastIndexOf("-[");
|
|
2420
|
+
if (bracketStart > 0 && remaining.endsWith("]")) {
|
|
2421
|
+
const utility = remaining.slice(0, bracketStart);
|
|
2422
|
+
const value = remaining.slice(bracketStart + 2, -1).replace(/_/g, " ");
|
|
2423
|
+
return { original: trimmed, modifiers, negative, important, utility, value, isArbitrary: true };
|
|
2424
|
+
}
|
|
2425
|
+
if (getBuiltinStandaloneNames().has(remaining)) {
|
|
2426
|
+
return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
|
|
2427
|
+
}
|
|
2428
|
+
for (const prefix of getBuiltinUtilityPrefixes()) {
|
|
2429
|
+
if (remaining === prefix) {
|
|
2430
|
+
return { original: trimmed, modifiers, negative, important, utility: prefix, value: "", isArbitrary: false };
|
|
2431
|
+
}
|
|
2432
|
+
if (remaining.startsWith(prefix + "-")) {
|
|
2433
|
+
const value = remaining.slice(prefix.length + 1);
|
|
2434
|
+
return { original: trimmed, modifiers, negative, important, utility: prefix, value, isArbitrary: false };
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
const firstDash = remaining.indexOf("-");
|
|
2438
|
+
if (firstDash > 0) {
|
|
2439
|
+
return {
|
|
2440
|
+
original: trimmed,
|
|
2441
|
+
modifiers,
|
|
2442
|
+
negative,
|
|
2443
|
+
important,
|
|
2444
|
+
utility: remaining.slice(0, firstDash),
|
|
2445
|
+
value: remaining.slice(firstDash + 1),
|
|
2446
|
+
isArbitrary: false
|
|
2447
|
+
};
|
|
2448
|
+
}
|
|
2449
|
+
return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
|
|
2450
|
+
}
|
|
2451
|
+
function splitClassTokens(classString) {
|
|
2452
|
+
const tokens = [];
|
|
2453
|
+
let current = "";
|
|
2454
|
+
let depth = 0;
|
|
2455
|
+
for (let i = 0; i < classString.length; i++) {
|
|
2456
|
+
const ch = classString[i];
|
|
2457
|
+
if (ch === "[") {
|
|
2458
|
+
depth++;
|
|
2459
|
+
current += ch;
|
|
2460
|
+
continue;
|
|
2461
|
+
}
|
|
2462
|
+
if (ch === "]") {
|
|
2463
|
+
depth--;
|
|
2464
|
+
current += ch;
|
|
2465
|
+
continue;
|
|
2466
|
+
}
|
|
2467
|
+
if (/\s/.test(ch)) {
|
|
2468
|
+
if (depth === 0) {
|
|
2469
|
+
if (current) {
|
|
2470
|
+
tokens.push(current);
|
|
2471
|
+
current = "";
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
} else {
|
|
2475
|
+
current += ch;
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
if (current) tokens.push(current);
|
|
2479
|
+
return tokens;
|
|
2480
|
+
}
|
|
2481
|
+
function normalizeClassString(classString) {
|
|
2482
|
+
return splitClassTokens(classString).join(" ");
|
|
2483
|
+
}
|
|
2484
|
+
function parseClasses(classString) {
|
|
2485
|
+
const results = [];
|
|
2486
|
+
for (const token of splitClassTokens(classString)) {
|
|
2487
|
+
const parsed = parseClass(token);
|
|
2488
|
+
if (parsed) results.push(parsed);
|
|
2489
|
+
}
|
|
2490
|
+
return results;
|
|
2491
|
+
}
|
|
2492
|
+
function findOuterColon(s) {
|
|
2493
|
+
let depth = 0;
|
|
2494
|
+
for (let i = 0; i < s.length; i++) {
|
|
2495
|
+
const ch = s[i];
|
|
2496
|
+
if (ch === "[") depth++;
|
|
2497
|
+
else if (ch === "]") depth--;
|
|
2498
|
+
else if (ch === ":" && depth === 0) return i;
|
|
2499
|
+
}
|
|
2500
|
+
return -1;
|
|
2501
|
+
}
|
|
3027
2502
|
|
|
3028
2503
|
// src/core/responsiveStore.ts
|
|
3029
2504
|
var RESPONSIVE_KEY = "__kbach_responsive__";
|
|
@@ -3056,7 +2531,30 @@ function getActiveBreakpoints(width) {
|
|
|
3056
2531
|
}
|
|
3057
2532
|
|
|
3058
2533
|
// src/core/resolver.ts
|
|
3059
|
-
var
|
|
2534
|
+
var _themeCache = /* @__PURE__ */ new WeakMap();
|
|
2535
|
+
function getThemeCache(theme) {
|
|
2536
|
+
let cache = _themeCache.get(theme);
|
|
2537
|
+
if (!cache) {
|
|
2538
|
+
cache = new LRUCache(1e4);
|
|
2539
|
+
_themeCache.set(theme, cache);
|
|
2540
|
+
}
|
|
2541
|
+
return cache;
|
|
2542
|
+
}
|
|
2543
|
+
var _sortCache = /* @__PURE__ */ new WeakMap();
|
|
2544
|
+
function getSortedEntries(resolved) {
|
|
2545
|
+
let sorted = _sortCache.get(resolved);
|
|
2546
|
+
if (!sorted) {
|
|
2547
|
+
const entries = Object.entries(resolved);
|
|
2548
|
+
entries.sort((a, b) => {
|
|
2549
|
+
const pa = a[0] === "base" ? -1 : a[0].split(":").length;
|
|
2550
|
+
const pb = b[0] === "base" ? -1 : b[0].split(":").length;
|
|
2551
|
+
return pa - pb;
|
|
2552
|
+
});
|
|
2553
|
+
sorted = entries;
|
|
2554
|
+
_sortCache.set(resolved, sorted);
|
|
2555
|
+
}
|
|
2556
|
+
return sorted;
|
|
2557
|
+
}
|
|
3060
2558
|
var FONT_KEY = "__kbach_default_font__";
|
|
3061
2559
|
function setDefaultFontFamily(font) {
|
|
3062
2560
|
globalThis[FONT_KEY] = font;
|
|
@@ -3065,7 +2563,7 @@ function getDefaultFontFamily() {
|
|
|
3065
2563
|
return globalThis[FONT_KEY];
|
|
3066
2564
|
}
|
|
3067
2565
|
var _styleEl = null;
|
|
3068
|
-
var _injectedRules =
|
|
2566
|
+
var _injectedRules = new LRUCache(5e4);
|
|
3069
2567
|
function getStyleEl() {
|
|
3070
2568
|
if (_styleEl) return _styleEl;
|
|
3071
2569
|
_styleEl = document.createElement("style");
|
|
@@ -3075,7 +2573,7 @@ function getStyleEl() {
|
|
|
3075
2573
|
}
|
|
3076
2574
|
function injectRule(rule) {
|
|
3077
2575
|
if (_injectedRules.has(rule)) return;
|
|
3078
|
-
_injectedRules.
|
|
2576
|
+
_injectedRules.set(rule, true);
|
|
3079
2577
|
try {
|
|
3080
2578
|
getStyleEl().sheet?.insertRule(rule, getStyleEl().sheet.cssRules.length);
|
|
3081
2579
|
} catch {
|
|
@@ -3099,150 +2597,20 @@ function injectGlobalStyles(theme) {
|
|
|
3099
2597
|
}
|
|
3100
2598
|
getGlobalStyleEl().textContent = rules.join("\n");
|
|
3101
2599
|
}
|
|
3102
|
-
var MODIFIER_TO_PSEUDO = {
|
|
3103
|
-
hover: ":hover",
|
|
3104
|
-
focus: ":focus",
|
|
3105
|
-
"focus-within": ":focus-within",
|
|
3106
|
-
"focus-visible": ":focus-visible",
|
|
3107
|
-
active: ":active",
|
|
3108
|
-
pressed: ":active",
|
|
3109
|
-
disabled: ":disabled",
|
|
3110
|
-
checked: ":checked",
|
|
3111
|
-
visited: ":visited",
|
|
3112
|
-
placeholder: "::placeholder",
|
|
3113
|
-
first: ":first-child",
|
|
3114
|
-
last: ":last-child",
|
|
3115
|
-
odd: ":nth-child(odd)",
|
|
3116
|
-
even: ":nth-child(even)",
|
|
3117
|
-
only: ":only-child",
|
|
3118
|
-
"not-hover": ":not(:hover)",
|
|
3119
|
-
"not-focus": ":not(:focus)",
|
|
3120
|
-
"not-active": ":not(:active)",
|
|
3121
|
-
"not-pressed": ":not(:active)",
|
|
3122
|
-
"not-disabled": ":not(:disabled)",
|
|
3123
|
-
"not-checked": ":not(:checked)",
|
|
3124
|
-
"not-visited": ":not(:visited)",
|
|
3125
|
-
// Pseudo-elements (CSS-injection only; never applied as inline styles)
|
|
3126
|
-
before: "::before",
|
|
3127
|
-
after: "::after",
|
|
3128
|
-
selection: "::selection",
|
|
3129
|
-
"first-letter": "::first-letter",
|
|
3130
|
-
"first-line": "::first-line",
|
|
3131
|
-
marker: "::marker"
|
|
3132
|
-
};
|
|
3133
|
-
var GROUP_PEER_PREFIX = {
|
|
3134
|
-
"group-hover": ".group:hover",
|
|
3135
|
-
"group-focus": ".group:focus",
|
|
3136
|
-
"peer-hover": ".peer:hover ~",
|
|
3137
|
-
"peer-focus": ".peer:focus ~"
|
|
3138
|
-
};
|
|
3139
|
-
var MODE_MODS = /* @__PURE__ */ new Set(["dark", "light", "not-dark", "not-light"]);
|
|
3140
|
-
var RESPONSIVE_MODS = /* @__PURE__ */ new Set(["sm", "md", "lg", "xl", "2xl"]);
|
|
3141
|
-
var PRINT_MODS = /* @__PURE__ */ new Set(["print"]);
|
|
3142
|
-
var MEDIA_MODS = {
|
|
3143
|
-
landscape: "(orientation: landscape)",
|
|
3144
|
-
portrait: "(orientation: portrait)",
|
|
3145
|
-
"motion-reduce": "(prefers-reduced-motion: reduce)",
|
|
3146
|
-
"motion-safe": "(prefers-reduced-motion: no-preference)",
|
|
3147
|
-
"contrast-more": "(prefers-contrast: more)",
|
|
3148
|
-
"contrast-less": "(prefers-contrast: less)"
|
|
3149
|
-
};
|
|
3150
|
-
var DIR_MODS = {
|
|
3151
|
-
rtl: '[dir="rtl"]',
|
|
3152
|
-
ltr: '[dir="ltr"]'
|
|
3153
|
-
};
|
|
3154
2600
|
function buildDivideDecls(styles) {
|
|
3155
2601
|
const parts = [];
|
|
3156
2602
|
if ("__divideX" in styles) {
|
|
3157
2603
|
const w = Number(styles.__divideX);
|
|
3158
|
-
parts.push(`border-left-width: ${w}px
|
|
3159
|
-
parts.push("border-right-width: 0px");
|
|
2604
|
+
parts.push(`border-left-width: ${w}px`, "border-right-width: 0px");
|
|
3160
2605
|
}
|
|
3161
2606
|
if ("__divideY" in styles) {
|
|
3162
2607
|
const w = Number(styles.__divideY);
|
|
3163
|
-
parts.push(`border-top-width: ${w}px
|
|
3164
|
-
parts.push("border-bottom-width: 0px");
|
|
2608
|
+
parts.push(`border-top-width: ${w}px`, "border-bottom-width: 0px");
|
|
3165
2609
|
}
|
|
3166
2610
|
if ("__divideColor" in styles) parts.push(`border-color: ${String(styles.__divideColor)}`);
|
|
3167
2611
|
if ("__divideStyle" in styles) parts.push(`border-style: ${String(styles.__divideStyle)}`);
|
|
3168
2612
|
return parts.join("; ");
|
|
3169
2613
|
}
|
|
3170
|
-
function buildClassCSSRules(cls, bucketKey, styles, darkMode, important, screens) {
|
|
3171
|
-
const rules = [];
|
|
3172
|
-
if ("__keyframe" in styles && typeof styles.__keyframe === "string") {
|
|
3173
|
-
rules.push(styles.__keyframe);
|
|
3174
|
-
}
|
|
3175
|
-
const isDivide = "__divideX" in styles || "__divideY" in styles || "__divideColor" in styles || "__divideStyle" in styles;
|
|
3176
|
-
const escaped = escapeCSSSelector(cls);
|
|
3177
|
-
const childSuffix = isDivide ? " > * + *" : "";
|
|
3178
|
-
if (bucketKey === "base") {
|
|
3179
|
-
const baseCssDecls = isDivide ? buildDivideDecls(styles) : styleValueToCSS(styles, important);
|
|
3180
|
-
if (!baseCssDecls) return rules;
|
|
3181
|
-
rules.push(`.${escaped}${childSuffix} { ${baseCssDecls} }`);
|
|
3182
|
-
return rules;
|
|
3183
|
-
}
|
|
3184
|
-
const mods = bucketKey.split(":");
|
|
3185
|
-
const responsiveMods = mods.filter((m) => RESPONSIVE_MODS.has(m));
|
|
3186
|
-
const nonResponsiveMods = mods.filter((m) => !RESPONSIVE_MODS.has(m));
|
|
3187
|
-
const hasDark = nonResponsiveMods.includes("dark") || nonResponsiveMods.includes("not-light");
|
|
3188
|
-
const hasLight = nonResponsiveMods.includes("light") || nonResponsiveMods.includes("not-dark");
|
|
3189
|
-
const hasPrint = nonResponsiveMods.includes("print");
|
|
3190
|
-
const mediaMods = nonResponsiveMods.filter((m) => m in MEDIA_MODS);
|
|
3191
|
-
const dirMods = nonResponsiveMods.filter((m) => m in DIR_MODS);
|
|
3192
|
-
const ancestorMods = nonResponsiveMods.filter((m) => m in GROUP_PEER_PREFIX);
|
|
3193
|
-
const pseudoMods = nonResponsiveMods.filter(
|
|
3194
|
-
(m) => !MODE_MODS.has(m) && !(m in GROUP_PEER_PREFIX) && !PRINT_MODS.has(m) && !(m in MEDIA_MODS) && !(m in DIR_MODS)
|
|
3195
|
-
);
|
|
3196
|
-
const pseudoSuffix = pseudoMods.map((p) => MODIFIER_TO_PSEUDO[p] ?? `:${p}`).join("");
|
|
3197
|
-
const elementSelector = `.${escaped}${pseudoSuffix}${childSuffix}`;
|
|
3198
|
-
const ancestorPrefix = ancestorMods.length ? ancestorMods.map((m) => GROUP_PEER_PREFIX[m]).join(" ") + " " : "";
|
|
3199
|
-
const dirPrefix = dirMods.length ? dirMods.map((m) => DIR_MODS[m]).join(" ") + " " : "";
|
|
3200
|
-
const selector = `${dirPrefix}${ancestorPrefix}${elementSelector}`;
|
|
3201
|
-
const CSS_ONLY_PSEUDOS = /* @__PURE__ */ new Set([
|
|
3202
|
-
"first",
|
|
3203
|
-
"last",
|
|
3204
|
-
"odd",
|
|
3205
|
-
"even",
|
|
3206
|
-
"only",
|
|
3207
|
-
"focus-within",
|
|
3208
|
-
"focus-visible"
|
|
3209
|
-
]);
|
|
3210
|
-
const needsImportant = important || hasPrint || mediaMods.length > 0 || dirMods.length > 0 || ancestorMods.length > 0 || pseudoMods.some((m) => CSS_ONLY_PSEUDOS.has(m));
|
|
3211
|
-
const cssDecls = isDivide ? buildDivideDecls(styles) : styleValueToCSS(styles, needsImportant);
|
|
3212
|
-
if (!cssDecls) return rules;
|
|
3213
|
-
let rule;
|
|
3214
|
-
if (hasDark) {
|
|
3215
|
-
if (darkMode === "media") {
|
|
3216
|
-
rule = `@media (prefers-color-scheme: dark) { ${selector} { ${cssDecls} } }`;
|
|
3217
|
-
} else if (darkMode === "class") {
|
|
3218
|
-
rule = `.dark ${selector} { ${cssDecls} }`;
|
|
3219
|
-
} else {
|
|
3220
|
-
rule = `[data-theme="dark"] ${selector} { ${cssDecls} }`;
|
|
3221
|
-
}
|
|
3222
|
-
} else if (hasLight) {
|
|
3223
|
-
if (darkMode === "media") {
|
|
3224
|
-
rule = `@media (prefers-color-scheme: light) { ${selector} { ${cssDecls} } }`;
|
|
3225
|
-
} else if (darkMode === "class") {
|
|
3226
|
-
rule = `:not(.dark) ${selector} { ${cssDecls} }`;
|
|
3227
|
-
} else {
|
|
3228
|
-
rule = `[data-theme="light"] ${selector} { ${cssDecls} }`;
|
|
3229
|
-
}
|
|
3230
|
-
} else {
|
|
3231
|
-
rule = `${selector} { ${cssDecls} }`;
|
|
3232
|
-
}
|
|
3233
|
-
if (hasPrint) rule = `@media print { ${rule} }`;
|
|
3234
|
-
for (const m of mediaMods) rule = `@media ${MEDIA_MODS[m]} { ${rule} }`;
|
|
3235
|
-
if (responsiveMods.length > 0) {
|
|
3236
|
-
const minWidth = Math.max(...responsiveMods.map((m) => screens[m] ?? 0));
|
|
3237
|
-
if (minWidth > 0) rule = `@media (min-width: ${minWidth}px) { ${rule} }`;
|
|
3238
|
-
}
|
|
3239
|
-
rules.push(rule);
|
|
3240
|
-
return rules;
|
|
3241
|
-
}
|
|
3242
|
-
function injectClassRule(cls, bucketKey, styles, darkMode, important = false) {
|
|
3243
|
-
const cssRules = buildClassCSSRules(cls, bucketKey, styles, darkMode, important, getGlobalScreens());
|
|
3244
|
-
for (const r of cssRules) injectRule(r);
|
|
3245
|
-
}
|
|
3246
2614
|
var RN_ONLY_PROPS = /* @__PURE__ */ new Set([
|
|
3247
2615
|
"shadowColor",
|
|
3248
2616
|
"shadowOffset",
|
|
@@ -3252,13 +2620,10 @@ var RN_ONLY_PROPS = /* @__PURE__ */ new Set([
|
|
|
3252
2620
|
"includeFontPadding",
|
|
3253
2621
|
"textAlignVertical",
|
|
3254
2622
|
"writingDirection",
|
|
3255
|
-
// Text shadow native props — web uses the textShadow CSS shorthand instead
|
|
3256
2623
|
"textShadowColor",
|
|
3257
2624
|
"textShadowOffset",
|
|
3258
2625
|
"textShadowRadius",
|
|
3259
|
-
// tintColor is native-only (Image/icon tinting)
|
|
3260
2626
|
"tintColor",
|
|
3261
|
-
// Internal markers — handled specially, never serialized as CSS props
|
|
3262
2627
|
"__divideX",
|
|
3263
2628
|
"__divideY",
|
|
3264
2629
|
"__divideColor",
|
|
@@ -3300,8 +2665,7 @@ function styleValueToCSS(styles, forceImportant = false) {
|
|
|
3300
2665
|
const imp = forceImportant || prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") || prop === "position" && (cssVal === "sticky" || cssVal === "fixed" || cssVal === "static") ? " !important" : "";
|
|
3301
2666
|
if (prop in RN_SHORTHAND_EXPAND) {
|
|
3302
2667
|
const [p1, p2] = RN_SHORTHAND_EXPAND[prop];
|
|
3303
|
-
parts.push(`${p1}: ${cssVal}${imp}`);
|
|
3304
|
-
parts.push(`${p2}: ${cssVal}${imp}`);
|
|
2668
|
+
parts.push(`${p1}: ${cssVal}${imp}`, `${p2}: ${cssVal}${imp}`);
|
|
3305
2669
|
continue;
|
|
3306
2670
|
}
|
|
3307
2671
|
parts.push(`${camelToKebab(prop)}: ${cssVal}${imp}`);
|
|
@@ -3311,14 +2675,87 @@ function styleValueToCSS(styles, forceImportant = false) {
|
|
|
3311
2675
|
function camelToKebab(str) {
|
|
3312
2676
|
return str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
3313
2677
|
}
|
|
2678
|
+
function buildClassCSSRules(cls, bucketKey, styles, darkMode, important, screens) {
|
|
2679
|
+
const rules = [];
|
|
2680
|
+
if ("__keyframe" in styles && typeof styles.__keyframe === "string") {
|
|
2681
|
+
rules.push(styles.__keyframe);
|
|
2682
|
+
}
|
|
2683
|
+
const isDivide = "__divideX" in styles || "__divideY" in styles || "__divideColor" in styles || "__divideStyle" in styles;
|
|
2684
|
+
const escaped = escapeCSSSelector(cls);
|
|
2685
|
+
const childSuffix = isDivide ? " > * + *" : "";
|
|
2686
|
+
if (bucketKey === "base") {
|
|
2687
|
+
const decls2 = isDivide ? buildDivideDecls(styles) : styleValueToCSS(styles, important);
|
|
2688
|
+
if (!decls2) return rules;
|
|
2689
|
+
rules.push(`.${escaped}${childSuffix} { ${decls2} }`);
|
|
2690
|
+
return rules;
|
|
2691
|
+
}
|
|
2692
|
+
const mods = bucketKey.split(":");
|
|
2693
|
+
let darkScheme;
|
|
2694
|
+
let needsImportant = important;
|
|
2695
|
+
const pseudoParts = [];
|
|
2696
|
+
const ancestorParts = [];
|
|
2697
|
+
const dirParts = [];
|
|
2698
|
+
const mediaWrappers = [];
|
|
2699
|
+
let minWidth = 0;
|
|
2700
|
+
for (const mod of mods) {
|
|
2701
|
+
const def = getModifier(mod);
|
|
2702
|
+
if (!def) continue;
|
|
2703
|
+
if (def.darkScheme) darkScheme = def.darkScheme;
|
|
2704
|
+
if (def.pseudo) pseudoParts.push(def.pseudo);
|
|
2705
|
+
if (def.ancestorSelector) {
|
|
2706
|
+
ancestorParts.push(def.ancestorSelector);
|
|
2707
|
+
needsImportant = true;
|
|
2708
|
+
}
|
|
2709
|
+
if (def.dirSelector) {
|
|
2710
|
+
dirParts.push(def.dirSelector);
|
|
2711
|
+
needsImportant = true;
|
|
2712
|
+
}
|
|
2713
|
+
if (def.mediaQuery) {
|
|
2714
|
+
mediaWrappers.push(`@media ${def.mediaQuery}`);
|
|
2715
|
+
needsImportant = true;
|
|
2716
|
+
}
|
|
2717
|
+
if (def.isResponsive) {
|
|
2718
|
+
const w = screens[mod] ?? 0;
|
|
2719
|
+
if (w > minWidth) minWidth = w;
|
|
2720
|
+
}
|
|
2721
|
+
if (def.forcesImportant) needsImportant = true;
|
|
2722
|
+
}
|
|
2723
|
+
const pseudoSuffix = pseudoParts.join("");
|
|
2724
|
+
const elementSelector = `.${escaped}${pseudoSuffix}${childSuffix}`;
|
|
2725
|
+
const ancestorPrefix = ancestorParts.join("");
|
|
2726
|
+
const dirPrefix = dirParts.join("");
|
|
2727
|
+
const selector = `${dirPrefix}${ancestorPrefix}${elementSelector}`;
|
|
2728
|
+
const decls = isDivide ? buildDivideDecls(styles) : styleValueToCSS(styles, needsImportant);
|
|
2729
|
+
if (!decls) return rules;
|
|
2730
|
+
let rule;
|
|
2731
|
+
if (darkScheme === "dark") {
|
|
2732
|
+
if (darkMode === "media") rule = `@media (prefers-color-scheme: dark) { ${selector} { ${decls} } }`;
|
|
2733
|
+
else if (darkMode === "class") rule = `.dark ${selector} { ${decls} }`;
|
|
2734
|
+
else rule = `[data-theme="dark"] ${selector} { ${decls} }`;
|
|
2735
|
+
} else if (darkScheme === "light") {
|
|
2736
|
+
if (darkMode === "media") rule = `@media (prefers-color-scheme: light) { ${selector} { ${decls} } }`;
|
|
2737
|
+
else if (darkMode === "class") rule = `:not(.dark) ${selector} { ${decls} }`;
|
|
2738
|
+
else rule = `[data-theme="light"] ${selector} { ${decls} }`;
|
|
2739
|
+
} else {
|
|
2740
|
+
rule = `${selector} { ${decls} }`;
|
|
2741
|
+
}
|
|
2742
|
+
for (const mw of mediaWrappers) rule = `${mw} { ${rule} }`;
|
|
2743
|
+
if (minWidth > 0) rule = `@media (min-width: ${minWidth}px) { ${rule} }`;
|
|
2744
|
+
rules.push(rule);
|
|
2745
|
+
return rules;
|
|
2746
|
+
}
|
|
2747
|
+
function injectClassRule(cls, bucketKey, styles, darkMode, important) {
|
|
2748
|
+
const cssRules = buildClassCSSRules(cls, bucketKey, styles, darkMode, important, getGlobalScreens());
|
|
2749
|
+
for (const r of cssRules) injectRule(r);
|
|
2750
|
+
}
|
|
3314
2751
|
function resolve(classString, theme, darkMode = "attribute") {
|
|
2752
|
+
const cache = getThemeCache(theme);
|
|
3315
2753
|
const cacheKey = `${classString}::${darkMode}`;
|
|
3316
|
-
const cached =
|
|
2754
|
+
const cached = cache.get(cacheKey);
|
|
3317
2755
|
if (cached) return cached;
|
|
3318
2756
|
const result = {};
|
|
3319
|
-
const
|
|
3320
|
-
const
|
|
3321
|
-
for (const parsed of parsedClasses) {
|
|
2757
|
+
const onWeb = typeof document !== "undefined";
|
|
2758
|
+
for (const parsed of parseClasses(classString)) {
|
|
3322
2759
|
const styles = resolveUtility(parsed, theme);
|
|
3323
2760
|
if (!styles) {
|
|
3324
2761
|
if (process.env.NODE_ENV !== "production" && !parsed.isArbitrary && !isKnownUtility(parsed.utility)) {
|
|
@@ -3329,130 +2766,59 @@ function resolve(classString, theme, darkMode = "attribute") {
|
|
|
3329
2766
|
const bucketKey = parsed.modifiers.length === 0 ? "base" : parsed.modifiers.join(":");
|
|
3330
2767
|
if (!result[bucketKey]) result[bucketKey] = {};
|
|
3331
2768
|
Object.assign(result[bucketKey], styles);
|
|
3332
|
-
if (
|
|
3333
|
-
|
|
3334
|
-
}
|
|
3335
|
-
}
|
|
3336
|
-
styleCache.set(cacheKey, result);
|
|
3337
|
-
if (typeof document !== "undefined") {
|
|
3338
|
-
for (const { cls, bucketKey, styles, important } of injectQueue) {
|
|
3339
|
-
injectClassRule(cls, bucketKey, styles, darkMode, important);
|
|
2769
|
+
if (onWeb) {
|
|
2770
|
+
injectClassRule(parsed.original, bucketKey, styles, darkMode, parsed.important);
|
|
3340
2771
|
}
|
|
3341
2772
|
}
|
|
2773
|
+
cache.set(cacheKey, result);
|
|
3342
2774
|
return result;
|
|
3343
2775
|
}
|
|
3344
2776
|
function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new Set()) {
|
|
3345
2777
|
const result = {};
|
|
3346
|
-
const
|
|
3347
|
-
entries.sort((a, b) => {
|
|
3348
|
-
const pa = a[0] === "base" ? -1 : a[0].split(":").length;
|
|
3349
|
-
const pb = b[0] === "base" ? -1 : b[0].split(":").length;
|
|
3350
|
-
return pa - pb;
|
|
3351
|
-
});
|
|
3352
|
-
for (const [key, styles] of entries) {
|
|
2778
|
+
for (const [key, styles] of getSortedEntries(resolved)) {
|
|
3353
2779
|
if (!styles) continue;
|
|
3354
2780
|
if (key === "base") {
|
|
3355
2781
|
Object.assign(result, styles);
|
|
3356
2782
|
continue;
|
|
3357
2783
|
}
|
|
3358
2784
|
const mods = key.split(":");
|
|
3359
|
-
if (
|
|
2785
|
+
if (mods.every((mod) => matchModifier(mod, isDark, state, breakpoints))) {
|
|
3360
2786
|
Object.assign(result, styles);
|
|
3361
2787
|
}
|
|
3362
2788
|
}
|
|
3363
|
-
const
|
|
3364
|
-
if (
|
|
3365
|
-
result.fontFamily =
|
|
2789
|
+
const defaultFont = getDefaultFontFamily();
|
|
2790
|
+
if (defaultFont && !("fontFamily" in result)) {
|
|
2791
|
+
result.fontFamily = defaultFont;
|
|
3366
2792
|
}
|
|
3367
|
-
if (
|
|
2793
|
+
if (!isNative) {
|
|
3368
2794
|
const r = result;
|
|
3369
|
-
const
|
|
3370
|
-
if (
|
|
3371
|
-
r.paddingLeft =
|
|
3372
|
-
r.paddingRight =
|
|
2795
|
+
const ph = r.paddingHorizontal;
|
|
2796
|
+
if (ph !== void 0) {
|
|
2797
|
+
r.paddingLeft = ph;
|
|
2798
|
+
r.paddingRight = ph;
|
|
3373
2799
|
delete r.paddingHorizontal;
|
|
3374
2800
|
}
|
|
3375
|
-
const
|
|
3376
|
-
if (
|
|
3377
|
-
r.paddingTop =
|
|
3378
|
-
r.paddingBottom =
|
|
2801
|
+
const pv = r.paddingVertical;
|
|
2802
|
+
if (pv !== void 0) {
|
|
2803
|
+
r.paddingTop = pv;
|
|
2804
|
+
r.paddingBottom = pv;
|
|
3379
2805
|
delete r.paddingVertical;
|
|
3380
2806
|
}
|
|
3381
|
-
const
|
|
3382
|
-
if (
|
|
3383
|
-
r.marginLeft =
|
|
3384
|
-
r.marginRight =
|
|
2807
|
+
const mh = r.marginHorizontal;
|
|
2808
|
+
if (mh !== void 0) {
|
|
2809
|
+
r.marginLeft = mh;
|
|
2810
|
+
r.marginRight = mh;
|
|
3385
2811
|
delete r.marginHorizontal;
|
|
3386
2812
|
}
|
|
3387
|
-
const
|
|
3388
|
-
if (
|
|
3389
|
-
r.marginTop =
|
|
3390
|
-
r.marginBottom =
|
|
2813
|
+
const mv = r.marginVertical;
|
|
2814
|
+
if (mv !== void 0) {
|
|
2815
|
+
r.marginTop = mv;
|
|
2816
|
+
r.marginBottom = mv;
|
|
3391
2817
|
delete r.marginVertical;
|
|
3392
2818
|
}
|
|
3393
2819
|
}
|
|
3394
2820
|
return result;
|
|
3395
2821
|
}
|
|
3396
|
-
function matchesMods(mods, isDark, state, breakpoints) {
|
|
3397
|
-
return mods.every((mod) => {
|
|
3398
|
-
switch (mod) {
|
|
3399
|
-
case "dark":
|
|
3400
|
-
return isDark;
|
|
3401
|
-
case "light":
|
|
3402
|
-
case "not-dark":
|
|
3403
|
-
return !isDark;
|
|
3404
|
-
case "not-light":
|
|
3405
|
-
return isDark;
|
|
3406
|
-
case "hover":
|
|
3407
|
-
return !!state.hover;
|
|
3408
|
-
case "not-hover":
|
|
3409
|
-
return !state.hover;
|
|
3410
|
-
case "focus":
|
|
3411
|
-
return !!state.focus;
|
|
3412
|
-
case "not-focus":
|
|
3413
|
-
return !state.focus;
|
|
3414
|
-
case "pressed":
|
|
3415
|
-
case "active":
|
|
3416
|
-
return !!state.pressed || !!state.active;
|
|
3417
|
-
case "not-pressed":
|
|
3418
|
-
case "not-active":
|
|
3419
|
-
return !state.pressed && !state.active;
|
|
3420
|
-
case "disabled":
|
|
3421
|
-
return !!state.disabled;
|
|
3422
|
-
case "not-disabled":
|
|
3423
|
-
return !state.disabled;
|
|
3424
|
-
case "checked":
|
|
3425
|
-
return !!state.checked;
|
|
3426
|
-
case "not-checked":
|
|
3427
|
-
return !state.checked;
|
|
3428
|
-
case "visited":
|
|
3429
|
-
return !!state.visited;
|
|
3430
|
-
case "not-visited":
|
|
3431
|
-
return !state.visited;
|
|
3432
|
-
case "placeholder":
|
|
3433
|
-
return !!state.placeholder;
|
|
3434
|
-
case "sm":
|
|
3435
|
-
case "md":
|
|
3436
|
-
case "lg":
|
|
3437
|
-
case "xl":
|
|
3438
|
-
case "2xl":
|
|
3439
|
-
return breakpoints.has(mod);
|
|
3440
|
-
// CSS-only modifiers — never applied as inline styles
|
|
3441
|
-
case "print":
|
|
3442
|
-
case "landscape":
|
|
3443
|
-
case "portrait":
|
|
3444
|
-
case "motion-reduce":
|
|
3445
|
-
case "motion-safe":
|
|
3446
|
-
case "contrast-more":
|
|
3447
|
-
case "contrast-less":
|
|
3448
|
-
case "rtl":
|
|
3449
|
-
case "ltr":
|
|
3450
|
-
return false;
|
|
3451
|
-
default:
|
|
3452
|
-
return false;
|
|
3453
|
-
}
|
|
3454
|
-
});
|
|
3455
|
-
}
|
|
3456
2822
|
|
|
3457
2823
|
// src/core/config.ts
|
|
3458
2824
|
function deepMerge(base, override) {
|
|
@@ -3493,14 +2859,24 @@ function resolveOneRef(ref, colors) {
|
|
|
3493
2859
|
return entry[m[2]] ?? null;
|
|
3494
2860
|
}
|
|
3495
2861
|
function resolveColorRefs(colors) {
|
|
2862
|
+
const MAX_DEPTH = 5;
|
|
2863
|
+
function resolveChain(raw) {
|
|
2864
|
+
let current = raw;
|
|
2865
|
+
for (let i = 0; i < MAX_DEPTH; i++) {
|
|
2866
|
+
const next = resolveOneRef(current, colors);
|
|
2867
|
+
if (!next || next === current) break;
|
|
2868
|
+
current = next;
|
|
2869
|
+
}
|
|
2870
|
+
return current;
|
|
2871
|
+
}
|
|
3496
2872
|
const out = {};
|
|
3497
2873
|
for (const [key, val] of Object.entries(colors)) {
|
|
3498
2874
|
if (typeof val === "string") {
|
|
3499
|
-
out[key] =
|
|
2875
|
+
out[key] = resolveChain(val);
|
|
3500
2876
|
} else {
|
|
3501
2877
|
const shades = {};
|
|
3502
2878
|
for (const [shade, hex] of Object.entries(val)) {
|
|
3503
|
-
shades[shade] =
|
|
2879
|
+
shades[shade] = resolveChain(hex);
|
|
3504
2880
|
}
|
|
3505
2881
|
out[key] = shades;
|
|
3506
2882
|
}
|
|
@@ -3548,15 +2924,26 @@ function buildConfig(userConfig) {
|
|
|
3548
2924
|
injectGlobalStyles(resolved.theme);
|
|
3549
2925
|
return resolved;
|
|
3550
2926
|
}
|
|
2927
|
+
function _selectorToModifierDef(selector) {
|
|
2928
|
+
const s = selector.trim();
|
|
2929
|
+
if (s.startsWith("@media ")) {
|
|
2930
|
+
return { mediaQuery: s.slice(7), jsBehavior: "css-only", forcesImportant: true };
|
|
2931
|
+
}
|
|
2932
|
+
if (s.startsWith("::") || s.startsWith(":")) {
|
|
2933
|
+
return { pseudo: s, jsBehavior: "css-only", forcesImportant: true };
|
|
2934
|
+
}
|
|
2935
|
+
return { ancestorSelector: s.endsWith(" ") ? s : `${s} `, jsBehavior: "css-only", forcesImportant: true };
|
|
2936
|
+
}
|
|
3551
2937
|
function makePluginAPI(theme) {
|
|
3552
2938
|
const standalone = getPluginStandaloneMap();
|
|
3553
2939
|
return {
|
|
3554
2940
|
addUtility(name, styles) {
|
|
3555
2941
|
standalone[name] = styles;
|
|
3556
2942
|
},
|
|
3557
|
-
addVariant(name,
|
|
3558
|
-
|
|
3559
|
-
|
|
2943
|
+
addVariant(name, selectorOrDef) {
|
|
2944
|
+
const def = typeof selectorOrDef === "string" ? _selectorToModifierDef(selectorOrDef) : selectorOrDef;
|
|
2945
|
+
customVariants[name] = typeof selectorOrDef === "string" ? selectorOrDef : name;
|
|
2946
|
+
registerModifier(name, def);
|
|
3560
2947
|
},
|
|
3561
2948
|
theme(path, defaultValue) {
|
|
3562
2949
|
const parts = path.replace(/\[([^\]]+)\]/g, ".$1").split(".");
|
|
@@ -3677,23 +3064,26 @@ function useConditionalWidth(active) {
|
|
|
3677
3064
|
);
|
|
3678
3065
|
}
|
|
3679
3066
|
|
|
3680
|
-
// src/
|
|
3681
|
-
function chain(original, extra) {
|
|
3682
|
-
return (...args) => {
|
|
3683
|
-
original?.(...args);
|
|
3684
|
-
extra();
|
|
3685
|
-
};
|
|
3686
|
-
}
|
|
3687
|
-
var RESPONSIVE_MODS2 = /* @__PURE__ */ new Set(["sm", "md", "lg", "xl", "2xl"]);
|
|
3067
|
+
// src/shared-utils.ts
|
|
3688
3068
|
function hasResponsiveBuckets(resolved) {
|
|
3069
|
+
const responsiveMods = getResponsiveModifiers();
|
|
3689
3070
|
for (const key of Object.keys(resolved)) {
|
|
3690
3071
|
if (key === "base") continue;
|
|
3691
3072
|
for (const mod of key.split(":")) {
|
|
3692
|
-
if (
|
|
3073
|
+
if (responsiveMods.has(mod)) return true;
|
|
3693
3074
|
}
|
|
3694
3075
|
}
|
|
3695
3076
|
return false;
|
|
3696
3077
|
}
|
|
3078
|
+
var EMPTY_BREAKPOINTS2 = /* @__PURE__ */ new Set();
|
|
3079
|
+
|
|
3080
|
+
// src/InteractiveWrapper.tsx
|
|
3081
|
+
function chain(original, extra) {
|
|
3082
|
+
return (...args) => {
|
|
3083
|
+
original?.(...args);
|
|
3084
|
+
extra();
|
|
3085
|
+
};
|
|
3086
|
+
}
|
|
3697
3087
|
var InteractiveWrapper = (0, import_react3.forwardRef)(
|
|
3698
3088
|
function InteractiveWrapper2({
|
|
3699
3089
|
Component,
|
|
@@ -3769,10 +3159,10 @@ var InteractiveWrapper = (0, import_react3.forwardRef)(
|
|
|
3769
3159
|
ref,
|
|
3770
3160
|
...restWithoutChildren,
|
|
3771
3161
|
style: finalStyle,
|
|
3772
|
-
|
|
3162
|
+
...!isNative && className ? { className } : {},
|
|
3773
3163
|
// onPressIn / onPressOut are React Native-only.
|
|
3774
3164
|
// On web, onPointerDown/Up drive the pressed state instead (covers mouse + touch).
|
|
3775
|
-
|
|
3165
|
+
...!isNative ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
|
|
3776
3166
|
onMouseEnter: handleMouseEnter,
|
|
3777
3167
|
onMouseLeave: handleMouseLeave,
|
|
3778
3168
|
onFocus: handleFocus,
|
|
@@ -3785,22 +3175,12 @@ InteractiveWrapper.displayName = "Kbach.InteractiveWrapper";
|
|
|
3785
3175
|
|
|
3786
3176
|
// src/DarkWrapper.tsx
|
|
3787
3177
|
var import_react4 = __toESM(require("react"));
|
|
3788
|
-
var RESPONSIVE_MODS3 = /* @__PURE__ */ new Set(["sm", "md", "lg", "xl", "2xl"]);
|
|
3789
|
-
function hasResponsiveBuckets2(resolved) {
|
|
3790
|
-
for (const key of Object.keys(resolved)) {
|
|
3791
|
-
if (key === "base") continue;
|
|
3792
|
-
for (const mod of key.split(":")) {
|
|
3793
|
-
if (RESPONSIVE_MODS3.has(mod)) return true;
|
|
3794
|
-
}
|
|
3795
|
-
}
|
|
3796
|
-
return false;
|
|
3797
|
-
}
|
|
3798
3178
|
var DarkWrapper = import_react4.default.forwardRef(
|
|
3799
3179
|
function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
|
|
3800
3180
|
const isDark = useGlobalDarkMode();
|
|
3801
|
-
const needsWidth =
|
|
3181
|
+
const needsWidth = hasResponsiveBuckets(resolvedStyle);
|
|
3802
3182
|
const width = useConditionalWidth(needsWidth);
|
|
3803
|
-
const breakpoints = needsWidth ? getActiveBreakpoints(width) :
|
|
3183
|
+
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS2;
|
|
3804
3184
|
const computedStyle = flatten(resolvedStyle, isDark, {}, breakpoints);
|
|
3805
3185
|
stripInternalMarkers(computedStyle);
|
|
3806
3186
|
if (typeof Component !== "string") stripWebOnlyProps(computedStyle);
|
|
@@ -3842,51 +3222,39 @@ function stripWebOnlyProps(s) {
|
|
|
3842
3222
|
}
|
|
3843
3223
|
|
|
3844
3224
|
// src/jsx-runtime.tsx
|
|
3845
|
-
var
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
"not-visited",
|
|
3860
|
-
"placeholder",
|
|
3861
|
-
"group-hover",
|
|
3862
|
-
"group-focus",
|
|
3863
|
-
"peer-hover",
|
|
3864
|
-
"peer-focus"
|
|
3865
|
-
// focus-within / focus-visible / first / last / odd / even / only are CSS-only —
|
|
3866
|
-
// they have no JS state to track, so they don't need InteractiveWrapper.
|
|
3867
|
-
]);
|
|
3868
|
-
var RESPONSIVE_MODS4 = /* @__PURE__ */ new Set(["sm", "md", "lg", "xl", "2xl"]);
|
|
3869
|
-
var MODE_MODS_JSX = /* @__PURE__ */ new Set(["dark", "light", "not-dark", "not-light"]);
|
|
3225
|
+
var _cachedDefaultFont = void 0;
|
|
3226
|
+
var _defaultFontVersion = 0;
|
|
3227
|
+
var _lastFontVersion = -1;
|
|
3228
|
+
function _invalidateDefaultFontCache() {
|
|
3229
|
+
_defaultFontVersion++;
|
|
3230
|
+
}
|
|
3231
|
+
function getCachedDefaultFont() {
|
|
3232
|
+
if (_lastFontVersion !== _defaultFontVersion) {
|
|
3233
|
+
_cachedDefaultFont = getDefaultFontFamily();
|
|
3234
|
+
_lastFontVersion = _defaultFontVersion;
|
|
3235
|
+
}
|
|
3236
|
+
return _cachedDefaultFont;
|
|
3237
|
+
}
|
|
3238
|
+
var _bucketModsCache = /* @__PURE__ */ new WeakMap();
|
|
3870
3239
|
function bucketMods(resolved) {
|
|
3240
|
+
const cached = _bucketModsCache.get(resolved);
|
|
3241
|
+
if (cached) return cached;
|
|
3242
|
+
const interactiveMods = getInteractiveModifiers();
|
|
3243
|
+
const modeMods = getModeModifiers();
|
|
3244
|
+
const responsiveMods = getResponsiveModifiers();
|
|
3871
3245
|
let interactive = false;
|
|
3872
3246
|
let modeOrResponsive = false;
|
|
3873
3247
|
for (const key of Object.keys(resolved)) {
|
|
3874
3248
|
if (key === "base") continue;
|
|
3875
|
-
const
|
|
3876
|
-
|
|
3877
|
-
if (
|
|
3878
|
-
interactive = true;
|
|
3879
|
-
break;
|
|
3880
|
-
}
|
|
3881
|
-
}
|
|
3882
|
-
for (const mod of parts) {
|
|
3883
|
-
if (MODE_MODS_JSX.has(mod) || RESPONSIVE_MODS4.has(mod)) {
|
|
3884
|
-
modeOrResponsive = true;
|
|
3885
|
-
break;
|
|
3886
|
-
}
|
|
3249
|
+
for (const mod of key.split(":")) {
|
|
3250
|
+
if (!interactive && interactiveMods.has(mod)) interactive = true;
|
|
3251
|
+
if (!modeOrResponsive && (modeMods.has(mod) || responsiveMods.has(mod))) modeOrResponsive = true;
|
|
3887
3252
|
}
|
|
3253
|
+
if (interactive && modeOrResponsive) break;
|
|
3888
3254
|
}
|
|
3889
|
-
|
|
3255
|
+
const result = { interactive, modeOrResponsive };
|
|
3256
|
+
_bucketModsCache.set(resolved, result);
|
|
3257
|
+
return result;
|
|
3890
3258
|
}
|
|
3891
3259
|
var CONSUMED_PROPS = /* @__PURE__ */ new Set(["className", "kb", "__kbachStyles", "__kbachClasses"]);
|
|
3892
3260
|
function omitConsumed(props) {
|
|
@@ -3961,10 +3329,8 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
3961
3329
|
const { className, kb: kbProp, __kbachStyles, __kbachClasses } = rawProps;
|
|
3962
3330
|
const classStr = className ?? kbProp ?? __kbachClasses;
|
|
3963
3331
|
if (!classStr && !__kbachStyles) {
|
|
3964
|
-
const defaultFont =
|
|
3965
|
-
if (!defaultFont)
|
|
3966
|
-
return makeElement(isStaticChildren, type, rawProps, key);
|
|
3967
|
-
}
|
|
3332
|
+
const defaultFont = getCachedDefaultFont();
|
|
3333
|
+
if (!defaultFont) return makeElement(isStaticChildren, type, rawProps, key);
|
|
3968
3334
|
const { style: userStyle2, ...passProps2 } = omitConsumed(rawProps);
|
|
3969
3335
|
const finalStyle2 = userStyle2 ? Array.isArray(userStyle2) ? { fontFamily: defaultFont, ...Object.assign({}, ...userStyle2) } : { fontFamily: defaultFont, ...userStyle2 } : { fontFamily: defaultFont };
|
|
3970
3336
|
return makeElement(isStaticChildren, type, { ...passProps2, style: finalStyle2 }, key);
|
|
@@ -3980,7 +3346,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
3980
3346
|
return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
|
|
3981
3347
|
Component: actualType,
|
|
3982
3348
|
resolvedStyle: resolved,
|
|
3983
|
-
|
|
3349
|
+
...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
|
|
3984
3350
|
style: userStyle,
|
|
3985
3351
|
...passProps
|
|
3986
3352
|
}, key);
|
|
@@ -3989,7 +3355,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
3989
3355
|
return (0, import_jsx_runtime.jsx)(DarkWrapper, {
|
|
3990
3356
|
Component: actualType,
|
|
3991
3357
|
resolvedStyle: resolved,
|
|
3992
|
-
|
|
3358
|
+
...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
|
|
3993
3359
|
style: userStyle,
|
|
3994
3360
|
...passProps
|
|
3995
3361
|
}, key);
|
|
@@ -4001,7 +3367,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
|
|
|
4001
3367
|
return makeElement(isStaticChildren, actualType, {
|
|
4002
3368
|
...passProps,
|
|
4003
3369
|
style: finalStyle,
|
|
4004
|
-
|
|
3370
|
+
...!isNative && classStr ? { className: normalizeClassString(classStr) } : {}
|
|
4005
3371
|
}, key);
|
|
4006
3372
|
}
|
|
4007
3373
|
function jsx(type, props, key) {
|
|
@@ -4013,6 +3379,7 @@ function jsxs(type, props, key) {
|
|
|
4013
3379
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4014
3380
|
0 && (module.exports = {
|
|
4015
3381
|
Fragment,
|
|
3382
|
+
_invalidateDefaultFontCache,
|
|
4016
3383
|
jsx,
|
|
4017
3384
|
jsxs
|
|
4018
3385
|
});
|