@takazudo/zfb 3.1.0 → 3.2.0

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.
Files changed (58) hide show
  1. package/dist/config.d.ts +28 -3
  2. package/dist/config.js +23 -12
  3. package/dist/config.js.map +1 -1
  4. package/dist/content.js.map +1 -1
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/island-boundary.d.ts +2 -2
  8. package/dist/island-boundary.js +4 -2
  9. package/dist/island-boundary.js.map +1 -1
  10. package/dist/island.d.ts +8 -4
  11. package/dist/island.js +1 -1
  12. package/dist/island.js.map +1 -1
  13. package/dist/jsx-types.d.ts +1 -1
  14. package/dist/jsx-types.js.map +1 -1
  15. package/dist/runtime.js.map +1 -1
  16. package/dist/slugify.js.map +1 -1
  17. package/dist/zudo-react/description.d.ts +18 -0
  18. package/dist/zudo-react/description.js +41 -0
  19. package/dist/zudo-react/description.js.map +1 -1
  20. package/dist/zudo-react/dom-bindings.d.ts +2 -1
  21. package/dist/zudo-react/dom-bindings.js +16 -22
  22. package/dist/zudo-react/dom-bindings.js.map +1 -1
  23. package/dist/zudo-react/forms.js.map +1 -1
  24. package/dist/zudo-react/hydrate.js +20 -30
  25. package/dist/zudo-react/hydrate.js.map +1 -1
  26. package/dist/zudo-react/index.d.ts +2 -1
  27. package/dist/zudo-react/index.js.map +1 -1
  28. package/dist/zudo-react/jsx-dev-runtime.d.ts +2 -6
  29. package/dist/zudo-react/jsx-dev-runtime.js +3 -3
  30. package/dist/zudo-react/jsx-dev-runtime.js.map +1 -1
  31. package/dist/zudo-react/jsx-runtime.js +2 -2
  32. package/dist/zudo-react/jsx-runtime.js.map +1 -1
  33. package/dist/zudo-react/jsx-types.d.ts +59 -23
  34. package/dist/zudo-react/jsx-types.js.map +1 -1
  35. package/dist/zudo-react/props-transport.d.ts +2 -0
  36. package/dist/zudo-react/props-transport.js +42 -14
  37. package/dist/zudo-react/props-transport.js.map +1 -1
  38. package/dist/zudo-react/raw-html.d.ts +1 -0
  39. package/dist/zudo-react/raw-html.js +120 -0
  40. package/dist/zudo-react/raw-html.js.map +1 -0
  41. package/dist/zudo-react/reactive.js.map +1 -1
  42. package/dist/zudo-react/render-html.d.ts +11 -1
  43. package/dist/zudo-react/render-html.js +83 -56
  44. package/dist/zudo-react/render-html.js.map +1 -1
  45. package/dist/zudo-react/root.js +24 -1
  46. package/dist/zudo-react/root.js.map +1 -1
  47. package/dist/zudo-react/server.d.ts +2 -0
  48. package/dist/zudo-react/server.js.map +1 -1
  49. package/dist/zudo-react/style.d.ts +10 -0
  50. package/dist/zudo-react/style.js +525 -0
  51. package/dist/zudo-react/style.js.map +1 -0
  52. package/dist/zudo-react/testing.d.ts +27 -0
  53. package/dist/zudo-react/testing.js +117 -0
  54. package/dist/zudo-react/testing.js.map +1 -0
  55. package/dist/zudo-react/vocabulary.d.ts +7 -0
  56. package/dist/zudo-react/vocabulary.js +64 -5
  57. package/dist/zudo-react/vocabulary.js.map +1 -1
  58. package/package.json +16 -10
@@ -1,3 +1,13 @@
1
- import { type Child } from "./description.js";
1
+ import { type Child, type DescriptionSite } from "./description.js";
2
2
  import type { RenderOptions } from "./server.js";
3
+ export interface RenderDiagnostic {
4
+ readonly code: string;
5
+ readonly path: string;
6
+ readonly component: string;
7
+ readonly spelling?: {
8
+ readonly name: string;
9
+ readonly suggestion?: string;
10
+ };
11
+ readonly site?: DescriptionSite;
12
+ }
3
13
  export declare function renderHtml(node: Child, options: RenderOptions): string;
@@ -1,11 +1,13 @@
1
- import { Fragment, isDescription } from "./description.js";
1
+ import { serializeStyle } from "./style.js";
2
+ import { Fragment, descriptionSite, isDescription, } from "./description.js";
2
3
  import { escapeAttribute, escapeText } from "./escape.js";
4
+ import { rawHtmlReserved } from "./raw-html.js";
3
5
  import { readSnapshot } from "./reactive.js";
4
6
  import { createScope, withScope } from "./scope.js";
5
- import { serializeProps } from "./props-transport.js";
7
+ import { emptyChildren, normalizeProps } from "./props-transport.js";
6
8
  import { islandRootType } from "./island-root-type.js";
7
9
  import { isShowType, isForType, showProps, forProps, keyed, keyPayload, view, } from "./structure.js";
8
- import { booleanAttrs, commonAttrs, dialectSuggestion, formProps, htmlAttrs, htmlTags, isDialectProp, reactiveModelSuggestion, svgAttrs, svgTags, voidTags, } from "./vocabulary.js";
10
+ import { attributeError, attributeText, booleanAttrs, commonAttrs, dialectSuggestion, emptyIframeChildren, formProps, htmlAttrs, htmlTags, isDialectProp, reactiveModelSuggestion, svgAttrs, svgTags, voidTags, } from "./vocabulary.js";
9
11
  const words = (value) => new Set(value.split(" "));
10
12
  const reserved = words("key ref children rawHtml");
11
13
  const sensitive = words("noscript xmp iframe noembed noframes plaintext");
@@ -17,8 +19,19 @@ const tableChildren = {
17
19
  tr: words("td th"),
18
20
  colgroup: words("col"),
19
21
  };
