tailwind-styled-v4 5.0.26 → 5.0.27

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
@@ -3005,6 +3005,19 @@ function extractStaticStateCss(srcDir, options = {}) {
3005
3005
  const decl = r.declarations.trim();
3006
3006
  return decl.length === 0 || !decl.includes(":");
3007
3007
  }).length;
3008
+ function sanitizeCssRule(cssRule, declarations) {
3009
+ const segments = declarations.split(/[;\n]/).map((s) => s.trim()).filter(Boolean);
3010
+ const validSegs = segments.filter((s) => s.includes(":"));
3011
+ const invalidSegs = segments.filter((s) => !s.includes(":"));
3012
+ if (invalidSegs.length === 0) return cssRule;
3013
+ if (validSegs.length === 0) return null;
3014
+ const braceIdx = cssRule.indexOf("{");
3015
+ if (braceIdx === -1) return null;
3016
+ const selector = cssRule.slice(0, braceIdx).trim();
3017
+ return `${selector} {
3018
+ ${validSegs.join(";\n ")};
3019
+ }`;
3020
+ }
3008
3021
  const byComponent = /* @__PURE__ */ new Map();
3009
3022
  for (const rule of allRules) {
3010
3023
  const existing = byComponent.get(rule.componentName) ?? [];
@@ -3016,11 +3029,18 @@ function extractStaticStateCss(srcDir, options = {}) {
3016
3029
  cssBlocks.push(`/* ${componentName} */`);
3017
3030
  for (const rule of rules) {
3018
3031
  cssBlocks.push(`/* state: ${rule.stateName} */`);
3019
- const isUnresolved = rule.declarations.trim().length > 0 && !rule.declarations.includes(":");
3020
- if (isUnresolved) {
3021
- cssBlocks.push(`/* SKIPPED (unresolved): ${rule.declarations} \u2014 akan di-inject runtime */`);
3032
+ const isFullyUnresolved = rule.declarations.trim().length > 0 && !rule.declarations.includes(":");
3033
+ if (isFullyUnresolved) {
3034
+ const encoded = rule.declarations.replace(/([\w-]+)/g, "[$1]");
3035
+ cssBlocks.push(`/* SKIP [unresolved]: ${encoded} */`);
3022
3036
  } else {
3023
- cssBlocks.push(rule.cssRule);
3037
+ const sanitized = sanitizeCssRule(rule.cssRule, rule.declarations);
3038
+ if (sanitized !== null) {
3039
+ cssBlocks.push(sanitized);
3040
+ } else {
3041
+ const encoded = rule.declarations.replace(/([\w-]+)/g, "[$1]");
3042
+ cssBlocks.push(`/* SKIP [sanitized-empty]: ${encoded} */`);
3043
+ }
3024
3044
  }
3025
3045
  }
3026
3046
  cssBlocks.push("");