tailwind-styled-v4 5.0.22 → 5.0.23

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
@@ -3074,25 +3074,26 @@ ${source}`;
3074
3074
  }
3075
3075
  return native.extractTwStateConfigs(source, filename);
3076
3076
  };
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;
3077
+ generateStaticStateCss = (entries, resolvedCssOrThemeConfig) => {
3078
+ const native = getNativeBridge();
3079
+ if (!native?.generateStaticStateCss) {
3080
+ throw new Error("FATAL: Native binding 'generateStaticStateCss' is required but not available.");
3081
+ }
3082
+ const resolvedCss = typeof resolvedCssOrThemeConfig === "string" ? resolvedCssOrThemeConfig : null;
3083
+ const inputs = entries.map((e) => ({
3084
+ tag: e.tag,
3085
+ componentName: e.componentName,
3086
+ statesJson: e.statesJson
3087
+ }));
3088
+ return native.generateStaticStateCss(inputs, resolvedCss);
3092
3089
  };
3093
3090
  extractAndGenerateStateCss = (source, filename) => {
3094
- const entries = extractTwStateConfigs(source, filename);
3095
- return generateStaticStateCss(entries);
3091
+ const native = getNativeBridge();
3092
+ if (!native?.extractAndGenerateStateCss) {
3093
+ const entries = extractTwStateConfigs(source, filename);
3094
+ return generateStaticStateCss(entries);
3095
+ }
3096
+ return native.extractAndGenerateStateCss(source, filename);
3096
3097
  };
3097
3098
  }
3098
3099
  });
@@ -3511,8 +3512,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3511
3512
  cssBlocks.push(`/* state: ${rule.stateName} */`);
3512
3513
  const isUnresolved = rule.declarations.trim().length > 0 && !rule.declarations.includes(":");
3513
3514
  if (isUnresolved) {
3514
- const applyClasses = rule.declarations.trim().split(/\s+/).join(" ");
3515
- cssBlocks.push(`${rule.selector} { @apply ${applyClasses}; }`);
3515
+ cssBlocks.push(`/* SKIPPED (unresolved): ${rule.declarations} \u2014 akan di-inject runtime */`);
3516
3516
  } else {
3517
3517
  cssBlocks.push(rule.cssRule);
3518
3518
  }