20
- function fail(code, context, detail) {
21
- throw new TypeError(`${code}: ${detail} at ${context.path} in ${context.identity?.component ?? "static render"}`);
22
+ function fail(code, context, detail, spelling) {
23
+ const component = context.identity?.component ?? "static render";
24
+ const site = context.node && descriptionSite(context.node);
25
+ const diagnostic = {
26
+ code,
27
+ path: context.path,
28
+ component,
29
+ ...(spelling && { spelling }),
30
+ ...(site && { site }),
31
+ };
32
+ throw Object.assign(new TypeError(`${code}: ${detail} at ${context.path} in ${component}`), {
33
+ diagnostic,
34
+ });
22
35
  }
23
36
  function reactive(value) {
24
37
  return (typeof value === "object" &&
@@ -62,24 +75,14 @@ function renderText(value, context) {
62
75
  fail("ZR_CHILD", context, `invalid scalar ${typeof value}`);
63
76
  }
64
77
  function style(value, context) {
65
- if (typeof value === "string")
66
- return value;
67
- if (value === null ||
68
- typeof value !== "object" ||
69
- Array.isArray(value) ||
70
- Object.getPrototypeOf(value) !== Object.prototype)
71
- fail("ZR_STYLE", context, "style must be a string or flat object");
72
- let result = "";
73
- for (const [name, entry] of Object.entries(value)) {
74
- if (!/^(--[a-zA-Z0-9_-]+|[a-z][a-z0-9-]*)$/.test(name) || /[A-Z]/.test(name))
75
- fail("ZR_STYLE", context, `invalid property ${name}`);
76
- if (entry == null)
77
- continue;
78
- if (typeof entry !== "string" && !(typeof entry === "number" && Number.isFinite(entry)))
79
- fail("ZR_STYLE", context, `invalid value for ${name}`);
80
- result += `${name}:${entry};`;
78
+ try {
79
+ return serializeStyle(value);
80
+ }
81
+ catch (error) {
82
+ if (error instanceof TypeError)
83
+ fail("ZR_STYLE", context, error.message.replace(/^ZR_STYLE: /, ""));
84
+ throw error;
81
85
  }
82
- return result;
83
86
  }
84
87
  function attributes(tag, props, context, namespace, custom) {
85
88
  let output = "";
@@ -90,7 +93,7 @@ function attributes(tag, props, context, namespace, custom) {
90
93
  continue;
91
94
  if (isDialectProp(name, namespace, custom)) {
92
95
  const suggestion = dialectSuggestion(name, namespace, custom);
93
- fail("ZR_PROP_DIALECT", context, `${tag}.${name}${suggestion ? ` (use \`${suggestion}\` instead of \`${name}\`)` : ""}`);
96
+ fail("ZR_PROP_DIALECT", context, `${tag}.${name}${suggestion ? ` (use \`${suggestion}\` instead of \`${name}\`)` : ""}`, suggestion ? { name, suggestion } : { name });
94
97
  }
95
98
  if (name.startsWith("on:")) {
96
99
  if (!/^on:[A-Za-z][A-Za-z0-9_-]*(?::capture)?$/.test(name))
@@ -116,35 +119,28 @@ function attributes(tag, props, context, namespace, custom) {
116
119
  const suggestion = reactiveModelSuggestion(tag, name, String(read(props.type) ?? "text"), custom);
117
120
  fail("ZR_MODEL_UNSUPPORTED", context, `${tag}.${name} requires ${suggestion ?? "a static value"}`);
118
121
  }
122
+ if (/^on[a-z]/.test(name) && typeof value === "function")
123
+ fail("ZR_PROP_DIALECT", context, `${tag}.${name} must use on:${name.slice(2)}`, {
124
+ name,
125
+ suggestion: `on:${name.slice(2)}`,
126
+ });
127
+ const error = attributeError(name, value, custom);
128
+ if (error)
129
+ fail("ZR_ATTRIBUTE", context, `${tag}.${name} ${error}`);
119
130
  if (value == null)
120
131
  continue;
121
- if (/^on[a-z]/.test(name) && typeof value === "function")
122
- fail("ZR_PROP_DIALECT", context, `${tag}.${name} must use on:${name.slice(2)}`);
123
- if (custom && typeof value !== "string")
124
- fail("ZR_ATTRIBUTE", context, `${tag}.${name} requires a string`);
125
- if (name === "style")
126
- output += ` style="${escapeAttribute(style(value, context))}"`;
127
- else if (booleanAttrs.has(name)) {
128
- if (typeof value !== "boolean")
129
- fail("ZR_ATTRIBUTE", context, `${tag}.${name} requires a boolean`);
130
- if (value)
131
- output += ` ${name}`;
132
- }
133
- else {
134
- if (typeof value !== "string" &&
135
- typeof value !== "boolean" &&
136
- !(typeof value === "number" && Number.isFinite(value)))
137
- fail("ZR_ATTRIBUTE", context, `${tag}.${name} requires a scalar`);
138
- if (typeof value === "boolean" && !name.startsWith("aria-") && !name.startsWith("data-"))
139
- fail("ZR_ATTRIBUTE", context, `${tag}.${name} requires a string`);
140
- if (/^on[a-z]/.test(name) && typeof value !== "string")
141
- fail("ZR_ATTRIBUTE", context, `${tag}.${name} requires a string`);
142
- output += ` ${name}="${escapeAttribute(String(value))}"`;
143
- }
132
+ const text = name === "style" ? style(value, context) : attributeText(name, value);
133
+ if (text === null)
134
+ continue;
135
+ output +=
136
+ booleanAttrs.has(name) && value === true ? ` ${name}` : ` ${name}="${escapeAttribute(text)}"`;
144
137
  }
145
138
  return output;
146
139
  }
147
140
  function restricted(value, context, namespace, parent) {
141
+ return tracked(value, context, () => restrictedValue(value, context, namespace, parent));
142
+ }
143
+ function restrictedValue(value, context, namespace, parent) {
148
144
  if (value == null || typeof value === "boolean")
149
145
  return "";
150
146
  if (Array.isArray(value))
@@ -169,7 +165,7 @@ function element(description, context, namespace, parent) {
169
165
  const childNamespace = tag === "foreignObject" ? "html" : elementNamespace;
170
166
  if (elementNamespace === "svg" ? !svgTags.has(tag) : !custom && !htmlTags.has(tag))
171
167
  fail("ZR_TAG", context, tag);
172
- if (context.identity && (tag === "template" || sensitive.has(tag)))
168
+ if (context.identity && (tag === "template" || (tag !== "iframe" && sensitive.has(tag))))
173
169
  fail("ZR_PARSER_CONTEXT", context, tag);
174
170
  if (parent in tableChildren && !tableChildren[parent]?.has(tag))
175
171
  fail("ZR_PARSER_CONTEXT", context, `${parent} > ${tag}`);
@@ -184,6 +180,12 @@ function element(description, context, namespace, parent) {
184
180
  : `form:${context.nextFormId++}`;
185
181
  const source = description.props;
186
182
  const props = { ...source };
183
+ if (tag === "iframe") {
184
+ if (Object.hasOwn(props, "rawHtml"))
185
+ fail("ZR_RAW_HTML", context, "iframe forbids rawHtml");
186
+ if (!emptyIframeChildren(props.children))
187
+ fail("ZR_PARSER_CONTEXT", context, "iframe requires empty children");
188
+ }
187
189
  const hasValue = source.modelValue !== undefined;
188
190
  const hasChecked = source.modelChecked !== undefined;
189
191
  if ((hasValue && hasChecked) ||
@@ -311,7 +313,7 @@ function element(description, context, namespace, parent) {
311
313
  const payload = read(raw);
312
314
  if (typeof payload !== "string")
313
315
  fail("ZR_RAW_HTML", context, `${tag} requires string rawHtml`);
314
- if (/<!--\/?zr:1:|data-zfb-island(?:-skip-ssr)?\s*=/.test(payload))
316
+ if (rawHtmlReserved(payload, tag))
315
317
  fail("ZR_RAW_HTML", context, "reserved boundary in rawHtml");
316
318
  if ((tag === "script" && /<\/script/i.test(payload)) ||
317
319
  (tag === "style" && /<\/style/i.test(payload)))
@@ -324,6 +326,9 @@ function element(description, context, namespace, parent) {
324
326
  fail("ZR_MODEL_VALUE", context, "textarea requires string");
325
327
  content = `${value.startsWith("\n") ? "\n" : ""}${escapeText(value)}`;
326
328
  }
329
+ else if (tag === "iframe") {
330
+ // The shell has no owned children; srcdoc belongs to the browser's foreign document.
331
+ }
327
332
  else if (tag === "script" || tag === "style") {
328
333
  if (hasChildren)
329
334
  fail("ZR_RAW_HTML", context, `${tag} requires rawHtml`);
@@ -364,7 +369,22 @@ function element(description, context, namespace, parent) {
364
369
  context.formId = previousFormId;
365
370
  return `<${tag}${attrs}>${voidTags.has(tag) ? "" : `${content}</${tag}>`}`;
366
371
  }
372
+ // A failure is attributed only to the value being rendered: a description's own site,
373
+ // or no site at all for scalars, promises and other non-description children.
374
+ function tracked(value, context, fn) {
375
+ const prior = context.node;
376
+ context.node = isDescription(value) ? value : undefined;
377
+ try {
378
+ return fn();
379
+ }
380
+ finally {
381
+ context.node = prior;
382
+ }
383
+ }
367
384
  function render(value, context, namespace, parent) {
385
+ return tracked(value, context, () => renderValue(value, context, namespace, parent));
386
+ }
387
+ function renderValue(value, context, namespace, parent) {
368
388
  if (value == null || typeof value === "boolean")
369
389
  return "";
370
390
  if (Array.isArray(value))
@@ -453,9 +473,6 @@ function render(value, context, namespace, parent) {
453
473
  context.scope = prior;
454
474
  }
455
475
  }
456
- function empty(value) {
457
- return (value == null || typeof value === "boolean" || (Array.isArray(value) && value.every(empty)));
458
- }
459
476
  function island(description, context, namespace, parent) {
460
477
  if (context.boundary)
461
478
  fail("ZR_NESTED_ISLAND", context, "nested island");
@@ -470,13 +487,13 @@ function island(description, context, namespace, parent) {
470
487
  const component = child.type.displayName ?? child.type.name;
471
488
  if (component !== options.identity.component)
472
489
  fail("ZR_ISLAND_IDENTITY", context, `expected ${options.identity.component}, got ${component}`);
473
- if (Object.hasOwn(child.props, "children") && !empty(child.props.children))
490
+ if (Object.hasOwn(child.props, "children") && !emptyChildren(child.props.children))
474
491
  fail("ZR_ISLAND_CHILD", context, "nonempty children");
475
- const props = { ...child.props };
476
- delete props.children;
492
+ let props;
477
493
  let payload;
478
494
  try {
479
- payload = serializeProps(props);
495
+ props = normalizeProps(child.props);
496
+ payload = JSON.stringify(props);
480
497
  }
481
498
  catch (error) {
482
499
  throw new TypeError(`ZR_ISLAND_PROPS ${component}: ${error instanceof Error ? error.message : String(error)}`);
@@ -486,8 +503,18 @@ function island(description, context, namespace, parent) {
486
503
  (when === "media" && !options.media?.trim()) ||
487
504
  (when !== "media" && options.media !== undefined))
488
505
  fail("ZR_ISLAND_WHEN", context, when);
506
+ if (options.persist !== undefined &&
507
+ (typeof options.persist !== "string" ||
508
+ !options.persist.trim() ||
509
+ options.persist !== options.persist.trim() ||
510
+ /[\u0000-\u001f\u007f]/.test(options.persist)))
511
+ fail("ZR_ISLAND_PERSIST", context, "persist must be a nonempty string without surrounding whitespace or control characters");
512
+ if (options.persistProps !== undefined && typeof options.persistProps !== "boolean")
513
+ fail("ZR_ISLAND_PERSIST", context, "persistProps must be a boolean");
514
+ if (options.persistProps !== undefined && options.persist === undefined)
515
+ fail("ZR_ISLAND_PERSIST", context, "persistProps requires persist");
489
516
  const marker = options.skipSsr ? "data-zfb-island-skip-ssr" : "data-zfb-island";
490
- const attrs = ` ${marker}="${escapeAttribute(options.identity.component)}" data-when="${when}"${when === "media" ? ` data-media="${escapeAttribute(options.media)}"` : ""} data-zfb-transport="json/1" data-zfb-protocol="zudo-react/1" data-zfb-build="${escapeAttribute(options.identity.build)}" data-props="${escapeAttribute(payload)}"`;
517
+ const attrs = ` ${marker}="${escapeAttribute(options.identity.component)}" data-when="${when}"${when === "media" ? ` data-media="${escapeAttribute(options.media)}"` : ""} data-zfb-transport="json/1" data-zfb-protocol="zudo-react/1" data-zfb-build="${escapeAttribute(options.identity.build)}" data-props="${escapeAttribute(payload)}"${options.persist === undefined ? "" : ` data-zfb-transition-persist="${escapeAttribute(options.persist)}"`}${options.persistProps === true ? ' data-zfb-transition-persist-props="true"' : ""}`;
491
518
  const local = {
492
519
  radioGroups: new Map(),
493
520
  radioNames: new Map(),
@@ -1 +1 @@
1
- {"version":3,"file":"render-html.js","sourceRoot":"","sources":["../../src/zudo-react/render-html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAgC,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAqB,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,cA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AACH,CAAC","sourcesContent":["import { Fragment, isDescription, type Child, type Description } from \"./description.js\";\nimport { escapeAttribute, escapeText } from \"./escape.js\";\nimport type { IslandIdentity } from \"./index.js\";\nimport { readSnapshot } from \"./reactive.js\";\nimport type { ReadonlySignal } from \"./reactive-types.js\";\nimport { createScope, withScope, type RuntimeScope } from \"./scope.js\";\nimport { serializeProps } from \"./props-transport.js\";\nimport { islandRootType } from \"./island-root-type.js\";\nimport type { IslandOptions, RenderOptions } from \"./server.js\";\nimport {\n isShowType,\n isForType,\n showProps,\n forProps,\n keyed,\n keyPayload,\n view,\n} from \"./structure.js\";\nimport {\n booleanAttrs,\n commonAttrs,\n dialectSuggestion,\n formProps,\n htmlAttrs,\n htmlTags,\n isDialectProp,\n reactiveModelSuggestion,\n svgAttrs,\n svgTags,\n type Namespace,\n voidTags,\n} from \"./vocabulary.js\";\n\nconst words = (value: string) => new Set(value.split(\" \"));\nconst reserved = words(\"key ref children rawHtml\");\nconst sensitive = words(\"noscript xmp iframe noembed noframes plaintext\");\nconst tableChildren: Record<string, Set<string>> = {\n table: words(\"caption colgroup thead tbody tfoot\"),\n thead: words(\"tr\"),\n tbody: words(\"tr\"),\n tfoot: words(\"tr\"),\n tr: words(\"td th\"),\n colgroup: words(\"col\"),\n};\ninterface Context {\n identity: IslandIdentity | undefined;\n boundary: boolean;\n next: number;\n scope: RuntimeScope;\n path: string;\n selectValue?: string | undefined;\n selectSeen?: Set<string> | undefined;\n selectMatches?: number | undefined;\n radioGroups: Map<\n unknown,\n { name: string; form: string; value: string | null; options: Set<string> }\n >;\n radioNames: Map<string, unknown>;\n formId: string;\n nextFormId: number;\n}\nfunction fail(code: string, context: Context, detail: string): never {\n throw new TypeError(\n `${code}: ${detail} at ${context.path} in ${context.identity?.component ?? \"static render\"}`,\n );\n}\nfunction reactive(value: unknown): value is ReadonlySignal<unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"$$zudoReactive\" in value &&\n value.$$zudoReactive === \"zudo-react.reactive.v1\"\n );\n}\nfunction read(value: unknown): unknown {\n return reactive(value) ? readSnapshot(value) : value;\n}\nfunction region(context: Context, kind: string, content: () => string): string {\n if (!context.identity) return content();\n const id = context.next++;\n return `<!--zr:1:${id}:${kind}-->${content()}<!--/zr:1:${id}-->`;\n}\nfunction at<T>(context: Context, part: string, fn: () => T): T {\n const old = context.path;\n context.path += part;\n try {\n return fn();\n } finally {\n context.path = old;\n }\n}\nfunction children(value: unknown, context: Context, namespace: Namespace, parent: string): string {\n if (value == null || typeof value === \"boolean\") return \"\";\n if (Array.isArray(value))\n return value\n .map((item, index) =>\n at(context, `[${index}]`, () => render(item, context, namespace, parent)),\n )\n .join(\"\");\n return render(value, context, namespace, parent);\n}\nfunction renderText(value: unknown, context: Context): string {\n if (value == null || typeof value === \"boolean\") return \"\";\n if (typeof value === \"string\" || (typeof value === \"number\" && Number.isFinite(value)))\n return escapeText(String(value));\n fail(\"ZR_CHILD\", context, `invalid scalar ${typeof value}`);\n}\nfunction style(value: unknown, context: Context): string {\n if (typeof value === \"string\") return value;\n if (\n value === null ||\n typeof value !== \"object\" ||\n Array.isArray(value) ||\n Object.getPrototypeOf(value) !== Object.prototype\n )\n fail(\"ZR_STYLE\", context, \"style must be a string or flat object\");\n let result = \"\";\n for (const [name, entry] of Object.entries(value)) {\n if (!/^(--[a-zA-Z0-9_-]+|[a-z][a-z0-9-]*)$/.test(name) || /[A-Z]/.test(name))\n fail(\"ZR_STYLE\", context, `invalid property ${name}`);\n if (entry == null) continue;\n if (typeof entry !== \"string\" && !(typeof entry === \"number\" && Number.isFinite(entry)))\n fail(\"ZR_STYLE\", context, `invalid value for ${name}`);\n result += `${name}:${entry};`;\n }\n return result;\n}\nfunction attributes(\n tag: string,\n props: Readonly<Record<string, unknown>>,\n context: Context,\n namespace: Namespace,\n custom: boolean,\n): string {\n let output = \"\";\n for (const [name, original] of Object.entries(props)) {\n if (reserved.has(name)) continue;\n if (formProps.has(name)) continue;\n if (isDialectProp(name, namespace, custom)) {\n const suggestion = dialectSuggestion(name, namespace, custom);\n fail(\n \"ZR_PROP_DIALECT\",\n context,\n `${tag}.${name}${suggestion ? ` (use \\`${suggestion}\\` instead of \\`${name}\\`)` : \"\"}`,\n );\n }\n if (name.startsWith(\"on:\")) {\n if (!/^on:[A-Za-z][A-Za-z0-9_-]*(?::capture)?$/.test(name))\n fail(\"ZR_LISTENER\", context, `${tag}.${name}`);\n if (typeof original !== \"function\") fail(\"ZR_LISTENER\", context, `${tag}.${name}`);\n const inline = `on${name.slice(3).replace(/:capture$/, \"\")}`;\n if (inline in props) fail(\"ZR_LISTENER_CONFLICT\", context, `${tag}.${inline}`);\n continue;\n }\n if (!/^[A-Za-z_:][A-Za-z0-9_:.-]*$/.test(name)) fail(\"ZR_ATTRIBUTE\", context, `${tag}.${name}`);\n if (\n !custom &&\n !commonAttrs.has(name) &&\n !(namespace === \"svg\" ? svgAttrs.has(name) : htmlAttrs.has(name)) &&\n !/^data-[\\w.-]+$/.test(name) &&\n !/^aria-[\\w.-]+$/.test(name) &&\n !/^on[a-z]+$/.test(name)\n )\n fail(\"ZR_ATTRIBUTE\", context, `${tag}.${name}`);\n const value = read(original);\n if ((name === \"value\" || name === \"checked\") && reactive(original)) {\n const suggestion = reactiveModelSuggestion(\n tag,\n name,\n String(read(props.type) ?? \"text\"),\n custom,\n );\n fail(\n \"ZR_MODEL_UNSUPPORTED\",\n context,\n `${tag}.${name} requires ${suggestion ?? \"a static value\"}`,\n );\n }\n if (value == null) continue;\n if (/^on[a-z]/.test(name) && typeof value === \"function\")\n fail(\"ZR_PROP_DIALECT\", context, `${tag}.${name} must use on:${name.slice(2)}`);\n if (custom && typeof value !== \"string\")\n fail(\"ZR_ATTRIBUTE\", context, `${tag}.${name} requires a string`);\n if (name === \"style\") output += ` style=\"${escapeAttribute(style(value, context))}\"`;\n else if (booleanAttrs.has(name)) {\n if (typeof value !== \"boolean\")\n fail(\"ZR_ATTRIBUTE\", context, `${tag}.${name} requires a boolean`);\n if (value) output += ` ${name}`;\n } else {\n if (\n typeof value !== \"string\" &&\n typeof value !== \"boolean\" &&\n !(typeof value === \"number\" && Number.isFinite(value))\n )\n fail(\"ZR_ATTRIBUTE\", context, `${tag}.${name} requires a scalar`);\n if (typeof value === \"boolean\" && !name.startsWith(\"aria-\") && !name.startsWith(\"data-\"))\n fail(\"ZR_ATTRIBUTE\", context, `${tag}.${name} requires a string`);\n if (/^on[a-z]/.test(name) && typeof value !== \"string\")\n fail(\"ZR_ATTRIBUTE\", context, `${tag}.${name} requires a string`);\n output += ` ${name}=\"${escapeAttribute(String(value))}\"`;\n }\n }\n return output;\n}\nfunction restricted(\n value: unknown,\n context: Context,\n namespace: Namespace,\n parent: string,\n): string {\n if (value == null || typeof value === \"boolean\") return \"\";\n if (Array.isArray(value))\n return value\n .map((item, index) =>\n at(context, `[${index}]`, () => restricted(item, context, namespace, parent)),\n )\n .join(\"\");\n if (typeof value === \"string\" || typeof value === \"number\") {\n if (parent in tableChildren && String(value).trim())\n fail(\"ZR_PARSER_CONTEXT\", context, `${parent} text`);\n return renderText(value, context);\n }\n if (parent === \"title\" || parent === \"option\")\n fail(\"ZR_PARSER_CONTEXT\", context, `${parent} requires static text`);\n if (!isDescription(value) || typeof value.type !== \"string\")\n fail(\"ZR_PARSER_CONTEXT\", context, `${parent} requires intrinsic children`);\n return element(value, context, namespace, parent);\n}\nfunction element(\n description: Description,\n context: Context,\n namespace: Namespace,\n parent: string,\n): string {\n const tag = description.type as string;\n const custom = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(tag);\n const elementNamespace = tag === \"svg\" || namespace === \"svg\" ? \"svg\" : \"html\";\n const childNamespace = tag === \"foreignObject\" ? \"html\" : elementNamespace;\n if (elementNamespace === \"svg\" ? !svgTags.has(tag) : !custom && !htmlTags.has(tag))\n fail(\"ZR_TAG\", context, tag);\n if (context.identity && (tag === \"template\" || sensitive.has(tag)))\n fail(\"ZR_PARSER_CONTEXT\", context, tag);\n if (parent in tableChildren && !tableChildren[parent]?.has(tag))\n fail(\"ZR_PARSER_CONTEXT\", context, `${parent} > ${tag}`);\n if (\n (parent === \"select\" && tag !== \"option\" && tag !== \"optgroup\") ||\n (parent === \"optgroup\" && tag !== \"option\")\n )\n fail(\"ZR_PARSER_CONTEXT\", context, `${parent} > ${tag}`);\n const previousFormId = context.formId;\n if (tag === \"form\")\n context.formId =\n typeof description.props.id === \"string\"\n ? `id:${description.props.id}`\n : `form:${context.nextFormId++}`;\n const source = description.props;\n const props: Record<string, unknown> = { ...source };\n const hasValue = source.modelValue !== undefined;\n const hasChecked = source.modelChecked !== undefined;\n if (\n (hasValue && hasChecked) ||\n (source.defaultValue !== undefined && source.value !== undefined) ||\n (source.defaultChecked !== undefined && source.checked !== undefined) ||\n (hasValue &&\n (source.defaultValue !== undefined ||\n (source.type !== \"radio\" && source.value !== undefined))) ||\n (hasChecked && (source.defaultChecked !== undefined || source.checked !== undefined))\n )\n fail(\"ZR_MODEL_CONFLICT\", context, tag);\n if (hasValue || hasChecked) {\n for (const name of [\"type\", \"multiple\", \"name\", \"form\"])\n if (reactive(source[name])) fail(\"ZR_MODEL_UNSUPPORTED\", context, `reactive ${name} shape`);\n const model = hasValue ? source.modelValue : source.modelChecked;\n let prototype = model;\n let writable = false;\n while (prototype && typeof prototype === \"object\") {\n const property = Object.getOwnPropertyDescriptor(prototype, \"value\");\n if (property) {\n writable = typeof property.set === \"function\";\n break;\n }\n prototype = Object.getPrototypeOf(prototype);\n }\n if (\n !reactive(model) ||\n !writable ||\n !(\"$$zudoWritable\" in model) ||\n model.$$zudoWritable !== \"zudo-react.writable.v1\"\n )\n fail(\"ZR_MODEL_READONLY\", context, tag);\n }\n if ((hasValue || hasChecked) && source.contenteditable !== undefined)\n fail(\"ZR_MODEL_UNSUPPORTED\", context, `${tag}[contenteditable]`);\n const inputType = String(source.type ?? \"text\");\n if (\n hasValue &&\n !(\n tag === \"textarea\" ||\n tag === \"select\" ||\n (tag === \"input\" &&\n [\"text\", \"search\", \"email\", \"url\", \"tel\", \"password\", \"radio\"].includes(inputType))\n )\n )\n fail(\"ZR_MODEL_UNSUPPORTED\", context, `${tag}[type=${inputType}]`);\n if (hasChecked && !(tag === \"input\" && inputType === \"checkbox\"))\n fail(\"ZR_MODEL_UNSUPPORTED\", context, tag);\n if (\n source.defaultValue !== undefined &&\n !(tag === \"textarea\" || tag === \"select\" || tag === \"input\")\n )\n fail(\"ZR_MODEL_UNSUPPORTED\", context, tag);\n if (\n source.defaultValue !== undefined &&\n tag === \"input\" &&\n ![\"text\", \"search\", \"email\", \"url\", \"tel\", \"password\"].includes(inputType)\n )\n fail(\"ZR_MODEL_UNSUPPORTED\", context, `${tag}[type=${inputType}]`);\n if (\n source.defaultChecked !== undefined &&\n !(tag === \"input\" && [\"checkbox\", \"radio\"].includes(inputType))\n )\n fail(\"ZR_MODEL_UNSUPPORTED\", context, tag);\n if (tag === \"input\") {\n if (source.defaultValue !== undefined || (hasValue && inputType !== \"radio\"))\n props.value = read(source.modelValue ?? source.defaultValue);\n if (source.defaultChecked !== undefined || hasChecked)\n props.checked = read(source.modelChecked ?? source.defaultChecked);\n if (hasValue && inputType === \"radio\") {\n if (typeof source.name !== \"string\" || !source.name || typeof source.value !== \"string\")\n fail(\"ZR_MODEL_UNSUPPORTED\", context, \"radio requires static name and value\");\n const selected = read(source.modelValue);\n if (selected !== null && typeof selected !== \"string\")\n fail(\"ZR_MODEL_VALUE\", context, \"radio requires string or null\");\n const form = typeof source.form === \"string\" ? `id:${source.form}` : context.formId;\n const key = `${source.name}\\u0000${form}`;\n const owner = context.radioNames.get(key);\n if (owner && owner !== source.modelValue)\n fail(\"ZR_MODEL_CONFLICT\", context, \"same-name radios use different models\");\n context.radioNames.set(key, source.modelValue);\n const group = context.radioGroups.get(source.modelValue);\n if (\n group &&\n (group.name !== source.name || group.form !== form || group.options.has(source.value))\n )\n fail(\"ZR_MODEL_CONFLICT\", context, \"radio membership or duplicate value\");\n if (group) group.options.add(source.value);\n else\n context.radioGroups.set(source.modelValue, {\n name: source.name,\n form,\n value: selected,\n options: new Set([source.value]),\n });\n props.checked = selected === source.value;\n }\n }\n if (tag === \"option\" && context.selectValue !== undefined) {\n const value = source.value;\n if (typeof value !== \"string\")\n fail(\"ZR_MODEL_UNSUPPORTED\", context, \"select option requires static value\");\n if (context.selectSeen!.has(value))\n fail(\"ZR_MODEL_CONFLICT\", context, \"duplicate option value\");\n context.selectSeen!.add(value);\n if (source.selected !== undefined)\n fail(\"ZR_MODEL_CONFLICT\", context, \"select-level value with option selected\");\n props.selected = value === context.selectValue;\n if (props.selected) context.selectMatches = (context.selectMatches ?? 0) + 1;\n }\n if (context.boundary && (\"data-zfb-island\" in props || \"data-zfb-island-skip-ssr\" in props))\n fail(\"ZR_NESTED_ISLAND\", context, tag);\n if (\n tag === \"select\" &&\n read(props.multiple) === true &&\n (context.identity || hasValue || source.defaultValue !== undefined)\n )\n fail(\"ZR_MODEL_UNSUPPORTED\", context, \"select[multiple]\");\n const attrs = attributes(tag, props, context, elementNamespace, custom);\n const raw = props.rawHtml;\n const hasChildren = Object.hasOwn(props, \"children\");\n if (raw !== undefined && hasChildren)\n fail(\"ZR_RAW_HTML\", context, `${tag} has children and rawHtml`);\n if (voidTags.has(tag) && (hasChildren || raw !== undefined))\n fail(\"ZR_VOID_CHILDREN\", context, tag);\n if (\n raw !== undefined &&\n (elementNamespace === \"svg\" ||\n tag === \"textarea\" ||\n tag === \"title\" ||\n tag === \"select\" ||\n tag === \"option\")\n )\n fail(\"ZR_RAW_HTML\", context, tag);\n if (tag === \"textarea\" && hasChildren && (hasValue || source.defaultValue !== undefined))\n fail(\"ZR_MODEL_CONFLICT\", context, tag);\n let content = \"\";\n if (raw !== undefined) {\n if ((tag === \"script\" || tag === \"style\") && reactive(raw))\n fail(\"ZR_RAW_HTML\", context, `${tag} requires static rawHtml`);\n const payload = read(raw);\n if (typeof payload !== \"string\") fail(\"ZR_RAW_HTML\", context, `${tag} requires string rawHtml`);\n if (/<!--\\/?zr:1:|data-zfb-island(?:-skip-ssr)?\\s*=/.test(payload))\n fail(\"ZR_RAW_HTML\", context, \"reserved boundary in rawHtml\");\n if (\n (tag === \"script\" && /<\\/script/i.test(payload)) ||\n (tag === \"style\" && /<\\/style/i.test(payload))\n )\n fail(\"ZR_RAW_HTML\", context, `closing ${tag} in rawHtml`);\n content = tag === \"script\" || tag === \"style\" ? payload : region(context, \"h\", () => payload);\n } else if (tag === \"textarea\" && (hasValue || source.defaultValue !== undefined)) {\n const value = read(source.modelValue ?? source.defaultValue);\n if (typeof value !== \"string\") fail(\"ZR_MODEL_VALUE\", context, \"textarea requires string\");\n content = `${value.startsWith(\"\\n\") ? \"\\n\" : \"\"}${escapeText(value)}`;\n } else if (tag === \"script\" || tag === \"style\") {\n if (hasChildren) fail(\"ZR_RAW_HTML\", context, `${tag} requires rawHtml`);\n } else if (\n tag === \"title\" ||\n tag === \"option\" ||\n tag === \"optgroup\" ||\n tag === \"select\" ||\n tag in tableChildren\n ) {\n if (tag === \"select\" && (hasValue || source.defaultValue !== undefined)) {\n const value = read(source.modelValue ?? source.defaultValue);\n if (typeof value !== \"string\") fail(\"ZR_MODEL_VALUE\", context, \"select requires string\");\n const oldValue = context.selectValue;\n const oldSeen = context.selectSeen;\n const oldMatches = context.selectMatches;\n context.selectValue = value;\n context.selectSeen = new Set();\n context.selectMatches = 0;\n try {\n content = restricted(props.children, context, childNamespace, tag);\n if (context.selectMatches !== 1)\n fail(\"ZR_MODEL_VALUE\", context, `select has no option ${value}`);\n } finally {\n context.selectValue = oldValue;\n context.selectSeen = oldSeen;\n context.selectMatches = oldMatches;\n }\n } else content = restricted(props.children, context, childNamespace, tag);\n } else content = children(props.children, context, childNamespace, tag);\n if (tag === \"pre\" && raw === undefined && (content.startsWith(\"\\n\") || content.startsWith(\"\\r\")))\n content = `\\n${content}`;\n context.formId = previousFormId;\n return `<${tag}${attrs}>${voidTags.has(tag) ? \"\" : `${content}</${tag}>`}`;\n}\nfunction render(value: unknown, context: Context, namespace: Namespace, parent: string): string {\n if (value == null || typeof value === \"boolean\") return \"\";\n if (Array.isArray(value))\n return region(context, \"f\", () => children(value, context, namespace, parent));\n if (reactive(value)) return region(context, \"t\", () => renderText(read(value), context));\n if (typeof value === \"string\" || typeof value === \"number\") return renderText(value, context);\n if (typeof value === \"object\" && value !== null && \"then\" in value)\n fail(\"ZR_ASYNC_COMPONENT\", context, \"promise child\");\n if (!isDescription(value)) fail(\"ZR_CHILD\", context, typeof value);\n if ((value.type as symbol | typeof value.type) === islandRootType)\n return island(value, context, namespace, parent);\n if (value.type === Fragment)\n return region(context, \"f\", () => children(value.props.children, context, namespace, parent));\n if (isShowType(value.type)) {\n if (\n parent in tableChildren ||\n [\"select\", \"optgroup\", \"option\", \"title\", \"textarea\", \"script\", \"style\"].includes(parent)\n )\n fail(\"ZR_PARSER_CONTEXT\", context, parent);\n const props = showProps(value);\n if (\n !reactive(props.when) ||\n typeof props.children !== \"function\" ||\n (props.fallback !== undefined && typeof props.fallback !== \"function\")\n )\n fail(\"ZR_CHILD\", context, \"Show requires signal and factories\");\n const selected = read(props.when);\n if (typeof selected !== \"boolean\") fail(\"ZR_CHILD\", context, \"Show.when requires boolean\");\n return region(context, `s:${selected ? 1 : 0}`, () => {\n const factory = selected ? props.children : props.fallback;\n if (!factory) return \"\";\n const scope = context.scope.child(\"Show\");\n const previous = context.scope;\n context.scope = scope;\n try {\n return withScope(scope, () => render(factory(), context, namespace, parent));\n } finally {\n context.scope = previous;\n }\n });\n }\n if (isForType(value.type)) {\n if (\n parent in tableChildren ||\n [\"select\", \"optgroup\", \"option\", \"title\", \"textarea\", \"script\", \"style\"].includes(parent)\n )\n fail(\"ZR_PARSER_CONTEXT\", context, parent);\n const props = forProps<unknown>(value);\n if (\n !reactive(props.each) ||\n typeof props.by !== \"function\" ||\n typeof props.children !== \"function\"\n )\n fail(\"ZR_CHILD\", context, \"For requires signal, key and factory\");\n const items = read(props.each);\n if (!Array.isArray(items)) fail(\"ZR_CHILD\", context, \"For.each requires array\");\n const keys = keyed(items, props.by, context.path);\n return region(context, \"l\", () =>\n items\n .map((item, index) => {\n const scope = context.scope.child(\"For\");\n const previous = context.scope;\n context.scope = scope;\n try {\n return region(context, `i:${keyPayload(keys[index]!)}`, () =>\n withScope(scope, () =>\n render(\n props.children(view(item).value, view(index).value),\n context,\n namespace,\n parent,\n ),\n ),\n );\n } finally {\n context.scope = previous;\n }\n })\n .join(\"\"),\n );\n }\n if (typeof value.type === \"string\") return element(value, context, namespace, parent);\n const component = value.type;\n const scope = context.scope.child(component.name || \"Anonymous\");\n const prior = context.scope;\n context.scope = scope;\n try {\n return region(context, \"c\", () => {\n const output = withScope(scope, () => component(value.props));\n if (output && typeof output === \"object\" && \"then\" in output)\n fail(\"ZR_ASYNC_COMPONENT\", context, component.name);\n return render(output, context, namespace, parent);\n });\n } finally {\n context.scope = prior;\n }\n}\nfunction empty(value: unknown): boolean {\n return (\n value == null || typeof value === \"boolean\" || (Array.isArray(value) && value.every(empty))\n );\n}\nfunction island(\n description: Description,\n context: Context,\n namespace: Namespace,\n parent: string,\n): string {\n if (context.boundary) fail(\"ZR_NESTED_ISLAND\", context, \"nested island\");\n if (namespace !== \"html\" || parent === \"p\" || parent in tableChildren || parent === \"select\")\n fail(\"ZR_PARSER_CONTEXT\", context, \"island wrapper\");\n const child = description.props.child;\n const options = description.props.options as IslandOptions;\n if (!isDescription(child) || typeof child.type !== \"function\")\n fail(\"ZR_ISLAND_CHILD\", context, \"one function component required\");\n if (!options?.identity?.component || !options.identity.build)\n fail(\"ZR_ISLAND_IDENTITY\", context, \"component/build required\");\n const component =\n (child.type as typeof child.type & { displayName?: string }).displayName ?? child.type.name;\n if (component !== options.identity.component)\n fail(\"ZR_ISLAND_IDENTITY\", context, `expected ${options.identity.component}, got ${component}`);\n if (Object.hasOwn(child.props, \"children\") && !empty(child.props.children))\n fail(\"ZR_ISLAND_CHILD\", context, \"nonempty children\");\n const props = { ...child.props };\n delete props.children;\n let payload: string;\n try {\n payload = serializeProps(props);\n } catch (error) {\n throw new TypeError(\n `ZR_ISLAND_PROPS ${component}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n const when = options.when ?? \"load\";\n if (\n ![\"load\", \"idle\", \"visible\", \"media\"].includes(when) ||\n (when === \"media\" && !options.media?.trim()) ||\n (when !== \"media\" && options.media !== undefined)\n )\n fail(\"ZR_ISLAND_WHEN\", context, when);\n const marker = options.skipSsr ? \"data-zfb-island-skip-ssr\" : \"data-zfb-island\";\n const attrs = ` ${marker}=\"${escapeAttribute(options.identity.component)}\" data-when=\"${when}\"${when === \"media\" ? ` data-media=\"${escapeAttribute(options.media!)}\"` : \"\"} data-zfb-transport=\"json/1\" data-zfb-protocol=\"zudo-react/1\" data-zfb-build=\"${escapeAttribute(options.identity.build)}\" data-props=\"${escapeAttribute(payload)}\"`;\n const local: Context = {\n radioGroups: new Map(),\n radioNames: new Map(),\n formId: \"\",\n nextFormId: 0,\n identity: options.skipSsr ? undefined : options.identity,\n boundary: true,\n next: 0,\n scope: context.scope,\n path: context.path,\n };\n const content = options.skipSsr\n ? children(options.fallback, local, namespace, \"div\")\n : render({ ...child, props }, local, \"html\", \"div\");\n validateRadioGroups(local);\n return `<div${attrs}>${content}</div>`;\n}\nfunction validateRadioGroups(context: Context): void {\n for (const group of context.radioGroups.values())\n if (group.value !== null && !group.options.has(group.value))\n fail(\"ZR_MODEL_VALUE\", context, `radio has no option ${group.value}`);\n}\nexport function renderHtml(node: Child, options: RenderOptions): string {\n const root = createScope({ component: options.island?.component ?? \"<root>\" });\n const context: Context = {\n radioGroups: new Map(),\n radioNames: new Map(),\n formId: \"\",\n nextFormId: 0,\n identity: options.island,\n boundary: options.island !== undefined,\n next: 0,\n scope: root,\n path: \"root\",\n };\n try {\n const html = render(node, context, \"html\", \"\");\n validateRadioGroups(context);\n return html;\n } finally {\n root.dispose();\n }\n}\n"]}
1
+ {"version":3,"file":"render-html.js","sourceRoot":"","sources":["../../src/zudo-react/render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ACX,IAAI,EAAE,MAAM;KACb,CAAC;IACF,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QAC/C,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;AACH,CAAC","sourcesContent":["import { serializeStyle } from \"./style.js\";\nimport {\n Fragment,\n descriptionSite,\n isDescription,\n type Child,\n type Description,\n type DescriptionSite,\n} from \"./description.js\";\nimport { escapeAttribute, escapeText } from \"./escape.js\";\nimport { rawHtmlReserved } from \"./raw-html.js\";\nimport type { IslandIdentity } from \"./index.js\";\nimport { readSnapshot } from \"./reactive.js\";\nimport type { ReadonlySignal } from \"./reactive-types.js\";\nimport { createScope, withScope, type RuntimeScope } from \"./scope.js\";\nimport { emptyChildren, normalizeProps } from \"./props-transport.js\";\nimport { islandRootType } from \"./island-root-type.js\";\nimport type { IslandOptions, RenderOptions } from \"./server.js\";\nimport {\n isShowType,\n isForType,\n showProps,\n forProps,\n keyed,\n keyPayload,\n view,\n} from \"./structure.js\";\nimport {\n attributeError,\n attributeText,\n booleanAttrs,\n commonAttrs,\n dialectSuggestion,\n emptyIframeChildren,\n formProps,\n htmlAttrs,\n htmlTags,\n isDialectProp,\n reactiveModelSuggestion,\n svgAttrs,\n svgTags,\n type Namespace,\n voidTags,\n} from \"./vocabulary.js\";\n\nconst words = (value: string) => new Set(value.split(\" \"));\nconst reserved = words(\"key ref children rawHtml\");\nconst sensitive = words(\"noscript xmp iframe noembed noframes plaintext\");\nconst tableChildren: Record<string, Set<string>> = {\n table: words(\"caption colgroup thead tbody tfoot\"),\n thead: words(\"tr\"),\n tbody: words(\"tr\"),\n tfoot: words(\"tr\"),\n tr: words(\"td th\"),\n colgroup: words(\"col\"),\n};\ninterface Context {\n identity: IslandIdentity | undefined;\n boundary: boolean;\n next: number;\n scope: RuntimeScope;\n path: string;\n node?: Description | undefined;\n selectValue?: string | undefined;\n selectSeen?: Set<string> | undefined;\n selectMatches?: number | undefined;\n radioGroups: Map<\n unknown,\n { name: string; form: string; value: string | null; options: Set<string> }\n >;\n radioNames: Map<string, unknown>;\n formId: string;\n nextFormId: number;\n}\nexport interface RenderDiagnostic {\n readonly code: string;\n readonly path: string;\n readonly component: string;\n readonly spelling?: { readonly name: string; readonly suggestion?: string };\n readonly site?: DescriptionSite;\n}\nfunction fail(\n code: string,\n context: Context,\n detail: string,\n spelling?: RenderDiagnostic[\"spelling\"],\n): never {\n const component = context.identity?.component ?? \"static render\";\n const site = context.node && descriptionSite(context.node);\n const diagnostic: RenderDiagnostic = {\n code,\n path: context.path,\n component,\n ...(spelling && { spelling }),\n ...(site && { site }),\n };\n throw Object.assign(new TypeError(`${code}: ${detail} at ${context.path} in ${component}`), {\n diagnostic,\n });\n}\nfunction reactive(value: unknown): value is ReadonlySignal<unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"$$zudoReactive\" in value &&\n value.$$zudoReactive === \"zudo-react.reactive.v1\"\n );\n}\nfunction read(value: unknown): unknown {\n return reactive(value) ? readSnapshot(value) : value;\n}\nfunction region(context: Context, kind: string, content: () => string): string {\n if (!context.identity) return content();\n const id = context.next++;\n return `<!--zr:1:${id}:${kind}-->${content()}<!--/zr:1:${id}-->`;\n}\nfunction at<T>(context: Context, part: string, fn: () => T): T {\n const old = context.path;\n context.path += part;\n try {\n return fn();\n } finally {\n context.path = old;\n }\n}\nfunction children(value: unknown, context: Context, namespace: Namespace, parent: string): string {\n if (value == null || typeof value === \"boolean\") return \"\";\n if (Array.isArray(value))\n return value\n .map((item, index) =>\n at(context, `[${index}]`, () => render(item, context, namespace, parent)),\n )\n .join(\"\");\n return render(value, context, namespace, parent);\n}\nfunction renderText(value: unknown, context: Context): string {\n if (value == null || typeof value === \"boolean\") return \"\";\n if (typeof value === \"string\" || (typeof value === \"number\" && Number.isFinite(value)))\n return escapeText(String(value));\n fail(\"ZR_CHILD\", context, `invalid scalar ${typeof value}`);\n}\nfunction style(value: unknown, context: Context): string {\n try {\n return serializeStyle(value);\n } catch (error) {\n if (error instanceof TypeError)\n fail(\"ZR_STYLE\", context, error.message.replace(/^ZR_STYLE: /, \"\"));\n throw error;\n }\n}\nfunction attributes(\n tag: string,\n props: Readonly<Record<string, unknown>>,\n context: Context,\n namespace: Namespace,\n custom: boolean,\n): string {\n let output = \"\";\n for (const [name, original] of Object.entries(props)) {\n if (reserved.has(name)) continue;\n if (formProps.has(name)) continue;\n if (isDialectProp(name, namespace, custom)) {\n const suggestion = dialectSuggestion(name, namespace, custom);\n fail(\n \"ZR_PROP_DIALECT\",\n context,\n `${tag}.${name}${suggestion ? ` (use \\`${suggestion}\\` instead of \\`${name}\\`)` : \"\"}`,\n suggestion ? { name, suggestion } : { name },\n );\n }\n if (name.startsWith(\"on:\")) {\n if (!/^on:[A-Za-z][A-Za-z0-9_-]*(?::capture)?$/.test(name))\n fail(\"ZR_LISTENER\", context, `${tag}.${name}`);\n if (typeof original !== \"function\") fail(\"ZR_LISTENER\", context, `${tag}.${name}`);\n const inline = `on${name.slice(3).replace(/:capture$/, \"\")}`;\n if (inline in props) fail(\"ZR_LISTENER_CONFLICT\", context, `${tag}.${inline}`);\n continue;\n }\n if (!/^[A-Za-z_:][A-Za-z0-9_:.-]*$/.test(name)) fail(\"ZR_ATTRIBUTE\", context, `${tag}.${name}`);\n if (\n !custom &&\n !commonAttrs.has(name) &&\n !(namespace === \"svg\" ? svgAttrs.has(name) : htmlAttrs.has(name)) &&\n !/^data-[\\w.-]+$/.test(name) &&\n !/^aria-[\\w.-]+$/.test(name) &&\n !/^on[a-z]+$/.test(name)\n )\n fail(\"ZR_ATTRIBUTE\", context, `${tag}.${name}`);\n const value = read(original);\n if ((name === \"value\" || name === \"checked\") && reactive(original)) {\n const suggestion = reactiveModelSuggestion(\n tag,\n name,\n String(read(props.type) ?? \"text\"),\n custom,\n );\n fail(\n \"ZR_MODEL_UNSUPPORTED\",\n context,\n `${tag}.${name} requires ${suggestion ?? \"a static value\"}`,\n );\n }\n if (/^on[a-z]/.test(name) && typeof value === \"function\")\n fail(\"ZR_PROP_DIALECT\", context, `${tag}.${name} must use on:${name.slice(2)}`, {\n name,\n suggestion: `on:${name.slice(2)}`,\n });\n const error = attributeError(name, value, custom);\n if (error) fail(\"ZR_ATTRIBUTE\", context, `${tag}.${name} ${error}`);\n if (value == null) continue;\n const text = name === \"style\" ? style(value, context) : attributeText(name, value);\n if (text === null) continue;\n output +=\n booleanAttrs.has(name) && value === true ? ` ${name}` : ` ${name}=\"${escapeAttribute(text)}\"`;\n }\n return output;\n}\nfunction restricted(\n value: unknown,\n context: Context,\n namespace: Namespace,\n parent: string,\n): string {\n return tracked(value, context, () => restrictedValue(value, context, namespace, parent));\n}\nfunction restrictedValue(\n value: unknown,\n context: Context,\n namespace: Namespace,\n parent: string,\n): string {\n if (value == null || typeof value === \"boolean\") return \"\";\n if (Array.isArray(value))\n return value\n .map((item, index) =>\n at(context, `[${index}]`, () => restricted(item, context, namespace, parent)),\n )\n .join(\"\");\n if (typeof value === \"string\" || typeof value === \"number\") {\n if (parent in tableChildren && String(value).trim())\n fail(\"ZR_PARSER_CONTEXT\", context, `${parent} text`);\n return renderText(value, context);\n }\n if (parent === \"title\" || parent === \"option\")\n fail(\"ZR_PARSER_CONTEXT\", context, `${parent} requires static text`);\n if (!isDescription(value) || typeof value.type !== \"string\")\n fail(\"ZR_PARSER_CONTEXT\", context, `${parent} requires intrinsic children`);\n return element(value, context, namespace, parent);\n}\nfunction element(\n description: Description,\n context: Context,\n namespace: Namespace,\n parent: string,\n): string {\n const tag = description.type as string;\n const custom = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(tag);\n const elementNamespace = tag === \"svg\" || namespace === \"svg\" ? \"svg\" : \"html\";\n const childNamespace = tag === \"foreignObject\" ? \"html\" : elementNamespace;\n if (elementNamespace === \"svg\" ? !svgTags.has(tag) : !custom && !htmlTags.has(tag))\n fail(\"ZR_TAG\", context, tag);\n if (context.identity && (tag === \"template\" || (tag !== \"iframe\" && sensitive.has(tag))))\n fail(\"ZR_PARSER_CONTEXT\", context, tag);\n if (parent in tableChildren && !tableChildren[parent]?.has(tag))\n fail(\"ZR_PARSER_CONTEXT\", context, `${parent} > ${tag}`);\n if (\n (parent === \"select\" && tag !== \"option\" && tag !== \"optgroup\") ||\n (parent === \"optgroup\" && tag !== \"option\")\n )\n fail(\"ZR_PARSER_CONTEXT\", context, `${parent} > ${tag}`);\n const previousFormId = context.formId;\n if (tag === \"form\")\n context.formId =\n typeof description.props.id === \"string\"\n ? `id:${description.props.id}`\n : `form:${context.nextFormId++}`;\n const source = description.props;\n const props: Record<string, unknown> = { ...source };\n if (tag === \"iframe\") {\n if (Object.hasOwn(props, \"rawHtml\")) fail(\"ZR_RAW_HTML\", context, \"iframe forbids rawHtml\");\n if (!emptyIframeChildren(props.children))\n fail(\"ZR_PARSER_CONTEXT\", context, \"iframe requires empty children\");\n }\n const hasValue = source.modelValue !== undefined;\n const hasChecked = source.modelChecked !== undefined;\n if (\n (hasValue && hasChecked) ||\n (source.defaultValue !== undefined && source.value !== undefined) ||\n (source.defaultChecked !== undefined && source.checked !== undefined) ||\n (hasValue &&\n (source.defaultValue !== undefined ||\n (source.type !== \"radio\" && source.value !== undefined))) ||\n (hasChecked && (source.defaultChecked !== undefined || source.checked !== undefined))\n )\n fail(\"ZR_MODEL_CONFLICT\", context, tag);\n if (hasValue || hasChecked) {\n for (const name of [\"type\", \"multiple\", \"name\", \"form\"])\n if (reactive(source[name])) fail(\"ZR_MODEL_UNSUPPORTED\", context, `reactive ${name} shape`);\n const model = hasValue ? source.modelValue : source.modelChecked;\n let prototype = model;\n let writable = false;\n while (prototype && typeof prototype === \"object\") {\n const property = Object.getOwnPropertyDescriptor(prototype, \"value\");\n if (property) {\n writable = typeof property.set === \"function\";\n break;\n }\n prototype = Object.getPrototypeOf(prototype);\n }\n if (\n !reactive(model) ||\n !writable ||\n !(\"$$zudoWritable\" in model) ||\n model.$$zudoWritable !== \"zudo-react.writable.v1\"\n )\n fail(\"ZR_MODEL_READONLY\", context, tag);\n }\n if ((hasValue || hasChecked) && source.contenteditable !== undefined)\n fail(\"ZR_MODEL_UNSUPPORTED\", context, `${tag}[contenteditable]`);\n const inputType = String(source.type ?? \"text\");\n if (\n hasValue &&\n !(\n tag === \"textarea\" ||\n tag === \"select\" ||\n (tag === \"input\" &&\n [\"text\", \"search\", \"email\", \"url\", \"tel\", \"password\", \"radio\"].includes(inputType))\n )\n )\n fail(\"ZR_MODEL_UNSUPPORTED\", context, `${tag}[type=${inputType}]`);\n if (hasChecked && !(tag === \"input\" && inputType === \"checkbox\"))\n fail(\"ZR_MODEL_UNSUPPORTED\", context, tag);\n if (\n source.defaultValue !== undefined &&\n !(tag === \"textarea\" || tag === \"select\" || tag === \"input\")\n )\n fail(\"ZR_MODEL_UNSUPPORTED\", context, tag);\n if (\n source.defaultValue !== undefined &&\n tag === \"input\" &&\n ![\"text\", \"search\", \"email\", \"url\", \"tel\", \"password\"].includes(inputType)\n )\n fail(\"ZR_MODEL_UNSUPPORTED\", context, `${tag}[type=${inputType}]`);\n if (\n source.defaultChecked !== undefined &&\n !(tag === \"input\" && [\"checkbox\", \"radio\"].includes(inputType))\n )\n fail(\"ZR_MODEL_UNSUPPORTED\", context, tag);\n if (tag === \"input\") {\n if (source.defaultValue !== undefined || (hasValue && inputType !== \"radio\"))\n props.value = read(source.modelValue ?? source.defaultValue);\n if (source.defaultChecked !== undefined || hasChecked)\n props.checked = read(source.modelChecked ?? source.defaultChecked);\n if (hasValue && inputType === \"radio\") {\n if (typeof source.name !== \"string\" || !source.name || typeof source.value !== \"string\")\n fail(\"ZR_MODEL_UNSUPPORTED\", context, \"radio requires static name and value\");\n const selected = read(source.modelValue);\n if (selected !== null && typeof selected !== \"string\")\n fail(\"ZR_MODEL_VALUE\", context, \"radio requires string or null\");\n const form = typeof source.form === \"string\" ? `id:${source.form}` : context.formId;\n const key = `${source.name}\\u0000${form}`;\n const owner = context.radioNames.get(key);\n if (owner && owner !== source.modelValue)\n fail(\"ZR_MODEL_CONFLICT\", context, \"same-name radios use different models\");\n context.radioNames.set(key, source.modelValue);\n const group = context.radioGroups.get(source.modelValue);\n if (\n group &&\n (group.name !== source.name || group.form !== form || group.options.has(source.value))\n )\n fail(\"ZR_MODEL_CONFLICT\", context, \"radio membership or duplicate value\");\n if (group) group.options.add(source.value);\n else\n context.radioGroups.set(source.modelValue, {\n name: source.name,\n form,\n value: selected,\n options: new Set([source.value]),\n });\n props.checked = selected === source.value;\n }\n }\n if (tag === \"option\" && context.selectValue !== undefined) {\n const value = source.value;\n if (typeof value !== \"string\")\n fail(\"ZR_MODEL_UNSUPPORTED\", context, \"select option requires static value\");\n if (context.selectSeen!.has(value))\n fail(\"ZR_MODEL_CONFLICT\", context, \"duplicate option value\");\n context.selectSeen!.add(value);\n if (source.selected !== undefined)\n fail(\"ZR_MODEL_CONFLICT\", context, \"select-level value with option selected\");\n props.selected = value === context.selectValue;\n if (props.selected) context.selectMatches = (context.selectMatches ?? 0) + 1;\n }\n if (context.boundary && (\"data-zfb-island\" in props || \"data-zfb-island-skip-ssr\" in props))\n fail(\"ZR_NESTED_ISLAND\", context, tag);\n if (\n tag === \"select\" &&\n read(props.multiple) === true &&\n (context.identity || hasValue || source.defaultValue !== undefined)\n )\n fail(\"ZR_MODEL_UNSUPPORTED\", context, \"select[multiple]\");\n const attrs = attributes(tag, props, context, elementNamespace, custom);\n const raw = props.rawHtml;\n const hasChildren = Object.hasOwn(props, \"children\");\n if (raw !== undefined && hasChildren)\n fail(\"ZR_RAW_HTML\", context, `${tag} has children and rawHtml`);\n if (voidTags.has(tag) && (hasChildren || raw !== undefined))\n fail(\"ZR_VOID_CHILDREN\", context, tag);\n if (\n raw !== undefined &&\n (elementNamespace === \"svg\" ||\n tag === \"textarea\" ||\n tag === \"title\" ||\n tag === \"select\" ||\n tag === \"option\")\n )\n fail(\"ZR_RAW_HTML\", context, tag);\n if (tag === \"textarea\" && hasChildren && (hasValue || source.defaultValue !== undefined))\n fail(\"ZR_MODEL_CONFLICT\", context, tag);\n let content = \"\";\n if (raw !== undefined) {\n if ((tag === \"script\" || tag === \"style\") && reactive(raw))\n fail(\"ZR_RAW_HTML\", context, `${tag} requires static rawHtml`);\n const payload = read(raw);\n if (typeof payload !== \"string\") fail(\"ZR_RAW_HTML\", context, `${tag} requires string rawHtml`);\n if (rawHtmlReserved(payload, tag)) fail(\"ZR_RAW_HTML\", context, \"reserved boundary in rawHtml\");\n if (\n (tag === \"script\" && /<\\/script/i.test(payload)) ||\n (tag === \"style\" && /<\\/style/i.test(payload))\n )\n fail(\"ZR_RAW_HTML\", context, `closing ${tag} in rawHtml`);\n content = tag === \"script\" || tag === \"style\" ? payload : region(context, \"h\", () => payload);\n } else if (tag === \"textarea\" && (hasValue || source.defaultValue !== undefined)) {\n const value = read(source.modelValue ?? source.defaultValue);\n if (typeof value !== \"string\") fail(\"ZR_MODEL_VALUE\", context, \"textarea requires string\");\n content = `${value.startsWith(\"\\n\") ? \"\\n\" : \"\"}${escapeText(value)}`;\n } else if (tag === \"iframe\") {\n // The shell has no owned children; srcdoc belongs to the browser's foreign document.\n } else if (tag === \"script\" || tag === \"style\") {\n if (hasChildren) fail(\"ZR_RAW_HTML\", context, `${tag} requires rawHtml`);\n } else if (\n tag === \"title\" ||\n tag === \"option\" ||\n tag === \"optgroup\" ||\n tag === \"select\" ||\n tag in tableChildren\n ) {\n if (tag === \"select\" && (hasValue || source.defaultValue !== undefined)) {\n const value = read(source.modelValue ?? source.defaultValue);\n if (typeof value !== \"string\") fail(\"ZR_MODEL_VALUE\", context, \"select requires string\");\n const oldValue = context.selectValue;\n const oldSeen = context.selectSeen;\n const oldMatches = context.selectMatches;\n context.selectValue = value;\n context.selectSeen = new Set();\n context.selectMatches = 0;\n try {\n content = restricted(props.children, context, childNamespace, tag);\n if (context.selectMatches !== 1)\n fail(\"ZR_MODEL_VALUE\", context, `select has no option ${value}`);\n } finally {\n context.selectValue = oldValue;\n context.selectSeen = oldSeen;\n context.selectMatches = oldMatches;\n }\n } else content = restricted(props.children, context, childNamespace, tag);\n } else content = children(props.children, context, childNamespace, tag);\n if (tag === \"pre\" && raw === undefined && (content.startsWith(\"\\n\") || content.startsWith(\"\\r\")))\n content = `\\n${content}`;\n context.formId = previousFormId;\n return `<${tag}${attrs}>${voidTags.has(tag) ? \"\" : `${content}</${tag}>`}`;\n}\n// A failure is attributed only to the value being rendered: a description's own site,\n// or no site at all for scalars, promises and other non-description children.\nfunction tracked<T>(value: unknown, context: Context, fn: () => T): T {\n const prior = context.node;\n context.node = isDescription(value) ? value : undefined;\n try {\n return fn();\n } finally {\n context.node = prior;\n }\n}\nfunction render(value: unknown, context: Context, namespace: Namespace, parent: string): string {\n return tracked(value, context, () => renderValue(value, context, namespace, parent));\n}\nfunction renderValue(\n value: unknown,\n context: Context,\n namespace: Namespace,\n parent: string,\n): string {\n if (value == null || typeof value === \"boolean\") return \"\";\n if (Array.isArray(value))\n return region(context, \"f\", () => children(value, context, namespace, parent));\n if (reactive(value)) return region(context, \"t\", () => renderText(read(value), context));\n if (typeof value === \"string\" || typeof value === \"number\") return renderText(value, context);\n if (typeof value === \"object\" && value !== null && \"then\" in value)\n fail(\"ZR_ASYNC_COMPONENT\", context, \"promise child\");\n if (!isDescription(value)) fail(\"ZR_CHILD\", context, typeof value);\n if ((value.type as symbol | typeof value.type) === islandRootType)\n return island(value, context, namespace, parent);\n if (value.type === Fragment)\n return region(context, \"f\", () => children(value.props.children, context, namespace, parent));\n if (isShowType(value.type)) {\n if (\n parent in tableChildren ||\n [\"select\", \"optgroup\", \"option\", \"title\", \"textarea\", \"script\", \"style\"].includes(parent)\n )\n fail(\"ZR_PARSER_CONTEXT\", context, parent);\n const props = showProps(value);\n if (\n !reactive(props.when) ||\n typeof props.children !== \"function\" ||\n (props.fallback !== undefined && typeof props.fallback !== \"function\")\n )\n fail(\"ZR_CHILD\", context, \"Show requires signal and factories\");\n const selected = read(props.when);\n if (typeof selected !== \"boolean\") fail(\"ZR_CHILD\", context, \"Show.when requires boolean\");\n return region(context, `s:${selected ? 1 : 0}`, () => {\n const factory = selected ? props.children : props.fallback;\n if (!factory) return \"\";\n const scope = context.scope.child(\"Show\");\n const previous = context.scope;\n context.scope = scope;\n try {\n return withScope(scope, () => render(factory(), context, namespace, parent));\n } finally {\n context.scope = previous;\n }\n });\n }\n if (isForType(value.type)) {\n if (\n parent in tableChildren ||\n [\"select\", \"optgroup\", \"option\", \"title\", \"textarea\", \"script\", \"style\"].includes(parent)\n )\n fail(\"ZR_PARSER_CONTEXT\", context, parent);\n const props = forProps<unknown>(value);\n if (\n !reactive(props.each) ||\n typeof props.by !== \"function\" ||\n typeof props.children !== \"function\"\n )\n fail(\"ZR_CHILD\", context, \"For requires signal, key and factory\");\n const items = read(props.each);\n if (!Array.isArray(items)) fail(\"ZR_CHILD\", context, \"For.each requires array\");\n const keys = keyed(items, props.by, context.path);\n return region(context, \"l\", () =>\n items\n .map((item, index) => {\n const scope = context.scope.child(\"For\");\n const previous = context.scope;\n context.scope = scope;\n try {\n return region(context, `i:${keyPayload(keys[index]!)}`, () =>\n withScope(scope, () =>\n render(\n props.children(view(item).value, view(index).value),\n context,\n namespace,\n parent,\n ),\n ),\n );\n } finally {\n context.scope = previous;\n }\n })\n .join(\"\"),\n );\n }\n if (typeof value.type === \"string\") return element(value, context, namespace, parent);\n const component = value.type;\n const scope = context.scope.child(component.name || \"Anonymous\");\n const prior = context.scope;\n context.scope = scope;\n try {\n return region(context, \"c\", () => {\n const output = withScope(scope, () => component(value.props));\n if (output && typeof output === \"object\" && \"then\" in output)\n fail(\"ZR_ASYNC_COMPONENT\", context, component.name);\n return render(output, context, namespace, parent);\n });\n } finally {\n context.scope = prior;\n }\n}\nfunction island(\n description: Description,\n context: Context,\n namespace: Namespace,\n parent: string,\n): string {\n if (context.boundary) fail(\"ZR_NESTED_ISLAND\", context, \"nested island\");\n if (namespace !== \"html\" || parent === \"p\" || parent in tableChildren || parent === \"select\")\n fail(\"ZR_PARSER_CONTEXT\", context, \"island wrapper\");\n const child = description.props.child;\n const options = description.props.options as IslandOptions;\n if (!isDescription(child) || typeof child.type !== \"function\")\n fail(\"ZR_ISLAND_CHILD\", context, \"one function component required\");\n if (!options?.identity?.component || !options.identity.build)\n fail(\"ZR_ISLAND_IDENTITY\", context, \"component/build required\");\n const component =\n (child.type as typeof child.type & { displayName?: string }).displayName ?? child.type.name;\n if (component !== options.identity.component)\n fail(\"ZR_ISLAND_IDENTITY\", context, `expected ${options.identity.component}, got ${component}`);\n if (Object.hasOwn(child.props, \"children\") && !emptyChildren(child.props.children))\n fail(\"ZR_ISLAND_CHILD\", context, \"nonempty children\");\n let props: Record<string, unknown>;\n let payload: string;\n try {\n props = normalizeProps(child.props);\n payload = JSON.stringify(props);\n } catch (error) {\n throw new TypeError(\n `ZR_ISLAND_PROPS ${component}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n const when = options.when ?? \"load\";\n if (\n ![\"load\", \"idle\", \"visible\", \"media\"].includes(when) ||\n (when === \"media\" && !options.media?.trim()) ||\n (when !== \"media\" && options.media !== undefined)\n )\n fail(\"ZR_ISLAND_WHEN\", context, when);\n if (\n options.persist !== undefined &&\n (typeof options.persist !== \"string\" ||\n !options.persist.trim() ||\n options.persist !== options.persist.trim() ||\n /[\\u0000-\\u001f\\u007f]/.test(options.persist))\n )\n fail(\n \"ZR_ISLAND_PERSIST\",\n context,\n \"persist must be a nonempty string without surrounding whitespace or control characters\",\n );\n if (options.persistProps !== undefined && typeof options.persistProps !== \"boolean\")\n fail(\"ZR_ISLAND_PERSIST\", context, \"persistProps must be a boolean\");\n if (options.persistProps !== undefined && options.persist === undefined)\n fail(\"ZR_ISLAND_PERSIST\", context, \"persistProps requires persist\");\n const marker = options.skipSsr ? \"data-zfb-island-skip-ssr\" : \"data-zfb-island\";\n const attrs = ` ${marker}=\"${escapeAttribute(options.identity.component)}\" data-when=\"${when}\"${when === \"media\" ? ` data-media=\"${escapeAttribute(options.media!)}\"` : \"\"} data-zfb-transport=\"json/1\" data-zfb-protocol=\"zudo-react/1\" data-zfb-build=\"${escapeAttribute(options.identity.build)}\" data-props=\"${escapeAttribute(payload)}\"${options.persist === undefined ? \"\" : ` data-zfb-transition-persist=\"${escapeAttribute(options.persist)}\"`}${options.persistProps === true ? ' data-zfb-transition-persist-props=\"true\"' : \"\"}`;\n const local: Context = {\n radioGroups: new Map(),\n radioNames: new Map(),\n formId: \"\",\n nextFormId: 0,\n identity: options.skipSsr ? undefined : options.identity,\n boundary: true,\n next: 0,\n scope: context.scope,\n path: context.path,\n };\n const content = options.skipSsr\n ? children(options.fallback, local, namespace, \"div\")\n : render({ ...child, props }, local, \"html\", \"div\");\n validateRadioGroups(local);\n return `<div${attrs}>${content}</div>`;\n}\nfunction validateRadioGroups(context: Context): void {\n for (const group of context.radioGroups.values())\n if (group.value !== null && !group.options.has(group.value))\n fail(\"ZR_MODEL_VALUE\", context, `radio has no option ${group.value}`);\n}\nexport function renderHtml(node: Child, options: RenderOptions): string {\n const root = createScope({ component: options.island?.component ?? \"<root>\" });\n const context: Context = {\n radioGroups: new Map(),\n radioNames: new Map(),\n formId: \"\",\n nextFormId: 0,\n identity: options.island,\n boundary: options.island !== undefined,\n next: 0,\n scope: root,\n path: \"root\",\n };\n try {\n const html = render(node, context, \"html\", \"\");\n validateRadioGroups(context);\n return html;\n } finally {\n root.dispose();\n }\n}\n"]}
@@ -2,9 +2,32 @@ export const ROOT_KEY = Symbol.for("@takazudo/zfb/zudo-react/root-v1");
2
2
  export function storedRoot(container) {
3
3
  return container[ROOT_KEY];
4
4
  }
5
+ const phaseMessages = {
6
+ setup: "root setup failed",
7
+ preflight: "root validation failed",
8
+ commit: "root commit failed",
9
+ activation: "activation failed",
10
+ update: "reactive update failed",
11
+ cleanup: "cleanup failed",
12
+ };
13
+ function diagnosticLine(value) {
14
+ // Only runtime-shaped identifiers and DOM paths belong on the searchable line.
15
+ // The structured object retains the full details for inspection.
16
+ const code = /^ZR_[A-Z0-9_]+$/.test(value.code) ? value.code : "ZR_UNKNOWN";
17
+ const phase = Object.hasOwn(phaseMessages, value.phase) ? value.phase : "setup";
18
+ const component = /^[A-Za-z_$][\w$.-]*$/.test(value.component) ? value.component : "[component]";
19
+ const path = /^\/[a-z][a-z0-9-]*:nth-child\(\d+\)(?:\/[a-z#][a-z0-9#-]*(?::nth-child\(\d+\))?(?:\[\d+\])?)*$/.test(value.path)
20
+ ? value.path
21
+ : "[path]";
22
+ const message = code === "ZR_HYDRATION_MISMATCH" ? "hydration mismatch" : phaseMessages[phase];
23
+ return `[zudo-react] ${code} ${phase} ${component} ${path}: ${message}`;
24
+ }
5
25
  export function report(options, diagnostic) {
6
26
  try {
7
- (options.report ?? ((value) => console.error(value)))(diagnostic);
27
+ if (options.report)
28
+ options.report(diagnostic);
29
+ else
30
+ console.error(diagnosticLine(diagnostic), diagnostic);
8
31
  }
9
32
  catch (error) {
10
33
  console.error(error);
@@ -1 +1 @@
1
- {"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/zudo-react/root.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AAEvE,MAAM,UAAU,UAAU,CAAC,SAAkB;IAC3C,OAAQ,SAAyB,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC;AACD,MAAM,UAAU,MAAM,CAAC,OAAoB,EAAE,UAAsB;IACjE,IAAI,CAAC;QACH,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IACpE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC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AQ,EAAE,cAAc;QACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,IAAI,QAAQ;YACV,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,OAAO;YACL,IAAI,QAAQ;gBAAE,OAAO;YACrB,QAAQ,GAAG,IAAI,CAAC;YAChB,KAAK,MAAM,OAAO,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;gBAC9C,IAAI,CAAC;oBACH,OAAO,EAAE,CAAC;gBACZ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,CACJ,OAAO,EACP,UAAU,CACR,OAAO,EACP,kBAAkB,EAClB,SAAS,EACT,QAAQ,CAAC,SAAS,CAAC,EACnB,SAAS,EACT,MAAM,CAAC,KAAK,CAAC,CACd,CACF,CAAC;gBACJ,CAAC;YACH,CAAC;YACD,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;QACD,OAAO;YACL,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,OAAO,IAAI,UAAU,CAAC,SAAS,CAAC,KAAK,MAAM;gBAAE,OAAO;YACxD,OAAO,GAAG,IAAI,CAAC;YACf,KAAK,MAAM,IAAI,IAAI,KAAK;gBAAE,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS;oBAAE,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACzF,IAAI,UAAU,CAAC,SAAS,CAAC,KAAK,MAAM;gBAAE,OAAQ,SAAyB,CAAC,QAAQ,CAAC,CAAC;QACpF,CAAC;KACF,CAAC;IACD,SAAyB,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IAC9C,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { Diagnostic, IslandIdentity, Reporter } from \"./index.js\";\nimport type { RuntimeScope } from \"./scope.js\";\n\nexport interface RootOptions {\n identity: IslandIdentity;\n signal?: AbortSignal | undefined;\n report?: Reporter | undefined;\n}\nexport interface RootHandle {\n readonly protocol: \"zudo-react/1\";\n readonly identity: IslandIdentity;\n readonly disposed: boolean;\n dispose(): void;\n unmount(): void;\n}\nexport const ROOT_KEY = Symbol.for(\"@takazudo/zfb/zudo-react/root-v1\");\ntype RootElement = Element & { [ROOT_KEY]?: RootHandle };\nexport function storedRoot(container: Element): RootHandle | undefined {\n return (container as RootElement)[ROOT_KEY];\n}\nexport function report(options: RootOptions, diagnostic: Diagnostic): void {\n try {\n (options.report ?? ((value) => console.error(value)))(diagnostic);\n } catch (error) {\n console.error(error);\n }\n}\nexport function diagnostic(\n options: RootOptions,\n code: string,\n phase: Diagnostic[\"phase\"],\n path: string,\n expected: string,\n actual: string,\n stack: readonly string[] = [options.identity.component],\n): Diagnostic {\n return {\n code,\n phase,\n component: stack.at(-1) ?? options.identity.component,\n componentStack: stack,\n path,\n expected,\n actual,\n protocol: \"zudo-react/1\",\n build: options.identity.build,\n };\n}\nexport function rootPath(element: Element): string {\n const parts: string[] = [];\n for (let node: Element | null = element; node; node = node.parentElement) {\n const index = node.parentElement\n ? Array.prototype.indexOf.call(node.parentElement.children, node) + 1\n : 1;\n parts.unshift(`${node.localName}:nth-child(${index})`);\n }\n return `/${parts.join(\"/\")}`;\n}\nexport function createRoot(\n container: Element,\n options: RootOptions,\n scope: RuntimeScope,\n cleanups: Array<() => void>,\n owned: readonly Node[],\n): RootHandle {\n let disposed = false;\n let removed = false;\n const handle: RootHandle = {\n protocol: \"zudo-react/1\",\n identity: options.identity,\n get disposed() {\n return disposed;\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n for (const cleanup of [...cleanups].reverse()) {\n try {\n cleanup();\n } catch (error) {\n report(\n options,\n diagnostic(\n options,\n \"ZR_CLEANUP_ERROR\",\n \"cleanup\",\n rootPath(container),\n \"cleanup\",\n String(error),\n ),\n );\n }\n }\n scope.dispose();\n },\n unmount() {\n handle.dispose();\n if (removed || storedRoot(container) !== handle) return;\n removed = true;\n for (const node of owned) if (node.parentNode === container) container.removeChild(node);\n if (storedRoot(container) === handle) delete (container as RootElement)[ROOT_KEY];\n },\n };\n (container as RootElement)[ROOT_KEY] = handle;\n return handle;\n}\n"]}
1
+ {"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/zudo-react/root.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AAEvE,MAAM,UAAU,UAAU,CAAC,SAAkB;IAC3C,OAAQ,SAAyB,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC;AACD,MAAM,aAAa,GAAwC;IACzD,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,wBAAwB;IACnC,MAAM,EAAE,oBAAoB;IAC5B,UAAU,EAAE,mBAAmB;IAC/B,MAAM,EAAE,wBAAwB;IAChC,OAAO,EAAE,gBAAgB;CAC1B,CAAC;AAEF,SAAS,cAAc,CAAC,KAAiB;IACvC,+EAA+E;IAC/E,iEAAiE;IACjE,MAAM,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC;IAC5E,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;IAChF,MAAM,SAAS,GAAG,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC;IACjG,MAAM,IAAI,GACR,gGAAgG,CAAC,IAAI,CACnG,KAAK,CAAC,IAAI,CACX;QACC,CAAC,CAAC,KAAK,CAAC,IAAI;QACZ,CAAC,CAAC,QAAQ,CAAC;IACf,MAAM,OAAO,GAAG,IAAI,KAAK,uBAAuB,CAAC,CAA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I,KAAK;gBAAE,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS;oBAAE,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACzF,IAAI,UAAU,CAAC,SAAS,CAAC,KAAK,MAAM;gBAAE,OAAQ,SAAyB,CAAC,QAAQ,CAAC,CAAC;QACpF,CAAC;KACF,CAAC;IACD,SAAyB,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IAC9C,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { Diagnostic, IslandIdentity, Reporter } from \"./index.js\";\nimport type { RuntimeScope } from \"./scope.js\";\n\nexport interface RootOptions {\n identity: IslandIdentity;\n signal?: AbortSignal | undefined;\n report?: Reporter | undefined;\n}\nexport interface RootHandle {\n readonly protocol: \"zudo-react/1\";\n readonly identity: IslandIdentity;\n readonly disposed: boolean;\n dispose(): void;\n unmount(): void;\n}\nexport const ROOT_KEY = Symbol.for(\"@takazudo/zfb/zudo-react/root-v1\");\ntype RootElement = Element & { [ROOT_KEY]?: RootHandle };\nexport function storedRoot(container: Element): RootHandle | undefined {\n return (container as RootElement)[ROOT_KEY];\n}\nconst phaseMessages: Record<Diagnostic[\"phase\"], string> = {\n setup: \"root setup failed\",\n preflight: \"root validation failed\",\n commit: \"root commit failed\",\n activation: \"activation failed\",\n update: \"reactive update failed\",\n cleanup: \"cleanup failed\",\n};\n\nfunction diagnosticLine(value: Diagnostic): string {\n // Only runtime-shaped identifiers and DOM paths belong on the searchable line.\n // The structured object retains the full details for inspection.\n const code = /^ZR_[A-Z0-9_]+$/.test(value.code) ? value.code : \"ZR_UNKNOWN\";\n const phase = Object.hasOwn(phaseMessages, value.phase) ? value.phase : \"setup\";\n const component = /^[A-Za-z_$][\\w$.-]*$/.test(value.component) ? value.component : \"[component]\";\n const path =\n /^\\/[a-z][a-z0-9-]*:nth-child\\(\\d+\\)(?:\\/[a-z#][a-z0-9#-]*(?::nth-child\\(\\d+\\))?(?:\\[\\d+\\])?)*$/.test(\n value.path,\n )\n ? value.path\n : \"[path]\";\n const message = code === \"ZR_HYDRATION_MISMATCH\" ? \"hydration mismatch\" : phaseMessages[phase];\n return `[zudo-react] ${code} ${phase} ${component} ${path}: ${message}`;\n}\n\nexport function report(options: RootOptions, diagnostic: Diagnostic): void {\n try {\n if (options.report) options.report(diagnostic);\n else console.error(diagnosticLine(diagnostic), diagnostic);\n } catch (error) {\n console.error(error);\n }\n}\nexport function diagnostic(\n options: RootOptions,\n code: string,\n phase: Diagnostic[\"phase\"],\n path: string,\n expected: string,\n actual: string,\n stack: readonly string[] = [options.identity.component],\n): Diagnostic {\n return {\n code,\n phase,\n component: stack.at(-1) ?? options.identity.component,\n componentStack: stack,\n path,\n expected,\n actual,\n protocol: \"zudo-react/1\",\n build: options.identity.build,\n };\n}\nexport function rootPath(element: Element): string {\n const parts: string[] = [];\n for (let node: Element | null = element; node; node = node.parentElement) {\n const index = node.parentElement\n ? Array.prototype.indexOf.call(node.parentElement.children, node) + 1\n : 1;\n parts.unshift(`${node.localName}:nth-child(${index})`);\n }\n return `/${parts.join(\"/\")}`;\n}\nexport function createRoot(\n container: Element,\n options: RootOptions,\n scope: RuntimeScope,\n cleanups: Array<() => void>,\n owned: readonly Node[],\n): RootHandle {\n let disposed = false;\n let removed = false;\n const handle: RootHandle = {\n protocol: \"zudo-react/1\",\n identity: options.identity,\n get disposed() {\n return disposed;\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n for (const cleanup of [...cleanups].reverse()) {\n try {\n cleanup();\n } catch (error) {\n report(\n options,\n diagnostic(\n options,\n \"ZR_CLEANUP_ERROR\",\n \"cleanup\",\n rootPath(container),\n \"cleanup\",\n String(error),\n ),\n );\n }\n }\n scope.dispose();\n },\n unmount() {\n handle.dispose();\n if (removed || storedRoot(container) !== handle) return;\n removed = true;\n for (const node of owned) if (node.parentNode === container) container.removeChild(node);\n if (storedRoot(container) === handle) delete (container as RootElement)[ROOT_KEY];\n },\n };\n (container as RootElement)[ROOT_KEY] = handle;\n return handle;\n}\n"]}
@@ -10,6 +10,8 @@ export interface IslandOptions {
10
10
  media?: string | undefined;
11
11
  skipSsr?: boolean | undefined;
12
12
  fallback?: Child;
13
+ persist?: string | undefined;
14
+ persistProps?: boolean | undefined;
13
15
  }
14
16
  export declare function islandRoot(child: Description, options: IslandOptions): Description;
15
17
  export declare function renderToString(node: Child, options?: RenderOptions): string;