@csszyx/runtime 0.10.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -785,6 +785,338 @@ const BOX_ROLE_PREFIXES = [
785
785
  ["w", { role: "outer", category: "sizing" }],
786
786
  ["z", { role: "outer", category: "position" }]
787
787
  ];
788
+ const BOX_ROLE_BY_KEY = /* @__PURE__ */ new Map([
789
+ ["accent", { role: "inner", category: "accent" }],
790
+ ["align", { role: "inner", category: "text" }],
791
+ ["animate", { role: "outer", category: "transition" }],
792
+ ["animationDelay", { role: "outer", category: "transition" }],
793
+ ["appearance", { role: "inner", category: "interaction" }],
794
+ ["aspect", { role: "outer", category: "sizing" }],
795
+ ["autoCols", { role: "inner", category: "grid" }],
796
+ ["autoRows", { role: "inner", category: "grid" }],
797
+ ["backdropBlur", { role: "outer", category: "backdrop" }],
798
+ ["backdropBrightness", { role: "outer", category: "backdrop" }],
799
+ ["backdropContrast", { role: "outer", category: "backdrop" }],
800
+ ["backdropFilter", { role: "outer", category: "backdrop" }],
801
+ ["backdropGrayscale", { role: "outer", category: "backdrop" }],
802
+ ["backdropHueRotate", { role: "outer", category: "backdrop" }],
803
+ ["backdropInvert", { role: "outer", category: "backdrop" }],
804
+ ["backdropOpacity", { role: "outer", category: "backdrop" }],
805
+ ["backdropSaturate", { role: "outer", category: "backdrop" }],
806
+ ["backdropSepia", { role: "outer", category: "backdrop" }],
807
+ ["backface", { role: "outer", category: "transform" }],
808
+ ["basis", { role: "inner", category: "flex" }],
809
+ ["bg", { role: "outer", category: "bg" }],
810
+ ["bgAttach", { role: "outer", category: "bg" }],
811
+ ["bgBlend", { role: "outer", category: "bg" }],
812
+ ["bgClip", { role: "outer", category: "bg" }],
813
+ ["bgImg", { role: "outer", category: "bg" }],
814
+ ["bgOrigin", { role: "outer", category: "bg" }],
815
+ ["bgPos", { role: "outer", category: "bg" }],
816
+ ["bgRepeat", { role: "outer", category: "bg" }],
817
+ ["bgSize", { role: "outer", category: "bg" }],
818
+ ["blockSize", { role: "outer", category: "sizing" }],
819
+ ["blur", { role: "outer", category: "filter" }],
820
+ ["border", { role: "outer", category: "border" }],
821
+ ["borderB", { role: "outer", category: "border" }],
822
+ ["borderBColor", { role: "outer", category: "border" }],
823
+ ["borderBe", { role: "outer", category: "border" }],
824
+ ["borderBs", { role: "outer", category: "border" }],
825
+ ["borderCollapse", { role: "outer", category: "border" }],
826
+ ["borderColor", { role: "outer", category: "border" }],
827
+ ["borderE", { role: "outer", category: "border" }],
828
+ ["borderL", { role: "outer", category: "border" }],
829
+ ["borderLColor", { role: "outer", category: "border" }],
830
+ ["borderR", { role: "outer", category: "border" }],
831
+ ["borderRColor", { role: "outer", category: "border" }],
832
+ ["borderS", { role: "outer", category: "border" }],
833
+ ["borderSpacing", { role: "outer", category: "border" }],
834
+ ["borderSpacingX", { role: "outer", category: "border" }],
835
+ ["borderSpacingY", { role: "outer", category: "border" }],
836
+ ["borderStyle", { role: "outer", category: "border" }],
837
+ ["borderT", { role: "outer", category: "border" }],
838
+ ["borderTColor", { role: "outer", category: "border" }],
839
+ ["borderX", { role: "outer", category: "border" }],
840
+ ["borderXColor", { role: "outer", category: "border" }],
841
+ ["borderY", { role: "outer", category: "border" }],
842
+ ["borderYColor", { role: "outer", category: "border" }],
843
+ ["bottom", { role: "outer", category: "position" }],
844
+ ["box", { role: "outer", category: "sizing" }],
845
+ ["boxDecoration", { role: "outer", category: "fragmentation" }],
846
+ ["break", { role: "inner", category: "text" }],
847
+ ["breakAfter", { role: "outer", category: "fragmentation" }],
848
+ ["breakBefore", { role: "outer", category: "fragmentation" }],
849
+ ["breakInside", { role: "outer", category: "fragmentation" }],
850
+ ["brightness", { role: "outer", category: "filter" }],
851
+ ["caption", { role: "inner", category: "table" }],
852
+ ["caret", { role: "inner", category: "accent" }],
853
+ ["clear", { role: "outer", category: "position" }],
854
+ ["col", { role: "inner", category: "grid" }],
855
+ ["colEnd", { role: "inner", category: "grid" }],
856
+ ["color", { role: "inner", category: "text" }],
857
+ ["colSpan", { role: "inner", category: "grid" }],
858
+ ["colStart", { role: "inner", category: "grid" }],
859
+ ["columns", { role: "inner", category: "columns" }],
860
+ ["container", { role: "outer", category: "sizing" }],
861
+ ["content", { role: "inner", category: "text" }],
862
+ ["contrast", { role: "outer", category: "filter" }],
863
+ ["cursor", { role: "inner", category: "interaction" }],
864
+ ["decoration", { role: "inner", category: "text" }],
865
+ ["decorationColor", { role: "inner", category: "text" }],
866
+ ["decorationStyle", { role: "inner", category: "text" }],
867
+ ["decorationThickness", { role: "inner", category: "text" }],
868
+ ["delay", { role: "outer", category: "transition" }],
869
+ ["diagonalFractions", { role: "inner", category: "text" }],
870
+ ["display", { role: "inner", category: "display" }],
871
+ ["divideColor", { role: "outer", category: "divide" }],
872
+ ["divideStyle", { role: "outer", category: "divide" }],
873
+ ["divideX", { role: "outer", category: "divide" }],
874
+ ["divideXReverse", { role: "outer", category: "divide" }],
875
+ ["divideY", { role: "outer", category: "divide" }],
876
+ ["divideYReverse", { role: "outer", category: "divide" }],
877
+ ["dropShadow", { role: "outer", category: "filter" }],
878
+ ["dropShadowColor", { role: "outer", category: "filter" }],
879
+ ["duration", { role: "outer", category: "transition" }],
880
+ ["ease", { role: "outer", category: "transition" }],
881
+ ["end", { role: "outer", category: "position" }],
882
+ ["fieldSizing", { role: "inner", category: "interaction" }],
883
+ ["fill", { role: "inner", category: "svg" }],
884
+ ["filter", { role: "outer", category: "filter" }],
885
+ ["flex", { role: "inner", category: "flex" }],
886
+ ["flexDir", { role: "inner", category: "flex" }],
887
+ ["flexWrap", { role: "inner", category: "flex" }],
888
+ ["float", { role: "outer", category: "position" }],
889
+ ["fontFamily", { role: "inner", category: "text" }],
890
+ ["fontFeatures", { role: "inner", category: "text" }],
891
+ ["fontSmoothing", { role: "inner", category: "text" }],
892
+ ["fontStretch", { role: "inner", category: "text" }],
893
+ ["fontStyle", { role: "inner", category: "text" }],
894
+ ["forcedColorAdjust", { role: "outer", category: "color-scheme" }],
895
+ ["from", { role: "outer", category: "gradient" }],
896
+ ["gap", { role: "inner", category: "gap" }],
897
+ ["gapX", { role: "inner", category: "gap" }],
898
+ ["gapY", { role: "inner", category: "gap" }],
899
+ ["grayscale", { role: "outer", category: "filter" }],
900
+ ["gridCols", { role: "inner", category: "grid" }],
901
+ ["gridFlow", { role: "inner", category: "grid" }],
902
+ ["gridRows", { role: "inner", category: "grid" }],
903
+ ["grow", { role: "inner", category: "flex" }],
904
+ ["h", { role: "outer", category: "sizing" }],
905
+ ["hueRotate", { role: "outer", category: "filter" }],
906
+ ["hyphens", { role: "inner", category: "text" }],
907
+ ["indent", { role: "inner", category: "text" }],
908
+ ["inlineSize", { role: "outer", category: "sizing" }],
909
+ ["inset", { role: "outer", category: "position" }],
910
+ ["insetBe", { role: "outer", category: "position" }],
911
+ ["insetBs", { role: "outer", category: "position" }],
912
+ ["insetE", { role: "outer", category: "position" }],
913
+ ["insetRing", { role: "inner", category: "ring" }],
914
+ ["insetRingColor", { role: "inner", category: "ring" }],
915
+ ["insetS", { role: "outer", category: "position" }],
916
+ ["insetShadow", { role: "inner", category: "shadow" }],
917
+ ["insetShadowColor", { role: "inner", category: "shadow" }],
918
+ ["insetX", { role: "outer", category: "position" }],
919
+ ["insetY", { role: "outer", category: "position" }],
920
+ ["invert", { role: "outer", category: "filter" }],
921
+ ["isolation", { role: "outer", category: "position" }],
922
+ ["items", { role: "inner", category: "alignment" }],
923
+ ["justify", { role: "inner", category: "alignment" }],
924
+ ["justifyItems", { role: "inner", category: "alignment" }],
925
+ ["justifySelf", { role: "inner", category: "alignment" }],
926
+ ["leading", { role: "inner", category: "text" }],
927
+ ["left", { role: "outer", category: "position" }],
928
+ ["lineClamp", { role: "inner", category: "text" }],
929
+ ["liningNums", { role: "inner", category: "text" }],
930
+ ["list", { role: "inner", category: "list" }],
931
+ ["listImg", { role: "inner", category: "list" }],
932
+ ["listPos", { role: "inner", category: "list" }],
933
+ ["m", { role: "outer", category: "margin" }],
934
+ ["mask", { role: "outer", category: "mask" }],
935
+ ["maskClip", { role: "outer", category: "mask" }],
936
+ ["maskFrom", { role: "outer", category: "mask" }],
937
+ ["maskOrigin", { role: "outer", category: "mask" }],
938
+ ["maskPos", { role: "outer", category: "mask" }],
939
+ ["maskRepeat", { role: "outer", category: "mask" }],
940
+ ["maskShape", { role: "outer", category: "mask" }],
941
+ ["maskSize", { role: "outer", category: "mask" }],
942
+ ["maskTo", { role: "outer", category: "mask" }],
943
+ ["maskVia", { role: "outer", category: "mask" }],
944
+ ["maxBlockSize", { role: "outer", category: "sizing" }],
945
+ ["maxH", { role: "outer", category: "sizing" }],
946
+ ["maxInlineSize", { role: "outer", category: "sizing" }],
947
+ ["maxW", { role: "outer", category: "sizing" }],
948
+ ["mb", { role: "outer", category: "margin" }],
949
+ ["mbe", { role: "outer", category: "margin" }],
950
+ ["mbs", { role: "outer", category: "margin" }],
951
+ ["me", { role: "outer", category: "margin" }],
952
+ ["minBlockSize", { role: "outer", category: "sizing" }],
953
+ ["minH", { role: "outer", category: "sizing" }],
954
+ ["minInlineSize", { role: "outer", category: "sizing" }],
955
+ ["minW", { role: "outer", category: "sizing" }],
956
+ ["mixBlend", { role: "outer", category: "blend" }],
957
+ ["ml", { role: "outer", category: "margin" }],
958
+ ["mr", { role: "outer", category: "margin" }],
959
+ ["ms", { role: "outer", category: "margin" }],
960
+ ["mt", { role: "outer", category: "margin" }],
961
+ ["mx", { role: "outer", category: "margin" }],
962
+ ["my", { role: "outer", category: "margin" }],
963
+ ["notSrOnly", { role: "outer", category: "visibility" }],
964
+ ["objectFit", { role: "inner", category: "object" }],
965
+ ["objectPos", { role: "inner", category: "object" }],
966
+ ["oldstyleNums", { role: "inner", category: "text" }],
967
+ ["opacity", { role: "outer", category: "opacity" }],
968
+ ["order", { role: "inner", category: "flex" }],
969
+ ["ordinal", { role: "inner", category: "text" }],
970
+ ["origin", { role: "outer", category: "transform" }],
971
+ ["outline", { role: "outer", category: "outline" }],
972
+ ["outlineColor", { role: "outer", category: "outline" }],
973
+ ["outlineOffset", { role: "outer", category: "outline" }],
974
+ ["outlineStyle", { role: "outer", category: "outline" }],
975
+ ["overflow", { role: "inner", category: "overflow" }],
976
+ ["overflowX", { role: "inner", category: "overflow" }],
977
+ ["overflowY", { role: "inner", category: "overflow" }],
978
+ ["overscroll", { role: "inner", category: "overscroll" }],
979
+ ["overscrollX", { role: "inner", category: "overscroll" }],
980
+ ["overscrollY", { role: "inner", category: "overscroll" }],
981
+ ["p", { role: "inner", category: "padding" }],
982
+ ["pb", { role: "inner", category: "padding" }],
983
+ ["pbe", { role: "inner", category: "padding" }],
984
+ ["pbs", { role: "inner", category: "padding" }],
985
+ ["pe", { role: "inner", category: "padding" }],
986
+ ["perspective", { role: "outer", category: "transform" }],
987
+ ["perspectiveOrigin", { role: "outer", category: "transform" }],
988
+ ["pl", { role: "inner", category: "padding" }],
989
+ ["placeContent", { role: "inner", category: "alignment" }],
990
+ ["placeItems", { role: "inner", category: "alignment" }],
991
+ ["placeSelf", { role: "inner", category: "alignment" }],
992
+ ["pointerEvents", { role: "inner", category: "interaction" }],
993
+ ["position", { role: "outer", category: "position" }],
994
+ ["pr", { role: "inner", category: "padding" }],
995
+ ["proportionalNums", { role: "inner", category: "text" }],
996
+ ["prose", { role: "inner", category: "text" }],
997
+ ["proseInvert", { role: "inner", category: "text" }],
998
+ ["ps", { role: "inner", category: "padding" }],
999
+ ["pt", { role: "inner", category: "padding" }],
1000
+ ["px", { role: "inner", category: "padding" }],
1001
+ ["py", { role: "inner", category: "padding" }],
1002
+ ["resize", { role: "inner", category: "interaction" }],
1003
+ ["right", { role: "outer", category: "position" }],
1004
+ ["ring", { role: "outer", category: "ring" }],
1005
+ ["ringColor", { role: "outer", category: "ring" }],
1006
+ ["ringOffset", { role: "outer", category: "ring" }],
1007
+ ["ringOffsetColor", { role: "outer", category: "ring" }],
1008
+ ["rotate", { role: "outer", category: "transform" }],
1009
+ ["rotateX", { role: "outer", category: "transform" }],
1010
+ ["rotateY", { role: "outer", category: "transform" }],
1011
+ ["rotateZ", { role: "outer", category: "transform" }],
1012
+ ["rounded", { role: "outer", category: "rounded" }],
1013
+ ["roundedB", { role: "outer", category: "rounded" }],
1014
+ ["roundedBl", { role: "outer", category: "rounded" }],
1015
+ ["roundedBr", { role: "outer", category: "rounded" }],
1016
+ ["roundedE", { role: "outer", category: "rounded" }],
1017
+ ["roundedEe", { role: "outer", category: "rounded" }],
1018
+ ["roundedEs", { role: "outer", category: "rounded" }],
1019
+ ["roundedL", { role: "outer", category: "rounded" }],
1020
+ ["roundedR", { role: "outer", category: "rounded" }],
1021
+ ["roundedS", { role: "outer", category: "rounded" }],
1022
+ ["roundedSe", { role: "outer", category: "rounded" }],
1023
+ ["roundedSs", { role: "outer", category: "rounded" }],
1024
+ ["roundedT", { role: "outer", category: "rounded" }],
1025
+ ["roundedTl", { role: "outer", category: "rounded" }],
1026
+ ["roundedTr", { role: "outer", category: "rounded" }],
1027
+ ["row", { role: "inner", category: "grid" }],
1028
+ ["rowEnd", { role: "inner", category: "grid" }],
1029
+ ["rowSpan", { role: "inner", category: "grid" }],
1030
+ ["rowStart", { role: "inner", category: "grid" }],
1031
+ ["saturate", { role: "outer", category: "filter" }],
1032
+ ["scale", { role: "outer", category: "transform" }],
1033
+ ["scaleX", { role: "outer", category: "transform" }],
1034
+ ["scaleY", { role: "outer", category: "transform" }],
1035
+ ["scaleZ", { role: "outer", category: "transform" }],
1036
+ ["scheme", { role: "outer", category: "color-scheme" }],
1037
+ ["scroll", { role: "inner", category: "scroll" }],
1038
+ ["scrollbar", { role: "inner", category: "scroll" }],
1039
+ ["scrollbarGutter", { role: "inner", category: "scroll" }],
1040
+ ["scrollbarThumb", { role: "inner", category: "scroll" }],
1041
+ ["scrollbarTrack", { role: "inner", category: "scroll" }],
1042
+ ["scrollM", { role: "inner", category: "scroll" }],
1043
+ ["scrollMb", { role: "inner", category: "scroll" }],
1044
+ ["scrollMbe", { role: "inner", category: "scroll" }],
1045
+ ["scrollMbs", { role: "inner", category: "scroll" }],
1046
+ ["scrollMe", { role: "inner", category: "scroll" }],
1047
+ ["scrollMl", { role: "inner", category: "scroll" }],
1048
+ ["scrollMr", { role: "inner", category: "scroll" }],
1049
+ ["scrollMs", { role: "inner", category: "scroll" }],
1050
+ ["scrollMt", { role: "inner", category: "scroll" }],
1051
+ ["scrollMx", { role: "inner", category: "scroll" }],
1052
+ ["scrollMy", { role: "inner", category: "scroll" }],
1053
+ ["scrollP", { role: "inner", category: "scroll" }],
1054
+ ["scrollPb", { role: "inner", category: "scroll" }],
1055
+ ["scrollPbe", { role: "inner", category: "scroll" }],
1056
+ ["scrollPbs", { role: "inner", category: "scroll" }],
1057
+ ["scrollPe", { role: "inner", category: "scroll" }],
1058
+ ["scrollPl", { role: "inner", category: "scroll" }],
1059
+ ["scrollPr", { role: "inner", category: "scroll" }],
1060
+ ["scrollPs", { role: "inner", category: "scroll" }],
1061
+ ["scrollPt", { role: "inner", category: "scroll" }],
1062
+ ["scrollPx", { role: "inner", category: "scroll" }],
1063
+ ["scrollPy", { role: "inner", category: "scroll" }],
1064
+ ["select", { role: "inner", category: "interaction" }],
1065
+ ["self", { role: "inner", category: "alignment" }],
1066
+ ["sepia", { role: "outer", category: "filter" }],
1067
+ ["shadow", { role: "outer", category: "shadow" }],
1068
+ ["shadowColor", { role: "outer", category: "shadow" }],
1069
+ ["shrink", { role: "inner", category: "flex" }],
1070
+ ["size", { role: "outer", category: "sizing" }],
1071
+ ["skewX", { role: "outer", category: "transform" }],
1072
+ ["skewY", { role: "outer", category: "transform" }],
1073
+ ["slashedZero", { role: "inner", category: "text" }],
1074
+ ["snapAlign", { role: "inner", category: "snap" }],
1075
+ ["snapStop", { role: "inner", category: "snap" }],
1076
+ ["snapType", { role: "inner", category: "snap" }],
1077
+ ["spaceX", { role: "inner", category: "space" }],
1078
+ ["spaceXReverse", { role: "inner", category: "space" }],
1079
+ ["spaceY", { role: "inner", category: "space" }],
1080
+ ["spaceYReverse", { role: "inner", category: "space" }],
1081
+ ["srOnly", { role: "outer", category: "visibility" }],
1082
+ ["stackedFractions", { role: "inner", category: "text" }],
1083
+ ["start", { role: "outer", category: "position" }],
1084
+ ["stroke", { role: "inner", category: "svg" }],
1085
+ ["strokeWidth", { role: "inner", category: "svg" }],
1086
+ ["tableLayout", { role: "inner", category: "table" }],
1087
+ ["tabSize", { role: "inner", category: "text" }],
1088
+ ["tabularNums", { role: "inner", category: "text" }],
1089
+ ["text", { role: "inner", category: "text" }],
1090
+ ["textAlign", { role: "inner", category: "text" }],
1091
+ ["textOverflow", { role: "inner", category: "text" }],
1092
+ ["textShadow", { role: "inner", category: "text" }],
1093
+ ["textShadowColor", { role: "inner", category: "text" }],
1094
+ ["textTransform", { role: "inner", category: "text" }],
1095
+ ["textWrap", { role: "inner", category: "text" }],
1096
+ ["to", { role: "outer", category: "gradient" }],
1097
+ ["top", { role: "outer", category: "position" }],
1098
+ ["touch", { role: "inner", category: "touch" }],
1099
+ ["tracking", { role: "inner", category: "text" }],
1100
+ ["transform", { role: "outer", category: "transform" }],
1101
+ ["transformStyle", { role: "outer", category: "transform" }],
1102
+ ["transition", { role: "outer", category: "transition" }],
1103
+ ["transitionBehavior", { role: "outer", category: "transition" }],
1104
+ ["translate", { role: "outer", category: "transform" }],
1105
+ ["translateX", { role: "outer", category: "transform" }],
1106
+ ["translateY", { role: "outer", category: "transform" }],
1107
+ ["translateZ", { role: "outer", category: "transform" }],
1108
+ ["truncate", { role: "inner", category: "text" }],
1109
+ ["underlineOffset", { role: "inner", category: "text" }],
1110
+ ["via", { role: "outer", category: "gradient" }],
1111
+ ["visibility", { role: "outer", category: "visibility" }],
1112
+ ["w", { role: "outer", category: "sizing" }],
1113
+ ["weight", { role: "inner", category: "text" }],
1114
+ ["whitespace", { role: "inner", category: "text" }],
1115
+ ["willChange", { role: "inner", category: "interaction" }],
1116
+ ["wrap", { role: "inner", category: "text" }],
1117
+ ["z", { role: "outer", category: "position" }],
1118
+ ["zoom", { role: "outer", category: "transform" }]
1119
+ ]);
788
1120
 
