tailwind-styled-v4 5.0.12 → 5.0.14

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.
Files changed (69) hide show
  1. package/README.md +100 -4
  2. package/dist/animate.d.mts +4 -0
  3. package/dist/animate.d.ts +4 -0
  4. package/dist/animate.js +22 -0
  5. package/dist/animate.js.map +1 -1
  6. package/dist/animate.mjs +22 -0
  7. package/dist/animate.mjs.map +1 -1
  8. package/dist/atomic.js +56 -14
  9. package/dist/atomic.js.map +1 -1
  10. package/dist/atomic.mjs +56 -14
  11. package/dist/atomic.mjs.map +1 -1
  12. package/dist/cli.js +156 -14
  13. package/dist/cli.js.map +1 -1
  14. package/dist/cli.mjs +156 -14
  15. package/dist/cli.mjs.map +1 -1
  16. package/dist/compiler.d.mts +1045 -991
  17. package/dist/compiler.d.ts +1045 -991
  18. package/dist/compiler.js +891 -925
  19. package/dist/compiler.js.map +1 -1
  20. package/dist/compiler.mjs +890 -925
  21. package/dist/compiler.mjs.map +1 -1
  22. package/dist/engine.js +1651 -354
  23. package/dist/engine.js.map +1 -1
  24. package/dist/engine.mjs +1650 -353
  25. package/dist/engine.mjs.map +1 -1
  26. package/dist/index.browser.mjs +3 -1
  27. package/dist/index.browser.mjs.map +1 -1
  28. package/dist/index.js +1682 -365
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.mjs +1682 -365
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/next.js +1076 -986
  33. package/dist/next.js.map +1 -1
  34. package/dist/next.mjs +1076 -986
  35. package/dist/next.mjs.map +1 -1
  36. package/dist/shared.d.mts +3 -2
  37. package/dist/shared.d.ts +3 -2
  38. package/dist/shared.js +1595 -298
  39. package/dist/shared.js.map +1 -1
  40. package/dist/shared.mjs +1595 -298
  41. package/dist/shared.mjs.map +1 -1
  42. package/dist/svelte.js +42 -24
  43. package/dist/svelte.js.map +1 -1
  44. package/dist/svelte.mjs +42 -24
  45. package/dist/svelte.mjs.map +1 -1
  46. package/dist/turbopackLoader.js +1606 -309
  47. package/dist/turbopackLoader.js.map +1 -1
  48. package/dist/turbopackLoader.mjs +1606 -309
  49. package/dist/turbopackLoader.mjs.map +1 -1
  50. package/dist/tw.js +156 -14
  51. package/dist/tw.js.map +1 -1
  52. package/dist/tw.mjs +156 -14
  53. package/dist/tw.mjs.map +1 -1
  54. package/dist/vite.js +1636 -339
  55. package/dist/vite.js.map +1 -1
  56. package/dist/vite.mjs +1636 -339
  57. package/dist/vite.mjs.map +1 -1
  58. package/dist/vue.js +42 -24
  59. package/dist/vue.js.map +1 -1
  60. package/dist/vue.mjs +42 -24
  61. package/dist/vue.mjs.map +1 -1
  62. package/dist/webpackLoader.js +80 -29
  63. package/dist/webpackLoader.js.map +1 -1
  64. package/dist/webpackLoader.mjs +80 -29
  65. package/dist/webpackLoader.mjs.map +1 -1
  66. package/native/tailwind-styled-native.node +0 -0
  67. package/native/tailwind-styled-native.win32-x64-msvc.node +0 -0
  68. package/package.json +3 -2
  69. package/native/index.node +0 -0
package/dist/compiler.mjs CHANGED
@@ -8,7 +8,9 @@ import { fileURLToPath } from 'url';
8
8
 
