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