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/vite.js CHANGED
@@ -3059,8 +3059,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3059
3059
  cssBlocks.push(`/* state: ${rule.stateName} */`);
3060
3060
  const isUnresolved = rule.declarations.trim().length > 0 && !rule.declarations.includes(":");
3061
3061
  if (isUnresolved) {
3062
- const applyClasses = rule.declarations.trim().split(/\s+/).join(" ");
3063
- cssBlocks.push(`${rule.selector} { @apply ${applyClasses}; }`);
3062
+ cssBlocks.push(`/* SKIPPED (unresolved): ${rule.declarations} \u2014 akan di-inject runtime */`);
3064
3063
  } else {
3065
3064
  cssBlocks.push(rule.cssRule);
3066
3065
  }
@@ -3796,7 +3795,13 @@ var init_src2 = __esm({
3796
3795
  const cssChunks = [];
3797
3796
  const stateRules = extractAndGenerateStateCss(source, filepath);
3798
3797
  if (stateRules.length > 0) {
3799
- cssChunks.push(stateRules.map((r) => r.cssRule).join("\n"));
3798
+ const resolvedRules = stateRules.filter((r) => {
3799
+ const decl = r.declarations.trim();
3800
+ return decl.length === 0 || decl.includes(":");
3801
+ });
3802
+ if (resolvedRules.length > 0) {
3803
+ cssChunks.push(resolvedRules.map((r) => r.cssRule).join("\n"));
3804
+ }
3800
3805
  }
3801
3806
  const containerCss = extractContainerCssFromSource(source);
3802
3807
  if (containerCss) cssChunks.push(containerCss);
@@ -3936,25 +3941,26 @@ ${source}`;
3936
3941
  }
3937
3942
  return native.extractTwStateConfigs(source, filename);
3938
3943
  };
3939
- generateStaticStateCss = (entries, _themeConfig) => {
3940
- const rules = [];
3941
- for (const entry of entries) {
3942
- const stateConfig = JSON.parse(entry.statesJson);
3943
- for (const [stateName, classes] of Object.entries(stateConfig)) {
3944
- rules.push({
3945
- selector: `.${entry.componentName}[data-state="${stateName}"]`,
3946
- declarations: classes,
3947
- cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
3948
- componentName: entry.componentName,
3949
- stateName
3950
- });
3951
- }
3944
+ generateStaticStateCss = (entries, resolvedCssOrThemeConfig) => {
3945
+ const native = getNativeBridge();
3946
+ if (!native?.generateStaticStateCss) {
3947
+ throw new Error("FATAL: Native binding 'generateStaticStateCss' is required but not available.");
3952
3948
  }
3953
- return rules;
3949
+ const resolvedCss = typeof resolvedCssOrThemeConfig === "string" ? resolvedCssOrThemeConfig : null;
3950
+ const inputs = entries.map((e) => ({
3951
+ tag: e.tag,
3952
+ componentName: e.componentName,
3953
+ statesJson: e.statesJson
3954
+ }));
3955
+ return native.generateStaticStateCss(inputs, resolvedCss);
3954
3956
  };
3955
3957
  extractAndGenerateStateCss = (source, filename) => {
3956
- const entries = extractTwStateConfigs(source, filename);
3957
- return generateStaticStateCss(entries);
3958
+ const native = getNativeBridge();
3959
+ if (!native?.extractAndGenerateStateCss) {
3960
+ const entries = extractTwStateConfigs(source, filename);
3961
+ return generateStaticStateCss(entries);
3962
+ }
3963
+ return native.extractAndGenerateStateCss(source, filename);
3958
3964
  };
3959
3965
  }
3960
3966
  });