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.mjs CHANGED
@@ -2970,6 +2970,19 @@ function extractStaticStateCss(srcDir, options = {}) {
2970
2970
  const decl = r.declarations.trim();
2971
2971
  return decl.length === 0 || !decl.includes(":");
2972
2972
  }).length;
2973
+ function sanitizeCssRule(cssRule, declarations) {
2974
+ const segments = declarations.split(/[;\n]/).map((s) => s.trim()).filter(Boolean);
2975
+ const validSegs = segments.filter((s) => s.includes(":"));
2976
+ const invalidSegs = segments.filter((s) => !s.includes(":"));
2977
+ if (invalidSegs.length === 0) return cssRule;
2978
+ if (validSegs.length === 0) return null;
2979
+ const braceIdx = cssRule.indexOf("{");
2980
+ if (braceIdx === -1) return null;
2981
+ const selector = cssRule.slice(0, braceIdx).trim();
2982
+ return `${selector} {
2983
+ ${validSegs.join(";\n ")};
2984
+ }`;
2985
+ }
2973
2986
  const byComponent = /* @__PURE__ */ new Map();
2974
2987
  for (const rule of allRules) {
2975
2988
  const existing = byComponent.get(rule.componentName) ?? [];
@@ -2981,11 +2994,18 @@ function extractStaticStateCss(srcDir, options = {}) {
2981
2994
  cssBlocks.push(`/* ${componentName} */`);
2982
2995
  for (const rule of rules) {
2983
2996
  cssBlocks.push(`/* state: ${rule.stateName} */`);
2984
- const isUnresolved = rule.declarations.trim().length > 0 && !rule.declarations.includes(":");
2985
- if (isUnresolved) {
2986
- cssBlocks.push(`/* SKIPPED (unresolved): ${rule.declarations} \u2014 akan di-inject runtime */`);
2997
+ const isFullyUnresolved = rule.declarations.trim().length > 0 && !rule.declarations.includes(":");
2998
+ if (isFullyUnresolved) {
2999
+ const encoded = rule.declarations.replace(/([\w-]+)/g, "[$1]");
3000
+ cssBlocks.push(`/* SKIP [unresolved]: ${encoded} */`);
2987
3001
  } else {
2988
- cssBlocks.push(rule.cssRule);
3002
+ const sanitized = sanitizeCssRule(rule.cssRule, rule.declarations);
3003
+ if (sanitized !== null) {
3004
+ cssBlocks.push(sanitized);
3005
+ } else {
3006
+ const encoded = rule.declarations.replace(/([\w-]+)/g, "[$1]");
3007
+ cssBlocks.push(`/* SKIP [sanitized-empty]: ${encoded} */`);
3008
+ }
2989
3009
  }
2990
3010
  }
2991
3011
  cssBlocks.push("");