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.js CHANGED
@@ -2960,7 +2960,13 @@ var init_src = __esm({
2960
2960
  const cssChunks = [];
2961
2961
  const stateRules = extractAndGenerateStateCss(source, filepath);
2962
2962
  if (stateRules.length > 0) {
2963
- cssChunks.push(stateRules.map((r) => r.cssRule).join("\n"));
2963
+ const resolvedRules = stateRules.filter((r) => {
2964
+ const decl = r.declarations.trim();
2965
+ return decl.length === 0 || decl.includes(":");
2966
+ });
2967
+ if (resolvedRules.length > 0) {
2968
+ cssChunks.push(resolvedRules.map((r) => r.cssRule).join("\n"));
2969
+ }
2964
2970
  }
2965
2971
  const containerCss = extractContainerCssFromSource(source);
2966
2972
  if (containerCss) cssChunks.push(containerCss);
@@ -3100,25 +3106,26 @@ ${source}`;
3100
3106
  }
3101
3107
  return native.extractTwStateConfigs(source, filename);
3102
3108
  };
3103
- generateStaticStateCss = (entries, _themeConfig) => {
3104
- const rules = [];
3105
- for (const entry of entries) {
3106
- const stateConfig = JSON.parse(entry.statesJson);
3107
- for (const [stateName, classes] of Object.entries(stateConfig)) {
3108
- rules.push({
3109
- selector: `.${entry.componentName}[data-state="${stateName}"]`,
3110
- declarations: classes,
3111
- cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
3112
- componentName: entry.componentName,
3113
- stateName
3114
- });
3115
- }
3109
+ generateStaticStateCss = (entries, resolvedCssOrThemeConfig) => {
3110
+ const native = getNativeBridge();
3111
+ if (!native?.generateStaticStateCss) {
3112
+ throw new Error("FATAL: Native binding 'generateStaticStateCss' is required but not available.");
3116
3113
  }
3117
- return rules;
3114
+ const resolvedCss = typeof resolvedCssOrThemeConfig === "string" ? resolvedCssOrThemeConfig : null;
3115
+ const inputs = entries.map((e) => ({
3116
+ tag: e.tag,
3117
+ componentName: e.componentName,
3118
+ statesJson: e.statesJson
3119
+ }));
3120
+ return native.generateStaticStateCss(inputs, resolvedCss);
3118
3121
  };
3119
3122
  extractAndGenerateStateCss = (source, filename) => {
3120
- const entries = extractTwStateConfigs(source, filename);
3121
- return generateStaticStateCss(entries);
3123
+ const native = getNativeBridge();
3124
+ if (!native?.extractAndGenerateStateCss) {
3125
+ const entries = extractTwStateConfigs(source, filename);
3126
+ return generateStaticStateCss(entries);
3127
+ }
3128
+ return native.extractAndGenerateStateCss(source, filename);
3122
3129
  };
3123
3130
  }
3124
3131
  });
@@ -3537,8 +3544,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3537
3544
  cssBlocks.push(`/* state: ${rule.stateName} */`);
3538
3545
  const isUnresolved = rule.declarations.trim().length > 0 && !rule.declarations.includes(":");
3539
3546
  if (isUnresolved) {
3540
- const applyClasses = rule.declarations.trim().split(/\s+/).join(" ");
3541
- cssBlocks.push(`${rule.selector} { @apply ${applyClasses}; }`);
3547
+ cssBlocks.push(`/* SKIPPED (unresolved): ${rule.declarations} \u2014 akan di-inject runtime */`);
3542
3548
  } else {
3543
3549
  cssBlocks.push(rule.cssRule);
3544
3550
  }