tailwind-styled-v4 5.0.22 → 5.0.24

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.
package/dist/next.mjs CHANGED
@@ -2412,7 +2412,13 @@ var init_src = __esm({
2412
2412
  const cssChunks = [];
2413
2413
  const stateRules = extractAndGenerateStateCss(source, filepath);
2414
2414
  if (stateRules.length > 0) {
2415
- cssChunks.push(stateRules.map((r) => r.cssRule).join("\n"));
2415
+ const resolvedRules = stateRules.filter((r) => {
2416
+ const decl = r.declarations.trim();
2417
+ return decl.length === 0 || decl.includes(":");
2418
+ });
2419
+ if (resolvedRules.length > 0) {
2420
+ cssChunks.push(resolvedRules.map((r) => r.cssRule).join("\n"));
2421
+ }
2416
2422
  }
2417
2423
  const containerCss = extractContainerCssFromSource(source);
2418
2424
  if (containerCss) cssChunks.push(containerCss);
@@ -2557,25 +2563,26 @@ ${source}`;
2557
2563
  }
2558
2564
  return native.extractTwStateConfigs(source, filename);
2559
2565
  };
2560
- generateStaticStateCss = (entries, _themeConfig) => {
2561
- const rules = [];
2562
- for (const entry of entries) {
2563
- const stateConfig = JSON.parse(entry.statesJson);
2564
- for (const [stateName, classes] of Object.entries(stateConfig)) {
2565
- rules.push({
2566
- selector: `.${entry.componentName}[data-state="${stateName}"]`,
2567
- declarations: classes,
2568
- cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
2569
- componentName: entry.componentName,
2570
- stateName
2571
- });
2572
- }
2566
+ generateStaticStateCss = (entries, resolvedCssOrThemeConfig) => {
2567
+ const native = getNativeBridge();
2568
+ if (!native?.generateStaticStateCss) {
2569
+ throw new Error("FATAL: Native binding 'generateStaticStateCss' is required but not available.");
2573
2570
  }
2574
- return rules;
2571
+ const resolvedCss = typeof resolvedCssOrThemeConfig === "string" ? resolvedCssOrThemeConfig : null;
2572
+ const inputs = entries.map((e) => ({
2573
+ tag: e.tag,
2574
+ componentName: e.componentName,
2575
+ statesJson: e.statesJson
2576
+ }));
2577
+ return native.generateStaticStateCss(inputs, resolvedCss);
2575
2578
  };
2576
2579
  extractAndGenerateStateCss = (source, filename) => {
2577
- const entries = extractTwStateConfigs(source, filename);
2578
- return generateStaticStateCss(entries);
2580
+ const native = getNativeBridge();
2581
+ if (!native?.extractAndGenerateStateCss) {
2582
+ const entries = extractTwStateConfigs(source, filename);
2583
+ return generateStaticStateCss(entries);
2584
+ }
2585
+ return native.extractAndGenerateStateCss(source, filename);
2579
2586
  };
2580
2587
  }
2581
2588
  });
@@ -2994,8 +3001,7 @@ function extractStaticStateCss(srcDir, options = {}) {
2994
3001
  cssBlocks.push(`/* state: ${rule.stateName} */`);
2995
3002
  const isUnresolved = rule.declarations.trim().length > 0 && !rule.declarations.includes(":");
2996
3003
  if (isUnresolved) {
2997
- const applyClasses = rule.declarations.trim().split(/\s+/).join(" ");
2998
- cssBlocks.push(`${rule.selector} { @apply ${applyClasses}; }`);
3004
+ cssBlocks.push(`/* SKIPPED (unresolved): ${rule.declarations} \u2014 akan di-inject runtime */`);
2999
3005
  } else {
3000
3006
  cssBlocks.push(rule.cssRule);
3001
3007
  }