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