@kbach/react 1.0.0-beta.20 → 1.0.0-beta.21
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
|
|
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 <
|
|
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 =
|
|
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 <
|
|
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);
|
package/dist/postcss-plugin.js
CHANGED
|
@@ -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
|
|
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 <
|
|
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 =
|
|
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 <
|
|
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);
|
package/dist/postcss-plugin.mjs
CHANGED
package/dist/vite-plugin.js
CHANGED
|
@@ -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
|
|
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 <
|
|
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 =
|
|
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 <
|
|
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);
|
package/dist/vite-plugin.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kbach/react",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.21",
|
|
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.
|
|
75
|
+
"@kbach/core-engine": "1.0.0-beta.12"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@types/react": "^19.2.0",
|