@jasonshimmy/custom-elements-runtime 2.2.5 → 2.2.6

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./namespace-helpers-DwMMXN9Q.cjs");function s(r,c){if(typeof r=="string")return i.escapeHTML(r);if(r.tag==="#text")return typeof r.children=="string"?i.escapeHTML(r.children):"";if(r.tag==="#anchor")return(Array.isArray(r.children)?r.children.filter(n=>n!=null):[]).map(n=>s(n,c)).join("");if(r.tag==="#raw")return typeof r.children=="string"?r.children:"";let e={};r.props&&r.props.attrs&&(e={...r.props.attrs});const a=c?.injectSvgNamespace??!0,l=c?.injectKnownNamespaces??a;a&&r.tag==="svg"&&!("xmlns"in e)?e.xmlns=i.SVG_NS:l&&r.tag in i.TAG_NAMESPACE_MAP&&!("xmlns"in e)&&(e.xmlns=i.TAG_NAMESPACE_MAP[r.tag]);const g=Object.entries(e).map(([t,n])=>` ${t}="${i.escapeHTML(String(n))}"`).join(""),p=Array.isArray(r.children)?r.children.filter(t=>t!=null).map(t=>s(t,c)).join(""):typeof r.children=="string"?i.escapeHTML(r.children):r.children?s(r.children):"";return`<${r.tag}${g}>${p}</${r.tag}>`}exports.renderToString=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./namespace-helpers-DwMMXN9Q.cjs"),h=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function c(r,n){if(typeof r=="string")return i.escapeHTML(r);if(r.tag==="#text")return typeof r.children=="string"?i.escapeHTML(r.children):"";if(r.tag==="#anchor")return(Array.isArray(r.children)?r.children.filter(a=>a!=null):[]).map(a=>c(a,n)).join("");if(r.tag==="#raw")return typeof r.children=="string"?r.children:"";let e={};r.props&&r.props.attrs&&(e={...r.props.attrs});const s=n?.injectSvgNamespace??!0,g=n?.injectKnownNamespaces??s;s&&r.tag==="svg"&&!("xmlns"in e)?e.xmlns=i.SVG_NS:g&&r.tag in i.TAG_NAMESPACE_MAP&&!("xmlns"in e)&&(e.xmlns=i.TAG_NAMESPACE_MAP[r.tag]);const l=Object.entries(e).map(([t,a])=>` ${t}="${i.escapeHTML(String(a))}"`).join("");if(h.has(r.tag))return`<${r.tag}${l}>`;const p=Array.isArray(r.children)?r.children.filter(t=>t!=null).map(t=>c(t,n)).join(""):typeof r.children=="string"?i.escapeHTML(r.children):r.children?c(r.children,n):"";return`<${r.tag}${l}>${p}</${r.tag}>`}exports.renderToString=c;
2
2
  //# sourceMappingURL=custom-elements-runtime.ssr.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-elements-runtime.ssr.cjs.js","sources":["../src/lib/runtime/vdom-ssr.ts"],"sourcesContent":["import type { VNode } from './types';\nimport { escapeHTML } from './helpers';\nimport { TAG_NAMESPACE_MAP, SVG_NS } from './namespace-helpers';\n\n/**\n * Render a VNode to a string (SSR).\n * Kept intentionally minimal: only serializes attributes under `props.attrs`\n * to avoid leaking runtime-only values (functions, reactive state, directives).\n * @param vnode The virtual node to render.\n * @returns The rendered HTML string.\n */\nexport type RenderOptions = {\n /** Backwards-compatible: whether to inject the SVG namespace on <svg> nodes (default true) */\n injectSvgNamespace?: boolean;\n /** Inject known well-known namespaces for tags like <math> when missing (default follows injectSvgNamespace) */\n injectKnownNamespaces?: boolean;\n};\n\nexport function renderToString(vnode: VNode, opts?: RenderOptions): string {\n if (typeof vnode === 'string') return escapeHTML(vnode) as string;\n\n if (vnode.tag === '#text') {\n return typeof vnode.children === 'string'\n ? (escapeHTML(vnode.children) as string)\n : '';\n }\n\n if (vnode.tag === '#anchor') {\n // Preserve meaningful falsy children (0, false, '') while filtering out\n // only null and undefined. Anchor blocks are normalized by the compiler\n // to exclude null/undefined; SSR should follow the same rule to avoid\n // hydration mismatches where falsy values are significant.\n const children = Array.isArray(vnode.children)\n ? vnode.children.filter((c) => c !== null && c !== undefined)\n : [];\n return children.map((c) => renderToString(c, opts)).join('');\n }\n\n if (vnode.tag === '#raw') {\n return typeof vnode.children === 'string' ? vnode.children : '';\n }\n\n // Collect attributes from props.attrs. For SSR we mirror vnode.attrs\n // but ensure SVG nodes behave like client-side: if this is an <svg>\n // and no xmlns was provided, inject the standard SVG namespace so\n // server markup matches client-created DOM namespace.\n let attrsObj: Record<string, unknown> = {};\n if (vnode.props && vnode.props.attrs) {\n attrsObj = { ...vnode.props.attrs };\n }\n\n const inject = opts?.injectSvgNamespace ?? true;\n const injectKnown = opts?.injectKnownNamespaces ?? inject;\n\n // Inject namespace for well-known tags when missing. By default we\n // preserve previous behavior (SVG injected) and also allow injecting\n // other known namespaces (MathML) when injectKnownNamespaces is true.\n if (inject && vnode.tag === 'svg' && !('xmlns' in attrsObj)) {\n attrsObj.xmlns = SVG_NS;\n } else if (\n injectKnown &&\n vnode.tag in TAG_NAMESPACE_MAP &&\n !('xmlns' in attrsObj)\n ) {\n attrsObj.xmlns = TAG_NAMESPACE_MAP[vnode.tag];\n }\n\n const attrsString = Object.entries(attrsObj)\n .map(([k, v]) => ` ${k}=\"${escapeHTML(String(v))}\"`)\n .join('');\n\n const children = Array.isArray(vnode.children)\n ? vnode.children\n .filter((c) => c !== null && c !== undefined)\n .map((c) => renderToString(c, opts))\n .join('')\n : typeof vnode.children === 'string'\n ? escapeHTML(vnode.children)\n : vnode.children\n ? renderToString(vnode.children)\n : '';\n\n return `<${vnode.tag}${attrsString}>${children}</${vnode.tag}>`;\n}\n"],"names":["renderToString","vnode","opts","escapeHTML","c","attrsObj","inject","injectKnown","SVG_NS","TAG_NAMESPACE_MAP","attrsString","k","v","children"],"mappings":"oIAkBO,SAASA,EAAeC,EAAcC,EAA8B,CACzE,GAAI,OAAOD,GAAU,SAAU,OAAOE,EAAAA,WAAWF,CAAK,EAEtD,GAAIA,EAAM,MAAQ,QAChB,OAAO,OAAOA,EAAM,UAAa,SAC5BE,EAAAA,WAAWF,EAAM,QAAQ,EAC1B,GAGN,GAAIA,EAAM,MAAQ,UAQhB,OAHiB,MAAM,QAAQA,EAAM,QAAQ,EACzCA,EAAM,SAAS,OAAQG,GAAMA,GAAM,IAAuB,EAC1D,CAAA,GACY,IAAKA,GAAMJ,EAAeI,EAAGF,CAAI,CAAC,EAAE,KAAK,EAAE,EAG7D,GAAID,EAAM,MAAQ,OAChB,OAAO,OAAOA,EAAM,UAAa,SAAWA,EAAM,SAAW,GAO/D,IAAII,EAAoC,CAAA,EACpCJ,EAAM,OAASA,EAAM,MAAM,QAC7BI,EAAW,CAAE,GAAGJ,EAAM,MAAM,KAAA,GAG9B,MAAMK,EAASJ,GAAM,oBAAsB,GACrCK,EAAcL,GAAM,uBAAyBI,EAK/CA,GAAUL,EAAM,MAAQ,OAAS,EAAE,UAAWI,GAChDA,EAAS,MAAQG,EAAAA,OAEjBD,GACAN,EAAM,OAAOQ,EAAAA,mBACb,EAAE,UAAWJ,KAEbA,EAAS,MAAQI,oBAAkBR,EAAM,GAAG,GAG9C,MAAMS,EAAc,OAAO,QAAQL,CAAQ,EACxC,IAAI,CAAC,CAACM,EAAGC,CAAC,IAAM,IAAID,CAAC,KAAKR,EAAAA,WAAW,OAAOS,CAAC,CAAC,CAAC,GAAG,EAClD,KAAK,EAAE,EAEJC,EAAW,MAAM,QAAQZ,EAAM,QAAQ,EACzCA,EAAM,SACH,OAAQG,GAAMA,GAAM,IAAuB,EAC3C,IAAKA,GAAMJ,EAAeI,EAAGF,CAAI,CAAC,EAClC,KAAK,EAAE,EACV,OAAOD,EAAM,UAAa,SACxBE,EAAAA,WAAWF,EAAM,QAAQ,EACzBA,EAAM,SACJD,EAAeC,EAAM,QAAQ,EAC7B,GAER,MAAO,IAAIA,EAAM,GAAG,GAAGS,CAAW,IAAIG,CAAQ,KAAKZ,EAAM,GAAG,GAC9D"}
