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