@kbach/react 1.0.0-beta.20 → 1.0.0-beta.22

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.
@@ -336,12 +336,14 @@ function extractClassStrings(rawCode) {
336
336
  const simpleRe = /(?:className|kb)=(["'])((?:(?!\1).)*)\1/g;
337
337
  let m;
338
338
  while ((m = simpleRe.exec(code)) !== null) pushTokens(m[2], found);
339
- const jsxExprRe = /(?:className|kb)=\{/g;
339
+ const MAX_BLOCK_SCAN_LEN = 2e4;
340
+ const jsxExprRe = /\b(?:className|kb)=\{/g;
340
341
  while ((m = jsxExprRe.exec(code)) !== null) {
341
342
  let depth = 1;
342
343
  let i = m.index + m[0].length;
344
+ const scanEnd = Math.min(code.length, i + MAX_BLOCK_SCAN_LEN);
343
345
  let block = "";
344
- while (i < code.length && depth > 0) {
346
+ while (i < scanEnd && depth > 0) {
345
347
  const ch = code[i];
346
348
  if (ch === "{") depth++;
347
349
  else if (ch === "}") {
@@ -351,14 +353,15 @@ function extractClassStrings(rawCode) {
351
353
  i++;
352
354
  }
353
355
  jsxExprRe.lastIndex = i + 1;
354
- pushClassLikeStrings(block, found);
356
+ if (depth === 0) pushClassLikeStrings(block, found);
355
357
  }
356
- const classComposerCallRe = /(?:clsx|cn|classnames|cx|kb)\(/g;
358
+ const classComposerCallRe = /\b(?:clsx|cn|classnames|cx|kb)\(/g;
357
359
  while ((m = classComposerCallRe.exec(code)) !== null) {
358
360
  let depth = 1;
359
361
  let i = m.index + m[0].length;
362
+ const scanEnd = Math.min(code.length, i + MAX_BLOCK_SCAN_LEN);
360
363
  let block = "";
361
- while (i < code.length && depth > 0) {
364
+ while (i < scanEnd && depth > 0) {
362
365
  const ch = code[i];
363
366
  if (ch === "(") depth++;
364
367
  else if (ch === ")") {
@@ -368,7 +371,7 @@ function extractClassStrings(rawCode) {
368
371
  i++;
369
372
  }
370
373
  classComposerCallRe.lastIndex = i + 1;
371
- pushClassLikeStrings(block, found);
374
+ if (depth === 0) pushClassLikeStrings(block, found);
372
375
  }
373
376
  const templateRe = /`([^`]{1,2000})`/g;
374
377
  while ((m = templateRe.exec(code)) !== null) pushTemplateLiteralBody(m[1], found);
@@ -165,12 +165,14 @@ function extractClassStrings(rawCode) {
165
165
  const simpleRe = /(?:className|kb)=(["'])((?:(?!\1).)*)\1/g;
166
166
  let m;
167
167
  while ((m = simpleRe.exec(code)) !== null) pushTokens(m[2], found);
168
- const jsxExprRe = /(?:className|kb)=\{/g;
168
+ const MAX_BLOCK_SCAN_LEN = 2e4;
169
+ const jsxExprRe = /\b(?:className|kb)=\{/g;
169
170
  while ((m = jsxExprRe.exec(code)) !== null) {
170
171
  let depth = 1;
171
172
  let i = m.index + m[0].length;
173
+ const scanEnd = Math.min(code.length, i + MAX_BLOCK_SCAN_LEN);
172
174
  let block = "";
173
- while (i < code.length && depth > 0) {
175
+ while (i < scanEnd && depth > 0) {
174
176
  const ch = code[i];
175
177
  if (ch === "{") depth++;
176
178
  else if (ch === "}") {
@@ -180,14 +182,15 @@ function extractClassStrings(rawCode) {
180
182
  i++;
181
183
  }
182
184
  jsxExprRe.lastIndex = i + 1;
183
- pushClassLikeStrings(block, found);
185
+ if (depth === 0) pushClassLikeStrings(block, found);
184
186
  }
185
- const classComposerCallRe = /(?:clsx|cn|classnames|cx|kb)\(/g;
187
+ const classComposerCallRe = /\b(?:clsx|cn|classnames|cx|kb)\(/g;
186
188
  while ((m = classComposerCallRe.exec(code)) !== null) {
187
189
  let depth = 1;
188
190
  let i = m.index + m[0].length;
191
+ const scanEnd = Math.min(code.length, i + MAX_BLOCK_SCAN_LEN);
189
192
  let block = "";
190
- while (i < code.length && depth > 0) {
193
+ while (i < scanEnd && depth > 0) {
191
194
  const ch = code[i];
192
195
  if (ch === "(") depth++;
193
196
  else if (ch === ")") {
@@ -197,7 +200,7 @@ function extractClassStrings(rawCode) {
197
200
  i++;
198
201
  }
199
202
  classComposerCallRe.lastIndex = i + 1;
200
- pushClassLikeStrings(block, found);
203
+ if (depth === 0) pushClassLikeStrings(block, found);
201
204
  }
202
205
  const templateRe = /`([^`]{1,2000})`/g;
203
206
  while ((m = templateRe.exec(code)) !== null) pushTemplateLiteralBody(m[1], found);
@@ -6,7 +6,7 @@ import {
6
6
  highlight,
7
7
  kbachTag,
8
8
  resolveEffectiveTheme
9
- } from "./chunk-MRBB55KV.mjs";
9
+ } from "./chunk-QYTXXF22.mjs";
10
10
  import "./chunk-43FOLRQA.mjs";
11
11
  import "./chunk-OVKVZA7B.mjs";
12
12
 
@@ -956,12 +956,14 @@ function extractClassStrings(rawCode) {
956
956
  const simpleRe = /(?:className|kb)=(["'])((?:(?!\1).)*)\1/g;
957
957
  let m;
958
958
  while ((m = simpleRe.exec(code)) !== null) pushTokens(m[2], found);
959
- const jsxExprRe = /(?:className|kb)=\{/g;
959
+ const MAX_BLOCK_SCAN_LEN = 2e4;
960
+ const jsxExprRe = /\b(?:className|kb)=\{/g;
960
961
  while ((m = jsxExprRe.exec(code)) !== null) {
961
962
  let depth = 1;
962
963
  let i = m.index + m[0].length;
964
+ const scanEnd = Math.min(code.length, i + MAX_BLOCK_SCAN_LEN);
963
965
  let block = "";
964
- while (i < code.length && depth > 0) {
966
+ while (i < scanEnd && depth > 0) {
965
967
  const ch = code[i];
966
968
  if (ch === "{") depth++;
967
969
  else if (ch === "}") {
@@ -971,14 +973,15 @@ function extractClassStrings(rawCode) {
971
973
  i++;
972
974
  }
973
975
  jsxExprRe.lastIndex = i + 1;
974
- pushClassLikeStrings(block, found);
976
+ if (depth === 0) pushClassLikeStrings(block, found);
975
977
  }
976
- const classComposerCallRe = /(?:clsx|cn|classnames|cx|kb)\(/g;
978
+ const classComposerCallRe = /\b(?:clsx|cn|classnames|cx|kb)\(/g;
977
979
  while ((m = classComposerCallRe.exec(code)) !== null) {
978
980
  let depth = 1;
979
981
  let i = m.index + m[0].length;
982
+ const scanEnd = Math.min(code.length, i + MAX_BLOCK_SCAN_LEN);
980
983
  let block = "";
981
- while (i < code.length && depth > 0) {
984
+ while (i < scanEnd && depth > 0) {
982
985
  const ch = code[i];
983
986
  if (ch === "(") depth++;
984
987
  else if (ch === ")") {
@@ -988,7 +991,7 @@ function extractClassStrings(rawCode) {
988
991
  i++;
989
992
  }
990
993
  classComposerCallRe.lastIndex = i + 1;
991
- pushClassLikeStrings(block, found);
994
+ if (depth === 0) pushClassLikeStrings(block, found);
992
995
  }
993
996
  const templateRe = /`([^`]{1,2000})`/g;
994
997
  while ((m = templateRe.exec(code)) !== null) pushTemplateLiteralBody(m[1], found);
@@ -5,7 +5,7 @@ import {
5
5
  kbach,
6
6
  loadConfigFile,
7
7
  resolveEffectiveTheme
8
- } from "./chunk-MRBB55KV.mjs";
8
+ } from "./chunk-QYTXXF22.mjs";
9
9
  import "./chunk-43FOLRQA.mjs";
10
10
  import "./chunk-OVKVZA7B.mjs";
11
11
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "1.0.0-beta.20",
3
+ "version": "1.0.0-beta.22",
4
4
  "description": "A utility-first styling engine for React, powered by a real Rust/WASM core — Tailwind CSS v4 feature parity with Kbach's own color palette.",
5
5
  "keywords": [
6
6
  "css",
@@ -72,7 +72,7 @@
72
72
  "generate:colors": "node ../core-engine/scripts/generate-palette.mjs src/generatedPalette.ts"
73
73
  },
74
74
  "dependencies": {
75
- "@kbach/core-engine": "1.0.0-beta.11"
75
+ "@kbach/core-engine": "1.0.0-beta.13"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@types/react": "^19.2.0",