9
9
  /* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
10
10
  var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
14
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
13
15
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
14
16
  }) : x)(function(x) {
@@ -22,6 +24,15 @@ var __export = (target, all) => {
22
24
  for (var name in all)
23
25
  __defProp(target, name, { get: all[name], enumerable: true });
24
26
  };
27
+ var __copyProps = (to, from, except, desc) => {
28
+ if (from && typeof from === "object" || typeof from === "function") {
29
+ for (let key of __getOwnPropNames(from))
30
+ if (!__hasOwnProp.call(to, key) && key !== except)
31
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
+ }
33
+ return to;
34
+ };
35
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
36
  function platformKey() {
26
37
  if (isBrowser) return "browser";
27
38
  return `${process.platform}-${process.arch}`;
@@ -42,27 +53,15 @@ function resolveNativeBinary(runtimeDir) {
42
53
  }
43
54
  tried.push(`env:${envPath} (not found)`);
44
55
  }
45
- const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
46
- for (const pkg of prebuiltPkgs) {
47
- try {
48
- const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
49
- if (fs.existsSync(candidate)) {
50
- return { path: candidate, source: "prebuilt", platform, tried };
51
- }
52
- tried.push(`prebuilt:${pkg} (resolved but missing)`);
53
- } catch {
54
- tried.push(`prebuilt:${pkg} (not installed)`);
55
- }
56
- }
57
56
  const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
58
- const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
57
+ const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser", "index"];
59
58
  if (runtimeDir) {
60
59
  for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
61
60
  const pkgRoot = path.resolve(runtimeDir, depth);
62
61
  for (const bin of BINARY_NAMES_SELF) {
63
62
  for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
64
63
  const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
65
- tried.push(`self-bundled:${candidate}`);
64
+ tried.push(`native:${candidate}`);
66
65
  if (fs.existsSync(candidate)) {
67
66
  return { path: candidate, source: "prebuilt", platform, tried };
68
67
  }
@@ -70,6 +69,18 @@ function resolveNativeBinary(runtimeDir) {
70
69
  }
71
70
  }
72
71
  }
72
+ const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
73
+ for (const pkg of prebuiltPkgs) {
74
+ try {
75
+ const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
76
+ if (fs.existsSync(candidate)) {
77
+ return { path: candidate, source: "prebuilt", platform, tried };
78
+ }
79
+ tried.push(`prebuilt:${pkg} (resolved but missing)`);
80
+ } catch {
81
+ tried.push(`prebuilt:${pkg} (not installed)`);
82
+ }
83
+ }
73
84
  const cwd = process.cwd();
74
85
  const base = runtimeDir ?? cwd;
75
86
  const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
@@ -210,271 +221,20 @@ Tried paths: ${result.tried.join("\n")}`);
210
221
  }
211
222
  });
212
223
 
213
- // packages/domain/compiler/src/tailwindEngine.ts
214
- var tailwindEngine_exports = {};
215
- __export(tailwindEngine_exports, {
216
- clearCache: () => clearCache,
217
- generateRawCss: () => generateRawCss,
218
- getCacheStats: () => getCacheStats,
219
- processTailwindCssWithTargets: () => processTailwindCssWithTargets,
220
- runCssPipeline: () => runCssPipeline,
221
- runCssPipelineSync: () => runCssPipelineSync
222
- });
223
- function _getCacheKey(classes, minify, cssEntry, root) {
224
- const sorted = [...classes].sort().join(",");
225
- const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
226
- return `${sorted}|${flags}`;
227
- }
228
- function _evictOldestIfNeeded() {
229
- if (_cssCache.size >= MAX_CACHE_SIZE) {
230
- const firstKey = _cssCache.keys().next().value;
231
- if (firstKey !== void 0) {
232
- _cssCache.delete(firstKey);
233
- }
234
- }
235
- }
236
- function getCacheStats() {
237
- const total = _cacheHits + _cacheMisses;
238
- return {
239
- hits: _cacheHits,
240
- misses: _cacheMisses,
241
- hitRate: total > 0 ? _cacheHits / total : 0,
242
- size: _cssCache.size,
243
- maxSize: MAX_CACHE_SIZE
244
- };
245
- }
246
- function clearCache() {
247
- _cssCache.clear();
248
- _cacheHits = 0;
249
- _cacheMisses = 0;
250
- }
251
- function loadTailwindEngine() {
252
- if (_twEngine) return _twEngine;
253
- if (_twEngineError) throw _twEngineError;
254
- try {
255
- const tw = require2("tailwindcss");
256
- if (typeof tw.compile !== "function") {
257
- throw new Error("tailwindcss v4 not found \u2014 compile() API missing. Check tailwindcss version >= 4.");
258
- }
259
- _twEngine = tw;
260
- return _twEngine;
261
- } catch (e) {
262
- _twEngineError = e instanceof Error ? e : new Error(String(e));
263
- throw _twEngineError;
264
- }
265
- }
266
- async function generateRawCss(classes, cssEntryContent, root) {
267
- if (classes.length === 0) return "";
268
- const tw = loadTailwindEngine();
269
- const input = cssEntryContent ?? "@import 'tailwindcss';";
270
- const { readFileSync, existsSync: existsSync2 } = await import('fs');
271
- const { dirname, resolve: resolve2 } = await import('path');
272
- const projectRoot = root ?? process.cwd();
273
- const req = createRequire(resolve2(projectRoot, "package.json"));
274
- const loadStylesheet = async (id, base) => {
275
- try {
276
- const cssId = id === "tailwindcss" ? "tailwindcss/index.css" : id === "tailwindcss/preflight" ? "tailwindcss/preflight.css" : id === "tailwindcss/utilities" ? "tailwindcss/utilities.css" : id === "tailwindcss/theme" ? "tailwindcss/theme.css" : id;
277
- const pkgPath = req.resolve(cssId);
278
- return { content: readFileSync(pkgPath, "utf-8"), base: dirname(pkgPath) };
279
- } catch {
280
- try {
281
- const absPath = resolve2(base, id);
282
- if (existsSync2(absPath)) {
283
- return { content: readFileSync(absPath, "utf-8"), base: dirname(absPath) };
284
- }
285
- } catch {
286
- }
287
- return { content: "", base };
288
- }
289
- };
290
- const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
291
- return compiler.build(classes);
292
- }
293
- function getThemeConfig() {
294
- return {
295
- colors: {
296
- slate: {
297
- "50": "#f8fafc",
298
- "100": "#f1f5f9",
299
- "200": "#e2e8f0",
300
- "300": "#cbd5e1",
301
- "400": "#94a3b8",
302
- "500": "#64748b",
303
- "600": "#475569",
304
- "700": "#334155",
305
- "800": "#1e293b",
306
- "900": "#0f172a"
307
- },
308
- gray: {
309
- "50": "#f9fafb",
310
- "100": "#f3f4f6",
311
- "200": "#e5e7eb",
312
- "300": "#d1d5db",
313
- "400": "#9ca3af",
314
- "500": "#6b7280",
315
- "600": "#4b5563",
316
- "700": "#374151",
317
- "800": "#1f2937",
318
- "900": "#111827"
319
- },
320
- white: "#ffffff",
321
- black: "#000000",
322
- red: {
323
- "500": "#ef4444",
324
- "600": "#dc2626"
325
- },
326
- blue: {
327
- "500": "#3b82f6",
328
- "600": "#1e40af"
329
- }
330
- },
331
- spacing: {
332
- "0": "0px",
333
- "1": "0.25rem",
334
- "2": "0.5rem",
335
- "3": "0.75rem",
336
- "4": "1rem",
337
- "5": "1.25rem",
338
- "6": "1.5rem",
339
- "8": "2rem",
340
- "10": "2.5rem",
341
- "12": "3rem",
342
- "16": "4rem",
343
- "20": "5rem",
344
- "24": "6rem"
345
- },
346
- breakpoints: {
347
- "sm": "640px",
348
- "md": "768px",
349
- "lg": "1024px",
350
- "xl": "1280px",
351
- "2xl": "1536px"
352
- }
353
- };
354
- }
355
- function postProcessWithLightning(rawCss) {
356
- if (!rawCss) return "";
224
+ // packages/domain/compiler/src/compiler/cssGeneratorNative.ts
225
+ async function generateCssNative(classes, options) {
226
+ const { theme } = options;
357
227
  const native = getNativeBridge();
358
- if (!native?.processTailwindCssLightning) {
359
- throw new Error("FATAL: Native binding 'processTailwindCssLightning' is required but not available.");
360
- }
361
- const result = native.processTailwindCssLightning(rawCss);
362
- if (!result?.css) {
363
- throw new Error("FATAL: processTailwindCssLightning returned null");
364
- }
365
- return result.css;
366
- }
367
- async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
368
- const filtered = classes.filter(Boolean);
369
- const uniqueMap = /* @__PURE__ */ new Map();
370
- filtered.forEach((cls) => uniqueMap.set(cls, cls));
371
- const unique = Array.from(uniqueMap.values());
372
- if (unique.length === 0) {
373
- return { css: "", classes: [], sizeBytes: 0, optimized: false };
374
- }
375
- const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root);
376
- const cached = _cssCache.get(cacheKey);
377
- if (cached) {
378
- _cacheHits++;
379
- if (process.env.DEBUG?.includes("compiler")) {
380
- console.log(
381
- `[Compiler] Cache HIT: ${unique.length} classes (hit rate: ${(getCacheStats().hitRate * 100).toFixed(1)}%)`
382
- );
383
- }
384
- return cached;
385
- }
386
- _cacheMisses++;
387
- let rawCss;
388
- let usedRustCompiler = false;
389
- try {
390
- const theme = getThemeConfig();
391
- rawCss = await generateCssNative(unique, {
392
- theme,
393
- fallbackToJs: true,
394
- logFallback: process.env.DEBUG?.includes("compiler") === true
395
- });
396
- usedRustCompiler = true;
397
- } catch (error) {
398
- if (process.env.DEBUG?.includes("compiler")) {
399
- console.warn("[Compiler] Rust compiler failed, using JavaScript Tailwind:", error);
400
- }
401
- rawCss = await generateRawCss(unique, cssEntryContent, root);
402
- }
403
- const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
404
- if (process.env.DEBUG?.includes("compiler")) {
405
- console.log(
406
- `[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
407
- `Size: ${finalCss.length} bytes`
228
+ if (!native?.generateCssNative) {
229
+ throw new Error(
230
+ "FATAL: Rust CSS generator (generateCssNative) is required but not available. Ensure native binding is properly loaded. Check that native/.node binary exists."
408
231
  );
409
232
  }
410
- const result = {
411
- css: finalCss,
412
- classes: unique,
413
- sizeBytes: finalCss.length,
414
- optimized: minify
415
- };
416
- _evictOldestIfNeeded();
417
- _cssCache.set(cacheKey, result);
418
- return result;
419
- }
420
- function runCssPipelineSync(_classes) {
421
- return { css: "", classes: [], sizeBytes: 0, optimized: false };
422
- }
423
- function processTailwindCssWithTargets(css, targets) {
424
- const native = getNativeBridge();
425
- if (!native?.processTailwindCssWithTargets) {
426
- throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
427
- }
428
- const result = native.processTailwindCssWithTargets(css, targets ?? null);
429
- if (!result?.css) {
430
- throw new Error("FATAL: processTailwindCssWithTargets returned null");
431
- }
432
- return result.css;
433
- }
434
- var require2, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, _twEngine, _twEngineError;
435
- var init_tailwindEngine = __esm({
436
- "packages/domain/compiler/src/tailwindEngine.ts"() {
437
- init_nativeBridge();
438
- init_cssGeneratorNative();
439
- require2 = createRequire(import.meta.url);
440
- _cssCache = /* @__PURE__ */ new Map();
441
- _cacheHits = 0;
442
- _cacheMisses = 0;
443
- MAX_CACHE_SIZE = 100;
444
- _twEngine = null;
445
- _twEngineError = null;
446
- }
447
- });
448
-
449
- // packages/domain/compiler/src/cssGeneratorNative.ts
450
- async function generateCssNative(classes, options) {
451
- const {
452
- theme,
453
- fallbackToJs = true,
454
- logFallback = false
455
- } = options;
456
- try {
457
- const native = getNativeBridge();
458
- if (!native?.generateCssNative) {
459
- throw new Error("generateCssNative not available in native binding");
460
- }
461
- const themeJson = JSON.stringify(theme);
462
- const css = native.generateCssNative(classes, themeJson);
463
- return css;
464
- } catch (error) {
465
- if (!fallbackToJs) {
466
- throw error;
467
- }
468
- if (logFallback) {
469
- console.warn(
470
- "[CSS Compiler] Rust CSS generator unavailable, falling back to JavaScript Tailwind",
471
- error instanceof Error ? error.message : String(error)
472
- );
473
- }
474
- return generateRawCss(classes);
475
- }
233
+ const themeJson = JSON.stringify(theme);
234
+ const css = native.generateCssNative(classes, themeJson);
235
+ return css;
476
236
  }
477
- function getCacheStats2() {
237
+ function getCacheStats() {
478
238
  try {
479
239
  const native = getNativeBridge();
480
240
  if (!native?.getCacheStats) {
@@ -497,154 +257,38 @@ function clearThemeCache() {
497
257
  }
498
258
  }
499
259
  var init_cssGeneratorNative = __esm({
500
- "packages/domain/compiler/src/cssGeneratorNative.ts"() {
260
+ "packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
501
261
  init_nativeBridge();
502
- init_tailwindEngine();
503
262
  }
504
263
  });
505
264
 
506
- // packages/domain/compiler/src/scannerNative.ts
507
- function scanWorkspace(root, extensions) {
265
+ // packages/domain/compiler/src/compiler/compilationNative.ts
266
+ function compileCssNative2(classes, prefix) {
508
267
  const native = getNativeBridge();
509
- if (!native?.scan_workspace) throw new Error("scan_workspace not available");
510
- return native.scan_workspace(root, extensions);
268
+ if (!native?.compileCss) throw new Error("compileCss not available");
269
+ return native.compileCss(classes, prefix);
511
270
  }
512
- function extractClassesFromSourceNative(source) {
271
+ function compileCssLightning(classes) {
513
272
  const native = getNativeBridge();
514
- if (!native?.extract_classes_from_source) throw new Error("extract_classes_from_source not available");
515
- return native.extract_classes_from_source(source);
273
+ if (!native?.compileCssLightning) throw new Error("compileCssLightning not available");
274
+ return native.compileCssLightning(classes);
516
275
  }
517
- function batchExtractClassesNative(filePaths) {
276
+ function extractTwStateConfigsNative(source, filename) {
518
277
  const native = getNativeBridge();
519
- if (!native?.batch_extract_classes) throw new Error("batch_extract_classes not available");
520
- return native.batch_extract_classes(filePaths);
278
+ if (!native?.extractTwStateConfigs) throw new Error("extractTwStateConfigs not available");
279
+ return native.extractTwStateConfigs(source, filename);
521
280
  }
522
- function checkAgainstSafelistNative(classes, safelist) {
281
+ function generateStaticStateCssNative(inputs, resolvedCss) {
523
282
  const native = getNativeBridge();
524
- if (!native?.check_against_safelist) throw new Error("check_against_safelist not available");
525
- return native.check_against_safelist(classes, safelist);
283
+ if (!native?.generateStaticStateCss) throw new Error("generateStaticStateCss not available");
284
+ return native.generateStaticStateCss(inputs, resolvedCss ?? null);
526
285
  }
527
- function scanFile(filePath) {
286
+ function extractAndGenerateStateCssNative(source, filename) {
528
287
  const native = getNativeBridge();
529
- if (!native?.scan_file) throw new Error("scan_file not available");
530
- return native.scan_file(filePath);
288
+ if (!native?.extractAndGenerateStateCss) throw new Error("extractAndGenerateStateCss not available");
289
+ return native.extractAndGenerateStateCss(source, filename);
531
290
  }
532
- function collectFiles(root, extensions) {
533
- const native = getNativeBridge();
534
- if (!native?.collect_files) throw new Error("collect_files not available");
535
- return native.collect_files(root, extensions);
536
- }
537
- function walkAndPrefilterSourceFiles(root, extensions, _parallel) {
538
- const native = getNativeBridge();
539
- if (!native?.walk_and_prefilter_source_files) throw new Error("walk_and_prefilter_source_files not available");
540
- return native.walk_and_prefilter_source_files(root, extensions);
541
- }
542
- function generateSubComponentTypes(root, outputPath) {
543
- const native = getNativeBridge();
544
- if (!native?.generate_sub_component_types) throw new Error("generate_sub_component_types not available");
545
- return native.generate_sub_component_types(root, outputPath);
546
- }
547
- var init_scannerNative = __esm({
548
- "packages/domain/compiler/src/scannerNative.ts"() {
549
- init_nativeBridge();
550
- }
551
- });
552
-
553
- // packages/domain/compiler/src/analyzerNative.ts
554
- function detectDeadCode(scanResultJson, css) {
555
- const native = getNativeBridge();
556
- if (!native?.detectDeadCode) throw new Error("detectDeadCode not available");
557
- return native.detectDeadCode(scanResultJson, css);
558
- }
559
- function analyzeClassUsageNative(classes, scanResultJson, css) {
560
- const native = getNativeBridge();
561
- if (!native?.analyzeClassUsage) throw new Error("analyzeClassUsage not available");
562
- return native.analyzeClassUsage(classes, scanResultJson, css);
563
- }
564
- function analyzeClassesNative(filesJson, cwd, flags) {
565
- const native = getNativeBridge();
566
- if (!native?.analyzeClasses) throw new Error("analyzeClasses not available");
567
- return native.analyzeClasses(filesJson, cwd, flags ?? 0);
568
- }
569
- function analyzeRscNative(source, filename) {
570
- const native = getNativeBridge();
571
- if (!native?.analyzeRsc) throw new Error("analyzeRsc not available");
572
- return native.analyzeRsc(source, filename);
573
- }
574
- function optimizeCssNative(css) {
575
- const native = getNativeBridge();
576
- if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
577
- const result = native.processTailwindCssLightning(css);
578
- return {
579
- css: result.css,
580
- originalSize: css.length,
581
- optimizedSize: result.size_bytes,
582
- reductionPercentage: (css.length - result.size_bytes) / css.length * 100
583
- };
584
- }
585
- function processTailwindCssLightning(css) {
586
- const native = getNativeBridge();
587
- if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
588
- return native.processTailwindCssLightning(css);
589
- }
590
- function eliminateDeadCssNative(css, deadClasses) {
591
- const native = getNativeBridge();
592
- if (!native?.eliminateDeadCss) throw new Error("eliminateDeadCss not available");
593
- return native.eliminateDeadCss(css, deadClasses);
594
- }
595
- function hoistComponentsNative(source) {
596
- const native = getNativeBridge();
597
- if (!native?.hoistComponents) throw new Error("hoistComponents not available");
598
- return native.hoistComponents(source);
599
- }
600
- function compileVariantTableNative(configJson) {
601
- const native = getNativeBridge();
602
- if (!native?.compileVariantTable) throw new Error("compileVariantTable not available");
603
- return native.compileVariantTable(configJson);
604
- }
605
- function classifyAndSortClassesNative(classes) {
606
- const native = getNativeBridge();
607
- if (!native?.classifyAndSortClasses) throw new Error("classifyAndSortClasses not available");
608
- return native.classifyAndSortClasses(classes);
609
- }
610
- function mergeCssDeclarationsNative(cssChunks) {
611
- const native = getNativeBridge();
612
- if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
613
- return native.mergeCssDeclarations(cssChunks);
614
- }
615
- var init_analyzerNative = __esm({
616
- "packages/domain/compiler/src/analyzerNative.ts"() {
617
- init_nativeBridge();
618
- }
619
- });
620
-
621
- // packages/domain/compiler/src/compilationNative.ts
622
- function compileCssNative2(classes, prefix) {
623
- const native = getNativeBridge();
624
- if (!native?.compileCss) throw new Error("compileCss not available");
625
- return native.compileCss(classes, prefix);
626
- }
627
- function compileCssLightning(classes) {
628
- const native = getNativeBridge();
629
- if (!native?.compileCssLightning) throw new Error("compileCssLightning not available");
630
- return native.compileCssLightning(classes);
631
- }
632
- function extractTwStateConfigsNative(source, filename) {
633
- const native = getNativeBridge();
634
- if (!native?.extractTwStateConfigs) throw new Error("extractTwStateConfigs not available");
635
- return native.extractTwStateConfigs(source, filename);
636
- }
637
- function generateStaticStateCssNative(inputs, resolvedCss) {
638
- const native = getNativeBridge();
639
- if (!native?.generateStaticStateCss) throw new Error("generateStaticStateCss not available");
640
- return native.generateStaticStateCss(inputs, resolvedCss ?? null);
641
- }
642
- function extractAndGenerateStateCssNative(source, filename) {
643
- const native = getNativeBridge();
644
- if (!native?.extractAndGenerateStateCss) throw new Error("extractAndGenerateStateCss not available");
645
- return native.extractAndGenerateStateCss(source, filename);
646
- }
647
- function layoutClassesToCss(classes) {
291
+ function layoutClassesToCss(classes) {
648
292
  const native = getNativeBridge();
649
293
  if (!native?.layoutClassesToCss) throw new Error("layoutClassesToCss not available");
650
294
  return native.layoutClassesToCss(classes);
@@ -685,245 +329,244 @@ function atomicRegistrySize() {
685
329
  return native.atomicRegistrySize();
686
330
  }
687
331
  var init_compilationNative = __esm({
688
- "packages/domain/compiler/src/compilationNative.ts"() {
332
+ "packages/domain/compiler/src/compiler/compilationNative.ts"() {
689
333
  init_nativeBridge();
690
334
  }
691
335
  });
692
336
 
693
- // packages/domain/compiler/src/cacheNative.ts
694
- function getCacheStatistics() {
337
+ // packages/domain/compiler/src/compiler/cssCompilationNative.ts
338
+ function compileClass(input) {
695
339
  const native = getNativeBridge();
696
- if (!native?.get_cache_statistics) throw new Error("get_cache_statistics not available");
697
- const statsJson = native.get_cache_statistics();
340
+ if (!native?.compile_class) throw new Error("compile_class not available");
341
+ const resultJson = native.compile_class(input);
698
342
  try {
699
- return JSON.parse(statsJson);
343
+ return JSON.parse(resultJson);
700
344
  } catch {
701
345
  return {
702
- parse_cache: { hits: 0, misses: 0, size: 0 },
703
- resolve_cache: { hits: 0, misses: 0, size: 0 },
704
- compile_cache: { hits: 0, misses: 0, size: 0 },
705
- css_gen_cache: { hits: 0, misses: 0, size: 0 },
706
- overall_hit_rate: 0,
707
- total_memory_bytes: 0
346
+ selector: "",
347
+ declarations: "",
348
+ properties: [],
349
+ specificity: 0
708
350
  };
709
351
  }
710
352
  }
711
- function clearAllCaches() {
353
+ function compileClasses(inputs) {
712
354
  const native = getNativeBridge();
713
- if (!native?.clear_all_caches) return;
355
+ if (!native?.compile_classes) throw new Error("compile_classes not available");
356
+ const resultJson = native.compile_classes(inputs);
714
357
  try {
715
- native.clear_all_caches();
358
+ return JSON.parse(resultJson);
716
359
  } catch {
360
+ return {
361
+ css: "",
362
+ resolved_classes: [],
363
+ unknown_classes: [],
364
+ size_bytes: 0,
365
+ duration_ms: 0
366
+ };
717
367
  }
718
368
  }
719
- function clearParseCache() {
369
+ function compileToCss(input, minify) {
720
370
  const native = getNativeBridge();
721
- if (!native?.clear_parse_cache) return;
722
- try {
723
- native.clear_parse_cache();
724
- } catch {
725
- }
371
+ if (!native?.compile_to_css) throw new Error("compile_to_css not available");
372
+ return native.compile_to_css(input, minify ?? false);
726
373
  }
727
- function clearResolveCache() {
374
+ function compileToCssBatch(inputs, minify) {
728
375
  const native = getNativeBridge();
729
- if (!native?.clear_resolve_cache) return;
730
- try {
731
- native.clear_resolve_cache();
732
- } catch {
733
- }
376
+ if (!native?.compile_to_css_batch) throw new Error("compile_to_css_batch not available");
377
+ return native.compile_to_css_batch(inputs, minify ?? false);
734
378
  }
735
- function clearCompileCache() {
379
+ function minifyCss(css) {
736
380
  const native = getNativeBridge();
737
- if (!native?.clear_compile_cache) return;
738
- try {
739
- native.clear_compile_cache();
740
- } catch {
741
- }
381
+ if (!native?.minify_css) throw new Error("minify_css not available");
382
+ return native.minify_css(css);
742
383
  }
743
- function clearCssGenCache() {
384
+ function compileAnimation(animationName, from, to) {
744
385
  const native = getNativeBridge();
745
- if (!native?.clear_css_gen_cache) return;
386
+ if (!native?.compile_animation) throw new Error("compile_animation not available");
387
+ const resultJson = native.compile_animation(animationName, from, to);
746
388
  try {
747
- native.clear_css_gen_cache();
389
+ return JSON.parse(resultJson);
748
390
  } catch {
391
+ return {
392
+ animation_id: "",
393
+ keyframes_css: "",
394
+ animation_rule: "",
395
+ duration_ms: 0
396
+ };
749
397
  }
750
398
  }
751
- function getCacheOptimizationHints(hitRatePercent, memoryUsedMb) {
399
+ function compileKeyframes(name, stopsJson) {
752
400
  const native = getNativeBridge();
753
- if (!native?.get_cache_optimization_hints)
754
- throw new Error("get_cache_optimization_hints not available");
755
- const hintsJson = native.get_cache_optimization_hints(
756
- Math.min(100, Math.max(0, hitRatePercent)),
757
- Math.max(1, memoryUsedMb)
758
- );
401
+ if (!native?.compile_keyframes) throw new Error("compile_keyframes not available");
402
+ const resultJson = native.compile_keyframes(name, stopsJson);
759
403
  try {
760
- return JSON.parse(hintsJson);
404
+ return JSON.parse(resultJson);
761
405
  } catch {
762
406
  return {
763
- current_strategy: "unknown",
764
- recommended_strategy: "increase_size",
765
- estimated_improvement_percent: 0,
766
- suggested_memory_mb: 256,
767
- notes: ["Unable to analyze cache statistics"]
407
+ animation_id: "",
408
+ keyframes_css: "",
409
+ animation_rule: "",
410
+ duration_ms: 0
768
411
  };
769
412
  }
770
413
  }
771
- function estimateOptimalCacheConfig(totalBudgetMb, workloadType) {
414
+ function compileTheme(tokensJson, themeName, prefix) {
772
415
  const native = getNativeBridge();
773
- if (!native?.estimate_optimal_cache_config_native)
774
- throw new Error("estimate_optimal_cache_config_native not available");
775
- const configJson = native.estimate_optimal_cache_config_native(
776
- Math.max(64, totalBudgetMb),
777
- workloadType
778
- );
416
+ if (!native?.compile_theme) throw new Error("compile_theme not available");
417
+ const resultJson = native.compile_theme(tokensJson, themeName, prefix);
779
418
  try {
780
- return JSON.parse(configJson);
419
+ return JSON.parse(resultJson);
781
420
  } catch {
782
421
  return {
783
- parse_cache_size: 128,
784
- resolve_cache_size: 64,
785
- compile_cache_size: 256,
786
- css_gen_cache_size: 128,
787
- recommended_eviction_policy: "lru",
788
- ttl_seconds: 3600,
789
- expected_hit_rate_percent: 75
422
+ selector: ":root",
423
+ variables: [],
424
+ variables_css: "",
425
+ theme_name: themeName
790
426
  };
791
427
  }
792
428
  }
793
- function cacheRead(cachePath) {
429
+ function twMerge(classString) {
794
430
  const native = getNativeBridge();
795
- if (!native?.cache_read) throw new Error("cache_read not available");
796
- const result = native.cache_read(cachePath);
797
- try {
798
- return JSON.parse(result.entries_json || "[]");
799
- } catch {
800
- return [];
801
- }
431
+ if (!native?.tw_merge) throw new Error("tw_merge not available");
432
+ return native.tw_merge(classString);
802
433
  }
803
- function cacheWrite(cachePath, entries) {
434
+ function twMergeMany(classStrings) {
804
435
  const native = getNativeBridge();
805
- if (!native?.cache_write) throw new Error("cache_write not available");
806
- try {
807
- const result = native.cache_write(
808
- cachePath,
809
- entries.map((e) => ({
810
- file: e.file,
811
- content_hash: e.contentHash,
812
- classes: e.classes,
813
- mtime_ms: e.mtimeMs,
814
- size_bytes: e.sizeBytes
815
- }))
816
- );
817
- return typeof result === "boolean" ? result : result === true;
818
- } catch {
819
- return false;
820
- }
436
+ if (!native?.tw_merge_many) throw new Error("tw_merge_many not available");
437
+ return native.tw_merge_many(classStrings);
821
438
  }
822
- function cachePriority(mtimeMs, sizeBytes, hitCount) {
439
+ function twMergeWithSeparator(classString, options) {
823
440
  const native = getNativeBridge();
824
- if (!native?.cache_priority) throw new Error("cache_priority not available");
825
- return native.cache_priority(mtimeMs, sizeBytes, hitCount);
441
+ if (!native?.tw_merge_with_separator)
442
+ throw new Error("tw_merge_with_separator not available");
443
+ const opts = {
444
+ separator: options.separator,
445
+ debug: options.debug
446
+ };
447
+ return native.tw_merge_with_separator(classString, opts);
826
448
  }
827
- var init_cacheNative = __esm({
828
- "packages/domain/compiler/src/cacheNative.ts"() {
449
+ function twMergeManyWithSeparator(classStrings, options) {
450
+ const native = getNativeBridge();
451
+ if (!native?.tw_merge_many_with_separator)
452
+ throw new Error("tw_merge_many_with_separator not available");
453
+ const opts = {
454
+ separator: options.separator,
455
+ debug: options.debug
456
+ };
457
+ return native.tw_merge_many_with_separator(classStrings, opts);
458
+ }
459
+ function twMergeRaw(classLists) {
460
+ const native = getNativeBridge();
461
+ if (!native?.tw_merge_raw) throw new Error("tw_merge_raw not available");
462
+ return native.tw_merge_raw(classLists);
463
+ }
464
+ var init_cssCompilationNative = __esm({
465
+ "packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
829
466
  init_nativeBridge();
830
467
  }
831
468
  });
832
469
 
833
- // packages/domain/compiler/src/themeResolutionNative.ts
834
- function resolveVariants(configJson) {
470
+ // packages/domain/compiler/src/compiler/idRegistryNative.ts
471
+ function idRegistryCreate() {
835
472
  const native = getNativeBridge();
836
- if (!native?.resolve_variants) throw new Error("resolve_variants not available");
837
- const resultJson = native.resolve_variants(configJson);
838
- try {
839
- return JSON.parse(resultJson);
840
- } catch {
841
- return {
842
- variants: [],
843
- supported: [],
844
- deprecated: [],
845
- conflicting: []
846
- };
847
- }
473
+ if (!native?.id_registry_create) throw new Error("id_registry_create not available");
474
+ return native.id_registry_create();
848
475
  }
849
- function validateThemeConfig(configJson) {
476
+ function idRegistryGenerate(handle, name) {
850
477
  const native = getNativeBridge();
851
- if (!native?.validate_variant_config) throw new Error("validate_variant_config not available");
852
- const resultJson = native.validate_variant_config(configJson);
853
- try {
854
- return JSON.parse(resultJson);
855
- } catch {
856
- return {
857
- is_valid: false,
858
- errors: ["Unable to parse configuration"],
859
- warnings: [],
860
- suggestions: []
861
- };
862
- }
478
+ if (!native?.id_registry_generate) throw new Error("id_registry_generate not available");
479
+ return native.id_registry_generate(handle, name);
863
480
  }
864
- function resolveCascade(baseThemeJson, overridesJson) {
481
+ function idRegistryLookup(handle, name) {
865
482
  const native = getNativeBridge();
866
- if (!native?.resolve_cascade) throw new Error("resolve_cascade not available");
867
- const resultJson = native.resolve_cascade(baseThemeJson, overridesJson);
868
- try {
869
- return JSON.parse(resultJson);
870
- } catch {
871
- return {
872
- base_theme: {},
873
- user_overrides: {},
874
- merged_theme: {},
875
- conflict_resolutions: []
876
- };
877
- }
483
+ if (!native?.id_registry_lookup) throw new Error("id_registry_lookup not available");
484
+ return native.id_registry_lookup(handle, name);
878
485
  }
879
- function resolveClassNames(classNames, themeJson) {
486
+ function idRegistryNext(handle) {
880
487
  const native = getNativeBridge();
881
- if (!native?.resolve_class_names) throw new Error("resolve_class_names not available");
882
- const resultJson = native.resolve_class_names(classNames, themeJson);
883
- try {
884
- return JSON.parse(resultJson);
885
- } catch {
886
- return [];
887
- }
488
+ if (!native?.id_registry_next) throw new Error("id_registry_next not available");
489
+ return native.id_registry_next(handle);
888
490
  }
889
- function resolveConflictGroup(groupName, themeJson) {
491
+ function idRegistryDestroy(handle) {
890
492
  const native = getNativeBridge();
891
- if (!native?.resolve_conflict_group)
892
- throw new Error("resolve_conflict_group not available");
893
- const resultJson = native.resolve_conflict_group(groupName, themeJson);
493
+ if (!native?.id_registry_destroy) return;
494
+ native.id_registry_destroy(handle);
495
+ }
496
+ function idRegistryReset(handle) {
497
+ const native = getNativeBridge();
498
+ if (!native?.id_registry_reset) return;
499
+ native.id_registry_reset(handle);
500
+ }
501
+ function idRegistrySnapshot(handle) {
502
+ const native = getNativeBridge();
503
+ if (!native?.id_registry_snapshot) throw new Error("id_registry_snapshot not available");
504
+ const snapshotJson = native.id_registry_snapshot(handle);
894
505
  try {
895
- return JSON.parse(resultJson);
506
+ return JSON.parse(snapshotJson);
896
507
  } catch {
897
508
  return {
898
- group_name: groupName,
899
- conflicting_classes: [],
900
- description: "",
901
- resolution_strategy: "last-wins"
509
+ handle,
510
+ next_id: 0,
511
+ entries: [],
512
+ total_entries: 0
902
513
  };
903
514
  }
904
515
  }
905
- function resolveThemeValue(keyPath, themeJson) {
516
+ function idRegistryActiveCount() {
906
517
  const native = getNativeBridge();
907
- if (!native?.resolve_theme_value) throw new Error("resolve_theme_value not available");
908
- return native.resolve_theme_value(keyPath, themeJson);
518
+ if (!native?.id_registry_active_count) throw new Error("id_registry_active_count not available");
519
+ return native.id_registry_active_count();
909
520
  }
910
- function resolveSimpleVariants(configJson) {
521
+ function registerPropertyName(propertyName) {
911
522
  const native = getNativeBridge();
912
- if (!native?.resolve_simple_variants) throw new Error("resolve_simple_variants not available");
913
- const resultJson = native.resolve_simple_variants(configJson);
914
- try {
915
- return JSON.parse(resultJson);
916
- } catch {
917
- return [];
918
- }
523
+ if (!native?.register_property_name)
524
+ throw new Error("register_property_name not available");
525
+ return native.register_property_name(propertyName);
919
526
  }
920
- var init_themeResolutionNative = __esm({
921
- "packages/domain/compiler/src/themeResolutionNative.ts"() {
527
+ function registerValueName(valueName) {
528
+ const native = getNativeBridge();
529
+ if (!native?.register_value_name) throw new Error("register_value_name not available");
530
+ return native.register_value_name(valueName);
531
+ }
532
+ function propertyIdToString(propertyId) {
533
+ const native = getNativeBridge();
534
+ if (!native?.property_id_to_string) throw new Error("property_id_to_string not available");
535
+ return native.property_id_to_string(propertyId);
536
+ }
537
+ function valueIdToString(valueId) {
538
+ const native = getNativeBridge();
539
+ if (!native?.value_id_to_string) throw new Error("value_id_to_string not available");
540
+ return native.value_id_to_string(valueId);
541
+ }
542
+ function reverseLookupProperty(propertyId) {
543
+ const native = getNativeBridge();
544
+ if (!native?.reverse_lookup_property)
545
+ throw new Error("reverse_lookup_property not available");
546
+ return native.reverse_lookup_property(propertyId);
547
+ }
548
+ function reverseLookupValue(valueId) {
549
+ const native = getNativeBridge();
550
+ if (!native?.reverse_lookup_value) throw new Error("reverse_lookup_value not available");
551
+ return native.reverse_lookup_value(valueId);
552
+ }
553
+ function idRegistryExport(handle) {
554
+ const native = getNativeBridge();
555
+ if (!native?.id_registry_export) throw new Error("id_registry_export not available");
556
+ return native.id_registry_export(handle);
557
+ }
558
+ function idRegistryImport(importedData) {
559
+ const native = getNativeBridge();
560
+ if (!native?.id_registry_import) throw new Error("id_registry_import not available");
561
+ return native.id_registry_import(importedData);
562
+ }
563
+ var init_idRegistryNative = __esm({
564
+ "packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
922
565
  init_nativeBridge();
923
566
  }
924
567
  });
925
568
 
926
- // packages/domain/compiler/src/streamingNative.ts
569
+ // packages/domain/compiler/src/compiler/streamingNative.ts
927
570
  function processFileChange(fileChangeJson) {
928
571
  const native = getNativeBridge();
929
572
  if (!native?.process_file_change) throw new Error("process_file_change not available");
@@ -1059,244 +702,663 @@ function scanFilesBatchNative(filesJson) {
1059
702
  }
1060
703
  }
1061
704
  var init_streamingNative = __esm({
1062
- "packages/domain/compiler/src/streamingNative.ts"() {
705
+ "packages/domain/compiler/src/compiler/streamingNative.ts"() {
1063
706
  init_nativeBridge();
1064
707
  }
1065
708
  });
1066
709
 
1067
- // packages/domain/compiler/src/cssCompilationNative.ts
1068
- function compileClass(input) {
1069
- const native = getNativeBridge();
1070
- if (!native?.compile_class) throw new Error("compile_class not available");
1071
- const resultJson = native.compile_class(input);
1072
- try {
1073
- return JSON.parse(resultJson);
1074
- } catch {
1075
- return {
1076
- selector: "",
1077
- declarations: "",
1078
- properties: [],
1079
- specificity: 0
1080
- };
1081
- }
710
+ // packages/domain/compiler/src/compiler/tailwindEngine.ts
711
+ var tailwindEngine_exports = {};
712
+ __export(tailwindEngine_exports, {
713
+ clearCache: () => clearCache,
714
+ getCacheStats: () => getCacheStats2,
715
+ processTailwindCssWithTargets: () => processTailwindCssWithTargets,
716
+ runCssPipeline: () => runCssPipeline,
717
+ runCssPipelineSync: () => runCssPipelineSync
718
+ });
719
+ function _getCacheKey(classes, minify, cssEntry, root) {
720
+ const sorted = [...classes].sort().join(",");
721
+ const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
722
+ return `${sorted}|${flags}`;
1082
723
  }
1083
- function compileClasses(inputs) {
1084
- const native = getNativeBridge();
1085
- if (!native?.compile_classes) throw new Error("compile_classes not available");
1086
- const resultJson = native.compile_classes(inputs);
1087
- try {
1088
- return JSON.parse(resultJson);
1089
- } catch {
1090
- return {
1091
- css: "",
1092
- resolved_classes: [],
1093
- unknown_classes: [],
1094
- size_bytes: 0,
1095
- duration_ms: 0
1096
- };
724
+ function _evictOldestIfNeeded() {
725
+ if (_cssCache.size >= MAX_CACHE_SIZE) {
726
+ const firstKey = _cssCache.keys().next().value;
727
+ if (firstKey !== void 0) {
728
+ _cssCache.delete(firstKey);
729
+ }
1097
730
  }
1098
731
  }
1099
- function compileToCss(input, minify) {
1100
- const native = getNativeBridge();
1101
- if (!native?.compile_to_css) throw new Error("compile_to_css not available");
1102
- return native.compile_to_css(input, minify ?? false);
1103
- }
1104
- function compileToCssBatch(inputs, minify) {
1105
- const native = getNativeBridge();
1106
- if (!native?.compile_to_css_batch) throw new Error("compile_to_css_batch not available");
1107
- return native.compile_to_css_batch(inputs, minify ?? false);
1108
- }
1109
- function minifyCss(css) {
1110
- const native = getNativeBridge();
1111
- if (!native?.minify_css) throw new Error("minify_css not available");
1112
- return native.minify_css(css);
732
+ function getCacheStats2() {
733
+ const total = _cacheHits + _cacheMisses;
734
+ return {
735
+ hits: _cacheHits,
736
+ misses: _cacheMisses,
737
+ hitRate: total > 0 ? _cacheHits / total : 0,
738
+ size: _cssCache.size,
739
+ maxSize: MAX_CACHE_SIZE
740
+ };
1113
741
  }
1114
- function compileAnimation(animationName, from, to) {
1115
- const native = getNativeBridge();
1116
- if (!native?.compile_animation) throw new Error("compile_animation not available");
1117
- const resultJson = native.compile_animation(animationName, from, to);
1118
- try {
1119
- return JSON.parse(resultJson);
1120
- } catch {
1121
- return {
1122
- animation_id: "",
1123
- keyframes_css: "",
1124
- animation_rule: "",
1125
- duration_ms: 0
1126
- };
1127
- }
742
+ function clearCache() {
743
+ _cssCache.clear();
744
+ _cacheHits = 0;
745
+ _cacheMisses = 0;
1128
746
  }
1129
- function compileKeyframes(name, stopsJson) {
747
+ function getThemeConfig() {
748
+ return {
749
+ colors: {
750
+ slate: {
751
+ "50": "#f8fafc",
752
+ "100": "#f1f5f9",
753
+ "200": "#e2e8f0",
754
+ "300": "#cbd5e1",
755
+ "400": "#94a3b8",
756
+ "500": "#64748b",
757
+ "600": "#475569",
758
+ "700": "#334155",
759
+ "800": "#1e293b",
760
+ "900": "#0f172a"
761
+ },
762
+ gray: {
763
+ "50": "#f9fafb",
764
+ "100": "#f3f4f6",
765
+ "200": "#e5e7eb",
766
+ "300": "#d1d5db",
767
+ "400": "#9ca3af",
768
+ "500": "#6b7280",
769
+ "600": "#4b5563",
770
+ "700": "#374151",
771
+ "800": "#1f2937",
772
+ "900": "#111827"
773
+ },
774
+ white: "#ffffff",
775
+ black: "#000000",
776
+ red: {
777
+ "500": "#ef4444",
778
+ "600": "#dc2626"
779
+ },
780
+ blue: {
781
+ "500": "#3b82f6",
782
+ "600": "#1e40af"
783
+ }
784
+ },
785
+ spacing: {
786
+ "0": "0px",
787
+ "1": "0.25rem",
788
+ "2": "0.5rem",
789
+ "3": "0.75rem",
790
+ "4": "1rem",
791
+ "5": "1.25rem",
792
+ "6": "1.5rem",
793
+ "8": "2rem",
794
+ "10": "2.5rem",
795
+ "12": "3rem",
796
+ "16": "4rem",
797
+ "20": "5rem",
798
+ "24": "6rem"
799
+ },
800
+ breakpoints: {
801
+ "sm": "640px",
802
+ "md": "768px",
803
+ "lg": "1024px",
804
+ "xl": "1280px",
805
+ "2xl": "1536px"
806
+ }
807
+ };
808
+ }
809
+ function postProcessWithLightning(rawCss) {
810
+ if (!rawCss) return "";
811
+ const native = getNativeBridge();
812
+ if (!native?.processTailwindCssLightning) {
813
+ throw new Error("FATAL: Native binding 'processTailwindCssLightning' is required but not available.");
814
+ }
815
+ const result = native.processTailwindCssLightning(rawCss);
816
+ if (!result?.css) {
817
+ throw new Error("FATAL: processTailwindCssLightning returned null");
818
+ }
819
+ return result.css;
820
+ }
821
+ async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
822
+ const filtered = classes.filter(Boolean);
823
+ const uniqueMap = /* @__PURE__ */ new Map();
824
+ filtered.forEach((cls) => uniqueMap.set(cls, cls));
825
+ const unique = Array.from(uniqueMap.values());
826
+ if (unique.length === 0) {
827
+ return { css: "", classes: [], sizeBytes: 0, optimized: false };
828
+ }
829
+ const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root);
830
+ const cached = _cssCache.get(cacheKey);
831
+ if (cached) {
832
+ _cacheHits++;
833
+ if (process.env.DEBUG?.includes("compiler")) {
834
+ console.log(
835
+ `[Compiler] Cache HIT: ${unique.length} classes (hit rate: ${(getCacheStats2().hitRate * 100).toFixed(1)}%)`
836
+ );
837
+ }
838
+ return cached;
839
+ }
840
+ _cacheMisses++;
841
+ let rawCss;
842
+ let usedRustCompiler = false;
843
+ const theme = getThemeConfig();
844
+ rawCss = await generateCssNative(unique, { theme });
845
+ usedRustCompiler = true;
846
+ const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
847
+ if (process.env.DEBUG?.includes("compiler")) {
848
+ console.log(
849
+ `[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
850
+ `Size: ${finalCss.length} bytes`
851
+ );
852
+ }
853
+ const result = {
854
+ css: finalCss,
855
+ classes: unique,
856
+ sizeBytes: finalCss.length,
857
+ optimized: minify
858
+ };
859
+ _evictOldestIfNeeded();
860
+ _cssCache.set(cacheKey, result);
861
+ return result;
862
+ }
863
+ function runCssPipelineSync(_classes) {
864
+ return { css: "", classes: [], sizeBytes: 0, optimized: false };
865
+ }
866
+ function processTailwindCssWithTargets(css, targets) {
867
+ const native = getNativeBridge();
868
+ if (!native?.processTailwindCssWithTargets) {
869
+ throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
870
+ }
871
+ const result = native.processTailwindCssWithTargets(css, targets ?? null);
872
+ if (!result?.css) {
873
+ throw new Error("FATAL: processTailwindCssWithTargets returned null");
874
+ }
875
+ return result.css;
876
+ }
877
+ var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
878
+ var init_tailwindEngine = __esm({
879
+ "packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
880
+ init_nativeBridge();
881
+ init_cssGeneratorNative();
882
+ createRequire(import.meta.url);
883
+ _cssCache = /* @__PURE__ */ new Map();
884
+ _cacheHits = 0;
885
+ _cacheMisses = 0;
886
+ MAX_CACHE_SIZE = 100;
887
+ }
888
+ });
889
+
890
+ // packages/domain/compiler/src/compiler/index.ts
891
+ var init_compiler = __esm({
892
+ "packages/domain/compiler/src/compiler/index.ts"() {
893
+ init_cssGeneratorNative();
894
+ init_compilationNative();
895
+ init_cssCompilationNative();
896
+ init_idRegistryNative();
897
+ init_streamingNative();
898
+ init_tailwindEngine();
899
+ }
900
+ });
901
+
902
+ // packages/domain/compiler/src/parser/index.ts
903
+ var parser_exports = {};
904
+ __export(parser_exports, {
905
+ astExtractClasses: () => astExtractClasses,
906
+ batchExtractClasses: () => batchExtractClasses,
907
+ checkAgainstSafelist: () => checkAgainstSafelist,
908
+ diffClassLists: () => diffClassLists,
909
+ extractAllClasses: () => extractAllClasses,
910
+ extractClassesFromSource: () => extractClassesFromSource,
911
+ extractComponentUsage: () => extractComponentUsage,
912
+ mergeClassesStatic: () => mergeClassesStatic,
913
+ normalizeAndDedupClasses: () => normalizeAndDedupClasses,
914
+ normalizeClasses: () => normalizeClasses,
915
+ parseClasses: () => parseClasses
916
+ });
917
+ var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
918
+ var init_parser = __esm({
919
+ "packages/domain/compiler/src/parser/index.ts"() {
920
+ init_nativeBridge();
921
+ parseClasses = (raw) => {
922
+ const native = getNativeBridge();
923
+ if (!native?.parseClasses) {
924
+ throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
925
+ }
926
+ return native.parseClasses(raw) || [];
927
+ };
928
+ extractAllClasses = (source) => {
929
+ const native = getNativeBridge();
930
+ if (!native?.extractAllClasses) {
931
+ throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
932
+ }
933
+ return native.extractAllClasses(source) || [];
934
+ };
935
+ extractClassesFromSource = (source) => {
936
+ const native = getNativeBridge();
937
+ if (!native?.extractClassesFromSource) {
938
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
939
+ }
940
+ const result = native.extractClassesFromSource(source);
941
+ return Array.isArray(result) ? result.join(" ") : String(result || "");
942
+ };
943
+ astExtractClasses = (source, _filename) => {
944
+ const native = getNativeBridge();
945
+ if (!native?.extractClassesFromSource) {
946
+ throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
947
+ }
948
+ return native.extractClassesFromSource(source) || [];
949
+ };
950
+ normalizeClasses = (raw) => {
951
+ const result = normalizeAndDedupClasses(raw);
952
+ return result?.normalized || "";
953
+ };
954
+ mergeClassesStatic = (classes) => {
955
+ const result = normalizeAndDedupClasses(classes);
956
+ return result?.normalized || "";
957
+ };
958
+ normalizeAndDedupClasses = (raw) => {
959
+ const native = getNativeBridge();
960
+ if (!native?.normalizeAndDedupClasses) {
961
+ throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
962
+ }
963
+ const result = native.normalizeAndDedupClasses(raw);
964
+ return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
965
+ };
966
+ extractComponentUsage = (source) => {
967
+ const native = getNativeBridge();
968
+ if (!native?.extractComponentUsage) {
969
+ throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
970
+ }
971
+ return native.extractComponentUsage(source) || [];
972
+ };
973
+ batchExtractClasses = (filePaths) => {
974
+ const native = getNativeBridge();
975
+ if (!native?.batchExtractClasses) {
976
+ throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
977
+ }
978
+ return native.batchExtractClasses(filePaths) || [];
979
+ };
980
+ checkAgainstSafelist = (classes, safelist) => {
981
+ const native = getNativeBridge();
982
+ if (!native?.checkAgainstSafelist) {
983
+ throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
984
+ }
985
+ return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
986
+ };
987
+ diffClassLists = (previous, current) => {
988
+ const native = getNativeBridge();
989
+ if (!native?.diffClassLists) {
990
+ throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
991
+ }
992
+ return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
993
+ };
994
+ }
995
+ });
996
+
997
+ // packages/domain/compiler/src/analyzer/analyzerNative.ts
998
+ function detectDeadCode(scanResultJson, css) {
999
+ const native = getNativeBridge();
1000
+ if (!native?.detectDeadCode) throw new Error("detectDeadCode not available");
1001
+ return native.detectDeadCode(scanResultJson, css);
1002
+ }
1003
+ function analyzeClassUsageNative(classes, scanResultJson, css) {
1004
+ const native = getNativeBridge();
1005
+ if (!native?.analyzeClassUsage) throw new Error("analyzeClassUsage not available");
1006
+ return native.analyzeClassUsage(classes, scanResultJson, css);
1007
+ }
1008
+ function analyzeClassesNative(filesJson, cwd, flags) {
1009
+ const native = getNativeBridge();
1010
+ if (!native?.analyzeClasses) throw new Error("analyzeClasses not available");
1011
+ return native.analyzeClasses(filesJson, cwd, flags ?? 0);
1012
+ }
1013
+ function analyzeRscNative(source, filename) {
1014
+ const native = getNativeBridge();
1015
+ if (!native?.analyzeRsc) throw new Error("analyzeRsc not available");
1016
+ return native.analyzeRsc(source, filename);
1017
+ }
1018
+ function optimizeCssNative(css) {
1019
+ const native = getNativeBridge();
1020
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1021
+ const result = native.processTailwindCssLightning(css);
1022
+ return {
1023
+ css: result.css,
1024
+ originalSize: css.length,
1025
+ optimizedSize: result.size_bytes,
1026
+ reductionPercentage: (css.length - result.size_bytes) / css.length * 100
1027
+ };
1028
+ }
1029
+ function processTailwindCssLightning(css) {
1030
+ const native = getNativeBridge();
1031
+ if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
1032
+ return native.processTailwindCssLightning(css);
1033
+ }
1034
+ function eliminateDeadCssNative(css, deadClasses) {
1035
+ const native = getNativeBridge();
1036
+ if (!native?.eliminateDeadCss) throw new Error("eliminateDeadCss not available");
1037
+ return native.eliminateDeadCss(css, deadClasses);
1038
+ }
1039
+ function hoistComponentsNative(source) {
1040
+ const native = getNativeBridge();
1041
+ if (!native?.hoistComponents) throw new Error("hoistComponents not available");
1042
+ return native.hoistComponents(source);
1043
+ }
1044
+ function compileVariantTableNative(configJson) {
1045
+ const native = getNativeBridge();
1046
+ if (!native?.compileVariantTable) throw new Error("compileVariantTable not available");
1047
+ return native.compileVariantTable(configJson);
1048
+ }
1049
+ function classifyAndSortClassesNative(classes) {
1050
+ const native = getNativeBridge();
1051
+ if (!native?.classifyAndSortClasses) throw new Error("classifyAndSortClasses not available");
1052
+ return native.classifyAndSortClasses(classes);
1053
+ }
1054
+ function mergeCssDeclarationsNative(cssChunks) {
1130
1055
  const native = getNativeBridge();
1131
- if (!native?.compile_keyframes) throw new Error("compile_keyframes not available");
1132
- const resultJson = native.compile_keyframes(name, stopsJson);
1056
+ if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
1057
+ return native.mergeCssDeclarations(cssChunks);
1058
+ }
1059
+ var init_analyzerNative = __esm({
1060
+ "packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
1061
+ init_nativeBridge();
1062
+ }
1063
+ });
1064
+
1065
+ // packages/domain/compiler/src/analyzer/themeResolutionNative.ts
1066
+ function resolveVariants(configJson) {
1067
+ const native = getNativeBridge();
1068
+ if (!native?.resolve_variants) throw new Error("resolve_variants not available");
1069
+ const resultJson = native.resolve_variants(configJson);
1133
1070
  try {
1134
1071
  return JSON.parse(resultJson);
1135
1072
  } catch {
1136
1073
  return {
1137
- animation_id: "",
1138
- keyframes_css: "",
1139
- animation_rule: "",
1140
- duration_ms: 0
1074
+ variants: [],
1075
+ supported: [],
1076
+ deprecated: [],
1077
+ conflicting: []
1141
1078
  };
1142
1079
  }
1143
1080
  }
