{"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils/css.ts"],"sourcesContent":["// CSS-record → inline-style serializer.\n//\n// Companion to the `*ToCss` style helpers (fontToCss / fillToCss /\n// borderToCss / alignmentToCss / cellStyleToCss): once a caller has\n// merged the partials into a `Record<string, string>`, this turns it\n// into a stable `style=\"…\"` attribute value for HTML preview.\n\n/**\n * Serialize a CSS-property record to an inline-style declaration string\n * (`prop1: val1; prop2: val2`). Properties are alphabetised so the\n * output is deterministic across runs.\n *\n * - Empty record returns `''`.\n * - Empty-string values are skipped (treat as \"unset\").\n * - Values containing `;` are dropped — they would terminate the\n *   declaration early and risk attribute-injection in `style=\"…\"`\n *   contexts. Callers should pre-escape user data; this is a\n *   defensive last line.\n *\n * The returned string is suitable for direct interpolation into an\n * HTML `style=\"…\"` attribute *after* the usual attribute-value HTML\n * escaping (no `&` / `\"` injection here — this only guards against\n * stray semicolons).\n */\nexport function cssRecordToInlineStyle(record: Record<string, string> | undefined): string {\n  if (!record) return '';\n  const parts: string[] = [];\n  for (const key of Object.keys(record).sort()) {\n    const value = record[key];\n    if (value === undefined || value === '') continue;\n    if (value.includes(';')) continue;\n    parts.push(`${key}: ${value}`);\n  }\n  return parts.join('; ');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,uBAAuB,QAAoD;CACzF,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM,QAAkB,CAAC;CACzB,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,CAAC,CAAC,KAAK,GAAG;EAC5C,MAAM,QAAQ,OAAO;EACrB,IAAI,UAAU,KAAA,KAAa,UAAU,IAAI;EACzC,IAAI,MAAM,SAAS,GAAG,GAAG;EACzB,MAAM,KAAK,GAAG,IAAI,IAAI,OAAO;CAC/B;CACA,OAAO,MAAM,KAAK,IAAI;AACxB"}