789
1121
  function stripVariant(token) {
790
1122
  let depth = 0;
@@ -866,12 +1198,126 @@ function pick(classes, selector) {
866
1198
  function omit(classes, selector) {
867
1199
  return tokenize(classes).filter((t) => !matches(inspect(t), selector)).join(" ");
868
1200
  }
1201
+ function classifySzKey(key) {
1202
+ return BOX_ROLE_BY_KEY.get(key);
1203
+ }
1204
+ function isPlainObject$1(value) {
1205
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1206
+ }
1207
+ function matchesKey(key, entry, selector) {
1208
+ if (typeof selector === "object") {
1209
+ return !!entry && Object.keys(selector).every((category) => entry.category === category);
1210
+ }
1211
+ if (selector === "outer" || selector === "inner") return entry?.role === selector;
1212
+ if (selector === "content") return entry?.role === "inner";
1213
+ if (key === selector) return true;
1214
+ return !!entry && selector === entry.category;
1215
+ }
1216
+ function anyMatchKey(key, entry, selectors) {
1217
+ return selectors.some((s) => matchesKey(key, entry, s));
1218
+ }
1219
+ function mergeSzInto(target, source, depth) {
1220
+ if (depth >= browser.MAX_SZ_DEPTH) throw new browser.SzDepthError();
1221
+ for (const key of Object.keys(source)) {
1222
+ if (browser.isForbiddenSzKey(key)) continue;
1223
+ const sv = source[key];
1224
+ const tv = target[key];
1225
+ target[key] = isPlainObject$1(sv) && isPlainObject$1(tv) ? mergeSzInto({ ...tv }, sv, depth + 1) : sv;
1226
+ }
1227
+ return target;
1228
+ }
1229
+ function flattenSz(sz, depth) {
1230
+ if (depth >= browser.MAX_SZ_DEPTH) throw new browser.SzDepthError();
1231
+ if (!sz) return {};
1232
+ if (typeof sz === "string") {
1233
+ if (process.env.NODE_ENV !== "production" && sz.trim()) {
1234
+ throw new TypeError(
1235
+ `splitBoxSz partitions sz objects, not raw class strings \u2014 use splitBox() for ${JSON.stringify(sz)}.`
1236
+ );
1237
+ }
1238
+ return {};
1239
+ }
1240
+ if (Array.isArray(sz)) {
1241
+ const acc = {};
1242
+ for (const part of sz) mergeSzInto(acc, flattenSz(part, depth + 1), depth + 1);
1243
+ return acc;
1244
+ }
1245
+ return sz;
1246
+ }
1247
+ function partitionSz(obj, options, outer, inner, depth) {
1248
+ if (depth >= browser.MAX_SZ_DEPTH) throw new browser.SzDepthError();
1249
+ const forceInner = options.inner ?? [];
1250
+ const forceOuter = options.outer ?? [];
1251
+ const fallback = options.fallback ?? "outer";
1252
+ for (const key of Object.keys(obj)) {
1253
+ if (browser.isForbiddenSzKey(key)) continue;
1254
+ const value = obj[key];
1255
+ const entry = BOX_ROLE_BY_KEY.get(key);
1256
+ if (anyMatchKey(key, entry, forceInner)) {
1257
+ inner[key] = value;
1258
+ } else if (anyMatchKey(key, entry, forceOuter)) {
1259
+ outer[key] = value;
1260
+ } else if (entry) {
1261
+ (entry.role === "inner" ? inner : outer)[key] = value;
1262
+ } else if (isPlainObject$1(value)) {
1263
+ const subOuter = {};
1264
+ const subInner = {};
1265
+ partitionSz(value, options, subOuter, subInner, depth + 1);
1266
+ if (Object.keys(subOuter).length > 0) outer[key] = subOuter;
1267
+ if (Object.keys(subInner).length > 0) inner[key] = subInner;
1268
+ } else {
1269
+ (fallback === "inner" ? inner : outer)[key] = value;
1270
+ }
1271
+ }
1272
+ }
1273
+ function splitBoxSz(sz, options = {}) {
1274
+ const outer = {};
1275
+ const inner = {};
1276
+ partitionSz(flattenSz(sz, 0), options, outer, inner, 0);
1277
+ return { outer, inner };
1278
+ }
1279
+ function filterSz(obj, selector, keep, depth) {
1280
+ if (depth >= browser.MAX_SZ_DEPTH) throw new browser.SzDepthError();
1281
+ const result = {};
1282
+ for (const key of Object.keys(obj)) {
1283
+ if (browser.isForbiddenSzKey(key)) continue;
1284
+ const value = obj[key];
1285
+ const entry = BOX_ROLE_BY_KEY.get(key);
1286
+ if (entry || !isPlainObject$1(value)) {
1287
+ if (matchesKey(key, entry, selector) === keep) result[key] = value;
1288
+ } else {
1289
+ const sub = filterSz(value, selector, keep, depth + 1);
1290
+ if (Object.keys(sub).length > 0) result[key] = sub;
1291
+ }
1292
+ }
1293
+ return result;
1294
+ }
1295
+ function hasSz(sz, selector) {
1296
+ const scan = (obj, depth) => {
1297
+ if (depth >= browser.MAX_SZ_DEPTH) throw new browser.SzDepthError();
1298
+ for (const key of Object.keys(obj)) {
1299
+ if (browser.isForbiddenSzKey(key)) continue;
1300
+ const value = obj[key];
1301
+ const entry = BOX_ROLE_BY_KEY.get(key);
1302
+ if (matchesKey(key, entry, selector)) return true;
1303
+ if (!entry && isPlainObject$1(value) && scan(value, depth + 1)) return true;
1304
+ }
1305
+ return false;
1306
+ };
1307
+ return scan(flattenSz(sz, 0), 0);
1308
+ }
1309
+ function pickSz(sz, selector) {
1310
+ return filterSz(flattenSz(sz, 0), selector, true, 0);
1311
+ }
1312
+ function omitSz(sz, selector) {
1313
+ return filterSz(flattenSz(sz, 0), selector, false, 0);
1314
+ }
869
1315
 
870
- const warned = /* @__PURE__ */ new Set();
1316
+ const warned$1 = /* @__PURE__ */ new Set();
871
1317
  const RAW_SZ_WARNING = '[csszyx] A raw `sz` object reached the runtime and was dropped before it could leak to the DOM as sz="[object Object]".\nThis means the file was not compiled \u2014 its `sz` produces no CSS. If it lives in a workspace package, add that package to `compilePackages`; otherwise check that the bundler is not skipping the file.';
872
1318
  function warnRawSz() {
873
- if (warned.has(RAW_SZ_WARNING)) return;
874
- warned.add(RAW_SZ_WARNING);
1319
+ if (warned$1.has(RAW_SZ_WARNING)) return;
1320
+ warned$1.add(RAW_SZ_WARNING);
875
1321
  console.warn(RAW_SZ_WARNING);
876
1322
  }
877
1323
  function stripSzProps(props) {
@@ -887,6 +1333,18 @@ function stripSzProps(props) {
887
1333
  return rest;
888
1334
  }
889
1335
 
1336
+ const warned = /* @__PURE__ */ new Set();
1337
+ function devWarn(message) {
1338
+ if (process.env.NODE_ENV === "production") {
1339
+ return;
1340
+ }
1341
+ if (warned.has(message)) {
1342
+ return;
1343
+ }
1344
+ warned.add(message);
1345
+ console.warn(`[csszyx] ${message}`);
1346
+ }
1347
+
890
1348
  function deepMerge(target, source, depth = 0) {
891
1349
  if (depth >= browser.MAX_SZ_DEPTH) {
892
1350
  throw new browser.SzDepthError();
@@ -906,8 +1364,97 @@ function deepMerge(target, source, depth = 0) {
906
1364
  }
907
1365
  return result;
908
1366
  }
1367
+ function isPlainObject(value) {
1368
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1369
+ }
1370
+ function validateSzvConfig(config) {
1371
+ if (process.env.NODE_ENV === "production") {
1372
+ return true;
1373
+ }
1374
+ if (!isPlainObject(config)) {
1375
+ devWarn(`szv(config): config must be an object, got ${describe(config)}. Ignoring.`);
1376
+ return false;
1377
+ }
1378
+ if (config.base !== void 0 && !isPlainObject(config.base)) {
1379
+ devWarn(`szv(config): base must be an sz object, got ${describe(config.base)}.`);
1380
+ }
1381
+ if (!isPlainObject(config.variants)) {
1382
+ devWarn(
1383
+ `szv(config): variants is required and must be an object, got ${describe(config.variants)}. Ignoring.`
1384
+ );
1385
+ return false;
1386
+ }
1387
+ for (const dim of Object.keys(config.variants)) {
1388
+ const values = config.variants[dim];
1389
+ if (!isPlainObject(values)) {
1390
+ devWarn(
1391
+ `szv(config): variants.${dim} must be an object of values, got ${describe(values)}.`
1392
+ );
1393
+ continue;
1394
+ }
1395
+ for (const token of Object.keys(values)) {
1396
+ const v = values[token];
1397
+ if (v !== null && v !== void 0 && !isPlainObject(v)) {
1398
+ devWarn(
1399
+ `szv(config): variants.${dim}.${token} must be an sz object, got ${describe(v)}. It will be skipped.`
1400
+ );
1401
+ } else if (isPlainObject(v)) {
1402
+ assertBoundedDepth(v, `variants.${dim}.${token}`);
1403
+ }
1404
+ }
1405
+ }
1406
+ if (config.defaultVariants !== void 0 && !isPlainObject(config.defaultVariants)) {
1407
+ devWarn(
1408
+ `szv(config): defaultVariants must be an object, got ${describe(config.defaultVariants)}.`
1409
+ );
1410
+ }
1411
+ return true;
1412
+ }
1413
+ function assertBoundedDepth(obj, where, depth = 0) {
1414
+ if (depth >= browser.MAX_SZ_DEPTH) {
1415
+ devWarn(
1416
+ `szv(config): ${where} nests deeper than ${browser.MAX_SZ_DEPTH} levels; it will be rejected at render.`
1417
+ );
1418
+ return;
1419
+ }
1420
+ for (const key of Object.keys(obj)) {
1421
+ if (browser.isForbiddenSzKey(key)) {
1422
+ devWarn(`szv(config): ${where} has a forbidden key "${key}"; it will be skipped.`);
1423
+ continue;
1424
+ }
1425
+ const v = obj[key];
1426
+ if (isPlainObject(v)) {
1427
+ assertBoundedDepth(v, `${where}.${key}`, depth + 1);
1428
+ }
1429
+ }
1430
+ }
1431
+ function describe(value) {
1432
+ if (value === null) return "null";
1433
+ if (Array.isArray(value)) return "an array";
1434
+ return typeof value;
1435
+ }
909
1436
  function szv(config) {
1437
+ const configValid = validateSzvConfig(config);
910
1438
  return function szVariantFn(selection) {
1439
+ if (!configValid) {
1440
+ return isPlainObject(config?.base) ? { ...config.base } : {};
1441
+ }
1442
+ if (process.env.NODE_ENV !== "production" && selection) {
1443
+ for (const key of Object.keys(selection)) {
1444
+ if (!(key in config.variants)) {
1445
+ devWarn(
1446
+ `szv()(selection): unknown variant "${key}" \u2014 not declared in config.variants.`
1447
+ );
1448
+ continue;
1449
+ }
1450
+ const val = selection[key];
1451
+ if (val !== null && val !== void 0 && !(String(val) in config.variants[key])) {
1452
+ devWarn(
1453
+ `szv()(selection): "${String(val)}" is not a value of variant "${key}" \u2014 it has no styles.`
1454
+ );
1455
+ }
1456
+ }
1457
+ }
911
1458
  let result = config.base ? { ...config.base } : {};
912
1459
  const resolved = { ...config.defaultVariants };
913
1460
  if (selection) {
@@ -921,13 +1468,13 @@ function szv(config) {
921
1468
  }
922
1469
  }
923
1470
  }
924
- for (const variantKey of Object.keys(config.variants)) {
1471
+ for (const variantKey of Object.keys(config.variants ?? {})) {
925
1472
  const selectedValue = resolved[variantKey];
926
1473
  if (selectedValue === null || selectedValue === void 0) {
927
1474
  continue;
928
1475
  }
929
1476
  const variantObj = config.variants[variantKey][selectedValue];
930
- if (variantObj) {
1477
+ if (isPlainObject(variantObj)) {
931
1478
  result = deepMerge(result, variantObj);
932
1479
  }
933
1480
  }
@@ -986,6 +1533,7 @@ exports._szMerge = _szMerge;
986
1533
  exports.abortHydration = abortHydration;
987
1534
  exports.attemptCSRRecovery = attemptCSRRecovery;
988
1535
  exports.classify = classify;
1536
+ exports.classifySzKey = classifySzKey;
989
1537
  exports.clearHydrationErrors = clearHydrationErrors;
990
1538
  exports.computeMangleChecksumAsync = computeMangleChecksumAsync;
991
1539
  exports.disableCSRRecovery = disableCSRRecovery;
@@ -999,6 +1547,7 @@ exports.getSSRContext = getSSRContext;
999
1547
  exports.guardHydration = guardHydration;
1000
1548
  exports.has = has;
1001
1549
  exports.hasRecoveryToken = hasRecoveryToken;
1550
+ exports.hasSz = hasSz;
1002
1551
  exports.initRuntime = initRuntime;
1003
1552
  exports.isCSRRecoveryAllowed = isCSRRecoveryAllowed;
1004
1553
  exports.isHydrating = isHydrating;
@@ -1010,9 +1559,12 @@ exports.isValidManifest = isValidManifest;
1010
1559
  exports.loadMangleMapFromDOM = loadMangleMapFromDOM;
1011
1560
  exports.loadManifestFromDOM = loadManifestFromDOM;
1012
1561
  exports.omit = omit;
1562
+ exports.omitSz = omitSz;
1013
1563
  exports.pick = pick;
1564
+ exports.pickSz = pickSz;
1014
1565
  exports.resetRuntime = resetRuntime;
1015
1566
  exports.splitBox = splitBox;
1567
+ exports.splitBoxSz = splitBoxSz;
1016
1568
  exports.startHydration = startHydration;
1017
1569
  exports.stripSzProps = stripSzProps;
1018
1570
  exports.szv = szv;