@kbach/react 0.5.34 → 0.5.36

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.
@@ -3,15 +3,16 @@ import {
3
3
  InteractiveWrapper,
4
4
  useConditionalWidth,
5
5
  useGlobalDarkMode
6
- } from "./chunk-6AUSWRH2.mjs";
6
+ } from "./chunk-D2LLZADB.mjs";
7
7
  import {
8
8
  flatten,
9
9
  getActiveBreakpoints,
10
10
  getConfig,
11
11
  getDefaultFontFamily,
12
12
  isWeb,
13
+ normalizeClassString,
13
14
  resolve
14
- } from "./chunk-T3SOZ6AO.mjs";
15
+ } from "./chunk-QTZGBGGJ.mjs";
15
16
 
16
17
  // src/jsx-runtime.tsx
17
18
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -214,7 +215,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
214
215
  return _jsx(InteractiveWrapper, {
215
216
  Component: actualType,
216
217
  resolvedStyle: resolved,
217
- ...isWeb && classStr ? { className: classStr } : {},
218
+ ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {},
218
219
  style: userStyle,
219
220
  ...passProps
220
221
  }, key);
@@ -223,7 +224,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
223
224
  return _jsx(DarkWrapper, {
224
225
  Component: actualType,
225
226
  resolvedStyle: resolved,
226
- ...isWeb && classStr ? { className: classStr } : {},
227
+ ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {},
227
228
  style: userStyle,
228
229
  ...passProps
229
230
  }, key);
@@ -235,7 +236,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
235
236
  return makeElement(isStaticChildren, actualType, {
236
237
  ...passProps,
237
238
  style: finalStyle,
238
- ...isWeb && classStr ? { className: classStr } : {}
239
+ ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {}
239
240
  }, key);
240
241
  }
241
242
  function jsx(type, props, key) {
@@ -4,7 +4,7 @@ import {
4
4
  getGlobalWidth,
5
5
  isWeb,
6
6
  subscribeGlobalWidth
7
- } from "./chunk-T3SOZ6AO.mjs";
7
+ } from "./chunk-QTZGBGGJ.mjs";
8
8
 
9
9
  // src/core/darkModeStore.ts
10
10
  var KEY = "__kbach_dark_store__";