1
+ {"version":3,"file":"custom-elements-runtime.ssr.cjs.js","sources":["../src/lib/runtime/vdom-ssr.ts"],"sourcesContent":["import type { VNode } from './types';\nimport { escapeHTML } from './helpers';\nimport { TAG_NAMESPACE_MAP, SVG_NS } from './namespace-helpers';\n\n/**\n * Render a VNode to a string (SSR).\n * Kept intentionally minimal: only serializes attributes under `props.attrs`\n * to avoid leaking runtime-only values (functions, reactive state, directives).\n * @param vnode The virtual node to render.\n * @returns The rendered HTML string.\n */\nexport type RenderOptions = {\n /** Backwards-compatible: whether to inject the SVG namespace on <svg> nodes (default true) */\n injectSvgNamespace?: boolean;\n /** Inject known well-known namespaces for tags like <math> when missing (default follows injectSvgNamespace) */\n injectKnownNamespaces?: boolean;\n};\n\n// HTML void elements that should be self-closing\nconst VOID_ELEMENTS = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n]);\n\nexport function renderToString(vnode: VNode, opts?: RenderOptions): string {\n if (typeof vnode === 'string') return escapeHTML(vnode) as string;\n\n if (vnode.tag === '#text') {\n return typeof vnode.children === 'string'\n ? (escapeHTML(vnode.children) as string)\n : '';\n }\n\n if (vnode.tag === '#anchor') {\n // Preserve meaningful falsy children (0, false, '') while filtering out\n // only null and undefined. Anchor blocks are normalized by the compiler\n // to exclude null/undefined; SSR should follow the same rule to avoid\n // hydration mismatches where falsy values are significant.\n const children = Array.isArray(vnode.children)\n ? vnode.children.filter((c) => c !== null && c !== undefined)\n : [];\n return children.map((c) => renderToString(c, opts)).join('');\n }\n\n if (vnode.tag === '#raw') {\n return typeof vnode.children === 'string' ? vnode.children : '';\n }\n\n // Collect attributes from props.attrs. For SSR we mirror vnode.attrs\n // but ensure SVG nodes behave like client-side: if this is an <svg>\n // and no xmlns was provided, inject the standard SVG namespace so\n // server markup matches client-created DOM namespace.\n let attrsObj: Record<string, unknown> = {};\n if (vnode.props && vnode.props.attrs) {\n attrsObj = { ...vnode.props.attrs };\n }\n\n const inject = opts?.injectSvgNamespace ?? true;\n const injectKnown = opts?.injectKnownNamespaces ?? inject;\n\n // Inject namespace for well-known tags when missing. By default we\n // preserve previous behavior (SVG injected) and also allow injecting\n // other known namespaces (MathML) when injectKnownNamespaces is true.\n if (inject && vnode.tag === 'svg' && !('xmlns' in attrsObj)) {\n attrsObj.xmlns = SVG_NS;\n } else if (\n injectKnown &&\n vnode.tag in TAG_NAMESPACE_MAP &&\n !('xmlns' in attrsObj)\n ) {\n attrsObj.xmlns = TAG_NAMESPACE_MAP[vnode.tag];\n }\n\n const attrsString = Object.entries(attrsObj)\n .map(([k, v]) => ` ${k}=\"${escapeHTML(String(v))}\"`)\n .join('');\n\n // Handle void elements (self-closing tags)\n if (VOID_ELEMENTS.has(vnode.tag)) {\n return `<${vnode.tag}${attrsString}>`;\n }\n\n const children = Array.isArray(vnode.children)\n ? vnode.children\n .filter((c) => c !== null && c !== undefined)\n .map((c) => renderToString(c, opts))\n .join('')\n : typeof vnode.children === 'string'\n ? escapeHTML(vnode.children)\n : vnode.children\n ? renderToString(vnode.children, opts)\n : '';\n\n return `<${vnode.tag}${attrsString}>${children}</${vnode.tag}>`;\n}\n"],"names":["VOID_ELEMENTS","renderToString","vnode","opts","escapeHTML","c","attrsObj","inject","injectKnown","SVG_NS","TAG_NAMESPACE_MAP","attrsString","k","v","children"],"mappings":"oIAmBMA,MAAoB,IAAI,CAC5B,OACA,OACA,KACA,MACA,QACA,KACA,MACA,QACA,OACA,OACA,QACA,SACA,QACA,KACF,CAAC,EAEM,SAASC,EAAeC,EAAcC,EAA8B,CACzE,GAAI,OAAOD,GAAU,SAAU,OAAOE,EAAAA,WAAWF,CAAK,EAEtD,GAAIA,EAAM,MAAQ,QAChB,OAAO,OAAOA,EAAM,UAAa,SAC5BE,EAAAA,WAAWF,EAAM,QAAQ,EAC1B,GAGN,GAAIA,EAAM,MAAQ,UAQhB,OAHiB,MAAM,QAAQA,EAAM,QAAQ,EACzCA,EAAM,SAAS,OAAQG,GAAMA,GAAM,IAAuB,EAC1D,CAAA,GACY,IAAKA,GAAMJ,EAAeI,EAAGF,CAAI,CAAC,EAAE,KAAK,EAAE,EAG7D,GAAID,EAAM,MAAQ,OAChB,OAAO,OAAOA,EAAM,UAAa,SAAWA,EAAM,SAAW,GAO/D,IAAII,EAAoC,CAAA,EACpCJ,EAAM,OAASA,EAAM,MAAM,QAC7BI,EAAW,CAAE,GAAGJ,EAAM,MAAM,KAAA,GAG9B,MAAMK,EAASJ,GAAM,oBAAsB,GACrCK,EAAcL,GAAM,uBAAyBI,EAK/CA,GAAUL,EAAM,MAAQ,OAAS,EAAE,UAAWI,GAChDA,EAAS,MAAQG,EAAAA,OAEjBD,GACAN,EAAM,OAAOQ,EAAAA,mBACb,EAAE,UAAWJ,KAEbA,EAAS,MAAQI,oBAAkBR,EAAM,GAAG,GAG9C,MAAMS,EAAc,OAAO,QAAQL,CAAQ,EACxC,IAAI,CAAC,CAACM,EAAGC,CAAC,IAAM,IAAID,CAAC,KAAKR,EAAAA,WAAW,OAAOS,CAAC,CAAC,CAAC,GAAG,EAClD,KAAK,EAAE,EAGV,GAAIb,EAAc,IAAIE,EAAM,GAAG,EAC7B,MAAO,IAAIA,EAAM,GAAG,GAAGS,CAAW,IAGpC,MAAMG,EAAW,MAAM,QAAQZ,EAAM,QAAQ,EACzCA,EAAM,SACH,OAAQG,GAAMA,GAAM,IAAuB,EAC3C,IAAKA,GAAMJ,EAAeI,EAAGF,CAAI,CAAC,EAClC,KAAK,EAAE,EACV,OAAOD,EAAM,UAAa,SACxBE,EAAAA,WAAWF,EAAM,QAAQ,EACzBA,EAAM,SACJD,EAAeC,EAAM,SAAUC,CAAI,EACnC,GAER,MAAO,IAAID,EAAM,GAAG,GAAGS,CAAW,IAAIG,CAAQ,KAAKZ,EAAM,GAAG,GAC9D"}
@@ -1,20 +1,39 @@
1
- import { e as s, S as p, T as e } from "./namespace-helpers-Vwt2Fzds.js";
2
- function c(r, a) {
3
- if (typeof r == "string") return s(r);
1
+ import { e as c, S as p, T as g } from "./namespace-helpers-Vwt2Fzds.js";
2
+ const m = /* @__PURE__ */ new Set([
3
+ "area",
4
+ "base",
5
+ "br",
6
+ "col",
7
+ "embed",
8
+ "hr",
9
+ "img",
10
+ "input",
11
+ "link",
12
+ "meta",
13
+ "param",
14
+ "source",
15
+ "track",
16
+ "wbr"
17
+ ]);
18
+ function s(r, n) {
19
+ if (typeof r == "string") return c(r);
4
20
  if (r.tag === "#text")
5
- return typeof r.children == "string" ? s(r.children) : "";
21
+ return typeof r.children == "string" ? c(r.children) : "";
6
22
  if (r.tag === "#anchor")
7
- return (Array.isArray(r.children) ? r.children.filter((n) => n != null) : []).map((n) => c(n, a)).join("");
23
+ return (Array.isArray(r.children) ? r.children.filter((a) => a != null) : []).map((a) => s(a, n)).join("");
8
24
  if (r.tag === "#raw")
9
25
  return typeof r.children == "string" ? r.children : "";
10
26
  let i = {};
11
27
  r.props && r.props.attrs && (i = { ...r.props.attrs });
12
- const l = a?.injectSvgNamespace ?? !0, g = a?.injectKnownNamespaces ?? l;
13
- l && r.tag === "svg" && !("xmlns" in i) ? i.xmlns = p : g && r.tag in e && !("xmlns" in i) && (i.xmlns = e[r.tag]);
14
- const h = Object.entries(i).map(([t, n]) => ` ${t}="${s(String(n))}"`).join(""), f = Array.isArray(r.children) ? r.children.filter((t) => t != null).map((t) => c(t, a)).join("") : typeof r.children == "string" ? s(r.children) : r.children ? c(r.children) : "";
15
- return `<${r.tag}${h}>${f}</${r.tag}>`;
28
+ const e = n?.injectSvgNamespace ?? !0, h = n?.injectKnownNamespaces ?? e;
29
+ e && r.tag === "svg" && !("xmlns" in i) ? i.xmlns = p : h && r.tag in g && !("xmlns" in i) && (i.xmlns = g[r.tag]);
30
+ const l = Object.entries(i).map(([t, a]) => ` ${t}="${c(String(a))}"`).join("");
31
+ if (m.has(r.tag))
32
+ return `<${r.tag}${l}>`;
33
+ const f = Array.isArray(r.children) ? r.children.filter((t) => t != null).map((t) => s(t, n)).join("") : typeof r.children == "string" ? c(r.children) : r.children ? s(r.children, n) : "";
34
+ return `<${r.tag}${l}>${f}</${r.tag}>`;
16
35
  }
17
36
  export {
18
- c as renderToString
37
+ s as renderToString
19
38
  };
20
39
  //# sourceMappingURL=custom-elements-runtime.ssr.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-elements-runtime.ssr.es.js","sources":["../src/lib/runtime/vdom-ssr.ts"],"sourcesContent":["import type { VNode } from './types';\nimport { escapeHTML } from './helpers';\nimport { TAG_NAMESPACE_MAP, SVG_NS } from './namespace-helpers';\n\n/**\n * Render a VNode to a string (SSR).\n * Kept intentionally minimal: only serializes attributes under `props.attrs`\n * to avoid leaking runtime-only values (functions, reactive state, directives).\n * @param vnode The virtual node to render.\n * @returns The rendered HTML string.\n */\nexport type RenderOptions = {\n /** Backwards-compatible: whether to inject the SVG namespace on <svg> nodes (default true) */\n injectSvgNamespace?: boolean;\n /** Inject known well-known namespaces for tags like <math> when missing (default follows injectSvgNamespace) */\n injectKnownNamespaces?: boolean;\n};\n\nexport function renderToString(vnode: VNode, opts?: RenderOptions): string {\n if (typeof vnode === 'string') return escapeHTML(vnode) as string;\n\n if (vnode.tag === '#text') {\n return typeof vnode.children === 'string'\n ? (escapeHTML(vnode.children) as string)\n : '';\n }\n\n if (vnode.tag === '#anchor') {\n // Preserve meaningful falsy children (0, false, '') while filtering out\n // only null and undefined. Anchor blocks are normalized by the compiler\n // to exclude null/undefined; SSR should follow the same rule to avoid\n // hydration mismatches where falsy values are significant.\n const children = Array.isArray(vnode.children)\n ? vnode.children.filter((c) => c !== null && c !== undefined)\n : [];\n return children.map((c) => renderToString(c, opts)).join('');\n }\n\n if (vnode.tag === '#raw') {\n return typeof vnode.children === 'string' ? vnode.children : '';\n }\n\n // Collect attributes from props.attrs. For SSR we mirror vnode.attrs\n // but ensure SVG nodes behave like client-side: if this is an <svg>\n // and no xmlns was provided, inject the standard SVG namespace so\n // server markup matches client-created DOM namespace.\n let attrsObj: Record<string, unknown> = {};\n if (vnode.props && vnode.props.attrs) {\n attrsObj = { ...vnode.props.attrs };\n }\n\n const inject = opts?.injectSvgNamespace ?? true;\n const injectKnown = opts?.injectKnownNamespaces ?? inject;\n\n // Inject namespace for well-known tags when missing. By default we\n // preserve previous behavior (SVG injected) and also allow injecting\n // other known namespaces (MathML) when injectKnownNamespaces is true.\n if (inject && vnode.tag === 'svg' && !('xmlns' in attrsObj)) {\n attrsObj.xmlns = SVG_NS;\n } else if (\n injectKnown &&\n vnode.tag in TAG_NAMESPACE_MAP &&\n !('xmlns' in attrsObj)\n ) {\n attrsObj.xmlns = TAG_NAMESPACE_MAP[vnode.tag];\n }\n\n const attrsString = Object.entries(attrsObj)\n .map(([k, v]) => ` ${k}=\"${escapeHTML(String(v))}\"`)\n .join('');\n\n const children = Array.isArray(vnode.children)\n ? vnode.children\n .filter((c) => c !== null && c !== undefined)\n .map((c) => renderToString(c, opts))\n .join('')\n : typeof vnode.children === 'string'\n ? escapeHTML(vnode.children)\n : vnode.children\n ? renderToString(vnode.children)\n : '';\n\n return `<${vnode.tag}${attrsString}>${children}</${vnode.tag}>`;\n}\n"],"names":["renderToString","vnode","opts","escapeHTML","c","attrsObj","inject","injectKnown","SVG_NS","TAG_NAMESPACE_MAP","attrsString","k","v","children"],"mappings":";AAkBO,SAASA,EAAeC,GAAcC,GAA8B;AACzE,MAAI,OAAOD,KAAU,SAAU,QAAOE,EAAWF,CAAK;AAEtD,MAAIA,EAAM,QAAQ;AAChB,WAAO,OAAOA,EAAM,YAAa,WAC5BE,EAAWF,EAAM,QAAQ,IAC1B;AAGN,MAAIA,EAAM,QAAQ;AAQhB,YAHiB,MAAM,QAAQA,EAAM,QAAQ,IACzCA,EAAM,SAAS,OAAO,CAACG,MAAMA,KAAM,IAAuB,IAC1D,CAAA,GACY,IAAI,CAACA,MAAMJ,EAAeI,GAAGF,CAAI,CAAC,EAAE,KAAK,EAAE;AAG7D,MAAID,EAAM,QAAQ;AAChB,WAAO,OAAOA,EAAM,YAAa,WAAWA,EAAM,WAAW;AAO/D,MAAII,IAAoC,CAAA;AACxC,EAAIJ,EAAM,SAASA,EAAM,MAAM,UAC7BI,IAAW,EAAE,GAAGJ,EAAM,MAAM,MAAA;AAG9B,QAAMK,IAASJ,GAAM,sBAAsB,IACrCK,IAAcL,GAAM,yBAAyBI;AAKnD,EAAIA,KAAUL,EAAM,QAAQ,SAAS,EAAE,WAAWI,KAChDA,EAAS,QAAQG,IAEjBD,KACAN,EAAM,OAAOQ,KACb,EAAE,WAAWJ,OAEbA,EAAS,QAAQI,EAAkBR,EAAM,GAAG;AAG9C,QAAMS,IAAc,OAAO,QAAQL,CAAQ,EACxC,IAAI,CAAC,CAACM,GAAGC,CAAC,MAAM,IAAID,CAAC,KAAKR,EAAW,OAAOS,CAAC,CAAC,CAAC,GAAG,EAClD,KAAK,EAAE,GAEJC,IAAW,MAAM,QAAQZ,EAAM,QAAQ,IACzCA,EAAM,SACH,OAAO,CAACG,MAAMA,KAAM,IAAuB,EAC3C,IAAI,CAACA,MAAMJ,EAAeI,GAAGF,CAAI,CAAC,EAClC,KAAK,EAAE,IACV,OAAOD,EAAM,YAAa,WACxBE,EAAWF,EAAM,QAAQ,IACzBA,EAAM,WACJD,EAAeC,EAAM,QAAQ,IAC7B;AAER,SAAO,IAAIA,EAAM,GAAG,GAAGS,CAAW,IAAIG,CAAQ,KAAKZ,EAAM,GAAG;AAC9D;"}
1
+ {"version":3,"file":"custom-elements-runtime.ssr.es.js","sources":["../src/lib/runtime/vdom-ssr.ts"],"sourcesContent":["import type { VNode } from './types';\nimport { escapeHTML } from './helpers';\nimport { TAG_NAMESPACE_MAP, SVG_NS } from './namespace-helpers';\n\n/**\n * Render a VNode to a string (SSR).\n * Kept intentionally minimal: only serializes attributes under `props.attrs`\n * to avoid leaking runtime-only values (functions, reactive state, directives).\n * @param vnode The virtual node to render.\n * @returns The rendered HTML string.\n */\nexport type RenderOptions = {\n /** Backwards-compatible: whether to inject the SVG namespace on <svg> nodes (default true) */\n injectSvgNamespace?: boolean;\n /** Inject known well-known namespaces for tags like <math> when missing (default follows injectSvgNamespace) */\n injectKnownNamespaces?: boolean;\n};\n\n// HTML void elements that should be self-closing\nconst VOID_ELEMENTS = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n]);\n\nexport function renderToString(vnode: VNode, opts?: RenderOptions): string {\n if (typeof vnode === 'string') return escapeHTML(vnode) as string;\n\n if (vnode.tag === '#text') {\n return typeof vnode.children === 'string'\n ? (escapeHTML(vnode.children) as string)\n : '';\n }\n\n if (vnode.tag === '#anchor') {\n // Preserve meaningful falsy children (0, false, '') while filtering out\n // only null and undefined. Anchor blocks are normalized by the compiler\n // to exclude null/undefined; SSR should follow the same rule to avoid\n // hydration mismatches where falsy values are significant.\n const children = Array.isArray(vnode.children)\n ? vnode.children.filter((c) => c !== null && c !== undefined)\n : [];\n return children.map((c) => renderToString(c, opts)).join('');\n }\n\n if (vnode.tag === '#raw') {\n return typeof vnode.children === 'string' ? vnode.children : '';\n }\n\n // Collect attributes from props.attrs. For SSR we mirror vnode.attrs\n // but ensure SVG nodes behave like client-side: if this is an <svg>\n // and no xmlns was provided, inject the standard SVG namespace so\n // server markup matches client-created DOM namespace.\n let attrsObj: Record<string, unknown> = {};\n if (vnode.props && vnode.props.attrs) {\n attrsObj = { ...vnode.props.attrs };\n }\n\n const inject = opts?.injectSvgNamespace ?? true;\n const injectKnown = opts?.injectKnownNamespaces ?? inject;\n\n // Inject namespace for well-known tags when missing. By default we\n // preserve previous behavior (SVG injected) and also allow injecting\n // other known namespaces (MathML) when injectKnownNamespaces is true.\n if (inject && vnode.tag === 'svg' && !('xmlns' in attrsObj)) {\n attrsObj.xmlns = SVG_NS;\n } else if (\n injectKnown &&\n vnode.tag in TAG_NAMESPACE_MAP &&\n !('xmlns' in attrsObj)\n ) {\n attrsObj.xmlns = TAG_NAMESPACE_MAP[vnode.tag];\n }\n\n const attrsString = Object.entries(attrsObj)\n .map(([k, v]) => ` ${k}=\"${escapeHTML(String(v))}\"`)\n .join('');\n\n // Handle void elements (self-closing tags)\n if (VOID_ELEMENTS.has(vnode.tag)) {\n return `<${vnode.tag}${attrsString}>`;\n }\n\n const children = Array.isArray(vnode.children)\n ? vnode.children\n .filter((c) => c !== null && c !== undefined)\n .map((c) => renderToString(c, opts))\n .join('')\n : typeof vnode.children === 'string'\n ? escapeHTML(vnode.children)\n : vnode.children\n ? renderToString(vnode.children, opts)\n : '';\n\n return `<${vnode.tag}${attrsString}>${children}</${vnode.tag}>`;\n}\n"],"names":["VOID_ELEMENTS","renderToString","vnode","opts","escapeHTML","c","attrsObj","inject","injectKnown","SVG_NS","TAG_NAMESPACE_MAP","attrsString","k","v","children"],"mappings":";AAmBA,MAAMA,wBAAoB,IAAI;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,SAASC,EAAeC,GAAcC,GAA8B;AACzE,MAAI,OAAOD,KAAU,SAAU,QAAOE,EAAWF,CAAK;AAEtD,MAAIA,EAAM,QAAQ;AAChB,WAAO,OAAOA,EAAM,YAAa,WAC5BE,EAAWF,EAAM,QAAQ,IAC1B;AAGN,MAAIA,EAAM,QAAQ;AAQhB,YAHiB,MAAM,QAAQA,EAAM,QAAQ,IACzCA,EAAM,SAAS,OAAO,CAACG,MAAMA,KAAM,IAAuB,IAC1D,CAAA,GACY,IAAI,CAACA,MAAMJ,EAAeI,GAAGF,CAAI,CAAC,EAAE,KAAK,EAAE;AAG7D,MAAID,EAAM,QAAQ;AAChB,WAAO,OAAOA,EAAM,YAAa,WAAWA,EAAM,WAAW;AAO/D,MAAII,IAAoC,CAAA;AACxC,EAAIJ,EAAM,SAASA,EAAM,MAAM,UAC7BI,IAAW,EAAE,GAAGJ,EAAM,MAAM,MAAA;AAG9B,QAAMK,IAASJ,GAAM,sBAAsB,IACrCK,IAAcL,GAAM,yBAAyBI;AAKnD,EAAIA,KAAUL,EAAM,QAAQ,SAAS,EAAE,WAAWI,KAChDA,EAAS,QAAQG,IAEjBD,KACAN,EAAM,OAAOQ,KACb,EAAE,WAAWJ,OAEbA,EAAS,QAAQI,EAAkBR,EAAM,GAAG;AAG9C,QAAMS,IAAc,OAAO,QAAQL,CAAQ,EACxC,IAAI,CAAC,CAACM,GAAGC,CAAC,MAAM,IAAID,CAAC,KAAKR,EAAW,OAAOS,CAAC,CAAC,CAAC,GAAG,EAClD,KAAK,EAAE;AAGV,MAAIb,EAAc,IAAIE,EAAM,GAAG;AAC7B,WAAO,IAAIA,EAAM,GAAG,GAAGS,CAAW;AAGpC,QAAMG,IAAW,MAAM,QAAQZ,EAAM,QAAQ,IACzCA,EAAM,SACH,OAAO,CAACG,MAAMA,KAAM,IAAuB,EAC3C,IAAI,CAACA,MAAMJ,EAAeI,GAAGF,CAAI,CAAC,EAClC,KAAK,EAAE,IACV,OAAOD,EAAM,YAAa,WACxBE,EAAWF,EAAM,QAAQ,IACzBA,EAAM,WACJD,EAAeC,EAAM,UAAUC,CAAI,IACnC;AAER,SAAO,IAAID,EAAM,GAAG,GAAGS,CAAW,IAAIG,CAAQ,KAAKZ,EAAM,GAAG;AAC9D;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./custom-elements-runtime.directives.cjs.js");const t=require("./transitions-DHQuI3AY.cjs");exports.Transition=t.Transition;exports.TransitionGroup=t.TransitionGroup;exports.createTransitionPreset=t.createTransitionPreset;exports.getTransitionStyleSheet=t.getTransitionStyleSheet;exports.transitionPresets=t.transitionPresets;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./custom-elements-runtime.directives.cjs.js");const t=require("./transitions-BAjG4ZyQ.cjs");exports.Transition=t.Transition;exports.TransitionGroup=t.TransitionGroup;exports.createTransitionPreset=t.createTransitionPreset;exports.getTransitionStyleSheet=t.getTransitionStyleSheet;exports.transitionPresets=t.transitionPresets;
2
2
  //# sourceMappingURL=custom-elements-runtime.transitions.cjs.js.map
@@ -1,8 +1,8 @@
1
1
  import "./custom-elements-runtime.directives.es.js";
2
- import { T as e, d as r, e as i, a as n, t as o } from "./transitions-DCIjMqzG.js";
2
+ import { T as r, e as a, f as i, b as n, t as o } from "./transitions-Dnvv4N7o.js";
3
3
  export {
4
- e as Transition,
5
- r as TransitionGroup,
4
+ r as Transition,
5
+ a as TransitionGroup,
6
6
  i as createTransitionPreset,
7
7
  n as getTransitionStyleSheet,
8
8
  o as transitionPresets
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Prose typography plugin - tree-shaken if never used
3
+ * Provides beautiful typography defaults for long-form content
4
+ */
5
+ import type { CSSMap } from './style';
6
+ /**
7
+ * Generate prose base CSS on-demand for treeshakability
8
+ * Only generates CSS when prose class is actually used
9
+ */
10
+ export declare function generateProseCSS(className: string): string | null;
11
+ /**
12
+ * Parse prose element modifiers like prose-a:text-blue-600
13
+ * Returns the generated CSS rule with proper scoping
14
+ */
15
+ export declare function generateProseElementModifier(className: string, utilityMap: CSSMap, parseSpacing: (className: string) => string | null, parseSpaceUtility: (className: string) => string | null, parseOpacity: (className: string) => string | null, parseColorWithOpacity: (className: string) => string | null, parseGradientColorStop: (className: string) => string | null, parseArbitrary: (className: string) => string | null): string | null;
@@ -1,5 +1,15 @@
1
1
  import type { ComponentConfig, ComponentContext, VNode, Refs } from './types';
2
2
  export declare const contextStack: unknown[];
3
+ /**
4
+ * Register a child component element for faster HTML aggregation
5
+ * @internal
6
+ */
7
+ export declare function registerChildComponent(shadowRoot: ShadowRoot, childEl: HTMLElement): void;
8
+ /**
9
+ * Unregister a child component element when it's removed
10
+ * @internal
11
+ */
12
+ export declare function unregisterChildComponent(shadowRoot: ShadowRoot, childEl: HTMLElement): void;
3
13
  /**
4
14
  * Renders the component output.
5
15
  */
@@ -10,15 +10,27 @@ export declare function css(strings: TemplateStringsArray, ...values: unknown[])
10
10
  */
11
11
  export declare function minifyCSS(css: string): string;
12
12
  export declare function getBaseResetSheet(): CSSStyleSheet;
13
+ export declare function getProseSheet(): CSSStyleSheet | null;
14
+ export declare function registerProseSize(size: string): void;
13
15
  export declare function sanitizeCSS(css: string): string;
14
16
  export declare const baseReset: string;
15
- type CSSMap = Record<string, string>;
17
+ export type CSSMap = Record<string, string>;
16
18
  type SelectorVariantMap = Record<string, (selector: string, body: string) => string>;
17
19
  type MediaVariantMap = Record<string, string>;
18
20
  export declare const colors: Record<string, Record<string, string>>;
19
21
  export declare const spacing = "0.25rem";
20
22
  export declare const spacingProps: Record<string, string[]>;
21
23
  export declare const utilityMap: CSSMap;
24
+ /**
25
+ * Parse prose base classes (prose, prose-sm, prose-lg, prose-xl, prose-2xl)
26
+ * Registers prose sizes for the singleton prose stylesheet instead of returning CSS
27
+ */
28
+ export declare function parseProseClass(className: string): string | null;
29
+ /**
30
+ * Parse prose element modifiers like prose-a:text-primary-600
31
+ * Uses separate prose module for treeshaking
32
+ */
33
+ export declare function parseProseElementModifier(className: string): string | null;
22
34
  export declare const selectorVariants: SelectorVariantMap;
23
35
  export declare const mediaVariants: MediaVariantMap;
24
36
  export declare const containerVariants: MediaVariantMap;
@@ -40,7 +52,13 @@ export declare function parseGradientColorStop(className: string): string | null
40
52
  export declare function parseOpacity(className: string): string | null;
41
53
  export declare function parseArbitrary(className: string): string | null;
42
54
  export declare function parseArbitraryVariant(token: string): string | null;
55
+ /**
56
+ * Polyfill for CSS.escape() for SSR environments
57
+ * Based on https://drafts.csswg.org/cssom/#serialize-an-identifier
58
+ */
59
+ export declare function cssEscape(value: string): string;
43
60
  export declare function escapeClassName(name: string): string;
61
+ export declare function escapeRegExp(str: string): string;
44
62
  export declare function extractClassesFromHTML(html: string): string[];
45
63
  export declare const jitCssCache: Map<string, {
46
64
  css: string;