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.mjs CHANGED
@@ -3037,8 +3037,7 @@ function extractStaticStateCss(srcDir, options = {}) {
3037
3037
  cssBlocks.push(`/* state: ${rule.stateName} */`);
3038
3038
  const isUnresolved = rule.declarations.trim().length > 0 && !rule.declarations.includes(":");
3039
3039
  if (isUnresolved) {
3040
- const applyClasses = rule.declarations.trim().split(/\s+/).join(" ");
3041
- cssBlocks.push(`${rule.selector} { @apply ${applyClasses}; }`);
3040
+ cssBlocks.push(`/* SKIPPED (unresolved): ${rule.declarations} \u2014 akan di-inject runtime */`);
3042
3041
  } else {
3043
3042
  cssBlocks.push(rule.cssRule);
3044
3043
  }
@@ -3774,7 +3773,13 @@ var init_src2 = __esm({
3774
3773
  const cssChunks = [];
3775
3774
  const stateRules = extractAndGenerateStateCss(source, filepath);
3776
3775
  if (stateRules.length > 0) {
3777
- cssChunks.push(stateRules.map((r) => r.cssRule).join("\n"));
3776
+ const resolvedRules = stateRules.filter((r) => {
3777
+ const decl = r.declarations.trim();
3778
+ return decl.length === 0 || decl.includes(":");
3779
+ });
3780
+ if (resolvedRules.length > 0) {
3781
+ cssChunks.push(resolvedRules.map((r) => r.cssRule).join("\n"));
3782
+ }
3778
3783
  }
3779
3784
  const containerCss = extractContainerCssFromSource(source);
3780
3785
  if (containerCss) cssChunks.push(containerCss);
@@ -3914,25 +3919,26 @@ ${source}`;
3914
3919
  }
3915
3920
  return native.extractTwStateConfigs(source, filename);
3916
3921
  };
3917
- generateStaticStateCss = (entries, _themeConfig) => {
3918
- const rules = [];
3919
- for (const entry of entries) {
3920
- const stateConfig = JSON.parse(entry.statesJson);
3921
- for (const [stateName, classes] of Object.entries(stateConfig)) {
3922
- rules.push({
3923
- selector: `.${entry.componentName}[data-state="${stateName}"]`,
3924
- declarations: classes,
3925
- cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
3926
- componentName: entry.componentName,
3927
- stateName
3928
- });
3929
- }
3922
+ generateStaticStateCss = (entries, resolvedCssOrThemeConfig) => {
3923
+ const native = getNativeBridge();
3924
+ if (!native?.generateStaticStateCss) {
3925
+ throw new Error("FATAL: Native binding 'generateStaticStateCss' is required but not available.");
3930
3926
  }
3931
- return rules;
3927
+ const resolvedCss = typeof resolvedCssOrThemeConfig === "string" ? resolvedCssOrThemeConfig : null;
3928
+ const inputs = entries.map((e) => ({
3929
+ tag: e.tag,
3930
+ componentName: e.componentName,
3931
+ statesJson: e.statesJson
3932
+ }));
3933
+ return native.generateStaticStateCss(inputs, resolvedCss);
3932
3934
  };
3933
3935
  extractAndGenerateStateCss = (source, filename) => {
3934
- const entries = extractTwStateConfigs(source, filename);
3935
- return generateStaticStateCss(entries);
3936
+ const native = getNativeBridge();
3937
+ if (!native?.extractAndGenerateStateCss) {
3938
+ const entries = extractTwStateConfigs(source, filename);
3939
+ return generateStaticStateCss(entries);
3940
+ }
3941
+ return native.extractAndGenerateStateCss(source, filename);
3936
3942
  };
3937
3943
  }
3938
3944
  });