@@ -1249,7 +1249,7 @@ function parseClass(className) {
1249
1249
  const bracketStart = remaining.lastIndexOf("-[");
1250
1250
  if (bracketStart > 0 && remaining.endsWith("]")) {
1251
1251
  const utility = remaining.slice(0, bracketStart);
1252
- const value = remaining.slice(bracketStart + 2, -1);
1252
+ const value = remaining.slice(bracketStart + 2, -1).replace(/_/g, " ");
1253
1253
  return { original: trimmed, modifiers, negative, important, utility, value, isArbitrary: true };
1254
1254
  }
1255
1255
  if (STANDALONE_UTILITIES.has(remaining)) {
@@ -1278,10 +1278,42 @@ function parseClass(className) {
1278
1278
  }
1279
1279
  return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
1280
1280
  }
1281
+ function splitClassTokens(classString) {
1282
+ const tokens = [];
1283
+ let current = "";
1284
+ let depth = 0;
1285
+ for (let i = 0; i < classString.length; i++) {
1286
+ const ch = classString[i];
1287
+ if (ch === "[") {
1288
+ depth++;
1289
+ current += ch;
1290
+ continue;
1291
+ }
1292
+ if (ch === "]") {
1293
+ depth--;
1294
+ current += ch;
1295
+ continue;
1296
+ }
1297
+ if (/\s/.test(ch)) {
1298
+ if (depth === 0) {
1299
+ if (current) {
1300
+ tokens.push(current);
1301
+ current = "";
1302
+ }
1303
+ }
1304
+ } else {
1305
+ current += ch;
1306
+ }
1307
+ }
1308
+ if (current) tokens.push(current);
1309
+ return tokens;
1310
+ }
1311
+ function normalizeClassString(classString) {
1312
+ return splitClassTokens(classString).join(" ");
1313
+ }
1281
1314
  function parseClasses(classString) {
1282
1315
  const results = [];
1283
- for (const token of classString.split(/\s+/)) {
1284
- if (!token) continue;
1316
+ for (const token of splitClassTokens(classString)) {
1285
1317
  const parsed = parseClass(token);
1286
1318
  if (parsed) results.push(parsed);
1287
1319
  }
@@ -3559,6 +3591,8 @@ export {
3559
3591
  isWeb,
3560
3592
  setCSSGenMode,
3561
3593
  parseClass,
3594
+ splitClassTokens,
3595
+ normalizeClassString,
3562
3596
  parseClasses,
3563
3597
  syncGlobalWidth,
3564
3598
  syncGlobalScreens,
package/dist/index.d.mts CHANGED
@@ -7,6 +7,19 @@ declare const defaultColors: ThemeColors;
7
7
  declare const defaultTheme: ThemeConfig;
8
8
 
9
9
  declare function parseClass(className: string): ParsedClass | null;
10
+ /**
11
+ * Split a class string into tokens. Whitespace at bracket depth > 0 is STRIPPED
12
+ * (not just skipped as a delimiter) so that arbitrary values like rgb(41, 172, 15)
13
+ * become valid CSS class name tokens: bg-[rgb(41,172,15)].
14
+ * Spaces inside brackets are illegal in HTML class attributes and would cause the
15
+ * browser to split the class into multiple broken tokens.
16
+ */
17
+ declare function splitClassTokens(classString: string): string[];
18
+ /**
19
+ * Normalize a full class string so it is safe to use as an HTML className value.
20
+ * Strips spaces inside brackets: "bg-[rgb(41, 172, 15)] p-4" → "bg-[rgb(41,172,15)] p-4"
21
+ */
22
+ declare function normalizeClassString(classString: string): string;
10
23
  /** Parse a space-separated class string into individual ParsedClass objects. */
11
24
  declare function parseClasses(classString: string): ParsedClass[];
12
25
 
@@ -301,4 +314,4 @@ declare function kb(classString: string, isDark?: boolean): StyleValue | string;
301
314
  */
302
315
  declare function cx(...classes: Array<string | false | null | undefined>): string;
303
316
 
304
- export { type ColorScale, type ColorsAPI, FrameworkConfig, type InteractionState, InteractiveWrapper, type InteractiveWrapperProps, ParsedClass, ResolvedConfig, ResolvedStyle, StyleValue, type StyledProps, ThemeConfig, ThemeContext, type ThemeContextValue, ThemeMode, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, type ToggleVariant, buildConfig, cx, defaultColors, defaultTheme, flatten, getConfig, initConfig, kb, parseClass, parseClasses, resolve, styled, updateConfig, useBreakpoint, useColors, useGlobalDarkMode, useIsDark, useResolvedStyle, useResponsive, useStyles, useTheme, wrapColors };
317
+ export { type ColorScale, type ColorsAPI, FrameworkConfig, type InteractionState, InteractiveWrapper, type InteractiveWrapperProps, ParsedClass, ResolvedConfig, ResolvedStyle, StyleValue, type StyledProps, ThemeConfig, ThemeContext, type ThemeContextValue, ThemeMode, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, type ToggleVariant, buildConfig, cx, defaultColors, defaultTheme, flatten, getConfig, initConfig, kb, normalizeClassString, parseClass, parseClasses, resolve, splitClassTokens, styled, updateConfig, useBreakpoint, useColors, useGlobalDarkMode, useIsDark, useResolvedStyle, useResponsive, useStyles, useTheme, wrapColors };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,19 @@ declare const defaultColors: ThemeColors;
7
7
  declare const defaultTheme: ThemeConfig;
8
8
 
9
9
  declare function parseClass(className: string): ParsedClass | null;
10
+ /**
11
+ * Split a class string into tokens. Whitespace at bracket depth > 0 is STRIPPED
12
+ * (not just skipped as a delimiter) so that arbitrary values like rgb(41, 172, 15)
13
+ * become valid CSS class name tokens: bg-[rgb(41,172,15)].
14
+ * Spaces inside brackets are illegal in HTML class attributes and would cause the
15
+ * browser to split the class into multiple broken tokens.
16
+ */
17
+ declare function splitClassTokens(classString: string): string[];
18
+ /**
19
+ * Normalize a full class string so it is safe to use as an HTML className value.
20
+ * Strips spaces inside brackets: "bg-[rgb(41, 172, 15)] p-4" → "bg-[rgb(41,172,15)] p-4"
21
+ */
22
+ declare function normalizeClassString(classString: string): string;
10
23
  /** Parse a space-separated class string into individual ParsedClass objects. */
11
24
  declare function parseClasses(classString: string): ParsedClass[];
12
25
 
@@ -301,4 +314,4 @@ declare function kb(classString: string, isDark?: boolean): StyleValue | string;
301
314
  */
302
315
  declare function cx(...classes: Array<string | false | null | undefined>): string;
303
316
 
304
- export { type ColorScale, type ColorsAPI, FrameworkConfig, type InteractionState, InteractiveWrapper, type InteractiveWrapperProps, ParsedClass, ResolvedConfig, ResolvedStyle, StyleValue, type StyledProps, ThemeConfig, ThemeContext, type ThemeContextValue, ThemeMode, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, type ToggleVariant, buildConfig, cx, defaultColors, defaultTheme, flatten, getConfig, initConfig, kb, parseClass, parseClasses, resolve, styled, updateConfig, useBreakpoint, useColors, useGlobalDarkMode, useIsDark, useResolvedStyle, useResponsive, useStyles, useTheme, wrapColors };
317
+ export { type ColorScale, type ColorsAPI, FrameworkConfig, type InteractionState, InteractiveWrapper, type InteractiveWrapperProps, ParsedClass, ResolvedConfig, ResolvedStyle, StyleValue, type StyledProps, ThemeConfig, ThemeContext, type ThemeContextValue, ThemeMode, ThemeProvider, type ThemeProviderProps, ThemeToggle, type ThemeToggleProps, type ToggleVariant, buildConfig, cx, defaultColors, defaultTheme, flatten, getConfig, initConfig, kb, normalizeClassString, parseClass, parseClasses, resolve, splitClassTokens, styled, updateConfig, useBreakpoint, useColors, useGlobalDarkMode, useIsDark, useResolvedStyle, useResponsive, useStyles, useTheme, wrapColors };
package/dist/index.js CHANGED
@@ -42,9 +42,11 @@ __export(index_exports, {
42
42
  getConfig: () => getConfig,
43
43
  initConfig: () => initConfig,
44
44
  kb: () => kb,
45
+ normalizeClassString: () => normalizeClassString,
45
46
  parseClass: () => parseClass,
46
47
  parseClasses: () => parseClasses,
47
48
  resolve: () => resolve,
49
+ splitClassTokens: () => splitClassTokens,
48
50
  styled: () => styled,
49
51
  updateConfig: () => updateConfig,
50
52
  useBreakpoint: () => useBreakpoint,
@@ -1412,7 +1414,7 @@ function parseClass(className) {
1412
1414
  const bracketStart = remaining.lastIndexOf("-[");
1413
1415
  if (bracketStart > 0 && remaining.endsWith("]")) {
1414
1416
  const utility = remaining.slice(0, bracketStart);
1415
- const value = remaining.slice(bracketStart + 2, -1);
1417
+ const value = remaining.slice(bracketStart + 2, -1).replace(/_/g, " ");
1416
1418
  return { original: trimmed, modifiers, negative, important, utility, value, isArbitrary: true };
1417
1419
  }
1418
1420
  if (STANDALONE_UTILITIES.has(remaining)) {
@@ -1441,10 +1443,42 @@ function parseClass(className) {
1441
1443
  }
1442
1444
  return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
1443
1445
  }
1446
+ function splitClassTokens(classString) {
1447
+ const tokens = [];
1448
+ let current = "";
1449
+ let depth = 0;
1450
+ for (let i = 0; i < classString.length; i++) {
1451
+ const ch = classString[i];
1452
+ if (ch === "[") {
1453
+ depth++;
1454
+ current += ch;
1455
+ continue;
1456
+ }
1457
+ if (ch === "]") {
1458
+ depth--;
1459
+ current += ch;
1460
+ continue;
1461
+ }
1462
+ if (/\s/.test(ch)) {
1463
+ if (depth === 0) {
1464
+ if (current) {
1465
+ tokens.push(current);
1466
+ current = "";
1467
+ }
1468
+ }
1469
+ } else {
1470
+ current += ch;
1471
+ }
1472
+ }
1473
+ if (current) tokens.push(current);
1474
+ return tokens;
1475
+ }
1476
+ function normalizeClassString(classString) {
1477
+ return splitClassTokens(classString).join(" ");
1478
+ }
1444
1479
  function parseClasses(classString) {
1445
1480
  const results = [];
1446
- for (const token of classString.split(/\s+/)) {
1447
- if (!token) continue;
1481
+ for (const token of splitClassTokens(classString)) {
1448
1482
  const parsed = parseClass(token);
1449
1483
  if (parsed) results.push(parsed);
1450
1484
  }
@@ -4099,7 +4133,7 @@ function styled(Component, baseClasses = "") {
4099
4133
  ...rest,
4100
4134
  style: finalStyle,
4101
4135
  // className lets injected CSS rules (group-hover:, before:, print:, etc.) match the element.
4102
- ...isWeb && combined ? { className: combined } : {},
4136
+ ...isWeb && combined ? { className: normalizeClassString(combined) } : {},
4103
4137
  // onPressIn / onPressOut are React Native-only; on web use Pointer Events instead.
4104
4138
  ...isWeb ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
4105
4139
  onMouseEnter: handleMouseEnter,
@@ -4306,9 +4340,11 @@ function cx(...classes) {
4306
4340
  getConfig,
4307
4341
  initConfig,
4308
4342
  kb,
4343
+ normalizeClassString,
4309
4344
  parseClass,
4310
4345
  parseClasses,
4311
4346
  resolve,
4347
+ splitClassTokens,
4312
4348
  styled,
4313
4349
  updateConfig,
4314
4350
  useBreakpoint,
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  useConditionalWidth,
7
7
  useGlobalDarkMode,
8
8
  useGlobalWidth
9
- } from "./chunk-6AUSWRH2.mjs";
9
+ } from "./chunk-D2LLZADB.mjs";
10
10
  import {
11
11
  __require,
12
12
  buildConfig,
@@ -17,15 +17,17 @@ import {
17
17
  getConfig,
18
18
  initConfig,
19
19
  isWeb,
20
+ normalizeClassString,
20
21
  onConfigChange,
21
22
  parseClass,
22
23
  parseClasses,
23
24
  resolve,
24
25
  setGlobalWidth,
26
+ splitClassTokens,
25
27
  syncGlobalScreens,
26
28
  syncGlobalWidth,
27
29
  updateConfig
28
- } from "./chunk-T3SOZ6AO.mjs";
30
+ } from "./chunk-QTZGBGGJ.mjs";
29
31
 
30
32
  // src/context.tsx
31
33
  import { createContext, useContext } from "react";
@@ -458,7 +460,7 @@ function styled(Component, baseClasses = "") {
458
460
  ...rest,
459
461
  style: finalStyle,
460
462
  // className lets injected CSS rules (group-hover:, before:, print:, etc.) match the element.
461
- ...isWeb && combined ? { className: combined } : {},
463
+ ...isWeb && combined ? { className: normalizeClassString(combined) } : {},
462
464
  // onPressIn / onPressOut are React Native-only; on web use Pointer Events instead.
463
465
  ...isWeb ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
464
466
  onMouseEnter: handleMouseEnter,
@@ -541,9 +543,11 @@ export {
541
543
  getConfig,
542
544
  initConfig,
543
545
  kb,
546
+ normalizeClassString,
544
547
  parseClass,
545
548
  parseClasses,
546
549
  resolve,
550
+ splitClassTokens,
547
551
  styled,
548
552
  updateConfig,
549
553
  useBreakpoint,
@@ -1316,7 +1316,7 @@ function parseClass(className) {
1316
1316
  const bracketStart = remaining.lastIndexOf("-[");
1317
1317
  if (bracketStart > 0 && remaining.endsWith("]")) {
1318
1318
  const utility = remaining.slice(0, bracketStart);
1319
- const value = remaining.slice(bracketStart + 2, -1);
1319
+ const value = remaining.slice(bracketStart + 2, -1).replace(/_/g, " ");
1320
1320
  return { original: trimmed, modifiers, negative, important, utility, value, isArbitrary: true };
1321
1321
  }
1322
1322
  if (STANDALONE_UTILITIES.has(remaining)) {
@@ -1345,10 +1345,42 @@ function parseClass(className) {
1345
1345
  }
1346
1346
  return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
1347
1347
  }
1348
+ function splitClassTokens(classString) {
1349
+ const tokens = [];
1350
+ let current = "";
1351
+ let depth = 0;
1352
+ for (let i = 0; i < classString.length; i++) {
1353
+ const ch = classString[i];
1354
+ if (ch === "[") {
1355
+ depth++;
1356
+ current += ch;
1357
+ continue;
1358
+ }
1359
+ if (ch === "]") {
1360
+ depth--;
1361
+ current += ch;
1362
+ continue;
1363
+ }
1364
+ if (/\s/.test(ch)) {
1365
+ if (depth === 0) {
1366
+ if (current) {
1367
+ tokens.push(current);
1368
+ current = "";
1369
+ }
1370
+ }
1371
+ } else {
1372
+ current += ch;
1373
+ }
1374
+ }
1375
+ if (current) tokens.push(current);
1376
+ return tokens;
1377
+ }
1378
+ function normalizeClassString(classString) {
1379
+ return splitClassTokens(classString).join(" ");
1380
+ }
1348
1381
  function parseClasses(classString) {
1349
1382
  const results = [];
1350
- for (const token of classString.split(/\s+/)) {
1351
- if (!token) continue;
1383
+ for (const token of splitClassTokens(classString)) {
1352
1384
  const parsed = parseClass(token);
1353
1385
  if (parsed) results.push(parsed);
1354
1386
  }
@@ -3922,7 +3954,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
3922
3954
  return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
3923
3955
  Component: actualType,
3924
3956
  resolvedStyle: resolved,
3925
- ...isWeb && classStr ? { className: classStr } : {},
3957
+ ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {},
3926
3958
  style: userStyle,
3927
3959
  ...passProps
3928
3960
  }, key);
@@ -3931,7 +3963,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
3931
3963
  return (0, import_jsx_runtime.jsx)(DarkWrapper, {
3932
3964
  Component: actualType,
3933
3965
  resolvedStyle: resolved,
3934
- ...isWeb && classStr ? { className: classStr } : {},
3966
+ ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {},
3935
3967
  style: userStyle,
3936
3968
  ...passProps
3937
3969
  }, key);
@@ -3943,7 +3975,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
3943
3975
  return makeElement(isStaticChildren, actualType, {
3944
3976
  ...passProps,
3945
3977
  style: finalStyle,
3946
- ...isWeb && classStr ? { className: classStr } : {}
3978
+ ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {}
3947
3979
  }, key);
3948
3980
  }
3949
3981
  function jsx(type, props, key) {
@@ -2,9 +2,9 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-LMCUZ3HI.mjs";
6
- import "./chunk-6AUSWRH2.mjs";
7
- import "./chunk-T3SOZ6AO.mjs";
5
+ } from "./chunk-AZJVYYAX.mjs";
6
+ import "./chunk-D2LLZADB.mjs";
7
+ import "./chunk-QTZGBGGJ.mjs";
8
8
 
9
9
  // src/jsx-dev-runtime.tsx
10
10
  function jsxDEV(type, props, key, isStaticChildren, _source, _self) {
@@ -1315,7 +1315,7 @@ function parseClass(className) {
1315
1315
  const bracketStart = remaining.lastIndexOf("-[");
1316
1316
  if (bracketStart > 0 && remaining.endsWith("]")) {
1317
1317
  const utility = remaining.slice(0, bracketStart);
1318
- const value = remaining.slice(bracketStart + 2, -1);
1318
+ const value = remaining.slice(bracketStart + 2, -1).replace(/_/g, " ");
1319
1319
  return { original: trimmed, modifiers, negative, important, utility, value, isArbitrary: true };
1320
1320
  }
1321
1321
  if (STANDALONE_UTILITIES.has(remaining)) {
@@ -1344,10 +1344,42 @@ function parseClass(className) {
1344
1344
  }
1345
1345
  return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
1346
1346
  }
1347
+ function splitClassTokens(classString) {
1348
+ const tokens = [];
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;
1376
+ }
1377
+ function normalizeClassString(classString) {
1378
+ return splitClassTokens(classString).join(" ");
1379
+ }
1347
1380
  function parseClasses(classString) {
1348
1381
  const results = [];
1349
- for (const token of classString.split(/\s+/)) {
1350
- if (!token) continue;
1382
+ for (const token of splitClassTokens(classString)) {
1351
1383
  const parsed = parseClass(token);
1352
1384
  if (parsed) results.push(parsed);
1353
1385
  }
@@ -3921,7 +3953,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
3921
3953
  return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
3922
3954
  Component: actualType,
3923
3955
  resolvedStyle: resolved,
3924
- ...isWeb && classStr ? { className: classStr } : {},
3956
+ ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {},
3925
3957
  style: userStyle,
3926
3958
  ...passProps
3927
3959
  }, key);
@@ -3930,7 +3962,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
3930
3962
  return (0, import_jsx_runtime.jsx)(DarkWrapper, {
3931
3963
  Component: actualType,
3932
3964
  resolvedStyle: resolved,
3933
- ...isWeb && classStr ? { className: classStr } : {},
3965
+ ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {},
3934
3966
  style: userStyle,
3935
3967
  ...passProps
3936
3968
  }, key);
@@ -3942,7 +3974,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
3942
3974
  return makeElement(isStaticChildren, actualType, {
3943
3975
  ...passProps,
3944
3976
  style: finalStyle,
3945
- ...isWeb && classStr ? { className: classStr } : {}
3977
+ ...isWeb && classStr ? { className: normalizeClassString(classStr) } : {}
3946
3978
  }, key);
3947
3979
  }
3948
3980
  function jsx(type, props, key) {
@@ -2,9 +2,9 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-LMCUZ3HI.mjs";
6
- import "./chunk-6AUSWRH2.mjs";
7
- import "./chunk-T3SOZ6AO.mjs";
5
+ } from "./chunk-AZJVYYAX.mjs";
6
+ import "./chunk-D2LLZADB.mjs";
7
+ import "./chunk-QTZGBGGJ.mjs";
8
8
  export {
9
9
  Fragment,
10
10
  jsx,
@@ -2896,7 +2896,7 @@ function parseClass(className) {
2896
2896
  const bracketStart = remaining.lastIndexOf("-[");
2897
2897
  if (bracketStart > 0 && remaining.endsWith("]")) {
2898
2898
  const utility = remaining.slice(0, bracketStart);
2899
- const value = remaining.slice(bracketStart + 2, -1);
2899
+ const value = remaining.slice(bracketStart + 2, -1).replace(/_/g, " ");
2900
2900
  return { original: trimmed, modifiers, negative, important, utility, value, isArbitrary: true };
2901
2901
  }
2902
2902
  if (STANDALONE_UTILITIES.has(remaining)) {
@@ -2925,10 +2925,39 @@ function parseClass(className) {
2925
2925
  }
2926
2926
  return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
2927
2927
  }
2928
+ function splitClassTokens(classString) {
2929
+ const tokens = [];
2930
+ let current = "";
2931
+ let depth = 0;
2932
+ for (let i = 0; i < classString.length; i++) {
2933
+ const ch = classString[i];
2934
+ if (ch === "[") {
2935
+ depth++;
2936
+ current += ch;
2937
+ continue;
2938
+ }
2939
+ if (ch === "]") {
2940
+ depth--;
2941
+ current += ch;
2942
+ continue;
2943
+ }
2944
+ if (/\s/.test(ch)) {
2945
+ if (depth === 0) {
2946
+ if (current) {
2947
+ tokens.push(current);
2948
+ current = "";
2949
+ }
2950
+ }
2951
+ } else {
2952
+ current += ch;
2953
+ }
2954
+ }
2955
+ if (current) tokens.push(current);
2956
+ return tokens;
2957
+ }
2928
2958
  function parseClasses(classString) {
2929
2959
  const results = [];
2930
- for (const token of classString.split(/\s+/)) {
2931
- if (!token) continue;
2960
+ for (const token of splitClassTokens(classString)) {
2932
2961
  const parsed = parseClass(token);
2933
2962
  if (parsed) results.push(parsed);
2934
2963
  }
@@ -3509,7 +3538,7 @@ function kbach(userConfig) {
3509
3538
  for (const dir of ["src", "app", "pages", "components", "views", "layouts"]) {
3510
3539
  scanDir((0, import_path.join)(root, dir), (code) => {
3511
3540
  for (const cls of extractClassStrings(code))
3512
- for (const token of cls.split(/\s+/).filter(Boolean))
3541
+ for (const token of splitClassTokens(cls))
3513
3542
  if (!tokenCSS.has(token)) {
3514
3543
  const css = generateClassCSS(token, cfg.theme, cfg.darkMode, screens);
3515
3544
  tokenCSS.set(token, css);
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  buildConfig,
3
3
  generateClassCSS,
4
- setCSSGenMode
5
- } from "./chunk-T3SOZ6AO.mjs";
4
+ setCSSGenMode,
5
+ splitClassTokens
6
+ } from "./chunk-QTZGBGGJ.mjs";
6
7
 
7
8
  // src/vite-plugin.ts
8
9
  import { readFileSync, writeFileSync, existsSync, readdirSync, statSync } from "fs";
@@ -150,7 +151,7 @@ function kbach(userConfig) {
150
151
  for (const dir of ["src", "app", "pages", "components", "views", "layouts"]) {
151
152
  scanDir(join(root, dir), (code) => {
152
153
  for (const cls of extractClassStrings(code))
153
- for (const token of cls.split(/\s+/).filter(Boolean))
154
+ for (const token of splitClassTokens(cls))
154
155
  if (!tokenCSS.has(token)) {
155
156
  const css = generateClassCSS(token, cfg.theme, cfg.darkMode, screens);
156
157
  tokenCSS.set(token, css);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.5.34",
3
+ "version": "0.5.36",
4
4
  "description": "React / React Native components and hooks for the Kbach framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",