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.js CHANGED
@@ -2434,7 +2434,13 @@ var init_src = __esm({
2434
2434
  const cssChunks = [];
2435
2435
  const stateRules = extractAndGenerateStateCss(source, filepath);
2436
2436
  if (stateRules.length > 0) {
2437
- cssChunks.push(stateRules.map((r) => r.cssRule).join("\n"));
2437
+ const resolvedRules = stateRules.filter((r) => {
2438
+ const decl = r.declarations.trim();
2439
+ return decl.length === 0 || decl.includes(":");
2440
+ });
2441
+ if (resolvedRules.length > 0) {
2442
+ cssChunks.push(resolvedRules.map((r) => r.cssRule).join("\n"));
2443
+ }
2438
2444
  }
2439
2445
  const containerCss = extractContainerCssFromSource(source);
2440
2446
  if (containerCss) cssChunks.push(containerCss);
@@ -2579,25 +2585,26 @@ ${source}`;
2579
2585
  }
2580
2586
  return native.extractTwStateConfigs(source, filename);
2581
2587
  };
2582
- generateStaticStateCss = (entries, _themeConfig) => {
2583
- const rules = [];
2584
- for (const entry of entries) {
2585
- const stateConfig = JSON.parse(entry.statesJson);
2586
- for (const [stateName, classes] of Object.entries(stateConfig)) {
2587
- rules.push({
2588
- selector: `.${entry.componentName}[data-state="${stateName}"]`,
2589
- declarations: classes,
2590
- cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
2591
- componentName: entry.componentName,
2592
- stateName
2593
- });
2594
- }
2588
+ generateStaticStateCss = (entries, resolvedCssOrThemeConfig) => {
2589
+ const native = getNativeBridge();
2590
+ if (!native?.generateStaticStateCss) {
2591
+ throw new Error("FATAL: Native binding 'generateStaticStateCss' is required but not available.");
2595
2592
  }
2596
- return rules;
2593
+ const resolvedCss = typeof resolvedCssOrThemeConfig === "string" ? resolvedCssOrThemeConfig : null;
2594
+ const inputs = entries.map((e) => ({
2595
+ tag: e.tag,
2596
+ componentName: e.componentName,
2597
+ statesJson: e.statesJson
2598
+ }));
2599
+ return native.generateStaticStateCss(inputs, resolvedCss);
2597
2600
  };
2598
2601
  extractAndGenerateStateCss = (source, filename) => {
2599
- const entries = extractTwStateConfigs(source, filename);
2600
- return generateStaticStateCss(entries);
2602
+ const native = getNativeBridge();
2603
+ if (!native?.extractAndGenerateStateCss) {
2604
+ const entries = extractTwStateConfigs(source, filename);
2605
+ return generateStaticStateCss(entries);
2606
+ }
2607
+ return native.extractAndGenerateStateCss(source, filename);
2601
2608
  };
2602
2609
  }
2603
2610
  });
@@ -3016,8 +3023,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3016
3023
  cssBlocks.push(`/* state: ${rule.stateName} */`);
3017
3024
  const isUnresolved = rule.declarations.trim().length > 0 && !rule.declarations.includes(":");
3018
3025
  if (isUnresolved) {
3019
- const applyClasses = rule.declarations.trim().split(/\s+/).join(" ");
3020
- cssBlocks.push(`${rule.selector} { @apply ${applyClasses}; }`);
3026
+ cssBlocks.push(`/* SKIPPED (unresolved): ${rule.declarations} \u2014 akan di-inject runtime */`);
3021
3027
  } else {
3022
3028
  cssBlocks.push(rule.cssRule);
3023
3029
  }