@jxsuite/runtime 6.0.2 → 6.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.
@@ -12,9 +12,9 @@
12
12
  "/**\n * Deterministic mapping from Function-def `$src` module specifiers to bundled asset URLs, plus the\n * asset-mount math that publishes files living outside the project root at a stable site URL.\n * Shared between the compiler's sidecar bundler (which writes the bundle) and extension `lower()`\n * implementations (which emit the URL into client code) so neither needs to depend on the other.\n *\n * The mapping is intentionally hash-free: the same specifier always yields the same URL, letting\n * lowered defs reference bundles the compiler produces later in the build. Distinct specifiers that\n * collide on a slug are rejected by the bundler at build time.\n *\n * Pure string math only — no node imports — so browser hosts can import this module.\n */\n\nimport { isString } from \"./guards\";\n\n/** Prefix for npm package specifiers in `$src` (spec §12): `npm:<pkg>[/subpath]`. */\nexport const NPM_SPECIFIER_PREFIX = \"npm:\";\n\n/** URL directory (under the site root) where bundled sidecars are written. */\nexport const SIDECAR_ASSET_DIR = \"/assets/\";\n\n/** True when a `$src` specifier names an npm package rather than a project file. */\nexport function isNpmSpecifier(specifier: string): boolean {\n return specifier.startsWith(NPM_SPECIFIER_PREFIX);\n}\n\n/**\n * Map a Function-def `$src` specifier to its bundled asset URL.\n *\n * `npm:@jxsuite/search/client` → `/assets/jxsuite-search-client.js` `./lib/search-helpers.ts` →\n * `/assets/lib-search-helpers.js`\n */\nexport function sidecarAssetPath(specifier: string): string {\n let base = specifier;\n if (isNpmSpecifier(base)) {\n base = base.slice(NPM_SPECIFIER_PREFIX.length);\n }\n base = base\n .replace(/^\\.\\//, \"\")\n .replace(/\\.(js|ts|mjs|mts)$/, \"\")\n .replaceAll(\"@\", \"\")\n .replaceAll(/[/\\\\]+/g, \"-\")\n .replaceAll(/[^\\w.-]/g, \"-\")\n .replaceAll(/-+/g, \"-\")\n .replaceAll(/^-|-$/g, \"\");\n return `${SIDECAR_ASSET_DIR}${base}.js`;\n}\n\n/**\n * Map a bare npm specifier naming a **file** — a stylesheet, a font, a prebuilt script — to the URL\n * the build copies it to.\n *\n * Unlike {@link sidecarAssetPath} this keeps the extension, because the file is copied rather than\n * bundled and both the browser and the host dispatch on it.\n *\n * @docs framework/site/seo\n */\nexport function npmAssetPath(specifier: string): string {\n const ext = /\\.(\\w+)$/.exec(specifier)?.[1] ?? \"\";\n const base = specifier\n .replace(/\\.\\w+$/, \"\")\n .replaceAll(\"@\", \"\")\n .replaceAll(/[/\\\\]+/g, \"-\")\n .replaceAll(/[^\\w.-]/g, \"-\")\n .replaceAll(/-+/g, \"-\")\n .replaceAll(/^-|-$/g, \"\");\n return ext === \"\" ? `${SIDECAR_ASSET_DIR}${base}` : `${SIDECAR_ASSET_DIR}${base}.${ext}`;\n}\n\n// ─── Asset mounts (specs/extensions.md §8.5) ─────────────────────────────────\n\n/**\n * A site URL prefix backed by a real directory. Extensions declaring the `assets` capability return\n * mounts so hosts can publish files that live outside the project root (an external content\n * source's co-located images) without knowing anything about the section that owns them.\n */\nexport interface AssetMount {\n /** Site-absolute URL prefix, e.g. `/content/docs` (no trailing slash). */\n urlPrefix: string;\n /** Absolute directory the prefix maps onto. */\n dir: string;\n /**\n * Whether the mount serves a file, asked with the file's path relative to {@link dir},\n * `/`-separated. Absent means every file under the directory. A mount over a folder of notes sets\n * it so that what the collection leaves out (`exclude`, hidden files, unpublished documents) is\n * never reachable through the mount either: {@link assetUrlFor} gives a refused file no URL and\n * {@link resolveAssetUrl} resolves a refused URL to nothing, so no host serves or copies it. It is\n * a function, so it exists only where the mount was declared; a host that rebuilds a mount from\n * its two strings (a project-relative copy for Studio) gets none.\n */\n filter?: (path: string) => boolean;\n}\n\n/**\n * The project.json section key content types live under; also the URL namespace of their asset\n * mounts (`/content/<type>`). Shared by the parser's content loader, which declares the mounts, and\n * Studio's canvas, which rebuilds them in a browser.\n */\nexport const CONTENT_SECTION_KEY = \"content\";\n\n/** Content type names (and locale segments) safe to place in a URL path segment unescaped. */\nexport const SAFE_CONTENT_TYPE_NAME = /^[\\w.~-]+$/;\n\n/**\n * The placeholder a content type's `source` may carry to say \"one directory per locale\".\n *\n * `./blog/{locale}/` is one content type spread over N directories, not N content types. That\n * distinction is what keeps a translated post the same post: it keeps one schema, one set of\n * relationship targets, and one name in `$paths`, and differs only in which directory it was read\n * from — which is exactly the model `site-architecture.md` §13 uses for routes.\n */\nexport const LOCALE_PLACEHOLDER = \"{locale}\";\n\n/** Normalize a path or prefix for comparison: forward slashes, no trailing slash. */\nfunction normalizeDir(value: string): string {\n const forward = value.replaceAll(\"\\\\\", \"/\");\n return forward.length > 1 && forward.endsWith(\"/\") ? forward.slice(0, -1) : forward;\n}\n\n/** Normalize a mount's URL prefix: leading slash, no trailing slash. */\nexport function normalizeAssetPrefix(prefix: string): string {\n const forward = normalizeDir(prefix);\n return forward.startsWith(\"/\") ? forward : `/${forward}`;\n}\n\n/** Mounts sorted so the most specific (longest) candidate matches first. */\nfunction bySpecificity(mounts: readonly AssetMount[], key: \"dir\" | \"urlPrefix\"): AssetMount[] {\n return [...mounts].toSorted((a, b) => b[key].length - a[key].length);\n}\n\n/** True when `path` is `dir` itself or sits underneath it (both already normalized). */\nfunction isUnder(path: string, dir: string): boolean {\n return path === dir || path.startsWith(`${dir}/`);\n}\n\n/**\n * Map an absolute file path to its mounted site URL, or null when no mount contains it. Path\n * segments are percent-encoded so the URL survives HTML attributes; `resolveAssetUrl` reverses it.\n *\n * @param {readonly AssetMount[]} mounts\n * @param {string} absolutePath - Absolute filesystem path\n * @returns {string | null}\n */\nexport function assetUrlFor(mounts: readonly AssetMount[], absolutePath: string): string | null {\n const path = normalizeDir(absolutePath);\n for (const mount of bySpecificity(mounts, \"dir\")) {\n const dir = normalizeDir(mount.dir);\n if (!isUnder(path, dir) || path === dir) {\n continue;\n }\n const rest = path.slice(dir.length + 1);\n const { filter: serves } = mount;\n if (serves && !serves(rest)) {\n return null;\n }\n const encoded = rest\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n return `${normalizeAssetPrefix(mount.urlPrefix)}/${encoded}`;\n }\n return null;\n}\n\n/**\n * Map a mounted site URL back to its absolute file path, or null when it matches no mount. Query\n * and hash are dropped, the path is decoded ONCE (a still-encoded dot or slash after that decode is\n * a bypass attempt and is rejected), and `.`/`..` segments are refused outright — so the result can\n * never escape the mount directory.\n *\n * @param {readonly AssetMount[]} mounts\n * @param {string} url - Site-absolute URL (e.g. `/content/docs/images/hero.png`)\n * @returns {string | null}\n */\nexport function resolveAssetUrl(mounts: readonly AssetMount[], url: string): string | null {\n const pathname = url.split(\"#\")[0]!.split(\"?\")[0]!;\n if (!pathname.startsWith(\"/\")) {\n return null;\n }\n let decoded: string;\n try {\n decoded = decodeURIComponent(pathname);\n } catch {\n return null;\n }\n if (/%2e|%2f/i.test(decoded)) {\n return null;\n }\n for (const mount of bySpecificity(mounts, \"urlPrefix\")) {\n const prefix = normalizeAssetPrefix(mount.urlPrefix);\n if (!decoded.startsWith(`${prefix}/`)) {\n continue;\n }\n const rest = decoded.slice(prefix.length + 1);\n const segments = rest.split(\"/\");\n if (segments.some((s) => s === \"\" || s === \".\" || s === \"..\")) {\n return null;\n }\n const { filter: serves } = mount;\n if (serves && !serves(segments.join(\"/\"))) {\n return null;\n }\n return `${normalizeDir(mount.dir)}/${segments.join(\"/\")}`;\n }\n return null;\n}\n\n/** Characters that terminate a URL inside markup: quotes, whitespace, CSS `url()` parens, `<>`. */\nconst URL_TERMINATOR = String.raw`\"'\\s<>()\\\\`;\n\n/**\n * Collect every mounted URL referenced by a compiled artifact (HTML, CSS, JSON-LD). Scanning output\n * text rather than the document tree catches references wherever they came from — markdown images,\n * hand-authored pages, `$head` metadata, `url()` in stylesheets — with no per-attribute knowledge.\n *\n * @param {string} text - Compiled HTML or CSS\n * @param {readonly AssetMount[]} mounts\n * @returns {string[]} Unique mounted URLs, in first-seen order\n */\nexport function collectAssetUrls(text: string, mounts: readonly AssetMount[]): string[] {\n const found = new Set<string>();\n for (const mount of mounts) {\n const prefix = normalizeAssetPrefix(mount.urlPrefix);\n const pattern = new RegExp(\n `${prefix.replaceAll(/[.*+?^${}()|[\\]\\\\]/g, String.raw`\\$&`)}/[^${URL_TERMINATOR}]+`,\n \"g\",\n );\n for (const match of text.matchAll(pattern)) {\n const url = match[0].split(\"#\")[0]!.split(\"?\")[0]!;\n // A trailing slash names a directory, not a file — prose quoting the mount prefix\n // (\"published under /content/docs/images/\") is a mention, not a reference.\n if (!url.endsWith(\"/\")) {\n found.add(url);\n }\n }\n }\n return [...found].filter(Boolean);\n}\n\n// ─── Project paths ↔ site URLs (specs/site-architecture.md §9.3) ─────────────\n\n/**\n * The project directory whose contents publish at the site root.\n *\n * A convention rather than a setting: `public/logo.png` is `/logo.png` on the built site, which is\n * why an authored `/logo.png` names a file the project tree calls something else.\n */\nexport const PUBLIC_DIR = \"public\";\n\n/** Node keys whose value is a media reference. Mirrors `ASSET_KEYS` in the content loader. */\nexport const ASSET_KEYS = [\"src\", \"poster\"] as const;\n\n/**\n * One step in a host's resolution order for a site-absolute URL.\n *\n * - `\"mounts\"` — an extension asset mount publishes a directory at a URL prefix (extensions.md §8.5).\n * - `\"root\"` — the URL path is a project-relative path as written.\n * - `\"public\"` — the URL path is relative to {@link PUBLIC_DIR}.\n */\nexport type AssetLane = \"mounts\" | \"root\" | \"public\";\n\n/**\n * What a BUILD resolves — mounts, then `public/`, and nothing else.\n *\n * This is the published contract (site-architecture.md §9.3): a file at `<root>/hero.jpg` is not\n * addressable at `/hero.jpg` on a deployed site, because nothing copies it there.\n */\nexport const BUILD_LANES: readonly AssetLane[] = [\"mounts\", \"public\"];\n\n/**\n * What the editing servers resolve — mounts, then the project root, then `public/`.\n *\n * It is deliberately NOT {@link BUILD_LANES}, and the difference is a real one rather than an\n * implementation detail: `serveProjectFile` in `@jxsuite/server` tries the project root BEFORE\n * `public/`, so `<root>/hero.jpg` loads at `/hero.jpg` in a preview and 404s in production. A test\n * asserts the two constants differ, so nobody can quietly assume they agree.\n */\nexport const DEV_SERVER_LANES: readonly AssetLane[] = [\"mounts\", \"root\", \"public\"];\n\n/**\n * Split a reference into the path part and the `?query#hash` suffix.\n *\n * The suffix must survive every rewrite untouched: `./hero.png?v=2` is one file plus a\n * cache-buster, and a rewrite that drops the buster changes what the browser requests.\n *\n * @param {string} value - An authored reference\n * @returns {{ path: string; suffix: string }} The bare path and everything from the first `?`/`#`\n */\nexport function splitRefSuffix(value: string): { path: string; suffix: string } {\n const cut = value.search(/[#?]/);\n return cut === -1\n ? { path: value, suffix: \"\" }\n : { path: value.slice(0, cut), suffix: value.slice(cut) };\n}\n\n/**\n * True when `value` is already a URL, a template, a fragment, or empty — never a project file.\n *\n * Mirrors `isNonRelativeRef` in the content loader. A root-relative `/hero.jpg` counts as\n * non-relative here because it is a SITE URL, not a path relative to the document.\n *\n * @param {string} value - An authored reference\n * @returns {boolean}\n */\nexport function isNonRelativeRef(value: string): boolean {\n return (\n value === \"\" ||\n value.startsWith(\"/\") ||\n value.startsWith(\"#\") ||\n value.includes(\"${\") ||\n /^[a-z][\\w+.-]*:/i.test(value)\n );\n}\n\n/**\n * Normalize a project-relative path: forward slashes, no `./` prefix, no leading or trailing slash.\n *\n * @param {string} path - A project-relative path in any spelling\n * @returns {string} The canonical spelling\n */\nexport function normalizeProjectPath(path: string): string {\n return path.replaceAll(\"\\\\\", \"/\").replace(/^\\.\\//, \"\").replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\n}\n\n/** The directory portion of a project-relative path (`\"\"` for a root-level file). */\nexport function dirOfPath(path: string): string {\n const normalized = normalizeProjectPath(path);\n const slash = normalized.lastIndexOf(\"/\");\n return slash === -1 ? \"\" : normalized.slice(0, slash);\n}\n\n/**\n * Resolve `ref` against `dir` in a pure, POSIX-ish way — no `node:path`, and no leading-slash\n * assumption, because project paths are relative to a root the browser does not have.\n *\n * @param {string} dir - Project-relative directory (`\"\"` for the root)\n * @param {string} ref - A relative reference\n * @returns {string | null} The project-relative result, or null when it climbs above the root\n */\nexport function joinProjectPath(dir: string, ref: string): string | null {\n const base = dir === \"\" || dir === \".\" ? [] : normalizeProjectPath(dir).split(\"/\");\n const out = base.filter((segment) => segment !== \"\" && segment !== \".\");\n for (const segment of ref.replaceAll(\"\\\\\", \"/\").split(\"/\")) {\n if (segment === \"\" || segment === \".\") {\n continue;\n }\n if (segment === \"..\") {\n if (out.length === 0) {\n return null; // Escapes the project root.\n }\n out.pop();\n continue;\n }\n out.push(segment);\n }\n return out.join(\"/\");\n}\n\n/**\n * The site URL a project file publishes at under `lanes`, or null when nothing publishes it.\n *\n * The lanes are tried in order, so the answer is the URL the host would resolve FIRST — which is\n * what makes {@link projectPathsForSiteUrl} its inverse. Under {@link DEV_SERVER_LANES} that means\n * `public/logo.png` answers `/public/logo.png` (the root lane, which the server tries first) rather\n * than `/logo.png`; both work there, and only one round-trips.\n *\n * @param {string} path - Project-relative path\n * @param {readonly AssetMount[]} mounts - Project-relative asset mounts\n * @param {readonly AssetLane[]} lanes - The host's resolution order\n * @returns {string | null} A site-absolute URL, or null\n */\nexport function siteUrlForPath(\n path: string,\n mounts: readonly AssetMount[],\n lanes: readonly AssetLane[],\n): string | null {\n const normalized = normalizeProjectPath(path);\n if (normalized === \"\") {\n return null;\n }\n for (const lane of lanes) {\n if (lane === \"mounts\") {\n const url = assetUrlFor(mounts, normalized);\n if (url) {\n return url;\n }\n continue;\n }\n if (lane === \"root\") {\n return `/${encodeProjectPath(normalized)}`;\n }\n if (normalized === PUBLIC_DIR || normalized.startsWith(`${PUBLIC_DIR}/`)) {\n return `/${encodeProjectPath(normalized.slice(PUBLIC_DIR.length + 1))}`;\n }\n }\n return null;\n}\n\n/**\n * Every project path a site-absolute URL could name under `lanes`, in the order the host tries\n * them.\n *\n * A list rather than one answer because the lanes genuinely overlap: `/hero.jpg` is `hero.jpg` to\n * the root lane and `public/hero.jpg` to the public lane, and only a filesystem can say which\n * exists. Callers with no filesystem — the Studio canvas — take the first.\n *\n * @param {string} url - A site-absolute URL (query and hash are ignored)\n * @param {readonly AssetMount[]} mounts - Project-relative asset mounts\n * @param {readonly AssetLane[]} lanes - The host's resolution order\n * @returns {string[]} Candidate project-relative paths, most-preferred first\n */\nexport function projectPathsForSiteUrl(\n url: string,\n mounts: readonly AssetMount[],\n lanes: readonly AssetLane[],\n): string[] {\n const { path } = splitRefSuffix(url);\n if (!path.startsWith(\"/\")) {\n return [];\n }\n let decoded: string;\n try {\n decoded = decodeURIComponent(path);\n } catch {\n return [];\n }\n // A still-encoded dot or slash after one decode is a traversal attempt, not a filename.\n if (/%2e|%2f/i.test(decoded)) {\n return [];\n }\n const rest = decoded.replace(/^\\/+/, \"\");\n if (rest === \"\" || rest.split(\"/\").some((segment) => segment === \".\" || segment === \"..\")) {\n return [];\n }\n const out: string[] = [];\n for (const lane of lanes) {\n if (lane === \"mounts\") {\n const mounted = resolveAssetUrl(mounts, path);\n // Only a mount INSIDE the project is addressable by path; `../../docs` is not.\n if (mounted !== null && !mounted.startsWith(\"/\") && !/^[A-Za-z]:/.test(mounted)) {\n out.push(normalizeProjectPath(mounted));\n }\n continue;\n }\n out.push(lane === \"root\" ? rest : `${PUBLIC_DIR}/${rest}`);\n }\n return [...new Set(out)];\n}\n\n/**\n * The project file an authored reference names, seen from the document that wrote it.\n *\n * The two shapes an author writes resolve differently and neither goes through a site URL:\n *\n * - A content-relative `./images/hero.png` resolves against the document's own directory, which IS a\n * project path already — `content/posts/images/hero.png`. The mount detour that the built site\n * performs is not needed to name the file, only to publish it.\n * - A root-relative `/hero.jpg` is a site URL, so it resolves through {@link projectPathsForSiteUrl}\n * and takes the host's first lane.\n *\n * Everything else — an absolute URL, a `data:` URI, a `${…}` template, a bare fragment — names no\n * project file and returns null, which callers read as \"leave it exactly as written\".\n *\n * @param {string} value - The authored reference\n * @param {string} documentDir - Project-relative directory of the document that wrote it\n * @param {readonly AssetMount[]} mounts - Project-relative asset mounts\n * @param {readonly AssetLane[]} lanes - The host's resolution order\n * @returns {string | null} A project-relative path, or null\n */\nexport function projectPathForRef(\n value: string,\n documentDir: string,\n mounts: readonly AssetMount[],\n lanes: readonly AssetLane[],\n): string | null {\n const { path } = splitRefSuffix(value);\n if (path === \"\") {\n return null;\n }\n if (isNonRelativeRef(value)) {\n return path.startsWith(\"/\") ? (projectPathsForSiteUrl(path, mounts, lanes)[0] ?? null) : null;\n }\n // A reference ending in a slash names a DIRECTORY, and no directory is a media file.\n if (path.endsWith(\"/\")) {\n return null;\n }\n let decoded: string;\n try {\n decoded = decodeURIComponent(path);\n } catch {\n return null;\n }\n const joined = joinProjectPath(documentDir, decoded);\n if (joined === null || joined === \"\" || joined === normalizeProjectPath(documentDir)) {\n return null;\n }\n return joined;\n}\n\n/**\n * Percent-encode each path segment so the result survives an HTML attribute.\n *\n * Segment by segment, so the separators stay separators: `encodeURIComponent` on the whole path\n * would turn every `/` into `%2F` and produce one very long filename.\n *\n * @param {string} path - A project-relative path\n * @returns {string} The same path, each segment encoded\n */\nexport function encodeProjectPath(path: string): string {\n return path\n .split(\"/\")\n .map((segment) => encodeURIComponent(segment))\n .join(\"/\");\n}\n\n// ─── srcset ──────────────────────────────────────────────────────────────────\n\n/** One `srcset` candidate: a URL and the descriptor that selects it (`\"\"` when there is none). */\nexport interface SrcsetCandidate {\n url: string;\n descriptor: string;\n}\n\n/**\n * Parse a `srcset` attribute into its candidates.\n *\n * Splitting on `\",\"` is wrong and quietly so: a `data:` URL contains commas, and so does any URL\n * with a query list. This follows HTML's own algorithm instead — collect non-whitespace as the URL,\n * and if it ends in commas, the descriptor is empty and the next candidate starts immediately.\n *\n * @param {string} value - The attribute value\n * @returns {SrcsetCandidate[]} Candidates in source order\n */\nexport function parseSrcset(value: string): SrcsetCandidate[] {\n const out: SrcsetCandidate[] = [];\n let i = 0;\n while (i < value.length) {\n while (i < value.length && (/\\s/.test(value[i]!) || value[i] === \",\")) {\n i += 1;\n }\n if (i >= value.length) {\n break;\n }\n const start = i;\n while (i < value.length && !/\\s/.test(value[i]!)) {\n i += 1;\n }\n let url = value.slice(start, i);\n if (url.endsWith(\",\")) {\n out.push({ descriptor: \"\", url: url.replace(/,+$/, \"\") });\n continue;\n }\n while (i < value.length && /\\s/.test(value[i]!)) {\n i += 1;\n }\n const descStart = i;\n while (i < value.length && value[i] !== \",\") {\n i += 1;\n }\n const descriptor = value.slice(descStart, i).trim();\n i += 1; // Consume the separating comma.\n url = url.replace(/,+$/, \"\");\n if (url !== \"\") {\n out.push({ descriptor, url });\n }\n }\n return out;\n}\n\n/**\n * Serialize candidates back into a `srcset` attribute value.\n *\n * @param {readonly SrcsetCandidate[]} candidates\n * @returns {string} The attribute value\n */\nexport function formatSrcset(candidates: readonly SrcsetCandidate[]): string {\n return candidates\n .map(({ url, descriptor }) => (descriptor ? `${url} ${descriptor}` : url))\n .join(\", \");\n}\n\n// ─── Deployment base path (RFC 3986 §5) ──────────────────────────────────────\n\n/**\n * The path a site is deployed under, derived from `project.json`'s `url`.\n *\n * **There is no second key for this, on purpose.** Every URL the build emits is a URI reference,\n * and `url` is the base URI it is resolved against (RFC 3986 §5). A site at\n * `https://example.pages.dev/m/my-site/` has already said where it lives; a `build.base` beside it\n * would be a second writer on one fact, free to disagree with the canonical links and the sitemap\n * that are built from the same value.\n *\n * What went wrong was narrower than a missing option: the compiler resolved its references against\n * the base's ORIGIN and discarded its path, which is what §5.2 does to an absolute-path reference\n * (`/assets/x.js`) and is not what a deployment means by one. So the fix is to stop discarding it.\n *\n * Returns `\"\"` for a site at an origin root, a missing `url`, or a `url` that will not parse — all\n * three mean \"prefix nothing\", and a malformed URL must not take the build down when the only thing\n * it can affect is a prefix. Never has a trailing slash, so `base + \"/assets/x\"` is well-formed.\n *\n * @param {string | undefined} url - `project.json`'s `url`\n * @returns {string} `\"\"` or a path with a leading slash and no trailing one\n */\nexport function siteBasePath(url: string | undefined | null): string {\n if (!isString(url) || url === \"\") {\n return \"\";\n }\n let pathname: string;\n try {\n ({ pathname } = new URL(url));\n } catch {\n return \"\";\n }\n const trimmed = pathname.replace(/\\/+$/, \"\");\n if (trimmed === \"\" || trimmed === \"/\") {\n return \"\";\n }\n return trimmed.startsWith(\"/\") ? trimmed : `/${trimmed}`;\n}\n\n/**\n * Re-root a site-absolute URL onto the deployment base.\n *\n * Only an absolute-path reference is affected — the one form whose meaning is \"from the site root\",\n * and therefore the one form that moves when the site root does. A protocol-relative `//host/x`, an\n * absolute URL, a fragment, a query and every relative path already resolve against something else\n * and are returned untouched.\n *\n * **Idempotent**, because a URL may reach this more than once: an emitter that already prefixed and\n * an output pass that prefixes everything must not compound. A value already under the base is\n * returned as-is.\n *\n * @param {string} base - From {@link siteBasePath}\n * @param {string} url - A URL as emitted\n * @returns {string} The URL a browser should be given\n */\nexport function withBase(base: string, url: string): string {\n if (base === \"\" || !url.startsWith(\"/\") || url.startsWith(\"//\")) {\n return url;\n }\n if (url === base || url.startsWith(`${base}/`)) {\n return url;\n }\n return base + url;\n}\n\n/**\n * An absolute URL for a site route, keeping the base's path.\n *\n * `new URL(\"/about\", \"https://x.dev/m/site/\")` is `https://x.dev/about` — RFC 3986 §5.2 replaces\n * the whole path for an absolute-path reference, which is exactly right for the RFC and exactly\n * wrong for a canonical link. Resolving the route as a RELATIVE-path reference keeps the base, so\n * `<link rel=\"canonical\">`, `sitemap.xml` and `robots.txt` name pages that exist.\n *\n * @param {string} route - A site route (`/about`), leading slash optional\n * @param {string} siteUrl - `project.json`'s `url`\n * @returns {string} The absolute URL\n */\nexport function siteAbsoluteUrl(route: string, siteUrl: string): string {\n const base = new URL(siteUrl);\n // A base whose path does not end in \"/\" would drop its last segment under §5.2's merge.\n if (!base.pathname.endsWith(\"/\")) {\n base.pathname += \"/\";\n }\n return new URL(route.replace(/^\\/+/, \"\"), base).href;\n}\n",
13
13
  "/// <reference lib=\"dom\" />\n/**\n * Jx Statement Engine (spec §20) — structured function bodies.\n *\n * A Function entry's `body` may be a statement array instead of opaque JS source. This module is\n * the statements counterpart to expression.ts, with the same dual shape: `runStatements`\n * (interpreter) and `compileStatements` (JS emitter), shared by the runtime and every compiler\n * target. Statement kinds reuse web-platform names only: bare expression nodes (§19), the JSON\n * Schema `if`/`then`/`else` triple, `$switch`/`cases` in statement position, and WHATWG's\n * `dispatchEvent` with `CustomEventInit` members, `stopPropagation` and `preventDefault`.\n */\n\nimport { isFunction, isNonNullObject } from \"@jxsuite/schema/guards\";\nimport {\n compileExpression,\n compileOperandSource,\n evaluateExpression,\n evaluateOperand,\n} from \"./expression.ts\";\n\nimport type {\n JxDispatchStatement,\n JxExpressionNode,\n JxIfStatement,\n JxStatement,\n JxSwitchStatement,\n} from \"@jxsuite/schema/types\";\nimport type { CompileOpts, IterCtx } from \"./expression.ts\";\nimport type { JxScope } from \"./types.ts\";\n\ninterface RunOpts {\n /** Named-formula-style arguments bound for $args/<name> refs in the body. */\n args?: IterCtx[\"args\"];\n /**\n * Dispatch target for dispatchEvent statements when there is no event to read `currentTarget`\n * from — a parameterised body invoked through `call`, or a lifecycle hook. A thunk is read at\n * dispatch time, because a mount's root does not exist yet when its scope is built.\n */\n target?: EventTarget | null | (() => EventTarget | null);\n}\n\n/*\n * Statement bodies come from documents that are not schema-validated at runtime, so the branch\n * arrays the schema requires may still be absent; these views say so and keep the fallbacks\n * honest.\n */\ninterface UncheckedIfStatement extends Omit<JxIfStatement, \"then\"> {\n then?: JxStatement[];\n}\n\ninterface UncheckedSwitchStatement extends Omit<JxSwitchStatement, \"cases\"> {\n cases?: JxSwitchStatement[\"cases\"];\n}\n\ntype ClassifiedStatement =\n | { kind: \"expression\"; node: JxExpressionNode }\n | { kind: \"if\"; node: UncheckedIfStatement }\n | { kind: \"switch\"; node: UncheckedSwitchStatement }\n | { kind: \"dispatch\"; node: JxDispatchStatement }\n | { kind: \"stopPropagation\" }\n | { kind: \"preventDefault\" };\n\nfunction classifyStatement(statement: JxStatement): ClassifiedStatement {\n if (\"operator\" in statement) {\n return { kind: \"expression\", node: statement };\n }\n if (\"if\" in statement) {\n return { kind: \"if\", node: statement };\n }\n if (\"$switch\" in statement) {\n return { kind: \"switch\", node: statement };\n }\n if (\"stopPropagation\" in statement) {\n return { kind: \"stopPropagation\" };\n }\n if (\"preventDefault\" in statement) {\n return { kind: \"preventDefault\" };\n }\n return { kind: \"dispatch\", node: statement };\n}\n\n/** A value `await` would adopt: anything with a callable `then` (ECMA-262 thenable). */\nfunction isThenable(value: unknown): value is PromiseLike<unknown> {\n return (isNonNullObject(value) || isFunction(value)) && \"then\" in value && isFunction(value.then);\n}\n\n/**\n * Execute a statement list sequentially against the reactive scope. A statement whose value is a\n * thenable is awaited before the next runs (ECMA async/await semantics); purely synchronous bodies\n * complete synchronously before the returned promise settles.\n */\nexport async function runStatements(\n statements: JxStatement[],\n state: JxScope,\n event: Event | null,\n opts: RunOpts = {},\n): Promise<void> {\n const iterCtx: IterCtx | undefined = opts.args ? { args: opts.args } : undefined;\n for (const statement of statements) {\n const classified = classifyStatement(statement);\n switch (classified.kind) {\n case \"expression\": {\n const result = evaluateExpression(classified.node, state, event, iterCtx);\n if (isThenable(result)) {\n // Awaited for its ordering alone: the next statement runs once this one settles.\n void (await result);\n }\n break;\n }\n case \"if\": {\n const branch = classified.node;\n const taken = evaluateOperand(branch.if, state, event, iterCtx) ? branch.then : branch.else;\n if (Array.isArray(taken)) {\n await runStatements(taken, state, event, opts);\n }\n break;\n }\n case \"switch\": {\n const branch = classified.node;\n const key = String(evaluateOperand(branch.$switch, state, event, iterCtx));\n const cases = branch.cases ?? {};\n const taken = Object.hasOwn(cases, key) ? cases[key] : branch.default;\n if (Array.isArray(taken)) {\n await runStatements(taken, state, event, opts);\n }\n break;\n }\n case \"dispatch\": {\n const dispatch = classified.node;\n // An event's own target wins; the option is the fallback for bodies run without one.\n const fallback = isFunction(opts.target) ? opts.target() : opts.target;\n const target = event?.currentTarget ?? fallback;\n if (!target) {\n break;\n }\n const init: CustomEventInit = {};\n if (\"detail\" in dispatch) {\n init.detail = evaluateOperand(dispatch.detail, state, event, iterCtx);\n }\n if (dispatch.bubbles !== undefined) {\n init.bubbles = dispatch.bubbles;\n }\n if (dispatch.composed !== undefined) {\n init.composed = dispatch.composed;\n }\n target.dispatchEvent(new CustomEvent(dispatch.dispatchEvent, init));\n break;\n }\n case \"stopPropagation\": {\n // The event the handler is running for; a body run without one has nothing to stop.\n event?.stopPropagation();\n break;\n }\n case \"preventDefault\": {\n event?.preventDefault();\n break;\n }\n default: {\n break;\n }\n }\n }\n}\n\ninterface StatementCompileOpts extends CompileOpts {\n /** JS expression for the dispatchEvent target; defaults to `(event && event.currentTarget)`. */\n dispatchTarget?: string;\n /** Indentation prefix for emitted lines. */\n indent?: string;\n}\n\n/**\n * Compile a statement list to a JS statement block (no surrounding braces). Mirrors `runStatements`\n * exactly; each statement kind lowers to its genuine ECMAScript form — expression statements,\n * `if`/`else`, `switch` over the discriminant's string form, and `dispatchEvent(new\n * CustomEvent(...))`.\n */\nexport function compileStatements(\n statements: JxStatement[],\n opts: StatementCompileOpts = {},\n): string {\n const indent = opts.indent ?? \"\";\n const lines: string[] = [];\n for (const statement of statements) {\n const classified = classifyStatement(statement);\n switch (classified.kind) {\n case \"expression\": {\n lines.push(`${indent}${compileExpression(classified.node, opts)};`);\n break;\n }\n case \"if\": {\n const branch = classified.node;\n const test = compileOperandSource(branch.if, opts);\n const inner = { ...opts, indent: `${indent} ` };\n lines.push(`${indent}if (${test}) {`, compileStatements(branch.then ?? [], inner));\n if (branch.else) {\n lines.push(`${indent}} else {`, compileStatements(branch.else, inner));\n }\n lines.push(`${indent}}`);\n break;\n }\n case \"switch\": {\n const branch = classified.node;\n const disc = compileOperandSource(branch.$switch, opts);\n const inner = { ...opts, indent: `${indent} ` };\n lines.push(`${indent}switch (String(${disc})) {`);\n for (const [key, caseStatements] of Object.entries(branch.cases ?? {})) {\n lines.push(\n `${indent} case ${JSON.stringify(key)}: {`,\n compileStatements(caseStatements, inner),\n `${indent} break;`,\n `${indent} }`,\n );\n }\n if (branch.default) {\n lines.push(\n `${indent} default: {`,\n compileStatements(branch.default, inner),\n `${indent} }`,\n );\n }\n lines.push(`${indent}}`);\n break;\n }\n case \"dispatch\": {\n const dispatch = classified.node;\n const eventName = opts.eventParam ?? \"event\";\n const target = opts.dispatchTarget ?? `(${eventName} && ${eventName}.currentTarget)`;\n const init: string[] = [];\n if (\"detail\" in dispatch) {\n init.push(`detail: ${compileOperandSource(dispatch.detail, opts)}`);\n }\n if (dispatch.bubbles !== undefined) {\n init.push(`bubbles: ${JSON.stringify(dispatch.bubbles)}`);\n }\n if (dispatch.composed !== undefined) {\n init.push(`composed: ${JSON.stringify(dispatch.composed)}`);\n }\n const initSource = init.length > 0 ? `, { ${init.join(\", \")} }` : \"\";\n lines.push(\n `${indent}${target}?.dispatchEvent(new CustomEvent(${JSON.stringify(dispatch.dispatchEvent)}${initSource}));`,\n );\n break;\n }\n case \"stopPropagation\": {\n lines.push(`${indent}${opts.eventParam ?? \"event\"}?.stopPropagation();`);\n break;\n }\n case \"preventDefault\": {\n lines.push(`${indent}${opts.eventParam ?? \"event\"}?.preventDefault();`);\n break;\n }\n default: {\n break;\n }\n }\n }\n return lines.join(\"\\n\");\n}\n",
14
14
  "/**\n * The `Cookie` state `$prototype`'s reading and writing, split out because both halves are exactly\n * the places a cookie binding goes wrong (RFC 6265bis).\n *\n * **Reading does not build a regular expression.** The cookie's name comes from the document, and\n * the old reader interpolated it straight into a pattern — so a name containing a dot, a paren or a\n * star silently matched the wrong cookie, and one containing an unbalanced bracket threw\n * SyntaxError from a document that validates. There is nothing to escape here: the cookie header is\n * a semicolon-separated list, so splitting it and comparing names is both correct and cheaper.\n *\n * **`HttpOnly` is absent on purpose, and must stay absent.** A cookie this prototype writes is\n * written by script through `document.cookie`; the browser refuses to _set_ `HttpOnly` from script\n * and refuses to _read back_ an `HttpOnly` cookie, so adding the attribute would produce a binding\n * that writes a value it can never see again. Its absence is the correct behavior for a\n * script-written cookie, not a missing feature.\n *\n * **`Expires` is not supported, and that is also deliberate.** `Max-Age` covers the same ground,\n * RFC 6265bis §5.5 makes `Max-Age` win wherever both appear, and `Expires` takes an HTTP-date whose\n * mis-spelling fails silently in the direction of a cookie that never expires.\n */\n\nimport type { JsonValue } from \"@jxsuite/schema/types\";\n\n/** The cookie attributes an `external-class-def` may declare for the `Cookie` `$prototype`. */\nexport interface CookieOptions {\n domain?: string | undefined;\n maxAge?: number | undefined;\n path?: string | undefined;\n sameSite?: string | undefined;\n secure?: boolean | undefined;\n}\n\n/** Cookie names carrying RFC 6265bis §4.1.3 prefixes, which constrain their own attributes. */\nconst HOST_PREFIX = \"__Host-\";\nconst SECURE_PREFIX = \"__Secure-\";\n\n/**\n * The raw (still percent-encoded) value of `name` in a `document.cookie` header, or null.\n *\n * @param {string} header The full `name=value; name=value` string.\n * @param {string} name\n * @returns {string | null}\n */\nexport function readCookie(header: string, name: string): string | null {\n for (const pair of header.split(\";\")) {\n const eq = pair.indexOf(\"=\");\n if (eq === -1) {\n continue;\n }\n if (pair.slice(0, eq).trim() === name) {\n return pair.slice(eq + 1);\n }\n }\n return null;\n}\n\n/**\n * Serialize one `document.cookie` assignment, applying the attribute rules a name's prefix and its\n * `SameSite` value already imply.\n *\n * Three of those rules are enforced rather than left to the author, because a browser that\n * disagrees with the attributes **silently drops the cookie** — the write appears to succeed and\n * the value is simply never there again:\n *\n * - `__Host-` requires `Secure`, requires `Path=/`, and forbids `Domain` (RFC 6265bis §4.1.3.2). A\n * declared `path` or `domain` is overridden rather than honored, since honoring it would produce\n * a cookie no browser will store.\n * - `__Secure-` requires `Secure` (§4.1.3.1).\n * - `SameSite=None` requires `Secure` (§5.4.7); without it the cookie is rejected outright.\n *\n * @param {string} name\n * @param {JsonValue} value JSON-encoded, then percent-encoded.\n * @param {CookieOptions} options\n * @returns {string}\n */\nexport function serializeCookie(name: string, value: JsonValue, options: CookieOptions): string {\n const hostPrefixed = name.startsWith(HOST_PREFIX);\n const parts = [`${name}=${encodeURIComponent(JSON.stringify(value))}`];\n\n if (options.maxAge !== undefined) {\n parts.push(`Max-Age=${options.maxAge}`);\n }\n\n const path = hostPrefixed ? \"/\" : options.path;\n if (path) {\n parts.push(`Path=${path}`);\n }\n if (options.domain && !hostPrefixed) {\n parts.push(`Domain=${options.domain}`);\n }\n\n const { sameSite } = options;\n const secure =\n options.secure === true ||\n hostPrefixed ||\n name.startsWith(SECURE_PREFIX) ||\n sameSite?.toLowerCase() === \"none\";\n if (secure) {\n parts.push(\"Secure\");\n }\n if (sameSite) {\n parts.push(`SameSite=${sameSite}`);\n }\n\n return parts.join(\"; \");\n}\n",
15
- "/// <reference lib=\"dom\" />\n/**\n * Jx — JSON-native reactive web component runtime\n *\n * Four-step pipeline:\n *\n * 1. `resolve` — fetch JSON source (or accept raw object)\n * 2. `buildScope` — state detection + reactive proxy construction\n * 3. `render` — walk resolved tree, build DOM, wire reactive effects\n * 4. `output` — append to target\n *\n * @module jx\n * @license MIT\n * @version 3.0.0\n */\n\nimport {\n computed,\n effect,\n effectScope,\n isReactive,\n isRef,\n onEffectCleanup,\n onScopeDispose,\n pauseTracking,\n reactive,\n ref,\n resetTracking,\n shallowReactive,\n toRaw,\n} from \"@vue/reactivity\";\nimport {\n buildStyleRules,\n cssPropertyName,\n hashCss,\n isNestedSelectorKey,\n transposeCanvasOverlaySelector,\n} from \"./css.ts\";\nimport { evaluateExpression, evaluateOperand, isMutating } from \"./expression.ts\";\nimport { readPath } from \"./pointer.ts\";\nimport type {\n JxContext,\n JxEventHandler,\n JxHostScope,\n JxMount,\n JxMountOptions,\n JxPath,\n JxRenderOptions,\n JxRowContext,\n JxScope,\n JxScopeFunction,\n JxScopeValue,\n} from \"./types.ts\";\nimport {\n bodyReturnsValue,\n hasStructuredBody,\n isBoolean,\n isExpressionDef,\n isFunction,\n isFunctionDef,\n isJsonObject,\n isMappedArray,\n isNamedFormulaDef,\n isNestedStyle,\n isNonNullObject,\n isNumber,\n isPrivateStateKey,\n isPrototypeDef,\n isRef as isRefValue,\n isServerFnDef,\n isString,\n isTagExpression,\n isTemplateString,\n paramNames,\n} from \"@jxsuite/schema/guards\";\nimport type { TagNameSlot } from \"@jxsuite/schema/guards\";\nimport { formatSrcset, parseSrcset } from \"@jxsuite/schema/asset-paths\";\nimport { runStatements } from \"./statements.ts\";\nimport { readCookie, serializeCookie } from \"./cookie.ts\";\nimport type {\n CemParameter,\n JsonValue,\n JxAttributeValue,\n JxClassCtorDef,\n JxClassDef,\n JxDocument,\n JxDocumentValue,\n JxElement,\n JxFunctionDef,\n JxHeadEntry,\n JxMappedArray,\n JxPrototypeDef,\n JxRef,\n JxServerFnDef,\n JxStyle,\n} from \"@jxsuite/schema/types\";\nimport type { EffectScope, Ref } from \"@vue/reactivity\";\n\n// ─── Public API ───────────────────────────────────────────────────────────────\n\n/**\n * Mount a Jx document into a DOM container.\n *\n * @example\n * import { Jx } from \"@jxsuite/runtime\";\n * const state = await Jx(\"./counter.json\", document.getElementById(\"app\"));\n *\n * @param {string | JxDocument} source - Path to .json file, URL, or raw document object\n * @param {HTMLElement} [target] Default is `document.body`\n * @param {JxRenderOptions} [options]\n * @returns {Promise<JxScope>} Resolves with the live component scope (state reactive\n * proxy)\n */\n/** The document-schema version this runtime understands (the `/schema/vN` in a hosted `$schema`). */\nexport const SUPPORTED_SCHEMA_VERSION = 1;\nlet _schemaVersionWarned = false;\n\n/**\n * Warn once when a document declares a hosted `$schema` whose version differs from the one this\n * runtime supports. A relative or non-hosted `$schema` (local dev schema paths) is ignored. This is\n * a diagnostic only — there is no document-format migration story yet (see spec §3.2 / §21.4).\n */\nfunction checkSchemaVersion($schema: JxDocumentValue | undefined): void {\n if (_schemaVersionWarned || !isString($schema)) {\n return;\n }\n const match = $schema.match(/\\/schema\\/v(\\d+)\\b/);\n if (match && Number(match[1]) !== SUPPORTED_SCHEMA_VERSION) {\n _schemaVersionWarned = true;\n console.warn(\n `Jx: document $schema is version v${match[1]} but this runtime supports ` +\n `v${SUPPORTED_SCHEMA_VERSION}. Behavior may be undefined; there is no format migrator yet.`,\n );\n }\n}\n\nexport async function Jx(\n source: string | JxDocument,\n target: HTMLElement = document.body,\n options?: JxRenderOptions,\n) {\n const base = options?.base\n ? new URL(options.base, location.href).href\n : isString(source)\n ? new URL(source, location.href).href\n : location.href;\n const doc = await resolve(source);\n\n /* The module-level fallback is still written here, on purpose: a component defined LATER with\n `@--name` blocks and no own `$media` reads it (setRootMedia). `mount()` never writes it — a\n mount's `$media` travels in its context, which is the whole point of having one. */\n if (doc.$media) {\n _rootMedia = doc.$media;\n }\n\n const mountOptions: JxMountOptions = { base };\n if (options?.onNodeCreated) {\n mountOptions.onNodeCreated = options.onNodeCreated;\n }\n if (options?.signal) {\n mountOptions.signal = options.signal;\n }\n const mounted = await mount(doc, target, mountOptions);\n return mounted.scope;\n}\n\n/**\n * A lifecycle hook a document's state supplies (`onMount`, `onUnmount`, `onAdopted`) as the runtime\n * calls it: with the scope, plus the host element for a defined element's `onMount`, which also\n * receives the host as `this`.\n */\ntype ScopeHook = (\n this: HTMLElement | JxScope | undefined,\n scope: JxScope,\n host?: HTMLElement,\n) => void;\n\n/**\n * Whether a scope member can be called as a {@link ScopeHook}. Being a function is the whole\n * contract: JavaScript checks neither the arguments a call passes nor what it returns, so every\n * function accepts this call, and the runtime discards whatever it returns.\n */\nfunction isScopeHook(value: unknown): value is ScopeHook {\n return isFunction(value);\n}\n\n/** Host-scope keys the runtime owns: `$media`, `$map`, the `$`-locals and `#`-private entries. */\nconst HOST_SCOPE_RESERVED = /^[$#]/;\n\n/**\n * A host's scope as the runtime merges it: the host's own record, typed as the {@link JxScope} it\n * joins.\n *\n * @param {S} scope - The host's scope, held to `JxScopeValue` member by member by its type\n * @returns {JxScope}\n */\nfunction hostScopeOf<S extends JxHostScope<S>>(scope: S): JxScope {\n /* SAFETY: `JxHostScope<S>` has already held every member of `S` to `JxScopeValue`, recursively\n through arrays, records and function results. What TypeScript cannot conclude from that is an\n index signature, which an interface never has implicitly, so a host's own interface is not\n assignable to `JxScope` however its members are typed. Nothing is copied or converted: this is\n the host's record, read by member name like every other scope. */\n return scope as JxScope;\n}\n\nfunction assertHostScope(scope: JxScope): void {\n for (const key of Object.keys(scope)) {\n if (HOST_SCOPE_RESERVED.test(key)) {\n throw new TypeError(\n `Jx mount: host scope key \"${key}\" is reserved — names beginning with \"$\" or \"#\" are ` +\n `runtime vocabulary`,\n );\n }\n }\n}\n\n/**\n * Mount a document into a host-owned node and hand back the live scope with a disposer.\n *\n * This is the embedding contract (specs/embedding.md): the host supplies its own reactive records\n * and functions as `options.scope`, a per-mount base, `$media` and document resolver, and gets a\n * root it can remove and a `dispose()` that stops every effect the render created. Nothing here\n * writes a module global, so a shell can hold many roots with different needs at once.\n *\n * @param {JxDocument} doc - The document to render (already an object; use {@link resolve} for a\n * URL)\n * @param {ParentNode} target - Where the rendered root is appended\n * @param {JxMountOptions} [options]\n * @returns {Promise<JxMount>}\n * @docs extending/embedding/runtime-host\n */\nexport async function mount<S extends JxHostScope<S> = JxScope>(\n doc: JxDocument,\n target: ParentNode,\n options: JxMountOptions<S> = {},\n): Promise<JxMount> {\n const hostScope: JxScope = options.scope ? hostScopeOf(options.scope) : {};\n assertHostScope(hostScope);\n const base = options.base ? new URL(options.base, location.href).href : location.href;\n const ctx: JxContext = {\n base,\n media: options.media ?? doc.$media ?? null,\n root: null,\n };\n if (options.resolver) {\n ctx.resolver = options.resolver;\n }\n if (options.skipServerFunctions !== undefined) {\n ctx.skipServerFunctions = options.skipServerFunctions;\n }\n if (options.skipAutoRequests !== undefined) {\n ctx.skipAutoRequests = options.skipAutoRequests;\n }\n checkSchemaVersion(doc.$schema);\n\n // Register custom elements declared in $elements (depth-first)\n if (doc.$elements) {\n await registerElements(doc.$elements, base, ctx);\n }\n\n // Inject <head> elements declared in $head (link, meta, script, etc.)\n if (doc.$head) {\n injectHead(doc.$head, base);\n }\n\n const scope = await buildScope(doc, hostScope, base, ctx);\n\n const elements = new Set<string>();\n const renderOptions: JxRenderOptions = {\n _ctx: ctx,\n onNodeCreated: (el, path, def, state) => {\n if (el instanceof Element && el.tagName.includes(\"-\")) {\n elements.add(el.tagName.toLowerCase());\n }\n options.onNodeCreated?.(el, path, def, state);\n },\n };\n if (options.onNodeMoved) {\n renderOptions.onNodeMoved = options.onNodeMoved;\n }\n const { result: root, stop } = runScoped(() => renderNode(doc, scope, renderOptions));\n ctx.root = root;\n\n let mounted = false;\n let disposed = false;\n const dispose = (): void => {\n if (disposed) {\n return;\n }\n disposed = true;\n options.signal?.removeEventListener(\"abort\", dispose);\n /* The root leaves the document BEFORE its effects stop (embedding.md §2.2). Stopping releases\n each element's styles, and on a connected subtree every one of those inline-property and\n `data-jx` writes schedules a style invalidation for a node that is leaving anyway: a\n Publish tab switch spent 22 ms there, and a dialog's close forced a recalculation of the\n subtree it was removing. It is also the order a custom element's own `onUnmount` sees,\n which runs from `disconnectedCallback` (spec.md §16.4). */\n root.remove();\n stop();\n // Called as a method, so a hook that reads `this` sees the scope, as it always has.\n if (mounted && isScopeHook(scope.onUnmount)) {\n scope.onUnmount(scope);\n }\n };\n\n if (options.signal?.aborted) {\n // Aborted before it could be attached: tear the effects down and attach nothing.\n dispose();\n } else {\n options.signal?.addEventListener(\"abort\", dispose, { once: true });\n target.append(root);\n mounted = true;\n if (isScopeHook(scope.onMount)) {\n scope.onMount(scope);\n }\n }\n return { scope, root, elements, dispose };\n}\n\n// ─── Step 1: Resolve ──────────────────────────────────────────────────────────\n\nconst _resolveCache = new Map<string, Promise<JxDocument>>();\n\n/**\n * Seed the resolve cache with a document a host already holds, under the URL its references use.\n *\n * A bundled document — one imported as JSON rather than fetched — still names its dependencies by\n * URL: an `$elements` entry, a `$switch` case. Preloading those under the same URLs lets every such\n * reference resolve with no network, and lets `defineElement(\"<url>\")` dedupe on the source it\n * would otherwise have fetched. The key is stored as given and, when it parses as a URL, in its\n * absolute form too, because the two lookup paths spell it differently.\n *\n * @param {string} url - The URL the document is known by\n * @param {JxDocument} doc\n */\nexport function preloadDocument(url: string, doc: JxDocument): void {\n const settled = Promise.resolve(doc);\n _resolveCache.set(url, settled);\n try {\n _resolveCache.set(new URL(url, location.href).href, settled);\n } catch {\n // Not a URL at all — the raw key still serves the lookup that uses it.\n }\n}\n\n/**\n * A response's Content-Type, or `\"\"` when it carries no headers at all. A response we have no\n * EVIDENCE about is one we proceed with rather than guess. Every real `Response` has headers; a\n * host's or a test's `fetch` stand-in may not, which is what the parameter type admits.\n *\n * @param res The response, or a stand-in for one\n * @returns {string}\n */\nfunction responseContentType(res: Partial<Pick<Response, \"headers\">>): string {\n return res.headers?.get(\"Content-Type\") ?? \"\";\n}\n\nexport async function resolve(source: string | JxDocument, ctx?: JxContext): Promise<JxDocument> {\n if (!isString(source)) {\n return source;\n }\n // A mount's resolver answers for THIS mount and its hit never enters the shared cache.\n const served = ctx?.resolver?.(source);\n if (served) {\n return served;\n }\n if (_resolveCache.has(source)) {\n return _resolveCache.get(source)!;\n }\n const p = fetch(source).then(async (res) => {\n if (!res.ok) {\n throw new Error(`Jx: failed to fetch ${source} (${res.status})`);\n }\n /*\n * `res.ok` is not enough on a single-page host. A static host configured with an SPA fallback\n * answers a path it does not have with the APPLICATION SHELL at HTTP 200, so a missing document\n * arrives looking like a successful fetch and dies inside `res.json()` as\n * `Unexpected token '<', \"<!doctype \"... is not valid JSON` — a parser error for what is\n * actually a 404. Jx Cloud did this to every component `$ref` in the canvas.\n *\n * Checked on the content type rather than by sniffing the body: a host that says `text/html`\n * has told us plainly, and saying so costs nothing.\n */\n const contentType = responseContentType(res);\n if (contentType.includes(\"text/html\")) {\n throw new Error(\n `Jx: ${source} returned HTML, not a document — the host answered a missing file with its ` +\n `app shell (a single-page fallback), so this path is not served.`,\n );\n }\n /* SAFETY: trust boundary. `resolve` fetches only URLs that name a Jx document (a `Jx()` source,\n an `$elements` entry, a `$switch` case), and the host answered 2xx with a non-HTML body, so\n the JSON is that document; the runtime does not schema-validate documents by design. */\n return (await res.json()) as JxDocument;\n });\n _resolveCache.set(source, p);\n return p;\n}\n\n// ─── Step 2: Build scope ──────────────────────────────────────────────────────\n\n/** JSON Schema keywords used to identify pure type definitions (Shape 2b). */\nconst SCHEMA_KEYWORDS = new Set([\n \"type\",\n \"properties\",\n \"items\",\n \"enum\",\n \"minimum\",\n \"maximum\",\n \"minLength\",\n \"maxLength\",\n \"pattern\",\n \"required\",\n \"examples\",\n]);\n\n/** /** @type {{ skip: boolean }} */\nconst _serverFnConfig = { skip: false };\n/** Set to true to suppress timing: \"server\" resolution (used by Studio edit mode). */\nexport function setSkipServerFunctions(v: boolean) {\n _serverFnConfig.skip = v;\n}\n\n/** @type {{ skip: boolean }} */\nconst _autoRequestConfig = { skip: false };\n/**\n * Set to true to suppress AUTOMATIC `$prototype: \"Request\"` fetches — the sibling of\n * {@link setSkipServerFunctions}, and used by Studio for the same reason.\n *\n * `buildScope` re-resolves every `state` entry on each full canvas render, so an auto-request\n * re-issued its HTTP call every time the canvas rebuilt. In edit/design mode that meant authoring\n * actions — a signal edit, or pressing Enter inside component-wrapped content, both of which force\n * a full render — fired network requests. Live data belongs to preview and to the deployed site.\n *\n * Only non-`manual` requests are gated: a `manual` one fires from an event handler, and edit mode\n * strips handlers before rendering. The returned ref is unchanged either way — it simply stays at\n * its initial `null`, which is the same state bindings observe before any fetch resolves.\n */\nexport function setSkipAutoRequests(v: boolean) {\n _autoRequestConfig.skip = v;\n}\n\n// ─── Dev-proxy auth token (Studio cross-origin canvas) ────────────────────────\n// The Studio canvas iframe is served from a token-gated loopback origin (createProjectServer): its\n// POST /__jx_resolve__ + /__jx_server__ routes 403 without ?token=<rpcToken>. The iframe boot reads\n// The token from its URL and calls setResolveToken so these dev-proxy fetches authenticate. Unset by\n// Default, leaving production + same-origin dev untouched (bare path, no query appended).\nlet _resolveToken: string | null = null;\nexport function setResolveToken(token: string | null) {\n _resolveToken = token || null;\n}\n/** Append the dev-proxy auth token to a privileged resolve path when one is configured. */\nfunction resolveProxyPath(path: string): string {\n return _resolveToken ? `${path}?token=${encodeURIComponent(_resolveToken)}` : path;\n}\n\n/**\n * Observe runtime-created reactive values: runs `fn` immediately inside a reactive effect and\n * re-runs it whenever a tracked value changes; returns a disposer. Dep tracking in @vue/reactivity\n * is per module INSTANCE, so an effect created from another copy of the package (e.g. the studio's\n * own pin) can never track a ref/reactive created here — consumers that want to observe\n * runtime-resolved scope values (the Studio canvas iframe's dataScope re-post) must use this.\n *\n * @param {() => void} fn - Read the reactive values to observe inside this callback.\n * @returns {() => void} Disposer — stops the effect and its scope.\n */\nexport function observeScope(fn: () => void): () => void {\n const scope = effectScope(true);\n scope.run(() => {\n effect(fn);\n });\n return () => scope.stop();\n}\n\n/** What {@link runScoped} hands back: the callback's result, and the disposer for its effects. */\nexport interface ScopedRun<T> {\n result: T;\n stop: () => void;\n}\n\n/**\n * Run `fn` inside a detached reactive scope of THIS module's reactivity instance, returning its\n * result plus a disposer that stops every effect `fn` created. Callers that render via\n * {@link renderNode} and later tear the render down (the Studio canvas full render and its surgical\n * subtree re-renders) MUST use this instead of their own effectScope: scope collection is per\n * vue-reactivity module instance, so a scope from another copy of the package collects NOTHING and\n * its stop() silently leaks every binding effect of the superseded render.\n *\n * @param {() => T} fn - Work that may create reactive effects (typically a renderNode call).\n * @returns {ScopedRun<T>} The callback result and the scope disposer.\n */\nexport function runScoped<T>(fn: () => T): ScopedRun<T> {\n const scope = effectScope(true);\n try {\n /* SAFETY: `run` answers undefined only for a scope that was already stopped, and this one was\n created on the line above, so it is active and `run` returns what `fn` returned. */\n const result = scope.run(fn) as T;\n return { result, stop: () => scope.stop() };\n } catch (error) {\n // A throwing fn would otherwise leak the effects it created before failing.\n scope.stop();\n throw error;\n }\n}\n\n/**\n * Studio-canvas viewport-unit transpose. The canvas iframe is sized to its document's height, so\n * any viewport unit (`vh`/`vw`/`vmin`/`vmax`/`svh`/…) — which resolves against the iframe ELEMENT —\n * would feed back into an ever-growing height. When this is on, the runtime transposes them to\n * CONTAINER units (`cqh`/`cqw`/…) that resolve against the canvas's fixed-size query container (see\n * `canvas.html`): a predictable, feedback-free stand-in for the viewport. Off (the default) leaves\n * CSS untouched for real production rendering.\n */\nlet _canvasViewportTranspose = false;\nexport function setCanvasViewportTranspose(on: boolean) {\n _canvasViewportTranspose = on;\n}\n\nconst VIEWPORT_UNIT_RE = /(-?\\d*\\.?\\d+)(?:s|l|d)?v(h|w|min|max|i|b)\\b/gi;\nconst VIEWPORT_UNIT_MAP = new Map([\n [\"b\", \"cqb\"],\n [\"h\", \"cqh\"],\n [\"i\", \"cqi\"],\n [\"max\", \"cqmax\"],\n [\"min\", \"cqmin\"],\n [\"w\", \"cqw\"],\n]);\n\n/**\n * Transpose CSS viewport units → container-query units in a value string, but only when the\n * studio-canvas flag is set (otherwise the value is returned untouched). `100vh` → `100cqh`,\n * `50svw` → `50cqw`, `10vmin` → `10cqmin`, etc.\n */\nexport function transposeCanvasUnits(value: string): string {\n if (!_canvasViewportTranspose || !value.includes(\"v\")) {\n return value;\n }\n return value.replaceAll(\n VIEWPORT_UNIT_RE,\n (_m, num: string, dim: string) =>\n `${num}${VIEWPORT_UNIT_MAP.get(dim.toLowerCase()) ?? `cq${dim}`}`,\n );\n}\n\n/**\n * Studio-canvas anchor de-linking. In the editor canvas a rendered `<a href>` would navigate the\n * iframe when clicked, fighting element selection. When this is on, the runtime stamps the value on\n * `data-jx-href` instead of `href` so the anchor is inert (selectable, not a live link) while the\n * original target stays recoverable for richer link handling later. Off (the default) leaves\n * production rendering untouched; the studio sets it for design/edit (not preview — see\n * iframe-render).\n */\nlet _canvasDelinkAnchors = false;\nexport function setCanvasDelinkAnchors(on: boolean) {\n _canvasDelinkAnchors = on;\n}\n\n/**\n * Studio-canvas popover de-linking — `setCanvasDelinkAnchors`'s rule applied to `popover`.\n *\n * An OPEN popover is in the top layer, and CSS Position 4 §3.1 gives a top-layer element the\n * VIEWPORT as its containing block whatever its ancestors say. In the editor canvas that viewport\n * is a fiction: the frame is sized to its own content height, so a drawer pinned with `inset: 0`\n * lands halfway down a 6000px page, and a panel taller than a short component frame is clipped by\n * the `overflow: hidden` the canvas document needs. Worse, a top-layer box contributes nothing to\n * any ancestor's scrollable overflow, so the artboard can never grow to fit one.\n *\n * When this is on, the runtime stamps `popover` on `data-jx-popover` for nodes the studio can\n * ADDRESS — those carrying a stamped `data-jx-path`. That drops every `[popover]` UA rule at once,\n * and the one that matters most is `position: fixed`: with it gone the panel lays out in NORMAL\n * FLOW at its document position, which is what makes it contribute to `#jx-canvas-root`'s\n * scrollHeight so the host can grow the artboard to fit it. Leaving the top layer is necessary but\n * not sufficient — a fixed box contributes nothing to an ancestor's overflow either.\n *\n * It is worth saying what does NOT rescue this, because it is the intuitive answer and it is wrong:\n * `container-type: size` on the canvas's query container does NOT make it a containing block for\n * fixed descendants. Measured in Chrome 151 — `getComputedStyle(container).contain` is `none`, and\n * a `position: fixed` child inside it measures the WINDOW, not the container. So a panel that stays\n * fixed stays laid out against the frame's own viewport, which in an editable mode is the\n * document's full height. `iframe-render.ts` therefore FORCES `position` on the open panel rather\n * than relying on any containment.\n *\n * The studio re-supplies the one UA rule that matters — `display: none` while closed — inside a\n * cascade LAYER, so author declarations still beat it exactly as they beat the real UA rule on the\n * shipped page. That is deliberate: a popover whose base rule sets `display` is broken in\n * production, and the canvas has to show that rather than paper over it.\n *\n * The gate on `data-jx-path` is what keeps this out of documents the studio does not own: a popover\n * rendered inside a component's own template is never stamped, so it keeps its native behaviour.\n *\n * It also drives {@link transposeCanvasPopoverSelector}. The two are one transform — an attribute\n * renamed without its selectors transposed is a popover that can never be styled open.\n *\n * @docs framework/concepts/overlays\n */\nlet _canvasDelinkPopovers = false;\nexport function setCanvasDelinkPopovers(on: boolean) {\n _canvasDelinkPopovers = on;\n}\n\n/**\n * Studio-canvas de-linking of invoker commands, `inert` and a dialog's `open` — the dialog half of\n * {@link setCanvasDelinkPopovers}.\n *\n * A `<button command=\"show-modal\" commandfor=\"…\">` is the platform's own invoker: clicking it calls\n * `showModal()` on its target, which puts the dialog in the top layer and makes the rest of the\n * page INERT — the two things an editable canvas can least afford, since the first is the geometry\n * the popover comment above describes and the second makes every other element unclickable. So on a\n * stamped node `commandfor` is renamed to `data-jx-commandfor`: a button with `command` and no\n * target does nothing, and the studio's frame reports the click instead, so the host's single\n * writer of open state can answer it. `popovertarget` is left alone on purpose — its target has no\n * `popover` attribute on the canvas, so the platform already does nothing with it.\n *\n * `inert` becomes `data-jx-inert` for the same reason: an author's inert region is a region the\n * editor could not select into. And a `<dialog open>` becomes `<dialog data-jx-open>`, so the UA's\n * `dialog:not([open]) { display: none }` keeps every dialog closed until the canvas opens ONE with\n * `data-jx-dialog-open`, exactly as it opens one popover. `<details open>` is untouched: its `open`\n * is content, not an overlay state.\n *\n * Gated on `data-jx-path` like the popover rewrite, and driving\n * {@link transposeCanvasOverlaySelector} with it: an attribute renamed without its selectors\n * transposed is a dialog that can never be styled open, or a region that can never be styled inert.\n * Both renames travel with their selectors there — `[open]` on a dialog's own rules, `[inert]`\n * wherever it appears.\n *\n * @docs framework/concepts/overlays\n */\nlet _canvasDelinkCommands = false;\nexport function setCanvasDelinkCommands(on: boolean) {\n _canvasDelinkCommands = on;\n}\n\n/**\n * Raised while a defined element renders its own children, so the canvas de-link reaches them.\n *\n * The de-link rules gate on `data-jx-path`, which a document node carries and an element's INTERNAL\n * node never can: the internals belong to the definition, not to the page being edited, so the\n * studio's stamper never sees them. Without this a kit element that declares `popover` on a panel\n * inside itself opens a genuine top-layer popover inside an editable canvas, while Studio's single\n * writer of open state learns nothing about it.\n *\n * A module-scoped flag is sound here because `canvasAttrName` is called once per attribute OUTSIDE\n * the effect that binds it, and a definition renders its children synchronously — so the flag is\n * never read across a suspension point.\n */\nlet _canvasInsideStampedHost = false;\n\n/** Whether the node being rendered is inside a stamped host, and so part of the edited page. */\nfunction canvasStamped(el: HTMLElement): boolean {\n return _canvasInsideStampedHost || el.dataset.jxPath !== undefined;\n}\n\n/** The attribute name to stamp `key` on `el` under — `href` → `data-jx-href` on de-linked anchors. */\nfunction canvasAttrName(el: HTMLElement, key: string): string {\n if (_canvasDelinkAnchors && key === \"href\" && (el.tagName === \"A\" || el.tagName === \"AREA\")) {\n return \"data-jx-href\";\n }\n /* `dataset.jxPath` is already stamped here: `onNodeCreated` fires before `applyAttributes` in\n `renderNode`, and the studio's stamper writes the attribute synchronously inside it. That\n ordering is an unwritten contract between two packages, so `runtime-canvas.test.ts` asserts it\n directly rather than trusting it. */\n if (_canvasDelinkPopovers && key === \"popover\" && canvasStamped(el)) {\n return \"data-jx-popover\";\n }\n if (_canvasDelinkCommands && canvasStamped(el)) {\n if (key === \"commandfor\") {\n return \"data-jx-commandfor\";\n }\n if (key === \"inert\") {\n return \"data-jx-inert\";\n }\n if (key === \"open\" && el.tagName === \"DIALOG\") {\n return \"data-jx-open\";\n }\n }\n return key;\n}\n\n/**\n * Rewrite one asset reference for a host that does not serve the site's own URL space.\n *\n * The runtime writes a reference VERBATIM — `el.src = \"/hero.jpg\"` — so the browser resolves it\n * against the document, and the document is whatever page the renderer happens to be running in. On\n * a real site and on an editing server that serves the project tree, that is correct and this hook\n * stays null. On a multi-tenant editor origin it is not: `/hero.jpg` resolves against the editor,\n * misses, and — behind a single-page-app fallback — comes back as HTML at HTTP 200, so the image\n * renders broken and nothing is logged.\n *\n * A function rather than data because it cannot be one: the values it must fix are produced INSIDE\n * reactive effects (`{\"$ref\": \"#/state/hero\"}` is not a string until the effect runs), so no\n * document walk can see them. The Studio canvas iframe sets this at render time.\n *\n * Returning null leaves the value exactly as written, and a null resolver makes every call site\n * below the identity — so production rendering is byte-identical.\n *\n * @param {CanvasAssetResolver | null} fn - The resolver, or null to restore verbatim rendering\n */\nexport type CanvasAssetResolver = (value: string, key: string) => string | null;\n\nlet _canvasAssetResolver: CanvasAssetResolver | null = null;\nexport function setCanvasAssetResolver(fn: CanvasAssetResolver | null) {\n _canvasAssetResolver = fn;\n}\n\n/** Attribute/property names whose value is an asset reference, on any element. */\nconst ASSET_KEYS = new Set([\"src\", \"poster\", \"data\"]);\n\n/** Names whose value is a `srcset`-shaped candidate list rather than one reference. */\nconst SRCSET_KEYS = new Set([\"srcset\", \"imagesrcset\"]);\n\n/**\n * Elements on which `href` names an ASSET rather than a destination.\n *\n * `<a href>` and `<area href>` are places to go, not files to load; rewriting one would send a\n * click at the file that backs the page instead of at the page. `<link href>` is the opposite — a\n * stylesheet, an icon, a preload — and is the reason `$head` needs this at all.\n */\nconst HREF_ASSET_TAGS = new Set([\"LINK\"]);\n\n/** True when writing `key` on a `<tagName>` writes an asset reference. */\nfunction isAssetKey(tagName: string, key: string): boolean {\n return ASSET_KEYS.has(key) || (key === \"href\" && HREF_ASSET_TAGS.has(tagName));\n}\n\n/**\n * The value to actually write for `key` on a `<tagName>` — resolved when it is an asset reference,\n * and the input itself in every other case, including whenever no resolver is installed.\n *\n * `srcset` is split into its candidates and resolved one at a time, because it is N references in\n * one attribute and a resolver handed the whole string would have to re-implement HTML's parser to\n * find them.\n */\nfunction canvasAssetValue(tagName: string, key: string, value: string): string {\n if (!_canvasAssetResolver || value === \"\") {\n return value;\n }\n const name = key.toLowerCase();\n if (SRCSET_KEYS.has(name)) {\n const candidates = parseSrcset(value);\n const next = candidates.map((candidate) => {\n const resolved = _canvasAssetResolver?.(candidate.url, name) ?? null;\n if (resolved === null || resolved === candidate.url) {\n return candidate;\n }\n return { descriptor: candidate.descriptor, url: resolved };\n });\n // A rewritten candidate is a new object, so identity says whether anything changed.\n const changed = next.some((candidate, index) => candidate !== candidates[index]);\n return changed ? formatSrcset(next) : value;\n }\n if (!isAssetKey(tagName, name)) {\n return value;\n }\n return _canvasAssetResolver(value, name) ?? value;\n}\n\n/** Every `url(...)` inside a CSS value, unquoted or quoted with either quote. */\nconst CSS_URL_RE = /\\burl\\(\\s*(?<q>[\"']?)(?<u>[^\"')]*)\\k<q>\\s*\\)/g;\n\n/**\n * Resolve every `url()` inside a CSS value.\n *\n * Applied to CSS rather than to a list of properties because in CSS a `url()` is ALWAYS a resource\n * reference — `background-image`, `mask`, `cursor`, `@font-face src`, `list-style-image` and every\n * shorthand that contains them — so enumerating the properties would be a list that goes stale\n * while the syntax does not.\n */\nfunction canvasStyleUrls(value: string): string {\n if (!_canvasAssetResolver || !value.includes(\"url(\")) {\n return value;\n }\n return value.replaceAll(CSS_URL_RE, (whole, quote: string, url: string) => {\n const resolved = url === \"\" ? null : (_canvasAssetResolver?.(url, \"url()\") ?? null);\n return resolved === null ? whole : `url(${quote}${resolved}${quote})`;\n });\n}\n\n/**\n * A style scalar as the canvas wants it written: assets resolved, then viewport units transposed.\n *\n * Exported because the canvas emits some CSS itself — the site-level `style` block, which never\n * passes through {@link applyStyle} — and a second implementation of \"what the canvas does to a\n * style value\" is a second thing to keep in step.\n *\n * @param {string} value - A CSS declaration value\n * @returns {string} The value as the canvas should write it\n */\nexport function canvasStyleValue(value: string): string {\n return transposeCanvasUnits(canvasStyleUrls(value));\n}\n\n/**\n * Studio-canvas prop-binding markers. When on, `bindProperty` stamps `data-jx-bound-prop=\"<key>\"`\n * on elements whose `textContent` is an invertible single-key state binding — the pure template\n * `\"${state.key}\"` or `{ \"$ref\": \"#/state/key\" }`. The studio canvas uses the marker to offer\n * inline editing of component-instance prop values; the rendered text must BE the prop value\n * verbatim, so mixed templates and deep paths are never stamped. Off (the default) leaves\n * production rendering untouched; the studio sets it for design/edit (not preview — see\n * iframe-render).\n */\nlet _stampPropBindings = false;\nexport function setStampPropBindings(on: boolean) {\n _stampPropBindings = on;\n}\n\n/** The single invertible template form: the whole string is exactly one `${state.key}` access. */\nconst PURE_STATE_TEMPLATE = /^\\s*\\$\\{\\s*state\\.(\\w+)\\s*\\}\\s*$/;\n\n/** The state key of an invertible `textContent` binding, or null (mixed template, deep path). */\nfunction boundPropKey(\n key: string,\n val: JxDocumentValue | undefined,\n state: JxScope,\n): string | null {\n if (!_stampPropBindings || key !== \"textContent\") {\n return null;\n }\n let sub: string | null = null;\n if (isRefValue(val)) {\n if (!val.$ref.startsWith(\"#/state/\")) {\n return null;\n }\n const rest = val.$ref.slice(\"#/state/\".length);\n sub = rest && !rest.includes(\"/\") ? rest : null;\n } else if (isString(val)) {\n sub = PURE_STATE_TEMPLATE.exec(val)?.[1] ?? null;\n }\n if (!sub) {\n return null;\n }\n // Only plain writable data entries are per-instance props. Computed/signal entries live as refs\n // In the raw scope (auto-unwrapped by the reactive proxy), and function/object entries (handlers,\n // $prototype instances) are not prop-overridable either — an instance $props write against any of\n // Them would clobber the definition's behavior, so their bindings are never marked editable.\n const stored = toRaw(state)[sub];\n if (isRef(stored) || isFunction(stored)) {\n return null;\n }\n if (isNonNullObject(stored)) {\n return null;\n }\n return sub;\n}\n\n/**\n * Build the reactive scope (state) from the document using the five-shape detection algorithm.\n *\n * @param {JxDocument} doc\n * @param {JxScope} [parentScope] Default is `{}`\n * @param {string} [base] Base URL for resolving $src imports. Default is `location.href`\n * @param {JxContext} [ctx] The mount context; absent on the legacy direct path\n * @returns {Promise<JxScope>} Reactive proxy (state)\n */\nexport async function buildScope(\n doc: JxDocument,\n parentScope: JxScope = {},\n base: string = location.href,\n ctx?: JxContext,\n) {\n // A body run without an event dispatches from the mount's root, read when it fires.\n const dispatchRoot = (): EventTarget | null => ctx?.root ?? null;\n const raw: JxScope = {};\n const defs = doc.state ?? {};\n\n /* Merge parent scope properties. A REACTIVE parent stays live: its members are read through\n accessors rather than copied, so a host that hands in a reactive record as the scope sees the\n document follow every field of it, not a snapshot of the primitives it held at mount time. A\n member the document declares itself is copied instead, so the document's own entry can still\n overwrite it — the document wins (embedding.md §3). */\n const linked = isReactive(parentScope);\n for (const key of Object.keys(parentScope)) {\n if (linked && !(key in defs)) {\n Object.defineProperty(raw, key, {\n configurable: true,\n enumerable: true,\n get: () => parentScope[key],\n set: (value: JxScopeValue) => {\n parentScope[key] = value;\n },\n });\n } else {\n raw[key] = parentScope[key];\n }\n }\n\n // Pass 0: resolve bare $prototype names via import map\n const imports = doc.imports ?? {};\n for (const [, def] of Object.entries(defs)) {\n if (isPrototypeDef(def) && !def.$src) {\n const mapped = imports[def.$prototype];\n if (mapped) {\n if (!mapped.endsWith(\".class.json\")) {\n console.warn(\n `Jx: import \"${def.$prototype}\" must map to a .class.json path, got \"${mapped}\"`,\n );\n continue;\n }\n def.$src = mapped;\n }\n }\n }\n\n // First pass: collect naked values, expanded defaults, plain objects\n for (const [key, def] of Object.entries(defs)) {\n // 1. String value\n if (isString(def)) {\n if (!def.includes(\"${\")) {\n raw[key] = def;\n } // Shape 1: naked string\n continue; // Template strings handled in second pass\n }\n\n // 2. Number, boolean, null\n if (isNumber(def) || isBoolean(def) || def === null) {\n raw[key] = def;\n continue;\n }\n\n // 3. Array\n if (Array.isArray(def)) {\n raw[key] = def;\n continue;\n }\n\n // 4. Object\n if (isNonNullObject(def)) {\n if (def.$prototype) {\n continue;\n } // Handled in later passes\n if (isExpressionDef(def)) {\n continue;\n } // Handled in pass 2.5\n if (isServerFnDef(def)) {\n continue;\n } // Handled in fifth pass\n if (\"default\" in def) {\n raw[key] = def.default;\n continue;\n } // Shape 2: expanded signal\n if (hasSchemaKeywords(def)) {\n continue;\n } // Shape 2b: pure type def\n raw[key] = def; // Shape 1: plain object\n }\n }\n\n // Wrap in Vue reactive proxy — deep reactivity from this point on\n const state = reactive(raw);\n\n // Second pass: template strings → computed, a single expression keeping its own type (§5.3)\n for (const [key, def] of Object.entries(defs)) {\n if (isString(def) && def.includes(\"${\")) {\n state[key] = computed(() => evaluateValueTemplate(def, state));\n }\n }\n\n // Pass 2.5: $expression entries (Shape 5)\n for (const [key, def] of Object.entries(defs)) {\n if (isExpressionDef(def)) {\n const node = def.$expression;\n if (isNamedFormulaDef(def)) {\n // A named formula: callable with positional args mapped onto its declared parameters.\n const params = def.parameters;\n state[key] = (...argValues: JxScopeValue[]) =>\n evaluateExpression(node, state, null, { args: bindPositionalArgs(params, argValues) });\n } else if (isMutating(node.operator)) {\n const handler: JxEventHandler = (s, event) => evaluateExpression(node, s, event);\n state[key] = handler;\n } else {\n state[key] = computed(() => evaluateExpression(node, state, null));\n }\n }\n }\n\n // Third pass: $prototype: \"Function\" entries\n for (const [key, def] of Object.entries(defs)) {\n if (hasStructuredBody(def)) {\n // Structured body (spec §20): with parameters → a callable mapping positional args onto\n // $args names (invoked via the call operator); without → an event handler.\n const { body } = def;\n if (Array.isArray(def.parameters) && def.parameters.length > 0) {\n const params = def.parameters;\n state[key] = (...argValues: JxScopeValue[]) =>\n runStatements(body, state, null, {\n args: bindPositionalArgs(params, argValues),\n target: dispatchRoot,\n });\n } else {\n /* The event is optional in fact: a `call` operator or a host invokes a handler with the\n scope alone, and the body then runs with no event rather than an undefined one. */\n const handler = (s: JxScope, event?: Event | null): void => {\n void runStatements(body, s, event ?? null, { target: dispatchRoot });\n };\n state[key] = handler;\n }\n } else if (isFunctionDef(def)) {\n state[key] = await resolveFunction(def, state, key, base);\n }\n }\n\n // Fourth pass: other $prototype entries (Request, Set, Map, etc.)\n for (const [key, def] of Object.entries(defs)) {\n if (isPrototypeDef(def)) {\n state[key] = await resolvePrototype(def, state, key, base, ctx);\n }\n }\n\n /* Fifth pass: timing: \"server\" entries, each called through the host's /__jx_server__ proxy, or\n in process only when the host registered the module itself (spec.md §11.4) */\n if (!(ctx?.skipServerFunctions ?? _serverFnConfig.skip)) {\n for (const [key, def] of Object.entries(defs)) {\n if (isServerFnDef(def)) {\n state[key] = await resolveServerFunction(def, state, key, base);\n }\n }\n }\n\n const rootMedia = ctx?.media ?? _rootMedia;\n if (doc.$media) {\n state[\"$media\"] = doc.$media;\n } else if (!state[\"$media\"] && Object.keys(rootMedia).length > 0) {\n state[\"$media\"] = rootMedia;\n }\n\n return state;\n}\n\n/**\n * Map a call's positional arguments onto a definition's declared parameter names, as `$args/<name>`\n * refs read them. A parameter given as an object supplies its `default` for a position the call\n * left undefined. Parameters come from a document that is not schema-validated at runtime, so an\n * entry that names nothing (null, or an object without a `name`) binds nothing.\n *\n * @param parameters The declared parameters, in call order\n * @param argValues The values the call passed, in the same order\n * @returns {JxScope} Name to value, for the body's `$args` refs\n */\nfunction bindPositionalArgs(\n parameters: readonly (string | CemParameter | null)[],\n argValues: readonly JxScopeValue[],\n): JxScope {\n const args: JxScope = {};\n for (const [i, p] of parameters.entries()) {\n const name = isString(p) ? p : (p?.name ?? \"\");\n if (!name) {\n continue;\n }\n args[name] =\n argValues[i] === undefined && p !== null && !isString(p) && \"default\" in p\n ? p.default\n : argValues[i];\n }\n return args;\n}\n\n/**\n * Check whether an object contains any JSON Schema keywords. Used to discriminate Shape 2b (pure\n * type definition) from Shape 1 (naked object).\n *\n * @param obj A state entry object, as the document wrote it\n * @returns {boolean}\n */\nfunction hasSchemaKeywords(obj: Readonly<Record<string, JxDocumentValue | undefined>>) {\n for (const k of Object.keys(obj)) {\n if (SCHEMA_KEYWORDS.has(k)) {\n return true;\n }\n }\n return false;\n}\nexport { hasSchemaKeywords };\n\n/**\n * The names a template may read without a `state.` prefix, in the order {@link templateArgs}\n * supplies them.\n *\n * `$site` and `$page` are here for the reason `evaluateStaticTemplate` in the compiler binds them:\n * every example in site-architecture.md §8.2 and §13.4 writes the bare `${$page.locale}`, and\n * `injectContext` (or the Studio canvas) puts the two on the document's state, not in the\n * template's lexical scope. Without them the live runtime threw `ReferenceError: $page is not\n * defined` on a template the build renders, so a page that prerendered correctly drew nothing where\n * it hydrated or rendered live.\n */\nconst TEMPLATE_PARAMS = [\"state\", \"$map\", \"item\", \"index\", \"$site\", \"$page\"] as const;\n\n/** The values {@link TEMPLATE_PARAMS} name, read from one scope. */\nfunction templateArgs(state: JxScope): Parameters<TemplateFn<unknown>> {\n const $map = rowContext(state);\n return [state, $map, $map?.item, $map?.index, state.$site, state.$page];\n}\n\n/**\n * Evaluate a template string in the context of state and optional $map. Templates use\n * `state.varName`, `$map.item` (or `item`) and the page context `$page` / `$site`.\n *\n * @param {string} str\n * @param {JxScope} state\n * @returns {string}\n */\nfunction evaluateTemplate(str: string, state: JxScope): string {\n let fn = textTemplates.get(str);\n if (!fn) {\n /* SAFETY: `new Function` compiles exactly the TEMPLATE_PARAMS, and its body returns a template\n literal, so every call answers a string (or throws, which the caller sees). */\n fn = new Function(...TEMPLATE_PARAMS, `return \\`${str}\\``) as TemplateFn<string>;\n remember(textTemplates, str, fn);\n }\n return fn(...templateArgs(state));\n}\n\n/**\n * Compiled templates, by source. A compiled template closes over nothing — everything it reads\n * arrives as one of its TEMPLATE_PARAMS — so one function per distinct source serves every binding\n * that spells it. Compiling is the expensive half: a `$map` row re-bound to a fresh item re-runs\n * each of its template effects, and a 40-row window re-binding on every scroll step spent seconds\n * in `new Function` alone. A source that fails to compile throws before it is stored, so it throws\n * again on the next evaluation exactly as it did before the cache existed.\n */\nconst textTemplates = new Map<string, TemplateFn<string>>();\n\n/** {@link textTemplates}, for single-expression templates compiled to keep their own type. */\nconst valueTemplates = new Map<string, TemplateFn<JxScopeValue>>();\n\n/**\n * How many sources a template cache holds before it starts over. Editing mints a new source per\n * keystroke, so the cache is bounded; clearing it wholesale costs one recompile per live binding,\n * which is what every evaluation cost before there was a cache.\n */\nconst TEMPLATE_CACHE_MAX = 4096;\n\n/**\n * Store a compiled template, emptying the cache first when it is full.\n *\n * @param {Map<string, F>} cache\n * @param {string} source\n * @param {F} fn\n */\nfunction remember<F>(cache: Map<string, F>, source: string, fn: F): void {\n if (cache.size >= TEMPLATE_CACHE_MAX) {\n cache.clear();\n }\n cache.set(source, fn);\n}\n\n/** Template sources already reported as throwing, so a binding re-run per keystroke warns once. */\nconst reportedTemplates = new Set<string>();\n\n/** Who hears a throwing template binding, when a host asked to; otherwise the console does. */\nlet _templateErrorHandler: ((error: Error, source: string) => void) | null = null;\n\n/**\n * Route throwing template bindings to `handler` instead of a console warning, or back with `null`.\n *\n * A binding survives its expression throwing (§6.1), which is right for a page and wrong for a host\n * whose question IS whether the document renders: Studio's render critic must still refuse a page\n * whose `${nonExistent}` can never evaluate. Every throw is delivered, not only the first.\n *\n * @param {((error: Error, source: string) => void) | null} handler\n */\nexport function setTemplateErrorHandler(\n handler: ((error: Error, source: string) => void) | null,\n): void {\n _templateErrorHandler = handler;\n}\n\n/**\n * Run a template binding as an effect that survives its expression throwing.\n *\n * A binding is live: `${state.posts.length}` over a collection that resolves asynchronously reads\n * `null` first and an array a moment later. Unguarded, the first run's TypeError escaped `effect()`\n * — which stops the effect before rethrowing — so the binding never re-ran when the data arrived,\n * and the throw unwound the whole `renderNode` above it: one early read blanked the page. Caught\n * INSIDE the effect, every dependency read before the throw stays tracked, so the binding re-runs\n * on the change that makes it valid. Until then it shows `fallback`'s answer (nothing written, by\n * default), and the error is reported once per source.\n *\n * @param {string} source - The template, for the report\n * @param {() => void} run - Evaluates the template and writes it\n * @param {() => void} [fallback] - What a throwing evaluation writes instead\n */\nfunction bindTemplate(source: string, run: () => void, fallback?: () => void): void {\n effect(() => {\n try {\n run();\n } catch (error) {\n if (_templateErrorHandler) {\n _templateErrorHandler(error instanceof Error ? error : new Error(String(error)), source);\n } else if (!reportedTemplates.has(source)) {\n reportedTemplates.add(source);\n console.warn(`jx: template ${JSON.stringify(source)} threw:`, error);\n }\n fallback?.();\n }\n });\n}\n\n/** A compiled template: the scope, the row context, its item and index, and the page context. */\ntype TemplateFn<R> = (\n state: JxScope,\n $map: JxRowContext | undefined,\n item: JxRowContext[\"item\"],\n index: JxRowContext[\"index\"] | undefined,\n $site: JxScopeValue,\n $page: JxScopeValue,\n) => R;\n\n/**\n * The row context a scope carries, or undefined outside a mapped row.\n *\n * @param {JxScope} state\n * @returns {JxRowContext | undefined}\n */\nfunction rowContext(state: JxScope): JxRowContext | undefined {\n /* SAFETY: `$map` is runtime vocabulary. A host scope may not supply it (`assertHostScope`), a\n node never binds it as a `$`-local (it is in RESERVED_KEYS), and the one writer is\n `renderMappedArrayInto`, which binds the `{ index, item }` row record; elsewhere it is absent. */\n return state.$map as JxRowContext | undefined;\n}\n\n/**\n * Whether a template is ONE expression end to end — `\"${a.b}\"` rather than `\"a ${b}\"` or\n * `\"${a}${b}\"`.\n *\n * Depth-counted rather than pattern-matched. A greedy `/^\\$\\{(.+)\\}$/` also matched `\"${a} /\n * ${b}\"`, spliced the interior into `return (a} / ${b)`, and the SyntaxError became a silent null:\n * the node rendered empty and a `$head` entry shipped its own template text. A brace scan is exact\n * where a tightened regex is not — `\"${`${a}-x`}\"` is still one expression, and must keep its raw\n * value.\n *\n * Lives here rather than in the compiler because both renderers must draw the line in the same\n * place. It is what decides whether a value keeps its own type, and a value that is a boolean in\n * one renderer and the string `\"false\"` in the other is a page that changes meaning as it\n * hydrates.\n *\n * @param {string} str - Template source\n * @returns {boolean} True when the whole string is a single `${…}`\n */\nexport function isSingleExpression(str: string): boolean {\n if (!str.startsWith(\"${\") || !str.endsWith(\"}\")) {\n return false;\n }\n let depth = 0;\n for (let i = 1; i < str.length; i += 1) {\n const c = str[i];\n if (c === \"{\") {\n depth += 1;\n } else if (c === \"}\") {\n depth -= 1;\n if (depth === 0) {\n return i === str.length - 1;\n }\n }\n }\n return false;\n}\n\n/**\n * Evaluate a template as a VALUE — a state entry (Shape 3) or an attribute — keeping the\n * expression's own type.\n *\n * `evaluateTemplate` interpolates into a string, which is what text wants and what a value cannot\n * afford: `\"${state.expanded}\"` has to arrive as the boolean `false`, or `booleanAttrValue` never\n * sees a boolean, `open=\"false\"` is written, and HTML reads that as open. A state entry is the same\n * case one step removed: `\"isBrand\": \"${state.name === 'github'}\"` held the string `\"false\"`, which\n * is truthy, so every `state.isBrand ? … : …` took the wrong branch in Studio and in a hydrated\n * component while the prerendered page took the right one. Only a single expression can carry a\n * type at all — `\"a ${b}\"` is text by construction — which is the same line\n * `evaluateStaticTemplate` draws in the compiler, and drawing it identically is what keeps a\n * prerendered page and the same document rendered live in agreement.\n *\n * @param {string} str - Template source\n * @param {JxScope} state - Reactive scope\n * @returns {JxScopeValue} The expression's value, or the interpolated string\n */\nfunction evaluateValueTemplate(str: string, state: JxScope): JxScopeValue {\n if (!isSingleExpression(str)) {\n return evaluateTemplate(str, state);\n }\n let fn = valueTemplates.get(str);\n if (!fn) {\n /* SAFETY: `new Function` compiles exactly the TEMPLATE_PARAMS; the body returns one\n expression's value, which is whatever the scope it reads holds, so it is typed as a scope\n member and narrowed by the attribute writer. */\n fn = new Function(\n ...TEMPLATE_PARAMS,\n `return (${str.slice(2, -1)})`,\n ) as TemplateFn<JxScopeValue>;\n remember(valueTemplates, str, fn);\n }\n return fn(...templateArgs(state));\n}\n\n// ─── Step 2b: Function resolution (Shape 4) ─────────────────────────────────\n\n/**\n * A module namespace as the runtime reads it: exports looked up by name, then under `default` (the\n * shape a CommonJS module takes when imported). An export is whatever the module exported, so each\n * lookup checks what it found before using it.\n */\ninterface ImportedModule {\n readonly [exportName: string]: JxScopeValue;\n readonly default?: ImportedModule;\n}\n\n/**\n * Import a module namespace by specifier.\n *\n * Not `async`: the import's own promise is handed back, so awaiting this costs exactly the ticks\n * awaiting `import()` did, and scope construction keeps its order against its siblings'.\n *\n * @param {string} specifier\n * @returns {Promise<ImportedModule>}\n */\n/**\n * How the host serves the package an `npm:` specifier names, or null for none.\n *\n * `npm:@jxsuite/search/client` is a package specifier (spec.md §5.3, 4c), and the build bundles it\n * (`compiler/src/site/bundler.ts`). The interpreter had no answer for it: `new URL()` reads `npm:`\n * as a URL scheme, so it was handed to `import()` verbatim and the browser refused it as a\n * cross-origin request to a scheme it does not fetch. A host that renders documents live knows\n * where its packages are served (the dev server bundles `/node_modules/<package>/<subpath>` on\n * demand), so it says so here. With no resolver the bare specifier is imported, which an import map\n * can answer.\n */\nlet _npmModuleResolver: ((specifier: string) => string) | null = null;\n\n/**\n * Install (or with `null`, remove) the host's resolver for `npm:` specifiers.\n *\n * @param {((specifier: string) => string) | null} resolver - Package specifier → importable URL\n */\nexport function setNpmModuleResolver(resolver: ((specifier: string) => string) | null): void {\n _npmModuleResolver = resolver;\n}\n\n/** The scheme a package specifier is written with. */\nconst NPM_SCHEME = \"npm:\";\n\n/**\n * Import a module a document names by `$src`: an `npm:` package through the host's resolver, and\n * anything else from the document's base (then as written).\n *\n * @param {string} src - The `$src` as the document spells it\n * @param {string} [base] - The document's URL\n * @returns {Promise<ImportedModule>}\n */\nasync function importSource(src: string, base?: string): Promise<ImportedModule> {\n if (src.startsWith(NPM_SCHEME)) {\n const specifier = src.slice(NPM_SCHEME.length);\n return importModule(_npmModuleResolver?.(specifier) ?? specifier);\n }\n if (base) {\n try {\n return await importModule(new URL(src, base).href);\n } catch {\n return importModule(src);\n }\n }\n return importModule(src);\n}\n\nfunction importModule(specifier: string): Promise<ImportedModule> {\n /* SAFETY: trust boundary — a module exports whatever it exports. `import()` resolves to the\n module namespace object, whose keys are its export names, and every export is typed as the scope\n member it becomes: the runtime uses one only after `isFunction` has accepted it (a Function\n entry's `$src`, a server function, a `$implementation` class) or after testing it for\n presence, and both tests are defined for any value a module can export. `default` is only ever\n read through optional property access. */\n return import(specifier) as Promise<ImportedModule>;\n}\n\n/**\n * An external class's instance as the runtime uses it (spec.md §12.3): a record read by member\n * name, three members of which are its contract with the runtime — a `value`, a `resolve()` that\n * produces one (possibly a promise), and a `subscribe()` that pushes later ones. Each is optional\n * and checked before it is used.\n */\ninterface ExternalClassInstance extends JxScope {\n value?: JxScopeValue;\n resolve?: () => JxScopeValue | Promise<JxScopeValue>;\n subscribe?: (callback: (value: JxScopeValue) => void) => void;\n}\n\n/** Module cache for $src imports (shared with external class resolution). */\nconst _moduleCache = new Map<string, ImportedModule>();\n\n/** A module the host will import on first use, keyed as the document spells its `$src`. */\ntype ModuleLoader = () => Promise<ImportedModule>;\n\n/**\n * Lazy registrations: a loader until it runs, then the in-flight load, so two entries resolving the\n * same sidecar in one tick share one import rather than racing two.\n */\nconst _moduleLoaders = new Map<string, ModuleLoader | Promise<ImportedModule>>();\n\n/**\n * The specifiers a host registered through `preloadModule`, in either form. Kept apart from\n * `_moduleCache` because that cache is shared: a Function entry's `$src` import lands there too,\n * and a `timing: \"server\"` entry naming the same specifier must still not run in the browser\n * (spec.md §11.4). Only the host's own registration admits a server module in process.\n */\nconst _hostSeeded = new Set<string>();\n\n/**\n * Seed the `$src` module cache with a module the host already imported, under the specifier the\n * document spells. A bundled document cannot have its sidecar fetched by URL — the bundler saw\n * neither the string nor the file — so the host imports the sidecar itself and registers it here,\n * and `$src` then resolves exactly as it would have from the network.\n *\n * Given a FUNCTION instead of a namespace, the registration is lazy: nothing is imported until a\n * document names the specifier, and the loader runs once. That is the shape for a host that can\n * bundle a sidecar as its own chunk but should not pay for it until something renders — Studio's\n * canvas frame registers every kit behaviour this way, so a page that uses no kit element loads\n * none of them (embedding.md §6).\n *\n * A registered module is also how a host runs a `timing: \"server\"` entry in process; for any\n * specifier not registered here, the runtime calls the host's `/__jx_server__` proxy instead.\n *\n * @param {string} specifier - The `$src` value as written in the document\n * @param {ImportedModule | ModuleLoader} mod - The imported module namespace, or a loader that\n * imports it on first use\n */\nexport function preloadModule(specifier: string, mod: ImportedModule | ModuleLoader): void {\n _hostSeeded.add(specifier);\n if (isFunction(mod)) {\n _moduleCache.delete(specifier);\n _moduleLoaders.set(specifier, mod);\n return;\n }\n _moduleLoaders.delete(specifier);\n _moduleCache.set(specifier, mod);\n}\n\n/**\n * The module a specifier was seeded with — imported, or lazily registered — or undefined when the\n * host said nothing about it and the network is the answer.\n *\n * SYNCHRONOUS for a namespace the host imported, and that is load-bearing rather than tidy: a cache\n * hit used to be a `Map#has` on the way through `resolveFunction`, and an `await` there — even of a\n * value that is not a promise — defers one microtask, which reorders every element's scope\n * construction against its siblings'. The kit's field naming its slotted control is one thing that\n * order decides. Only a loader is a promise, because only a loader has to be.\n *\n * @param {string} src\n * @returns {ImportedModule | Promise<ImportedModule> | undefined}\n */\nfunction seededModule(src: string): ImportedModule | Promise<ImportedModule> | undefined {\n const cached = _moduleCache.get(src);\n if (cached) {\n return cached;\n }\n const pending = _moduleLoaders.get(src);\n if (!pending) {\n return undefined;\n }\n if (!isFunction(pending)) {\n return pending;\n }\n /* Started here, outside the async body, so a loader that throws synchronously still throws to\n the caller. The async body turns a thenable from a host's loader into a Promise the call sites\n can tell from a namespace. */\n const started = pending();\n const load = (async () => {\n try {\n const mod = await started;\n _moduleCache.set(src, mod);\n _moduleLoaders.delete(src);\n return mod;\n } catch (error) {\n /* A failed load — a chunk the network dropped — puts the loader back, so the next document to\n name the specifier tries again rather than inheriting this rejection for good. */\n _moduleLoaders.set(src, pending);\n throw error;\n }\n })();\n _moduleLoaders.set(src, load);\n return load;\n}\n\n/**\n * A Function entry's implementation as the runtime calls it — a compiled `body` or a `$src` export\n * — with the scope as its first argument. JavaScript checks none of the arguments, and what the\n * call returns is bound into the scope like any other member.\n */\ntype ScopeFunction = (...args: JxScopeValue[]) => JxScopeValue;\n\n/**\n * Resolve a $prototype: \"Function\" entry into a function or computed.\n *\n * Functions receive state as their first parameter at call time. Functions with a return statement\n * in their body are wrapped in computed() for reactive evaluation.\n *\n * @param {JxFunctionDef} def - State entry with $prototype: \"Function\"\n * @param {JxScope} state - Reactive scope proxy\n * @param {string} key - Def key name\n * @param {string} [base] - Base URL for resolving $src imports\n * @returns {Promise<JxScopeValue>}\n */\nasync function resolveFunction(def: JxFunctionDef, state: JxScope, key: string, base?: string) {\n if (def.body && def.$src) {\n throw new Error(`Jx: '${key}' declares both body and $src — these are mutually exclusive`);\n }\n if (!def.body && !def.$src) {\n const params = resolveParamNames(def);\n const noop = new Function(...params, \"\");\n Object.defineProperty(noop, \"name\", {\n configurable: true,\n value: def.name ?? key,\n });\n return noop;\n }\n\n let fn: ScopeFunction;\n\n if (isString(def.body)) {\n const params = resolveParamNames(def);\n /* SAFETY: `new Function` returns an ordinary function of the named parameters, `state` first.\n A call never checks its arguments, and what the body returns is one more scope member. */\n fn = new Function(...params, def.body) as ScopeFunction;\n Object.defineProperty(fn, \"name\", {\n configurable: true,\n value: def.name ?? key,\n });\n } else {\n // $src: dynamic import (the body/$src dichotomy was validated above)\n const src = def.$src;\n if (!src) {\n throw new Error(`Jx: '${key}' has neither body nor $src`);\n }\n const exportName = def.$export ?? key;\n let mod: ImportedModule;\n const seeded = seededModule(src);\n if (seeded instanceof Promise) {\n mod = await seeded;\n } else if (seeded) {\n mod = seeded;\n } else {\n mod = await importSource(src, base);\n _moduleCache.set(src, mod);\n }\n const candidate = mod[exportName] ?? mod.default?.[exportName];\n if (!isFunction(candidate)) {\n throw new TypeError(`Jx: export \"${exportName}\" not found or not a function in \"${src}\"`);\n }\n /* SAFETY: the guard proved a function, and a function accepts any call: the runtime passes the\n scope first, as a Function entry's contract says, and binds the result as a scope member. */\n fn = candidate as ScopeFunction;\n }\n\n // Detect computed: body contains a return statement, or $src function introspection.\n // Functions with parameters (event handlers, callbacks) are never computed.\n const hasParams = (def.parameters ?? def.arguments ?? []).length > 0;\n let isComputed = false;\n if (!hasParams) {\n isComputed = isString(def.body)\n ? bodyReturnsValue(def.body)\n : fn.length <= 1 && bodyReturnsValue(fn.toString());\n }\n if (isComputed) {\n return computed(() => fn(state));\n }\n\n return fn;\n}\n\n// ─── Step 3: Render ───────────────────────────────────────────────────────────\n\n/**\n * Extract parameter names from a function definition. Supports both legacy \"arguments\" (string\n * array) and CEM-compatible \"parameters\" (object array). Always ensures \"state\" is the first\n * parameter.\n *\n * @param {JxFunctionDef | JxPrototypeDef} def\n * @returns {string[]}\n */\nfunction resolveParamNames(def: JxFunctionDef | JxPrototypeDef) {\n const names = def.parameters ? paramNames(def.parameters) : (def.arguments ?? []);\n return names.length > 0 && names[0] === \"state\" ? names : [\"state\", ...names];\n}\n\n/**\n * Reserved Jx keys — never set as DOM properties.\n *\n * @type {Set<string>}\n */\nexport const RESERVED_KEYS = new Set([\n \"$schema\",\n \"$id\",\n \"$defs\",\n \"state\",\n \"$ref\",\n \"$props\",\n \"$elements\",\n \"$title\",\n \"$description\",\n \"$switch\",\n \"$prototype\",\n \"$src\",\n \"$export\",\n \"$media\",\n \"$map\",\n \"timing\",\n \"default\",\n \"description\",\n \"body\",\n \"parameters\",\n \"arguments\",\n \"name\",\n \"tagName\",\n \"children\",\n \"style\",\n \"attributes\",\n \"items\",\n \"map\",\n \"filter\",\n \"sort\",\n \"cases\",\n \"observedAttributes\",\n]);\n\n/**\n * A child scope: reads fall through to `parent`, writes land on the child.\n *\n * @param {JxScope} parent\n * @returns {JxScope}\n */\nfunction inheritScope(parent: JxScope): JxScope {\n /* SAFETY: `Object.create` is typed `any`, but what it returns is a plain object whose prototype\n is `parent`, so it is keyed by string exactly as the scope it extends is. */\n return Object.create(parent) as JxScope;\n}\n\n/**\n * The named breakpoints a scope carries, or none.\n *\n * @param {JxScope} state\n * @returns {Record<string, string>}\n */\nfunction scopeMedia(state: JxScope): Record<string, string> {\n /* SAFETY: `$media` is runtime vocabulary a host scope may not supply (`assertHostScope`); the one\n writer is `buildScope`, which stores a document's or the mount's `$media` map, a record of\n breakpoint name to media query. */\n return (state[\"$media\"] as Record<string, string> | undefined) ?? {};\n}\n\n/**\n * An element as the property bag a Jx key writes into, `el[key] = value`. Reading or writing a key\n * the element does not define is an ordinary expando, as it is in JavaScript.\n */\ntype ElementProperties = HTMLElement & Record<string, JxScopeValue>;\n\n/**\n * View an element as its property bag.\n *\n * @param {HTMLElement} el\n * @returns {ElementProperties}\n */\nfunction elementProperties(el: HTMLElement): ElementProperties {\n /* SAFETY: every element is an ordinary extensible object, so any string key can be read (a\n missing one is undefined) and written; the added index signature claims nothing more. */\n return el as ElementProperties;\n}\n\n/**\n * The reactive state a connected Jx instance renders from, or null for any other element (and for\n * an instance that has not connected yet).\n *\n * @param {HTMLElement} el\n * @returns {JxScope | null}\n */\nfunction instanceStateOf(el: HTMLElement): JxScope | null {\n const state = elementProperties(el)._state;\n /* SAFETY: `_state` is written by one writer, the Jx element class's `connectedCallback`, which\n stores the scope `buildScope` answered; on any other element the expando is absent, and a\n non-object is refused below. */\n return isNonNullObject(state) ? (state as JxScope) : null;\n}\n\n/**\n * Whether a scope member can be called as an event handler, `(scope, event)`. Being a function is\n * the whole contract, for the reason {@link isScopeHook} gives.\n */\nfunction isEventHandler(value: unknown): value is JxEventHandler {\n return isFunction(value);\n}\n\n/**\n * Recursively render a Jx element definition into a DOM element.\n *\n * @param {JxElement | string | number | boolean} def\n * @param {JxScope} state - Reactive scope proxy (or child scope via Object.create)\n * @param {JxRenderOptions} [options]\n * @returns {HTMLElement | Text}\n */\n/** Refs already warned about, so the §13 diagnostic fires once per distinct target. */\nconst warnedRefChildren = new Set<string>();\n\n/** Foreign-content namespaces the HTML parser switches into, and the runtime must too. */\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\nconst MATHML_NS = \"http://www.w3.org/1998/Math/MathML\";\n\n/**\n * The namespace an element belongs in, given the one its parent established.\n *\n * The static build emits markup text, so the HTML parser applied foreign-content rules for it and\n * SVG worked there. The runtime built every node with `document.createElement`, which is HTML-only,\n * so the same document rendered blank in the Studio canvas and in any hydrated component — the\n * editor and the deployed site disagreeing, with only the editor wrong.\n *\n * @param {string} tagName\n * @param {string | null | undefined} inherited - The namespace the parent element established\n * @returns {string | null} Null means HTML\n */\nfunction elementNamespace(tagName: string, inherited: string | null | undefined): string | null {\n if (tagName === \"svg\") {\n return SVG_NS;\n }\n if (tagName === \"math\") {\n return MATHML_NS;\n }\n return inherited ?? null;\n}\n\nexport function renderNode(\n def: JxElement | string | number | boolean,\n state: JxScope,\n options?: JxRenderOptions,\n): HTMLElement | Text {\n const path = options?._path ?? [];\n\n // Text node children: bare strings/numbers/booleans produce DOM Text nodes\n if (isString(def) || isNumber(def) || isBoolean(def)) {\n const textNode = document.createTextNode(String(def));\n if (isTemplateString(def)) {\n bindTemplate(\n def,\n () => {\n textNode.textContent = evaluateTemplate(def, state);\n },\n () => {\n textNode.textContent = \"\";\n },\n );\n }\n return textNode;\n }\n\n // Extend scope with any $-prefixed local bindings declared on this node\n let localState: JxScope = state;\n for (const [key, val] of Object.entries(def)) {\n if (key.startsWith(\"$\") && !RESERVED_KEYS.has(key)) {\n if (localState === state) {\n localState = inheritScope(state);\n }\n localState[key] = isRefValue(val) ? resolveRef(val.$ref, state) : val;\n }\n }\n\n /*\n * §13 diagnostic: a node-level external `$ref` (the withdrawn component-instance syntax) has no\n * tagName and silently renders an empty <div>. Warn once per target instead of failing silently —\n * the supported mechanism is $elements + a custom-element tag (see spec §13).\n */\n if (\"$ref\" in def && !def.tagName) {\n const refTarget = String(def.$ref ?? \"\");\n if (!warnedRefChildren.has(refTarget)) {\n warnedRefChildren.add(refTarget);\n console.warn(\n `Jx: a $ref child (\"${refTarget}\") is not a supported component instance; register the ` +\n `component in $elements and use its custom-element tag instead (spec §13).`,\n );\n }\n }\n\n /* RESOLVED ONCE, HERE, before anything branches on it.\n A tag may be a name or a choice between names (`ElementTagName`). Resolving at the top means\n every test below — the hyphen check that routes to the custom-element path, `customElements.get`,\n `createElement` itself — sees a literal, exactly as it did when a tag could only be written out.\n\n It is not tracked. `tagName` is in RESERVED_KEYS so no binding sweep reaches it, and a tag that\n changed after mount would mean replacing the node: the subtree's listeners, its focus, its typed\n input values and its component instances all go with it, and this runtime has no dispose walk to\n pay that bill (renderSwitch, two hundred lines up, still leaks its previous case's effects).\n `jx validate` warns when a tag discriminant is also an assignment target, so the case where this\n rule bites is caught before it ships rather than found as a `<div>` that never became an `<a>`. */\n const tagName = resolveTagName(def.tagName, localState);\n const isCustomEl = tagName.includes(\"-\") && customElements.get(tagName);\n\n if (def.$props && isCustomEl) {\n return renderCustomElementWithProps(def, localState, options, path);\n }\n\n if (def.$props) {\n // A hyphenated tag carrying $props is a component instance whose definition has not finished\n // Registering yet (async defineElement — e.g. the Studio desktop canvas, where the component\n // Fetch can land after this node renders). Render via the property-first path anyway: it sets\n // The instance props as JS properties on the bare element, which the eventual upgrade's\n // ConnectedCallback reads back off `this` (see the def.state merge below), so the instance's\n // Props win. The old branch stripped the props here, so a late upgrade painted the component's\n // State DEFAULTS instead (\"0\"/\"DESCRIPTION\" for every instance). A non-custom tag can never\n // Upgrade, so it keeps the historical mergeProps-into-scope behavior.\n if (tagName.includes(\"-\")) {\n return renderCustomElementWithProps(def, localState, options, path);\n }\n const { $props: _$props, ...rest } = def;\n return renderNode(rest, mergeProps(def, localState), options);\n }\n if (def.$switch) {\n return renderSwitch(def, localState, options);\n }\n\n const ns = elementNamespace(tagName, options?._ns);\n /*\n * `foreignObject` is itself an SVG element, and is the documented way back into HTML: its\n * DESCENDANTS are HTML, so the element and its children carry different namespaces.\n */\n const childNs = tagName === \"foreignObject\" ? null : ns;\n /* SAFETY: a namespaced node is an Element, not an HTMLElement, but every apply* helper below\n touches only members SVG and MathML elements share with HTML ones (style, dataset,\n setAttribute, append), and `bindProperty` writes `className` as an attribute on them. */\n const el = ns\n ? (document.createElementNS(ns, tagName) as HTMLElement)\n : document.createElement(tagName);\n\n if (options?.onNodeCreated) {\n options.onNodeCreated(el, path, def, localState);\n }\n\n applyProperties(el, def, localState);\n /* A custom element's own definition applies its style at connection, through the same interning\n path — which releases whatever is already on the element. So the call site's style is\n remembered here and merged there; see {@link callSiteStyles}. */\n if (def.style && tagName.includes(\"-\")) {\n callSiteStyles.set(el, def.style);\n }\n applyStyle(el, def.style ?? {}, scopeMedia(localState), localState);\n applyAttributes(el, def.attributes ?? {}, localState);\n\n const kids = def.children;\n if (isMappedArray(kids)) {\n // Legacy whole-children repeater: the items render directly into `el` (which keeps its own\n // TagName, e.g. <ul>), with no extra wrapper element.\n const arrOpts =\n options || childNs ? { ...options, _ns: childNs, _path: [...path, \"children\"] } : undefined;\n renderMappedArrayInto(el, kids, localState, arrOpts);\n } else if (Array.isArray(kids)) {\n for (let i = 0; i < kids.length; i++) {\n const child = kids[i]!;\n const childOpts =\n options || childNs\n ? { ...options, _ns: childNs, _path: [...path, \"children\", i] }\n : undefined;\n if (isMappedArray(child)) {\n // Array pseudo-element among siblings: expand inline, no wrapper.\n renderMappedArrayInto(el, child, localState, childOpts);\n } else {\n el.append(renderNode(child, localState, childOpts));\n }\n }\n }\n\n return el;\n}\n\n// ─── Template string utilities ────────────────────────────────────────────────\n\n/**\n * Check if a value is a template string (contains ${}).\n *\n * @param {unknown} val\n * @returns {boolean}\n */\n// ─── Property / style / attribute application ─────────────────────────────────\n\n/**\n * @param {HTMLElement} el\n * @param {JxElement} def\n * @param {JxScope} state\n */\nfunction applyProperties(el: HTMLElement, def: JxElement, state: JxScope) {\n for (const [key, val] of Object.entries(def)) {\n if (RESERVED_KEYS.has(key)) {\n continue;\n }\n if (key.startsWith(\"$\")) {\n continue;\n } // Scope bindings — handled in renderNode\n\n if (key.startsWith(\"on\") && bindHandler(el, key, val, state)) {\n continue;\n }\n\n bindProperty(el, key, val, state);\n }\n}\n\n/**\n * Attach an `on*` key as an event listener, in any of the four spellings a handler has: a `$ref` to\n * a function, a structured body (spec §20), a string body, or an `$expression`. Returns false for a\n * value that is none of those, which the caller then writes as a plain property.\n *\n * @param {HTMLElement} el\n * @param {string} key The `on`-prefixed key\n * @param {JxDocumentValue | undefined} val\n * @param {JxScope} state\n * @returns {boolean} Whether a listener was attached\n */\nfunction bindHandler(\n el: HTMLElement,\n key: string,\n val: JxDocumentValue | undefined,\n state: JxScope,\n): boolean {\n const type = key.slice(2);\n const scope = state;\n if (isRefValue(val)) {\n const handler = resolveRef(val.$ref, state);\n if (isEventHandler(handler)) {\n el.addEventListener(type, (e) => handler(scope, e));\n }\n return true;\n }\n if (hasStructuredBody(val)) {\n const { body } = val;\n el.addEventListener(type, (e) => {\n void runStatements(body, scope, e);\n });\n return true;\n }\n if (isFunctionDef(val) && isString(val.body)) {\n const params = resolveParamNames(val);\n /* SAFETY: `new Function` returns an ordinary function of the named parameters, `state` first;\n the listener calls it with the scope and the event, and discards what it returns. */\n const fn = new Function(...params, val.body) as JxEventHandler;\n el.addEventListener(type, (e) => fn(scope, e));\n return true;\n }\n if (isExpressionDef(val)) {\n const node = val.$expression;\n el.addEventListener(type, (e) => evaluateExpression(node, scope, e));\n return true;\n }\n return false;\n}\n\n/**\n * A definition's root-level `on*` keys listen on the HOST element, exactly as they would on an\n * element in a document. Only handler keys are read here: the rest of a definition's root —\n * `observedAttributes`, `emits`, `description` — describes the element rather than styling an\n * instance, and is not written onto it.\n *\n * @param {HTMLElement} host\n * @param {JxElement} def\n * @param {JxScope} state\n */\nfunction bindDefinitionHandlers(host: HTMLElement, def: JxElement, state: JxScope) {\n for (const [key, val] of Object.entries(def)) {\n if (key.startsWith(\"on\") && !RESERVED_KEYS.has(key)) {\n bindHandler(host, key, val, state);\n }\n }\n}\n\n/**\n * @param {HTMLElement} el\n * @param {string} key\n * @param {JxDocumentValue | undefined} val\n * @param {JxScope} state\n */\nfunction bindProperty(\n el: HTMLElement,\n key: string,\n val: JxDocumentValue | undefined,\n state: JxScope,\n) {\n const target = elementProperties(el);\n const boundProp = boundPropKey(key, val, state);\n if (boundProp) {\n el.dataset.jxBoundProp = boundProp;\n }\n /* An `<img>` in a document says `{\"tagName\": \"img\", \"src\": \"/hero.jpg\"}`, so `src` arrives HERE\n as a top-level key and is written as a DOM PROPERTY — `attributes: { src }` is the rarer\n spelling. Both are the same reference and both need the same resolution. */\n const asAsset = (resolved: JxScopeValue): JxScopeValue =>\n isString(resolved) ? canvasAssetValue(el.tagName, key, resolved) : resolved;\n /*\n * `className` on an SVGElement is a read-only SVGAnimatedString, so assigning it throws in the\n * strict mode an ES module always runs under. It is the most common Jx element property, so the\n * attribute form is the only one that works on both.\n */\n const write = (resolved: JxScopeValue): void => {\n // Widened to Element: a namespaced node is typed HTMLElement here but is not one at runtime.\n const node: Element = el;\n if (key === \"className\" && !(node instanceof HTMLElement)) {\n node.setAttribute(\"class\", resolved == null ? \"\" : String(resolved));\n return;\n }\n /* An equal write is skipped. A binding re-runs whenever anything it read changes, not only\n when its own result does, and re-setting `value` on a focused control is not free: it can\n move the caret and collapse the selection. A control that already holds the value has\n nothing to learn from being told again. */\n if (target[key] === resolved) {\n return;\n }\n target[key] = resolved;\n };\n if (isRefValue(val)) {\n const refVal = val;\n if (key === \"id\") {\n /* SAFETY: the `id` setter is a WebIDL DOMString attribute, which converts whatever it is\n given to a string itself; the cast only lets the bound value reach that conversion. */\n target[key] = resolveRef(refVal.$ref, state) as string;\n return;\n }\n effect(() => {\n write(asAsset(resolveRef(refVal.$ref, state)));\n });\n return;\n }\n\n // Universal ${} reactivity — template strings in element properties\n if (isTemplateString(val)) {\n const template = val;\n bindTemplate(template, () => {\n write(asAsset(evaluateTemplate(template, state)));\n });\n return;\n }\n\n write(asAsset(val));\n}\n\n/*\n * ─── The Stylesheet Engine ───────────────────────────────────────────────────\n *\n * An authored `style` object becomes REAL CSS RULES, delivered through the document's\n * `adoptedStyleSheets`. Everything below exists to make that true, and the reason it has to be\n * true is a cascade inversion rather than a missing feature.\n *\n * `applyStyle` used to split one style object across two cascade ORIGINS: a top-level scalar went\n * inline (`el.style.color = …`) while an object-valued key became a per-element `<style>` tag. An\n * inline declaration beats any non-`!important` rule, so\n *\n * { \"backgroundColor\": \"#6e0303\", \":hover\": { \"backgroundColor\": \"#15164a\" } }\n *\n * emitted a perfectly correct `:hover` rule that could never win. Nesting was not missing; it was\n * outranked. The one existing defence, `mediaOverriddenProps`, moved a base property out of inline\n * when an `@`-block overrode it — one level deep, `@`-keys only, never `:hover` — which is the\n * shape of the bug rather than a fix for it. Every style assertion in the suite read the `<style>`\n * tag's text, so the inversion was invisible to all of them.\n *\n * With every declaration in a rule, `:hover` versus base is an ordinary equal-specificity pair and\n * source order decides, exactly as it does on the compiled page.\n *\n * **Three sheet roles, because mutation cost scales with sheet size.** Measured in Chrome 152 over\n * 500 styled elements: 500 `<style>` tags cost 86.0ms to build, one adopted sheet with hash dedup\n * costs 1.7ms, and 500 separate adopted sheets cost 6.2ms to build but 84.1ms per style recalc\n * because each one is walked. On the update path (300 value edits, the Style-panel hot path)\n * mutating a rule inside one big shared sheet costs 295.7ms, because Chrome rebuilds the whole\n * sheet's RuleSet on any mutation. So:\n *\n * - the SHARED sheet holds every static, interned rule set and is grown but never rewritten;\n * - a reactive declaration is indirected through a custom property, so the rule is static text\n * and the update writes `el.style.setProperty(\"--jx-r0-0\", v)` — 12.4ms, and independent of\n * sheet size (the same mechanism that makes `${…}` work inside a nested block at all);\n * - the SCRATCH sheet takes the elements under live Studio edit and is rewritten with\n * `replaceSync`, 7.5ms per 100 structural edits against 76.9ms for delete+insert in the big one.\n *\n * **The handle stays `data-jx`, and its value becomes a content hash.** Not a generated class:\n * `applyAttributes` runs after `applyStyle`, so a static `attributes: { class: … }` would wipe a\n * class handle. `data-jx` is already there, is specificity (0,1,0), and is not author-writable.\n * Hashing the built rule text rather than calling `Math.random()` is what gives dedup and SSR\n * stability, and it covers everything that varies per call site by construction — the authored\n * object, the resolved `$media` map and the canvas transposer state are all inputs to that text.\n *\n * **Jx emits no cascade layer of its own.** Third-party CSS arrives through `$head` unlayered, and\n * an unlayered rule beats a layered one at any specificity — so layering Jx's own rules would hand\n * every page's `$head` a win it does not have today. It is also what keeps the canvas's\n * `@layer jx-canvas-ua` UA emulation working now that base declarations are unlayered rules rather\n * than inline styles: unlayered still beats layered, which is the same direction author origin\n * beats UA origin on the shipped page.\n */\n\n/** A rule set as it was written into a sheet: the texts, plus the live rules when there are any. */\ninterface InsertedRules {\n texts: readonly string[];\n rules: CSSRule[];\n}\n\n/** A place rules can be written. Two implementations: the CSSOM, and `<style>` text. */\ninterface StyleSink {\n insert: (texts: readonly string[]) => InsertedRules;\n remove: (inserted: InsertedRules) => void;\n /** Rewrite the whole sink. Used only by the scratch sheet. */\n replaceAll: (texts: readonly string[]) => void;\n /** Everything written, in sheet order. See {@link documentStyleText}. */\n text: () => string;\n detach: () => void;\n}\n\n/**\n * A sink over a real `CSSStyleSheet` — constructable and adopted, or a `<style>` element's own.\n *\n * @param {CSSStyleSheet} sheet\n * @param {() => void} detach\n * @returns {StyleSink}\n */\nfunction cssomSink(sheet: CSSStyleSheet, detach: () => void): StyleSink {\n const entries: InsertedRules[] = [];\n return {\n detach,\n insert(texts) {\n const rules: CSSRule[] = [];\n for (const text of texts) {\n const index = sheet.cssRules.length;\n try {\n sheet.insertRule(text, index);\n } catch {\n /* One unparseable rule must not take the other twenty with it. A `<style>` element drops\n exactly the offending rule and keeps going; `insertRule` throws, so this restores the\n tolerance an author's stylesheet has always had. */\n continue;\n }\n const rule = sheet.cssRules[index];\n if (rule) {\n rules.push(rule);\n }\n }\n const inserted: InsertedRules = { rules, texts };\n entries.push(inserted);\n return inserted;\n },\n remove(inserted) {\n const at = entries.indexOf(inserted);\n if (at !== -1) {\n entries.splice(at, 1);\n }\n if (inserted.rules.length === 0) {\n return;\n }\n /* An index scan of a 302-rule sheet measures 0.04ms, so finding the rules costs nothing next\n to the RuleSet rebuild the deletion itself forces. Descending, or each deletion shifts the\n indices still to be removed. */\n const list = [...sheet.cssRules];\n const indices = inserted.rules\n .map((rule) => list.indexOf(rule))\n .filter((index) => index >= 0)\n .toSorted((a, b) => b - a);\n for (const index of indices) {\n sheet.deleteRule(index);\n }\n inserted.rules.length = 0;\n },\n replaceAll(texts) {\n entries.length = 0;\n entries.push({ rules: [], texts });\n sheet.replaceSync(texts.join(\"\\n\"));\n },\n text() {\n return entries.flatMap((entry) => entry.texts.join(\"\\n\")).join(\"\\n\");\n },\n };\n}\n\n/**\n * The last resort: a `<style>` element whose text is rewritten. No CSSOM required.\n *\n * @param {HTMLStyleElement} tag\n * @returns {StyleSink}\n */\nfunction textSink(tag: HTMLStyleElement): StyleSink {\n const entries: InsertedRules[] = [];\n const write = () => {\n tag.textContent = entries.map((entry) => entry.texts.join(\"\\n\")).join(\"\\n\");\n };\n return {\n detach() {\n tag.remove();\n },\n insert(texts) {\n const inserted: InsertedRules = { rules: [], texts };\n entries.push(inserted);\n write();\n return inserted;\n },\n remove(inserted) {\n const index = entries.indexOf(inserted);\n if (index !== -1) {\n entries.splice(index, 1);\n write();\n }\n },\n replaceAll(texts) {\n entries.length = 0;\n entries.push({ rules: [], texts });\n write();\n },\n text() {\n return tag.textContent;\n },\n };\n}\n\n/**\n * Open a sheet on `doc`, preferring a constructable one.\n *\n * A constructable stylesheet cannot be adopted into another document, which is why the registry\n * below is keyed on the document and never cached at module scope: the Studio iframe, the live\n * preview tab and the parent page each open their own.\n *\n * @param {Document} doc\n * @returns {StyleSink}\n */\nfunction openSink(doc: Document): StyleSink {\n // A window without constructable stylesheets (an older engine, a test DOM) lacks the global.\n const view: (Window & { CSSStyleSheet?: typeof CSSStyleSheet }) | null = doc.defaultView;\n const SheetConstructor = view?.CSSStyleSheet;\n if (isFunction(SheetConstructor) && Array.isArray(doc.adoptedStyleSheets)) {\n try {\n const sheet = new SheetConstructor();\n doc.adoptedStyleSheets = [...doc.adoptedStyleSheets, sheet];\n return cssomSink(sheet, () => {\n doc.adoptedStyleSheets = doc.adoptedStyleSheets.filter((s) => s !== sheet);\n });\n } catch {\n // No constructable stylesheets, or a frozen adoptedStyleSheets. Fall through to a tag.\n }\n }\n const tag = doc.createElement(\"style\");\n tag.dataset.jxSheet = \"\";\n (documentHead(doc) ?? doc.documentElement).append(tag);\n return tag.sheet ? cssomSink(tag.sheet, () => tag.remove()) : textSink(tag);\n}\n\n/**\n * A document's `<head>`, or null when it has none. HTML defines `document.head` as nullable (a\n * document whose root element has no `head` child), though the DOM typings declare it non-null.\n *\n * @param {Document} doc\n * @returns {HTMLHeadElement | null}\n */\nfunction documentHead(doc: Document): HTMLHeadElement | null {\n return doc.head;\n}\n\n/** One interned rule set: the rules as written, and how many elements point at them. */\ninterface InternEntry {\n inserted: InsertedRules;\n refs: number;\n}\n\n/** Everything one document's rules are kept in. */\ninterface SheetState {\n shared: StyleSink;\n /** Opened on the first live edit, and only then — most documents never have one. */\n scratch: StyleSink | null;\n /** Elements living on the scratch sheet, in the order their rules are written. */\n scratchOwners: Map<HTMLElement, readonly string[]>;\n /** Scope handle to the rule set it names. */\n interned: Map<string, InternEntry>;\n /** Declaration-body at-rule text to the one copy of it. */\n hoisted: Map<string, InternEntry>;\n /** Distinguishes `--jx-r<serial>-<n>` variables between elements. */\n serial: number;\n}\n\n/**\n * The per-document registry. A `WeakMap` rather than a module-level singleton because one process\n * renders into several documents (canvas iframe, preview tab, parent) and a constructable sheet\n * belongs to exactly one of them.\n */\nconst sheetStates = new WeakMap<Document, SheetState>();\n\n/**\n * @param {Document} doc\n * @returns {SheetState}\n */\nfunction sheetStateFor(doc: Document): SheetState {\n const existing = sheetStates.get(doc);\n if (existing) {\n return existing;\n }\n const created: SheetState = {\n hoisted: new Map(),\n interned: new Map(),\n scratch: null,\n scratchOwners: new Map(),\n serial: 0,\n shared: openSink(doc),\n };\n sheetStates.set(doc, created);\n return created;\n}\n\n/** What one element holds, so that releasing it is exact rather than approximate. */\ninterface ElementStyleEntry {\n doc: Document;\n /** The state this entry's handles belong to; a reset replaces it and orphans them. */\n state: SheetState;\n uid: string;\n /** The interning key in the shared sheet, or null when the element is on the scratch sheet. */\n interned: string | null;\n /** Hoisted declaration at-rules this element holds a reference to. */\n hoisted: readonly string[];\n /** The `--jx-r…` custom properties its effects write inline. */\n vars: readonly string[];\n /** Stops those effects. */\n stop: (() => void) | null;\n}\n\n/**\n * Per-element style bookkeeping. The replacement for the old `elementStyleTags`, which exported a\n * `<style>` element and let its importers remove it by hand; {@link releaseElementStyles} is the\n * documented teardown in its place, because a rule set is now refcounted and dropping one by hand\n * would either leak it or take it away from another element that shares it.\n */\nconst elementStyles = new WeakMap<HTMLElement, ElementStyleEntry>();\n\n/** The scope handle `buildStyleRules` writes, before the hash of its own output replaces it. */\nconst SCOPE_TOKEN = \"\u0001jx-scope\u0001\";\n\n/**\n * Rewrite the scratch sheet from its owners.\n *\n * `scratchOwners` is a STRONG map — it has to be, since the sheet's whole text is rebuilt from it —\n * so an element only leaves it through {@link releaseElementStyles}. That is not a hole: every way\n * an edited element can go away calls it. `applyStyle` registers it with the enclosing reactive\n * scope, Studio's `disposeSubtree` calls it per element, and `resetDocumentStyles` drops the map\n * wholesale. Sweeping on `isConnected` instead would be wrong rather than merely redundant: an\n * element is routinely styled before it is inserted.\n *\n * Both call sites reach this only once an element is already IN `scratchOwners`, and the only place\n * that happens (`scratchOwners.set`, below) always opens `scratch` first — so it is never still\n * null here.\n *\n * @param {SheetState} state\n */\nfunction rewriteScratch(state: SheetState) {\n state.scratch!.replaceAll([...state.scratchOwners.values()].flat());\n}\n\n/**\n * Drop one reference to an interned rule set, removing its rules when the last one goes.\n *\n * `key` always names an entry `retainInterned` already created: {@link releaseElementStyles}'s two\n * call sites pass back exactly the `entry.interned`/`entry.hoisted` keys it was handed at\n * `retainInterned` time, and a stale `state` (one `resetDocumentStyles` already replaced) is turned\n * away before either call site is reached.\n *\n * @param {SheetState} state\n * @param {Map<string, InternEntry>} table\n * @param {string} key\n */\nfunction releaseInterned(state: SheetState, table: Map<string, InternEntry>, key: string) {\n const entry = table.get(key)!;\n entry.refs -= 1;\n if (entry.refs <= 0) {\n table.delete(key);\n state.shared.remove(entry.inserted);\n }\n}\n\n/**\n * Take one reference to a rule set, inserting it the first time it is asked for.\n *\n * @param {SheetState} state\n * @param {Map<string, InternEntry>} table\n * @param {string} key\n * @param {readonly string[]} texts\n */\nfunction retainInterned(\n state: SheetState,\n table: Map<string, InternEntry>,\n key: string,\n texts: readonly string[],\n) {\n const existing = table.get(key);\n if (existing) {\n existing.refs += 1;\n return;\n }\n table.set(key, { inserted: state.shared.insert(texts), refs: 1 });\n}\n\n/**\n * Release everything {@link applyStyle} gave an element: its rules, its scope handle, and the inline\n * custom properties and effects behind its reactive declarations.\n *\n * This is the teardown API `elementStyleTags` used to stand in for, and it is exported because\n * removing a rule set by hand is no longer possible: sets are shared between elements that style\n * alike, so the only safe removal is a refcounted one. Calling it on an element that has no styles\n * is a no-op, which is what makes `applyStyle` safe to call twice.\n *\n * Callers rarely need it. `applyStyle` registers it with the enclosing reactive scope, so an\n * element discarded by a re-rendering mapped array or a disposed Studio subtree releases itself.\n *\n * @param {HTMLElement} el\n * @param {ElementStyleEntry} [only] - Release only if this is still the element's current entry\n */\nexport function releaseElementStyles(el: HTMLElement, only?: ElementStyleEntry): void {\n const entry = elementStyles.get(el);\n if (!entry || (only !== undefined && entry !== only)) {\n return;\n }\n elementStyles.delete(el);\n entry.stop?.();\n for (const name of entry.vars) {\n el.style.removeProperty(name);\n }\n delete el.dataset.jx;\n /* A `resetDocumentStyles` between the two replaces the state, and its sheets are already gone —\n so the element-local half above always runs and the sheet half is skipped as already done. */\n if (sheetStates.get(entry.doc) !== entry.state) {\n return;\n }\n const { state } = entry;\n if (entry.interned === null) {\n if (state.scratchOwners.delete(el)) {\n rewriteScratch(state);\n }\n } else {\n releaseInterned(state, state.interned, entry.interned);\n }\n for (const key of entry.hoisted) {\n releaseInterned(state, state.hoisted, key);\n }\n}\n\n/**\n * Discard every sheet this runtime opened on a document, and orphan the element entries that point\n * into them.\n *\n * A full re-render replaces the whole tree, so the alternative is a shared sheet that only ever\n * grows. The element `WeakMap` cannot be enumerated to be cleared, so entries are invalidated\n * instead: each one records the `SheetState` it was written into, and a release that finds a\n * different state registered for the document does the element-local half only. That is what stops\n * a surviving element from later handing `deleteRule` an index into a sheet nobody is reading.\n *\n * @param {Document} [doc] - Defaults to the ambient document\n */\nexport function resetDocumentStyles(doc: Document = document): void {\n const state = sheetStates.get(doc);\n if (!state) {\n return;\n }\n sheetStates.delete(doc);\n for (const el of state.scratchOwners.keys()) {\n elementStyles.delete(el);\n delete el.dataset.jx;\n }\n state.scratchOwners.clear();\n state.interned.clear();\n state.hoisted.clear();\n state.shared.detach();\n state.scratch?.detach();\n}\n\n/**\n * The CSS this engine has written into a document, in sheet order.\n *\n * It reports what the engine ASKED the document to adopt, not what the document managed to parse,\n * and the difference is the point: `insertRule` throws on a rule the host cannot parse, and the\n * sink swallows that so one bad rule cannot take the rest of an element's set with it. The test DOM\n * rejects `@position-try` outright, so reading it back off `cssRules` there would report a block\n * that a browser adopts perfectly well as missing.\n *\n * It is also the honest answer to \"what CSS did my style object become\", which is a question the\n * Studio style inspector asks and, before this, nothing could answer without scraping `<style>`\n * tags out of the head.\n *\n * @param {Document} [doc] - Defaults to the ambient document\n * @returns {string} One rule per line, shared sheet first\n * @docs framework/concepts/styling\n */\nexport function documentStyleText(doc: Document = document): string {\n const state = sheetStates.get(doc);\n if (!state) {\n return \"\";\n }\n return [state.shared.text(), state.scratch?.text() ?? \"\"].filter(Boolean).join(\"\\n\");\n}\n\n/**\n * Whether a style object declares `display` anywhere in it.\n *\n * `defineElement` gives a custom element `display: block` because a custom element defaults to\n * `inline` and Jx containers behave like `<div>`. It used to test `this.style.display`, which was a\n * correct test only while the author's own `display` was written inline — the moment it became a\n * rule the guard stopped seeing it and the default started overriding the author. The test is now\n * on the source rather than on the element, and it is a deep one on purpose: an inline default\n * would beat a `:hover` or `@media` `display` just as surely as a base one.\n *\n * A `@keyframes` block is the one thing the walk does NOT descend into. A `display` in a keyframe\n * stop is a point on a timeline, not a declaration on this element — animating `display` is the\n * ordinary shape of an `allow-discrete` reveal — so counting one as the author's own left the\n * element with no `display` at all, and a custom element with no `display` is `inline`. The element\n * laid out wrongly whenever it was still, which is most of the time.\n *\n * @param {JxStyle | undefined} style\n * @returns {boolean}\n */\nfunction declaresDisplay(style: JxStyle | undefined): boolean {\n /* The BASE block only. A deep walk read a `display` that exists solely inside `&:hover` or an\n `@media` block as \"the author supplied one\", so the element stayed `inline` at rest and\n became a block on hover — a live trap rather than a subtlety. An author who wants the\n platform's own default writes `display: revert` in the base block, which this sees. */\n return isNonNullObject(style) && \"display\" in style;\n}\n\n/**\n * The `style` object a USAGE SITE wrote on a custom element, kept until the element connects.\n *\n * Weak in the element, so an instance that is never connected is collected with its entry.\n */\nconst callSiteStyles = new WeakMap<HTMLElement, JxStyle>();\n\n/**\n * Merge two style objects, `over` winning.\n *\n * Deep, because a nested selector block is a rule of its own: a call site that declares `&:hover`\n * must not delete the definition's `&:hover`, only the declarations it repeats inside it. A scalar\n * always replaces, which is what \"the call site wins\" means.\n *\n * @param base The definition's style.\n * @param over The usage site's, if any.\n * @returns {JxStyle} A new object; neither argument is mutated.\n */\nfunction mergeStyle(base: JxStyle, over: JxStyle | undefined): JxStyle {\n if (!over) {\n return base;\n }\n const out: JxStyle = { ...base };\n for (const [key, value] of Object.entries(over)) {\n const prior = out[key];\n /* A block merges into whatever object the definition holds there. A repeated-block list is\n spread to its index keys first, which is what spreading it as a style object always did. */\n out[key] =\n isNestedStyle(value) && isNonNullObject(prior)\n ? mergeStyle(\n Array.isArray(prior) ? Object.fromEntries(Object.entries(prior)) : prior,\n value,\n )\n : value;\n }\n return out;\n}\n\n/**\n * Turn an element's `style` object into CSS rules and adopt them.\n *\n * Nothing is written inline except the `--jx-r…` custom properties that carry reactive values, so\n * an authored `:hover`, `@media` or `@supports` block overrides its own base declaration by\n * ordinary cascade rules — which is what the emitted CSS always said and the inline write always\n * prevented. See the engine essay above for the sheet roles and the measurements behind them.\n *\n * Calling it twice on one element is safe: the first call's rules are released first.\n *\n * @param {HTMLElement} el\n * @param {JxStyle} styleDef\n * @param {Record<string, string>} [mediaQueries] Named breakpoints from root $media. Default is\n * `{}`\n * @param {JxScope} [state] Component scope for template string evaluation. Default is `{}`\n * @docs framework/concepts/styling\n */\nexport function applyStyle(\n el: HTMLElement,\n styleDef: JxStyle,\n mediaQueries: Record<string, string> = {},\n state: JxScope = {},\n) {\n applyStyleInto(el, styleDef, mediaQueries, state, false);\n}\n\n/**\n * Re-apply an element's style definition in place.\n *\n * The Studio Style panel calls this per keystroke, so its rules go to the SCRATCH sheet, which is\n * rewritten whole with `replaceSync` rather than edited rule by rule inside the shared one: 7.5ms\n * per 100 structural edits against 76.9ms. The previous rule set is released first — without that\n * this would leak a set into the shared sheet on every keypress, which is the opposite of the\n * `<style>`-tag leak it replaced.\n *\n * Inline styles are NOT cleared wholesale any more. `el.style.cssText = \"\"` also destroyed an\n * author's own `attributes: { style: \"…\" }` and would now take the custom-element `display` default\n * with it; only the `--jx-r…` properties this engine wrote are removed.\n *\n * @param {HTMLElement} el\n * @param {JxStyle | undefined} styleDef\n * @param {Record<string, string>} [mediaQueries]\n * @param {JxScope} [state]\n */\nexport function reapplyStyle(\n el: HTMLElement,\n styleDef: JxStyle | undefined,\n mediaQueries: Record<string, string> = {},\n state: JxScope = {},\n) {\n applyStyleInto(el, styleDef ?? {}, mediaQueries, state, true);\n}\n\n/**\n * @param {HTMLElement} el\n * @param {JxStyle} styleDef\n * @param {Record<string, string>} mediaQueries\n * @param {JxScope} state\n * @param {boolean} live - Write to the scratch sheet (the Studio edit path) rather than intern\n */\nfunction applyStyleInto(\n el: HTMLElement,\n styleDef: JxStyle,\n mediaQueries: Record<string, string>,\n state: JxScope,\n live: boolean,\n) {\n releaseElementStyles(el);\n const doc = el.ownerDocument;\n const sheetState = sheetStateFor(doc);\n\n /* One gate for the whole call, so every recursion answers alike. Off in production and in\n preview, where the selector is written exactly as authored.\n\n The SAME predicate the attribute rename uses, and it has to be: an attribute renamed without\n its selectors transposed is a panel that can never be styled open. They disagreed while the\n rename learned to reach inside a defined element and this did not, so a kit popover rendered\n within another definition's template would have been de-linked and then left with a\n `:popover-open` rule that could no longer match. */\n const transposeSelector =\n (_canvasDelinkPopovers || _canvasDelinkCommands) && canvasStamped(el)\n ? (selector: string) =>\n transposeCanvasOverlaySelector(selector, {\n dialog: el.tagName === \"DIALOG\",\n })\n : (selector: string) => selector;\n\n /* Reactive declarations become `var()` reads of a custom property this element sets inline. The\n variable inherits, which is correct, and the declaration stays in the rule where `:hover` can\n override it. The serial keeps two elements' variables apart: a descendant rule reads `var()`\n from the nearest ancestor that set it, and without it a styled child would shadow its parent's\n `--jx-r0` with its own. Only a DESCENDANT rule needs that: a self-target declaration reads the\n variable the element itself sets, so it is named by position alone (`--jx-s<n>`) and elements\n that style alike keep sharing one rule set. */\n let serial = -1;\n let indirect = 0;\n const sources: { name: string; value: string | JxRef }[] = [];\n const rules = buildStyleRules(styleDef, {\n mediaQueries,\n resolveValue: (property, value, target) => {\n /* A reactive value on a CUSTOM PROPERTY, in a rule targeting the element itself, is written\n inline under the AUTHOR'S OWN NAME and contributes no declaration. That keeps the rule\n text free of anything per-element, so every row of a repeater interns ONE rule instead of\n one each: the serial below is in the rule text, the interning handle is a hash of that\n text, and so no two reactive elements could ever share a rule set. Measured before this:\n three font rows produced three handles and three rules.\n The declaration that READS the variable — `font-family: var(--row-face, inherit)` — lives\n in the owning element's own style, is identical across rows, and interns once.\n Only a SELF-target rule qualifies. A descendant rule keeps the indirection, because its\n variable must not be set on the element that carries the rule: a `var()` resolves from the\n nearest ancestor that set it, and a shared descendant rule would read the wrong one. */\n if (target === \"self\" && property.startsWith(\"--\")) {\n sources.push({ name: property, value });\n return null;\n }\n /* Counted separately from `sources`, so an inline custom property before it cannot shift the\n name of an indirected one. The name is IN the rule text, and the interning handle is a\n hash of that text — a number that moved with unrelated declarations would give two\n otherwise identical styles two rules. */\n let name: string;\n if (target === \"self\") {\n /* A SELF-target rule reads its variable from the element that sets it inline, which is\n this element — no ancestor's value can reach it — so the name needs no serial, only its\n position. Without this, every instance of a definition with one reactive declaration\n (the kit's tree row binds its indent) interned a rule set of its own: an Outline\n scrolling through a long page minted fifteen rules per row and grew the shared sheet\n past fourteen thousand, slowing every insert and every style recalculation after. */\n name = `--jx-s${indirect}`;\n } else {\n if (serial < 0) {\n ({ serial } = sheetState);\n sheetState.serial += 1;\n }\n name = `--jx-r${serial}-${indirect}`;\n }\n indirect += 1;\n sources.push({ name, value });\n return `var(${name})`;\n },\n scope: SCOPE_TOKEN,\n transposeSelector,\n transposeValue: canvasStyleValue,\n });\n /* `sources.length` too, not `rules.length` alone: a style whose ONLY reactive declaration is a\n custom property on the element itself emits no rule at all, and returning here would install\n no effect, so the variable would be written once and never track its source again. */\n if (rules.length === 0 && sources.length === 0) {\n return;\n }\n\n /* Declaration-body at-rules declare a document-global NAME — `@position-try --flip`,\n `@font-face` — so they are written once for the whole document and refcounted, rather than\n once per element that mentions them. */\n const scoped = rules.filter((rule) => rule.target !== \"unscoped\");\n const unscoped = rules.filter((rule) => rule.target === \"unscoped\");\n for (const rule of unscoped) {\n retainInterned(sheetState, sheetState.hoisted, rule.text, [rule.text]);\n }\n\n const uid = `jx-${hashCss(scoped.map((rule) => rule.key).join(\"|\"))}`;\n const texts = scoped.map((rule) => rule.text.replaceAll(SCOPE_TOKEN, `[data-jx=\"${uid}\"]`));\n if (texts.length > 0) {\n el.dataset.jx = uid;\n if (live) {\n sheetState.scratch ??= openSink(doc);\n sheetState.scratchOwners.set(el, texts);\n rewriteScratch(sheetState);\n } else {\n retainInterned(sheetState, sheetState.interned, uid, texts);\n }\n }\n\n const entry: ElementStyleEntry = {\n doc,\n hoisted: unscoped.map((rule) => rule.text),\n interned: texts.length > 0 && !live ? uid : null,\n state: sheetState,\n stop: null,\n uid,\n vars: sources.map((source) => source.name),\n };\n if (sources.length > 0) {\n const scope = effectScope();\n scope.run(() => {\n for (const { name, value } of sources) {\n effect(() => {\n const resolved = isRefValue(value)\n ? resolveRef(value.$ref, state)\n : evaluateTemplate(value, state);\n el.style.setProperty(name, canvasStyleValue(String(resolved ?? \"\")));\n });\n }\n });\n entry.stop = () => scope.stop();\n }\n elementStyles.set(el, entry);\n /* Ties the rules to the render that made them: a mapped array's discarded generation, or a\n Studio subtree being replaced, stops its scope and the rule set goes with it. Guarded on the\n entry so a later `reapplyStyle` is not undone by an older scope disposing after it. */\n onScopeDispose(() => releaseElementStyles(el, entry), true);\n}\n\n/*\n * HTML carries a boolean two incompatible ways, and writing one as the other inverts it in silence.\n *\n * A *boolean attribute* — `open`, `disabled`, `hidden`, `required` — is read by PRESENCE. Any value\n * at all counts as true, `\"false\"` included, so `<details open=\"false\">` is an OPEN `<details>`.\n * The value must never be written; absence is the only way to say false.\n *\n * An *enumerated* attribute carries the word in its own text and reads an empty value as unset, so\n * the presence form is the broken one here: bare `aria-hidden` is NOT hidden, and a dropped\n * `contenteditable` means \"inherit from the parent\" rather than `false`. Every `aria-*` is in this\n * family — ARIA has no presence attributes at all — along with the three HTML attributes below.\n *\n * **`popover` is enumerated and is deliberately NOT in this set**, which looks like an oversight\n * and is not. Its keywords are `auto`, `manual` and `hint`; its MISSING-value default is `auto`, so\n * a bare `popover` and `popover=\"\"` are both auto popovers — which is what the presence branch\n * below already produces for `true`, correctly. Its INVALID-value default is `manual`, so moving it\n * here would emit `popover=\"true\"`, which is not a keyword, and every popover written as a boolean\n * would silently stop light-dismissing and stop answering Escape. The right answer to a boolean\n * `popover` is not a different emission, it is not writing one: `@jxsuite/schema/overlays` reports\n * it as `invalid-mode`, and the house spelling is `\"auto\"`.\n *\n * That also corrects the paragraph above for this one attribute: a presence attribute counts any\n * value as true, but `popover=\"false\"` is a *manual* popover rather than a true-ish one, because it\n * is enumerated even though it is emitted through the presence branch.\n *\n * @docs framework/concepts/elements\n */\nconst ENUMERATED_ATTRS = new Set([\"contenteditable\", \"draggable\", \"spellcheck\"]);\n\n/**\n * The enumerated-attribute names, for a code generator that cannot import this module.\n *\n * The compiler's element and client targets emit standalone ES modules that a built site loads\n * without `@jxsuite/runtime`, so they inline the boolean decision instead of calling it. They\n * serialize THIS array into that inlined helper, and `compile-element.test.ts` asserts the emitted\n * literal still equals it — which is what keeps the four writers of the rule one decision rather\n * than four, in the one place a shared function could not reach.\n *\n * @returns {string[]} The names, sorted, so the emitted output is stable.\n */\nexport function enumeratedAttrNames(): string[] {\n return [...ENUMERATED_ATTRS].toSorted();\n}\n\n/**\n * The text an attribute's boolean value must be written with, or `null` when saying it means\n * removing the attribute instead.\n *\n * An empty string is the bare form: `setAttribute(name, \"\")` is how the DOM spells the `open` that\n * HTML source writes with no `=`.\n *\n * Shared rather than restated because two renderers must agree. The compiler writes attributes into\n * a string of HTML and this file writes them onto live elements; were they to disagree about which\n * family an attribute belongs to, a prerendered page would change meaning as it hydrated.\n *\n * @param {string} name - Attribute name, already resolved to what will be written\n * @param {boolean} value - The resolved boolean\n * @returns {string | null} Text to write, or null to omit the attribute\n */\nexport function booleanAttrValue(name: string, value: boolean): string | null {\n const lower = name.toLowerCase();\n if (lower.startsWith(\"aria-\") || ENUMERATED_ATTRS.has(lower)) {\n return String(value);\n }\n return value ? \"\" : null;\n}\n\n/**\n * @param {HTMLElement} el\n * @param {Record<string, import(\"@jxsuite/schema/types\").JxAttributeValue>} attrs\n * @param {JxScope} state\n */\nfunction applyAttributes(el: HTMLElement, attrs: Record<string, JxAttributeValue>, state: JxScope) {\n for (const [k, v] of Object.entries(attrs)) {\n const attr = canvasAttrName(el, k);\n /* Inside the effects, not before them. A `$ref` or `${…}` value is not a string until the\n effect runs — which is exactly why the document walk this replaced could never see it. */\n const write = (resolved: JxScopeValue) => {\n if (resolved === null || resolved === undefined) {\n /* Nothing is an attribute the element does not have. A binding that resolves to `null`\n has to take the attribute WITH it, for the same reason a `false` does below — and an\n `aria-checked=\"\"` or `title=\"\"` left behind is not absence, it is a wrong value. */\n el.removeAttribute(attr);\n return;\n }\n if (isBoolean(resolved)) {\n const text = booleanAttrValue(attr, resolved);\n /* `removeAttribute`, not `setAttribute(attr, \"false\")`. A binding that flips back has to\n take the attribute WITH it: the element is being re-used, so anything left behind is the\n state the page just said it had left. Asset rewriting is skipped because a boolean names\n no asset — `canvasAssetValue` reads `src`/`href` values, which are never booleans. */\n if (text === null) {\n el.removeAttribute(attr);\n } else {\n el.setAttribute(attr, text);\n }\n return;\n }\n el.setAttribute(attr, canvasAssetValue(el.tagName, k, String(resolved)));\n };\n if (isRefValue(v)) {\n effect(() => write(resolveRef(v.$ref, state)));\n } else if (isTemplateString(v)) {\n bindTemplate(v, () => write(evaluateValueTemplate(v, state)));\n } else {\n write(v);\n }\n }\n}\n\n// ─── Array mapping ────────────────────────────────────────────────────────────\n\n/**\n * Render a mapped array (repeater) wrapper-less: its item instances are inserted directly into\n * `parentEl`, in place, ahead of an anchor comment that marks the array's position among the\n * parent's other children.\n *\n * Rows are RECONCILED, not rebuilt. Each row is keyed — by the `key` pointer the array declares,\n * else by its index — and owns a detached effect scope and a reactive `$map` context. When `items`\n * (or the filter/sort sources, or a key) change, a row whose key survives keeps its node and its\n * effects: a reorder moves the node, an insertion creates only the new rows, a removal stops only\n * the removed ones, and a moved row's `$map.index` is updated in place. That is what lets focus,\n * scroll position and a half-typed value survive a change to the list.\n *\n * Reads made while a row is constructed are made with tracking PAUSED. `effectScope.run()` does not\n * reset the active subscriber, so without this every top-level read a row performs — a `$props`\n * write, a tag discriminant, a `$`-local — subscribed the LIST effect, and one row's data changing\n * rebuilt the whole list. The bindings inside a row are effects of their own and re-enable tracking\n * when they run, so a row still updates itself.\n *\n * `options._path` is the array node's own document path (`[…, \"children\", i]`, or `[…, \"children\"]`\n * for a legacy whole-children repeater); item instances render at `[…that…, \"map\", index]`, and a\n * row that moves reports its new path through `options.onNodeMoved`.\n *\n * @param {HTMLElement} parentEl\n * @param {import(\"@jxsuite/schema/types\").JxMappedArray} arrayDef\n * @param {JxScope} state\n * @param {JxRenderOptions} [options]\n */\nfunction renderMappedArrayInto(\n parentEl: HTMLElement,\n arrayDef: JxMappedArray,\n state: JxScope,\n options?: JxRenderOptions,\n) {\n const path = options?._path ?? [];\n const anchor = document.createComment(\"jx-array\");\n parentEl.append(anchor);\n const { items: itemsSrc, map: mapDef, filter: filterRef, sort: sortRef, key: keyRef } = arrayDef;\n const keyPointer = isRefValue(keyRef) ? keyRef.$ref : null;\n /* The instantiation chain the list belongs to (spec.md §16.9), for the same reason\n {@link renderSwitch} keeps one: a row that arrives with new data is inserted from an effect\n re-run, and the instance it holds must connect under the chain of the definition that drew\n the list. */\n const instancePath = _instancePath;\n\n let warned = false;\n const warnOnce = (message: string): void => {\n if (!warned) {\n warned = true;\n console.warn(`Jx $map: ${message}`);\n }\n };\n\n /** The rows currently rendered, in DOM order. */\n let rows: MappedRow[] = [];\n\n /* Out of the document FIRST, then stopped: stopping releases every element's styles\n (`releaseElementStyles`), and on a connected node each of those inline-property and `data-jx`\n writes schedules a style invalidation for a node that is about to leave. Detached, they are\n plain writes. See `dispose` in `mount`. */\n const teardown = (row: MappedRow): void => {\n row.node.remove();\n row.scope.stop();\n };\n\n const createRow = (\n key: MappedRow[\"key\"],\n item: MappedRow[\"map\"][\"item\"],\n index: number,\n ): MappedRow => {\n const map = shallowReactive({ index, item });\n const child = inheritScope(state);\n child.$map = map;\n // The flat aliases stay readable by legacy readers, and follow the reactive context.\n Object.defineProperty(child, \"$map/item\", { enumerable: true, get: () => map.item });\n Object.defineProperty(child, \"$map/index\", { enumerable: true, get: () => map.index });\n const scope = effectScope(true);\n const childOpts = options ? { ...options, _path: [...path, \"map\", index] } : undefined;\n const node = scope.run(() => renderNode(mapDef!, child, childOpts))!;\n return { key, map, node, scope };\n };\n\n const reconcile = (list: readonly JxScopeValue[], keys: readonly MappedRow[\"key\"][]): void => {\n const previous = new Map<MappedRow[\"key\"], MappedRow>();\n for (const row of rows) {\n previous.set(row.key, row);\n }\n const next: MappedRow[] = [];\n for (let index = 0; index < list.length; index++) {\n const key = keys[index];\n const item = list[index];\n const existing = previous.get(key);\n if (existing) {\n previous.delete(key);\n if (existing.map.item !== item) {\n existing.map.item = item;\n }\n if (existing.map.index !== index) {\n existing.map.index = index;\n options?.onNodeMoved?.(existing.node, [...path, \"map\", index]);\n }\n next.push(existing);\n } else {\n next.push(createRow(key, item, index));\n }\n }\n // Whatever was not claimed is gone.\n for (const row of previous.values()) {\n teardown(row);\n }\n /* Order in one forward pass. The cursor walks the kept nodes in their current order; a row\n already under the cursor is in place, anything else is inserted before it — a new node, or\n a kept node moved forward. Only rows that are out of place move, and a move is the one thing\n that can cost a focused element its focus. */\n let cursor: ChildNode = rows.find((row) => !previous.has(row.key))?.node ?? anchor;\n for (const row of next) {\n if (row.node === cursor) {\n cursor = cursor.nextSibling ?? anchor;\n continue;\n }\n cursor.before(row.node);\n }\n rows = next;\n };\n\n const update = (): void => {\n let items: JxScopeValue = isRefValue(itemsSrc) ? resolveRef(itemsSrc.$ref, state) : itemsSrc;\n if (Array.isArray(items) && isRefValue(filterRef)) {\n const fn = resolveRef(filterRef.$ref, state);\n if (isFunction(fn)) {\n /* SAFETY: the guard proved a function, and a function accepts any call: `Array#filter`\n passes each item (with its index and the list) and reads only the result's truthiness. */\n items = items.filter(fn as (item: MappedRow[\"map\"][\"item\"]) => boolean);\n }\n }\n if (Array.isArray(items) && isRefValue(sortRef)) {\n const fn = resolveRef(sortRef.$ref, state);\n if (isFunction(fn)) {\n /* SAFETY: the guard proved a function, and a function accepts any call: `toSorted` passes\n two items and orders by the sign of the number the comparator returns. */\n const compare = fn as (a: MappedRow[\"map\"][\"item\"], b: MappedRow[\"map\"][\"item\"]) => number;\n const unsorted: readonly JxScopeValue[] = items;\n items = [...unsorted].toSorted(compare);\n }\n }\n const list: readonly JxScopeValue[] = Array.isArray(items) && mapDef ? items : [];\n\n // Keys are read HERE, tracked, so a key that changes reconciles the list.\n const keys = list.map((item, index) => mappedRowKey(keyPointer, item, index, warnOnce));\n const seen = new Set<MappedRow[\"key\"]>();\n for (let i = 0; i < keys.length; i++) {\n if (seen.has(keys[i])) {\n warnOnce(\n `duplicate key ${String(keys[i])} — every occurrence after the first is rebuilt on each change`,\n );\n keys[i] = { duplicate: i };\n } else {\n seen.add(keys[i]);\n }\n }\n\n pauseTracking();\n try {\n underInstancePath(reexpand(instancePath), () => reconcile(list, keys));\n } finally {\n resetTracking();\n }\n };\n\n /* The first render is synchronous; every re-render is coalesced into ONE microtask. A reactive\n array mutated in place — `reverse()`, `sort()`, an index write — triggers once per element it\n touches, and an effect run between two of those writes sees an array that is half of each\n state: a row that is transiently absent would be torn down and then rebuilt, which is exactly\n the identity loss keys exist to prevent. Deferring to a microtask is what a framework scheduler\n does for the same reason; a row's own bindings stay synchronous. */\n let queued = false;\n let stopped = false;\n const runner = effect(update, {\n scheduler: () => {\n if (queued) {\n return;\n }\n queued = true;\n queueMicrotask(() => {\n queued = false;\n if (!stopped) {\n runner();\n }\n });\n },\n });\n\n onScopeDispose(() => {\n stopped = true;\n for (const row of rows) {\n teardown(row);\n }\n rows = [];\n }, true);\n}\n\n/** A rendered row of a mapped array. */\ninterface MappedRow {\n key: JxScopeValue;\n /** The row's `$map` context; `item` and `index` are written in place when the row is reused. */\n map: JxRowContext;\n node: HTMLElement | Text;\n scope: EffectScope;\n}\n\n/**\n * The identity a `key` pointer names for one item: the item itself for `$map/item`, a value read\n * off it for `$map/item/<path>`. Anything else is not a key — an index names a position, not a row\n * — and a key that evaluates to nothing cannot tell rows apart, so both fall back to the index.\n */\nfunction mappedRowKey(\n pointer: string | null,\n item: MappedRow[\"map\"][\"item\"],\n index: number,\n warnOnce: (message: string) => void,\n): MappedRow[\"key\"] {\n if (pointer === null) {\n return index;\n }\n if (pointer === \"$map/item\") {\n return item;\n }\n if (pointer.startsWith(\"$map/item/\")) {\n const key = readPath(item, pointer.slice(\"$map/item/\".length));\n if (key === undefined || key === null) {\n warnOnce(`key \"${pointer}\" is empty for some items — those rows fall back to their index`);\n return index;\n }\n return key;\n }\n warnOnce(`key \"${pointer}\" is not a $map/item pointer — rows fall back to their index`);\n return index;\n}\n\n/**\n * An element's tag: a name, or the branch of a {@link JxTagExpression} the state selects.\n *\n * Every branch of the expression is itself a `TagName`, so this can only ever return something the\n * schema already held to the tag-name pattern — the property that lets the compiler enumerate the\n * candidates and lets `createElement` be called without a second thought here.\n *\n * @param {TagNameSlot} tagName The element's declared tag.\n * @param {JxScope} scope The state the discriminant reads.\n * @returns {string} A literal tag name; `\"div\"` when nothing is declared.\n */\nexport function resolveTagName(tagName: TagNameSlot, scope: JxScope): string {\n if (isString(tagName)) {\n return tagName;\n }\n if (!isTagExpression(tagName)) {\n return \"div\";\n }\n const expression = tagName.$expression;\n if (expression.operator === \"?:\") {\n // `evaluateOperand`, not `evaluateExpression`: the discriminant is an OPERAND — a pointer, a\n // Literal or a nested node — exactly as it is for a `$switch`, whose docstring names this.\n return evaluateOperand(expression.target, scope, null) ? expression.value : expression.initial;\n }\n const key = evaluateOperand(expression.target, scope, null);\n return expression.cases[String(key)] ?? expression.default;\n}\n\n// ─── $switch ──────────────────────────────────────────────────────────────────\n\n/**\n * @param {JxElement} def\n * @param {JxScope} state\n * @param {JxRenderOptions} [options]\n * @returns {HTMLElement}\n */\nfunction renderSwitch(def: JxElement, state: JxScope, options?: JxRenderOptions) {\n const path = options?._path ?? [];\n const container = document.createElement(resolveTagName(def.tagName, state));\n /* The instantiation chain this switch belongs to (spec.md §16.9), read now because the effect\n below re-runs with nothing on the stack. A case that flips after the first paint puts it back\n around the insertion, so an instance the new case creates connects under the chain of the\n definition that drew the switch rather than under none. See {@link _instancePath}. */\n const instancePath = _instancePath;\n\n if (options?.onNodeCreated) {\n options.onNodeCreated(container, path, def, state);\n }\n\n applyProperties(container, def, state);\n applyStyle(container, def.style ?? {}, scopeMedia(state), state);\n applyAttributes(container, def.attributes ?? {}, state);\n /* Every case renders in a detached scope of its own, stopped before the next case renders and\n when the container's own scope stops. A generation counter names the case a pending external\n load belongs to; it moves on EVERY change — an inline case included — so a load that resolves\n after the discriminant moved on cannot paint over what replaced it. */\n let generation = 0;\n let live: EffectScope | null = null;\n /* The key the rendered case was chosen by. A discriminant that re-resolves to the SAME key keeps\n its case: the subtree, its effects and its state — an open submenu, a half-typed value —\n survive. Without this a mapped row whose item was replaced by an equal one (a host rebuilding\n its projection) rebuilt every switch inside it, and the popover the case rendered closed. */\n let renderedKey: string | null = null;\n const retire = (): void => {\n live?.stop();\n live = null;\n };\n\n effect(() => {\n if (!isRefValue(def.$switch)) {\n // Detached before it is stopped, for the reason `teardown` in `renderMappedArray` gives.\n container.replaceChildren();\n retire();\n generation += 1;\n return;\n }\n const key = String(resolveRef(def.$switch.$ref, state));\n if (key === renderedKey) {\n return;\n }\n renderedKey = key;\n /* `replaceChildren()` rather than `innerHTML = \"\"`: identical semantics, and it is not a\n Trusted Types injection sink — under `require-trusted-types-for 'script'` an innerHTML write\n needs a policy even when the string is empty. Four sinks that were never injecting anything\n is four fewer things a policy has to be permissive about. Detached BEFORE the case is\n stopped, for the reason `teardown` in `renderMappedArray` gives. */\n container.replaceChildren();\n retire();\n generation += 1;\n const caseDef = def.cases?.[key];\n if (!caseDef) {\n return;\n }\n const gen = generation;\n const scope = effectScope(true);\n live = scope;\n const childOpts = options ? { ...options, _path: [...path, \"cases\", key] } : undefined;\n\n if (isRefValue(caseDef)) {\n // External $ref — fetch and render asynchronously, against the mount's base so a bundled\n // Document need not live at the page URL.\n const { href } = new URL(caseDef.$ref, options?._ctx?.base ?? location.href);\n resolve(href, options?._ctx)\n .then(async (doc) => {\n if (gen !== generation) {\n return;\n }\n const childScope = await buildScope(doc, {}, href, options?._ctx);\n if (gen !== generation) {\n return;\n }\n container.replaceChildren();\n underInstancePath(reexpand(instancePath), () =>\n scope.run(() => container.append(renderNode(doc, childScope, childOpts))),\n );\n })\n .catch((error) =>\n console.error(\"Jx $switch: failed to load external case\", caseDef.$ref, error),\n );\n return;\n }\n\n // Tracking is paused for the same reason it is for a mapped row: a top-level read the case\n // Makes while it renders must not subscribe THIS effect, or the case re-renders on every\n // Change to anything it read. The bindings inside it track for themselves.\n pauseTracking();\n try {\n underInstancePath(reexpand(instancePath), () =>\n scope.run(() => container.append(renderNode(caseDef, state, childOpts))),\n );\n } finally {\n resetTracking();\n }\n });\n onScopeDispose(retire, true);\n\n return container;\n}\n\n// ─── Prototype namespaces (Shape 5) ──────────────────────────────────────────\n\n/**\n * `ref()`, for a value that is one scope member: the same function, under a signature that says so.\n *\n * `ref`'s own return type unwraps its argument's type recursively, and over the recursive\n * `JxScopeValue` union (an array of scope values holds scope values) that unwrapping never\n * terminates (TS2589). The value goes in as it is, so the ref is typed as holding a scope member.\n */\nconst scopeRef: (value: JxScopeValue) => Ref<JxScopeValue> = ref;\n\n/**\n * Resolve a $prototype definition into a value for the reactive scope.\n *\n * Returns a ref() for async/persistent entries (Request, Storage, Cookie, IndexedDB), or a plain\n * value for simple entries (Set, Map, FormData, Blob).\n *\n * @param {JxPrototypeDef} def - State entry with $prototype\n * @param {JxScope} state - Reactive scope proxy\n * @param {string} key - Def key (for diagnostics)\n * @param {string} [base] - Base URL for resolving $src imports\n * @returns {Promise<JxScopeValue>}\n */\nexport async function resolvePrototype(\n def: JxPrototypeDef,\n state: JxScope,\n key: string,\n base?: string,\n ctx?: JxContext,\n) {\n // ── External class via $src ─────────────────────────────────────────────────\n if (def.$src) {\n return resolveExternalPrototype(def, state, key, base);\n }\n\n switch (def.$prototype) {\n case \"Request\": {\n const s: Ref<JxScopeValue> = ref(null);\n const debounceMs = def.debounce ?? 0;\n let debounceTimer: ReturnType<typeof setTimeout> | null = null;\n\n if (!def.manual && !(ctx?.skipAutoRequests ?? _autoRequestConfig.skip)) {\n effect(() => {\n let url: string | undefined;\n if (isTemplateString(def.url)) {\n url = evaluateTemplate(def.url, state);\n } else {\n ({ url } = def);\n }\n if (!url || url === \"undefined\" || url.includes(\"undefined\")) {\n return;\n }\n\n const controller = new AbortController();\n onEffectCleanup(() => {\n controller.abort();\n if (debounceTimer !== null) {\n clearTimeout(debounceTimer);\n }\n });\n\n const doFetch = () =>\n fetch(url, {\n method: def.method ?? \"GET\",\n signal: controller.signal,\n ...(def.headers && { headers: def.headers }),\n ...(def.body && {\n body: isNonNullObject(def.body) ? JSON.stringify(def.body) : def.body,\n }),\n })\n .then((r): Promise<JsonValue> => (r.ok ? r.json() : Promise.reject(r.statusText)))\n .then((d) => {\n s.value = d;\n })\n .catch((error) => {\n if (!(error instanceof Error && error.name === \"AbortError\")) {\n s.value = { error: String(error) };\n }\n });\n\n if (debounceMs > 0) {\n debounceTimer = setTimeout(doFetch, debounceMs);\n } else {\n void doFetch();\n }\n });\n }\n\n return s;\n }\n\n case \"URLSearchParams\": {\n return computed(() => {\n const p: Record<string, string> = {};\n for (const [k, v] of Object.entries(def)) {\n if (k !== \"$prototype\") {\n /* SAFETY: the record goes straight to `URLSearchParams`, whose WebIDL record<USVString,\n USVString> conversion stringifies every value itself; a bound number or boolean\n reaches that conversion exactly as it always has. */\n p[k] = (\n isRefValue(v)\n ? resolveRef(v.$ref, state)\n : isTemplateString(v)\n ? evaluateTemplate(v, state)\n : v\n ) as string;\n }\n }\n return new URLSearchParams(p).toString();\n });\n }\n\n case \"LocalStorage\":\n case \"SessionStorage\": {\n const store = def.$prototype === \"LocalStorage\" ? localStorage : sessionStorage;\n const k = def.key ?? key;\n let init: JxScopeValue;\n try {\n const s = store.getItem(k);\n /* SAFETY: `JSON.parse` answers the JSON value the stored text encodes, or throws, which the\n catch below answers with the entry's default. */\n init = s !== null ? (JSON.parse(s) as JsonValue) : (def.default ?? null);\n } catch {\n init = def.default ?? null;\n }\n const storageState = scopeRef(init);\n // Persist on change\n effect(() => {\n const v = storageState.value;\n if (v === null) {\n try {\n store.removeItem(k);\n } catch {}\n } else {\n try {\n store.setItem(k, JSON.stringify(v));\n } catch {}\n }\n });\n return storageState;\n }\n\n case \"Cookie\": {\n const name = def.name ?? key;\n const read = (): JsonValue => {\n const raw = readCookie(document.cookie, name);\n if (raw === null) {\n return null;\n }\n try {\n /* SAFETY: `JSON.parse` answers the JSON value the cookie encodes, or throws, which the\n catch below answers with the raw text. */\n return JSON.parse(decodeURIComponent(raw)) as JsonValue;\n } catch {\n return raw;\n }\n };\n const cookieState = scopeRef(read() ?? def.default ?? null);\n // Persist on change\n effect(() => {\n /* SAFETY: the store is seeded with JSON (`read` parses it, `default` is JSON) and holds\n what the page writes back; `serializeCookie` reads it only through `JSON.stringify`,\n which is defined for any value and keeps exactly the JSON a cookie can carry. */\n // oxlint-disable-next-line unicorn/no-document-cookie -- the Cookie $prototype IS the cookie store binding\n document.cookie = serializeCookie(name, cookieState.value as JsonValue, def);\n });\n return cookieState;\n }\n\n case \"IndexedDB\": {\n const idbState: Ref<JxScopeValue> = ref(null);\n const {\n database,\n store,\n version = 1,\n keyPath = \"id\",\n autoIncrement = true,\n indexes = [],\n } = def;\n if (!database || !store) {\n throw new Error(`Jx: IndexedDB entry '${key}' requires database and store`);\n }\n const req = indexedDB.open(database, version);\n req.addEventListener(\"upgradeneeded\", (e) => {\n // SAFETY: an open request's events are dispatched at the request itself.\n const db: IDBDatabase = (e.target as IDBOpenDBRequest).result;\n if (!db.objectStoreNames.contains(store)) {\n const os = db.createObjectStore(store, { autoIncrement, keyPath });\n for (const i of indexes) {\n os.createIndex(i.name, i.keyPath, { unique: i.unique ?? false });\n }\n }\n });\n req.addEventListener(\"success\", (e) => {\n // SAFETY: an open request's events are dispatched at the request itself.\n const db: IDBDatabase = (e.target as IDBOpenDBRequest).result;\n idbState.value = {\n database,\n getStore: (mode: IDBTransactionMode = \"readwrite\") =>\n Promise.resolve(db.transaction(store, mode).objectStore(store)),\n isReady: true,\n store,\n version,\n };\n });\n req.addEventListener(\"error\", () => {\n idbState.value = { error: req.error?.message };\n });\n return idbState;\n }\n\n case \"Set\": {\n return new Set(Array.isArray(def.default) ? def.default : []);\n }\n\n case \"Map\": {\n return new Map(Object.entries(isJsonObject(def.default) ? def.default : {}));\n }\n\n case \"FormData\": {\n const fd = new FormData();\n for (const [k, v] of Object.entries(def.fields ?? {})) {\n /* SAFETY: `append(name, value)` converts a non-Blob value to a USVString itself, so a JSON\n number or boolean field reaches that conversion exactly as it always has. */\n fd.append(k, v as string);\n }\n return fd;\n }\n\n case \"Blob\": {\n /* SAFETY: a Blob entry's `parts` is the BlobPart list its document declares; anything else\n reaches the Blob constructor, whose own WebIDL sequence check refuses it as before. */\n const parts = def.parts as BlobPart[] | null | undefined;\n return new Blob(parts ?? [], {\n type: isString(def.type) ? def.type : \"text/plain\",\n });\n }\n\n case \"ReadableStream\": {\n return null;\n }\n\n default: {\n console.warn(\n `Jx: unknown $prototype \"${def.$prototype}\" for \"${key}\". Did you mean to add '$src'?`,\n );\n return ref(null);\n }\n }\n}\n\n// ─── External class resolution ────────────────────────────────────────────────\n\n/** Reserved keys stripped from the config object passed to external class constructors. */\nconst EXTERNAL_RESERVED = new Set([\n \"$prototype\",\n \"$src\",\n \"$export\",\n \"timing\",\n \"default\",\n \"description\",\n \"body\",\n \"parameters\",\n \"arguments\",\n \"name\",\n]);\n\n/**\n * The config an external class is constructed with: the entry's own keys, minus the runtime's.\n *\n * @param {JxPrototypeDef} def\n * @returns {JxScope}\n */\nfunction externalConfig(def: JxPrototypeDef): JxScope {\n const config: JxScope = {};\n for (const [k, v] of Object.entries(def)) {\n if (!EXTERNAL_RESERVED.has(k)) {\n config[k] = v;\n }\n }\n return config;\n}\n\n/**\n * A class an external module exports, as the runtime uses it: a function, which is what `typeof`\n * says of every class, constructed with the entry's config.\n */\ntype ExternalClass = JxScopeFunction & (new (config: JxScope) => ExternalClassInstance);\n\n/**\n * Resolve an external class prototype via $src.\n *\n * @param {JxPrototypeDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<Ref<JxScopeValue>>}\n */\nasync function resolveExternalPrototype(\n def: JxPrototypeDef,\n state: JxScope,\n key: string,\n base?: string,\n) {\n const src = def.$src;\n\n // Non-Function $prototype must use .class.json as entrypoint\n if (!src || !src.endsWith(\".class.json\")) {\n throw new Error(\n `Jx: $prototype \"${def.$prototype}\" requires a .class.json $src, got \"${src}\". ` +\n `Wrap the class in a .class.json schema with $implementation.`,\n );\n }\n\n return resolveClassJson(def, state, key, base);\n}\n\n/**\n * Import a JS module and instantiate a class from it. Internal helper used by resolveClassJson for\n * $implementation.\n *\n * @param {JxPrototypeDef} def - Original state entry (for config extraction)\n * @param {string} src - JS module URL to import\n * @param {string} exportName - Export name to look up\n * @param {string} [base] - Base URL for resolution\n * @returns {Promise<Ref<JxScopeValue>>}\n */\nasync function importAndInstantiate(\n def: JxPrototypeDef,\n src: string,\n exportName: string,\n base?: string,\n) {\n let mod: ImportedModule;\n const seeded = seededModule(src);\n if (seeded instanceof Promise) {\n mod = await seeded;\n } else if (seeded) {\n mod = seeded;\n } else {\n try {\n mod = await importModule(src);\n } catch {\n if (base) {\n const resolvedSrc = new URL(src, base).href;\n mod = await importModule(resolvedSrc);\n } else {\n throw new Error(`Failed to import \"${src}\"`);\n }\n }\n _moduleCache.set(src, mod);\n }\n\n const ExportedClass = mod[exportName] ?? mod.default?.[exportName];\n if (!ExportedClass) {\n throw new Error(`Jx: export \"${exportName}\" not found in \"${src}\"`);\n }\n if (!isFunction(ExportedClass)) {\n throw new TypeError(`Jx: \"${exportName}\" from \"${src}\" is not a class`);\n }\n\n /* SAFETY: trust boundary — the external class contract, spec.md §12.3. A `$implementation`\n module's export is written as a class constructed with the entry's config; `isFunction` is all\n that can be checked before `new`, and a function that is not constructible throws its own\n TypeError there, as it always has. The instance is read only through `ExternalClassInstance`'s\n optional members, each checked before it is used, and the one it offers is the entry's value. */\n const instance = new (ExportedClass as ExternalClass)(externalConfig(def));\n\n const value = isFunction(instance.resolve)\n ? await instance.resolve()\n : \"value\" in instance\n ? instance.value\n : instance;\n\n // Always wrap in ref for reactivity with external classes\n const s = scopeRef(value);\n if (isFunction(instance.subscribe)) {\n instance.subscribe((newVal) => {\n s.value = newVal;\n });\n }\n return s;\n}\n\n/**\n * Resolve a .class.json schema-defined class. Fetches the schema, follows $implementation if\n * hybrid, or constructs dynamically if self-contained.\n *\n * Its one caller, {@link resolveExternalPrototype}, already rejects a missing `$src` before this\n * runs, so `def.$src` is never empty here.\n *\n * @param {JxPrototypeDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<Ref<JxScopeValue>>}\n */\nasync function resolveClassJson(def: JxPrototypeDef, state: JxScope, key: string, base?: string) {\n const src = def.$src!;\n let classDef: JxClassDef;\n\n // Bare specifiers (package references like @scope/pkg/file) can't be fetched directly —\n // Go straight to dev proxy which can resolve them via node_modules.\n const isBareSpecifier =\n !src.startsWith(\".\") &&\n !src.startsWith(\"/\") &&\n !src.startsWith(\"http\") &&\n !src.startsWith(\"file:\");\n if (isBareSpecifier) {\n return resolveViaDevProxy(def, state, key, base);\n }\n\n // Try fetching the .class.json file directly\n try {\n const url = base ? new URL(src, base).href : src;\n const res = await fetch(url);\n if (!res.ok) {\n throw new Error(`HTTP ${res.status}`);\n }\n /* SAFETY: trust boundary. Only a `$src` ending in `.class.json` reaches this fetch\n (`resolveExternalPrototype` refuses anything else), and a 2xx answer for one is a class\n definition document; the runtime does not schema-validate documents by design. */\n classDef = (await res.json()) as JxClassDef;\n } catch {\n // Fall back to dev proxy (server will handle .class.json resolution)\n return resolveViaDevProxy(def, state, key, base);\n }\n\n // Hybrid mode: $implementation points to the real JS module\n if (classDef.$implementation) {\n // If the schema references $context (e.g. content types), the browser cannot provide\n // The required server-side context — go directly to dev proxy.\n const schemaStr = JSON.stringify(classDef);\n if (schemaStr.includes('\"#/$context/')) {\n return resolveViaDevProxy(def, state, key, base);\n }\n const schemaUrl = base ? new URL(src, base).href : new URL(src, location.href).href;\n const implSrc = new URL(classDef.$implementation, schemaUrl).href;\n const exportName = def.$export ?? classDef.title ?? def.$prototype;\n try {\n return await importAndInstantiate(def, implSrc, exportName, base);\n } catch {\n return resolveViaDevProxy(def, state, key, base);\n }\n }\n\n // Self-contained: construct class dynamically from schema\n const DynClass = classFromSchema(classDef);\n /* SAFETY: every member of ExternalClassInstance is optional, and each is checked below before it\n is used, so any constructed object satisfies it; a schema class that defines `resolve`,\n `value` or `subscribe` methods or fields is the shape it names. */\n const instance = new DynClass(externalConfig(def)) as ExternalClassInstance;\n\n const value = isFunction(instance.resolve)\n ? await instance.resolve()\n : \"value\" in instance\n ? instance.value\n : instance;\n\n // Always wrap in ref for reactivity\n const s = scopeRef(value);\n if (isFunction(instance.subscribe)) {\n instance.subscribe((newVal) => {\n s.value = newVal;\n });\n }\n return s;\n}\n\n/**\n * Whether a class document's `$defs.constructor` is its own constructor definition, rather than the\n * `Object.prototype.constructor` function every object parsed from JSON inherits.\n *\n * @param rawCtor What `$defs.constructor` reads as\n */\nfunction isCtorDef(\n rawCtor: NonNullable<JxClassDef[\"$defs\"]>[\"constructor\"],\n): rawCtor is JxClassCtorDef {\n return isNonNullObject(rawCtor);\n}\n\n/**\n * Dynamically construct a class from a .class.json schema definition. Browser-side: maps private\n * fields to _-prefixed public fields.\n *\n * @param {import(\"@jxsuite/schema/types\").JxClassDef} classDef\n * @returns {typeof DynClass} A class whose instances hold the schema's fields by name\n */\nfunction classFromSchema(classDef: JxClassDef) {\n const fields = classDef.$defs?.fields ?? {};\n // JSON objects inherit Object.prototype.constructor — only an own object value counts.\n const rawCtor = classDef.$defs?.constructor;\n const ctor = isCtorDef(rawCtor) ? rawCtor : undefined;\n const methods = classDef.$defs?.methods ?? {};\n\n // oxlint-disable-next-line typescript/no-extraneous-class -- methods are attached to the prototype dynamically below\n class DynClass {\n /** Static methods, attached by name below. */\n static [member: string]: JxScopeValue;\n /** An instance holds its fields, and reaches its methods, by the names the schema gives. */\n [member: string]: JxScopeValue;\n\n constructor(config: JxScope = {}) {\n for (const [key, typedField] of Object.entries(fields)) {\n const id = typedField.identifier ?? key;\n const propName = typedField.access === \"private\" ? `_${id}` : id;\n if (config[id] !== undefined) {\n this[propName] = config[id];\n } else if (typedField.initializer !== undefined) {\n this[propName] = typedField.initializer;\n } else if (typedField.default !== undefined) {\n this[propName] = structuredClone(typedField.default);\n } else {\n this[propName] = null;\n }\n }\n if (ctor?.body) {\n const bodyStr = Array.isArray(ctor.body) ? ctor.body.join(\"\\n\") : ctor.body;\n /* SAFETY: `new Function` returns an ordinary function of the one named parameter; `call`\n runs it with the instance under construction as `this`, which is the constructor\n body's contract. */\n const init = new Function(\"config\", bodyStr) as (this: DynClass, config: JxScope) => void;\n init.call(this, config);\n }\n }\n }\n\n for (const [key, typedMethod] of Object.entries(methods)) {\n const name = typedMethod.identifier ?? key;\n const params = (typedMethod.parameters ?? []).map((p) => {\n if (p.$ref) {\n // `split` always yields at least one segment, so `pop` always finds one.\n return p.$ref.split(\"/\").pop() ?? \"\";\n }\n const n = p.identifier ?? p.name;\n return isString(n) ? n : \"arg\";\n });\n const bodyStr = Array.isArray(typedMethod.body)\n ? typedMethod.body.join(\"\\n\")\n : (typedMethod.body ?? \"\");\n\n if (typedMethod.role === \"accessor\") {\n const descriptor: PropertyDescriptor = {};\n if (typedMethod.getter) {\n /* SAFETY: `new Function` returns an ordinary function; as a getter it is called with no\n arguments and the instance as `this`, and what it returns is the property's value. */\n descriptor.get = new Function(typedMethod.getter.body ?? \"\") as () => JxScopeValue;\n }\n if (typedMethod.setter) {\n const sp = (typedMethod.setter.parameters ?? []).map(\n (p) => p.$ref?.split(\"/\").pop() ?? \"v\",\n );\n /* SAFETY: `new Function` returns an ordinary function of the named parameters; as a setter\n it receives the assigned value as its one argument, and its return is discarded. */\n descriptor.set = new Function(...sp, typedMethod.setter.body ?? \"\") as (\n v: JxScopeValue,\n ) => void;\n }\n Object.defineProperty(DynClass.prototype, name, {\n ...descriptor,\n configurable: true,\n });\n } else if (typedMethod.scope === \"static\") {\n DynClass[name] = new Function(...params, bodyStr);\n } else {\n DynClass.prototype[name] = new Function(...params, bodyStr);\n }\n }\n\n Object.defineProperty(DynClass, \"name\", {\n configurable: true,\n value: classDef.title,\n });\n return DynClass;\n}\n\n/**\n * Dev-mode fallback: when an $src module cannot run in the browser, proxy the resolve() call\n * through the Jx dev server (POST /**jx_resolve**). Supports reactive template strings in config\n * values via Vue effect().\n *\n * @param {JxPrototypeDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<Ref<JxScopeValue>>}\n */\nasync function resolveViaDevProxy(def: JxPrototypeDef, state: JxScope, key: string, base?: string) {\n const config = externalConfig(def);\n\n const hasTemplates = Object.values(config).some((v) => isTemplateString(v));\n\n /** @param {JxScope} resolvedConfig */\n const doResolve = (resolvedConfig: JxScope) =>\n fetch(resolveProxyPath(\"/__jx_resolve__\"), {\n body: JSON.stringify({\n $base: base,\n $export: def.$export,\n $prototype: def.$prototype,\n $src: def.$src,\n ...resolvedConfig,\n }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n }).then((r): Promise<JsonValue> => {\n if (!r.ok) {\n throw new Error(`Jx dev proxy ${r.status} for \"${key}\"`);\n }\n // The dev proxy answers with the resolved value serialized as JSON.\n return r.json();\n });\n\n // Always wrap in ref for reactivity\n const s: Ref<JxScopeValue> = ref(null);\n if (hasTemplates) {\n effect(() => {\n const resolvedConfig: JxScope = {};\n for (const [k, v] of Object.entries(config)) {\n resolvedConfig[k] = isTemplateString(v) ? evaluateTemplate(v, state) : v;\n }\n doResolve(resolvedConfig)\n .then((value) => {\n s.value = value;\n })\n .catch((error) => console.error(\"Jx dev proxy:\", error));\n });\n } else {\n doResolve(config)\n .then((value) => {\n s.value = value;\n })\n .catch((error) => console.error(\"Jx dev proxy:\", error));\n }\n return s;\n}\n\n// ─── Server function resolution ───────────────────────────────────────────────\n\n/**\n * Start one `timing: \"server\"` entry's calls, wherever they run. Each call takes the next number,\n * and only the latest may write the entry or report a failure: the answer to a call whose arguments\n * have since changed is dropped whenever it arrives, and a failed call keeps the entry's last\n * value. A call that throws before it returns a promise (an argument the proxy cannot serialize, or\n * a host function that throws synchronously) fails the same way, rather than out of whichever state\n * write started it. The proxy and a host-registered module share it, so a reactive entry's calls\n * are ordered and reported the same way on either path.\n *\n * @param {Ref<JxScopeValue>} s - The entry's value\n * @param {ServerCall} invoke - One call, with resolved arguments: it may return a value or a\n * promise, or throw\n * @param {string} label - The `console.error` prefix a failed call is reported under\n * @returns {(args: JxScope) => void} Starts a call\n */\nfunction latestServerCall(\n s: Ref<JxScopeValue>,\n invoke: ServerCall,\n label: string,\n): (args: JxScope) => void {\n let seq = 0;\n return (args: JxScope) => {\n seq += 1;\n const n = seq;\n /* The executor runs before the constructor returns, so the call still starts synchronously,\n and a throw inside it rejects this promise instead of escaping to the caller. */\n new Promise<JsonValue>((settle) => {\n settle(invoke(args));\n })\n .then((result) => {\n if (n === seq) {\n s.value = result;\n }\n })\n .catch((error) => {\n if (n === seq) {\n console.error(label, error);\n }\n });\n };\n}\n\n/**\n * One call of a `timing: \"server\"` function, with its resolved arguments. Its answer is JSON, or a\n * promise of JSON: on the proxy path the answer crosses the wire as JSON, and a host-registered\n * module honours the same contract so the two paths are interchangeable.\n */\ntype ServerCall = (args: JxScope) => JsonValue | Promise<JsonValue>;\n\n/**\n * Resolve a timing: \"server\" entry. The runtime never imports a server module itself: every call is\n * a POST to the host's `/__jx_server__` proxy, which runs the function server-side with `env`, so\n * the runtime never requests the module's source (spec.md §11.4). A host may still serve that file\n * at its URL, which is why a secret belongs in `env` and never in the module body. The one\n * exception is the host's own act: a module it registered with `preloadModule` (embedding.md §6) is\n * called in process, and a reactive entry's calls are ordered there as the proxy orders them.\n *\n * @param {JxServerFnDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<Ref<JxScopeValue>>}\n */\nasync function resolveServerFunction(\n def: JxServerFnDef,\n state: JxScope,\n key: string,\n base?: string,\n) {\n const src = def.$src;\n const exportName = def.$export;\n\n /* The host-seeded set, not the module cache: a Function entry's own `$src` import lands in that\n cache too, and reusing it here would put a server module in the browser after all. */\n const seeded = _hostSeeded.has(src) ? seededModule(src) : undefined;\n if (!seeded) {\n return resolveServerFunctionViaProxy(def, state, key, base);\n }\n const mod = seeded instanceof Promise ? await seeded : seeded;\n\n const candidate = mod[exportName] ?? mod.default?.[exportName];\n if (!candidate) {\n throw new Error(`Jx: export \"${exportName}\" not found in \"${src}\" for \"${key}\"`);\n }\n if (!isFunction(candidate)) {\n throw new TypeError(`Jx: \"${exportName}\" from \"${src}\" is not a function`);\n }\n /* SAFETY: the guard proved a function, and a function accepts any call. A `timing: \"server\"`\n export is written to be called through the proxy, which hands it one arguments object and\n sends its answer back as JSON, so that is the contract it is held to in process too. */\n const fn = candidate as ServerCall;\n\n const rawArgs = def.arguments ?? {};\n const hasReactiveArg = Object.values(rawArgs).some((v) => isRefValue(v));\n const resolveArgs = () => {\n const args: JxScope = {};\n for (const [k, v] of Object.entries(rawArgs)) {\n args[k] = isRefValue(v) ? resolveRef(v.$ref, state) : v;\n }\n return args;\n };\n\n // Always wrap in ref for reactivity\n const s: Ref<JxScopeValue> = ref(null);\n if (hasReactiveArg) {\n const call = latestServerCall(s, fn, \"Jx server function:\");\n effect(() => {\n const args = resolveArgs();\n onEffectCleanup(() => {});\n call(args);\n });\n } else {\n s.value = await fn(resolveArgs());\n }\n return s;\n}\n\n/**\n * Call a timing: \"server\" entry through the host's `/__jx_server__` proxy, which imports the module\n * server-side and calls the export with `env` (server.md §3.3). This is the only path an\n * interpreting runtime takes for a module the host did not register. A `$ref` argument makes the\n * call reactive: it re-posts from an `effect()` when the reference changes. A failed call leaves\n * the entry's last value and logs, and the answer to a superseded call is dropped, so a slow answer\n * to an earlier call can never overwrite a later one (`latestServerCall`).\n *\n * @param {JxServerFnDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<Ref<JxScopeValue>>}\n */\nasync function resolveServerFunctionViaProxy(\n def: JxServerFnDef,\n state: JxScope,\n key: string,\n base?: string,\n) {\n const rawArgs = def.arguments ?? {};\n const hasReactiveArg = Object.values(rawArgs).some((v) => isRefValue(v));\n\n const resolveArgs = () => {\n const args: JxScope = {};\n for (const [k, v] of Object.entries(rawArgs)) {\n args[k] = isRefValue(v) ? resolveRef(v.$ref, state) : v;\n }\n return args;\n };\n\n /** @param {JxScope} args */\n const doResolve = (args: JxScope) =>\n fetch(resolveProxyPath(\"/__jx_server__\"), {\n body: JSON.stringify({\n $base: base,\n $export: def.$export,\n $src: def.$src,\n arguments: args,\n }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n }).then((r): Promise<JsonValue> => {\n if (!r.ok) {\n throw new Error(`Jx server proxy ${r.status} for \"${key}\"`);\n }\n // The proxy answers with the function's result serialized as JSON.\n return r.json();\n });\n\n // Always wrap in ref for reactivity\n const s: Ref<JxScopeValue> = ref(null);\n const call = latestServerCall(s, doResolve, \"Jx server proxy:\");\n if (hasReactiveArg) {\n effect(() => {\n const args = resolveArgs();\n onEffectCleanup(() => {});\n call(args);\n });\n } else {\n call(resolveArgs());\n }\n return s;\n}\n\n/**\n * Resolve a $ref string to a value in scope.\n *\n * With Vue reactivity, this reads directly from the reactive proxy. When called inside a effect or\n * computed, the read is tracked.\n *\n * @param {string} ref\n * @param {JxScope} state - Reactive scope proxy (or child scope)\n * @returns {JxScopeValue}\n */\nexport function resolveRef(refPath: string, state: JxScope) {\n // A `$ref` read from a document is not schema-validated, so a non-string one passes through.\n if (!isString(refPath)) {\n return refPath;\n }\n if (refPath.startsWith(\"$map/\") || refPath.startsWith(\"#/$map/\")) {\n /* Both spellings. `#/` is the documented JSON Pointer prefix everywhere else in the schema,\n so a `#/$map/item/x` fell through to `readPath`, returned null, and a `$map` over it\n rendered ZERO rows with no warning. */\n const parts = (refPath.startsWith(\"#/\") ? refPath.slice(2) : refPath).split(\"/\");\n const [, key] = parts; // \"item\" or \"index\"\n /* SAFETY: `$map` holds only the row record `renderMappedArrayInto` binds (see `rowContext`), an\n ordinary object read here by whichever member the ref names. */\n const map = state.$map as Record<string, JxScopeValue> | undefined;\n const base = map?.[key!] ?? state[`$map/${key}`];\n return parts.length > 2 ? readPath(base, parts.slice(2).join(\"/\")) : base;\n }\n if (refPath.startsWith(\"#/state/\")) {\n // One call, not a hand-split leading token: slicing at the first `/` skipped unescaping it, so\n // `#/state/a~1b/c` looked for a member called `a~1b` rather than `a/b`.\n return readPath(state, refPath.slice(\"#/state/\".length));\n }\n if (refPath.startsWith(\"parent#/\")) {\n /*\n * A prop name may be a path into the prop. This read the whole path as one key and returned\n * undefined for `parent#/user/name`, while the compiler lowered it to a walk.\n */\n return readPath(state, refPath.slice(\"parent#/\".length));\n }\n if (refPath.startsWith(\"window#/\")) {\n return readPath(globalThis.window, refPath.slice(\"window#/\".length));\n }\n if (refPath.startsWith(\"document#/\")) {\n return readPath(globalThis.document, refPath.slice(\"document#/\".length));\n }\n return readPath(state, refPath) ?? null;\n}\n\n// ─── Utilities ────────────────────────────────────────────────────────────────\n\n/**\n * Check if v is a Vue ref (including computed).\n *\n * @param {unknown} v\n * @returns {v is Ref<unknown>}\n */\nexport function isSignal(v: unknown): v is Ref<unknown> {\n return isRef(v);\n}\n\n/**\n * Write an observed attribute into element state, coerced by the type the state entry already holds\n * (spec §16.5): a number parses, a boolean is presence (`\"false\"` counts as absent), and anything\n * else is the string. Shared by connection and `attributeChangedCallback` so the two cannot\n * disagree.\n *\n * REMOVING an attribute restores the entry's DECLARED DEFAULT rather than writing the absence\n * through. `attributeChangedCallback` reports a removal as `null`, and writing that through gave a\n * `type: \"string\"` entry the value `null` and a `type: \"number\"` entry `Number(null)`, which is 0 —\n * so a numeric prop could never express \"unset\" and a string prop stopped matching its own declared\n * type. The default is the value the entry had before anyone set the attribute, which is what the\n * removal is asking to go back to.\n *\n * @param defaults The declared defaults by state key; a key absent from it has none.\n */\nfunction absorbAttribute(\n state: JxScope,\n name: string,\n value: string | null,\n defaults?: ReadonlyMap<string, JxScopeValue>,\n): void {\n const camelKey = name.replaceAll(/-([a-z])/g, (_: string, c: string) => c.toUpperCase());\n const current = state[camelKey];\n if (isBoolean(current)) {\n // Presence IS the value for a boolean, so a removal is already spelled by the same rule.\n state[camelKey] = value !== null && value !== \"false\";\n return;\n }\n if (value === null) {\n const declared = defaults?.get(camelKey);\n state[camelKey] = declared === undefined ? (isNumber(current) ? 0 : \"\") : declared;\n return;\n }\n state[camelKey] = isNumber(current) ? Number(value) : value;\n}\n\n/**\n * The declared default of every state entry that has one, by state key.\n *\n * @param def The element definition\n * @returns {Map<string, JxScopeValue>} Key → default\n */\nfunction declaredDefaults(def: JxElement): Map<string, JxScopeValue> {\n const out = new Map<string, JxScopeValue>();\n for (const [key, entry] of Object.entries(def.state ?? {})) {\n if (isNonNullObject(entry)) {\n if (\"default\" in entry) {\n out.set(key, entry.default);\n continue;\n }\n // A computed entry has no default: its value is produced, and a removal leaves it alone.\n if (COMPUTED_STATE_KEYS.some((marker) => marker in entry)) {\n continue;\n }\n }\n // The shorthand `{ \"label\": \"none\" }` IS the default, the same way `buildScope` reads it.\n out.set(key, entry);\n }\n return out;\n}\n\n/** The markers that make a state entry produced rather than authored. */\nconst COMPUTED_STATE_KEYS = [\"$expression\", \"$prototype\", \"$ref\", \"$src\"] as const;\n\n/** Keys already reported, so a component rendered in a loop warns once rather than per instance. */\nconst _privatePropWarned = new Set<string>();\n\n/**\n * Refuse a `$props` write against a private (`#`) state key — `spec.md` §5.6.\n *\n * Ignored rather than thrown. A `$props` block naming a private entry is an authoring mistake, not\n * a broken document: the rest of the instance is well-formed and refusing to render it would turn a\n * typo into a blank page. But silence was the previous behavior and it is the wrong kind — the\n * author sees a prop that looks accepted and does nothing — so the write is dropped and named.\n *\n * @param {string} key\n * @param {string} [where] - The site refusing it, for a message that points somewhere\n * @returns {boolean} True when the key is private and the caller must skip it\n */\n/**\n * Whether the instance genuinely CARRIES `key`, rather than the prototype merely having an accessor\n * for it.\n *\n * `key in el` cannot tell those apart, and for a REFLECTED DOM property — `title`, `role`, `id`,\n * `lang`, `dir`, `slot`, `hidden` — the accessor answers `\"\"` when nothing is set. `\"\" !==\n * undefined`, so a component declaring `state.title` never rendered its own default: the empty\n * string won. `quote` next to it kept its default, which is what made the bug look like bad\n * content.\n *\n * The test is NOT `Object.hasOwn` alone, and that distinction is the whole subtlety. Assigning a\n * reflected name goes through the prototype accessor and creates no own property, so a legitimate\n * `$props.title` would be discarded by an own-property test — silently, for every component that\n * declares one. What the accessor DOES do is write the attribute, so the attribute is the evidence\n * that somebody set it, whether that was `$props` before connection or the author in the document.\n *\n * @param {HTMLElement} el - The instance being connected.\n * @param {string} key - A state key declared by the component definition.\n * @returns {boolean}\n */\nfunction instanceSupplies(el: HTMLElement, key: string): boolean {\n if (Object.hasOwn(el, key)) {\n return true;\n }\n if (el.hasAttribute(key)) {\n return true;\n }\n // ARIA-style reflections carry a kebab attribute for a camelCase property (`ariaLabel` →\n // `aria-label`), so the direct name lookup above would miss a value that really was set.\n const kebab = key.replaceAll(/[A-Z]/gu, (c) => `-${c.toLowerCase()}`);\n return kebab !== key && el.hasAttribute(kebab);\n}\n\n/**\n * The platform's setter for `key` on an element, when the name is one the platform already owns.\n *\n * @param {HTMLElement} el\n * @param {string} key\n * @returns {((value: JxScopeValue) => void) | undefined}\n */\nfunction nativeSetter(el: HTMLElement, key: string): ((value: JxScopeValue) => void) | undefined {\n for (\n let proto: object | null = Reflect.getPrototypeOf(el);\n proto;\n proto = Reflect.getPrototypeOf(proto)\n ) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, key);\n if (descriptor) {\n return descriptor.set;\n }\n }\n return undefined;\n}\n\nfunction refusePrivateProp(key: string, where?: string): boolean {\n if (!isPrivateStateKey(key)) {\n return false;\n }\n const seen = where === undefined ? key : `${where}:${key}`;\n if (!_privatePropWarned.has(seen)) {\n _privatePropWarned.add(seen);\n console.warn(\n `Jx: \"${key}\" is private state (spec.md §5.6) and cannot be set through $props` +\n `${where === undefined ? \"\" : ` (${where})`}. The write was ignored; rename the entry ` +\n \"without the leading # to make it part of the component's interface.\",\n );\n }\n return true;\n}\n\n/** Tests only — the warn-once set outlives a single render by design. */\nexport function _resetPrivatePropWarnings(): void {\n _privatePropWarned.clear();\n}\n\n/**\n * @param {JxElement} def\n * @param {JxScope} parentState\n * @returns {JxScope}\n */\nfunction mergeProps(def: JxElement, parentState: JxScope): JxScope {\n const child = inheritScope(parentState);\n for (const [k, v] of Object.entries(def.$props ?? {})) {\n if (refusePrivateProp(k, \"$props\")) {\n continue;\n }\n child[k] = isRefValue(v) ? resolveRef(v.$ref, parentState) : v;\n }\n return child;\n}\n\n/*\n * The CSS-authoring rules live in `./css.ts`, whose only import is a pair of type guards. They are\n * re-exported\n * here because they always were part of this module's surface and moving them must not break a\n * consumer; a host that cannot afford the DOM runtime imports `@jxsuite/runtime/css` instead.\n */\nexport {\n buildStyleRules,\n camelToKebab,\n COLOR_SCHEME_ATTR,\n COLOR_SCHEME_STORAGE_KEY,\n cssPropertyName,\n cssRuleText,\n hashCss,\n isDeclarationAtRule,\n isKeyframesAtRule,\n isNestedSelectorKey,\n pureSchemeOf,\n resolveAtQuery,\n resolveNestedSelector,\n schemeSelectors,\n spliceNestingSelector,\n splitSelectorList,\n transposeCanvasOverlaySelector,\n transposeCanvasPopoverSelector,\n} from \"./css.ts\";\nexport type { CssBuildOptions, CssKeyframeBlock, CssRule, CssRuleTarget } from \"./css.ts\";\n\n/**\n * Convert a style rules object to a CSS text string (skipping nested selectors).\n *\n * Kept for consumers; nothing in this repository composes a rule this way any more, because\n * `buildStyleRules` answers the same question for a whole style object rather than one flat level\n * of it. It shares that function's property spelling — `cssPropertyName`, not `camelToKebab` — so a\n * custom property survives it: `--fooBar` and `--foo-bar` are two different properties, and\n * kebab-casing one renames it out from under the `var()` that reads it.\n *\n * @param {JxStyle} rules\n * @returns {string}\n */\nexport function toCSSText(rules: JxStyle) {\n return Object.entries(rules)\n .filter(([k, v]) => !isNestedSelectorKey(k) && !isNonNullObject(v))\n .map(([p, v]) => `${cssPropertyName(p)}: ${canvasStyleValue(String(v))}`)\n .join(\"; \");\n}\n\n// ─── Custom Element Registration ──────────────────────────────────────────────\n\nlet _rootMedia: Record<string, string> = {};\n/**\n * Every defined element's CURRENT definition, read at connection — which is what lets a definition\n * be replaced.\n */\nconst _elementDefs = new Map<string, { base: string; doc: JxDocument }>();\n\n/**\n * The definition an element tag renders from, as most recently defined or redefined.\n *\n * @param {string} tagName\n * @returns {{ base: string; doc: JxDocument } | undefined}\n */\nexport function elementDefinition(tagName: string): { base: string; doc: JxDocument } | undefined {\n return _elementDefs.get(tagName);\n}\n\n/**\n * Replace an element's definition (embedding.md §7). `customElements.define` is one-shot, so the\n * generated class reads its definition through the registry at connection time: an instance\n * connected after this call renders the new document; one already on the page keeps the definition\n * it rendered until it is re-mounted. `observedAttributes` is the one thing the platform freezes at\n * first definition, so a changed list is reported and takes effect only in a fresh realm. A tag not\n * yet defined is simply defined.\n *\n * @param {JxDocument} doc\n * @param {string} [baseUrl]\n * @returns {Promise<void>}\n */\nexport async function redefineElement(doc: JxDocument, baseUrl?: string): Promise<void> {\n const base = baseUrl ?? location.href;\n const { tagName } = doc;\n if (!tagName || !tagName.includes(\"-\")) {\n throw new Error(`Jx redefineElement: tagName \"${tagName}\" must contain a hyphen`);\n }\n if (!customElements.get(tagName)) {\n await defineElement(doc, base);\n return;\n }\n if (doc.$elements) {\n await registerElements(doc.$elements, base);\n }\n const before = _elementDefs.get(tagName)?.doc.observedAttributes ?? [];\n const after = doc.observedAttributes ?? [];\n if (JSON.stringify(before) !== JSON.stringify(after)) {\n console.warn(\n `Jx redefineElement: <${tagName}> keeps observedAttributes [${before.join(\", \")}] as first defined; [${after.join(\", \")}] takes effect only in a fresh realm`,\n );\n }\n _elementDefs.set(tagName, { base, doc });\n}\n\n/**\n * Seed the module-level root `$media` map used as the fallback for components that declare their\n * own `@--name` style blocks but carry no own `$media` (buildScope ~279-280). `Jx()` sets this from\n * the document during a full top-level render, but the Studio iframe canvas calls `buildScope`/\n * `renderNode` directly (never `Jx()`), so without seeding it a component's `@--md` would resolve\n * to the invalid `@media md`. Callers on the direct path MUST set it (with the merged `$media`)\n * before `buildScope`, and re-set it every render so a stale map from a previous document cannot\n * leak.\n *\n * @param {Record<string, string> | null} [map] - Absent or null clears it\n */\nexport function setRootMedia(map?: Record<string, string> | null): void {\n _rootMedia = map ?? {};\n}\n\n/**\n * Resolve and register $elements entries (depth-first).\n *\n * @param {JxDocument[\"$elements\"]} elements\n * @param {string} base\n * @returns {Promise<void>}\n */\nasync function registerElements(\n elements: NonNullable<JxDocument[\"$elements\"]>,\n base: string,\n ctx?: JxContext,\n) {\n for (const entry of elements) {\n // Bare string: npm package side-effect import (registers custom elements)\n if (isString(entry)) {\n try {\n // Bare specifiers need a URL path for the browser; the dev server resolves\n // /node_modules/<pkg> to the package entry point via exports/module/main.\n const specifier =\n entry.startsWith(\"/\") || entry.startsWith(\".\") ? entry : `/node_modules/${entry}`;\n await import(specifier);\n } catch (error) {\n console.warn(`Jx: failed to import package \"${entry}\"`, error);\n }\n continue;\n }\n if (!isRefValue(entry)) {\n continue;\n }\n const { href } = new URL(entry.$ref, base);\n const doc = await resolve(href, ctx);\n if (!doc.tagName || !doc.tagName.includes(\"-\")) {\n continue;\n }\n if (customElements.get(doc.tagName)) {\n continue;\n }\n\n // Depth-first: register sub-dependencies first\n if (doc.$elements) {\n await registerElements(doc.$elements, href, ctx);\n }\n\n await defineElement(doc, href);\n }\n}\n\n/**\n * Inject head elements from $head declarations. Each entry is { tagName, attributes } — bare npm\n * specifiers in href/src are rewritten to /node_modules/ paths for the dev server.\n *\n * @param {import(\"@jxsuite/schema/types\").JxHeadEntry[]} entries\n * @param {string} _base - Document base URL for resolving relative paths\n */\nfunction injectHead(entries: readonly (JxHeadEntry | null | undefined)[], _base: string) {\n for (const entry of entries) {\n if (!entry || !entry.tagName) {\n continue;\n }\n const tag = entry.tagName.toLowerCase();\n const attrs = { ...entry.attributes };\n // Resolve href/src: bare npm specifiers -> /node_modules/ path\n for (const key of [\"href\", \"src\"] as const) {\n const v = attrs[key];\n if (!isString(v) || v === \"\") {\n continue;\n }\n if (!v.startsWith(\"/\") && !v.startsWith(\".\") && !v.startsWith(\"http\")) {\n /* The bare-specifier lane owns `/node_modules/<pkg>`, which is the HOST's URL space and\n not the project's. A canvas resolver must never claim it: the file is not in the\n repository, so there is nothing for it to resolve to. */\n attrs[key] = `/node_modules/${v}`;\n continue;\n }\n attrs[key] = canvasAssetValue(tag.toUpperCase(), key, v);\n }\n\n // Deduplicate: skip if an identical element already exists\n const selector = `${tag}${attrs.href ? `[href=\"${attrs.href}\"]` : \"\"}${attrs.src ? `[src=\"${attrs.src}\"]` : \"\"}`;\n if (selector !== tag && document.head.querySelector(selector)) {\n continue;\n }\n\n const el = document.createElement(tag);\n for (const [k, v] of Object.entries(attrs)) {\n el.setAttribute(k, String(v));\n }\n if (entry.textContent) {\n // An object is a structured data block (JSON-LD, site-architecture.md §8.5). The compiler\n // Serializes it the same way, so the interpreted page and the built page agree.\n el.textContent = isNonNullObject(entry.textContent)\n ? JSON.stringify(entry.textContent, null, 2)\n : entry.textContent;\n }\n document.head.append(el);\n }\n}\n\n// ─── Instantiation chain (spec.md §16.9) ─────────────────────────────────────\n\n/**\n * How deep component nesting may go before an instance refuses to render, and before the compiler\n * (`@jxsuite/compiler`, `shared.ts`, which imports this export) refuses to continue a build.\n *\n * The cycle check in {@link extendInstancePath} catches a definition that renders ITSELF — same tag,\n * same props — which is the only shape that can never terminate, while a self-reference whose props\n * change at every level (`depth: \"${state.depth + 1}\"`) is data-driven recursion that a `$switch`\n * may or may not bottom out. The seen-set cannot tell those apart, so this cap is what turns a\n * forgotten stop into a diagnostic instead of a page that never settles or a build that overflows\n * its stack. Thirty-two is far beyond any component library's real depth and far below the call\n * stack's. It lives here because the compiler depends on the runtime and not the other way round,\n * so one declaration serves both sides of spec.md §16.9: a page that builds is a page that\n * renders.\n */\nexport const MAX_COMPONENT_NESTING = 32;\n\n/** One instance on the chain: its tag, and the props it was given, as an identity. */\ninterface InstanceFrame {\n tag: string;\n /** Every value the instance supplied that its definition's state read (§16.9). */\n props: JxScope;\n}\n\n/**\n * The chain an instance is created under, and where on it the current expansion began.\n *\n * `frames` is every instance from the page-level one down, outermost first. `expansion` is the\n * index of the first frame that belongs to the SAME synchronous pass as the instance being created:\n * the cycle check (§16.9 rule 1) looks back no further than that, while the cap (rule 2) counts\n * every frame. The distinction is what an effect re-run does to certainty. Along one pass a\n * repeated frame is a render that repeats itself, deterministically, forever. Across a re-run it is\n * not: the frames above the boundary rendered to completion once, and whether the page asks for one\n * of them again is its data — an `onMount` that flips a `$switch` into the same tag every time, or\n * a click that opens one more level of a node that starts closed — which the runtime cannot tell\n * apart. So the cycle check is not asked across the boundary, and the loop that lives in re-runs is\n * ended by the cap instead: thirty-three empty hosts and a diagnostic, not a page that never\n * settles.\n */\ninterface InstancePath {\n frames: readonly InstanceFrame[];\n expansion: number;\n}\n\n/** The chain a page-level render runs under: nothing above it. */\nconst ROOT_INSTANCE_PATH: InstancePath = { expansion: 0, frames: [] };\n\n/**\n * The chain of instances whose definitions are being rendered RIGHT NOW.\n *\n * A module-level stack rather than a WeakMap from element to chain, and it is worth saying why that\n * survives `connectedCallback` being async. The callback awaits `buildScope` before it touches the\n * DOM, and by the time it resumes, whatever the enclosing instance pushed here has long been popped\n * — so the stack alone would be empty for every instance and catch nothing. What saves it is WHEN\n * an instance connects: `this.append(child)` in the enclosing render runs the child's\n * `connectedCallback` synchronously, and every way a definition brings an instance into being —\n * `renderCustomElementWithProps`, the bare-tag branch of `renderNode`, a nested element inside\n * either, and a prerendered host drawing its children again as it upgrades — appends it inside that\n * same synchronous stretch. So the callback reads the stack ONCE, before its first `await`, and\n * carries the copy across the gap. A WeakMap would need a write at each of those creation sites to\n * say the same thing.\n *\n * A subtree an effect renders LATER — a `$switch` case that flips after the first paint, a `$map`\n * row that arrives with new data — connects with nothing on the stack, because no enclosing render\n * is running when the effect re-runs; a write from `onMount` or a click is what triggered it. So\n * the two renderers that create nodes from an effect each capture the stack when they are first\n * rendered (which is inside the enclosing pass) and put it back, re-expanded, around every later\n * insertion ({@link underInstancePath}). That is the one thing this stack needs beyond the\n * synchronous stretch, and it is what makes the `onMount`-flip shape a diagnostic rather than a\n * hang. Reading `@vue/reactivity`'s `getCurrentScope()` there instead would find nothing: an effect\n * re-run restores no scope, and a case or a row renders in a DETACHED scope with no parent.\n */\nlet _instancePath: InstancePath = ROOT_INSTANCE_PATH;\n\n/**\n * Say that an instance was not rendered, on the two surfaces a host can reach (spec §16.4, §16.9):\n * the console, and a bubbling, composed `jx-error` `ErrorEvent` from the element carrying the\n * error. Nothing is said for a host no longer in the document, whose replacement reports for it.\n *\n * @param {HTMLElement} host - The instance\n * @param {string} tagName - Its tag, for the console line\n * @param {Error} error - Why\n */\nfunction reportUnrendered(host: HTMLElement, tagName: string, error: Error): void {\n if (!host.isConnected) {\n return;\n }\n console.error(`Jx: <${tagName}> was not rendered:`, error);\n host.dispatchEvent(\n new ErrorEvent(\"jx-error\", {\n bubbles: true,\n composed: true,\n error,\n message: error.message,\n }),\n );\n}\n\n/**\n * Run `fn` with `path` as the chain, so every instance that CONNECTS during it reads that chain.\n *\n * Restored rather than cleared afterwards: the enclosing render's chain is what was there, and a\n * restore needs no argument about whether anything was.\n *\n * @param {InstancePath} path - The chain the instances `fn` connects are created under\n * @param {() => T} fn - The render, or the insertion that connects what a render made\n * @returns {T} What `fn` returned\n */\nfunction underInstancePath<T>(path: InstancePath, fn: () => T): T {\n const was = _instancePath;\n _instancePath = path;\n try {\n return fn();\n } finally {\n _instancePath = was;\n }\n}\n\n/**\n * The chain a later insertion runs under: the same frames, with the expansion beginning now.\n *\n * Called on EVERY run of a `$switch` case or a `$map` reconcile, the first one included — harmless\n * there, because a first run builds into a detached container and nothing connects until the\n * enclosing pass appends it, under the enclosing pass's own chain.\n *\n * @param {InstancePath} path - The chain captured when the renderer was first rendered\n * @returns {InstancePath}\n */\nfunction reexpand(path: InstancePath): InstancePath {\n return { expansion: path.frames.length, frames: path.frames };\n}\n\n/**\n * Whether two prop values are the same input to a definition.\n *\n * Reference equality first — a `$ref` into the parent's state forwards the same primitive, the same\n * reactive proxy or the same function to the next level — and structural equality for plain data\n * rebuilt at each level (`data-jx-props` parsed twice is two objects with one meaning). Plain data\n * is what JSON can describe: an array, or an object with no prototype but `Object`'s, reactive or\n * raw. Anything else — a `Map`, a `Set`, a class instance, a circular object — is different from\n * everything but itself, because its JSON form would not say what it holds and two different values\n * that serialise alike would close a cycle that was never there. The cost of that policy is a loop\n * the depth cap catches instead; the alternative is a false diagnostic on a page that would have\n * ended. Inside plain data the comparison IS the JSON form, so a member JSON cannot see (a\n * function, a `Map` two levels down) is not seen here either; §16.9 says so.\n *\n * @param {JxScopeValue} a\n * @param {JxScopeValue} b\n * @returns {boolean}\n */\nfunction samePropValue(a: JxScopeValue, b: JxScopeValue): boolean {\n if (Object.is(a, b)) {\n return true;\n }\n if (!isPlainData(a) || !isPlainData(b)) {\n return false;\n }\n try {\n return JSON.stringify(a) === JSON.stringify(b);\n } catch {\n return false;\n }\n}\n\n/**\n * Whether a value is an array or a plain object — the shapes whose JSON form is the whole value.\n *\n * @param {JxScopeValue} value\n * @returns {boolean}\n */\nfunction isPlainData(value: JxScopeValue): boolean {\n if (!isNonNullObject(value)) {\n return false;\n }\n const raw: unknown = toRaw(value);\n if (Array.isArray(raw)) {\n return true;\n }\n const proto: unknown = Object.getPrototypeOf(raw);\n return proto === Object.prototype || proto === null;\n}\n\n/**\n * Whether two frames are the same instance: one tag, one set of prop names, equal values.\n *\n * @param {InstanceFrame} a\n * @param {InstanceFrame} b\n * @returns {boolean}\n */\nfunction sameFrame(a: InstanceFrame, b: InstanceFrame): boolean {\n if (a.tag !== b.tag) {\n return false;\n }\n const keys = Object.keys(a.props);\n if (keys.length !== Object.keys(b.props).length) {\n return false;\n }\n return keys.every(\n (key) => Object.hasOwn(b.props, key) && samePropValue(a.props[key], b.props[key]),\n );\n}\n\n/**\n * The chain an instance's own render runs under: the enclosing chain plus itself — or the\n * diagnostic that says why it must not render at all.\n *\n * The two messages are the compiler's, word for word (`renderComponentInstance` in\n * `@jxsuite/compiler`), so a page that fails to build and a canvas that fails to paint say the same\n * thing about the same definition. Meeting a frame already on the chain, within the current\n * expansion, is the instance rendering itself with the same props, which never ends; a chain at the\n * cap is a self-reference whose props change — or whose repeats live in re-runs, where the cycle\n * check is not asked ({@link InstancePath}) — and whose stop case never came.\n *\n * @param {InstancePath} path - The chain the instance was created under\n * @param {InstanceFrame} frame - The instance about to render\n * @returns {InstancePath} The chain its children render under\n * @throws {Error} The named diagnostic — never a stack overflow, never a hang\n * @docs framework/concepts/components\n */\nfunction extendInstancePath(path: InstancePath, frame: InstanceFrame): InstancePath {\n const chain = [...path.frames.map((f) => f.tag), frame.tag].join(\" → \");\n if (path.frames.slice(path.expansion).some((f) => sameFrame(f, frame))) {\n throw new Error(\n `Component <${frame.tag}> renders itself: ${chain}. A component cannot appear inside its own ` +\n `definition with the same props — the expansion would never end.`,\n );\n }\n if (path.frames.length >= MAX_COMPONENT_NESTING) {\n throw new Error(\n `Component nesting exceeds ${MAX_COMPONENT_NESTING} levels: ${chain}. A component that ` +\n `renders itself with changing props needs a case that stops.`,\n );\n }\n return { expansion: path.expansion, frames: [...path.frames, frame] };\n}\n\n/**\n * Register a custom element from a Jx document.\n *\n * @param {string | JxDocument} source - URL to .json file, or raw document object\n * @param {string} [base] - Base URL for resolving $src imports\n * @returns {Promise<void>}\n */\nconst _definedSources = new Set<string>();\n\nexport async function defineElement(source: string | JxDocument, baseUrl?: string) {\n let base = baseUrl;\n let source_: JxDocument;\n if (isString(source)) {\n base = new URL(source, base ?? location.href).href;\n if (_definedSources.has(base)) {\n return;\n }\n _definedSources.add(base);\n source_ = await resolve(source);\n } else {\n source_ = source;\n }\n base ??= location.href;\n\n const { tagName } = source_;\n if (!tagName || !tagName.includes(\"-\")) {\n throw new Error(`Jx defineElement: tagName \"${tagName}\" must contain a hyphen`);\n }\n if (customElements.get(tagName)) {\n return;\n }\n\n // Register sub-dependencies first\n if (source_.$elements) {\n await registerElements(source_.$elements, base);\n }\n\n _elementDefs.set(tagName, { base, doc: source_ });\n\n // The definition as first given. The class reads the CURRENT one at connection (see\n // `redefineElement`); only `observedAttributes` is frozen here, because the platform freezes it.\n const initialDef = source_;\n const initialBase = base;\n const observedAttrs = initialDef.observedAttributes ?? [];\n\n const ElementClass = class extends HTMLElement {\n _jxInitialized = false;\n _state: JxScope | null = null;\n\n static get observedAttributes() {\n return observedAttrs;\n }\n\n async connectedCallback() {\n // An element carrying `data-jx-definition-root` IS the definition being rendered by an\n // External renderer (the studio canvas editing this component's own document) — its subtree\n // Is authored DOM, not an instantiation site. Self-initializing here would wipe that tree\n // And re-render it with default state (the \"component editor shows a live instance\" bug).\n if (this.dataset.jxDefinitionRoot !== undefined) {\n return;\n }\n if (this._jxInitialized) {\n return;\n }\n this._jxInitialized = true;\n\n /* The chain this instance was created under, read BEFORE the first `await`: the enclosing\n render is still on the stack now and will not be when this callback resumes. See\n {@link _instancePath} for why that ordering is the whole mechanism. */\n const enclosingPath = _instancePath;\n /* What this instance was given, recorded beside each write into state below. It is the\n instance's identity on the chain (§16.9): two nested instances of one tag that were given\n the same values render the same thing, forever. Only a value the definition's state READS\n is recorded — a `$props` key no state entry declares changes nothing about the render, so\n a definition that \"varies\" one at each level is still rendering itself. */\n const supplied: JxScope = {};\n\n // The definition as it stands NOW — a redefinition since this class was made is honoured.\n const live = _elementDefs.get(tagName) ?? { base: initialBase, doc: initialDef };\n const def = live.doc;\n const defBase = live.base;\n\n // The element is its own dispatch root: a body run without an event emits from the host.\n const state = await buildScope(def, {}, defBase, { base: defBase, media: null, root: this });\n\n // Read properties from the data-jx-props payload the site build writes on a\n // Non-static instance, so an upgrade re-renders with the authored props, not the defaults.\n /* Observed attributes already on the element are read now. `attributeChangedCallback` fires\n for an attribute set before connection too — but on an instance with no state yet, so it\n had nothing to write into, and `<jx-icon name=\"plus\">` rendered with the default. Before\n the `$props` merges below, so a property a parent set still wins (spec §16.2). */\n for (const attr of observedAttrs) {\n if (this.hasAttribute(attr)) {\n absorbAttribute(state, attr, this.getAttribute(attr));\n // The raw string, not the coerced value: coercion is a function of it, so two equal\n // Strings are one input.\n supplied[attr] = this.getAttribute(attr);\n }\n }\n\n const propsAttr = this.dataset.jxProps;\n if (propsAttr) {\n try {\n /* SAFETY: `JSON.parse` answers the JSON value the attribute encodes, or throws, which the\n catch below ignores as it always has. */\n const props = JSON.parse(propsAttr) as JsonValue;\n /* The site build writes an object. An array or string payload still yields its index\n keys, and a number, boolean or null yields none, as `Object.entries` always gave. */\n const entries = isNonNullObject(props) || isString(props) ? Object.entries(props) : [];\n for (const [key, val] of entries) {\n if (refusePrivateProp(key, \"data-jx-props\")) {\n continue;\n }\n if (key in (def.state ?? {})) {\n state[key] = val;\n supplied[key] = val;\n }\n }\n } catch {}\n delete this.dataset.jxProps;\n }\n\n // Read literal `props.*` attributes (JSON-authored instances pass props this way; the\n // Compiler lifts them into $props at build, and this is the live-render mirror). String\n // Values only — HTML lowercases attribute names, so state keys must be lowercase to match.\n // Collect first: removing while iterating the live NamedNodeMap skips entries.\n const propAttrNames = this.getAttributeNames().filter(\n (name) => name.startsWith(\"props.\") && name.length > \"props.\".length,\n );\n for (const name of propAttrNames) {\n const key = name.slice(\"props.\".length);\n if (refusePrivateProp(key, \"props.* attribute\")) {\n this.removeAttribute(name);\n continue;\n }\n if (key in (def.state ?? {})) {\n state[key] = this.getAttribute(name);\n supplied[key] = this.getAttribute(name);\n this.removeAttribute(name);\n }\n }\n\n // Merge $props set as JS properties by parent before connection\n for (const key of Object.keys(def.state ?? {})) {\n if (isPrivateStateKey(key)) {\n continue;\n }\n const own = elementProperties(this);\n if (key in this && own[key] !== undefined && instanceSupplies(this, key)) {\n state[key] = own[key];\n supplied[key] = own[key];\n }\n }\n\n /* Every input is known now, so this is where an instance that would never finish is\n refused (§16.9): before it has a state, a style or a child, so a refused host is an empty\n element the page renders around — emptied of what the definition wrote into it for its\n slots too, since nothing will distribute that. The diagnostic is REPORTED rather than\n thrown onward: a throw from an async `connectedCallback` is an unhandled rejection that\n names no element and stops nothing. It goes two ways. The console is the runtime's\n surface for a render that fails after the page has settled (`$switch` external cases and\n the dev proxies report there too). The `jx-error` event is the surface a HOST can hold:\n it bubbles from the refused element with the error on it, so a page, or the studio canvas\n wrapping one, can collect it where a console line inside an iframe reaches nobody. The\n rest of the page keeps rendering, which is the point.\n\n Neither surface is used for a host that is no longer in the document. A refused instance\n was connected when this callback began, and one that is not by the time the verdict is in\n belongs to a subtree the page discarded during the `await` above: a prerendered host of the\n same tag that was parsed INSIDE another and re-rendered from the definition by the outer\n one's upgrade, which captures it as slot content and empties itself. Its replacement is\n the instance that reports, on the chain the outer upgrade draws; reporting from the\n discarded copy too said one defect twice. The refusal itself still stands, so a host\n re-attached later is an empty element and not a hang. */\n let ownPath: InstancePath;\n try {\n ownPath = extendInstancePath(enclosingPath, { props: supplied, tag: tagName });\n } catch (error) {\n this.replaceChildren();\n reportUnrendered(this, tagName, error instanceof Error ? error : new Error(String(error)));\n return;\n }\n /*\n * Set up property getters/setters that forward into reactive state. Private entries get NO\n * accessor: the property-first interface IS the props mechanism, so defining one would leave\n * `el[\"#cache\"] = x` writing straight through everything above.\n */\n for (const key of Object.keys(def.state ?? {})) {\n if (isPrivateStateKey(key)) {\n continue;\n }\n /* A name the platform already owns (`title`, `lang`, `hidden`) keeps its native setter, so\n the attribute still reflects — and ALSO reaches state. Skipping it entirely meant a prop\n delivered after connection (a template over data that resolves asynchronously) wrote\n only the attribute: the instance kept the empty value it connected with, and a card's\n `title` never rendered. */\n const native = nativeSetter(this, key);\n Object.defineProperty(this, key, {\n configurable: true,\n get: () => state[key],\n set: (v: JxScopeValue) => {\n native?.call(this, v);\n state[key] = v;\n },\n });\n }\n\n this._state = state;\n\n // Capture light DOM children (for slot distribution) before rendering\n const slottedChildren = captureSlotted(this);\n this.replaceChildren();\n\n /* Custom elements default to `display: inline`; a Jx container behaves like a `<div>`, so\n one is supplied. It goes in the element's OWN RULE rather than inline: an inline\n declaration is beaten only by `!important`, so a consumer could not override the default\n without one. At (0,1,0) a consumer's rule, a cascade layer or a parent's descendant rule\n all win normally, and the definition's own `display` still wins because it is written into\n the same rule after this. */\n const ownStyle = def.style;\n const defStyle =\n ownStyle && declaresDisplay(ownStyle) ? ownStyle : { display: \"block\", ...ownStyle };\n /* Definition first, call site second, so the call site wins at equal specificity by source\n order — the promise §9.2 already makes for base-before-nested. Merged into ONE call\n because each `applyStyle` releases what the last one interned. */\n const hostStyle = mergeStyle(defStyle, callSiteStyles.get(this));\n\n // Render template into light DOM (once, not in effect — inner effects handle reactivity)\n applyStyle(this, hostStyle, scopeMedia(state), state);\n applyAttributes(this, def.attributes ?? {}, state);\n bindDefinitionHandlers(this, def, state);\n\n /*\n * Root-level `textContent` is a definition's content just as much as `children` is — it is\n * the shape spec.md §17.2 recommends when every child would be a bare string — and it was\n * dropped here, so such a component rendered empty everywhere the interpreter runs.\n */\n if (!Array.isArray(def.children) && def.textContent !== undefined) {\n bindProperty(this, \"textContent\", def.textContent, state);\n }\n const children = Array.isArray(def.children) ? def.children : [];\n /* A render that throws is reported the way a refusal is (§16.4), for the same reason: thrown\n onward from this async callback it is an unhandled rejection naming no element. The\n children drawn before the throw stay; the one that threw, its later siblings and `onMount`\n do not happen, and slot content is still distributed into the slots that were drawn. */\n const draw = (): Error | null => {\n /* An instance the studio stamped is part of the page being edited, so everything the\n definition draws inside it is too — and the de-link rules cannot see that from the nodes\n themselves. Restored rather than cleared, because one definition may render another. */\n const wasInside = _canvasInsideStampedHost;\n _canvasInsideStampedHost ||= this.dataset.jxPath !== undefined;\n /* And the chain, for the same span: an instance this definition draws connects inside\n `this.append` below and reads it there ({@link underInstancePath}). */\n let failure: Error | null = null;\n try {\n underInstancePath(ownPath, () => {\n for (const childDef of children) {\n this.append(renderNode(childDef, state));\n }\n });\n } catch (error) {\n failure = error instanceof Error ? error : new Error(String(error));\n } finally {\n _canvasInsideStampedHost = wasInside;\n }\n // Slot distribution (light DOM)\n distributeSlots(this, slottedChildren);\n return failure;\n };\n\n /* Lifecycle: onMount, with the HOST as its second argument.\n A sidecar that must reach the element it belongs to had no way to: the runtime handed it\n the scope alone, so elements resorted to dispatching a `jx-ready` event at themselves and\n catching it with a root handler purely to learn `currentTarget`. The host is what the\n callback needed; the event round trip was the workaround.\n And with the host as its RECEIVER, which is how the compiled element calls it: there a\n state function is an arrow inside the element class, so a body's `this` is the element.\n Called bare here, a body written for the built site (jxsuite.com's search reads\n `const host = this`) read the window instead, and threw on every page that drew it live. */\n const mounted = (): void => {\n const { onMount } = state;\n if (isScopeHook(onMount)) {\n queueMicrotask(() => onMount.call(this, state, this));\n }\n };\n\n let attempt = runScoped(draw);\n const failure = attempt.result;\n if (!failure) {\n mounted();\n return;\n }\n reportUnrendered(this, tagName, failure);\n /* …and it is drawn again when what it was given changes (§16.4). A prop bound to data that\n arrives later (a collection the page resolves after its first render, a row a list fills\n in) reaches the instance AFTER it connected, so the render that threw was a render of\n the empty values, not of the instance. Without a retry it stayed blank for good even once\n every value it needed was there. The watch reads the definition's authored entries only,\n the ones a prop can write: a computed entry is what threw, and reading it here would\n throw again. Writes are coalesced into one microtask, because a parent sets its props one\n at a time. The same error is reported once, not once per attempt. */\n const inputs = [...declaredDefaults(def).keys()].filter((key) => !isPrivateStateKey(key));\n let lastMessage = failure.message;\n let queued = false;\n const watch = effect(\n () => {\n for (const key of inputs) {\n void state[key];\n }\n },\n {\n scheduler: () => {\n if (queued) {\n return;\n }\n queued = true;\n queueMicrotask(() => {\n queued = false;\n if (!this.isConnected) {\n watch.effect.stop();\n return;\n }\n watch();\n attempt.stop();\n this.replaceChildren();\n pauseTracking();\n try {\n attempt = runScoped(draw);\n } finally {\n resetTracking();\n }\n const again = attempt.result;\n if (!again) {\n watch.effect.stop();\n mounted();\n } else if (again.message !== lastMessage) {\n lastMessage = again.message;\n reportUnrendered(this, tagName, again);\n }\n });\n },\n },\n );\n }\n\n disconnectedCallback() {\n // Called as a method, so a hook that reads `this` sees the scope.\n const state = this._state;\n if (state && isScopeHook(state.onUnmount)) {\n state.onUnmount(state);\n }\n }\n\n adoptedCallback() {\n const state = this._state;\n if (state && isScopeHook(state.onAdopted)) {\n state.onAdopted(state);\n }\n }\n\n attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null) {\n if (!this._state || oldVal === newVal) {\n return;\n }\n // The CURRENT definition's defaults, so a redefinition (embedding.md §7) that changes one\n // Reaches an instance that is already connected.\n absorbAttribute(\n this._state,\n name,\n newVal,\n declaredDefaults(_elementDefs.get(tagName)?.doc ?? initialDef),\n );\n }\n };\n\n customElements.define(tagName, ElementClass);\n}\n\n/**\n * Render a registered custom element with $props (property-first interface).\n *\n * @param {JxElement} def\n * @param {JxScope} state\n * @param {JxRenderOptions} [options]\n * @param {JxPath} [path]\n * @returns {HTMLElement}\n */\nfunction renderCustomElementWithProps(\n def: JxElement,\n state: JxScope,\n options?: JxRenderOptions,\n path?: JxPath,\n) {\n const el = document.createElement(resolveTagName(def.tagName, state));\n\n if (options?.onNodeCreated) {\n options.onNodeCreated(el, path ?? [], def, state);\n }\n\n // Set JS properties from $props (before connection)\n for (const [key, val] of Object.entries(def.$props ?? {})) {\n if (refusePrivateProp(key, \"$props\")) {\n continue;\n }\n /* The same resolution `bindProperty` gives an ordinary element. A `$props: { src }` on a custom\n element is an asset reference authored at the USAGE site, so it belongs to the document that\n wrote it — a media prop the component forwards into its own `<img>` is resolved separately,\n inside the component's render, against the same context. */\n const write = (resolved: JxScopeValue): void => {\n const value = isString(resolved) ? canvasAssetValue(el.tagName, key, resolved) : resolved;\n elementProperties(el)[key] = value;\n /* A declared prop that shares its name with an `HTMLElement` property (`title`, `lang`) gets\n no forwarding accessor (§16.2), so the write above lands on the element and never reaches\n the instance's state. Connection reads it once; a binding that changes AFTER connection\n (a row whose data arrives later) was lost, and the instance went on drawing the value it\n connected with. The binding is the parent's `$props`, addressed to the definition's prop,\n so it writes that prop's state. */\n const instanceState = instanceStateOf(el);\n if (\n instanceState &&\n key in HTMLElement.prototype &&\n Object.hasOwn(toRaw(instanceState), key)\n ) {\n instanceState[key] = value;\n }\n };\n if (isRefValue(val)) {\n const refVal = val;\n write(resolveRef(refVal.$ref, state));\n // Reactive forwarding: re-set the property when the source changes\n effect(() => {\n write(resolveRef(refVal.$ref, state));\n });\n } else if (isTemplateString(val)) {\n bindTemplate(val, () => {\n write(evaluateTemplate(val, state));\n });\n } else {\n write(val);\n }\n }\n\n /* Apply host-level style and attributes from the usage site.\n Also REMEMBERED, because `connectedCallback` applies the definition's style through the same\n interning path and `applyStyleInto` releases the element's existing rules first — so without\n this the call site's declarations were written here and deleted a moment later, and a document\n could not style an element instance at all. See {@link callSiteStyles}. */\n if (def.style) {\n callSiteStyles.set(el, def.style);\n }\n applyStyle(el, def.style ?? {}, scopeMedia(state), state);\n applyAttributes(el, def.attributes ?? {}, state);\n /* And its ordinary properties and handlers — `id`, `hidden`, `className`, an `onselect` — exactly\n as an ordinary element gets them. A custom element used in a document is still an element in\n that document; only `$props` are the definition's to absorb. */\n applyProperties(el, def, state);\n\n // Append slotted children. A mapped array is not a node: its rows are rendered in place, ahead of\n // Their anchor, exactly as they are under an ordinary element — so a `$map` of menu rows inside a\n // `jx-menu` is a list of rows, not one `<div>` standing where the list should be.\n const children = Array.isArray(def.children) ? def.children : [];\n for (let i = 0; i < children.length; i++) {\n const child = children[i]!;\n const childOpts = options && path ? { ...options, _path: [...path, \"children\", i] } : undefined;\n if (isMappedArray(child)) {\n renderMappedArrayInto(el, child, state, childOpts);\n } else {\n el.append(renderNode(child, state, childOpts));\n }\n }\n\n return el;\n}\n\n/**\n * Whether a node is an element, by its `nodeType` (which, unlike `instanceof`, holds across\n * realms).\n *\n * @param {Node} node\n * @returns {node is Element}\n */\nfunction isElementNode(node: Node): node is Element {\n return node.nodeType === Node.ELEMENT_NODE;\n}\n\n/**\n * Whether a node is a text node, by its `nodeType`.\n *\n * @param {Node} node\n * @returns {node is Text}\n */\nfunction isTextNode(node: Node): node is Text {\n return node.nodeType === Node.TEXT_NODE;\n}\n\n/**\n * Whether a node is a comment, by its `nodeType`.\n *\n * @param {Node} node\n * @returns {node is Comment}\n */\nfunction isCommentNode(node: Node): node is Comment {\n return node.nodeType === Node.COMMENT_NODE;\n}\n\n// ─── Slot distribution (spec.md §8.5) ─────────────────────────────────────────\n\n/**\n * Text that is only HTML whitespace (space, tab, line feed, form feed, carriage return): never slot\n * content. A non-breaking space is not in the set, and `+` keeps an empty text node out of it, so\n * the text node a binding is about to write stays with its group.\n */\nexport const SLOT_WHITESPACE = /^[\\t\\n\\f\\r ]+$/u;\n\n/** The word that opens a prerendered slot group's comment bracket: `<!--jx-slot n name-->`. */\nexport const SLOT_MARK = \"jx-slot\";\n\n/** The attribute a prerendered instance carries when its slot groups are bracketed by `n`. */\nexport const SLOT_ATTR = \"data-jx-slots\";\n\n/**\n * The `Symbol.for` key of the shared group record: node → the slot group it belongs to.\n *\n * Shared through `globalThis` because each compiled component module carries its own copy of the\n * distribution helper, and a record one of them (or this runtime) writes has to be read by\n * whichever element captures the node next.\n */\nexport const SLOT_RECORD_KEY = \"jx.slot.group\";\n\n/** The record itself; read before a node's own `slot` attribute, and deleted once read. */\nconst slotRecord: WeakMap<Node, string> = (() => {\n const key = Symbol.for(SLOT_RECORD_KEY);\n /* SAFETY: the one value ever stored under this registered symbol is this WeakMap, written by\n this runtime or by a compiled module's inlined helper (`slotHelperSource` in the compiler). */\n const holder = globalThis as typeof globalThis & Record<symbol, WeakMap<Node, string>>;\n holder[key] ??= new WeakMap<Node, string>();\n return holder[key];\n})();\n\n/**\n * The children an element distributes into its slots, taken before its template renders.\n *\n * A prerendered instance is the exception, and the reason this is a function. Its children are the\n * prerendered markup, and re-rendering would capture the component's own template as slot content.\n * The prerender therefore stamps it `data-jx-slots=\"n\"` and brackets every group it placed with\n * `<!--jx-slot n name-->` … `<!--/jx-slot n-->`; this returns exactly the nodes inside this host's\n * brackets, recording each one's group name, and removes the attribute. The id is needed because a\n * forwarded group sits inside a nested instance's own brackets, and the name because a nested\n * instance that upgrades first must not regroup the enclosing instance's nodes.\n *\n * @param {Element} host\n * @returns {ChildNode[]}\n */\nexport function captureSlotted(host: Element): ChildNode[] {\n const id = host.getAttribute(SLOT_ATTR);\n if (id === null) {\n return [...host.childNodes];\n }\n host.removeAttribute(SLOT_ATTR);\n const opener = `${SLOT_MARK} ${id} `;\n const closer = `/${SLOT_MARK} ${id}`;\n const openers: Comment[] = [];\n const walker = host.ownerDocument.createTreeWalker(host, NodeFilter.SHOW_COMMENT);\n for (let n = walker.nextNode(); n; n = walker.nextNode()) {\n if (isCommentNode(n) && n.data.startsWith(opener)) {\n openers.push(n);\n }\n }\n const captured: ChildNode[] = [];\n for (const open of openers) {\n const name = decodeURIComponent(open.data.slice(opener.length));\n for (let n = open.nextSibling; n; n = n.nextSibling) {\n if (isCommentNode(n) && n.data === closer) {\n break;\n }\n slotRecord.set(n, name);\n captured.push(n);\n }\n }\n return captured;\n}\n\n/**\n * Whether a group holds content: an element, or a text node that is not empty. A comment (a lit\n * part marker, a repeater's anchor) travels with its group but does not stop the fallback showing.\n *\n * @param {readonly ChildNode[]} group\n * @returns {boolean}\n */\nfunction slotGroupHasContent(group: readonly ChildNode[]): boolean {\n return group.some((n) => isElementNode(n) || (isTextNode(n) && n.data !== \"\"));\n}\n\n/**\n * Light-DOM slot distribution: replace each `<slot>` under `host` with the captured children of its\n * group, or with its own fallback children when that group has no content (spec.md §8.5).\n *\n * - **Group.** A node's group is its record when it has one, else an element's `slot` attribute, else\n * the unnamed group (`\"\"`). Whitespace-only text is discarded: compiled hosts are parsed HTML\n * full of formatting whitespace, and whitespace placed in a part makes its `:empty` false.\n * - **Place.** Slots are taken in tree order and the FIRST of a name takes its group; a later one of\n * the same name shows its fallback. That is the DOM's \"find a slot\", so the answer does not\n * change when a component moves to a shadow root. A slot inside a fallback that was not shown\n * still takes its name, which keeps the static prerender's answer the same as this one.\n * - **Forward.** A slot written directly inside ANOTHER custom element's children is that element's\n * child. What it places there is recorded with the slot's own group (its record, else its `slot`\n * attribute), so the nested element distributes it by that name whether it captures before or\n * after this runs.\n *\n * No early return when nothing was slotted: a slot leaves no node either way, and a surviving slot\n * made `[part=\"label\"]:empty` false for a control with no label. A slot is replaced, not filled:\n * the selector tree is what a definition's `& > x` rules match, and a slot left as a wrapper turned\n * every slotted child into a grandchild (§16.6).\n *\n * @param {ParentNode} host\n * @param {readonly ChildNode[]} captured\n */\nexport function distributeSlots(host: ParentNode, captured: readonly ChildNode[]): void {\n const slots = [...host.querySelectorAll(\"slot\")];\n if (slots.length === 0) {\n return;\n }\n const groups = new Map<string, ChildNode[]>();\n for (const n of captured) {\n if (isTextNode(n) && SLOT_WHITESPACE.test(n.data)) {\n continue;\n }\n const recorded = slotRecord.get(n);\n slotRecord.delete(n);\n const name = recorded ?? (isElementNode(n) ? (n.getAttribute(\"slot\") ?? \"\") : \"\");\n let group = groups.get(name);\n if (!group) {\n group = [];\n groups.set(name, group);\n }\n group.push(n);\n }\n const taken = new Set<string>();\n for (const slot of slots) {\n const name = slot.getAttribute(\"name\") ?? \"\";\n let group: ChildNode[] = [];\n if (!taken.has(name)) {\n taken.add(name);\n group = groups.get(name) ?? [];\n }\n const placed = slotGroupHasContent(group) ? group : [...group, ...slot.childNodes];\n const parent = slot.parentElement;\n if (parent && parent !== host && parent.localName.includes(\"-\")) {\n const forwarded = slotRecord.get(slot) ?? slot.getAttribute(\"slot\") ?? \"\";\n for (const n of placed) {\n slotRecord.set(n, forwarded);\n }\n }\n slot.replaceWith(...placed);\n }\n}\n"
15
+ "/// <reference lib=\"dom\" />\n/**\n * Jx — JSON-native reactive web component runtime\n *\n * Four-step pipeline:\n *\n * 1. `resolve` — fetch JSON source (or accept raw object)\n * 2. `buildScope` — state detection + reactive proxy construction\n * 3. `render` — walk resolved tree, build DOM, wire reactive effects\n * 4. `output` — append to target\n *\n * @module jx\n * @license MIT\n * @version 3.0.0\n */\n\nimport {\n computed,\n effect,\n effectScope,\n isReactive,\n isRef,\n onEffectCleanup,\n onScopeDispose,\n pauseTracking,\n reactive,\n ref,\n resetTracking,\n shallowReactive,\n toRaw,\n} from \"@vue/reactivity\";\nimport {\n buildStyleRules,\n cssPropertyName,\n hashCss,\n isNestedSelectorKey,\n transposeCanvasOverlaySelector,\n} from \"./css.ts\";\nimport { evaluateExpression, evaluateOperand, isMutating } from \"./expression.ts\";\nimport { readPath } from \"./pointer.ts\";\nimport type {\n JxContext,\n JxEventHandler,\n JxHostScope,\n JxMount,\n JxMountOptions,\n JxPath,\n JxRenderOptions,\n JxRowContext,\n JxScope,\n JxScopeFunction,\n JxScopeValue,\n} from \"./types.ts\";\nimport {\n bodyReturnsValue,\n hasStructuredBody,\n isBoolean,\n isExpressionDef,\n isFunction,\n isFunctionDef,\n isJsonObject,\n isMappedArray,\n isNamedFormulaDef,\n isNestedStyle,\n isNonNullObject,\n isNumber,\n isPrivateStateKey,\n isPrototypeDef,\n isRef as isRefValue,\n isServerFnDef,\n isString,\n isTagExpression,\n isTemplateString,\n paramNames,\n} from \"@jxsuite/schema/guards\";\nimport type { TagNameSlot } from \"@jxsuite/schema/guards\";\nimport { formatSrcset, parseSrcset } from \"@jxsuite/schema/asset-paths\";\nimport { runStatements } from \"./statements.ts\";\nimport { readCookie, serializeCookie } from \"./cookie.ts\";\nimport type {\n CemParameter,\n JsonValue,\n JxAttributeValue,\n JxClassCtorDef,\n JxClassDef,\n JxDocument,\n JxDocumentValue,\n JxElement,\n JxFunctionDef,\n JxHeadEntry,\n JxMappedArray,\n JxPrototypeDef,\n JxRef,\n JxServerFnDef,\n JxStyle,\n} from \"@jxsuite/schema/types\";\nimport type { EffectScope, Ref } from \"@vue/reactivity\";\n\n// ─── Public API ───────────────────────────────────────────────────────────────\n\n/**\n * Mount a Jx document into a DOM container.\n *\n * @example\n * import { Jx } from \"@jxsuite/runtime\";\n * const state = await Jx(\"./counter.json\", document.getElementById(\"app\"));\n *\n * @param {string | JxDocument} source - Path to .json file, URL, or raw document object\n * @param {HTMLElement} [target] Default is `document.body`\n * @param {JxRenderOptions} [options]\n * @returns {Promise<JxScope>} Resolves with the live component scope (state reactive\n * proxy)\n */\n/** The document-schema version this runtime understands (the `/schema/vN` in a hosted `$schema`). */\nexport const SUPPORTED_SCHEMA_VERSION = 1;\nlet _schemaVersionWarned = false;\n\n/**\n * Warn once when a document declares a hosted `$schema` whose version differs from the one this\n * runtime supports. A relative or non-hosted `$schema` (local dev schema paths) is ignored. This is\n * a diagnostic only — there is no document-format migration story yet (see spec §3.2 / §21.4).\n */\nfunction checkSchemaVersion($schema: JxDocumentValue | undefined): void {\n if (_schemaVersionWarned || !isString($schema)) {\n return;\n }\n const match = $schema.match(/\\/schema\\/v(\\d+)\\b/);\n if (match && Number(match[1]) !== SUPPORTED_SCHEMA_VERSION) {\n _schemaVersionWarned = true;\n console.warn(\n `Jx: document $schema is version v${match[1]} but this runtime supports ` +\n `v${SUPPORTED_SCHEMA_VERSION}. Behavior may be undefined; there is no format migrator yet.`,\n );\n }\n}\n\nexport async function Jx(\n source: string | JxDocument,\n target: HTMLElement = document.body,\n options?: JxRenderOptions,\n) {\n const base = options?.base\n ? new URL(options.base, location.href).href\n : isString(source)\n ? new URL(source, location.href).href\n : location.href;\n const doc = await resolve(source);\n\n /* The module-level fallback is still written here, on purpose: a component defined LATER with\n `@--name` blocks and no own `$media` reads it (setRootMedia). `mount()` never writes it — a\n mount's `$media` travels in its context, which is the whole point of having one. */\n if (doc.$media) {\n _rootMedia = doc.$media;\n }\n\n const mountOptions: JxMountOptions = { base };\n if (options?.onNodeCreated) {\n mountOptions.onNodeCreated = options.onNodeCreated;\n }\n if (options?.signal) {\n mountOptions.signal = options.signal;\n }\n const mounted = await mount(doc, target, mountOptions);\n return mounted.scope;\n}\n\n/**\n * A lifecycle hook a document's state supplies (`onMount`, `onUnmount`, `onAdopted`) as the runtime\n * calls it: with the scope, plus the host element for a defined element's `onMount`, which also\n * receives the host as `this`.\n */\ntype ScopeHook = (\n this: HTMLElement | JxScope | undefined,\n scope: JxScope,\n host?: HTMLElement,\n) => void;\n\n/**\n * Whether a scope member can be called as a {@link ScopeHook}. Being a function is the whole\n * contract: JavaScript checks neither the arguments a call passes nor what it returns, so every\n * function accepts this call, and the runtime discards whatever it returns.\n */\nfunction isScopeHook(value: unknown): value is ScopeHook {\n return isFunction(value);\n}\n\n/** Host-scope keys the runtime owns: `$media`, `$map`, the `$`-locals and `#`-private entries. */\nconst HOST_SCOPE_RESERVED = /^[$#]/;\n\n/**\n * A host's scope as the runtime merges it: the host's own record, typed as the {@link JxScope} it\n * joins.\n *\n * @param {S} scope - The host's scope, held to `JxScopeValue` member by member by its type\n * @returns {JxScope}\n */\nfunction hostScopeOf<S extends JxHostScope<S>>(scope: S): JxScope {\n /* SAFETY: `JxHostScope<S>` has already held every member of `S` to `JxScopeValue`, recursively\n through arrays, records and function results. What TypeScript cannot conclude from that is an\n index signature, which an interface never has implicitly, so a host's own interface is not\n assignable to `JxScope` however its members are typed. Nothing is copied or converted: this is\n the host's record, read by member name like every other scope. */\n return scope as JxScope;\n}\n\nfunction assertHostScope(scope: JxScope): void {\n for (const key of Object.keys(scope)) {\n if (HOST_SCOPE_RESERVED.test(key)) {\n throw new TypeError(\n `Jx mount: host scope key \"${key}\" is reserved — names beginning with \"$\" or \"#\" are ` +\n `runtime vocabulary`,\n );\n }\n }\n}\n\n/**\n * Mount a document into a host-owned node and hand back the live scope with a disposer.\n *\n * This is the embedding contract (specs/embedding.md): the host supplies its own reactive records\n * and functions as `options.scope`, a per-mount base, `$media` and document resolver, and gets a\n * root it can remove and a `dispose()` that stops every effect the render created. Nothing here\n * writes a module global, so a shell can hold many roots with different needs at once.\n *\n * @param {JxDocument} doc - The document to render (already an object; use {@link resolve} for a\n * URL)\n * @param {ParentNode} target - Where the rendered root is appended\n * @param {JxMountOptions} [options]\n * @returns {Promise<JxMount>}\n * @docs extending/embedding/runtime-host\n */\nexport async function mount<S extends JxHostScope<S> = JxScope>(\n doc: JxDocument,\n target: ParentNode,\n options: JxMountOptions<S> = {},\n): Promise<JxMount> {\n const hostScope: JxScope = options.scope ? hostScopeOf(options.scope) : {};\n assertHostScope(hostScope);\n const base = options.base ? new URL(options.base, location.href).href : location.href;\n const ctx: JxContext = {\n base,\n media: options.media ?? doc.$media ?? null,\n root: null,\n };\n if (options.resolver) {\n ctx.resolver = options.resolver;\n }\n if (options.skipServerFunctions !== undefined) {\n ctx.skipServerFunctions = options.skipServerFunctions;\n }\n if (options.skipAutoRequests !== undefined) {\n ctx.skipAutoRequests = options.skipAutoRequests;\n }\n checkSchemaVersion(doc.$schema);\n\n // Register custom elements declared in $elements (depth-first)\n if (doc.$elements) {\n await registerElements(doc.$elements, base, ctx);\n }\n\n // Inject <head> elements declared in $head (link, meta, script, etc.)\n if (doc.$head) {\n injectHead(doc.$head, base);\n }\n\n const scope = await buildScope(doc, hostScope, base, ctx);\n\n const elements = new Set<string>();\n const renderOptions: JxRenderOptions = {\n _ctx: ctx,\n onNodeCreated: (el, path, def, state) => {\n if (el instanceof Element && el.tagName.includes(\"-\")) {\n elements.add(el.tagName.toLowerCase());\n }\n options.onNodeCreated?.(el, path, def, state);\n },\n };\n if (options.onNodeMoved) {\n renderOptions.onNodeMoved = options.onNodeMoved;\n }\n const { result: root, stop } = runScoped(() => renderNode(doc, scope, renderOptions));\n ctx.root = root;\n\n let mounted = false;\n let disposed = false;\n const dispose = (): void => {\n if (disposed) {\n return;\n }\n disposed = true;\n options.signal?.removeEventListener(\"abort\", dispose);\n /* The root leaves the document BEFORE its effects stop (embedding.md §2.2). Stopping releases\n each element's styles, and on a connected subtree every one of those inline-property and\n `data-jx` writes schedules a style invalidation for a node that is leaving anyway: a\n Publish tab switch spent 22 ms there, and a dialog's close forced a recalculation of the\n subtree it was removing. It is also the order a custom element's own `onUnmount` sees,\n which runs from `disconnectedCallback` (spec.md §16.4). */\n root.remove();\n stop();\n // Called as a method, so a hook that reads `this` sees the scope, as it always has.\n if (mounted && isScopeHook(scope.onUnmount)) {\n scope.onUnmount(scope);\n }\n };\n\n if (options.signal?.aborted) {\n // Aborted before it could be attached: tear the effects down and attach nothing.\n dispose();\n } else {\n options.signal?.addEventListener(\"abort\", dispose, { once: true });\n target.append(root);\n mounted = true;\n if (isScopeHook(scope.onMount)) {\n scope.onMount(scope);\n }\n }\n return { scope, root, elements, dispose };\n}\n\n// ─── Step 1: Resolve ──────────────────────────────────────────────────────────\n\nconst _resolveCache = new Map<string, Promise<JxDocument>>();\n\n/**\n * Seed the resolve cache with a document a host already holds, under the URL its references use.\n *\n * A bundled document — one imported as JSON rather than fetched — still names its dependencies by\n * URL: an `$elements` entry, a `$switch` case. Preloading those under the same URLs lets every such\n * reference resolve with no network, and lets `defineElement(\"<url>\")` dedupe on the source it\n * would otherwise have fetched. The key is stored as given and, when it parses as a URL, in its\n * absolute form too, because the two lookup paths spell it differently.\n *\n * @param {string} url - The URL the document is known by\n * @param {JxDocument} doc\n */\nexport function preloadDocument(url: string, doc: JxDocument): void {\n const settled = Promise.resolve(doc);\n _resolveCache.set(url, settled);\n try {\n _resolveCache.set(new URL(url, location.href).href, settled);\n } catch {\n // Not a URL at all — the raw key still serves the lookup that uses it.\n }\n}\n\n/**\n * A response's Content-Type, or `\"\"` when it carries no headers at all. A response we have no\n * EVIDENCE about is one we proceed with rather than guess. Every real `Response` has headers; a\n * host's or a test's `fetch` stand-in may not, which is what the parameter type admits.\n *\n * @param res The response, or a stand-in for one\n * @returns {string}\n */\nfunction responseContentType(res: Partial<Pick<Response, \"headers\">>): string {\n return res.headers?.get(\"Content-Type\") ?? \"\";\n}\n\nexport async function resolve(source: string | JxDocument, ctx?: JxContext): Promise<JxDocument> {\n if (!isString(source)) {\n return source;\n }\n // A mount's resolver answers for THIS mount and its hit never enters the shared cache.\n const served = ctx?.resolver?.(source);\n if (served) {\n return served;\n }\n if (_resolveCache.has(source)) {\n return _resolveCache.get(source)!;\n }\n const p = fetch(source).then(async (res) => {\n if (!res.ok) {\n throw new Error(`Jx: failed to fetch ${source} (${res.status})`);\n }\n /*\n * `res.ok` is not enough on a single-page host. A static host configured with an SPA fallback\n * answers a path it does not have with the APPLICATION SHELL at HTTP 200, so a missing document\n * arrives looking like a successful fetch and dies inside `res.json()` as\n * `Unexpected token '<', \"<!doctype \"... is not valid JSON` — a parser error for what is\n * actually a 404. Jx Cloud did this to every component `$ref` in the canvas.\n *\n * Checked on the content type rather than by sniffing the body: a host that says `text/html`\n * has told us plainly, and saying so costs nothing.\n */\n const contentType = responseContentType(res);\n if (contentType.includes(\"text/html\")) {\n throw new Error(\n `Jx: ${source} returned HTML, not a document — the host answered a missing file with its ` +\n `app shell (a single-page fallback), so this path is not served.`,\n );\n }\n /* A site origin answers `.jxn` as JSON, so only an editing server or a bare file host gets here\n with KDL, and the parser is the host's to supply: a lazy import here would be inlined by any\n host that bundles the runtime into one file, and ship the parser to every reader. */\n if (JXN_URL.test(source) && !contentType.includes(\"json\")) {\n if (!_documentParser) {\n throw new Error(\n `Jx: ${source} is a .jxn file and this page has no parser for it. Serve it from a Jx ` +\n `site, which answers JSON, or call setDocumentParser(parseJxn) with parseJxn from ` +\n `@jxsuite/schema/jxn.`,\n );\n }\n return _documentParser(await res.text(), source);\n }\n /* SAFETY: trust boundary. `resolve` fetches only URLs that name a Jx document (a `Jx()` source,\n an `$elements` entry, a `$switch` case), and the host answered 2xx with a non-HTML body, so\n the JSON is that document; the runtime does not schema-validate documents by design. */\n return (await res.json()) as JxDocument;\n });\n _resolveCache.set(source, p);\n return p;\n}\n\n// ─── Step 2: Build scope ──────────────────────────────────────────────────────\n\n/** The path part of a URL naming a `.jxn` file. */\nconst JXN_URL = /\\.jxn(?:[?#]|$)/iu;\n\n/** What reads a `.jxn` file's text. Absent, the runtime refuses one rather than guessing. */\nlet _documentParser: ((text: string, source: string) => JxDocument | Promise<JxDocument>) | null =\n null;\n\n/**\n * Supply what reads a `.jxn` file, for a host that serves one as its text.\n *\n * A compiled site never needs this, and a `$ref` from a Jx site origin does not: both get JSON.\n * Studio's canvas does, because an editing server answers a file as it is.\n *\n * @param parser `parseJxn` from `@jxsuite/schema/jxn`, or a function that loads it first, or null\n * to take it away again.\n */\nexport function setDocumentParser(\n parser: ((text: string, source: string) => JxDocument | Promise<JxDocument>) | null,\n): void {\n _documentParser = parser;\n}\n\n/** JSON Schema keywords used to identify pure type definitions (Shape 2b). */\nconst SCHEMA_KEYWORDS = new Set([\n \"type\",\n \"properties\",\n \"items\",\n \"enum\",\n \"minimum\",\n \"maximum\",\n \"minLength\",\n \"maxLength\",\n \"pattern\",\n \"required\",\n \"examples\",\n]);\n\n/** /** @type {{ skip: boolean }} */\nconst _serverFnConfig = { skip: false };\n/** Set to true to suppress timing: \"server\" resolution (used by Studio edit mode). */\nexport function setSkipServerFunctions(v: boolean) {\n _serverFnConfig.skip = v;\n}\n\n/** @type {{ skip: boolean }} */\nconst _autoRequestConfig = { skip: false };\n/**\n * Set to true to suppress AUTOMATIC `$prototype: \"Request\"` fetches — the sibling of\n * {@link setSkipServerFunctions}, and used by Studio for the same reason.\n *\n * `buildScope` re-resolves every `state` entry on each full canvas render, so an auto-request\n * re-issued its HTTP call every time the canvas rebuilt. In edit/design mode that meant authoring\n * actions — a signal edit, or pressing Enter inside component-wrapped content, both of which force\n * a full render — fired network requests. Live data belongs to preview and to the deployed site.\n *\n * Only non-`manual` requests are gated: a `manual` one fires from an event handler, and edit mode\n * strips handlers before rendering. The returned ref is unchanged either way — it simply stays at\n * its initial `null`, which is the same state bindings observe before any fetch resolves.\n */\nexport function setSkipAutoRequests(v: boolean) {\n _autoRequestConfig.skip = v;\n}\n\n// ─── Dev-proxy auth token (Studio cross-origin canvas) ────────────────────────\n// The Studio canvas iframe is served from a token-gated loopback origin (createProjectServer): its\n// POST /__jx_resolve__ + /__jx_server__ routes 403 without ?token=<rpcToken>. The iframe boot reads\n// The token from its URL and calls setResolveToken so these dev-proxy fetches authenticate. Unset by\n// Default, leaving production + same-origin dev untouched (bare path, no query appended).\nlet _resolveToken: string | null = null;\nexport function setResolveToken(token: string | null) {\n _resolveToken = token || null;\n}\n/** Append the dev-proxy auth token to a privileged resolve path when one is configured. */\nfunction resolveProxyPath(path: string): string {\n return _resolveToken ? `${path}?token=${encodeURIComponent(_resolveToken)}` : path;\n}\n\n/**\n * Observe runtime-created reactive values: runs `fn` immediately inside a reactive effect and\n * re-runs it whenever a tracked value changes; returns a disposer. Dep tracking in @vue/reactivity\n * is per module INSTANCE, so an effect created from another copy of the package (e.g. the studio's\n * own pin) can never track a ref/reactive created here — consumers that want to observe\n * runtime-resolved scope values (the Studio canvas iframe's dataScope re-post) must use this.\n *\n * @param {() => void} fn - Read the reactive values to observe inside this callback.\n * @returns {() => void} Disposer — stops the effect and its scope.\n */\nexport function observeScope(fn: () => void): () => void {\n const scope = effectScope(true);\n scope.run(() => {\n effect(fn);\n });\n return () => scope.stop();\n}\n\n/** What {@link runScoped} hands back: the callback's result, and the disposer for its effects. */\nexport interface ScopedRun<T> {\n result: T;\n stop: () => void;\n}\n\n/**\n * Run `fn` inside a detached reactive scope of THIS module's reactivity instance, returning its\n * result plus a disposer that stops every effect `fn` created. Callers that render via\n * {@link renderNode} and later tear the render down (the Studio canvas full render and its surgical\n * subtree re-renders) MUST use this instead of their own effectScope: scope collection is per\n * vue-reactivity module instance, so a scope from another copy of the package collects NOTHING and\n * its stop() silently leaks every binding effect of the superseded render.\n *\n * @param {() => T} fn - Work that may create reactive effects (typically a renderNode call).\n * @returns {ScopedRun<T>} The callback result and the scope disposer.\n */\nexport function runScoped<T>(fn: () => T): ScopedRun<T> {\n const scope = effectScope(true);\n try {\n /* SAFETY: `run` answers undefined only for a scope that was already stopped, and this one was\n created on the line above, so it is active and `run` returns what `fn` returned. */\n const result = scope.run(fn) as T;\n return { result, stop: () => scope.stop() };\n } catch (error) {\n // A throwing fn would otherwise leak the effects it created before failing.\n scope.stop();\n throw error;\n }\n}\n\n/**\n * Studio-canvas viewport-unit transpose. The canvas iframe is sized to its document's height, so\n * any viewport unit (`vh`/`vw`/`vmin`/`vmax`/`svh`/…) — which resolves against the iframe ELEMENT —\n * would feed back into an ever-growing height. When this is on, the runtime transposes them to\n * CONTAINER units (`cqh`/`cqw`/…) that resolve against the canvas's fixed-size query container (see\n * `canvas.html`): a predictable, feedback-free stand-in for the viewport. Off (the default) leaves\n * CSS untouched for real production rendering.\n */\nlet _canvasViewportTranspose = false;\nexport function setCanvasViewportTranspose(on: boolean) {\n _canvasViewportTranspose = on;\n}\n\nconst VIEWPORT_UNIT_RE = /(-?\\d*\\.?\\d+)(?:s|l|d)?v(h|w|min|max|i|b)\\b/gi;\nconst VIEWPORT_UNIT_MAP = new Map([\n [\"b\", \"cqb\"],\n [\"h\", \"cqh\"],\n [\"i\", \"cqi\"],\n [\"max\", \"cqmax\"],\n [\"min\", \"cqmin\"],\n [\"w\", \"cqw\"],\n]);\n\n/**\n * Transpose CSS viewport units → container-query units in a value string, but only when the\n * studio-canvas flag is set (otherwise the value is returned untouched). `100vh` → `100cqh`,\n * `50svw` → `50cqw`, `10vmin` → `10cqmin`, etc.\n */\nexport function transposeCanvasUnits(value: string): string {\n if (!_canvasViewportTranspose || !value.includes(\"v\")) {\n return value;\n }\n return value.replaceAll(\n VIEWPORT_UNIT_RE,\n (_m, num: string, dim: string) =>\n `${num}${VIEWPORT_UNIT_MAP.get(dim.toLowerCase()) ?? `cq${dim}`}`,\n );\n}\n\n/**\n * Studio-canvas anchor de-linking. In the editor canvas a rendered `<a href>` would navigate the\n * iframe when clicked, fighting element selection. When this is on, the runtime stamps the value on\n * `data-jx-href` instead of `href` so the anchor is inert (selectable, not a live link) while the\n * original target stays recoverable for richer link handling later. Off (the default) leaves\n * production rendering untouched; the studio sets it for design/edit (not preview — see\n * iframe-render).\n */\nlet _canvasDelinkAnchors = false;\nexport function setCanvasDelinkAnchors(on: boolean) {\n _canvasDelinkAnchors = on;\n}\n\n/**\n * Studio-canvas popover de-linking — `setCanvasDelinkAnchors`'s rule applied to `popover`.\n *\n * An OPEN popover is in the top layer, and CSS Position 4 §3.1 gives a top-layer element the\n * VIEWPORT as its containing block whatever its ancestors say. In the editor canvas that viewport\n * is a fiction: the frame is sized to its own content height, so a drawer pinned with `inset: 0`\n * lands halfway down a 6000px page, and a panel taller than a short component frame is clipped by\n * the `overflow: hidden` the canvas document needs. Worse, a top-layer box contributes nothing to\n * any ancestor's scrollable overflow, so the artboard can never grow to fit one.\n *\n * When this is on, the runtime stamps `popover` on `data-jx-popover` for nodes the studio can\n * ADDRESS — those carrying a stamped `data-jx-path`. That drops every `[popover]` UA rule at once,\n * and the one that matters most is `position: fixed`: with it gone the panel lays out in NORMAL\n * FLOW at its document position, which is what makes it contribute to `#jx-canvas-root`'s\n * scrollHeight so the host can grow the artboard to fit it. Leaving the top layer is necessary but\n * not sufficient — a fixed box contributes nothing to an ancestor's overflow either.\n *\n * It is worth saying what does NOT rescue this, because it is the intuitive answer and it is wrong:\n * `container-type: size` on the canvas's query container does NOT make it a containing block for\n * fixed descendants. Measured in Chrome 151 — `getComputedStyle(container).contain` is `none`, and\n * a `position: fixed` child inside it measures the WINDOW, not the container. So a panel that stays\n * fixed stays laid out against the frame's own viewport, which in an editable mode is the\n * document's full height. `iframe-render.ts` therefore FORCES `position` on the open panel rather\n * than relying on any containment.\n *\n * The studio re-supplies the one UA rule that matters — `display: none` while closed — inside a\n * cascade LAYER, so author declarations still beat it exactly as they beat the real UA rule on the\n * shipped page. That is deliberate: a popover whose base rule sets `display` is broken in\n * production, and the canvas has to show that rather than paper over it.\n *\n * The gate on `data-jx-path` is what keeps this out of documents the studio does not own: a popover\n * rendered inside a component's own template is never stamped, so it keeps its native behaviour.\n *\n * It also drives {@link transposeCanvasPopoverSelector}. The two are one transform — an attribute\n * renamed without its selectors transposed is a popover that can never be styled open.\n *\n * @docs framework/concepts/overlays\n */\nlet _canvasDelinkPopovers = false;\nexport function setCanvasDelinkPopovers(on: boolean) {\n _canvasDelinkPopovers = on;\n}\n\n/**\n * Studio-canvas de-linking of invoker commands, `inert` and a dialog's `open` — the dialog half of\n * {@link setCanvasDelinkPopovers}.\n *\n * A `<button command=\"show-modal\" commandfor=\"…\">` is the platform's own invoker: clicking it calls\n * `showModal()` on its target, which puts the dialog in the top layer and makes the rest of the\n * page INERT — the two things an editable canvas can least afford, since the first is the geometry\n * the popover comment above describes and the second makes every other element unclickable. So on a\n * stamped node `commandfor` is renamed to `data-jx-commandfor`: a button with `command` and no\n * target does nothing, and the studio's frame reports the click instead, so the host's single\n * writer of open state can answer it. `popovertarget` is left alone on purpose — its target has no\n * `popover` attribute on the canvas, so the platform already does nothing with it.\n *\n * `inert` becomes `data-jx-inert` for the same reason: an author's inert region is a region the\n * editor could not select into. And a `<dialog open>` becomes `<dialog data-jx-open>`, so the UA's\n * `dialog:not([open]) { display: none }` keeps every dialog closed until the canvas opens ONE with\n * `data-jx-dialog-open`, exactly as it opens one popover. `<details open>` is untouched: its `open`\n * is content, not an overlay state.\n *\n * Gated on `data-jx-path` like the popover rewrite, and driving\n * {@link transposeCanvasOverlaySelector} with it: an attribute renamed without its selectors\n * transposed is a dialog that can never be styled open, or a region that can never be styled inert.\n * Both renames travel with their selectors there — `[open]` on a dialog's own rules, `[inert]`\n * wherever it appears.\n *\n * @docs framework/concepts/overlays\n */\nlet _canvasDelinkCommands = false;\nexport function setCanvasDelinkCommands(on: boolean) {\n _canvasDelinkCommands = on;\n}\n\n/**\n * Raised while a defined element renders its own children, so the canvas de-link reaches them.\n *\n * The de-link rules gate on `data-jx-path`, which a document node carries and an element's INTERNAL\n * node never can: the internals belong to the definition, not to the page being edited, so the\n * studio's stamper never sees them. Without this a kit element that declares `popover` on a panel\n * inside itself opens a genuine top-layer popover inside an editable canvas, while Studio's single\n * writer of open state learns nothing about it.\n *\n * A module-scoped flag is sound here because `canvasAttrName` is called once per attribute OUTSIDE\n * the effect that binds it, and a definition renders its children synchronously — so the flag is\n * never read across a suspension point.\n */\nlet _canvasInsideStampedHost = false;\n\n/** Whether the node being rendered is inside a stamped host, and so part of the edited page. */\nfunction canvasStamped(el: HTMLElement): boolean {\n return _canvasInsideStampedHost || el.dataset.jxPath !== undefined;\n}\n\n/** The attribute name to stamp `key` on `el` under — `href` → `data-jx-href` on de-linked anchors. */\nfunction canvasAttrName(el: HTMLElement, key: string): string {\n if (_canvasDelinkAnchors && key === \"href\" && (el.tagName === \"A\" || el.tagName === \"AREA\")) {\n return \"data-jx-href\";\n }\n /* `dataset.jxPath` is already stamped here: `onNodeCreated` fires before `applyAttributes` in\n `renderNode`, and the studio's stamper writes the attribute synchronously inside it. That\n ordering is an unwritten contract between two packages, so `runtime-canvas.test.ts` asserts it\n directly rather than trusting it. */\n if (_canvasDelinkPopovers && key === \"popover\" && canvasStamped(el)) {\n return \"data-jx-popover\";\n }\n if (_canvasDelinkCommands && canvasStamped(el)) {\n if (key === \"commandfor\") {\n return \"data-jx-commandfor\";\n }\n if (key === \"inert\") {\n return \"data-jx-inert\";\n }\n if (key === \"open\" && el.tagName === \"DIALOG\") {\n return \"data-jx-open\";\n }\n }\n return key;\n}\n\n/**\n * Rewrite one asset reference for a host that does not serve the site's own URL space.\n *\n * The runtime writes a reference VERBATIM — `el.src = \"/hero.jpg\"` — so the browser resolves it\n * against the document, and the document is whatever page the renderer happens to be running in. On\n * a real site and on an editing server that serves the project tree, that is correct and this hook\n * stays null. On a multi-tenant editor origin it is not: `/hero.jpg` resolves against the editor,\n * misses, and — behind a single-page-app fallback — comes back as HTML at HTTP 200, so the image\n * renders broken and nothing is logged.\n *\n * A function rather than data because it cannot be one: the values it must fix are produced INSIDE\n * reactive effects (`{\"$ref\": \"#/state/hero\"}` is not a string until the effect runs), so no\n * document walk can see them. The Studio canvas iframe sets this at render time.\n *\n * Returning null leaves the value exactly as written, and a null resolver makes every call site\n * below the identity — so production rendering is byte-identical.\n *\n * @param {CanvasAssetResolver | null} fn - The resolver, or null to restore verbatim rendering\n */\nexport type CanvasAssetResolver = (value: string, key: string) => string | null;\n\nlet _canvasAssetResolver: CanvasAssetResolver | null = null;\nexport function setCanvasAssetResolver(fn: CanvasAssetResolver | null) {\n _canvasAssetResolver = fn;\n}\n\n/** Attribute/property names whose value is an asset reference, on any element. */\nconst ASSET_KEYS = new Set([\"src\", \"poster\", \"data\"]);\n\n/** Names whose value is a `srcset`-shaped candidate list rather than one reference. */\nconst SRCSET_KEYS = new Set([\"srcset\", \"imagesrcset\"]);\n\n/**\n * Elements on which `href` names an ASSET rather than a destination.\n *\n * `<a href>` and `<area href>` are places to go, not files to load; rewriting one would send a\n * click at the file that backs the page instead of at the page. `<link href>` is the opposite — a\n * stylesheet, an icon, a preload — and is the reason `$head` needs this at all.\n */\nconst HREF_ASSET_TAGS = new Set([\"LINK\"]);\n\n/** True when writing `key` on a `<tagName>` writes an asset reference. */\nfunction isAssetKey(tagName: string, key: string): boolean {\n return ASSET_KEYS.has(key) || (key === \"href\" && HREF_ASSET_TAGS.has(tagName));\n}\n\n/**\n * The value to actually write for `key` on a `<tagName>` — resolved when it is an asset reference,\n * and the input itself in every other case, including whenever no resolver is installed.\n *\n * `srcset` is split into its candidates and resolved one at a time, because it is N references in\n * one attribute and a resolver handed the whole string would have to re-implement HTML's parser to\n * find them.\n */\nfunction canvasAssetValue(tagName: string, key: string, value: string): string {\n if (!_canvasAssetResolver || value === \"\") {\n return value;\n }\n const name = key.toLowerCase();\n if (SRCSET_KEYS.has(name)) {\n const candidates = parseSrcset(value);\n const next = candidates.map((candidate) => {\n const resolved = _canvasAssetResolver?.(candidate.url, name) ?? null;\n if (resolved === null || resolved === candidate.url) {\n return candidate;\n }\n return { descriptor: candidate.descriptor, url: resolved };\n });\n // A rewritten candidate is a new object, so identity says whether anything changed.\n const changed = next.some((candidate, index) => candidate !== candidates[index]);\n return changed ? formatSrcset(next) : value;\n }\n if (!isAssetKey(tagName, name)) {\n return value;\n }\n return _canvasAssetResolver(value, name) ?? value;\n}\n\n/** Every `url(...)` inside a CSS value, unquoted or quoted with either quote. */\nconst CSS_URL_RE = /\\burl\\(\\s*(?<q>[\"']?)(?<u>[^\"')]*)\\k<q>\\s*\\)/g;\n\n/**\n * Resolve every `url()` inside a CSS value.\n *\n * Applied to CSS rather than to a list of properties because in CSS a `url()` is ALWAYS a resource\n * reference — `background-image`, `mask`, `cursor`, `@font-face src`, `list-style-image` and every\n * shorthand that contains them — so enumerating the properties would be a list that goes stale\n * while the syntax does not.\n */\nfunction canvasStyleUrls(value: string): string {\n if (!_canvasAssetResolver || !value.includes(\"url(\")) {\n return value;\n }\n return value.replaceAll(CSS_URL_RE, (whole, quote: string, url: string) => {\n const resolved = url === \"\" ? null : (_canvasAssetResolver?.(url, \"url()\") ?? null);\n return resolved === null ? whole : `url(${quote}${resolved}${quote})`;\n });\n}\n\n/**\n * A style scalar as the canvas wants it written: assets resolved, then viewport units transposed.\n *\n * Exported because the canvas emits some CSS itself — the site-level `style` block, which never\n * passes through {@link applyStyle} — and a second implementation of \"what the canvas does to a\n * style value\" is a second thing to keep in step.\n *\n * @param {string} value - A CSS declaration value\n * @returns {string} The value as the canvas should write it\n */\nexport function canvasStyleValue(value: string): string {\n return transposeCanvasUnits(canvasStyleUrls(value));\n}\n\n/**\n * Studio-canvas prop-binding markers. When on, `bindProperty` stamps `data-jx-bound-prop=\"<key>\"`\n * on elements whose `textContent` is an invertible single-key state binding — the pure template\n * `\"${state.key}\"` or `{ \"$ref\": \"#/state/key\" }`. The studio canvas uses the marker to offer\n * inline editing of component-instance prop values; the rendered text must BE the prop value\n * verbatim, so mixed templates and deep paths are never stamped. Off (the default) leaves\n * production rendering untouched; the studio sets it for design/edit (not preview — see\n * iframe-render).\n */\nlet _stampPropBindings = false;\nexport function setStampPropBindings(on: boolean) {\n _stampPropBindings = on;\n}\n\n/** The single invertible template form: the whole string is exactly one `${state.key}` access. */\nconst PURE_STATE_TEMPLATE = /^\\s*\\$\\{\\s*state\\.(\\w+)\\s*\\}\\s*$/;\n\n/** The state key of an invertible `textContent` binding, or null (mixed template, deep path). */\nfunction boundPropKey(\n key: string,\n val: JxDocumentValue | undefined,\n state: JxScope,\n): string | null {\n if (!_stampPropBindings || key !== \"textContent\") {\n return null;\n }\n let sub: string | null = null;\n if (isRefValue(val)) {\n if (!val.$ref.startsWith(\"#/state/\")) {\n return null;\n }\n const rest = val.$ref.slice(\"#/state/\".length);\n sub = rest && !rest.includes(\"/\") ? rest : null;\n } else if (isString(val)) {\n sub = PURE_STATE_TEMPLATE.exec(val)?.[1] ?? null;\n }\n if (!sub) {\n return null;\n }\n // Only plain writable data entries are per-instance props. Computed/signal entries live as refs\n // In the raw scope (auto-unwrapped by the reactive proxy), and function/object entries (handlers,\n // $prototype instances) are not prop-overridable either — an instance $props write against any of\n // Them would clobber the definition's behavior, so their bindings are never marked editable.\n const stored = toRaw(state)[sub];\n if (isRef(stored) || isFunction(stored)) {\n return null;\n }\n if (isNonNullObject(stored)) {\n return null;\n }\n return sub;\n}\n\n/**\n * Build the reactive scope (state) from the document using the five-shape detection algorithm.\n *\n * @param {JxDocument} doc\n * @param {JxScope} [parentScope] Default is `{}`\n * @param {string} [base] Base URL for resolving $src imports. Default is `location.href`\n * @param {JxContext} [ctx] The mount context; absent on the legacy direct path\n * @returns {Promise<JxScope>} Reactive proxy (state)\n */\nexport async function buildScope(\n doc: JxDocument,\n parentScope: JxScope = {},\n base: string = location.href,\n ctx?: JxContext,\n) {\n // A body run without an event dispatches from the mount's root, read when it fires.\n const dispatchRoot = (): EventTarget | null => ctx?.root ?? null;\n const raw: JxScope = {};\n const defs = doc.state ?? {};\n\n /* Merge parent scope properties. A REACTIVE parent stays live: its members are read through\n accessors rather than copied, so a host that hands in a reactive record as the scope sees the\n document follow every field of it, not a snapshot of the primitives it held at mount time. A\n member the document declares itself is copied instead, so the document's own entry can still\n overwrite it — the document wins (embedding.md §3). */\n const linked = isReactive(parentScope);\n for (const key of Object.keys(parentScope)) {\n if (linked && !(key in defs)) {\n Object.defineProperty(raw, key, {\n configurable: true,\n enumerable: true,\n get: () => parentScope[key],\n set: (value: JxScopeValue) => {\n parentScope[key] = value;\n },\n });\n } else {\n raw[key] = parentScope[key];\n }\n }\n\n // Pass 0: resolve bare $prototype names via import map\n const imports = doc.imports ?? {};\n for (const [, def] of Object.entries(defs)) {\n if (isPrototypeDef(def) && !def.$src) {\n const mapped = imports[def.$prototype];\n if (mapped) {\n if (!mapped.endsWith(\".class.json\")) {\n console.warn(\n `Jx: import \"${def.$prototype}\" must map to a .class.json path, got \"${mapped}\"`,\n );\n continue;\n }\n def.$src = mapped;\n }\n }\n }\n\n // First pass: collect naked values, expanded defaults, plain objects\n for (const [key, def] of Object.entries(defs)) {\n // 1. String value\n if (isString(def)) {\n if (!def.includes(\"${\")) {\n raw[key] = def;\n } // Shape 1: naked string\n continue; // Template strings handled in second pass\n }\n\n // 2. Number, boolean, null\n if (isNumber(def) || isBoolean(def) || def === null) {\n raw[key] = def;\n continue;\n }\n\n // 3. Array\n if (Array.isArray(def)) {\n raw[key] = def;\n continue;\n }\n\n // 4. Object\n if (isNonNullObject(def)) {\n if (def.$prototype) {\n continue;\n } // Handled in later passes\n if (isExpressionDef(def)) {\n continue;\n } // Handled in pass 2.5\n if (isServerFnDef(def)) {\n continue;\n } // Handled in fifth pass\n if (\"default\" in def) {\n raw[key] = def.default;\n continue;\n } // Shape 2: expanded signal\n if (hasSchemaKeywords(def)) {\n continue;\n } // Shape 2b: pure type def\n raw[key] = def; // Shape 1: plain object\n }\n }\n\n // Wrap in Vue reactive proxy — deep reactivity from this point on\n const state = reactive(raw);\n\n // Second pass: template strings → computed, a single expression keeping its own type (§5.3)\n for (const [key, def] of Object.entries(defs)) {\n if (isString(def) && def.includes(\"${\")) {\n state[key] = computed(() => evaluateValueTemplate(def, state));\n }\n }\n\n // Pass 2.5: $expression entries (Shape 5)\n for (const [key, def] of Object.entries(defs)) {\n if (isExpressionDef(def)) {\n const node = def.$expression;\n if (isNamedFormulaDef(def)) {\n // A named formula: callable with positional args mapped onto its declared parameters.\n const params = def.parameters;\n state[key] = (...argValues: JxScopeValue[]) =>\n evaluateExpression(node, state, null, { args: bindPositionalArgs(params, argValues) });\n } else if (isMutating(node.operator)) {\n const handler: JxEventHandler = (s, event) => evaluateExpression(node, s, event);\n state[key] = handler;\n } else {\n state[key] = computed(() => evaluateExpression(node, state, null));\n }\n }\n }\n\n // Third pass: $prototype: \"Function\" entries\n for (const [key, def] of Object.entries(defs)) {\n if (hasStructuredBody(def)) {\n // Structured body (spec §20): with parameters → a callable mapping positional args onto\n // $args names (invoked via the call operator); without → an event handler.\n const { body } = def;\n if (Array.isArray(def.parameters) && def.parameters.length > 0) {\n const params = def.parameters;\n state[key] = (...argValues: JxScopeValue[]) =>\n runStatements(body, state, null, {\n args: bindPositionalArgs(params, argValues),\n target: dispatchRoot,\n });\n } else {\n /* The event is optional in fact: a `call` operator or a host invokes a handler with the\n scope alone, and the body then runs with no event rather than an undefined one. */\n const handler = (s: JxScope, event?: Event | null): void => {\n void runStatements(body, s, event ?? null, { target: dispatchRoot });\n };\n state[key] = handler;\n }\n } else if (isFunctionDef(def)) {\n state[key] = await resolveFunction(def, state, key, base);\n }\n }\n\n // Fourth pass: other $prototype entries (Request, Set, Map, etc.)\n for (const [key, def] of Object.entries(defs)) {\n if (isPrototypeDef(def)) {\n state[key] = await resolvePrototype(def, state, key, base, ctx);\n }\n }\n\n /* Fifth pass: timing: \"server\" entries, each called through the host's /__jx_server__ proxy, or\n in process only when the host registered the module itself (spec.md §11.4) */\n if (!(ctx?.skipServerFunctions ?? _serverFnConfig.skip)) {\n for (const [key, def] of Object.entries(defs)) {\n if (isServerFnDef(def)) {\n state[key] = await resolveServerFunction(def, state, key, base);\n }\n }\n }\n\n const rootMedia = ctx?.media ?? _rootMedia;\n if (doc.$media) {\n state[\"$media\"] = doc.$media;\n } else if (!state[\"$media\"] && Object.keys(rootMedia).length > 0) {\n state[\"$media\"] = rootMedia;\n }\n\n return state;\n}\n\n/**\n * Map a call's positional arguments onto a definition's declared parameter names, as `$args/<name>`\n * refs read them. A parameter given as an object supplies its `default` for a position the call\n * left undefined. Parameters come from a document that is not schema-validated at runtime, so an\n * entry that names nothing (null, or an object without a `name`) binds nothing.\n *\n * @param parameters The declared parameters, in call order\n * @param argValues The values the call passed, in the same order\n * @returns {JxScope} Name to value, for the body's `$args` refs\n */\nfunction bindPositionalArgs(\n parameters: readonly (string | CemParameter | null)[],\n argValues: readonly JxScopeValue[],\n): JxScope {\n const args: JxScope = {};\n for (const [i, p] of parameters.entries()) {\n const name = isString(p) ? p : (p?.name ?? \"\");\n if (!name) {\n continue;\n }\n args[name] =\n argValues[i] === undefined && p !== null && !isString(p) && \"default\" in p\n ? p.default\n : argValues[i];\n }\n return args;\n}\n\n/**\n * Check whether an object contains any JSON Schema keywords. Used to discriminate Shape 2b (pure\n * type definition) from Shape 1 (naked object).\n *\n * @param obj A state entry object, as the document wrote it\n * @returns {boolean}\n */\nfunction hasSchemaKeywords(obj: Readonly<Record<string, JxDocumentValue | undefined>>) {\n for (const k of Object.keys(obj)) {\n if (SCHEMA_KEYWORDS.has(k)) {\n return true;\n }\n }\n return false;\n}\nexport { hasSchemaKeywords };\n\n/**\n * The names a template may read without a `state.` prefix, in the order {@link templateArgs}\n * supplies them.\n *\n * `$site` and `$page` are here for the reason `evaluateStaticTemplate` in the compiler binds them:\n * every example in site-architecture.md §8.2 and §13.4 writes the bare `${$page.locale}`, and\n * `injectContext` (or the Studio canvas) puts the two on the document's state, not in the\n * template's lexical scope. Without them the live runtime threw `ReferenceError: $page is not\n * defined` on a template the build renders, so a page that prerendered correctly drew nothing where\n * it hydrated or rendered live.\n */\nconst TEMPLATE_PARAMS = [\"state\", \"$map\", \"item\", \"index\", \"$site\", \"$page\"] as const;\n\n/** The values {@link TEMPLATE_PARAMS} name, read from one scope. */\nfunction templateArgs(state: JxScope): Parameters<TemplateFn<unknown>> {\n const $map = rowContext(state);\n return [state, $map, $map?.item, $map?.index, state.$site, state.$page];\n}\n\n/**\n * Evaluate a template string in the context of state and optional $map. Templates use\n * `state.varName`, `$map.item` (or `item`) and the page context `$page` / `$site`.\n *\n * @param {string} str\n * @param {JxScope} state\n * @returns {string}\n */\nfunction evaluateTemplate(str: string, state: JxScope): string {\n let fn = textTemplates.get(str);\n if (!fn) {\n /* SAFETY: `new Function` compiles exactly the TEMPLATE_PARAMS, and its body returns a template\n literal, so every call answers a string (or throws, which the caller sees). */\n fn = new Function(...TEMPLATE_PARAMS, `return \\`${str}\\``) as TemplateFn<string>;\n remember(textTemplates, str, fn);\n }\n return fn(...templateArgs(state));\n}\n\n/**\n * Compiled templates, by source. A compiled template closes over nothing — everything it reads\n * arrives as one of its TEMPLATE_PARAMS — so one function per distinct source serves every binding\n * that spells it. Compiling is the expensive half: a `$map` row re-bound to a fresh item re-runs\n * each of its template effects, and a 40-row window re-binding on every scroll step spent seconds\n * in `new Function` alone. A source that fails to compile throws before it is stored, so it throws\n * again on the next evaluation exactly as it did before the cache existed.\n */\nconst textTemplates = new Map<string, TemplateFn<string>>();\n\n/** {@link textTemplates}, for single-expression templates compiled to keep their own type. */\nconst valueTemplates = new Map<string, TemplateFn<JxScopeValue>>();\n\n/**\n * How many sources a template cache holds before it starts over. Editing mints a new source per\n * keystroke, so the cache is bounded; clearing it wholesale costs one recompile per live binding,\n * which is what every evaluation cost before there was a cache.\n */\nconst TEMPLATE_CACHE_MAX = 4096;\n\n/**\n * Store a compiled template, emptying the cache first when it is full.\n *\n * @param {Map<string, F>} cache\n * @param {string} source\n * @param {F} fn\n */\nfunction remember<F>(cache: Map<string, F>, source: string, fn: F): void {\n if (cache.size >= TEMPLATE_CACHE_MAX) {\n cache.clear();\n }\n cache.set(source, fn);\n}\n\n/** Template sources already reported as throwing, so a binding re-run per keystroke warns once. */\nconst reportedTemplates = new Set<string>();\n\n/** Who hears a throwing template binding, when a host asked to; otherwise the console does. */\nlet _templateErrorHandler: ((error: Error, source: string) => void) | null = null;\n\n/**\n * Route throwing template bindings to `handler` instead of a console warning, or back with `null`.\n *\n * A binding survives its expression throwing (§6.1), which is right for a page and wrong for a host\n * whose question IS whether the document renders: Studio's render critic must still refuse a page\n * whose `${nonExistent}` can never evaluate. Every throw is delivered, not only the first.\n *\n * @param {((error: Error, source: string) => void) | null} handler\n */\nexport function setTemplateErrorHandler(\n handler: ((error: Error, source: string) => void) | null,\n): void {\n _templateErrorHandler = handler;\n}\n\n/** Warn about a throwing template, once per source. */\nfunction warnTemplateError(source: string, error: Error): void {\n if (!reportedTemplates.has(source)) {\n reportedTemplates.add(source);\n console.warn(`jx: template ${JSON.stringify(source)} threw:`, error);\n }\n}\n\n/** Lookups in flight whose answers can make a throwing template valid (§6.1). */\nlet pendingLookups = 0;\n\n/** Each binding still throwing while a lookup is in flight, by its `run`, with its latest throw. */\nconst heldTemplateErrors = new Map<() => void, { error: Error; source: string }>();\n\n/** Who {@link lookupsSettled} has yet to answer. */\nconst lookupWaiters: (() => void)[] = [];\n\n/**\n * Hold template warnings until `lookup` and every other lookup in flight have settled.\n *\n * `lookup` must write its answer to state before it settles: the write re-runs the bindings waiting\n * on it, so whatever is still held when the last one settles is a template the data did not fix,\n * and only that is reported. A lookup its own answer starts is counted before this one is\n * released.\n *\n * @param {Promise<void>} lookup - Never rejects: it reports its own failure\n */\nfunction holdTemplateErrorsFor(lookup: Promise<void>): void {\n pendingLookups += 1;\n void lookup.finally(() => {\n pendingLookups -= 1;\n if (pendingLookups === 0) {\n /* The console, even if a handler was installed meanwhile: these throws happened outside that\n handler's render, and Studio's render critic would refuse its page for them. */\n for (const { error, source } of heldTemplateErrors.values()) {\n warnTemplateError(source, error);\n }\n heldTemplateErrors.clear();\n for (const wake of lookupWaiters.splice(0)) {\n wake();\n }\n }\n });\n}\n\n/**\n * Answers once no lookup the runtime started is in flight (embedding.md §5.2).\n *\n * A host whose question is whether a document renders awaits this between `buildScope` and\n * `renderNode`, so its templates read the data rather than the `null` before it. A lookup can hang,\n * and this waits for it, so bounding the wait is the host's job.\n *\n * @returns {Promise<void>}\n */\nexport function lookupsSettled(): Promise<void> {\n if (pendingLookups === 0) {\n return Promise.resolve();\n }\n return new Promise((wake) => {\n lookupWaiters.push(wake);\n });\n}\n\n/**\n * Run a template binding as an effect that survives its expression throwing.\n *\n * A binding is live: `${state.posts.length}` over a collection that resolves asynchronously reads\n * `null` first and an array a moment later. Unguarded, the first run's TypeError escaped `effect()`\n * — which stops the effect before rethrowing — so the binding never re-ran when the data arrived,\n * and the throw unwound the whole `renderNode` above it: one early read blanked the page. Caught\n * INSIDE the effect, every dependency read before the throw stays tracked, so the binding re-runs\n * on the change that makes it valid. Until then it shows `fallback`'s answer (nothing written, by\n * default), and the error is reported once per source, after any lookup in flight has settled: a\n * template that only needed that lookup's answer is not reported at all.\n *\n * @param {string} source - The template, for the report\n * @param {() => void} run - Evaluates the template and writes it\n * @param {() => void} [fallback] - What a throwing evaluation writes instead\n */\nfunction bindTemplate(source: string, run: () => void, fallback?: () => void): void {\n effect(() => {\n try {\n run();\n heldTemplateErrors.delete(run);\n } catch (error) {\n const thrown = error instanceof Error ? error : new Error(String(error));\n if (_templateErrorHandler) {\n _templateErrorHandler(thrown, source);\n } else if (pendingLookups > 0) {\n heldTemplateErrors.set(run, { error: thrown, source });\n } else {\n warnTemplateError(source, thrown);\n }\n fallback?.();\n }\n });\n}\n\n/** A compiled template: the scope, the row context, its item and index, and the page context. */\ntype TemplateFn<R> = (\n state: JxScope,\n $map: JxRowContext | undefined,\n item: JxRowContext[\"item\"],\n index: JxRowContext[\"index\"] | undefined,\n $site: JxScopeValue,\n $page: JxScopeValue,\n) => R;\n\n/**\n * The row context a scope carries, or undefined outside a mapped row.\n *\n * @param {JxScope} state\n * @returns {JxRowContext | undefined}\n */\nfunction rowContext(state: JxScope): JxRowContext | undefined {\n /* SAFETY: `$map` is runtime vocabulary. A host scope may not supply it (`assertHostScope`), a\n node never binds it as a `$`-local (it is in RESERVED_KEYS), and the one writer is\n `renderMappedArrayInto`, which binds the `{ index, item }` row record; elsewhere it is absent. */\n return state.$map as JxRowContext | undefined;\n}\n\n/**\n * Whether a template is ONE expression end to end — `\"${a.b}\"` rather than `\"a ${b}\"` or\n * `\"${a}${b}\"`.\n *\n * Depth-counted rather than pattern-matched. A greedy `/^\\$\\{(.+)\\}$/` also matched `\"${a} /\n * ${b}\"`, spliced the interior into `return (a} / ${b)`, and the SyntaxError became a silent null:\n * the node rendered empty and a `$head` entry shipped its own template text. A brace scan is exact\n * where a tightened regex is not — `\"${`${a}-x`}\"` is still one expression, and must keep its raw\n * value.\n *\n * Lives here rather than in the compiler because both renderers must draw the line in the same\n * place. It is what decides whether a value keeps its own type, and a value that is a boolean in\n * one renderer and the string `\"false\"` in the other is a page that changes meaning as it\n * hydrates.\n *\n * @param {string} str - Template source\n * @returns {boolean} True when the whole string is a single `${…}`\n */\nexport function isSingleExpression(str: string): boolean {\n if (!str.startsWith(\"${\") || !str.endsWith(\"}\")) {\n return false;\n }\n let depth = 0;\n for (let i = 1; i < str.length; i += 1) {\n const c = str[i];\n if (c === \"{\") {\n depth += 1;\n } else if (c === \"}\") {\n depth -= 1;\n if (depth === 0) {\n return i === str.length - 1;\n }\n }\n }\n return false;\n}\n\n/**\n * Evaluate a template as a VALUE — a state entry (Shape 3) or an attribute — keeping the\n * expression's own type.\n *\n * `evaluateTemplate` interpolates into a string, which is what text wants and what a value cannot\n * afford: `\"${state.expanded}\"` has to arrive as the boolean `false`, or `booleanAttrValue` never\n * sees a boolean, `open=\"false\"` is written, and HTML reads that as open. A state entry is the same\n * case one step removed: `\"isBrand\": \"${state.name === 'github'}\"` held the string `\"false\"`, which\n * is truthy, so every `state.isBrand ? … : …` took the wrong branch in Studio and in a hydrated\n * component while the prerendered page took the right one. Only a single expression can carry a\n * type at all — `\"a ${b}\"` is text by construction — which is the same line\n * `evaluateStaticTemplate` draws in the compiler, and drawing it identically is what keeps a\n * prerendered page and the same document rendered live in agreement.\n *\n * @param {string} str - Template source\n * @param {JxScope} state - Reactive scope\n * @returns {JxScopeValue} The expression's value, or the interpolated string\n */\nfunction evaluateValueTemplate(str: string, state: JxScope): JxScopeValue {\n if (!isSingleExpression(str)) {\n return evaluateTemplate(str, state);\n }\n let fn = valueTemplates.get(str);\n if (!fn) {\n /* SAFETY: `new Function` compiles exactly the TEMPLATE_PARAMS; the body returns one\n expression's value, which is whatever the scope it reads holds, so it is typed as a scope\n member and narrowed by the attribute writer. */\n fn = new Function(\n ...TEMPLATE_PARAMS,\n `return (${str.slice(2, -1)})`,\n ) as TemplateFn<JxScopeValue>;\n remember(valueTemplates, str, fn);\n }\n return fn(...templateArgs(state));\n}\n\n// ─── Step 2b: Function resolution (Shape 4) ─────────────────────────────────\n\n/**\n * A module namespace as the runtime reads it: exports looked up by name, then under `default` (the\n * shape a CommonJS module takes when imported). An export is whatever the module exported, so each\n * lookup checks what it found before using it.\n */\ninterface ImportedModule {\n readonly [exportName: string]: JxScopeValue;\n readonly default?: ImportedModule;\n}\n\n/**\n * Import a module namespace by specifier.\n *\n * Not `async`: the import's own promise is handed back, so awaiting this costs exactly the ticks\n * awaiting `import()` did, and scope construction keeps its order against its siblings'.\n *\n * @param {string} specifier\n * @returns {Promise<ImportedModule>}\n */\n/**\n * How the host serves the package an `npm:` specifier names, or null for none.\n *\n * `npm:@jxsuite/search/client` is a package specifier (spec.md §5.3, 4c), and the build bundles it\n * (`compiler/src/site/bundler.ts`). The interpreter had no answer for it: `new URL()` reads `npm:`\n * as a URL scheme, so it was handed to `import()` verbatim and the browser refused it as a\n * cross-origin request to a scheme it does not fetch. A host that renders documents live knows\n * where its packages are served (the dev server bundles `/node_modules/<package>/<subpath>` on\n * demand), so it says so here. With no resolver the bare specifier is imported, which an import map\n * can answer.\n */\nlet _npmModuleResolver: ((specifier: string) => string) | null = null;\n\n/**\n * Install (or with `null`, remove) the host's resolver for `npm:` specifiers.\n *\n * @param {((specifier: string) => string) | null} resolver - Package specifier → importable URL\n */\nexport function setNpmModuleResolver(resolver: ((specifier: string) => string) | null): void {\n _npmModuleResolver = resolver;\n}\n\n/** The scheme a package specifier is written with. */\nconst NPM_SCHEME = \"npm:\";\n\n/**\n * Import a module a document names by `$src`: an `npm:` package through the host's resolver, and\n * anything else from the document's base (then as written).\n *\n * @param {string} src - The `$src` as the document spells it\n * @param {string} [base] - The document's URL\n * @returns {Promise<ImportedModule>}\n */\nasync function importSource(src: string, base?: string): Promise<ImportedModule> {\n if (src.startsWith(NPM_SCHEME)) {\n const specifier = src.slice(NPM_SCHEME.length);\n return importModule(_npmModuleResolver?.(specifier) ?? specifier);\n }\n if (base) {\n try {\n return await importModule(new URL(src, base).href);\n } catch {\n return importModule(src);\n }\n }\n return importModule(src);\n}\n\nfunction importModule(specifier: string): Promise<ImportedModule> {\n /* SAFETY: trust boundary — a module exports whatever it exports. `import()` resolves to the\n module namespace object, whose keys are its export names, and every export is typed as the scope\n member it becomes: the runtime uses one only after `isFunction` has accepted it (a Function\n entry's `$src`, a server function, a `$implementation` class) or after testing it for\n presence, and both tests are defined for any value a module can export. `default` is only ever\n read through optional property access. */\n return import(specifier) as Promise<ImportedModule>;\n}\n\n/**\n * An external class's instance as the runtime uses it (spec.md §12.3): a record read by member\n * name, three members of which are its contract with the runtime — a `value`, a `resolve()` that\n * produces one (possibly a promise), and a `subscribe()` that pushes later ones. Each is optional\n * and checked before it is used.\n */\ninterface ExternalClassInstance extends JxScope {\n value?: JxScopeValue;\n resolve?: () => JxScopeValue | Promise<JxScopeValue>;\n subscribe?: (callback: (value: JxScopeValue) => void) => void;\n}\n\n/** Module cache for $src imports (shared with external class resolution). */\nconst _moduleCache = new Map<string, ImportedModule>();\n\n/** A module the host will import on first use, keyed as the document spells its `$src`. */\ntype ModuleLoader = () => Promise<ImportedModule>;\n\n/**\n * Lazy registrations: a loader until it runs, then the in-flight load, so two entries resolving the\n * same sidecar in one tick share one import rather than racing two.\n */\nconst _moduleLoaders = new Map<string, ModuleLoader | Promise<ImportedModule>>();\n\n/**\n * The specifiers a host registered through `preloadModule`, in either form. Kept apart from\n * `_moduleCache` because that cache is shared: a Function entry's `$src` import lands there too,\n * and a `timing: \"server\"` entry naming the same specifier must still not run in the browser\n * (spec.md §11.4). Only the host's own registration admits a server module in process.\n */\nconst _hostSeeded = new Set<string>();\n\n/**\n * Seed the `$src` module cache with a module the host already imported, under the specifier the\n * document spells. A bundled document cannot have its sidecar fetched by URL — the bundler saw\n * neither the string nor the file — so the host imports the sidecar itself and registers it here,\n * and `$src` then resolves exactly as it would have from the network.\n *\n * Given a FUNCTION instead of a namespace, the registration is lazy: nothing is imported until a\n * document names the specifier, and the loader runs once. That is the shape for a host that can\n * bundle a sidecar as its own chunk but should not pay for it until something renders — Studio's\n * canvas frame registers every kit behaviour this way, so a page that uses no kit element loads\n * none of them (embedding.md §6).\n *\n * A registered module is also how a host runs a `timing: \"server\"` entry in process; for any\n * specifier not registered here, the runtime calls the host's `/__jx_server__` proxy instead.\n *\n * @param {string} specifier - The `$src` value as written in the document\n * @param {ImportedModule | ModuleLoader} mod - The imported module namespace, or a loader that\n * imports it on first use\n */\nexport function preloadModule(specifier: string, mod: ImportedModule | ModuleLoader): void {\n _hostSeeded.add(specifier);\n if (isFunction(mod)) {\n _moduleCache.delete(specifier);\n _moduleLoaders.set(specifier, mod);\n return;\n }\n _moduleLoaders.delete(specifier);\n _moduleCache.set(specifier, mod);\n}\n\n/**\n * The module a specifier was seeded with — imported, or lazily registered — or undefined when the\n * host said nothing about it and the network is the answer.\n *\n * SYNCHRONOUS for a namespace the host imported, and that is load-bearing rather than tidy: a cache\n * hit used to be a `Map#has` on the way through `resolveFunction`, and an `await` there — even of a\n * value that is not a promise — defers one microtask, which reorders every element's scope\n * construction against its siblings'. The kit's field naming its slotted control is one thing that\n * order decides. Only a loader is a promise, because only a loader has to be.\n *\n * @param {string} src\n * @returns {ImportedModule | Promise<ImportedModule> | undefined}\n */\nfunction seededModule(src: string): ImportedModule | Promise<ImportedModule> | undefined {\n const cached = _moduleCache.get(src);\n if (cached) {\n return cached;\n }\n const pending = _moduleLoaders.get(src);\n if (!pending) {\n return undefined;\n }\n if (!isFunction(pending)) {\n return pending;\n }\n /* Started here, outside the async body, so a loader that throws synchronously still throws to\n the caller. The async body turns a thenable from a host's loader into a Promise the call sites\n can tell from a namespace. */\n const started = pending();\n const load = (async () => {\n try {\n const mod = await started;\n _moduleCache.set(src, mod);\n _moduleLoaders.delete(src);\n return mod;\n } catch (error) {\n /* A failed load — a chunk the network dropped — puts the loader back, so the next document to\n name the specifier tries again rather than inheriting this rejection for good. */\n _moduleLoaders.set(src, pending);\n throw error;\n }\n })();\n _moduleLoaders.set(src, load);\n return load;\n}\n\n/**\n * A Function entry's implementation as the runtime calls it — a compiled `body` or a `$src` export\n * — with the scope as its first argument. JavaScript checks none of the arguments, and what the\n * call returns is bound into the scope like any other member.\n */\ntype ScopeFunction = (...args: JxScopeValue[]) => JxScopeValue;\n\n/**\n * Resolve a $prototype: \"Function\" entry into a function or computed.\n *\n * Functions receive state as their first parameter at call time. Functions with a return statement\n * in their body are wrapped in computed() for reactive evaluation.\n *\n * @param {JxFunctionDef} def - State entry with $prototype: \"Function\"\n * @param {JxScope} state - Reactive scope proxy\n * @param {string} key - Def key name\n * @param {string} [base] - Base URL for resolving $src imports\n * @returns {Promise<JxScopeValue>}\n */\nasync function resolveFunction(def: JxFunctionDef, state: JxScope, key: string, base?: string) {\n if (def.body && def.$src) {\n throw new Error(`Jx: '${key}' declares both body and $src — these are mutually exclusive`);\n }\n if (!def.body && !def.$src) {\n const params = resolveParamNames(def);\n const noop = new Function(...params, \"\");\n Object.defineProperty(noop, \"name\", {\n configurable: true,\n value: def.name ?? key,\n });\n return noop;\n }\n\n let fn: ScopeFunction;\n\n if (isString(def.body)) {\n const params = resolveParamNames(def);\n /* SAFETY: `new Function` returns an ordinary function of the named parameters, `state` first.\n A call never checks its arguments, and what the body returns is one more scope member. */\n fn = new Function(...params, def.body) as ScopeFunction;\n Object.defineProperty(fn, \"name\", {\n configurable: true,\n value: def.name ?? key,\n });\n } else {\n // $src: dynamic import (the body/$src dichotomy was validated above)\n const src = def.$src;\n if (!src) {\n throw new Error(`Jx: '${key}' has neither body nor $src`);\n }\n const exportName = def.$export ?? key;\n let mod: ImportedModule;\n const seeded = seededModule(src);\n if (seeded instanceof Promise) {\n mod = await seeded;\n } else if (seeded) {\n mod = seeded;\n } else {\n mod = await importSource(src, base);\n _moduleCache.set(src, mod);\n }\n const candidate = mod[exportName] ?? mod.default?.[exportName];\n if (!isFunction(candidate)) {\n throw new TypeError(`Jx: export \"${exportName}\" not found or not a function in \"${src}\"`);\n }\n /* SAFETY: the guard proved a function, and a function accepts any call: the runtime passes the\n scope first, as a Function entry's contract says, and binds the result as a scope member. */\n fn = candidate as ScopeFunction;\n }\n\n // Detect computed: body contains a return statement, or $src function introspection.\n // Functions with parameters (event handlers, callbacks) are never computed.\n const hasParams = (def.parameters ?? def.arguments ?? []).length > 0;\n let isComputed = false;\n if (!hasParams) {\n isComputed = isString(def.body)\n ? bodyReturnsValue(def.body)\n : fn.length <= 1 && bodyReturnsValue(fn.toString());\n }\n if (isComputed) {\n return computed(() => fn(state));\n }\n\n return fn;\n}\n\n// ─── Step 3: Render ───────────────────────────────────────────────────────────\n\n/**\n * Extract parameter names from a function definition. Supports both legacy \"arguments\" (string\n * array) and CEM-compatible \"parameters\" (object array). Always ensures \"state\" is the first\n * parameter.\n *\n * @param {JxFunctionDef | JxPrototypeDef} def\n * @returns {string[]}\n */\nfunction resolveParamNames(def: JxFunctionDef | JxPrototypeDef) {\n const names = def.parameters ? paramNames(def.parameters) : (def.arguments ?? []);\n return names.length > 0 && names[0] === \"state\" ? names : [\"state\", ...names];\n}\n\n/**\n * Reserved Jx keys — never set as DOM properties.\n *\n * @type {Set<string>}\n */\nexport const RESERVED_KEYS = new Set([\n \"$schema\",\n \"$id\",\n \"$defs\",\n \"state\",\n \"$ref\",\n \"$props\",\n \"$elements\",\n \"$title\",\n \"$description\",\n \"$switch\",\n \"$prototype\",\n \"$src\",\n \"$export\",\n \"$media\",\n \"$map\",\n \"timing\",\n \"default\",\n \"description\",\n \"body\",\n \"parameters\",\n \"arguments\",\n \"name\",\n \"tagName\",\n \"children\",\n \"style\",\n \"attributes\",\n \"items\",\n \"map\",\n \"filter\",\n \"sort\",\n \"cases\",\n \"observedAttributes\",\n]);\n\n/**\n * A child scope: a `$map` row, or a node carrying `$`-prefixed local bindings or `$props`. Reads\n * fall through to `parent`, and so does a write to any key the chain above already holds.\n *\n * The write is the half a bare `Object.create(parent)` gets wrong, and it gets it wrong silently.\n * An assignment that reaches the reactive proxy through a prototype chain arrives with the child as\n * its receiver, so the proxy defines the value on the child and triggers nothing: the handler's\n * `count += 1` shadows `count`, the root never changes, and the bindings reading it never re-run. A\n * compiled document assigns to the root directly, so the same document counted there and sat still\n * here. A value this scope owns is declared with {@link bindLocal}, which is what shadows.\n *\n * @param {JxScope} parent\n * @returns {JxScope}\n */\nfunction inheritScope(parent: JxScope): JxScope {\n /* SAFETY: `Object.create` is typed `any`, but what it returns is a plain object whose prototype\n is `parent`, so it is keyed by string exactly as the scope it extends is. */\n const local = Object.create(parent) as JxScope;\n return new Proxy(local, {\n set(target, key: string, value: JxScopeValue) {\n if (Object.hasOwn(target, key)) {\n return Reflect.set(target, key, value);\n }\n if (key in parent) {\n return Reflect.set(parent, key, value);\n }\n bindLocal(target, key, value);\n return true;\n },\n });\n}\n\n/**\n * Declare `key` on a child scope itself, shadowing whatever its parents hold under that name.\n *\n * @param {JxScope} scope\n * @param {string} key\n * @param {JxScopeValue} value\n */\nfunction bindLocal(scope: JxScope, key: string, value: JxScopeValue): void {\n Object.defineProperty(scope, key, {\n configurable: true,\n enumerable: true,\n value,\n writable: true,\n });\n}\n\n/**\n * The named breakpoints a scope carries, or none.\n *\n * @param {JxScope} state\n * @returns {Record<string, string>}\n */\nfunction scopeMedia(state: JxScope): Record<string, string> {\n /* SAFETY: `$media` is runtime vocabulary a host scope may not supply (`assertHostScope`); the one\n writer is `buildScope`, which stores a document's or the mount's `$media` map, a record of\n breakpoint name to media query. */\n return (state[\"$media\"] as Record<string, string> | undefined) ?? {};\n}\n\n/**\n * An element as the property bag a Jx key writes into, `el[key] = value`. Reading or writing a key\n * the element does not define is an ordinary expando, as it is in JavaScript.\n */\ntype ElementProperties = HTMLElement & Record<string, JxScopeValue>;\n\n/**\n * View an element as its property bag.\n *\n * @param {HTMLElement} el\n * @returns {ElementProperties}\n */\nfunction elementProperties(el: HTMLElement): ElementProperties {\n /* SAFETY: every element is an ordinary extensible object, so any string key can be read (a\n missing one is undefined) and written; the added index signature claims nothing more. */\n return el as ElementProperties;\n}\n\n/**\n * The reactive state a connected Jx instance renders from, or null for any other element (and for\n * an instance that has not connected yet).\n *\n * @param {HTMLElement} el\n * @returns {JxScope | null}\n */\nfunction instanceStateOf(el: HTMLElement): JxScope | null {\n const state = elementProperties(el)._state;\n /* SAFETY: `_state` is written by one writer, the Jx element class's `connectedCallback`, which\n stores the scope `buildScope` answered; on any other element the expando is absent, and a\n non-object is refused below. */\n return isNonNullObject(state) ? (state as JxScope) : null;\n}\n\n/**\n * Whether a scope member can be called as an event handler, `(scope, event)`. Being a function is\n * the whole contract, for the reason {@link isScopeHook} gives.\n */\nfunction isEventHandler(value: unknown): value is JxEventHandler {\n return isFunction(value);\n}\n\n/**\n * Recursively render a Jx element definition into a DOM element.\n *\n * @param {JxElement | string | number | boolean} def\n * @param {JxScope} state - Reactive scope proxy (or child scope via Object.create)\n * @param {JxRenderOptions} [options]\n * @returns {HTMLElement | Text}\n */\n/** Refs already warned about, so the §13 diagnostic fires once per distinct target. */\nconst warnedRefChildren = new Set<string>();\n\n/** Foreign-content namespaces the HTML parser switches into, and the runtime must too. */\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\nconst MATHML_NS = \"http://www.w3.org/1998/Math/MathML\";\n\n/**\n * The namespace an element belongs in, given the one its parent established.\n *\n * The static build emits markup text, so the HTML parser applied foreign-content rules for it and\n * SVG worked there. The runtime built every node with `document.createElement`, which is HTML-only,\n * so the same document rendered blank in the Studio canvas and in any hydrated component — the\n * editor and the deployed site disagreeing, with only the editor wrong.\n *\n * @param {string} tagName\n * @param {string | null | undefined} inherited - The namespace the parent element established\n * @returns {string | null} Null means HTML\n */\nfunction elementNamespace(tagName: string, inherited: string | null | undefined): string | null {\n if (tagName === \"svg\") {\n return SVG_NS;\n }\n if (tagName === \"math\") {\n return MATHML_NS;\n }\n return inherited ?? null;\n}\n\nexport function renderNode(\n def: JxElement | string | number | boolean,\n state: JxScope,\n options?: JxRenderOptions,\n): HTMLElement | Text {\n const path = options?._path ?? [];\n\n // Text node children: bare strings/numbers/booleans produce DOM Text nodes\n if (isString(def) || isNumber(def) || isBoolean(def)) {\n const textNode = document.createTextNode(String(def));\n if (isTemplateString(def)) {\n bindTemplate(\n def,\n () => {\n textNode.textContent = evaluateTemplate(def, state);\n },\n () => {\n textNode.textContent = \"\";\n },\n );\n }\n return textNode;\n }\n\n // Extend scope with any $-prefixed local bindings declared on this node\n let localState: JxScope = state;\n for (const [key, val] of Object.entries(def)) {\n if (key.startsWith(\"$\") && !RESERVED_KEYS.has(key)) {\n if (localState === state) {\n localState = inheritScope(state);\n }\n bindLocal(localState, key, isRefValue(val) ? resolveRef(val.$ref, state) : val);\n }\n }\n\n /*\n * §13 diagnostic: a node-level external `$ref` (the withdrawn component-instance syntax) has no\n * tagName and silently renders an empty <div>. Warn once per target instead of failing silently —\n * the supported mechanism is $elements + a custom-element tag (see spec §13).\n */\n if (\"$ref\" in def && !def.tagName) {\n const refTarget = String(def.$ref ?? \"\");\n if (!warnedRefChildren.has(refTarget)) {\n warnedRefChildren.add(refTarget);\n console.warn(\n `Jx: a $ref child (\"${refTarget}\") is not a supported component instance; register the ` +\n `component in $elements and use its custom-element tag instead (spec §13).`,\n );\n }\n }\n\n /* RESOLVED ONCE, HERE, before anything branches on it.\n A tag may be a name or a choice between names (`ElementTagName`). Resolving at the top means\n every test below — the hyphen check that routes to the custom-element path, `customElements.get`,\n `createElement` itself — sees a literal, exactly as it did when a tag could only be written out.\n\n It is not tracked. `tagName` is in RESERVED_KEYS so no binding sweep reaches it, and a tag that\n changed after mount would mean replacing the node: the subtree's listeners, its focus, its typed\n input values and its component instances all go with it, and this runtime has no dispose walk to\n pay that bill (renderSwitch, two hundred lines up, still leaks its previous case's effects).\n `jx validate` warns when a tag discriminant is also an assignment target, so the case where this\n rule bites is caught before it ships rather than found as a `<div>` that never became an `<a>`. */\n const tagName = resolveTagName(def.tagName, localState);\n const isCustomEl = tagName.includes(\"-\") && customElements.get(tagName);\n\n if (def.$props && isCustomEl) {\n return renderCustomElementWithProps(def, localState, options, path);\n }\n\n if (def.$props) {\n // A hyphenated tag carrying $props is a component instance whose definition has not finished\n // Registering yet (async defineElement — e.g. the Studio desktop canvas, where the component\n // Fetch can land after this node renders). Render via the property-first path anyway: it sets\n // The instance props as JS properties on the bare element, which the eventual upgrade's\n // ConnectedCallback reads back off `this` (see the def.state merge below), so the instance's\n // Props win. The old branch stripped the props here, so a late upgrade painted the component's\n // State DEFAULTS instead (\"0\"/\"DESCRIPTION\" for every instance). A non-custom tag can never\n // Upgrade, so it keeps the historical mergeProps-into-scope behavior.\n if (tagName.includes(\"-\")) {\n return renderCustomElementWithProps(def, localState, options, path);\n }\n const { $props: _$props, ...rest } = def;\n return renderNode(rest, mergeProps(def, localState), options);\n }\n if (def.$switch) {\n return renderSwitch(def, localState, options);\n }\n\n const ns = elementNamespace(tagName, options?._ns);\n /*\n * `foreignObject` is itself an SVG element, and is the documented way back into HTML: its\n * DESCENDANTS are HTML, so the element and its children carry different namespaces.\n */\n const childNs = tagName === \"foreignObject\" ? null : ns;\n /* SAFETY: a namespaced node is an Element, not an HTMLElement, but every apply* helper below\n touches only members SVG and MathML elements share with HTML ones (style, dataset,\n setAttribute, append), and `bindProperty` writes `className` as an attribute on them. */\n const el = ns\n ? (document.createElementNS(ns, tagName) as HTMLElement)\n : document.createElement(tagName);\n\n if (options?.onNodeCreated) {\n options.onNodeCreated(el, path, def, localState);\n }\n\n applyProperties(el, def, localState);\n /* A custom element's own definition applies its style at connection, through the same interning\n path — which releases whatever is already on the element. So the call site's style is\n remembered here and merged there; see {@link callSiteStyles}. */\n if (def.style && tagName.includes(\"-\")) {\n callSiteStyles.set(el, def.style);\n }\n applyStyle(el, def.style ?? {}, scopeMedia(localState), localState);\n applyAttributes(el, def.attributes ?? {}, localState);\n\n const kids = def.children;\n if (isMappedArray(kids)) {\n // Legacy whole-children repeater: the items render directly into `el` (which keeps its own\n // TagName, e.g. <ul>), with no extra wrapper element.\n const arrOpts =\n options || childNs ? { ...options, _ns: childNs, _path: [...path, \"children\"] } : undefined;\n renderMappedArrayInto(el, kids, localState, arrOpts);\n } else if (Array.isArray(kids)) {\n for (let i = 0; i < kids.length; i++) {\n const child = kids[i]!;\n const childOpts =\n options || childNs\n ? { ...options, _ns: childNs, _path: [...path, \"children\", i] }\n : undefined;\n if (isMappedArray(child)) {\n // Array pseudo-element among siblings: expand inline, no wrapper.\n renderMappedArrayInto(el, child, localState, childOpts);\n } else {\n el.append(renderNode(child, localState, childOpts));\n }\n }\n } else if (isTemplateString(kids)) {\n renderComputedChildren(el, kids, localState, {\n ...options,\n _ns: childNs,\n _path: [...path, \"children\"],\n });\n }\n\n return el;\n}\n\n/**\n * Draw a whole-`children` template, the way the site build's template pass expands one (spec.md\n * §8.4). This is what an item's or an entry's parsed body looks like to something that renders the\n * source document rather than the build's output: Studio's Preview, chiefly.\n *\n * A result that is not an array draws nothing, because a plain string is not a `children` value.\n * The children are rendered in a detached scope of their own, replaced when the template's value\n * changes (a collection that was still loading), and with tracking paused for the reason\n * {@link renderSwitch} gives: the bindings inside track for themselves.\n *\n * @param {Element} el - The element whose children these are\n * @param {string} template - The `children` value\n * @param {JxScope} state\n * @param {JxRenderOptions} options - `_path` is the `children` position of `el`\n */\nfunction renderComputedChildren(\n el: Element,\n template: string,\n state: JxScope,\n options: JxRenderOptions,\n): void {\n const path = options._path ?? [];\n let live: EffectScope | null = null;\n const retire = (): void => {\n // Detached before it is stopped, for the reason `teardown` in `renderMappedArray` gives.\n el.replaceChildren();\n live?.stop();\n live = null;\n };\n bindTemplate(\n template,\n () => {\n const nodes = evaluateValueTemplate(template, state);\n retire();\n if (!Array.isArray(nodes)) {\n return;\n }\n const scope = effectScope(true);\n live = scope;\n pauseTracking();\n try {\n scope.run(() => {\n /* SAFETY: a children template that yields an array stands for the child list itself, the\n same reading the site build's template pass gives it. */\n for (const [i, child] of (nodes as (JxElement | string)[]).entries()) {\n el.append(renderNode(child, state, { ...options, _path: [...path, i] }));\n }\n });\n } finally {\n resetTracking();\n }\n },\n retire,\n );\n onScopeDispose(() => live?.stop(), true);\n}\n\n// ─── Template string utilities ────────────────────────────────────────────────\n\n/**\n * Check if a value is a template string (contains ${}).\n *\n * @param {unknown} val\n * @returns {boolean}\n */\n// ─── Property / style / attribute application ─────────────────────────────────\n\n/**\n * @param {HTMLElement} el\n * @param {JxElement} def\n * @param {JxScope} state\n */\nfunction applyProperties(el: HTMLElement, def: JxElement, state: JxScope) {\n for (const [key, val] of Object.entries(def)) {\n if (RESERVED_KEYS.has(key)) {\n continue;\n }\n if (key.startsWith(\"$\")) {\n continue;\n } // Scope bindings — handled in renderNode\n\n if (key.startsWith(\"on\") && bindHandler(el, key, val, state)) {\n continue;\n }\n\n bindProperty(el, key, val, state);\n }\n}\n\n/**\n * Attach an `on*` key as an event listener, in any of the four spellings a handler has: a `$ref` to\n * a function, a structured body (spec §20), a string body, or an `$expression`. Returns false for a\n * value that is none of those, which the caller then writes as a plain property.\n *\n * @param {HTMLElement} el\n * @param {string} key The `on`-prefixed key\n * @param {JxDocumentValue | undefined} val\n * @param {JxScope} state\n * @returns {boolean} Whether a listener was attached\n */\nfunction bindHandler(\n el: HTMLElement,\n key: string,\n val: JxDocumentValue | undefined,\n state: JxScope,\n): boolean {\n const type = key.slice(2);\n const scope = state;\n if (isRefValue(val)) {\n const handler = resolveRef(val.$ref, state);\n if (isEventHandler(handler)) {\n el.addEventListener(type, (e) => handler(scope, e));\n }\n return true;\n }\n if (hasStructuredBody(val)) {\n const { body } = val;\n el.addEventListener(type, (e) => {\n void runStatements(body, scope, e);\n });\n return true;\n }\n if (isFunctionDef(val) && isString(val.body)) {\n const params = resolveParamNames(val);\n /* SAFETY: `new Function` returns an ordinary function of the named parameters, `state` first;\n the listener calls it with the scope and the event, and discards what it returns. */\n const fn = new Function(...params, val.body) as JxEventHandler;\n el.addEventListener(type, (e) => fn(scope, e));\n return true;\n }\n if (isExpressionDef(val)) {\n const node = val.$expression;\n el.addEventListener(type, (e) => evaluateExpression(node, scope, e));\n return true;\n }\n return false;\n}\n\n/**\n * A definition's root-level `on*` keys listen on the HOST element, exactly as they would on an\n * element in a document. Only handler keys are read here: the rest of a definition's root —\n * `observedAttributes`, `emits`, `description` — describes the element rather than styling an\n * instance, and is not written onto it.\n *\n * @param {HTMLElement} host\n * @param {JxElement} def\n * @param {JxScope} state\n */\nfunction bindDefinitionHandlers(host: HTMLElement, def: JxElement, state: JxScope) {\n for (const [key, val] of Object.entries(def)) {\n if (key.startsWith(\"on\") && !RESERVED_KEYS.has(key)) {\n bindHandler(host, key, val, state);\n }\n }\n}\n\n/**\n * @param {HTMLElement} el\n * @param {string} key\n * @param {JxDocumentValue | undefined} val\n * @param {JxScope} state\n */\nfunction bindProperty(\n el: HTMLElement,\n key: string,\n val: JxDocumentValue | undefined,\n state: JxScope,\n) {\n const target = elementProperties(el);\n const boundProp = boundPropKey(key, val, state);\n if (boundProp) {\n el.dataset.jxBoundProp = boundProp;\n }\n /* An `<img>` in a document says `{\"tagName\": \"img\", \"src\": \"/hero.jpg\"}`, so `src` arrives HERE\n as a top-level key and is written as a DOM PROPERTY — `attributes: { src }` is the rarer\n spelling. Both are the same reference and both need the same resolution. */\n const asAsset = (resolved: JxScopeValue): JxScopeValue =>\n isString(resolved) ? canvasAssetValue(el.tagName, key, resolved) : resolved;\n /*\n * `className` on an SVGElement is a read-only SVGAnimatedString, so assigning it throws in the\n * strict mode an ES module always runs under. It is the most common Jx element property, so the\n * attribute form is the only one that works on both.\n */\n const write = (resolved: JxScopeValue): void => {\n // Widened to Element: a namespaced node is typed HTMLElement here but is not one at runtime.\n const node: Element = el;\n if (key === \"className\" && !(node instanceof HTMLElement)) {\n node.setAttribute(\"class\", resolved == null ? \"\" : String(resolved));\n return;\n }\n /* An equal write is skipped. A binding re-runs whenever anything it read changes, not only\n when its own result does, and re-setting `value` on a focused control is not free: it can\n move the caret and collapse the selection. A control that already holds the value has\n nothing to learn from being told again. */\n if (target[key] === resolved) {\n return;\n }\n target[key] = resolved;\n };\n if (isRefValue(val)) {\n const refVal = val;\n if (key === \"id\") {\n /* SAFETY: the `id` setter is a WebIDL DOMString attribute, which converts whatever it is\n given to a string itself; the cast only lets the bound value reach that conversion. */\n target[key] = resolveRef(refVal.$ref, state) as string;\n return;\n }\n effect(() => {\n write(asAsset(resolveRef(refVal.$ref, state)));\n });\n return;\n }\n\n // Universal ${} reactivity — template strings in element properties\n if (isTemplateString(val)) {\n const template = val;\n bindTemplate(template, () => {\n write(asAsset(evaluateTemplate(template, state)));\n });\n return;\n }\n\n write(asAsset(val));\n}\n\n/*\n * ─── The Stylesheet Engine ───────────────────────────────────────────────────\n *\n * An authored `style` object becomes REAL CSS RULES, delivered through the document's\n * `adoptedStyleSheets`. Everything below exists to make that true, and the reason it has to be\n * true is a cascade inversion rather than a missing feature.\n *\n * `applyStyle` used to split one style object across two cascade ORIGINS: a top-level scalar went\n * inline (`el.style.color = …`) while an object-valued key became a per-element `<style>` tag. An\n * inline declaration beats any non-`!important` rule, so\n *\n * { \"backgroundColor\": \"#6e0303\", \":hover\": { \"backgroundColor\": \"#15164a\" } }\n *\n * emitted a perfectly correct `:hover` rule that could never win. Nesting was not missing; it was\n * outranked. The one existing defence, `mediaOverriddenProps`, moved a base property out of inline\n * when an `@`-block overrode it — one level deep, `@`-keys only, never `:hover` — which is the\n * shape of the bug rather than a fix for it. Every style assertion in the suite read the `<style>`\n * tag's text, so the inversion was invisible to all of them.\n *\n * With every declaration in a rule, `:hover` versus base is an ordinary equal-specificity pair and\n * source order decides, exactly as it does on the compiled page.\n *\n * **Three sheet roles, because mutation cost scales with sheet size.** Measured in Chrome 152 over\n * 500 styled elements: 500 `<style>` tags cost 86.0ms to build, one adopted sheet with hash dedup\n * costs 1.7ms, and 500 separate adopted sheets cost 6.2ms to build but 84.1ms per style recalc\n * because each one is walked. On the update path (300 value edits, the Style-panel hot path)\n * mutating a rule inside one big shared sheet costs 295.7ms, because Chrome rebuilds the whole\n * sheet's RuleSet on any mutation. So:\n *\n * - the SHARED sheet holds every static, interned rule set and is grown but never rewritten;\n * - a reactive declaration is indirected through a custom property, so the rule is static text\n * and the update writes `el.style.setProperty(\"--jx-r0-0\", v)` — 12.4ms, and independent of\n * sheet size (the same mechanism that makes `${…}` work inside a nested block at all);\n * - the SCRATCH sheet takes the elements under live Studio edit and is rewritten with\n * `replaceSync`, 7.5ms per 100 structural edits against 76.9ms for delete+insert in the big one.\n *\n * **The handle stays `data-jx`, and its value becomes a content hash.** Not a generated class:\n * `applyAttributes` runs after `applyStyle`, so a static `attributes: { class: … }` would wipe a\n * class handle. `data-jx` is already there, is specificity (0,1,0), and is not author-writable.\n * Hashing the built rule text rather than calling `Math.random()` is what gives dedup and SSR\n * stability, and it covers everything that varies per call site by construction — the authored\n * object, the resolved `$media` map and the canvas transposer state are all inputs to that text.\n *\n * **Jx emits no cascade layer of its own.** Third-party CSS arrives through `$head` unlayered, and\n * an unlayered rule beats a layered one at any specificity — so layering Jx's own rules would hand\n * every page's `$head` a win it does not have today. It is also what keeps the canvas's\n * `@layer jx-canvas-ua` UA emulation working now that base declarations are unlayered rules rather\n * than inline styles: unlayered still beats layered, which is the same direction author origin\n * beats UA origin on the shipped page.\n */\n\n/** A rule set as it was written into a sheet: the texts, plus the live rules when there are any. */\ninterface InsertedRules {\n texts: readonly string[];\n rules: CSSRule[];\n}\n\n/** A place rules can be written. Two implementations: the CSSOM, and `<style>` text. */\ninterface StyleSink {\n insert: (texts: readonly string[]) => InsertedRules;\n remove: (inserted: InsertedRules) => void;\n /** Rewrite the whole sink. Used only by the scratch sheet. */\n replaceAll: (texts: readonly string[]) => void;\n /** Everything written, in sheet order. See {@link documentStyleText}. */\n text: () => string;\n detach: () => void;\n}\n\n/**\n * A sink over a real `CSSStyleSheet` — constructable and adopted, or a `<style>` element's own.\n *\n * @param {CSSStyleSheet} sheet\n * @param {() => void} detach\n * @returns {StyleSink}\n */\nfunction cssomSink(sheet: CSSStyleSheet, detach: () => void): StyleSink {\n const entries: InsertedRules[] = [];\n return {\n detach,\n insert(texts) {\n const rules: CSSRule[] = [];\n for (const text of texts) {\n const index = sheet.cssRules.length;\n try {\n sheet.insertRule(text, index);\n } catch {\n /* One unparseable rule must not take the other twenty with it. A `<style>` element drops\n exactly the offending rule and keeps going; `insertRule` throws, so this restores the\n tolerance an author's stylesheet has always had. */\n continue;\n }\n const rule = sheet.cssRules[index];\n if (rule) {\n rules.push(rule);\n }\n }\n const inserted: InsertedRules = { rules, texts };\n entries.push(inserted);\n return inserted;\n },\n remove(inserted) {\n const at = entries.indexOf(inserted);\n if (at !== -1) {\n entries.splice(at, 1);\n }\n if (inserted.rules.length === 0) {\n return;\n }\n /* An index scan of a 302-rule sheet measures 0.04ms, so finding the rules costs nothing next\n to the RuleSet rebuild the deletion itself forces. Descending, or each deletion shifts the\n indices still to be removed. */\n const list = [...sheet.cssRules];\n const indices = inserted.rules\n .map((rule) => list.indexOf(rule))\n .filter((index) => index >= 0)\n .toSorted((a, b) => b - a);\n for (const index of indices) {\n sheet.deleteRule(index);\n }\n inserted.rules.length = 0;\n },\n replaceAll(texts) {\n entries.length = 0;\n entries.push({ rules: [], texts });\n sheet.replaceSync(texts.join(\"\\n\"));\n },\n text() {\n return entries.flatMap((entry) => entry.texts.join(\"\\n\")).join(\"\\n\");\n },\n };\n}\n\n/**\n * The last resort: a `<style>` element whose text is rewritten. No CSSOM required.\n *\n * @param {HTMLStyleElement} tag\n * @returns {StyleSink}\n */\nfunction textSink(tag: HTMLStyleElement): StyleSink {\n const entries: InsertedRules[] = [];\n const write = () => {\n tag.textContent = entries.map((entry) => entry.texts.join(\"\\n\")).join(\"\\n\");\n };\n return {\n detach() {\n tag.remove();\n },\n insert(texts) {\n const inserted: InsertedRules = { rules: [], texts };\n entries.push(inserted);\n write();\n return inserted;\n },\n remove(inserted) {\n const index = entries.indexOf(inserted);\n if (index !== -1) {\n entries.splice(index, 1);\n write();\n }\n },\n replaceAll(texts) {\n entries.length = 0;\n entries.push({ rules: [], texts });\n write();\n },\n text() {\n return tag.textContent;\n },\n };\n}\n\n/**\n * Open a sheet on `doc`, preferring a constructable one.\n *\n * A constructable stylesheet cannot be adopted into another document, which is why the registry\n * below is keyed on the document and never cached at module scope: the Studio iframe, the live\n * preview tab and the parent page each open their own.\n *\n * @param {Document} doc\n * @returns {StyleSink}\n */\nfunction openSink(doc: Document): StyleSink {\n // A window without constructable stylesheets (an older engine, a test DOM) lacks the global.\n const view: (Window & { CSSStyleSheet?: typeof CSSStyleSheet }) | null = doc.defaultView;\n const SheetConstructor = view?.CSSStyleSheet;\n if (isFunction(SheetConstructor) && Array.isArray(doc.adoptedStyleSheets)) {\n try {\n const sheet = new SheetConstructor();\n doc.adoptedStyleSheets = [...doc.adoptedStyleSheets, sheet];\n return cssomSink(sheet, () => {\n doc.adoptedStyleSheets = doc.adoptedStyleSheets.filter((s) => s !== sheet);\n });\n } catch {\n // No constructable stylesheets, or a frozen adoptedStyleSheets. Fall through to a tag.\n }\n }\n const tag = doc.createElement(\"style\");\n tag.dataset.jxSheet = \"\";\n (documentHead(doc) ?? doc.documentElement).append(tag);\n return tag.sheet ? cssomSink(tag.sheet, () => tag.remove()) : textSink(tag);\n}\n\n/**\n * A document's `<head>`, or null when it has none. HTML defines `document.head` as nullable (a\n * document whose root element has no `head` child), though the DOM typings declare it non-null.\n *\n * @param {Document} doc\n * @returns {HTMLHeadElement | null}\n */\nfunction documentHead(doc: Document): HTMLHeadElement | null {\n return doc.head;\n}\n\n/** One interned rule set: the rules as written, and how many elements point at them. */\ninterface InternEntry {\n inserted: InsertedRules;\n refs: number;\n}\n\n/** Everything one document's rules are kept in. */\ninterface SheetState {\n shared: StyleSink;\n /** Opened on the first live edit, and only then — most documents never have one. */\n scratch: StyleSink | null;\n /** Elements living on the scratch sheet, in the order their rules are written. */\n scratchOwners: Map<HTMLElement, readonly string[]>;\n /** Scope handle to the rule set it names. */\n interned: Map<string, InternEntry>;\n /** Declaration-body at-rule text to the one copy of it. */\n hoisted: Map<string, InternEntry>;\n /** Distinguishes `--jx-r<serial>-<n>` variables between elements. */\n serial: number;\n}\n\n/**\n * The per-document registry. A `WeakMap` rather than a module-level singleton because one process\n * renders into several documents (canvas iframe, preview tab, parent) and a constructable sheet\n * belongs to exactly one of them.\n */\nconst sheetStates = new WeakMap<Document, SheetState>();\n\n/**\n * @param {Document} doc\n * @returns {SheetState}\n */\nfunction sheetStateFor(doc: Document): SheetState {\n const existing = sheetStates.get(doc);\n if (existing) {\n return existing;\n }\n const created: SheetState = {\n hoisted: new Map(),\n interned: new Map(),\n scratch: null,\n scratchOwners: new Map(),\n serial: 0,\n shared: openSink(doc),\n };\n sheetStates.set(doc, created);\n return created;\n}\n\n/** What one element holds, so that releasing it is exact rather than approximate. */\ninterface ElementStyleEntry {\n doc: Document;\n /** The state this entry's handles belong to; a reset replaces it and orphans them. */\n state: SheetState;\n uid: string;\n /** The interning key in the shared sheet, or null when the element is on the scratch sheet. */\n interned: string | null;\n /** Hoisted declaration at-rules this element holds a reference to. */\n hoisted: readonly string[];\n /** The `--jx-r…` custom properties its effects write inline. */\n vars: readonly string[];\n /** Stops those effects. */\n stop: (() => void) | null;\n}\n\n/**\n * Per-element style bookkeeping. The replacement for the old `elementStyleTags`, which exported a\n * `<style>` element and let its importers remove it by hand; {@link releaseElementStyles} is the\n * documented teardown in its place, because a rule set is now refcounted and dropping one by hand\n * would either leak it or take it away from another element that shares it.\n */\nconst elementStyles = new WeakMap<HTMLElement, ElementStyleEntry>();\n\n/** The scope handle `buildStyleRules` writes, before the hash of its own output replaces it. */\nconst SCOPE_TOKEN = \"\u0001jx-scope\u0001\";\n\n/**\n * Rewrite the scratch sheet from its owners.\n *\n * `scratchOwners` is a STRONG map — it has to be, since the sheet's whole text is rebuilt from it —\n * so an element only leaves it through {@link releaseElementStyles}. That is not a hole: every way\n * an edited element can go away calls it. `applyStyle` registers it with the enclosing reactive\n * scope, Studio's `disposeSubtree` calls it per element, and `resetDocumentStyles` drops the map\n * wholesale. Sweeping on `isConnected` instead would be wrong rather than merely redundant: an\n * element is routinely styled before it is inserted.\n *\n * Both call sites reach this only once an element is already IN `scratchOwners`, and the only place\n * that happens (`scratchOwners.set`, below) always opens `scratch` first — so it is never still\n * null here.\n *\n * @param {SheetState} state\n */\nfunction rewriteScratch(state: SheetState) {\n state.scratch!.replaceAll([...state.scratchOwners.values()].flat());\n}\n\n/**\n * Drop one reference to an interned rule set, removing its rules when the last one goes.\n *\n * `key` always names an entry `retainInterned` already created: {@link releaseElementStyles}'s two\n * call sites pass back exactly the `entry.interned`/`entry.hoisted` keys it was handed at\n * `retainInterned` time, and a stale `state` (one `resetDocumentStyles` already replaced) is turned\n * away before either call site is reached.\n *\n * @param {SheetState} state\n * @param {Map<string, InternEntry>} table\n * @param {string} key\n */\nfunction releaseInterned(state: SheetState, table: Map<string, InternEntry>, key: string) {\n const entry = table.get(key)!;\n entry.refs -= 1;\n if (entry.refs <= 0) {\n table.delete(key);\n state.shared.remove(entry.inserted);\n }\n}\n\n/**\n * Take one reference to a rule set, inserting it the first time it is asked for.\n *\n * @param {SheetState} state\n * @param {Map<string, InternEntry>} table\n * @param {string} key\n * @param {readonly string[]} texts\n */\nfunction retainInterned(\n state: SheetState,\n table: Map<string, InternEntry>,\n key: string,\n texts: readonly string[],\n) {\n const existing = table.get(key);\n if (existing) {\n existing.refs += 1;\n return;\n }\n table.set(key, { inserted: state.shared.insert(texts), refs: 1 });\n}\n\n/**\n * Release everything {@link applyStyle} gave an element: its rules, its scope handle, and the inline\n * custom properties and effects behind its reactive declarations.\n *\n * This is the teardown API `elementStyleTags` used to stand in for, and it is exported because\n * removing a rule set by hand is no longer possible: sets are shared between elements that style\n * alike, so the only safe removal is a refcounted one. Calling it on an element that has no styles\n * is a no-op, which is what makes `applyStyle` safe to call twice.\n *\n * Callers rarely need it. `applyStyle` registers it with the enclosing reactive scope, so an\n * element discarded by a re-rendering mapped array or a disposed Studio subtree releases itself.\n *\n * @param {HTMLElement} el\n * @param {ElementStyleEntry} [only] - Release only if this is still the element's current entry\n */\nexport function releaseElementStyles(el: HTMLElement, only?: ElementStyleEntry): void {\n const entry = elementStyles.get(el);\n if (!entry || (only !== undefined && entry !== only)) {\n return;\n }\n elementStyles.delete(el);\n entry.stop?.();\n for (const name of entry.vars) {\n el.style.removeProperty(name);\n }\n delete el.dataset.jx;\n /* A `resetDocumentStyles` between the two replaces the state, and its sheets are already gone —\n so the element-local half above always runs and the sheet half is skipped as already done. */\n if (sheetStates.get(entry.doc) !== entry.state) {\n return;\n }\n const { state } = entry;\n if (entry.interned === null) {\n if (state.scratchOwners.delete(el)) {\n rewriteScratch(state);\n }\n } else {\n releaseInterned(state, state.interned, entry.interned);\n }\n for (const key of entry.hoisted) {\n releaseInterned(state, state.hoisted, key);\n }\n}\n\n/**\n * Discard every sheet this runtime opened on a document, and orphan the element entries that point\n * into them.\n *\n * A full re-render replaces the whole tree, so the alternative is a shared sheet that only ever\n * grows. The element `WeakMap` cannot be enumerated to be cleared, so entries are invalidated\n * instead: each one records the `SheetState` it was written into, and a release that finds a\n * different state registered for the document does the element-local half only. That is what stops\n * a surviving element from later handing `deleteRule` an index into a sheet nobody is reading.\n *\n * @param {Document} [doc] - Defaults to the ambient document\n */\nexport function resetDocumentStyles(doc: Document = document): void {\n const state = sheetStates.get(doc);\n if (!state) {\n return;\n }\n sheetStates.delete(doc);\n for (const el of state.scratchOwners.keys()) {\n elementStyles.delete(el);\n delete el.dataset.jx;\n }\n state.scratchOwners.clear();\n state.interned.clear();\n state.hoisted.clear();\n state.shared.detach();\n state.scratch?.detach();\n}\n\n/**\n * The CSS this engine has written into a document, in sheet order.\n *\n * It reports what the engine ASKED the document to adopt, not what the document managed to parse,\n * and the difference is the point: `insertRule` throws on a rule the host cannot parse, and the\n * sink swallows that so one bad rule cannot take the rest of an element's set with it. The test DOM\n * rejects `@position-try` outright, so reading it back off `cssRules` there would report a block\n * that a browser adopts perfectly well as missing.\n *\n * It is also the honest answer to \"what CSS did my style object become\", which is a question the\n * Studio style inspector asks and, before this, nothing could answer without scraping `<style>`\n * tags out of the head.\n *\n * @param {Document} [doc] - Defaults to the ambient document\n * @returns {string} One rule per line, shared sheet first\n * @docs framework/concepts/styling\n */\nexport function documentStyleText(doc: Document = document): string {\n const state = sheetStates.get(doc);\n if (!state) {\n return \"\";\n }\n return [state.shared.text(), state.scratch?.text() ?? \"\"].filter(Boolean).join(\"\\n\");\n}\n\n/**\n * Whether a style object declares `display` anywhere in it.\n *\n * `defineElement` gives a custom element `display: block` because a custom element defaults to\n * `inline` and Jx containers behave like `<div>`. It used to test `this.style.display`, which was a\n * correct test only while the author's own `display` was written inline — the moment it became a\n * rule the guard stopped seeing it and the default started overriding the author. The test is now\n * on the source rather than on the element, and it is a deep one on purpose: an inline default\n * would beat a `:hover` or `@media` `display` just as surely as a base one.\n *\n * A `@keyframes` block is the one thing the walk does NOT descend into. A `display` in a keyframe\n * stop is a point on a timeline, not a declaration on this element — animating `display` is the\n * ordinary shape of an `allow-discrete` reveal — so counting one as the author's own left the\n * element with no `display` at all, and a custom element with no `display` is `inline`. The element\n * laid out wrongly whenever it was still, which is most of the time.\n *\n * @param {JxStyle | undefined} style\n * @returns {boolean}\n */\nfunction declaresDisplay(style: JxStyle | undefined): boolean {\n /* The BASE block only. A deep walk read a `display` that exists solely inside `&:hover` or an\n `@media` block as \"the author supplied one\", so the element stayed `inline` at rest and\n became a block on hover — a live trap rather than a subtlety. An author who wants the\n platform's own default writes `display: revert` in the base block, which this sees. */\n return isNonNullObject(style) && \"display\" in style;\n}\n\n/**\n * The `style` object a USAGE SITE wrote on a custom element, kept until the element connects.\n *\n * Weak in the element, so an instance that is never connected is collected with its entry.\n */\nconst callSiteStyles = new WeakMap<HTMLElement, JxStyle>();\n\n/**\n * Merge two style objects, `over` winning.\n *\n * Deep, because a nested selector block is a rule of its own: a call site that declares `&:hover`\n * must not delete the definition's `&:hover`, only the declarations it repeats inside it. A scalar\n * always replaces, which is what \"the call site wins\" means.\n *\n * @param base The definition's style.\n * @param over The usage site's, if any.\n * @returns {JxStyle} A new object; neither argument is mutated.\n */\nfunction mergeStyle(base: JxStyle, over: JxStyle | undefined): JxStyle {\n if (!over) {\n return base;\n }\n const out: JxStyle = { ...base };\n for (const [key, value] of Object.entries(over)) {\n const prior = out[key];\n /* A block merges into whatever object the definition holds there. A repeated-block list is\n spread to its index keys first, which is what spreading it as a style object always did. */\n out[key] =\n isNestedStyle(value) && isNonNullObject(prior)\n ? mergeStyle(\n Array.isArray(prior) ? Object.fromEntries(Object.entries(prior)) : prior,\n value,\n )\n : value;\n }\n return out;\n}\n\n/**\n * Turn an element's `style` object into CSS rules and adopt them.\n *\n * Nothing is written inline except the `--jx-r…` custom properties that carry reactive values, so\n * an authored `:hover`, `@media` or `@supports` block overrides its own base declaration by\n * ordinary cascade rules — which is what the emitted CSS always said and the inline write always\n * prevented. See the engine essay above for the sheet roles and the measurements behind them.\n *\n * Calling it twice on one element is safe: the first call's rules are released first.\n *\n * @param {HTMLElement} el\n * @param {JxStyle} styleDef\n * @param {Record<string, string>} [mediaQueries] Named breakpoints from root $media. Default is\n * `{}`\n * @param {JxScope} [state] Component scope for template string evaluation. Default is `{}`\n * @docs framework/concepts/styling\n */\nexport function applyStyle(\n el: HTMLElement,\n styleDef: JxStyle,\n mediaQueries: Record<string, string> = {},\n state: JxScope = {},\n) {\n applyStyleInto(el, styleDef, mediaQueries, state, false);\n}\n\n/**\n * Re-apply an element's style definition in place.\n *\n * The Studio Style panel calls this per keystroke, so its rules go to the SCRATCH sheet, which is\n * rewritten whole with `replaceSync` rather than edited rule by rule inside the shared one: 7.5ms\n * per 100 structural edits against 76.9ms. The previous rule set is released first — without that\n * this would leak a set into the shared sheet on every keypress, which is the opposite of the\n * `<style>`-tag leak it replaced.\n *\n * Inline styles are NOT cleared wholesale any more. `el.style.cssText = \"\"` also destroyed an\n * author's own `attributes: { style: \"…\" }` and would now take the custom-element `display` default\n * with it; only the `--jx-r…` properties this engine wrote are removed.\n *\n * @param {HTMLElement} el\n * @param {JxStyle | undefined} styleDef\n * @param {Record<string, string>} [mediaQueries]\n * @param {JxScope} [state]\n */\nexport function reapplyStyle(\n el: HTMLElement,\n styleDef: JxStyle | undefined,\n mediaQueries: Record<string, string> = {},\n state: JxScope = {},\n) {\n applyStyleInto(el, styleDef ?? {}, mediaQueries, state, true);\n}\n\n/**\n * @param {HTMLElement} el\n * @param {JxStyle} styleDef\n * @param {Record<string, string>} mediaQueries\n * @param {JxScope} state\n * @param {boolean} live - Write to the scratch sheet (the Studio edit path) rather than intern\n */\nfunction applyStyleInto(\n el: HTMLElement,\n styleDef: JxStyle,\n mediaQueries: Record<string, string>,\n state: JxScope,\n live: boolean,\n) {\n releaseElementStyles(el);\n const doc = el.ownerDocument;\n const sheetState = sheetStateFor(doc);\n\n /* One gate for the whole call, so every recursion answers alike. Off in production and in\n preview, where the selector is written exactly as authored.\n\n The SAME predicate the attribute rename uses, and it has to be: an attribute renamed without\n its selectors transposed is a panel that can never be styled open. They disagreed while the\n rename learned to reach inside a defined element and this did not, so a kit popover rendered\n within another definition's template would have been de-linked and then left with a\n `:popover-open` rule that could no longer match. */\n const transposeSelector =\n (_canvasDelinkPopovers || _canvasDelinkCommands) && canvasStamped(el)\n ? (selector: string) =>\n transposeCanvasOverlaySelector(selector, {\n dialog: el.tagName === \"DIALOG\",\n })\n : (selector: string) => selector;\n\n /* Reactive declarations become `var()` reads of a custom property this element sets inline. The\n variable inherits, which is correct, and the declaration stays in the rule where `:hover` can\n override it. The serial keeps two elements' variables apart: a descendant rule reads `var()`\n from the nearest ancestor that set it, and without it a styled child would shadow its parent's\n `--jx-r0` with its own. Only a DESCENDANT rule needs that: a self-target declaration reads the\n variable the element itself sets, so it is named by position alone (`--jx-s<n>`) and elements\n that style alike keep sharing one rule set. */\n let serial = -1;\n let indirect = 0;\n const sources: { name: string; value: string | JxRef }[] = [];\n const rules = buildStyleRules(styleDef, {\n mediaQueries,\n resolveValue: (property, value, target) => {\n /* A reactive value on a CUSTOM PROPERTY, in a rule targeting the element itself, is written\n inline under the AUTHOR'S OWN NAME and contributes no declaration. That keeps the rule\n text free of anything per-element, so every row of a repeater interns ONE rule instead of\n one each: the serial below is in the rule text, the interning handle is a hash of that\n text, and so no two reactive elements could ever share a rule set. Measured before this:\n three font rows produced three handles and three rules.\n The declaration that READS the variable — `font-family: var(--row-face, inherit)` — lives\n in the owning element's own style, is identical across rows, and interns once.\n Only a SELF-target rule qualifies. A descendant rule keeps the indirection, because its\n variable must not be set on the element that carries the rule: a `var()` resolves from the\n nearest ancestor that set it, and a shared descendant rule would read the wrong one. */\n if (target === \"self\" && property.startsWith(\"--\")) {\n sources.push({ name: property, value });\n return null;\n }\n /* Counted separately from `sources`, so an inline custom property before it cannot shift the\n name of an indirected one. The name is IN the rule text, and the interning handle is a\n hash of that text — a number that moved with unrelated declarations would give two\n otherwise identical styles two rules. */\n let name: string;\n if (target === \"self\") {\n /* A SELF-target rule reads its variable from the element that sets it inline, which is\n this element — no ancestor's value can reach it — so the name needs no serial, only its\n position. Without this, every instance of a definition with one reactive declaration\n (the kit's tree row binds its indent) interned a rule set of its own: an Outline\n scrolling through a long page minted fifteen rules per row and grew the shared sheet\n past fourteen thousand, slowing every insert and every style recalculation after. */\n name = `--jx-s${indirect}`;\n } else {\n if (serial < 0) {\n ({ serial } = sheetState);\n sheetState.serial += 1;\n }\n name = `--jx-r${serial}-${indirect}`;\n }\n indirect += 1;\n sources.push({ name, value });\n return `var(${name})`;\n },\n scope: SCOPE_TOKEN,\n transposeSelector,\n transposeValue: canvasStyleValue,\n });\n /* `sources.length` too, not `rules.length` alone: a style whose ONLY reactive declaration is a\n custom property on the element itself emits no rule at all, and returning here would install\n no effect, so the variable would be written once and never track its source again. */\n if (rules.length === 0 && sources.length === 0) {\n return;\n }\n\n /* Declaration-body at-rules declare a document-global NAME — `@position-try --flip`,\n `@font-face` — so they are written once for the whole document and refcounted, rather than\n once per element that mentions them. */\n const scoped = rules.filter((rule) => rule.target !== \"unscoped\");\n const unscoped = rules.filter((rule) => rule.target === \"unscoped\");\n for (const rule of unscoped) {\n retainInterned(sheetState, sheetState.hoisted, rule.text, [rule.text]);\n }\n\n const uid = `jx-${hashCss(scoped.map((rule) => rule.key).join(\"|\"))}`;\n const texts = scoped.map((rule) => rule.text.replaceAll(SCOPE_TOKEN, `[data-jx=\"${uid}\"]`));\n if (texts.length > 0) {\n el.dataset.jx = uid;\n if (live) {\n sheetState.scratch ??= openSink(doc);\n sheetState.scratchOwners.set(el, texts);\n rewriteScratch(sheetState);\n } else {\n retainInterned(sheetState, sheetState.interned, uid, texts);\n }\n }\n\n const entry: ElementStyleEntry = {\n doc,\n hoisted: unscoped.map((rule) => rule.text),\n interned: texts.length > 0 && !live ? uid : null,\n state: sheetState,\n stop: null,\n uid,\n vars: sources.map((source) => source.name),\n };\n if (sources.length > 0) {\n const scope = effectScope();\n scope.run(() => {\n for (const { name, value } of sources) {\n effect(() => {\n const resolved = isRefValue(value)\n ? resolveRef(value.$ref, state)\n : evaluateTemplate(value, state);\n el.style.setProperty(name, canvasStyleValue(String(resolved ?? \"\")));\n });\n }\n });\n entry.stop = () => scope.stop();\n }\n elementStyles.set(el, entry);\n /* Ties the rules to the render that made them: a mapped array's discarded generation, or a\n Studio subtree being replaced, stops its scope and the rule set goes with it. Guarded on the\n entry so a later `reapplyStyle` is not undone by an older scope disposing after it. */\n onScopeDispose(() => releaseElementStyles(el, entry), true);\n}\n\n/*\n * HTML carries a boolean two incompatible ways, and writing one as the other inverts it in silence.\n *\n * A *boolean attribute* — `open`, `disabled`, `hidden`, `required` — is read by PRESENCE. Any value\n * at all counts as true, `\"false\"` included, so `<details open=\"false\">` is an OPEN `<details>`.\n * The value must never be written; absence is the only way to say false.\n *\n * An *enumerated* attribute carries the word in its own text and reads an empty value as unset, so\n * the presence form is the broken one here: bare `aria-hidden` is NOT hidden, and a dropped\n * `contenteditable` means \"inherit from the parent\" rather than `false`. Every `aria-*` is in this\n * family — ARIA has no presence attributes at all — along with the three HTML attributes below.\n *\n * **`popover` is enumerated and is deliberately NOT in this set**, which looks like an oversight\n * and is not. Its keywords are `auto`, `manual` and `hint`; its MISSING-value default is `auto`, so\n * a bare `popover` and `popover=\"\"` are both auto popovers — which is what the presence branch\n * below already produces for `true`, correctly. Its INVALID-value default is `manual`, so moving it\n * here would emit `popover=\"true\"`, which is not a keyword, and every popover written as a boolean\n * would silently stop light-dismissing and stop answering Escape. The right answer to a boolean\n * `popover` is not a different emission, it is not writing one: `@jxsuite/schema/overlays` reports\n * it as `invalid-mode`, and the house spelling is `\"auto\"`.\n *\n * That also corrects the paragraph above for this one attribute: a presence attribute counts any\n * value as true, but `popover=\"false\"` is a *manual* popover rather than a true-ish one, because it\n * is enumerated even though it is emitted through the presence branch.\n *\n * @docs framework/concepts/elements\n */\nconst ENUMERATED_ATTRS = new Set([\"contenteditable\", \"draggable\", \"spellcheck\"]);\n\n/**\n * The enumerated-attribute names, for a code generator that cannot import this module.\n *\n * The compiler's element and client targets emit standalone ES modules that a built site loads\n * without `@jxsuite/runtime`, so they inline the boolean decision instead of calling it. They\n * serialize THIS array into that inlined helper, and `compile-element.test.ts` asserts the emitted\n * literal still equals it — which is what keeps the four writers of the rule one decision rather\n * than four, in the one place a shared function could not reach.\n *\n * @returns {string[]} The names, sorted, so the emitted output is stable.\n */\nexport function enumeratedAttrNames(): string[] {\n return [...ENUMERATED_ATTRS].toSorted();\n}\n\n/**\n * The text an attribute's boolean value must be written with, or `null` when saying it means\n * removing the attribute instead.\n *\n * An empty string is the bare form: `setAttribute(name, \"\")` is how the DOM spells the `open` that\n * HTML source writes with no `=`.\n *\n * Shared rather than restated because two renderers must agree. The compiler writes attributes into\n * a string of HTML and this file writes them onto live elements; were they to disagree about which\n * family an attribute belongs to, a prerendered page would change meaning as it hydrated.\n *\n * @param {string} name - Attribute name, already resolved to what will be written\n * @param {boolean} value - The resolved boolean\n * @returns {string | null} Text to write, or null to omit the attribute\n */\nexport function booleanAttrValue(name: string, value: boolean): string | null {\n const lower = name.toLowerCase();\n if (lower.startsWith(\"aria-\") || ENUMERATED_ATTRS.has(lower)) {\n return String(value);\n }\n return value ? \"\" : null;\n}\n\n/**\n * @param {HTMLElement} el\n * @param {Record<string, import(\"@jxsuite/schema/types\").JxAttributeValue>} attrs\n * @param {JxScope} state\n */\nfunction applyAttributes(el: HTMLElement, attrs: Record<string, JxAttributeValue>, state: JxScope) {\n for (const [k, v] of Object.entries(attrs)) {\n const attr = canvasAttrName(el, k);\n /* Inside the effects, not before them. A `$ref` or `${…}` value is not a string until the\n effect runs — which is exactly why the document walk this replaced could never see it. */\n const write = (resolved: JxScopeValue) => {\n if (resolved === null || resolved === undefined) {\n /* Nothing is an attribute the element does not have. A binding that resolves to `null`\n has to take the attribute WITH it, for the same reason a `false` does below — and an\n `aria-checked=\"\"` or `title=\"\"` left behind is not absence, it is a wrong value. */\n el.removeAttribute(attr);\n return;\n }\n if (isBoolean(resolved)) {\n const text = booleanAttrValue(attr, resolved);\n /* `removeAttribute`, not `setAttribute(attr, \"false\")`. A binding that flips back has to\n take the attribute WITH it: the element is being re-used, so anything left behind is the\n state the page just said it had left. Asset rewriting is skipped because a boolean names\n no asset — `canvasAssetValue` reads `src`/`href` values, which are never booleans. */\n if (text === null) {\n el.removeAttribute(attr);\n } else {\n el.setAttribute(attr, text);\n }\n return;\n }\n el.setAttribute(attr, canvasAssetValue(el.tagName, k, String(resolved)));\n };\n if (isRefValue(v)) {\n effect(() => write(resolveRef(v.$ref, state)));\n } else if (isTemplateString(v)) {\n bindTemplate(v, () => write(evaluateValueTemplate(v, state)));\n } else {\n write(v);\n }\n }\n}\n\n// ─── Array mapping ────────────────────────────────────────────────────────────\n\n/**\n * Render a mapped array (repeater) wrapper-less: its item instances are inserted directly into\n * `parentEl`, in place, ahead of an anchor comment that marks the array's position among the\n * parent's other children.\n *\n * Rows are RECONCILED, not rebuilt. Each row is keyed — by the `key` pointer the array declares,\n * else by its index — and owns a detached effect scope and a reactive `$map` context. When `items`\n * (or the filter/sort sources, or a key) change, a row whose key survives keeps its node and its\n * effects: a reorder moves the node, an insertion creates only the new rows, a removal stops only\n * the removed ones, and a moved row's `$map.index` is updated in place. That is what lets focus,\n * scroll position and a half-typed value survive a change to the list.\n *\n * Reads made while a row is constructed are made with tracking PAUSED. `effectScope.run()` does not\n * reset the active subscriber, so without this every top-level read a row performs — a `$props`\n * write, a tag discriminant, a `$`-local — subscribed the LIST effect, and one row's data changing\n * rebuilt the whole list. The bindings inside a row are effects of their own and re-enable tracking\n * when they run, so a row still updates itself.\n *\n * `options._path` is the array node's own document path (`[…, \"children\", i]`, or `[…, \"children\"]`\n * for a legacy whole-children repeater); item instances render at `[…that…, \"map\", index]`, and a\n * row that moves reports its new path through `options.onNodeMoved`.\n *\n * @param {HTMLElement} parentEl\n * @param {import(\"@jxsuite/schema/types\").JxMappedArray} arrayDef\n * @param {JxScope} state\n * @param {JxRenderOptions} [options]\n */\nfunction renderMappedArrayInto(\n parentEl: HTMLElement,\n arrayDef: JxMappedArray,\n state: JxScope,\n options?: JxRenderOptions,\n) {\n const path = options?._path ?? [];\n const anchor = document.createComment(\"jx-array\");\n parentEl.append(anchor);\n const { items: itemsSrc, map: mapDef, filter: filterRef, sort: sortRef, key: keyRef } = arrayDef;\n const keyPointer = isRefValue(keyRef) ? keyRef.$ref : null;\n /* The instantiation chain the list belongs to (spec.md §16.9), for the same reason\n {@link renderSwitch} keeps one: a row that arrives with new data is inserted from an effect\n re-run, and the instance it holds must connect under the chain of the definition that drew\n the list. */\n const instancePath = _instancePath;\n\n let warned = false;\n const warnOnce = (message: string): void => {\n if (!warned) {\n warned = true;\n console.warn(`Jx $map: ${message}`);\n }\n };\n\n /** The rows currently rendered, in DOM order. */\n let rows: MappedRow[] = [];\n\n /* Out of the document FIRST, then stopped: stopping releases every element's styles\n (`releaseElementStyles`), and on a connected node each of those inline-property and `data-jx`\n writes schedules a style invalidation for a node that is about to leave. Detached, they are\n plain writes. See `dispose` in `mount`. */\n const teardown = (row: MappedRow): void => {\n row.node.remove();\n row.scope.stop();\n };\n\n const createRow = (\n key: MappedRow[\"key\"],\n item: MappedRow[\"map\"][\"item\"],\n index: number,\n ): MappedRow => {\n const map = shallowReactive({ index, item });\n const child = inheritScope(state);\n bindLocal(child, \"$map\", map);\n // The flat aliases stay readable by legacy readers, and follow the reactive context.\n Object.defineProperty(child, \"$map/item\", { enumerable: true, get: () => map.item });\n Object.defineProperty(child, \"$map/index\", { enumerable: true, get: () => map.index });\n const scope = effectScope(true);\n const childOpts = options ? { ...options, _path: [...path, \"map\", index] } : undefined;\n const node = scope.run(() => renderNode(mapDef!, child, childOpts))!;\n return { key, map, node, scope };\n };\n\n const reconcile = (list: readonly JxScopeValue[], keys: readonly MappedRow[\"key\"][]): void => {\n const previous = new Map<MappedRow[\"key\"], MappedRow>();\n for (const row of rows) {\n previous.set(row.key, row);\n }\n const next: MappedRow[] = [];\n for (let index = 0; index < list.length; index++) {\n const key = keys[index];\n const item = list[index];\n const existing = previous.get(key);\n if (existing) {\n previous.delete(key);\n if (existing.map.item !== item) {\n existing.map.item = item;\n }\n if (existing.map.index !== index) {\n existing.map.index = index;\n options?.onNodeMoved?.(existing.node, [...path, \"map\", index]);\n }\n next.push(existing);\n } else {\n next.push(createRow(key, item, index));\n }\n }\n // Whatever was not claimed is gone.\n for (const row of previous.values()) {\n teardown(row);\n }\n /* Order in one forward pass. The cursor walks the kept nodes in their current order; a row\n already under the cursor is in place, anything else is inserted before it — a new node, or\n a kept node moved forward. Only rows that are out of place move, and a move is the one thing\n that can cost a focused element its focus. */\n let cursor: ChildNode = rows.find((row) => !previous.has(row.key))?.node ?? anchor;\n for (const row of next) {\n if (row.node === cursor) {\n cursor = cursor.nextSibling ?? anchor;\n continue;\n }\n cursor.before(row.node);\n }\n rows = next;\n };\n\n const update = (): void => {\n let items: JxScopeValue = isRefValue(itemsSrc) ? resolveRef(itemsSrc.$ref, state) : itemsSrc;\n if (Array.isArray(items) && isRefValue(filterRef)) {\n const fn = resolveRef(filterRef.$ref, state);\n if (isFunction(fn)) {\n /* SAFETY: the guard proved a function, and a function accepts any call: `Array#filter`\n passes each item (with its index and the list) and reads only the result's truthiness. */\n items = items.filter(fn as (item: MappedRow[\"map\"][\"item\"]) => boolean);\n }\n }\n if (Array.isArray(items) && isRefValue(sortRef)) {\n const fn = resolveRef(sortRef.$ref, state);\n if (isFunction(fn)) {\n /* SAFETY: the guard proved a function, and a function accepts any call: `toSorted` passes\n two items and orders by the sign of the number the comparator returns. */\n const compare = fn as (a: MappedRow[\"map\"][\"item\"], b: MappedRow[\"map\"][\"item\"]) => number;\n const unsorted: readonly JxScopeValue[] = items;\n items = [...unsorted].toSorted(compare);\n }\n }\n const list: readonly JxScopeValue[] = Array.isArray(items) && mapDef ? items : [];\n\n // Keys are read HERE, tracked, so a key that changes reconciles the list.\n const keys = list.map((item, index) => mappedRowKey(keyPointer, item, index, warnOnce));\n const seen = new Set<MappedRow[\"key\"]>();\n for (let i = 0; i < keys.length; i++) {\n if (seen.has(keys[i])) {\n warnOnce(\n `duplicate key ${String(keys[i])} — every occurrence after the first is rebuilt on each change`,\n );\n keys[i] = { duplicate: i };\n } else {\n seen.add(keys[i]);\n }\n }\n\n pauseTracking();\n try {\n underInstancePath(reexpand(instancePath), () => reconcile(list, keys));\n } finally {\n resetTracking();\n }\n };\n\n /* The first render is synchronous; every re-render is coalesced into ONE microtask. A reactive\n array mutated in place — `reverse()`, `sort()`, an index write — triggers once per element it\n touches, and an effect run between two of those writes sees an array that is half of each\n state: a row that is transiently absent would be torn down and then rebuilt, which is exactly\n the identity loss keys exist to prevent. Deferring to a microtask is what a framework scheduler\n does for the same reason; a row's own bindings stay synchronous. */\n let queued = false;\n let stopped = false;\n const runner = effect(update, {\n scheduler: () => {\n if (queued) {\n return;\n }\n queued = true;\n queueMicrotask(() => {\n queued = false;\n if (!stopped) {\n runner();\n }\n });\n },\n });\n\n onScopeDispose(() => {\n stopped = true;\n for (const row of rows) {\n teardown(row);\n }\n rows = [];\n }, true);\n}\n\n/** A rendered row of a mapped array. */\ninterface MappedRow {\n key: JxScopeValue;\n /** The row's `$map` context; `item` and `index` are written in place when the row is reused. */\n map: JxRowContext;\n node: HTMLElement | Text;\n scope: EffectScope;\n}\n\n/**\n * The identity a `key` pointer names for one item: the item itself for `$map/item`, a value read\n * off it for `$map/item/<path>`. Anything else is not a key — an index names a position, not a row\n * — and a key that evaluates to nothing cannot tell rows apart, so both fall back to the index.\n */\nfunction mappedRowKey(\n pointer: string | null,\n item: MappedRow[\"map\"][\"item\"],\n index: number,\n warnOnce: (message: string) => void,\n): MappedRow[\"key\"] {\n if (pointer === null) {\n return index;\n }\n if (pointer === \"$map/item\") {\n return item;\n }\n if (pointer.startsWith(\"$map/item/\")) {\n const key = readPath(item, pointer.slice(\"$map/item/\".length));\n if (key === undefined || key === null) {\n warnOnce(`key \"${pointer}\" is empty for some items — those rows fall back to their index`);\n return index;\n }\n return key;\n }\n warnOnce(`key \"${pointer}\" is not a $map/item pointer — rows fall back to their index`);\n return index;\n}\n\n/**\n * An element's tag: a name, or the branch of a {@link JxTagExpression} the state selects.\n *\n * Every branch of the expression is itself a `TagName`, so this can only ever return something the\n * schema already held to the tag-name pattern — the property that lets the compiler enumerate the\n * candidates and lets `createElement` be called without a second thought here.\n *\n * @param {TagNameSlot} tagName The element's declared tag.\n * @param {JxScope} scope The state the discriminant reads.\n * @returns {string} A literal tag name; `\"div\"` when nothing is declared.\n */\nexport function resolveTagName(tagName: TagNameSlot, scope: JxScope): string {\n if (isString(tagName)) {\n return tagName;\n }\n if (!isTagExpression(tagName)) {\n return \"div\";\n }\n const expression = tagName.$expression;\n if (expression.operator === \"?:\") {\n // `evaluateOperand`, not `evaluateExpression`: the discriminant is an OPERAND — a pointer, a\n // Literal or a nested node — exactly as it is for a `$switch`, whose docstring names this.\n return evaluateOperand(expression.target, scope, null) ? expression.value : expression.initial;\n }\n const key = evaluateOperand(expression.target, scope, null);\n return expression.cases[String(key)] ?? expression.default;\n}\n\n// ─── $switch ──────────────────────────────────────────────────────────────────\n\n/**\n * @param {JxElement} def\n * @param {JxScope} state\n * @param {JxRenderOptions} [options]\n * @returns {HTMLElement}\n */\nfunction renderSwitch(def: JxElement, state: JxScope, options?: JxRenderOptions) {\n const path = options?._path ?? [];\n const container = document.createElement(resolveTagName(def.tagName, state));\n /* The instantiation chain this switch belongs to (spec.md §16.9), read now because the effect\n below re-runs with nothing on the stack. A case that flips after the first paint puts it back\n around the insertion, so an instance the new case creates connects under the chain of the\n definition that drew the switch rather than under none. See {@link _instancePath}. */\n const instancePath = _instancePath;\n\n if (options?.onNodeCreated) {\n options.onNodeCreated(container, path, def, state);\n }\n\n applyProperties(container, def, state);\n applyStyle(container, def.style ?? {}, scopeMedia(state), state);\n applyAttributes(container, def.attributes ?? {}, state);\n /* Every case renders in a detached scope of its own, stopped before the next case renders and\n when the container's own scope stops. A generation counter names the case a pending external\n load belongs to; it moves on EVERY change — an inline case included — so a load that resolves\n after the discriminant moved on cannot paint over what replaced it. */\n let generation = 0;\n let live: EffectScope | null = null;\n /* The key the rendered case was chosen by. A discriminant that re-resolves to the SAME key keeps\n its case: the subtree, its effects and its state — an open submenu, a half-typed value —\n survive. Without this a mapped row whose item was replaced by an equal one (a host rebuilding\n its projection) rebuilt every switch inside it, and the popover the case rendered closed. */\n let renderedKey: string | null = null;\n const retire = (): void => {\n live?.stop();\n live = null;\n };\n\n effect(() => {\n if (!isRefValue(def.$switch)) {\n // Detached before it is stopped, for the reason `teardown` in `renderMappedArray` gives.\n container.replaceChildren();\n retire();\n generation += 1;\n return;\n }\n const key = String(resolveRef(def.$switch.$ref, state));\n if (key === renderedKey) {\n return;\n }\n renderedKey = key;\n /* `replaceChildren()` rather than `innerHTML = \"\"`: identical semantics, and it is not a\n Trusted Types injection sink — under `require-trusted-types-for 'script'` an innerHTML write\n needs a policy even when the string is empty. Four sinks that were never injecting anything\n is four fewer things a policy has to be permissive about. Detached BEFORE the case is\n stopped, for the reason `teardown` in `renderMappedArray` gives. */\n container.replaceChildren();\n retire();\n generation += 1;\n const caseDef = def.cases?.[key];\n if (!caseDef) {\n return;\n }\n const gen = generation;\n const scope = effectScope(true);\n live = scope;\n const childOpts = options ? { ...options, _path: [...path, \"cases\", key] } : undefined;\n\n if (isRefValue(caseDef)) {\n // External $ref — fetch and render asynchronously, against the mount's base so a bundled\n // Document need not live at the page URL.\n const { href } = new URL(caseDef.$ref, options?._ctx?.base ?? location.href);\n resolve(href, options?._ctx)\n .then(async (doc) => {\n if (gen !== generation) {\n return;\n }\n const childScope = await buildScope(doc, {}, href, options?._ctx);\n if (gen !== generation) {\n return;\n }\n container.replaceChildren();\n underInstancePath(reexpand(instancePath), () =>\n scope.run(() => container.append(renderNode(doc, childScope, childOpts))),\n );\n })\n .catch((error) =>\n console.error(\"Jx $switch: failed to load external case\", caseDef.$ref, error),\n );\n return;\n }\n\n // Tracking is paused for the same reason it is for a mapped row: a top-level read the case\n // Makes while it renders must not subscribe THIS effect, or the case re-renders on every\n // Change to anything it read. The bindings inside it track for themselves.\n pauseTracking();\n try {\n underInstancePath(reexpand(instancePath), () =>\n scope.run(() => container.append(renderNode(caseDef, state, childOpts))),\n );\n } finally {\n resetTracking();\n }\n });\n onScopeDispose(retire, true);\n\n return container;\n}\n\n// ─── Prototype namespaces (Shape 5) ──────────────────────────────────────────\n\n/**\n * `ref()`, for a value that is one scope member: the same function, under a signature that says so.\n *\n * `ref`'s own return type unwraps its argument's type recursively, and over the recursive\n * `JxScopeValue` union (an array of scope values holds scope values) that unwrapping never\n * terminates (TS2589). The value goes in as it is, so the ref is typed as holding a scope member.\n */\nconst scopeRef: (value: JxScopeValue) => Ref<JxScopeValue> = ref;\n\n/**\n * Resolve a $prototype definition into a value for the reactive scope.\n *\n * Returns a ref() for async/persistent entries (Request, Storage, Cookie, IndexedDB), or a plain\n * value for simple entries (Set, Map, FormData, Blob).\n *\n * @param {JxPrototypeDef} def - State entry with $prototype\n * @param {JxScope} state - Reactive scope proxy\n * @param {string} key - Def key (for diagnostics)\n * @param {string} [base] - Base URL for resolving $src imports\n * @returns {Promise<JxScopeValue>}\n */\nexport async function resolvePrototype(\n def: JxPrototypeDef,\n state: JxScope,\n key: string,\n base?: string,\n ctx?: JxContext,\n) {\n // ── External class via $src ─────────────────────────────────────────────────\n if (def.$src) {\n return resolveExternalPrototype(def, state, key, base);\n }\n\n switch (def.$prototype) {\n case \"Request\": {\n const s: Ref<JxScopeValue> = ref(null);\n const debounceMs = def.debounce ?? 0;\n let debounceTimer: ReturnType<typeof setTimeout> | null = null;\n\n if (!def.manual && !(ctx?.skipAutoRequests ?? _autoRequestConfig.skip)) {\n effect(() => {\n let url: string | undefined;\n if (isTemplateString(def.url)) {\n url = evaluateTemplate(def.url, state);\n } else {\n ({ url } = def);\n }\n if (!url || url === \"undefined\" || url.includes(\"undefined\")) {\n return;\n }\n\n const controller = new AbortController();\n onEffectCleanup(() => {\n controller.abort();\n if (debounceTimer !== null) {\n clearTimeout(debounceTimer);\n }\n });\n\n const doFetch = () => {\n holdTemplateErrorsFor(\n fetch(url, {\n method: def.method ?? \"GET\",\n signal: controller.signal,\n ...(def.headers && { headers: def.headers }),\n ...(def.body && {\n body: isNonNullObject(def.body) ? JSON.stringify(def.body) : def.body,\n }),\n })\n .then((r): Promise<JsonValue> => (r.ok ? r.json() : Promise.reject(r.statusText)))\n .then((d) => {\n s.value = d;\n })\n .catch((error) => {\n if (!(error instanceof Error && error.name === \"AbortError\")) {\n s.value = { error: String(error) };\n }\n }),\n );\n };\n\n if (debounceMs > 0) {\n debounceTimer = setTimeout(doFetch, debounceMs);\n } else {\n doFetch();\n }\n });\n }\n\n return s;\n }\n\n case \"URLSearchParams\": {\n return computed(() => {\n const p: Record<string, string> = {};\n for (const [k, v] of Object.entries(def)) {\n if (k !== \"$prototype\") {\n /* SAFETY: the record goes straight to `URLSearchParams`, whose WebIDL record<USVString,\n USVString> conversion stringifies every value itself; a bound number or boolean\n reaches that conversion exactly as it always has. */\n p[k] = (\n isRefValue(v)\n ? resolveRef(v.$ref, state)\n : isTemplateString(v)\n ? evaluateTemplate(v, state)\n : v\n ) as string;\n }\n }\n return new URLSearchParams(p).toString();\n });\n }\n\n case \"LocalStorage\":\n case \"SessionStorage\": {\n const store = def.$prototype === \"LocalStorage\" ? localStorage : sessionStorage;\n const k = def.key ?? key;\n let init: JxScopeValue;\n try {\n const s = store.getItem(k);\n /* SAFETY: `JSON.parse` answers the JSON value the stored text encodes, or throws, which the\n catch below answers with the entry's default. */\n init = s !== null ? (JSON.parse(s) as JsonValue) : (def.default ?? null);\n } catch {\n init = def.default ?? null;\n }\n const storageState = scopeRef(init);\n // Persist on change\n effect(() => {\n const v = storageState.value;\n if (v === null) {\n try {\n store.removeItem(k);\n } catch {}\n } else {\n try {\n store.setItem(k, JSON.stringify(v));\n } catch {}\n }\n });\n return storageState;\n }\n\n case \"Cookie\": {\n const name = def.name ?? key;\n const read = (): JsonValue => {\n const raw = readCookie(document.cookie, name);\n if (raw === null) {\n return null;\n }\n try {\n /* SAFETY: `JSON.parse` answers the JSON value the cookie encodes, or throws, which the\n catch below answers with the raw text. */\n return JSON.parse(decodeURIComponent(raw)) as JsonValue;\n } catch {\n return raw;\n }\n };\n const cookieState = scopeRef(read() ?? def.default ?? null);\n // Persist on change\n effect(() => {\n /* SAFETY: the store is seeded with JSON (`read` parses it, `default` is JSON) and holds\n what the page writes back; `serializeCookie` reads it only through `JSON.stringify`,\n which is defined for any value and keeps exactly the JSON a cookie can carry. */\n // oxlint-disable-next-line unicorn/no-document-cookie -- the Cookie $prototype IS the cookie store binding\n document.cookie = serializeCookie(name, cookieState.value as JsonValue, def);\n });\n return cookieState;\n }\n\n case \"IndexedDB\": {\n const idbState: Ref<JxScopeValue> = ref(null);\n const {\n database,\n store,\n version = 1,\n keyPath = \"id\",\n autoIncrement = true,\n indexes = [],\n } = def;\n if (!database || !store) {\n throw new Error(`Jx: IndexedDB entry '${key}' requires database and store`);\n }\n const req = indexedDB.open(database, version);\n req.addEventListener(\"upgradeneeded\", (e) => {\n // SAFETY: an open request's events are dispatched at the request itself.\n const db: IDBDatabase = (e.target as IDBOpenDBRequest).result;\n if (!db.objectStoreNames.contains(store)) {\n const os = db.createObjectStore(store, { autoIncrement, keyPath });\n for (const i of indexes) {\n os.createIndex(i.name, i.keyPath, { unique: i.unique ?? false });\n }\n }\n });\n req.addEventListener(\"success\", (e) => {\n // SAFETY: an open request's events are dispatched at the request itself.\n const db: IDBDatabase = (e.target as IDBOpenDBRequest).result;\n idbState.value = {\n database,\n getStore: (mode: IDBTransactionMode = \"readwrite\") =>\n Promise.resolve(db.transaction(store, mode).objectStore(store)),\n isReady: true,\n store,\n version,\n };\n });\n req.addEventListener(\"error\", () => {\n idbState.value = { error: req.error?.message };\n });\n return idbState;\n }\n\n case \"Set\": {\n return new Set(Array.isArray(def.default) ? def.default : []);\n }\n\n case \"Map\": {\n return new Map(Object.entries(isJsonObject(def.default) ? def.default : {}));\n }\n\n case \"FormData\": {\n const fd = new FormData();\n for (const [k, v] of Object.entries(def.fields ?? {})) {\n /* SAFETY: `append(name, value)` converts a non-Blob value to a USVString itself, so a JSON\n number or boolean field reaches that conversion exactly as it always has. */\n fd.append(k, v as string);\n }\n return fd;\n }\n\n case \"Blob\": {\n /* SAFETY: a Blob entry's `parts` is the BlobPart list its document declares; anything else\n reaches the Blob constructor, whose own WebIDL sequence check refuses it as before. */\n const parts = def.parts as BlobPart[] | null | undefined;\n return new Blob(parts ?? [], {\n type: isString(def.type) ? def.type : \"text/plain\",\n });\n }\n\n case \"ReadableStream\": {\n return null;\n }\n\n default: {\n console.warn(\n `Jx: unknown $prototype \"${def.$prototype}\" for \"${key}\". Did you mean to add '$src'?`,\n );\n return ref(null);\n }\n }\n}\n\n// ─── External class resolution ────────────────────────────────────────────────\n\n/** Reserved keys stripped from the config object passed to external class constructors. */\nconst EXTERNAL_RESERVED = new Set([\n \"$prototype\",\n \"$src\",\n \"$export\",\n \"timing\",\n \"default\",\n \"description\",\n \"body\",\n \"parameters\",\n \"arguments\",\n \"name\",\n]);\n\n/**\n * The config an external class is constructed with: the entry's own keys, minus the runtime's.\n *\n * @param {JxPrototypeDef} def\n * @returns {JxScope}\n */\nfunction externalConfig(def: JxPrototypeDef): JxScope {\n const config: JxScope = {};\n for (const [k, v] of Object.entries(def)) {\n if (!EXTERNAL_RESERVED.has(k)) {\n config[k] = v;\n }\n }\n return config;\n}\n\n/**\n * A class an external module exports, as the runtime uses it: a function, which is what `typeof`\n * says of every class, constructed with the entry's config.\n */\ntype ExternalClass = JxScopeFunction & (new (config: JxScope) => ExternalClassInstance);\n\n/**\n * Resolve an external class prototype via $src.\n *\n * @param {JxPrototypeDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<Ref<JxScopeValue>>}\n */\nasync function resolveExternalPrototype(\n def: JxPrototypeDef,\n state: JxScope,\n key: string,\n base?: string,\n) {\n const src = def.$src;\n\n // Non-Function $prototype must use .class.json as entrypoint\n if (!src || !src.endsWith(\".class.json\")) {\n throw new Error(\n `Jx: $prototype \"${def.$prototype}\" requires a .class.json $src, got \"${src}\". ` +\n `Wrap the class in a .class.json schema with $implementation.`,\n );\n }\n\n return resolveClassJson(def, state, key, base);\n}\n\n/**\n * Import a JS module and instantiate a class from it. Internal helper used by resolveClassJson for\n * $implementation.\n *\n * @param {JxPrototypeDef} def - Original state entry (for config extraction)\n * @param {string} src - JS module URL to import\n * @param {string} exportName - Export name to look up\n * @param {string} [base] - Base URL for resolution\n * @returns {Promise<Ref<JxScopeValue>>}\n */\nasync function importAndInstantiate(\n def: JxPrototypeDef,\n src: string,\n exportName: string,\n base?: string,\n) {\n let mod: ImportedModule;\n const seeded = seededModule(src);\n if (seeded instanceof Promise) {\n mod = await seeded;\n } else if (seeded) {\n mod = seeded;\n } else {\n try {\n mod = await importModule(src);\n } catch {\n if (base) {\n const resolvedSrc = new URL(src, base).href;\n mod = await importModule(resolvedSrc);\n } else {\n throw new Error(`Failed to import \"${src}\"`);\n }\n }\n _moduleCache.set(src, mod);\n }\n\n const ExportedClass = mod[exportName] ?? mod.default?.[exportName];\n if (!ExportedClass) {\n throw new Error(`Jx: export \"${exportName}\" not found in \"${src}\"`);\n }\n if (!isFunction(ExportedClass)) {\n throw new TypeError(`Jx: \"${exportName}\" from \"${src}\" is not a class`);\n }\n\n /* SAFETY: trust boundary — the external class contract, spec.md §12.3. A `$implementation`\n module's export is written as a class constructed with the entry's config; `isFunction` is all\n that can be checked before `new`, and a function that is not constructible throws its own\n TypeError there, as it always has. The instance is read only through `ExternalClassInstance`'s\n optional members, each checked before it is used, and the one it offers is the entry's value. */\n const instance = new (ExportedClass as ExternalClass)(externalConfig(def));\n\n const value = isFunction(instance.resolve)\n ? await instance.resolve()\n : \"value\" in instance\n ? instance.value\n : instance;\n\n // Always wrap in ref for reactivity with external classes\n const s = scopeRef(value);\n if (isFunction(instance.subscribe)) {\n instance.subscribe((newVal) => {\n s.value = newVal;\n });\n }\n return s;\n}\n\n/**\n * Resolve a .class.json schema-defined class. Fetches the schema, follows $implementation if\n * hybrid, or constructs dynamically if self-contained.\n *\n * Its one caller, {@link resolveExternalPrototype}, already rejects a missing `$src` before this\n * runs, so `def.$src` is never empty here.\n *\n * @param {JxPrototypeDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<Ref<JxScopeValue>>}\n */\nasync function resolveClassJson(def: JxPrototypeDef, state: JxScope, key: string, base?: string) {\n const src = def.$src!;\n let classDef: JxClassDef;\n\n // Bare specifiers (package references like @scope/pkg/file) can't be fetched directly —\n // Go straight to dev proxy which can resolve them via node_modules.\n const isBareSpecifier =\n !src.startsWith(\".\") &&\n !src.startsWith(\"/\") &&\n !src.startsWith(\"http\") &&\n !src.startsWith(\"file:\");\n if (isBareSpecifier) {\n return resolveViaDevProxy(def, state, key, base);\n }\n\n // Try fetching the .class.json file directly\n try {\n const url = base ? new URL(src, base).href : src;\n const res = await fetch(url);\n if (!res.ok) {\n throw new Error(`HTTP ${res.status}`);\n }\n /* SAFETY: trust boundary. Only a `$src` ending in `.class.json` reaches this fetch\n (`resolveExternalPrototype` refuses anything else), and a 2xx answer for one is a class\n definition document; the runtime does not schema-validate documents by design. */\n classDef = (await res.json()) as JxClassDef;\n } catch {\n // Fall back to dev proxy (server will handle .class.json resolution)\n return resolveViaDevProxy(def, state, key, base);\n }\n\n // Hybrid mode: $implementation points to the real JS module\n if (classDef.$implementation) {\n // If the schema references $context (e.g. content types), the browser cannot provide\n // The required server-side context — go directly to dev proxy.\n const schemaStr = JSON.stringify(classDef);\n if (schemaStr.includes('\"#/$context/')) {\n return resolveViaDevProxy(def, state, key, base);\n }\n const schemaUrl = base ? new URL(src, base).href : new URL(src, location.href).href;\n const implSrc = new URL(classDef.$implementation, schemaUrl).href;\n const exportName = def.$export ?? classDef.title ?? def.$prototype;\n try {\n return await importAndInstantiate(def, implSrc, exportName, base);\n } catch {\n return resolveViaDevProxy(def, state, key, base);\n }\n }\n\n // Self-contained: construct class dynamically from schema\n const DynClass = classFromSchema(classDef);\n /* SAFETY: every member of ExternalClassInstance is optional, and each is checked below before it\n is used, so any constructed object satisfies it; a schema class that defines `resolve`,\n `value` or `subscribe` methods or fields is the shape it names. */\n const instance = new DynClass(externalConfig(def)) as ExternalClassInstance;\n\n const value = isFunction(instance.resolve)\n ? await instance.resolve()\n : \"value\" in instance\n ? instance.value\n : instance;\n\n // Always wrap in ref for reactivity\n const s = scopeRef(value);\n if (isFunction(instance.subscribe)) {\n instance.subscribe((newVal) => {\n s.value = newVal;\n });\n }\n return s;\n}\n\n/**\n * Whether a class document's `$defs.constructor` is its own constructor definition, rather than the\n * `Object.prototype.constructor` function every object parsed from JSON inherits.\n *\n * @param rawCtor What `$defs.constructor` reads as\n */\nfunction isCtorDef(\n rawCtor: NonNullable<JxClassDef[\"$defs\"]>[\"constructor\"],\n): rawCtor is JxClassCtorDef {\n return isNonNullObject(rawCtor);\n}\n\n/**\n * Dynamically construct a class from a .class.json schema definition. Browser-side: maps private\n * fields to _-prefixed public fields.\n *\n * @param {import(\"@jxsuite/schema/types\").JxClassDef} classDef\n * @returns {typeof DynClass} A class whose instances hold the schema's fields by name\n */\nfunction classFromSchema(classDef: JxClassDef) {\n const fields = classDef.$defs?.fields ?? {};\n // JSON objects inherit Object.prototype.constructor — only an own object value counts.\n const rawCtor = classDef.$defs?.constructor;\n const ctor = isCtorDef(rawCtor) ? rawCtor : undefined;\n const methods = classDef.$defs?.methods ?? {};\n\n // oxlint-disable-next-line typescript/no-extraneous-class -- methods are attached to the prototype dynamically below\n class DynClass {\n /** Static methods, attached by name below. */\n static [member: string]: JxScopeValue;\n /** An instance holds its fields, and reaches its methods, by the names the schema gives. */\n [member: string]: JxScopeValue;\n\n constructor(config: JxScope = {}) {\n for (const [key, typedField] of Object.entries(fields)) {\n const id = typedField.identifier ?? key;\n const propName = typedField.access === \"private\" ? `_${id}` : id;\n if (config[id] !== undefined) {\n this[propName] = config[id];\n } else if (typedField.initializer !== undefined) {\n this[propName] = typedField.initializer;\n } else if (typedField.default !== undefined) {\n this[propName] = structuredClone(typedField.default);\n } else {\n this[propName] = null;\n }\n }\n if (ctor?.body) {\n const bodyStr = Array.isArray(ctor.body) ? ctor.body.join(\"\\n\") : ctor.body;\n /* SAFETY: `new Function` returns an ordinary function of the one named parameter; `call`\n runs it with the instance under construction as `this`, which is the constructor\n body's contract. */\n const init = new Function(\"config\", bodyStr) as (this: DynClass, config: JxScope) => void;\n init.call(this, config);\n }\n }\n }\n\n for (const [key, typedMethod] of Object.entries(methods)) {\n const name = typedMethod.identifier ?? key;\n const params = (typedMethod.parameters ?? []).map((p) => {\n if (p.$ref) {\n // `split` always yields at least one segment, so `pop` always finds one.\n return p.$ref.split(\"/\").pop() ?? \"\";\n }\n const n = p.identifier ?? p.name;\n return isString(n) ? n : \"arg\";\n });\n const bodyStr = Array.isArray(typedMethod.body)\n ? typedMethod.body.join(\"\\n\")\n : (typedMethod.body ?? \"\");\n\n if (typedMethod.role === \"accessor\") {\n const descriptor: PropertyDescriptor = {};\n if (typedMethod.getter) {\n /* SAFETY: `new Function` returns an ordinary function; as a getter it is called with no\n arguments and the instance as `this`, and what it returns is the property's value. */\n descriptor.get = new Function(typedMethod.getter.body ?? \"\") as () => JxScopeValue;\n }\n if (typedMethod.setter) {\n const sp = (typedMethod.setter.parameters ?? []).map(\n (p) => p.$ref?.split(\"/\").pop() ?? \"v\",\n );\n /* SAFETY: `new Function` returns an ordinary function of the named parameters; as a setter\n it receives the assigned value as its one argument, and its return is discarded. */\n descriptor.set = new Function(...sp, typedMethod.setter.body ?? \"\") as (\n v: JxScopeValue,\n ) => void;\n }\n Object.defineProperty(DynClass.prototype, name, {\n ...descriptor,\n configurable: true,\n });\n } else if (typedMethod.scope === \"static\") {\n DynClass[name] = new Function(...params, bodyStr);\n } else {\n DynClass.prototype[name] = new Function(...params, bodyStr);\n }\n }\n\n Object.defineProperty(DynClass, \"name\", {\n configurable: true,\n value: classDef.title,\n });\n return DynClass;\n}\n\n/**\n * Dev-mode fallback: when an $src module cannot run in the browser, proxy the resolve() call\n * through the Jx dev server (POST /**jx_resolve**). Supports reactive template strings in config\n * values via Vue effect().\n *\n * @param {JxPrototypeDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<Ref<JxScopeValue>>}\n */\nasync function resolveViaDevProxy(def: JxPrototypeDef, state: JxScope, key: string, base?: string) {\n const config = externalConfig(def);\n\n const hasTemplates = Object.values(config).some((v) => isTemplateString(v));\n\n /** @param {JxScope} resolvedConfig */\n const doResolve = (resolvedConfig: JxScope) =>\n fetch(resolveProxyPath(\"/__jx_resolve__\"), {\n body: JSON.stringify({\n $base: base,\n $export: def.$export,\n $prototype: def.$prototype,\n $src: def.$src,\n ...resolvedConfig,\n }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n }).then((r): Promise<JsonValue> => {\n if (!r.ok) {\n throw new Error(`Jx dev proxy ${r.status} for \"${key}\"`);\n }\n // The dev proxy answers with the resolved value serialized as JSON.\n return r.json();\n });\n\n // Always wrap in ref for reactivity\n const s: Ref<JxScopeValue> = ref(null);\n const resolveInto = (resolvedConfig: JxScope) => {\n holdTemplateErrorsFor(\n doResolve(resolvedConfig)\n .then((value) => {\n s.value = value;\n })\n .catch((error) => console.error(\"Jx dev proxy:\", error)),\n );\n };\n if (hasTemplates) {\n effect(() => {\n const resolvedConfig: JxScope = {};\n for (const [k, v] of Object.entries(config)) {\n resolvedConfig[k] = isTemplateString(v) ? evaluateTemplate(v, state) : v;\n }\n resolveInto(resolvedConfig);\n });\n } else {\n resolveInto(config);\n }\n return s;\n}\n\n// ─── Server function resolution ───────────────────────────────────────────────\n\n/**\n * Start one `timing: \"server\"` entry's calls, wherever they run. Each call takes the next number,\n * and only the latest may write the entry or report a failure: the answer to a call whose arguments\n * have since changed is dropped whenever it arrives, and a failed call keeps the entry's last\n * value. A call that throws before it returns a promise (an argument the proxy cannot serialize, or\n * a host function that throws synchronously) fails the same way, rather than out of whichever state\n * write started it. The proxy and a host-registered module share it, so a reactive entry's calls\n * are ordered and reported the same way on either path.\n *\n * @param {Ref<JxScopeValue>} s - The entry's value\n * @param {ServerCall} invoke - One call, with resolved arguments: it may return a value or a\n * promise, or throw\n * @param {string} label - The `console.error` prefix a failed call is reported under\n * @returns {(args: JxScope) => void} Starts a call\n */\nfunction latestServerCall(\n s: Ref<JxScopeValue>,\n invoke: ServerCall,\n label: string,\n): (args: JxScope) => void {\n let seq = 0;\n return (args: JxScope) => {\n seq += 1;\n const n = seq;\n /* The executor runs before the constructor returns, so the call still starts synchronously,\n and a throw inside it rejects this promise instead of escaping to the caller. */\n holdTemplateErrorsFor(\n new Promise<JsonValue>((settle) => {\n settle(invoke(args));\n })\n .then((result) => {\n if (n === seq) {\n s.value = result;\n }\n })\n .catch((error) => {\n if (n === seq) {\n console.error(label, error);\n }\n }),\n );\n };\n}\n\n/**\n * One call of a `timing: \"server\"` function, with its resolved arguments. Its answer is JSON, or a\n * promise of JSON: on the proxy path the answer crosses the wire as JSON, and a host-registered\n * module honours the same contract so the two paths are interchangeable.\n */\ntype ServerCall = (args: JxScope) => JsonValue | Promise<JsonValue>;\n\n/**\n * Resolve a timing: \"server\" entry. The runtime never imports a server module itself: every call is\n * a POST to the host's `/__jx_server__` proxy, which runs the function server-side with `env`, so\n * the runtime never requests the module's source (spec.md §11.4). A host may still serve that file\n * at its URL, which is why a secret belongs in `env` and never in the module body. The one\n * exception is the host's own act: a module it registered with `preloadModule` (embedding.md §6) is\n * called in process, and a reactive entry's calls are ordered there as the proxy orders them.\n *\n * @param {JxServerFnDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<Ref<JxScopeValue>>}\n */\nasync function resolveServerFunction(\n def: JxServerFnDef,\n state: JxScope,\n key: string,\n base?: string,\n) {\n const src = def.$src;\n const exportName = def.$export;\n\n /* The host-seeded set, not the module cache: a Function entry's own `$src` import lands in that\n cache too, and reusing it here would put a server module in the browser after all. */\n const seeded = _hostSeeded.has(src) ? seededModule(src) : undefined;\n if (!seeded) {\n return resolveServerFunctionViaProxy(def, state, key, base);\n }\n const mod = seeded instanceof Promise ? await seeded : seeded;\n\n const candidate = mod[exportName] ?? mod.default?.[exportName];\n if (!candidate) {\n throw new Error(`Jx: export \"${exportName}\" not found in \"${src}\" for \"${key}\"`);\n }\n if (!isFunction(candidate)) {\n throw new TypeError(`Jx: \"${exportName}\" from \"${src}\" is not a function`);\n }\n /* SAFETY: the guard proved a function, and a function accepts any call. A `timing: \"server\"`\n export is written to be called through the proxy, which hands it one arguments object and\n sends its answer back as JSON, so that is the contract it is held to in process too. */\n const fn = candidate as ServerCall;\n\n const rawArgs = def.arguments ?? {};\n const hasReactiveArg = Object.values(rawArgs).some((v) => isRefValue(v));\n const resolveArgs = () => {\n const args: JxScope = {};\n for (const [k, v] of Object.entries(rawArgs)) {\n args[k] = isRefValue(v) ? resolveRef(v.$ref, state) : v;\n }\n return args;\n };\n\n // Always wrap in ref for reactivity\n const s: Ref<JxScopeValue> = ref(null);\n if (hasReactiveArg) {\n const call = latestServerCall(s, fn, \"Jx server function:\");\n effect(() => {\n const args = resolveArgs();\n onEffectCleanup(() => {});\n call(args);\n });\n } else {\n s.value = await fn(resolveArgs());\n }\n return s;\n}\n\n/**\n * Call a timing: \"server\" entry through the host's `/__jx_server__` proxy, which imports the module\n * server-side and calls the export with `env` (server.md §3.3). This is the only path an\n * interpreting runtime takes for a module the host did not register. A `$ref` argument makes the\n * call reactive: it re-posts from an `effect()` when the reference changes. A failed call leaves\n * the entry's last value and logs, and the answer to a superseded call is dropped, so a slow answer\n * to an earlier call can never overwrite a later one (`latestServerCall`).\n *\n * @param {JxServerFnDef} def\n * @param {JxScope} state\n * @param {string} key\n * @param {string} [base]\n * @returns {Promise<Ref<JxScopeValue>>}\n */\nasync function resolveServerFunctionViaProxy(\n def: JxServerFnDef,\n state: JxScope,\n key: string,\n base?: string,\n) {\n const rawArgs = def.arguments ?? {};\n const hasReactiveArg = Object.values(rawArgs).some((v) => isRefValue(v));\n\n const resolveArgs = () => {\n const args: JxScope = {};\n for (const [k, v] of Object.entries(rawArgs)) {\n args[k] = isRefValue(v) ? resolveRef(v.$ref, state) : v;\n }\n return args;\n };\n\n /** @param {JxScope} args */\n const doResolve = (args: JxScope) =>\n fetch(resolveProxyPath(\"/__jx_server__\"), {\n body: JSON.stringify({\n $base: base,\n $export: def.$export,\n $src: def.$src,\n arguments: args,\n }),\n headers: { \"Content-Type\": \"application/json\" },\n method: \"POST\",\n }).then((r): Promise<JsonValue> => {\n if (!r.ok) {\n throw new Error(`Jx server proxy ${r.status} for \"${key}\"`);\n }\n // The proxy answers with the function's result serialized as JSON.\n return r.json();\n });\n\n // Always wrap in ref for reactivity\n const s: Ref<JxScopeValue> = ref(null);\n const call = latestServerCall(s, doResolve, \"Jx server proxy:\");\n if (hasReactiveArg) {\n effect(() => {\n const args = resolveArgs();\n onEffectCleanup(() => {});\n call(args);\n });\n } else {\n call(resolveArgs());\n }\n return s;\n}\n\n/**\n * Resolve a $ref string to a value in scope.\n *\n * With Vue reactivity, this reads directly from the reactive proxy. When called inside a effect or\n * computed, the read is tracked.\n *\n * @param {string} ref\n * @param {JxScope} state - Reactive scope proxy (or child scope)\n * @returns {JxScopeValue}\n */\nexport function resolveRef(refPath: string, state: JxScope) {\n // A `$ref` read from a document is not schema-validated, so a non-string one passes through.\n if (!isString(refPath)) {\n return refPath;\n }\n if (refPath.startsWith(\"$map/\") || refPath.startsWith(\"#/$map/\")) {\n /* Both spellings. `#/` is the documented JSON Pointer prefix everywhere else in the schema,\n so a `#/$map/item/x` fell through to `readPath`, returned null, and a `$map` over it\n rendered ZERO rows with no warning. */\n const parts = (refPath.startsWith(\"#/\") ? refPath.slice(2) : refPath).split(\"/\");\n const [, key] = parts; // \"item\" or \"index\"\n /* SAFETY: `$map` holds only the row record `renderMappedArrayInto` binds (see `rowContext`), an\n ordinary object read here by whichever member the ref names. */\n const map = state.$map as Record<string, JxScopeValue> | undefined;\n const base = map?.[key!] ?? state[`$map/${key}`];\n return parts.length > 2 ? readPath(base, parts.slice(2).join(\"/\")) : base;\n }\n if (refPath.startsWith(\"#/state/\")) {\n // One call, not a hand-split leading token: slicing at the first `/` skipped unescaping it, so\n // `#/state/a~1b/c` looked for a member called `a~1b` rather than `a/b`.\n return readPath(state, refPath.slice(\"#/state/\".length));\n }\n if (refPath.startsWith(\"parent#/\")) {\n /*\n * A prop name may be a path into the prop. This read the whole path as one key and returned\n * undefined for `parent#/user/name`, while the compiler lowered it to a walk.\n */\n return readPath(state, refPath.slice(\"parent#/\".length));\n }\n if (refPath.startsWith(\"window#/\")) {\n return readPath(globalThis.window, refPath.slice(\"window#/\".length));\n }\n if (refPath.startsWith(\"document#/\")) {\n return readPath(globalThis.document, refPath.slice(\"document#/\".length));\n }\n return readPath(state, refPath) ?? null;\n}\n\n// ─── Utilities ────────────────────────────────────────────────────────────────\n\n/**\n * Check if v is a Vue ref (including computed).\n *\n * @param {unknown} v\n * @returns {v is Ref<unknown>}\n */\nexport function isSignal(v: unknown): v is Ref<unknown> {\n return isRef(v);\n}\n\n/**\n * Write an observed attribute into element state, coerced by the type the state entry already holds\n * (spec §16.5): a number parses, a boolean is presence (`\"false\"` counts as absent), and anything\n * else is the string. Shared by connection and `attributeChangedCallback` so the two cannot\n * disagree.\n *\n * REMOVING an attribute restores the entry's DECLARED DEFAULT rather than writing the absence\n * through. `attributeChangedCallback` reports a removal as `null`, and writing that through gave a\n * `type: \"string\"` entry the value `null` and a `type: \"number\"` entry `Number(null)`, which is 0 —\n * so a numeric prop could never express \"unset\" and a string prop stopped matching its own declared\n * type. The default is the value the entry had before anyone set the attribute, which is what the\n * removal is asking to go back to.\n *\n * @param defaults The declared defaults by state key; a key absent from it has none.\n */\nfunction absorbAttribute(\n state: JxScope,\n name: string,\n value: string | null,\n defaults?: ReadonlyMap<string, JxScopeValue>,\n): void {\n const camelKey = name.replaceAll(/-([a-z])/g, (_: string, c: string) => c.toUpperCase());\n const current = state[camelKey];\n if (isBoolean(current)) {\n // Presence IS the value for a boolean, so a removal is already spelled by the same rule.\n state[camelKey] = value !== null && value !== \"false\";\n return;\n }\n if (value === null) {\n const declared = defaults?.get(camelKey);\n state[camelKey] = declared === undefined ? (isNumber(current) ? 0 : \"\") : declared;\n return;\n }\n state[camelKey] = isNumber(current) ? Number(value) : value;\n}\n\n/**\n * The declared default of every state entry that has one, by state key.\n *\n * @param def The element definition\n * @returns {Map<string, JxScopeValue>} Key → default\n */\nfunction declaredDefaults(def: JxElement): Map<string, JxScopeValue> {\n const out = new Map<string, JxScopeValue>();\n for (const [key, entry] of Object.entries(def.state ?? {})) {\n if (isNonNullObject(entry)) {\n if (\"default\" in entry) {\n out.set(key, entry.default);\n continue;\n }\n // A computed entry has no default: its value is produced, and a removal leaves it alone.\n if (COMPUTED_STATE_KEYS.some((marker) => marker in entry)) {\n continue;\n }\n }\n // The shorthand `{ \"label\": \"none\" }` IS the default, the same way `buildScope` reads it.\n out.set(key, entry);\n }\n return out;\n}\n\n/** The markers that make a state entry produced rather than authored. */\nconst COMPUTED_STATE_KEYS = [\"$expression\", \"$prototype\", \"$ref\", \"$src\"] as const;\n\n/** Keys already reported, so a component rendered in a loop warns once rather than per instance. */\nconst _privatePropWarned = new Set<string>();\n\n/**\n * Refuse a `$props` write against a private (`#`) state key — `spec.md` §5.6.\n *\n * Ignored rather than thrown. A `$props` block naming a private entry is an authoring mistake, not\n * a broken document: the rest of the instance is well-formed and refusing to render it would turn a\n * typo into a blank page. But silence was the previous behavior and it is the wrong kind — the\n * author sees a prop that looks accepted and does nothing — so the write is dropped and named.\n *\n * @param {string} key\n * @param {string} [where] - The site refusing it, for a message that points somewhere\n * @returns {boolean} True when the key is private and the caller must skip it\n */\n/**\n * Whether the instance genuinely CARRIES `key`, rather than the prototype merely having an accessor\n * for it.\n *\n * `key in el` cannot tell those apart, and for a REFLECTED DOM property — `title`, `role`, `id`,\n * `lang`, `dir`, `slot`, `hidden` — the accessor answers `\"\"` when nothing is set. `\"\" !==\n * undefined`, so a component declaring `state.title` never rendered its own default: the empty\n * string won. `quote` next to it kept its default, which is what made the bug look like bad\n * content.\n *\n * The test is NOT `Object.hasOwn` alone, and that distinction is the whole subtlety. Assigning a\n * reflected name goes through the prototype accessor and creates no own property, so a legitimate\n * `$props.title` would be discarded by an own-property test — silently, for every component that\n * declares one. What the accessor DOES do is write the attribute, so the attribute is the evidence\n * that somebody set it, whether that was `$props` before connection or the author in the document.\n *\n * @param {HTMLElement} el - The instance being connected.\n * @param {string} key - A state key declared by the component definition.\n * @returns {boolean}\n */\nfunction instanceSupplies(el: HTMLElement, key: string): boolean {\n if (Object.hasOwn(el, key)) {\n return true;\n }\n if (el.hasAttribute(key)) {\n return true;\n }\n // ARIA-style reflections carry a kebab attribute for a camelCase property (`ariaLabel` →\n // `aria-label`), so the direct name lookup above would miss a value that really was set.\n const kebab = key.replaceAll(/[A-Z]/gu, (c) => `-${c.toLowerCase()}`);\n return kebab !== key && el.hasAttribute(kebab);\n}\n\n/**\n * The platform's setter for `key` on an element, when the name is one the platform already owns.\n *\n * @param {HTMLElement} el\n * @param {string} key\n * @returns {((value: JxScopeValue) => void) | undefined}\n */\nfunction nativeSetter(el: HTMLElement, key: string): ((value: JxScopeValue) => void) | undefined {\n for (\n let proto: object | null = Reflect.getPrototypeOf(el);\n proto;\n proto = Reflect.getPrototypeOf(proto)\n ) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, key);\n if (descriptor) {\n return descriptor.set;\n }\n }\n return undefined;\n}\n\nfunction refusePrivateProp(key: string, where?: string): boolean {\n if (!isPrivateStateKey(key)) {\n return false;\n }\n const seen = where === undefined ? key : `${where}:${key}`;\n if (!_privatePropWarned.has(seen)) {\n _privatePropWarned.add(seen);\n console.warn(\n `Jx: \"${key}\" is private state (spec.md §5.6) and cannot be set through $props` +\n `${where === undefined ? \"\" : ` (${where})`}. The write was ignored; rename the entry ` +\n \"without the leading # to make it part of the component's interface.\",\n );\n }\n return true;\n}\n\n/** Tests only — the warn-once set outlives a single render by design. */\nexport function _resetPrivatePropWarnings(): void {\n _privatePropWarned.clear();\n}\n\n/**\n * @param {JxElement} def\n * @param {JxScope} parentState\n * @returns {JxScope}\n */\nfunction mergeProps(def: JxElement, parentState: JxScope): JxScope {\n const child = inheritScope(parentState);\n for (const [k, v] of Object.entries(def.$props ?? {})) {\n if (refusePrivateProp(k, \"$props\")) {\n continue;\n }\n bindLocal(child, k, isRefValue(v) ? resolveRef(v.$ref, parentState) : v);\n }\n return child;\n}\n\n/*\n * The CSS-authoring rules live in `./css.ts`, whose only import is a pair of type guards. They are\n * re-exported\n * here because they always were part of this module's surface and moving them must not break a\n * consumer; a host that cannot afford the DOM runtime imports `@jxsuite/runtime/css` instead.\n */\nexport {\n buildStyleRules,\n camelToKebab,\n COLOR_SCHEME_ATTR,\n COLOR_SCHEME_STORAGE_KEY,\n cssPropertyName,\n cssRuleText,\n hashCss,\n isDeclarationAtRule,\n isKeyframesAtRule,\n isNestedSelectorKey,\n pureSchemeOf,\n resolveAtQuery,\n resolveNestedSelector,\n schemeSelectors,\n spliceNestingSelector,\n splitSelectorList,\n transposeCanvasOverlaySelector,\n transposeCanvasPopoverSelector,\n} from \"./css.ts\";\nexport type { CssBuildOptions, CssKeyframeBlock, CssRule, CssRuleTarget } from \"./css.ts\";\n\n/**\n * Convert a style rules object to a CSS text string (skipping nested selectors).\n *\n * Kept for consumers; nothing in this repository composes a rule this way any more, because\n * `buildStyleRules` answers the same question for a whole style object rather than one flat level\n * of it. It shares that function's property spelling — `cssPropertyName`, not `camelToKebab` — so a\n * custom property survives it: `--fooBar` and `--foo-bar` are two different properties, and\n * kebab-casing one renames it out from under the `var()` that reads it.\n *\n * @param {JxStyle} rules\n * @returns {string}\n */\nexport function toCSSText(rules: JxStyle) {\n return Object.entries(rules)\n .filter(([k, v]) => !isNestedSelectorKey(k) && !isNonNullObject(v))\n .map(([p, v]) => `${cssPropertyName(p)}: ${canvasStyleValue(String(v))}`)\n .join(\"; \");\n}\n\n// ─── Custom Element Registration ──────────────────────────────────────────────\n\nlet _rootMedia: Record<string, string> = {};\n/**\n * Every defined element's CURRENT definition, read at connection — which is what lets a definition\n * be replaced.\n */\nconst _elementDefs = new Map<string, { base: string; doc: JxDocument }>();\n\n/**\n * The definition an element tag renders from, as most recently defined or redefined.\n *\n * @param {string} tagName\n * @returns {{ base: string; doc: JxDocument } | undefined}\n */\nexport function elementDefinition(tagName: string): { base: string; doc: JxDocument } | undefined {\n return _elementDefs.get(tagName);\n}\n\n/**\n * Replace an element's definition (embedding.md §7). `customElements.define` is one-shot, so the\n * generated class reads its definition through the registry at connection time: an instance\n * connected after this call renders the new document; one already on the page keeps the definition\n * it rendered until it is re-mounted. `observedAttributes` is the one thing the platform freezes at\n * first definition, so a changed list is reported and takes effect only in a fresh realm. A tag not\n * yet defined is simply defined.\n *\n * @param {JxDocument} doc\n * @param {string} [baseUrl]\n * @returns {Promise<void>}\n */\nexport async function redefineElement(doc: JxDocument, baseUrl?: string): Promise<void> {\n const base = baseUrl ?? location.href;\n const { tagName } = doc;\n if (!tagName || !tagName.includes(\"-\")) {\n throw new Error(`Jx redefineElement: tagName \"${tagName}\" must contain a hyphen`);\n }\n if (!customElements.get(tagName)) {\n await defineElement(doc, base);\n return;\n }\n if (doc.$elements) {\n await registerElements(doc.$elements, base);\n }\n const before = _elementDefs.get(tagName)?.doc.observedAttributes ?? [];\n const after = doc.observedAttributes ?? [];\n if (JSON.stringify(before) !== JSON.stringify(after)) {\n console.warn(\n `Jx redefineElement: <${tagName}> keeps observedAttributes [${before.join(\", \")}] as first defined; [${after.join(\", \")}] takes effect only in a fresh realm`,\n );\n }\n _elementDefs.set(tagName, { base, doc });\n}\n\n/**\n * Seed the module-level root `$media` map used as the fallback for components that declare their\n * own `@--name` style blocks but carry no own `$media` (buildScope ~279-280). `Jx()` sets this from\n * the document during a full top-level render, but the Studio iframe canvas calls `buildScope`/\n * `renderNode` directly (never `Jx()`), so without seeding it a component's `@--md` would resolve\n * to the invalid `@media md`. Callers on the direct path MUST set it (with the merged `$media`)\n * before `buildScope`, and re-set it every render so a stale map from a previous document cannot\n * leak.\n *\n * @param {Record<string, string> | null} [map] - Absent or null clears it\n */\nexport function setRootMedia(map?: Record<string, string> | null): void {\n _rootMedia = map ?? {};\n}\n\n/**\n * Resolve and register $elements entries (depth-first).\n *\n * @param {JxDocument[\"$elements\"]} elements\n * @param {string} base\n * @returns {Promise<void>}\n */\nasync function registerElements(\n elements: NonNullable<JxDocument[\"$elements\"]>,\n base: string,\n ctx?: JxContext,\n) {\n for (const entry of elements) {\n // Bare string: npm package side-effect import (registers custom elements)\n if (isString(entry)) {\n try {\n // Bare specifiers need a URL path for the browser; the dev server resolves\n // /node_modules/<pkg> to the package entry point via exports/module/main.\n const specifier =\n entry.startsWith(\"/\") || entry.startsWith(\".\") ? entry : `/node_modules/${entry}`;\n await import(specifier);\n } catch (error) {\n console.warn(`Jx: failed to import package \"${entry}\"`, error);\n }\n continue;\n }\n if (!isRefValue(entry)) {\n continue;\n }\n const { href } = new URL(entry.$ref, base);\n const doc = await resolve(href, ctx);\n if (!doc.tagName || !doc.tagName.includes(\"-\")) {\n continue;\n }\n if (customElements.get(doc.tagName)) {\n continue;\n }\n\n // Depth-first: register sub-dependencies first\n if (doc.$elements) {\n await registerElements(doc.$elements, href, ctx);\n }\n\n await defineElement(doc, href);\n }\n}\n\n/**\n * Inject head elements from $head declarations. Each entry is { tagName, attributes } — bare npm\n * specifiers in href/src are rewritten to /node_modules/ paths for the dev server.\n *\n * @param {import(\"@jxsuite/schema/types\").JxHeadEntry[]} entries\n * @param {string} _base - Document base URL for resolving relative paths\n */\nfunction injectHead(entries: readonly (JxHeadEntry | null | undefined)[], _base: string) {\n for (const entry of entries) {\n if (!entry || !entry.tagName) {\n continue;\n }\n const tag = entry.tagName.toLowerCase();\n const attrs = { ...entry.attributes };\n // Resolve href/src: bare npm specifiers -> /node_modules/ path\n for (const key of [\"href\", \"src\"] as const) {\n const v = attrs[key];\n if (!isString(v) || v === \"\") {\n continue;\n }\n if (!v.startsWith(\"/\") && !v.startsWith(\".\") && !v.startsWith(\"http\")) {\n /* The bare-specifier lane owns `/node_modules/<pkg>`, which is the HOST's URL space and\n not the project's. A canvas resolver must never claim it: the file is not in the\n repository, so there is nothing for it to resolve to. */\n attrs[key] = `/node_modules/${v}`;\n continue;\n }\n attrs[key] = canvasAssetValue(tag.toUpperCase(), key, v);\n }\n\n // Deduplicate: skip if an identical element already exists\n const selector = `${tag}${attrs.href ? `[href=\"${attrs.href}\"]` : \"\"}${attrs.src ? `[src=\"${attrs.src}\"]` : \"\"}`;\n if (selector !== tag && document.head.querySelector(selector)) {\n continue;\n }\n\n const el = document.createElement(tag);\n for (const [k, v] of Object.entries(attrs)) {\n el.setAttribute(k, String(v));\n }\n if (entry.textContent) {\n // An object is a structured data block (JSON-LD, site-architecture.md §8.5). The compiler\n // Serializes it the same way, so the interpreted page and the built page agree.\n el.textContent = isNonNullObject(entry.textContent)\n ? JSON.stringify(entry.textContent, null, 2)\n : entry.textContent;\n }\n document.head.append(el);\n }\n}\n\n// ─── Instantiation chain (spec.md §16.9) ─────────────────────────────────────\n\n/**\n * How deep component nesting may go before an instance refuses to render, and before the compiler\n * (`@jxsuite/compiler`, `shared.ts`, which imports this export) refuses to continue a build.\n *\n * The cycle check in {@link extendInstancePath} catches a definition that renders ITSELF — same tag,\n * same props — which is the only shape that can never terminate, while a self-reference whose props\n * change at every level (`depth: \"${state.depth + 1}\"`) is data-driven recursion that a `$switch`\n * may or may not bottom out. The seen-set cannot tell those apart, so this cap is what turns a\n * forgotten stop into a diagnostic instead of a page that never settles or a build that overflows\n * its stack. Thirty-two is far beyond any component library's real depth and far below the call\n * stack's. It lives here because the compiler depends on the runtime and not the other way round,\n * so one declaration serves both sides of spec.md §16.9: a page that builds is a page that\n * renders.\n */\nexport const MAX_COMPONENT_NESTING = 32;\n\n/** One instance on the chain: its tag, and the props it was given, as an identity. */\ninterface InstanceFrame {\n tag: string;\n /** Every value the instance supplied that its definition's state read (§16.9). */\n props: JxScope;\n}\n\n/**\n * The chain an instance is created under, and where on it the current expansion began.\n *\n * `frames` is every instance from the page-level one down, outermost first. `expansion` is the\n * index of the first frame that belongs to the SAME synchronous pass as the instance being created:\n * the cycle check (§16.9 rule 1) looks back no further than that, while the cap (rule 2) counts\n * every frame. The distinction is what an effect re-run does to certainty. Along one pass a\n * repeated frame is a render that repeats itself, deterministically, forever. Across a re-run it is\n * not: the frames above the boundary rendered to completion once, and whether the page asks for one\n * of them again is its data — an `onMount` that flips a `$switch` into the same tag every time, or\n * a click that opens one more level of a node that starts closed — which the runtime cannot tell\n * apart. So the cycle check is not asked across the boundary, and the loop that lives in re-runs is\n * ended by the cap instead: thirty-three empty hosts and a diagnostic, not a page that never\n * settles.\n */\ninterface InstancePath {\n frames: readonly InstanceFrame[];\n expansion: number;\n}\n\n/** The chain a page-level render runs under: nothing above it. */\nconst ROOT_INSTANCE_PATH: InstancePath = { expansion: 0, frames: [] };\n\n/**\n * The chain of instances whose definitions are being rendered RIGHT NOW.\n *\n * A module-level stack rather than a WeakMap from element to chain, and it is worth saying why that\n * survives `connectedCallback` being async. The callback awaits `buildScope` before it touches the\n * DOM, and by the time it resumes, whatever the enclosing instance pushed here has long been popped\n * — so the stack alone would be empty for every instance and catch nothing. What saves it is WHEN\n * an instance connects: `this.append(child)` in the enclosing render runs the child's\n * `connectedCallback` synchronously, and every way a definition brings an instance into being —\n * `renderCustomElementWithProps`, the bare-tag branch of `renderNode`, a nested element inside\n * either, and a prerendered host drawing its children again as it upgrades — appends it inside that\n * same synchronous stretch. So the callback reads the stack ONCE, before its first `await`, and\n * carries the copy across the gap. A WeakMap would need a write at each of those creation sites to\n * say the same thing.\n *\n * A subtree an effect renders LATER — a `$switch` case that flips after the first paint, a `$map`\n * row that arrives with new data — connects with nothing on the stack, because no enclosing render\n * is running when the effect re-runs; a write from `onMount` or a click is what triggered it. So\n * the two renderers that create nodes from an effect each capture the stack when they are first\n * rendered (which is inside the enclosing pass) and put it back, re-expanded, around every later\n * insertion ({@link underInstancePath}). That is the one thing this stack needs beyond the\n * synchronous stretch, and it is what makes the `onMount`-flip shape a diagnostic rather than a\n * hang. Reading `@vue/reactivity`'s `getCurrentScope()` there instead would find nothing: an effect\n * re-run restores no scope, and a case or a row renders in a DETACHED scope with no parent.\n */\nlet _instancePath: InstancePath = ROOT_INSTANCE_PATH;\n\n/**\n * Say that an instance was not rendered, on the two surfaces a host can reach (spec §16.4, §16.9):\n * the console, and a bubbling, composed `jx-error` `ErrorEvent` from the element carrying the\n * error. Nothing is said for a host no longer in the document, whose replacement reports for it.\n *\n * @param {HTMLElement} host - The instance\n * @param {string} tagName - Its tag, for the console line\n * @param {Error} error - Why\n */\nfunction reportUnrendered(host: HTMLElement, tagName: string, error: Error): void {\n if (!host.isConnected) {\n return;\n }\n console.error(`Jx: <${tagName}> was not rendered:`, error);\n host.dispatchEvent(\n new ErrorEvent(\"jx-error\", {\n bubbles: true,\n composed: true,\n error,\n message: error.message,\n }),\n );\n}\n\n/**\n * Run `fn` with `path` as the chain, so every instance that CONNECTS during it reads that chain.\n *\n * Restored rather than cleared afterwards: the enclosing render's chain is what was there, and a\n * restore needs no argument about whether anything was.\n *\n * @param {InstancePath} path - The chain the instances `fn` connects are created under\n * @param {() => T} fn - The render, or the insertion that connects what a render made\n * @returns {T} What `fn` returned\n */\nfunction underInstancePath<T>(path: InstancePath, fn: () => T): T {\n const was = _instancePath;\n _instancePath = path;\n try {\n return fn();\n } finally {\n _instancePath = was;\n }\n}\n\n/**\n * The chain a later insertion runs under: the same frames, with the expansion beginning now.\n *\n * Called on EVERY run of a `$switch` case or a `$map` reconcile, the first one included — harmless\n * there, because a first run builds into a detached container and nothing connects until the\n * enclosing pass appends it, under the enclosing pass's own chain.\n *\n * @param {InstancePath} path - The chain captured when the renderer was first rendered\n * @returns {InstancePath}\n */\nfunction reexpand(path: InstancePath): InstancePath {\n return { expansion: path.frames.length, frames: path.frames };\n}\n\n/**\n * Whether two prop values are the same input to a definition.\n *\n * Reference equality first — a `$ref` into the parent's state forwards the same primitive, the same\n * reactive proxy or the same function to the next level — and structural equality for plain data\n * rebuilt at each level (`data-jx-props` parsed twice is two objects with one meaning). Plain data\n * is what JSON can describe: an array, or an object with no prototype but `Object`'s, reactive or\n * raw. Anything else — a `Map`, a `Set`, a class instance, a circular object — is different from\n * everything but itself, because its JSON form would not say what it holds and two different values\n * that serialise alike would close a cycle that was never there. The cost of that policy is a loop\n * the depth cap catches instead; the alternative is a false diagnostic on a page that would have\n * ended. Inside plain data the comparison IS the JSON form, so a member JSON cannot see (a\n * function, a `Map` two levels down) is not seen here either; §16.9 says so.\n *\n * @param {JxScopeValue} a\n * @param {JxScopeValue} b\n * @returns {boolean}\n */\nfunction samePropValue(a: JxScopeValue, b: JxScopeValue): boolean {\n if (Object.is(a, b)) {\n return true;\n }\n if (!isPlainData(a) || !isPlainData(b)) {\n return false;\n }\n try {\n return JSON.stringify(a) === JSON.stringify(b);\n } catch {\n return false;\n }\n}\n\n/**\n * Whether a value is an array or a plain object — the shapes whose JSON form is the whole value.\n *\n * @param {JxScopeValue} value\n * @returns {boolean}\n */\nfunction isPlainData(value: JxScopeValue): boolean {\n if (!isNonNullObject(value)) {\n return false;\n }\n const raw: unknown = toRaw(value);\n if (Array.isArray(raw)) {\n return true;\n }\n const proto: unknown = Object.getPrototypeOf(raw);\n return proto === Object.prototype || proto === null;\n}\n\n/**\n * Whether two frames are the same instance: one tag, one set of prop names, equal values.\n *\n * @param {InstanceFrame} a\n * @param {InstanceFrame} b\n * @returns {boolean}\n */\nfunction sameFrame(a: InstanceFrame, b: InstanceFrame): boolean {\n if (a.tag !== b.tag) {\n return false;\n }\n const keys = Object.keys(a.props);\n if (keys.length !== Object.keys(b.props).length) {\n return false;\n }\n return keys.every(\n (key) => Object.hasOwn(b.props, key) && samePropValue(a.props[key], b.props[key]),\n );\n}\n\n/**\n * The chain an instance's own render runs under: the enclosing chain plus itself — or the\n * diagnostic that says why it must not render at all.\n *\n * The two messages are the compiler's, word for word (`renderComponentInstance` in\n * `@jxsuite/compiler`), so a page that fails to build and a canvas that fails to paint say the same\n * thing about the same definition. Meeting a frame already on the chain, within the current\n * expansion, is the instance rendering itself with the same props, which never ends; a chain at the\n * cap is a self-reference whose props change — or whose repeats live in re-runs, where the cycle\n * check is not asked ({@link InstancePath}) — and whose stop case never came.\n *\n * @param {InstancePath} path - The chain the instance was created under\n * @param {InstanceFrame} frame - The instance about to render\n * @returns {InstancePath} The chain its children render under\n * @throws {Error} The named diagnostic — never a stack overflow, never a hang\n * @docs framework/concepts/components\n */\nfunction extendInstancePath(path: InstancePath, frame: InstanceFrame): InstancePath {\n const chain = [...path.frames.map((f) => f.tag), frame.tag].join(\" → \");\n if (path.frames.slice(path.expansion).some((f) => sameFrame(f, frame))) {\n throw new Error(\n `Component <${frame.tag}> renders itself: ${chain}. A component cannot appear inside its own ` +\n `definition with the same props — the expansion would never end.`,\n );\n }\n if (path.frames.length >= MAX_COMPONENT_NESTING) {\n throw new Error(\n `Component nesting exceeds ${MAX_COMPONENT_NESTING} levels: ${chain}. A component that ` +\n `renders itself with changing props needs a case that stops.`,\n );\n }\n return { expansion: path.expansion, frames: [...path.frames, frame] };\n}\n\n/**\n * Register a custom element from a Jx document.\n *\n * @param {string | JxDocument} source - URL to .json file, or raw document object\n * @param {string} [base] - Base URL for resolving $src imports\n * @returns {Promise<void>}\n */\nconst _definedSources = new Set<string>();\n\nexport async function defineElement(source: string | JxDocument, baseUrl?: string) {\n let base = baseUrl;\n let source_: JxDocument;\n if (isString(source)) {\n base = new URL(source, base ?? location.href).href;\n if (_definedSources.has(base)) {\n return;\n }\n _definedSources.add(base);\n source_ = await resolve(source);\n } else {\n source_ = source;\n }\n base ??= location.href;\n\n const { tagName } = source_;\n if (!tagName || !tagName.includes(\"-\")) {\n throw new Error(`Jx defineElement: tagName \"${tagName}\" must contain a hyphen`);\n }\n if (customElements.get(tagName)) {\n return;\n }\n\n // Register sub-dependencies first\n if (source_.$elements) {\n await registerElements(source_.$elements, base);\n }\n\n _elementDefs.set(tagName, { base, doc: source_ });\n\n // The definition as first given. The class reads the CURRENT one at connection (see\n // `redefineElement`); only `observedAttributes` is frozen here, because the platform freezes it.\n const initialDef = source_;\n const initialBase = base;\n const observedAttrs = initialDef.observedAttributes ?? [];\n\n const ElementClass = class extends HTMLElement {\n _jxInitialized = false;\n _state: JxScope | null = null;\n\n static get observedAttributes() {\n return observedAttrs;\n }\n\n async connectedCallback() {\n // An element carrying `data-jx-definition-root` IS the definition being rendered by an\n // External renderer (the studio canvas editing this component's own document) — its subtree\n // Is authored DOM, not an instantiation site. Self-initializing here would wipe that tree\n // And re-render it with default state (the \"component editor shows a live instance\" bug).\n if (this.dataset.jxDefinitionRoot !== undefined) {\n return;\n }\n if (this._jxInitialized) {\n return;\n }\n this._jxInitialized = true;\n\n /* The chain this instance was created under, read BEFORE the first `await`: the enclosing\n render is still on the stack now and will not be when this callback resumes. See\n {@link _instancePath} for why that ordering is the whole mechanism. */\n const enclosingPath = _instancePath;\n /* What this instance was given, recorded beside each write into state below. It is the\n instance's identity on the chain (§16.9): two nested instances of one tag that were given\n the same values render the same thing, forever. Only a value the definition's state READS\n is recorded — a `$props` key no state entry declares changes nothing about the render, so\n a definition that \"varies\" one at each level is still rendering itself. */\n const supplied: JxScope = {};\n\n // The definition as it stands NOW — a redefinition since this class was made is honoured.\n const live = _elementDefs.get(tagName) ?? { base: initialBase, doc: initialDef };\n const def = live.doc;\n const defBase = live.base;\n\n // The element is its own dispatch root: a body run without an event emits from the host.\n const state = await buildScope(def, {}, defBase, { base: defBase, media: null, root: this });\n\n // Read properties from the data-jx-props payload the site build writes on a\n // Non-static instance, so an upgrade re-renders with the authored props, not the defaults.\n /* Observed attributes already on the element are read now. `attributeChangedCallback` fires\n for an attribute set before connection too — but on an instance with no state yet, so it\n had nothing to write into, and `<jx-icon name=\"plus\">` rendered with the default. Before\n the `$props` merges below, so a property a parent set still wins (spec §16.2). */\n for (const attr of observedAttrs) {\n if (this.hasAttribute(attr)) {\n absorbAttribute(state, attr, this.getAttribute(attr));\n // The raw string, not the coerced value: coercion is a function of it, so two equal\n // Strings are one input.\n supplied[attr] = this.getAttribute(attr);\n }\n }\n\n const propsAttr = this.dataset.jxProps;\n if (propsAttr) {\n try {\n /* SAFETY: `JSON.parse` answers the JSON value the attribute encodes, or throws, which the\n catch below ignores as it always has. */\n const props = JSON.parse(propsAttr) as JsonValue;\n /* The site build writes an object. An array or string payload still yields its index\n keys, and a number, boolean or null yields none, as `Object.entries` always gave. */\n const entries = isNonNullObject(props) || isString(props) ? Object.entries(props) : [];\n for (const [key, val] of entries) {\n if (refusePrivateProp(key, \"data-jx-props\")) {\n continue;\n }\n if (key in (def.state ?? {})) {\n state[key] = val;\n supplied[key] = val;\n }\n }\n } catch {}\n delete this.dataset.jxProps;\n }\n\n // Read literal `props.*` attributes (JSON-authored instances pass props this way; the\n // Compiler lifts them into $props at build, and this is the live-render mirror). String\n // Values only — HTML lowercases attribute names, so state keys must be lowercase to match.\n // Collect first: removing while iterating the live NamedNodeMap skips entries.\n const propAttrNames = this.getAttributeNames().filter(\n (name) => name.startsWith(\"props.\") && name.length > \"props.\".length,\n );\n for (const name of propAttrNames) {\n const key = name.slice(\"props.\".length);\n if (refusePrivateProp(key, \"props.* attribute\")) {\n this.removeAttribute(name);\n continue;\n }\n if (key in (def.state ?? {})) {\n state[key] = this.getAttribute(name);\n supplied[key] = this.getAttribute(name);\n this.removeAttribute(name);\n }\n }\n\n // Merge $props set as JS properties by parent before connection\n for (const key of Object.keys(def.state ?? {})) {\n if (isPrivateStateKey(key)) {\n continue;\n }\n const own = elementProperties(this);\n if (key in this && own[key] !== undefined && instanceSupplies(this, key)) {\n state[key] = own[key];\n supplied[key] = own[key];\n }\n }\n\n /* Every input is known now, so this is where an instance that would never finish is\n refused (§16.9): before it has a state, a style or a child, so a refused host is an empty\n element the page renders around — emptied of what the definition wrote into it for its\n slots too, since nothing will distribute that. The diagnostic is REPORTED rather than\n thrown onward: a throw from an async `connectedCallback` is an unhandled rejection that\n names no element and stops nothing. It goes two ways. The console is the runtime's\n surface for a render that fails after the page has settled (`$switch` external cases and\n the dev proxies report there too). The `jx-error` event is the surface a HOST can hold:\n it bubbles from the refused element with the error on it, so a page, or the studio canvas\n wrapping one, can collect it where a console line inside an iframe reaches nobody. The\n rest of the page keeps rendering, which is the point.\n\n Neither surface is used for a host that is no longer in the document. A refused instance\n was connected when this callback began, and one that is not by the time the verdict is in\n belongs to a subtree the page discarded during the `await` above: a prerendered host of the\n same tag that was parsed INSIDE another and re-rendered from the definition by the outer\n one's upgrade, which captures it as slot content and empties itself. Its replacement is\n the instance that reports, on the chain the outer upgrade draws; reporting from the\n discarded copy too said one defect twice. The refusal itself still stands, so a host\n re-attached later is an empty element and not a hang. */\n let ownPath: InstancePath;\n try {\n ownPath = extendInstancePath(enclosingPath, { props: supplied, tag: tagName });\n } catch (error) {\n this.replaceChildren();\n reportUnrendered(this, tagName, error instanceof Error ? error : new Error(String(error)));\n return;\n }\n /*\n * Set up property getters/setters that forward into reactive state. Private entries get NO\n * accessor: the property-first interface IS the props mechanism, so defining one would leave\n * `el[\"#cache\"] = x` writing straight through everything above.\n */\n for (const key of Object.keys(def.state ?? {})) {\n if (isPrivateStateKey(key)) {\n continue;\n }\n /* A name the platform already owns (`title`, `lang`, `hidden`) keeps its native setter, so\n the attribute still reflects — and ALSO reaches state. Skipping it entirely meant a prop\n delivered after connection (a template over data that resolves asynchronously) wrote\n only the attribute: the instance kept the empty value it connected with, and a card's\n `title` never rendered. */\n const native = nativeSetter(this, key);\n Object.defineProperty(this, key, {\n configurable: true,\n get: () => state[key],\n set: (v: JxScopeValue) => {\n native?.call(this, v);\n state[key] = v;\n },\n });\n }\n\n this._state = state;\n\n // Capture light DOM children (for slot distribution) before rendering\n const slottedChildren = captureSlotted(this);\n this.replaceChildren();\n\n /* Custom elements default to `display: inline`; a Jx container behaves like a `<div>`, so\n one is supplied. It goes in the element's OWN RULE rather than inline: an inline\n declaration is beaten only by `!important`, so a consumer could not override the default\n without one. At (0,1,0) a consumer's rule, a cascade layer or a parent's descendant rule\n all win normally, and the definition's own `display` still wins because it is written into\n the same rule after this. */\n const ownStyle = def.style;\n const defStyle =\n ownStyle && declaresDisplay(ownStyle) ? ownStyle : { display: \"block\", ...ownStyle };\n /* Definition first, call site second, so the call site wins at equal specificity by source\n order — the promise §9.2 already makes for base-before-nested. Merged into ONE call\n because each `applyStyle` releases what the last one interned. */\n const hostStyle = mergeStyle(defStyle, callSiteStyles.get(this));\n\n // Render template into light DOM (once, not in effect — inner effects handle reactivity)\n applyStyle(this, hostStyle, scopeMedia(state), state);\n applyAttributes(this, def.attributes ?? {}, state);\n bindDefinitionHandlers(this, def, state);\n\n /*\n * Root-level `textContent` is a definition's content just as much as `children` is — it is\n * the shape spec.md §17.2 recommends when every child would be a bare string — and it was\n * dropped here, so such a component rendered empty everywhere the interpreter runs.\n */\n if (!Array.isArray(def.children) && def.textContent !== undefined) {\n bindProperty(this, \"textContent\", def.textContent, state);\n }\n const children = Array.isArray(def.children) ? def.children : [];\n /* A render that throws is reported the way a refusal is (§16.4), for the same reason: thrown\n onward from this async callback it is an unhandled rejection naming no element. The\n children drawn before the throw stay; the one that threw, its later siblings and `onMount`\n do not happen, and slot content is still distributed into the slots that were drawn. */\n const draw = (): Error | null => {\n /* An instance the studio stamped is part of the page being edited, so everything the\n definition draws inside it is too — and the de-link rules cannot see that from the nodes\n themselves. Restored rather than cleared, because one definition may render another. */\n const wasInside = _canvasInsideStampedHost;\n _canvasInsideStampedHost ||= this.dataset.jxPath !== undefined;\n /* And the chain, for the same span: an instance this definition draws connects inside\n `this.append` below and reads it there ({@link underInstancePath}). */\n let failure: Error | null = null;\n try {\n underInstancePath(ownPath, () => {\n for (const childDef of children) {\n this.append(renderNode(childDef, state));\n }\n });\n } catch (error) {\n failure = error instanceof Error ? error : new Error(String(error));\n } finally {\n _canvasInsideStampedHost = wasInside;\n }\n // Slot distribution (light DOM)\n distributeSlots(this, slottedChildren);\n return failure;\n };\n\n /* Lifecycle: onMount, with the HOST as its second argument.\n A sidecar that must reach the element it belongs to had no way to: the runtime handed it\n the scope alone, so elements resorted to dispatching a `jx-ready` event at themselves and\n catching it with a root handler purely to learn `currentTarget`. The host is what the\n callback needed; the event round trip was the workaround.\n And with the host as its RECEIVER, which is how the compiled element calls it: there a\n state function is an arrow inside the element class, so a body's `this` is the element.\n Called bare here, a body written for the built site (jxsuite.com's search reads\n `const host = this`) read the window instead, and threw on every page that drew it live. */\n const mounted = (): void => {\n const { onMount } = state;\n if (isScopeHook(onMount)) {\n queueMicrotask(() => onMount.call(this, state, this));\n }\n };\n\n let attempt = runScoped(draw);\n const failure = attempt.result;\n if (!failure) {\n mounted();\n return;\n }\n reportUnrendered(this, tagName, failure);\n /* …and it is drawn again when what it was given changes (§16.4). A prop bound to data that\n arrives later (a collection the page resolves after its first render, a row a list fills\n in) reaches the instance AFTER it connected, so the render that threw was a render of\n the empty values, not of the instance. Without a retry it stayed blank for good even once\n every value it needed was there. The watch reads the definition's authored entries only,\n the ones a prop can write: a computed entry is what threw, and reading it here would\n throw again. Writes are coalesced into one microtask, because a parent sets its props one\n at a time. The same error is reported once, not once per attempt. */\n const inputs = [...declaredDefaults(def).keys()].filter((key) => !isPrivateStateKey(key));\n let lastMessage = failure.message;\n let queued = false;\n const watch = effect(\n () => {\n for (const key of inputs) {\n void state[key];\n }\n },\n {\n scheduler: () => {\n if (queued) {\n return;\n }\n queued = true;\n queueMicrotask(() => {\n queued = false;\n if (!this.isConnected) {\n watch.effect.stop();\n return;\n }\n watch();\n attempt.stop();\n this.replaceChildren();\n pauseTracking();\n try {\n attempt = runScoped(draw);\n } finally {\n resetTracking();\n }\n const again = attempt.result;\n if (!again) {\n watch.effect.stop();\n mounted();\n } else if (again.message !== lastMessage) {\n lastMessage = again.message;\n reportUnrendered(this, tagName, again);\n }\n });\n },\n },\n );\n }\n\n disconnectedCallback() {\n // Called as a method, so a hook that reads `this` sees the scope.\n const state = this._state;\n if (state && isScopeHook(state.onUnmount)) {\n state.onUnmount(state);\n }\n }\n\n adoptedCallback() {\n const state = this._state;\n if (state && isScopeHook(state.onAdopted)) {\n state.onAdopted(state);\n }\n }\n\n attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null) {\n if (!this._state || oldVal === newVal) {\n return;\n }\n // The CURRENT definition's defaults, so a redefinition (embedding.md §7) that changes one\n // Reaches an instance that is already connected.\n absorbAttribute(\n this._state,\n name,\n newVal,\n declaredDefaults(_elementDefs.get(tagName)?.doc ?? initialDef),\n );\n }\n };\n\n customElements.define(tagName, ElementClass);\n}\n\n/**\n * Render a registered custom element with $props (property-first interface).\n *\n * @param {JxElement} def\n * @param {JxScope} state\n * @param {JxRenderOptions} [options]\n * @param {JxPath} [path]\n * @returns {HTMLElement}\n */\nfunction renderCustomElementWithProps(\n def: JxElement,\n state: JxScope,\n options?: JxRenderOptions,\n path?: JxPath,\n) {\n const el = document.createElement(resolveTagName(def.tagName, state));\n\n if (options?.onNodeCreated) {\n options.onNodeCreated(el, path ?? [], def, state);\n }\n\n // Set JS properties from $props (before connection)\n for (const [key, val] of Object.entries(def.$props ?? {})) {\n if (refusePrivateProp(key, \"$props\")) {\n continue;\n }\n /* The same resolution `bindProperty` gives an ordinary element. A `$props: { src }` on a custom\n element is an asset reference authored at the USAGE site, so it belongs to the document that\n wrote it — a media prop the component forwards into its own `<img>` is resolved separately,\n inside the component's render, against the same context. */\n const write = (resolved: JxScopeValue): void => {\n const value = isString(resolved) ? canvasAssetValue(el.tagName, key, resolved) : resolved;\n elementProperties(el)[key] = value;\n /* A declared prop that shares its name with an `HTMLElement` property (`title`, `lang`) gets\n no forwarding accessor (§16.2), so the write above lands on the element and never reaches\n the instance's state. Connection reads it once; a binding that changes AFTER connection\n (a row whose data arrives later) was lost, and the instance went on drawing the value it\n connected with. The binding is the parent's `$props`, addressed to the definition's prop,\n so it writes that prop's state. */\n const instanceState = instanceStateOf(el);\n if (\n instanceState &&\n key in HTMLElement.prototype &&\n Object.hasOwn(toRaw(instanceState), key)\n ) {\n instanceState[key] = value;\n }\n };\n if (isRefValue(val)) {\n const refVal = val;\n write(resolveRef(refVal.$ref, state));\n // Reactive forwarding: re-set the property when the source changes\n effect(() => {\n write(resolveRef(refVal.$ref, state));\n });\n } else if (isTemplateString(val)) {\n bindTemplate(val, () => {\n write(evaluateTemplate(val, state));\n });\n } else {\n write(val);\n }\n }\n\n /* Apply host-level style and attributes from the usage site.\n Also REMEMBERED, because `connectedCallback` applies the definition's style through the same\n interning path and `applyStyleInto` releases the element's existing rules first — so without\n this the call site's declarations were written here and deleted a moment later, and a document\n could not style an element instance at all. See {@link callSiteStyles}. */\n if (def.style) {\n callSiteStyles.set(el, def.style);\n }\n applyStyle(el, def.style ?? {}, scopeMedia(state), state);\n applyAttributes(el, def.attributes ?? {}, state);\n /* And its ordinary properties and handlers — `id`, `hidden`, `className`, an `onselect` — exactly\n as an ordinary element gets them. A custom element used in a document is still an element in\n that document; only `$props` are the definition's to absorb. */\n applyProperties(el, def, state);\n\n // Append slotted children. A mapped array is not a node: its rows are rendered in place, ahead of\n // Their anchor, exactly as they are under an ordinary element — so a `$map` of menu rows inside a\n // `jx-menu` is a list of rows, not one `<div>` standing where the list should be.\n const children = Array.isArray(def.children) ? def.children : [];\n for (let i = 0; i < children.length; i++) {\n const child = children[i]!;\n const childOpts = options && path ? { ...options, _path: [...path, \"children\", i] } : undefined;\n if (isMappedArray(child)) {\n renderMappedArrayInto(el, child, state, childOpts);\n } else {\n el.append(renderNode(child, state, childOpts));\n }\n }\n\n return el;\n}\n\n/**\n * Whether a node is an element, by its `nodeType` (which, unlike `instanceof`, holds across\n * realms).\n *\n * @param {Node} node\n * @returns {node is Element}\n */\nfunction isElementNode(node: Node): node is Element {\n return node.nodeType === Node.ELEMENT_NODE;\n}\n\n/**\n * Whether a node is a text node, by its `nodeType`.\n *\n * @param {Node} node\n * @returns {node is Text}\n */\nfunction isTextNode(node: Node): node is Text {\n return node.nodeType === Node.TEXT_NODE;\n}\n\n/**\n * Whether a node is a comment, by its `nodeType`.\n *\n * @param {Node} node\n * @returns {node is Comment}\n */\nfunction isCommentNode(node: Node): node is Comment {\n return node.nodeType === Node.COMMENT_NODE;\n}\n\n// ─── Slot distribution (spec.md §8.5) ─────────────────────────────────────────\n\n/**\n * Text that is only HTML whitespace (space, tab, line feed, form feed, carriage return): never slot\n * content. A non-breaking space is not in the set, and `+` keeps an empty text node out of it, so\n * the text node a binding is about to write stays with its group.\n */\nexport const SLOT_WHITESPACE = /^[\\t\\n\\f\\r ]+$/u;\n\n/** The word that opens a prerendered slot group's comment bracket: `<!--jx-slot n name-->`. */\nexport const SLOT_MARK = \"jx-slot\";\n\n/** The attribute a prerendered instance carries when its slot groups are bracketed by `n`. */\nexport const SLOT_ATTR = \"data-jx-slots\";\n\n/**\n * The `Symbol.for` key of the shared group record: node → the slot group it belongs to.\n *\n * Shared through `globalThis` because each compiled component module carries its own copy of the\n * distribution helper, and a record one of them (or this runtime) writes has to be read by\n * whichever element captures the node next.\n */\nexport const SLOT_RECORD_KEY = \"jx.slot.group\";\n\n/** The record itself; read before a node's own `slot` attribute, and deleted once read. */\nconst slotRecord: WeakMap<Node, string> = (() => {\n const key = Symbol.for(SLOT_RECORD_KEY);\n /* SAFETY: the one value ever stored under this registered symbol is this WeakMap, written by\n this runtime or by a compiled module's inlined helper (`slotHelperSource` in the compiler). */\n const holder = globalThis as typeof globalThis & Record<symbol, WeakMap<Node, string>>;\n holder[key] ??= new WeakMap<Node, string>();\n return holder[key];\n})();\n\n/**\n * The children an element distributes into its slots, taken before its template renders.\n *\n * A prerendered instance is the exception, and the reason this is a function. Its children are the\n * prerendered markup, and re-rendering would capture the component's own template as slot content.\n * The prerender therefore stamps it `data-jx-slots=\"n\"` and brackets every group it placed with\n * `<!--jx-slot n name-->` … `<!--/jx-slot n-->`; this returns exactly the nodes inside this host's\n * brackets, recording each one's group name, and removes the attribute. The id is needed because a\n * forwarded group sits inside a nested instance's own brackets, and the name because a nested\n * instance that upgrades first must not regroup the enclosing instance's nodes.\n *\n * @param {Element} host\n * @returns {ChildNode[]}\n */\nexport function captureSlotted(host: Element): ChildNode[] {\n const id = host.getAttribute(SLOT_ATTR);\n if (id === null) {\n return [...host.childNodes];\n }\n host.removeAttribute(SLOT_ATTR);\n const opener = `${SLOT_MARK} ${id} `;\n const closer = `/${SLOT_MARK} ${id}`;\n const openers: Comment[] = [];\n const walker = host.ownerDocument.createTreeWalker(host, NodeFilter.SHOW_COMMENT);\n for (let n = walker.nextNode(); n; n = walker.nextNode()) {\n if (isCommentNode(n) && n.data.startsWith(opener)) {\n openers.push(n);\n }\n }\n const captured: ChildNode[] = [];\n for (const open of openers) {\n const name = decodeURIComponent(open.data.slice(opener.length));\n for (let n = open.nextSibling; n; n = n.nextSibling) {\n if (isCommentNode(n) && n.data === closer) {\n break;\n }\n slotRecord.set(n, name);\n captured.push(n);\n }\n }\n return captured;\n}\n\n/**\n * Whether a group holds content: an element, or a text node that is not empty. A comment (a lit\n * part marker, a repeater's anchor) travels with its group but does not stop the fallback showing.\n *\n * @param {readonly ChildNode[]} group\n * @returns {boolean}\n */\nfunction slotGroupHasContent(group: readonly ChildNode[]): boolean {\n return group.some((n) => isElementNode(n) || (isTextNode(n) && n.data !== \"\"));\n}\n\n/**\n * Light-DOM slot distribution: replace each `<slot>` under `host` with the captured children of its\n * group, or with its own fallback children when that group has no content (spec.md §8.5).\n *\n * - **Group.** A node's group is its record when it has one, else an element's `slot` attribute, else\n * the unnamed group (`\"\"`). Whitespace-only text is discarded: compiled hosts are parsed HTML\n * full of formatting whitespace, and whitespace placed in a part makes its `:empty` false.\n * - **Place.** Slots are taken in tree order and the FIRST of a name takes its group; a later one of\n * the same name shows its fallback. That is the DOM's \"find a slot\", so the answer does not\n * change when a component moves to a shadow root. A slot inside a fallback that was not shown\n * still takes its name, which keeps the static prerender's answer the same as this one.\n * - **Forward.** A slot written directly inside ANOTHER custom element's children is that element's\n * child. What it places there is recorded with the slot's own group (its record, else its `slot`\n * attribute), so the nested element distributes it by that name whether it captures before or\n * after this runs.\n *\n * No early return when nothing was slotted: a slot leaves no node either way, and a surviving slot\n * made `[part=\"label\"]:empty` false for a control with no label. A slot is replaced, not filled:\n * the selector tree is what a definition's `& > x` rules match, and a slot left as a wrapper turned\n * every slotted child into a grandchild (§16.6).\n *\n * @param {ParentNode} host\n * @param {readonly ChildNode[]} captured\n */\nexport function distributeSlots(host: ParentNode, captured: readonly ChildNode[]): void {\n const slots = [...host.querySelectorAll(\"slot\")];\n if (slots.length === 0) {\n return;\n }\n const groups = new Map<string, ChildNode[]>();\n for (const n of captured) {\n if (isTextNode(n) && SLOT_WHITESPACE.test(n.data)) {\n continue;\n }\n const recorded = slotRecord.get(n);\n slotRecord.delete(n);\n const name = recorded ?? (isElementNode(n) ? (n.getAttribute(\"slot\") ?? \"\") : \"\");\n let group = groups.get(name);\n if (!group) {\n group = [];\n groups.set(name, group);\n }\n group.push(n);\n }\n const taken = new Set<string>();\n for (const slot of slots) {\n const name = slot.getAttribute(\"name\") ?? \"\";\n let group: ChildNode[] = [];\n if (!taken.has(name)) {\n taken.add(name);\n group = groups.get(name) ?? [];\n }\n const placed = slotGroupHasContent(group) ? group : [...group, ...slot.childNodes];\n const parent = slot.parentElement;\n if (parent && parent !== host && parent.localName.includes(\"-\")) {\n const forwarded = slotRecord.get(slot) ?? slot.getAttribute(\"slot\") ?? \"\";\n for (const n of placed) {\n slotRecord.set(n, forwarded);\n }\n }\n slot.replaceWith(...placed);\n }\n}\n"
16
16
  ],
17
- "mappings": ";AAMA,SAAS,OAAO,CAAC,KAAK;AAAA,EACpB,MAAM,sBAAsB,OAAO,OAAO,IAAI;AAAA,EAC9C,WAAW,OAAO,IAAI,MAAM,GAAG;AAA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