1144
- function compileTheme(tokensJson, themeName, prefix) {
1081
+ function validateThemeConfig(configJson) {
1145
1082
  const native = getNativeBridge();
1146
- if (!native?.compile_theme) throw new Error("compile_theme not available");
1147
- const resultJson = native.compile_theme(tokensJson, themeName, prefix);
1083
+ if (!native?.validate_variant_config) throw new Error("validate_variant_config not available");
1084
+ const resultJson = native.validate_variant_config(configJson);
1148
1085
  try {
1149
1086
  return JSON.parse(resultJson);
1150
1087
  } catch {
1151
1088
  return {
1152
- selector: ":root",
1153
- variables: [],
1154
- variables_css: "",
1155
- theme_name: themeName
1089
+ is_valid: false,
1090
+ errors: ["Unable to parse configuration"],
1091
+ warnings: [],
1092
+ suggestions: []
1156
1093
  };
1157
1094
  }
1158
1095
  }
1159
- function twMerge(classString) {
1096
+ function resolveCascade(baseThemeJson, overridesJson) {
1160
1097
  const native = getNativeBridge();
1161
- if (!native?.tw_merge) throw new Error("tw_merge not available");
1162
- return native.tw_merge(classString);
1098
+ if (!native?.resolve_cascade) throw new Error("resolve_cascade not available");
1099
+ const resultJson = native.resolve_cascade(baseThemeJson, overridesJson);
1100
+ try {
1101
+ return JSON.parse(resultJson);
1102
+ } catch {
1103
+ return {
1104
+ base_theme: {},
1105
+ user_overrides: {},
1106
+ merged_theme: {},
1107
+ conflict_resolutions: []
1108
+ };
1109
+ }
1163
1110
  }
1164
- function twMergeMany(classStrings) {
1111
+ function resolveClassNames(classNames, themeJson) {
1165
1112
  const native = getNativeBridge();
1166
- if (!native?.tw_merge_many) throw new Error("tw_merge_many not available");
1167
- return native.tw_merge_many(classStrings);
1113
+ if (!native?.resolve_class_names) throw new Error("resolve_class_names not available");
1114
+ const resultJson = native.resolve_class_names(classNames, themeJson);
1115
+ try {
1116
+ return JSON.parse(resultJson);
1117
+ } catch {
1118
+ return [];
1119
+ }
1168
1120
  }
1169
- function twMergeWithSeparator(classString, options) {
1121
+ function resolveConflictGroup(groupName, themeJson) {
1170
1122
  const native = getNativeBridge();
1171
- if (!native?.tw_merge_with_separator)
1172
- throw new Error("tw_merge_with_separator not available");
1173
- const opts = {
1174
- separator: options.separator,
1175
- debug: options.debug
1176
- };
1177
- return native.tw_merge_with_separator(classString, opts);
1123
+ if (!native?.resolve_conflict_group)
1124
+ throw new Error("resolve_conflict_group not available");
1125
+ const resultJson = native.resolve_conflict_group(groupName, themeJson);
1126
+ try {
1127
+ return JSON.parse(resultJson);
1128
+ } catch {
1129
+ return {
1130
+ group_name: groupName,
1131
+ conflicting_classes: [],
1132
+ description: "",
1133
+ resolution_strategy: "last-wins"
1134
+ };
1135
+ }
1178
1136
  }
1179
- function twMergeManyWithSeparator(classStrings, options) {
1137
+ function resolveThemeValue(keyPath, themeJson) {
1180
1138
  const native = getNativeBridge();
1181
- if (!native?.tw_merge_many_with_separator)
1182
- throw new Error("tw_merge_many_with_separator not available");
1183
- const opts = {
1184
- separator: options.separator,
1185
- debug: options.debug
1186
- };
1187
- return native.tw_merge_many_with_separator(classStrings, opts);
1139
+ if (!native?.resolve_theme_value) throw new Error("resolve_theme_value not available");
1140
+ return native.resolve_theme_value(keyPath, themeJson);
1188
1141
  }
1189
- function twMergeRaw(classLists) {
1142
+ function resolveSimpleVariants(configJson) {
1190
1143
  const native = getNativeBridge();
1191
- if (!native?.tw_merge_raw) throw new Error("tw_merge_raw not available");
1192
- return native.tw_merge_raw(classLists);
1144
+ if (!native?.resolve_simple_variants) throw new Error("resolve_simple_variants not available");
1145
+ const resultJson = native.resolve_simple_variants(configJson);
1146
+ try {
1147
+ return JSON.parse(resultJson);
1148
+ } catch {
1149
+ return [];
1150
+ }
1193
1151
  }
1194
- var init_cssCompilationNative = __esm({
1195
- "packages/domain/compiler/src/cssCompilationNative.ts"() {
1152
+ var init_themeResolutionNative = __esm({
1153
+ "packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
1196
1154
  init_nativeBridge();
1197
1155
  }
1198
1156
  });
1199
1157
 
1200
- // packages/domain/compiler/src/idRegistryNative.ts
1201
- function idRegistryCreate() {
1158
+ // packages/domain/compiler/src/analyzer/scannerNative.ts
1159
+ function scanWorkspace(root, extensions) {
1202
1160
  const native = getNativeBridge();
1203
- if (!native?.id_registry_create) throw new Error("id_registry_create not available");
1204
- return native.id_registry_create();
1161
+ if (!native?.scan_workspace) throw new Error("scan_workspace not available");
1162
+ return native.scan_workspace(root, extensions);
1205
1163
  }
1206
- function idRegistryGenerate(handle, name) {
1164
+ function extractClassesFromSourceNative(source) {
1207
1165
  const native = getNativeBridge();
1208
- if (!native?.id_registry_generate) throw new Error("id_registry_generate not available");
1209
- return native.id_registry_generate(handle, name);
1166
+ if (!native?.extract_classes_from_source) throw new Error("extract_classes_from_source not available");
1167
+ return native.extract_classes_from_source(source);
1210
1168
  }
1211
- function idRegistryLookup(handle, name) {
1169
+ function batchExtractClassesNative(filePaths) {
1212
1170
  const native = getNativeBridge();
1213
- if (!native?.id_registry_lookup) throw new Error("id_registry_lookup not available");
1214
- return native.id_registry_lookup(handle, name);
1171
+ if (!native?.batch_extract_classes) throw new Error("batch_extract_classes not available");
1172
+ return native.batch_extract_classes(filePaths);
1215
1173
  }
1216
- function idRegistryNext(handle) {
1174
+ function checkAgainstSafelistNative(classes, safelist) {
1217
1175
  const native = getNativeBridge();
1218
- if (!native?.id_registry_next) throw new Error("id_registry_next not available");
1219
- return native.id_registry_next(handle);
1176
+ if (!native?.check_against_safelist) throw new Error("check_against_safelist not available");
1177
+ return native.check_against_safelist(classes, safelist);
1220
1178
  }
1221
- function idRegistryDestroy(handle) {
1179
+ function scanFile(filePath) {
1222
1180
  const native = getNativeBridge();
1223
- if (!native?.id_registry_destroy) return;
1224
- native.id_registry_destroy(handle);
1181
+ if (!native?.scan_file) throw new Error("scan_file not available");
1182
+ return native.scan_file(filePath);
1225
1183
  }
1226
- function idRegistryReset(handle) {
1184
+ function collectFiles(root, extensions) {
1227
1185
  const native = getNativeBridge();
1228
- if (!native?.id_registry_reset) return;
1229
- native.id_registry_reset(handle);
1186
+ if (!native?.collect_files) throw new Error("collect_files not available");
1187
+ return native.collect_files(root, extensions);
1230
1188
  }
1231
- function idRegistrySnapshot(handle) {
1189
+ function walkAndPrefilterSourceFiles(root, extensions, _parallel) {
1232
1190
  const native = getNativeBridge();
1233
- if (!native?.id_registry_snapshot) throw new Error("id_registry_snapshot not available");
1234
- const snapshotJson = native.id_registry_snapshot(handle);
1191
+ if (!native?.walk_and_prefilter_source_files) throw new Error("walk_and_prefilter_source_files not available");
1192
+ return native.walk_and_prefilter_source_files(root, extensions);
1193
+ }
1194
+ function generateSubComponentTypes(root, outputPath) {
1195
+ const native = getNativeBridge();
1196
+ if (!native?.generate_sub_component_types) throw new Error("generate_sub_component_types not available");
1197
+ return native.generate_sub_component_types(root, outputPath);
1198
+ }
1199
+ var init_scannerNative = __esm({
1200
+ "packages/domain/compiler/src/analyzer/scannerNative.ts"() {
1201
+ init_nativeBridge();
1202
+ }
1203
+ });
1204
+
1205
+ // packages/domain/compiler/src/analyzer/index.ts
1206
+ var init_analyzer = __esm({
1207
+ "packages/domain/compiler/src/analyzer/index.ts"() {
1208
+ init_analyzerNative();
1209
+ init_themeResolutionNative();
1210
+ init_scannerNative();
1211
+ }
1212
+ });
1213
+
1214
+ // packages/domain/compiler/src/cache/cacheNative.ts
1215
+ function getCacheStatistics() {
1216
+ const native = getNativeBridge();
1217
+ if (!native?.get_cache_statistics) throw new Error("get_cache_statistics not available");
1218
+ const statsJson = native.get_cache_statistics();
1235
1219
  try {
1236
- return JSON.parse(snapshotJson);
1220
+ return JSON.parse(statsJson);
1237
1221
  } catch {
1238
1222
  return {
1239
- handle,
1240
- next_id: 0,
1241
- entries: [],
1242
- total_entries: 0
1223
+ parse_cache: { hits: 0, misses: 0, size: 0 },
1224
+ resolve_cache: { hits: 0, misses: 0, size: 0 },
1225
+ compile_cache: { hits: 0, misses: 0, size: 0 },
1226
+ css_gen_cache: { hits: 0, misses: 0, size: 0 },
1227
+ overall_hit_rate: 0,
1228
+ total_memory_bytes: 0
1243
1229
  };
1244
1230
  }
1245
1231
  }
1246
- function idRegistryActiveCount() {
1232
+ function clearAllCaches() {
1247
1233
  const native = getNativeBridge();
1248
- if (!native?.id_registry_active_count) throw new Error("id_registry_active_count not available");
1249
- return native.id_registry_active_count();
1234
+ if (!native?.clear_all_caches) return;
1235
+ try {
1236
+ native.clear_all_caches();
1237
+ } catch {
1238
+ }
1250
1239
  }
1251
- function registerPropertyName(propertyName) {
1240
+ function clearParseCache() {
1252
1241
  const native = getNativeBridge();
1253
- if (!native?.register_property_name)
1254
- throw new Error("register_property_name not available");
1255
- return native.register_property_name(propertyName);
1242
+ if (!native?.clear_parse_cache) return;
1243
+ try {
1244
+ native.clear_parse_cache();
1245
+ } catch {
1246
+ }
1256
1247
  }
1257
- function registerValueName(valueName) {
1248
+ function clearResolveCache() {
1258
1249
  const native = getNativeBridge();
1259
- if (!native?.register_value_name) throw new Error("register_value_name not available");
1260
- return native.register_value_name(valueName);
1250
+ if (!native?.clear_resolve_cache) return;
1251
+ try {
1252
+ native.clear_resolve_cache();
1253
+ } catch {
1254
+ }
1261
1255
  }
1262
- function propertyIdToString(propertyId) {
1256
+ function clearCompileCache() {
1263
1257
  const native = getNativeBridge();
1264
- if (!native?.property_id_to_string) throw new Error("property_id_to_string not available");
1265
- return native.property_id_to_string(propertyId);
1258
+ if (!native?.clear_compile_cache) return;
1259
+ try {
1260
+ native.clear_compile_cache();
1261
+ } catch {
1262
+ }
1266
1263
  }
1267
- function valueIdToString(valueId) {
1264
+ function clearCssGenCache() {
1268
1265
  const native = getNativeBridge();
1269
- if (!native?.value_id_to_string) throw new Error("value_id_to_string not available");
1270
- return native.value_id_to_string(valueId);
1266
+ if (!native?.clear_css_gen_cache) return;
1267
+ try {
1268
+ native.clear_css_gen_cache();
1269
+ } catch {
1270
+ }
1271
1271
  }
1272
- function reverseLookupProperty(propertyId) {
1272
+ function getCacheOptimizationHints(hitRatePercent, memoryUsedMb) {
1273
1273
  const native = getNativeBridge();
1274
- if (!native?.reverse_lookup_property)
1275
- throw new Error("reverse_lookup_property not available");
1276
- return native.reverse_lookup_property(propertyId);
1274
+ if (!native?.get_cache_optimization_hints)
1275
+ throw new Error("get_cache_optimization_hints not available");
1276
+ const hintsJson = native.get_cache_optimization_hints(
1277
+ Math.min(100, Math.max(0, hitRatePercent)),
1278
+ Math.max(1, memoryUsedMb)
1279
+ );
1280
+ try {
1281
+ return JSON.parse(hintsJson);
1282
+ } catch {
1283
+ return {
1284
+ current_strategy: "unknown",
1285
+ recommended_strategy: "increase_size",
1286
+ estimated_improvement_percent: 0,
1287
+ suggested_memory_mb: 256,
1288
+ notes: ["Unable to analyze cache statistics"]
1289
+ };
1290
+ }
1291
+ }
1292
+ function estimateOptimalCacheConfig(totalBudgetMb, workloadType) {
1293
+ const native = getNativeBridge();
1294
+ if (!native?.estimate_optimal_cache_config_native)
1295
+ throw new Error("estimate_optimal_cache_config_native not available");
1296
+ const configJson = native.estimate_optimal_cache_config_native(
1297
+ Math.max(64, totalBudgetMb),
1298
+ workloadType
1299
+ );
1300
+ try {
1301
+ return JSON.parse(configJson);
1302
+ } catch {
1303
+ return {
1304
+ parse_cache_size: 128,
1305
+ resolve_cache_size: 64,
1306
+ compile_cache_size: 256,
1307
+ css_gen_cache_size: 128,
1308
+ recommended_eviction_policy: "lru",
1309
+ ttl_seconds: 3600,
1310
+ expected_hit_rate_percent: 75
1311
+ };
1312
+ }
1277
1313
  }
1278
- function reverseLookupValue(valueId) {
1314
+ function cacheRead(cachePath) {
1279
1315
  const native = getNativeBridge();
1280
- if (!native?.reverse_lookup_value) throw new Error("reverse_lookup_value not available");
1281
- return native.reverse_lookup_value(valueId);
1316
+ if (!native?.cache_read) throw new Error("cache_read not available");
1317
+ const result = native.cache_read(cachePath);
1318
+ try {
1319
+ return JSON.parse(result.entries_json || "[]");
1320
+ } catch {
1321
+ return [];
1322
+ }
1282
1323
  }
1283
- function idRegistryExport(handle) {
1324
+ function cacheWrite(cachePath, entries) {
1284
1325
  const native = getNativeBridge();
1285
- if (!native?.id_registry_export) throw new Error("id_registry_export not available");
1286
- return native.id_registry_export(handle);
1326
+ if (!native?.cache_write) throw new Error("cache_write not available");
1327
+ try {
1328
+ const result = native.cache_write(
1329
+ cachePath,
1330
+ entries.map((e) => ({
1331
+ file: e.file,
1332
+ content_hash: e.contentHash,
1333
+ classes: e.classes,
1334
+ mtime_ms: e.mtimeMs,
1335
+ size_bytes: e.sizeBytes
1336
+ }))
1337
+ );
1338
+ return typeof result === "boolean" ? result : result === true;
1339
+ } catch {
1340
+ return false;
1341
+ }
1287
1342
  }
1288
- function idRegistryImport(importedData) {
1343
+ function cachePriority(mtimeMs, sizeBytes, hitCount) {
1289
1344
  const native = getNativeBridge();
1290
- if (!native?.id_registry_import) throw new Error("id_registry_import not available");
1291
- return native.id_registry_import(importedData);
1345
+ if (!native?.cache_priority) throw new Error("cache_priority not available");
1346
+ return native.cache_priority(mtimeMs, sizeBytes, hitCount);
1292
1347
  }
1293
- var init_idRegistryNative = __esm({
1294
- "packages/domain/compiler/src/idRegistryNative.ts"() {
1348
+ var init_cacheNative = __esm({
1349
+ "packages/domain/compiler/src/cache/cacheNative.ts"() {
1295
1350
  init_nativeBridge();
1296
1351
  }
1297
1352
  });
1298
1353
 
1299
- // packages/domain/compiler/src/redisNative.ts
1354
+ // packages/domain/compiler/src/cache/index.ts
1355
+ var init_cache = __esm({
1356
+ "packages/domain/compiler/src/cache/index.ts"() {
1357
+ init_cacheNative();
1358
+ }
1359
+ });
1360
+
1361
+ // packages/domain/compiler/src/redis/redisNative.ts
1300
1362
  function redisPing() {
1301
1363
  const native = getNativeBridge();
1302
1364
  if (!native?.redis_ping) throw new Error("redis_ping not available");
@@ -1539,12 +1601,19 @@ function redisDiagnose() {
1539
1601
  return native.redis_diagnose();
1540
1602
  }
1541
1603
  var init_redisNative = __esm({
1542
- "packages/domain/compiler/src/redisNative.ts"() {
1604
+ "packages/domain/compiler/src/redis/redisNative.ts"() {
1543
1605
  init_nativeBridge();
1544
1606
  }
1545
1607
  });
1546
1608
 
1547
- // packages/domain/compiler/src/watchSystemNative.ts
1609
+ // packages/domain/compiler/src/redis/index.ts
1610
+ var init_redis = __esm({
1611
+ "packages/domain/compiler/src/redis/index.ts"() {
1612
+ init_redisNative();
1613
+ }
1614
+ });
1615
+
1616
+ // packages/domain/compiler/src/watch/watchSystemNative.ts
1548
1617
  function startWatch(root_path, patterns) {
1549
1618
  const native = getNativeBridge();
1550
1619
  if (!native?.start_watch) throw new Error("start_watch not available");
@@ -1677,10 +1746,17 @@ function getCompilerDiagnostics() {
1677
1746
  return native.get_compiler_diagnostics();
1678
1747
  }
1679
1748
  var init_watchSystemNative = __esm({
1680
- "packages/domain/compiler/src/watchSystemNative.ts"() {
1749
+ "packages/domain/compiler/src/watch/watchSystemNative.ts"() {
1681
1750
  init_nativeBridge();
1682
1751
  }
1683
1752
  });
1753
+
1754
+ // packages/domain/compiler/src/watch/index.ts
1755
+ var init_watch = __esm({
1756
+ "packages/domain/compiler/src/watch/index.ts"() {
1757
+ init_watchSystemNative();
1758
+ }
1759
+ });
1684
1760
  function _layoutClassesToCss(classes) {
1685
1761
  const native = getNativeBridge();
1686
1762
  if (!native?.layoutClassesToCss) {
@@ -1715,21 +1791,16 @@ function extractContainerCssFromSource(source) {
1715
1791
  }
1716
1792
  return rules.join("\n");
1717
1793
  }
1718
- var transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, compileCssNative, generateCssForClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, parseClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, eliminateDeadCss, findDeadVariants, runElimination, optimizeCss, scanProjectUsage, extractComponentUsage, diffClassLists, batchExtractClasses, checkAgainstSafelist, hoistComponents, compileVariantTable, compileVariants, classifyAndSortClasses, mergeCssDeclarations, analyzeClassUsage, analyzeRsc, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, BucketEngine, classifyNode, detectConflicts, bucketSort, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
1794
+ var transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, BucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
1719
1795
  var init_src2 = __esm({
1720
1796
  "packages/domain/compiler/src/index.ts"() {
1721
1797
  init_nativeBridge();
1722
- init_cssGeneratorNative();
1723
- init_scannerNative();
1724
- init_analyzerNative();
1725
- init_compilationNative();
1726
- init_cacheNative();
1727
- init_themeResolutionNative();
1728
- init_streamingNative();
1729
- init_cssCompilationNative();
1730
- init_idRegistryNative();
1731
- init_redisNative();
1732
- init_watchSystemNative();
1798
+ init_compiler();
1799
+ init_parser();
1800
+ init_analyzer();
1801
+ init_cache();
1802
+ init_redis();
1803
+ init_watch();
1733
1804
  transformSource = (source, opts) => {
1734
1805
  const native = getNativeBridge();
1735
1806
  if (!native?.transformSource) {
@@ -1773,58 +1844,19 @@ var init_src2 = __esm({
1773
1844
  const result = compileCssFromClasses(classes);
1774
1845
  return result?.code ? `<style data-tailwind-styled>${result.code}</style>` : "";
1775
1846
  };
1776
- compileCssNative = (classes, prefix = null) => {
1777
- return compileCssFromClasses(classes, prefix);
1778
- };
1779
1847
  generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
1780
- const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
1781
- const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
1782
- return result.css;
1783
- };
1784
- extractAllClasses = (source) => {
1785
- const native = getNativeBridge();
1786
- if (!native?.extractAllClasses) {
1787
- throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
1788
- }
1789
- return native.extractAllClasses(source) || [];
1790
- };
1791
- extractClassesFromSource = (source) => {
1792
- const native = getNativeBridge();
1793
- if (!native?.extractClassesFromSource) {
1794
- throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1795
- }
1796
- const result = native.extractClassesFromSource(source);
1797
- return Array.isArray(result) ? result.join(" ") : String(result || "");
1798
- };
1799
- astExtractClasses = (source, _filename) => {
1800
- const native = getNativeBridge();
1801
- if (!native?.extractClassesFromSource) {
1802
- throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
1803
- }
1804
- return native.extractClassesFromSource(source) || [];
1805
- };
1806
- parseClasses = (raw) => {
1807
- const native = getNativeBridge();
1808
- if (!native?.parseClasses) {
1809
- throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
1810
- }
1811
- return native.parseClasses(raw) || [];
1812
- };
1813
- normalizeClasses = (raw) => {
1814
- const result = normalizeAndDedupClasses(raw);
1815
- return result?.normalized || "";
1816
- };
1817
- mergeClassesStatic = (classes) => {
1818
- const result = normalizeAndDedupClasses(classes);
1819
- return result?.normalized || "";
1820
- };
1821
- normalizeAndDedupClasses = (raw) => {
1822
- const native = getNativeBridge();
1823
- if (!native?.normalizeAndDedupClasses) {
1824
- throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
1848
+ try {
1849
+ const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
1850
+ const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
1851
+ return result.css;
1852
+ } catch {
1853
+ const native = getNativeBridge();
1854
+ if (!native?.transformSource) {
1855
+ throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
1856
+ }
1857
+ const result = native.transformSource(classes.join(" "), {});
1858
+ return result?.code || "";
1825
1859
  }
1826
- const result = native.normalizeAndDedupClasses(raw);
1827
- return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
1828
1860
  };
1829
1861
  eliminateDeadCss = (css, deadClasses) => {
1830
1862
  const native = getNativeBridge();
@@ -1857,16 +1889,10 @@ var init_src2 = __esm({
1857
1889
  const dead = native.detectDeadCode(JSON.stringify(scanResult), css);
1858
1890
  return eliminateDeadCss(css, new Set(dead.deadInCss ?? []));
1859
1891
  };
1860
- optimizeCss = (css) => {
1861
- const native = getNativeBridge();
1862
- if (!native?.optimizeCss) {
1863
- throw new Error("FATAL: Native binding 'optimizeCss' is required but not available.");
1864
- }
1865
- return native.optimizeCss(css);
1866
- };
1867
1892
  scanProjectUsage = (dirs, cwd) => {
1893
+ const { batchExtractClasses: batchExtractClasses2 } = (init_parser(), __toCommonJS(parser_exports));
1868
1894
  const files = dirs.map((dir) => path__default.resolve(cwd, dir));
1869
- const results = batchExtractClasses(files) || [];
1895
+ const results = batchExtractClasses2(files) || [];
1870
1896
  const combined = {};
1871
1897
  for (const result of results) {
1872
1898
  if (result.ok && result.classes) {
@@ -1878,109 +1904,6 @@ var init_src2 = __esm({
1878
1904
  }
1879
1905
  return combined;
1880
1906
  };
1881
- extractComponentUsage = (source) => {
1882
- const native = getNativeBridge();
1883
- if (!native?.extractComponentUsage) {
1884
- throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
1885
- }
1886
- return native.extractComponentUsage(source) || [];
1887
- };
1888
- diffClassLists = (previous, current) => {
1889
- const native = getNativeBridge();
1890
- if (!native?.diffClassLists) {
1891
- throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
1892
- }
1893
- return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
1894
- };
1895
- batchExtractClasses = (filePaths) => {
1896
- const native = getNativeBridge();
1897
- if (!native?.batchExtractClasses) {
1898
- throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
1899
- }
1900
- return native.batchExtractClasses(filePaths) || [];
1901
- };
1902
- checkAgainstSafelist = (classes, safelist) => {
1903
- const native = getNativeBridge();
1904
- if (!native?.checkAgainstSafelist) {
1905
- throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
1906
- }
1907
- return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
1908
- };
1909
- hoistComponents = (source) => {
1910
- const native = getNativeBridge();
1911
- if (!native?.hoistComponents) {
1912
- throw new Error("FATAL: Native binding 'hoistComponents' is required but not available.");
1913
- }
1914
- return native.hoistComponents(source) || { code: source, hoisted: [], warnings: [] };
1915
- };
1916
- compileVariantTable = (configJson) => {
1917
- const native = getNativeBridge();
1918
- if (!native?.compileVariantTable) {
1919
- throw new Error("FATAL: Native binding 'compileVariantTable' is required but not available.");
1920
- }
1921
- return native.compileVariantTable(configJson) || { id: "", tableJson: "{}", keys: [], defaultKey: "", combinations: 0 };
1922
- };
1923
- compileVariants = (componentId, config) => {
1924
- return compileVariantTable(JSON.stringify({ componentId, ...config }));
1925
- };
1926
- classifyAndSortClasses = (classes) => {
1927
- const native = getNativeBridge();
1928
- if (!native?.classifyAndSortClasses) {
1929
- throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
1930
- }
1931
- return native.classifyAndSortClasses(classes) || [];
1932
- };
1933
- mergeCssDeclarations = (cssChunks) => {
1934
- const native = getNativeBridge();
1935
- if (!native?.mergeCssDeclarations) {
1936
- throw new Error("FATAL: Native binding 'mergeCssDeclarations' is required but not available.");
1937
- }
1938
- return native.mergeCssDeclarations(cssChunks) || { declarationsJson: "{}", declarationString: "", count: 0 };
1939
- };
1940
- analyzeClassUsage = (classes, scanResultJson, css) => {
1941
- const native = getNativeBridge();
1942
- if (!native?.analyzeClassUsage) {
1943
- throw new Error("FATAL: Native binding 'analyzeClassUsage' is required but not available.");
1944
- }
1945
- return native.analyzeClassUsage(classes, scanResultJson, css) || [];
1946
- };
1947
- analyzeRsc = (source, filename) => {
1948
- const native = getNativeBridge();
1949
- if (!native?.analyzeRsc) {
1950
- throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
1951
- }
1952
- return native.analyzeRsc(source, filename) || { isServer: true, needsClientDirective: false, clientReasons: [] };
1953
- };
1954
- analyzeFile = (source, filename) => {
1955
- const rsc = analyzeRsc(source, filename);
1956
- return {
1957
- isServer: rsc?.isServer ?? true,
1958
- needsClientDirective: rsc?.needsClientDirective ?? false,
1959
- clientReasons: rsc?.clientReasons ?? [],
1960
- interactiveClasses: [],
1961
- canStaticResolveVariants: true
1962
- };
1963
- };
1964
- analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
1965
- return { resolved: {}, dynamic: [] };
1966
- };
1967
- injectClientDirective = (source) => {
1968
- if (!source.includes('"use client"') && !source.includes("'use client'")) {
1969
- return '"use client";\n' + source;
1970
- }
1971
- return source;
1972
- };
1973
- injectServerOnlyComment = (source) => {
1974
- return `/* @server-only */
1975
- ${source}`;
1976
- };
1977
- analyzeClasses = (filesJson, cwd, flags) => {
1978
- const native = getNativeBridge();
1979
- if (!native?.analyzeClasses) {
1980
- throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
1981
- }
1982
- return native.analyzeClasses(filesJson, cwd, flags);
1983
- };
1984
1907
  generateSafelist = (scanDirs, outputPath, cwd) => {
1985
1908
  const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
1986
1909
  const allClasses = Object.keys(classes).sort();
@@ -2044,7 +1967,8 @@ ${source}`;
2044
1967
  if (containerCss) cssChunks.push(containerCss);
2045
1968
  const combined = cssChunks.join("\n").trim();
2046
1969
  if (combined) staticCss = combined;
2047
- } catch {
1970
+ } catch (err) {
1971
+ console.debug("Static CSS extraction warning:", err);
2048
1972
  }
2049
1973
  return {
2050
1974
  code: result?.code || "",
@@ -2134,7 +2058,46 @@ ${source}`;
2134
2058
  return [];
2135
2059
  };
2136
2060
  bucketSort = (classes) => {
2137
- return classifyAndSortClasses(classes).map((c) => c.raw ?? c);
2061
+ const native = getNativeBridge();
2062
+ if (!native?.classifyAndSortClasses) {
2063
+ throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
2064
+ }
2065
+ const sorted = native.classifyAndSortClasses(classes);
2066
+ return sorted.map((c) => c.raw ?? c);
2067
+ };
2068
+ analyzeFile = (source, filename) => {
2069
+ const native = getNativeBridge();
2070
+ if (!native?.analyzeRsc) {
2071
+ throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
2072
+ }
2073
+ const rsc = native.analyzeRsc(source, filename);
2074
+ return {
2075
+ isServer: rsc?.isServer ?? true,
2076
+ needsClientDirective: rsc?.needsClientDirective ?? false,
2077
+ clientReasons: rsc?.clientReasons ?? [],
2078
+ interactiveClasses: [],
2079
+ canStaticResolveVariants: true
2080
+ };
2081
+ };
2082
+ analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
2083
+ return { resolved: {}, dynamic: [] };
2084
+ };
2085
+ injectClientDirective = (source) => {
2086
+ if (!source.includes('"use client"') && !source.includes("'use client'")) {
2087
+ return '"use client";\n' + source;
2088
+ }
2089
+ return source;
2090
+ };
2091
+ injectServerOnlyComment = (source) => {
2092
+ return `/* @server-only */
2093
+ ${source}`;
2094
+ };
2095
+ analyzeClasses = (filesJson, cwd, flags) => {
2096
+ const native = getNativeBridge();
2097
+ if (!native?.analyzeClasses) {
2098
+ throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
2099
+ }
2100
+ return native.analyzeClasses(filesJson, cwd, flags);
2138
2101
  };
2139
2102
  extractTwStateConfigs = (source, filename) => {
2140
2103
  const native = getNativeBridge();
@@ -2143,23 +2106,25 @@ ${source}`;
2143
2106
  }
2144
2107
  return native.extractTwStateConfigs(source, filename);
2145
2108
  };
2146
- generateStaticStateCss = (inputs, resolvedCss = null) => {
2147
- const native = getNativeBridge();
2148
- if (!native?.generateStaticStateCss) {
2149
- throw new Error("FATAL: Native binding 'generateStaticStateCss' is required but not available.");
2109
+ generateStaticStateCss = (entries, _themeConfig) => {
2110
+ const rules = [];
2111
+ for (const entry of entries) {
2112
+ const stateConfig = JSON.parse(entry.statesJson);
2113
+ for (const [stateName, classes] of Object.entries(stateConfig)) {
2114
+ rules.push({
2115
+ selector: `.${entry.componentName}[data-state="${stateName}"]`,
2116
+ declarations: classes,
2117
+ cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
2118
+ componentName: entry.componentName,
2119
+ stateName
2120
+ });
2121
+ }
2150
2122
  }
2151
- return native.generateStaticStateCss(inputs, resolvedCss);
2123
+ return rules;
2152
2124
  };
2153
2125
  extractAndGenerateStateCss = (source, filename) => {
2154
- const native = getNativeBridge();
2155
- if (!native?.extractAndGenerateStateCss) {
2156
- const configs = extractTwStateConfigs(source, filename);
2157
- if (configs.length === 0) return [];
2158
- return generateStaticStateCss(
2159
- configs.map((c) => ({ tag: c.tag, componentName: c.componentName, statesJson: c.statesJson }))
2160
- );
2161
- }
2162
- return native.extractAndGenerateStateCss(source, filename);
2126
+ const entries = extractTwStateConfigs(source, filename);
2127
+ return generateStaticStateCss(entries);
2163
2128
  };
2164
2129
  }
2165
2130
  });
@@ -2167,6 +2132,6 @@ ${source}`;
2167
2132
  // src/umbrella/compiler.ts
2168
2133
  init_src2();
2169
2134
 
2170
- export { BucketEngine, IncrementalEngine, adaptNativeResult, analyzeClassUsage, analyzeClassUsageNative, analyzeClasses, analyzeClassesNative, analyzeFile, analyzeRsc, analyzeRscNative, analyzeVariantUsage, astExtractClasses, atomicRegistrySize, batchExtractClasses, batchExtractClassesNative, bucketSort, buildStyleTag, cachePriority, cacheRead, cacheWrite, checkAgainstSafelist, checkAgainstSafelistNative, classifyAndSortClasses, classifyAndSortClassesNative, classifyNode, clearAllCaches, clearAtomicRegistry, clearCompileCache, clearCssGenCache, clearParseCache, clearResolveCache, clearThemeCache, collectFiles, compileAnimation, compileClass, compileClasses, compileCssFromClasses, compileCssLightning, compileCssNative, compileCssNative2, compileKeyframes, compileTheme, compileToCss, compileToCssBatch, compileVariantTable, compileVariantTableNative, compileVariants, computeIncrementalDiff, createFingerprint, detectConflicts, detectDeadCode, diffClassLists, eliminateDeadCss, eliminateDeadCssNative, emitPluginHook, estimateOptimalCacheConfig, extractAllClasses, extractAndGenerateStateCss, extractAndGenerateStateCssNative, extractClassesFromSource, extractClassesFromSourceNative, extractComponentUsage, extractContainerCssFromSource, extractTwContainerConfigs, extractTwStateConfigs, extractTwStateConfigsNative, fileToRoute, findDeadVariants, generateAtomicCss, generateCssForClasses, generateCssNative, generateSafelist, generateStaticStateCss, generateStaticStateCssNative, generateSubComponentTypes, getAllRoutes, getBucketEngine, getCacheOptimizationHints, getCacheStatistics, getCacheStats2 as getCacheStats, getCompilationMetrics, getCompilerDiagnostics, getContentPaths, getIncrementalEngine, getNativeBridge, getPluginHooks, getRouteClasses, getWatchStats, hasTwUsage, hashContent, hoistComponents, hoistComponentsNative, idRegistryActiveCount, idRegistryCreate, idRegistryDestroy, idRegistryExport, idRegistryGenerate, idRegistryImport, idRegistryLookup, idRegistryNext, idRegistryReset, idRegistrySnapshot, injectClientDirective, injectServerOnlyComment, injectStateHash, isAlreadyTransformed, isWatchRunning, layoutClassesToCss, loadSafelist, loadTailwindConfig, mergeClassesStatic, mergeCssDeclarations, mergeCssDeclarationsNative, minifyCss, normalizeAndDedupClasses, normalizeClasses, optimizeCss, optimizeCssNative, parseAtomicClass, parseClasses, pollWatchEvents, processFileChange, processTailwindCssLightning, propertyIdToString, pruneStaleCacheEntries, rebuildWorkspaceResult, redisCacheClear, redisCacheHitRate, redisCacheKeyCount, redisCacheSize, redisCacheSync, redisClusterStatus, redisDelete, redisDiagnose, redisDisableCacheWarming, redisDisableCluster, redisDisablePersistence, redisEnableCacheWarming, redisEnableCluster, redisEnablePersistence, redisExists, redisExpirationGet, redisExpirationSet, redisFlushAll, redisFlushDb, redisGet, redisGetEvictionPolicy, redisInfo, redisMemoryStats, redisMget, redisMonitor, redisMset, redisOptimizeMemory, redisPing, redisPoolConnect, redisPoolReconnect, redisPoolStats, redisPublish, redisReplicate, redisReplicationStatus, redisSet, redisSetEvictionPolicy, redisSnapshot, redisSubscribe, registerFileClasses, registerGlobalClasses, registerPluginHook, registerPropertyName, registerValueName, resetBucketEngine, resetCompilationMetrics, resetIncrementalEngine, resetNativeBridgeCache, resolveCascade, resolveClassNames, resolveConflictGroup, resolveSimpleVariants, resolveThemeValue, resolveVariants, reverseLookupProperty, reverseLookupValue, runElimination, runLoaderTransform, scanCacheOptimizations, scanFile, scanFileNative, scanFilesBatchNative, scanProjectUsage, scanWorkspace, shouldProcess, shouldSkipFile, startWatch, stopWatch, toAtomicClasses, transformSource, twMerge, twMergeMany, twMergeManyWithSeparator, twMergeRaw, twMergeWithSeparator, unregisterPluginHook, validateCssOutput, validateThemeConfig, valueIdToString, walkAndPrefilterSourceFiles, watchAddPattern, watchClearAll, watchEventTypeToString, watchGetActiveHandles, watchPause, watchRemovePattern, watchResume };
2135
+ export { BucketEngine, IncrementalEngine, adaptNativeResult, analyzeClassUsageNative, analyzeClasses, analyzeClassesNative, analyzeFile, analyzeRscNative, analyzeVariantUsage, astExtractClasses, atomicRegistrySize, batchExtractClasses, batchExtractClassesNative, bucketSort, buildStyleTag, cachePriority, cacheRead, cacheWrite, checkAgainstSafelist, checkAgainstSafelistNative, classifyAndSortClassesNative, classifyNode, clearAllCaches, clearAtomicRegistry, clearCompileCache, clearCssGenCache, clearParseCache, clearResolveCache, clearThemeCache, collectFiles, compileAnimation, compileClass, compileClasses, compileCssFromClasses, compileCssLightning, compileCssNative2, compileKeyframes, compileTheme, compileToCss, compileToCssBatch, compileVariantTableNative, computeIncrementalDiff, createFingerprint, detectConflicts, detectDeadCode, diffClassLists, eliminateDeadCss, eliminateDeadCssNative, emitPluginHook, estimateOptimalCacheConfig, extractAllClasses, extractAndGenerateStateCss, extractAndGenerateStateCssNative, extractClassesFromSource, extractClassesFromSourceNative, extractComponentUsage, extractContainerCssFromSource, extractTwContainerConfigs, extractTwStateConfigs, extractTwStateConfigsNative, fileToRoute, findDeadVariants, generateAtomicCss, generateCssForClasses, generateCssNative, generateSafelist, generateStaticStateCss, generateStaticStateCssNative, generateSubComponentTypes, getAllRoutes, getBucketEngine, getCacheOptimizationHints, getCacheStatistics, getCacheStats, getCompilationMetrics, getCompilerDiagnostics, getContentPaths, getIncrementalEngine, getNativeBridge, getPluginHooks, getRouteClasses, getWatchStats, hasTwUsage, hashContent, hoistComponentsNative, idRegistryActiveCount, idRegistryCreate, idRegistryDestroy, idRegistryExport, idRegistryGenerate, idRegistryImport, idRegistryLookup, idRegistryNext, idRegistryReset, idRegistrySnapshot, injectClientDirective, injectServerOnlyComment, injectStateHash, isAlreadyTransformed, isWatchRunning, layoutClassesToCss, loadSafelist, loadTailwindConfig, mergeClassesStatic, mergeCssDeclarationsNative, minifyCss, normalizeAndDedupClasses, normalizeClasses, optimizeCssNative, parseAtomicClass, parseClasses, pollWatchEvents, processFileChange, processTailwindCssLightning, propertyIdToString, pruneStaleCacheEntries, rebuildWorkspaceResult, redisCacheClear, redisCacheHitRate, redisCacheKeyCount, redisCacheSize, redisCacheSync, redisClusterStatus, redisDelete, redisDiagnose, redisDisableCacheWarming, redisDisableCluster, redisDisablePersistence, redisEnableCacheWarming, redisEnableCluster, redisEnablePersistence, redisExists, redisExpirationGet, redisExpirationSet, redisFlushAll, redisFlushDb, redisGet, redisGetEvictionPolicy, redisInfo, redisMemoryStats, redisMget, redisMonitor, redisMset, redisOptimizeMemory, redisPing, redisPoolConnect, redisPoolReconnect, redisPoolStats, redisPublish, redisReplicate, redisReplicationStatus, redisSet, redisSetEvictionPolicy, redisSnapshot, redisSubscribe, registerFileClasses, registerGlobalClasses, registerPluginHook, registerPropertyName, registerValueName, resetBucketEngine, resetCompilationMetrics, resetIncrementalEngine, resetNativeBridgeCache, resolveCascade, resolveClassNames, resolveConflictGroup, resolveSimpleVariants, resolveThemeValue, resolveVariants, reverseLookupProperty, reverseLookupValue, runCssPipeline, runElimination, runLoaderTransform, scanCacheOptimizations, scanFile, scanFileNative, scanFilesBatchNative, scanProjectUsage, scanWorkspace, shouldProcess, shouldSkipFile, startWatch, stopWatch, toAtomicClasses, transformSource, twMerge, twMergeMany, twMergeManyWithSeparator, twMergeRaw, twMergeWithSeparator, unregisterPluginHook, validateCssOutput, validateThemeConfig, valueIdToString, walkAndPrefilterSourceFiles, watchAddPattern, watchClearAll, watchEventTypeToString, watchGetActiveHandles, watchPause, watchRemovePattern, watchResume };
2171
2136
  //# sourceMappingURL=compiler.mjs.map
2172
2137
  //# sourceMappingURL=compiler.mjs.map