@kbach/react-native 1.0.0 → 1.1.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,13 +10,13 @@ import {
10
10
  subscribeDynamicTokens,
11
11
  subscribeGlobalDarkMode,
12
12
  toggleGlobalDarkMode
13
- } from "./chunk-7CNURQSH.mjs";
13
+ } from "./chunk-FSO4WVCH.mjs";
14
14
  import {
15
15
  defaultTheme,
16
16
  getTheme,
17
17
  resolveClassName,
18
18
  setTheme
19
- } from "./chunk-MUPEQJRT.mjs";
19
+ } from "./chunk-R7E5D3D6.mjs";
20
20
 
21
21
  // src/config.ts
22
22
  function parseHexRgb(hex) {
@@ -1151,6 +1151,73 @@ var import_react_native2 = require("react-native");
1151
1151
  var import_theme2 = require("./theme");
1152
1152
  var import_darkModeStore2 = require("./darkModeStore");
1153
1153
 
1154
+ // src/jsEngine/groups.ts
1155
+ function expandVariantGroups(input) {
1156
+ if (!input.includes(":(")) return input;
1157
+ const out = [];
1158
+ for (const token of splitTopLevel(input)) expandToken(token, "", false, out);
1159
+ return out.join(" ");
1160
+ }
1161
+ function splitTopLevel(s) {
1162
+ const parts = [];
1163
+ let depth = 0;
1164
+ let start = -1;
1165
+ for (let i = 0; i < s.length; i++) {
1166
+ const ch = s[i];
1167
+ if (ch === "(" || ch === "[") depth++;
1168
+ else if (ch === ")" || ch === "]") depth--;
1169
+ const space = /\s/.test(ch);
1170
+ if (space && depth <= 0) {
1171
+ if (start >= 0) {
1172
+ parts.push(s.slice(start, i));
1173
+ start = -1;
1174
+ }
1175
+ depth = Math.max(depth, 0);
1176
+ } else if (start < 0 && !space) {
1177
+ start = i;
1178
+ }
1179
+ }
1180
+ if (start >= 0) parts.push(s.slice(start));
1181
+ return parts;
1182
+ }
1183
+ function groupOpen(token) {
1184
+ let brackets = 0;
1185
+ for (let i = 0; i < token.length; i++) {
1186
+ const ch = token[i];
1187
+ if (ch === "[") brackets++;
1188
+ else if (ch === "]") brackets--;
1189
+ else if (ch === "(" && brackets === 0 && i > 1 && token[i - 1] === ":") return i;
1190
+ }
1191
+ return -1;
1192
+ }
1193
+ function groupClose(token, open) {
1194
+ let depth = 0;
1195
+ for (let i = open; i < token.length; i++) {
1196
+ const ch = token[i];
1197
+ if (ch === "(" || ch === "[") depth++;
1198
+ else if (ch === ")" || ch === "]") {
1199
+ depth--;
1200
+ if (depth === 0) return ch === ")" ? i : -1;
1201
+ }
1202
+ }
1203
+ return -1;
1204
+ }
1205
+ function pushClass(prefix, cls, important, out) {
1206
+ if (!cls) return;
1207
+ const bare = cls.split(":").pop() ?? cls;
1208
+ out.push(prefix + cls + (important && !cls.endsWith("!") && !bare.startsWith("!") ? "!" : ""));
1209
+ }
1210
+ function expandToken(token, prefix, important, out) {
1211
+ const open = groupOpen(token);
1212
+ if (open < 0) return pushClass(prefix, token, important, out);
1213
+ const close = groupClose(token, open);
1214
+ if (close < 0) return pushClass(prefix, token, important, out);
1215
+ const rest = token.slice(close + 1);
1216
+ if (rest !== "" && rest !== "!") return pushClass(prefix, token, important, out);
1217
+ const innerPrefix = prefix + token.slice(0, open);
1218
+ for (const part of splitTopLevel(token.slice(open + 1, close))) expandToken(part, innerPrefix, rest === "!" || important, out);
1219
+ }
1220
+
1154
1221
  // src/jsEngine/shared.ts
1155
1222
  function decl(property, value) {
1156
1223
  return { property, value };
@@ -2450,6 +2517,7 @@ Fix: use a plain px/rem calc, a fraction utility (e.g. w-1/2), or resolve this v
2450
2517
  return { value: null, warning };
2451
2518
  }
2452
2519
  function resolveStyleJsWithWarnings(classString, theme, colorScheme, pressed, width) {
2520
+ classString = expandVariantGroups(classString);
2453
2521
  const style = {};
2454
2522
  const warnings = [];
2455
2523
  let shadowOffset = null;