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/next.js CHANGED
@@ -2992,6 +2992,19 @@ function extractStaticStateCss(srcDir, options = {}) {
2992
2992
  const decl = r.declarations.trim();
2993
2993
  return decl.length === 0 || !decl.includes(":");
2994
2994
  }).length;
2995
+ function sanitizeCssRule(cssRule, declarations) {
2996
+ const segments = declarations.split(/[;\n]/).map((s) => s.trim()).filter(Boolean);
2997
+ const validSegs = segments.filter((s) => s.includes(":"));
2998
+ const invalidSegs = segments.filter((s) => !s.includes(":"));
2999
+ if (invalidSegs.length === 0) return cssRule;
3000
+ if (validSegs.length === 0) return null;
3001
+ const braceIdx = cssRule.indexOf("{");
3002
+ if (braceIdx === -1) return null;
3003
+ const selector = cssRule.slice(0, braceIdx).trim();
3004
+ return `${selector} {
3005
+ ${validSegs.join(";\n ")};
3006
+ }`;
3007
+ }
2995
3008
  const byComponent = /* @__PURE__ */ new Map();
2996
3009
  for (const rule of allRules) {
2997
3010
  const existing = byComponent.get(rule.componentName) ?? [];
@@ -3003,11 +3016,18 @@ function extractStaticStateCss(srcDir, options = {}) {
3003
3016
  cssBlocks.push(`/* ${componentName} */`);
3004
3017
  for (const rule of rules) {
3005
3018
  cssBlocks.push(`/* state: ${rule.stateName} */`);
3006
- const isUnresolved = rule.declarations.trim().length > 0 && !rule.declarations.includes(":");
3007
- if (isUnresolved) {
3008
- cssBlocks.push(`/* SKIPPED (unresolved): ${rule.declarations} \u2014 akan di-inject runtime */`);
3019
+ const isFullyUnresolved = rule.declarations.trim().length > 0 && !rule.declarations.includes(":");
3020
+ if (isFullyUnresolved) {
3021
+ const encoded = rule.declarations.replace(/([\w-]+)/g, "[$1]");
3022
+ cssBlocks.push(`/* SKIP [unresolved]: ${encoded} */`);
3009
3023
  } else {
3010
- cssBlocks.push(rule.cssRule);
3024
+ const sanitized = sanitizeCssRule(rule.cssRule, rule.declarations);
3025
+ if (sanitized !== null) {
3026
+ cssBlocks.push(sanitized);
3027
+ } else {
3028
+ const encoded = rule.declarations.replace(/([\w-]+)/g, "[$1]");
3029
+ cssBlocks.push(`/* SKIP [sanitized-empty]: ${encoded} */`);
3030
+ }
3011
3031
  }
3012
3032
  }
3013
3033
  cssBlocks.push("");