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/index.mjs CHANGED
@@ -2935,7 +2935,13 @@ var init_src = __esm({
2935
2935
  const cssChunks = [];
2936
2936
  const stateRules = extractAndGenerateStateCss(source, filepath);
2937
2937
  if (stateRules.length > 0) {
2938
- cssChunks.push(stateRules.map((r) => r.cssRule).join("\n"));
2938
+ const resolvedRules = stateRules.filter((r) => {
2939
+ const decl = r.declarations.trim();
2940
+ return decl.length === 0 || decl.includes(":");
2941
+ });
2942
+ if (resolvedRules.length > 0) {
2943
+ cssChunks.push(resolvedRules.map((r) => r.cssRule).join("\n"));
2944
+ }
2939
2945
  }
2940
2946
  const containerCss = extractContainerCssFromSource(source);
2941
2947
  if (containerCss) cssChunks.push(containerCss);
@@ -3075,25 +3081,26 @@ ${source}`;
3075
3081
  }
3076
3082
  return native.extractTwStateConfigs(source, filename);
3077
3083
  };
3078
- generateStaticStateCss = (entries, _themeConfig) => {
3079
- const rules = [];
3080
- for (const entry of entries) {
3081
- const stateConfig = JSON.parse(entry.statesJson);
3082
- for (const [stateName, classes] of Object.entries(stateConfig)) {
3083
- rules.push({
3084
- selector: `.${entry.componentName}[data-state="${stateName}"]`,
3085
- declarations: classes,
3086
- cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
3087
- componentName: entry.componentName,
3088
- stateName
3089
- });
3090
- }
3084
+ generateStaticStateCss = (entries, resolvedCssOrThemeConfig) => {
3085
+ const native = getNativeBridge();
3086
+ if (!native?.generateStaticStateCss) {
3087
+ throw new Error("FATAL: Native binding 'generateStaticStateCss' is required but not available.");
3091
3088
  }
3092
- return rules;
3089
+ const resolvedCss = typeof resolvedCssOrThemeConfig === "string" ? resolvedCssOrThemeConfig : null;
3090
+ const inputs = entries.map((e) => ({
3091
+ tag: e.tag,
3092
+ componentName: e.componentName,
3093
+ statesJson: e.statesJson
3094
+ }));
3095
+ return native.generateStaticStateCss(inputs, resolvedCss);
3093
3096
  };
3094
3097
  extractAndGenerateStateCss = (source, filename) => {
3095
- const entries = extractTwStateConfigs(source, filename);
3096
- return generateStaticStateCss(entries);
3098
+ const native = getNativeBridge();
3099
+ if (!native?.extractAndGenerateStateCss) {
3100
+ const entries = extractTwStateConfigs(source, filename);
3101
+ return generateStaticStateCss(entries);
3102
+ }
3103
+ return native.extractAndGenerateStateCss(source, filename);
3097
3104
  };
3098
3105
  }
3099
3106
  });
@@ -3512,8 +3519,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3512
3519
  cssBlocks.push(`/* state: ${rule.stateName} */`);
3513
3520
  const isUnresolved = rule.declarations.trim().length > 0 && !rule.declarations.includes(":");
3514
3521
  if (isUnresolved) {
3515
- const applyClasses = rule.declarations.trim().split(/\s+/).join(" ");
3516
- cssBlocks.push(`${rule.selector} { @apply ${applyClasses}; }`);
3522
+ cssBlocks.push(`/* SKIPPED (unresolved): ${rule.declarations} \u2014 akan di-inject runtime */`);
3517
3523
  } else {
3518
3524
  cssBlocks.push(rule.cssRule);
3519
3525
  }