@verajs/renderer 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -6
- package/dist/development/vera-renderer-elements.js.map +1 -1
- package/dist/development/vera-renderer-hydrate-slots.js +1 -1
- package/dist/development/vera-renderer-hydrate-slots.js.map +1 -1
- package/dist/development/vera-renderer-hydration.d.ts.map +1 -1
- package/dist/development/vera-renderer-hydration.js +42 -4
- package/dist/development/vera-renderer-hydration.js.map +1 -1
- package/dist/development/vera-renderer-portal.js +1 -1
- package/dist/development/vera-renderer-portal.js.map +1 -1
- package/dist/development/vera-renderer-profiler.d.ts.map +1 -1
- package/dist/development/vera-renderer-profiler.js +304 -97
- package/dist/development/vera-renderer-profiler.js.map +1 -1
- package/dist/development/vera-renderer-slots.js +1 -1
- package/dist/development/vera-renderer-slots.js.map +1 -1
- package/dist/development/vera-renderer-spread.js.map +1 -1
- package/dist/development/vera-renderer-tag.js.map +1 -1
- package/dist/development/vera-renderer.d.ts.map +1 -1
- package/dist/development/vera-renderer.js +304 -97
- package/dist/development/vera-renderer.js.map +1 -1
- package/dist/vera-renderer-elements.min.js.map +1 -1
- package/dist/vera-renderer-hydrate-slots.min.js +1 -1
- package/dist/vera-renderer-hydrate-slots.min.js.map +1 -1
- package/dist/vera-renderer-hydration.min.js +1 -1
- package/dist/vera-renderer-hydration.min.js.map +1 -1
- package/dist/vera-renderer-portal.min.js +1 -1
- package/dist/vera-renderer-portal.min.js.map +1 -1
- package/dist/vera-renderer-slots.min.js +1 -1
- package/dist/vera-renderer-slots.min.js.map +1 -1
- package/dist/vera-renderer-spread.min.js.map +1 -1
- package/dist/vera-renderer-tag.min.js.map +1 -1
- package/dist/vera-renderer.min.js +1 -1
- package/dist/vera-renderer.min.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @verajs/renderer
|
|
2
2
|
|
|
3
|
-
The DOM renderer for VeraJS — <!--size:renderer.gzip-->
|
|
3
|
+
The DOM renderer for VeraJS — <!--size:renderer.gzip-->6.26 KB<!--/size:renderer.gzip--> gzipped,
|
|
4
4
|
no dependencies, no build step required.
|
|
5
5
|
|
|
6
6
|
Tagged templates parse once and clone; every render after the first walks only the value slots, so
|
|
@@ -313,8 +313,9 @@ moved. Rows are keyed by an item's own `id`, else by the item itself. `lists` ne
|
|
|
313
313
|
bare `{ on: 'render', fn: renderInto }` its rows cannot commit themselves, so every row's change re-renders the parent,
|
|
314
314
|
and development says so once (`lists-no-renderer`). `createSelector(() => state.selected)` returns
|
|
315
315
|
`isSelected(key)`, which re-renders only the old and the new key's rows on a change. Without `lists` wired, development says so once
|
|
316
|
-
(`lists-unwired`) when such a `.map` returns templates, since rows are then matched by position
|
|
317
|
-
|
|
316
|
+
(`lists-unwired`) when such a `.map` returns unkeyed templates, since rows are then matched by position (rows from
|
|
317
|
+
`keyed()`, or JSX's `key={id}`, are matched by key and say nothing); to match by position on purpose, map a plain copy,
|
|
318
|
+
`[...state.rows].map(…)`. The copy still TRACKS — spreading reads every index, so the render
|
|
318
319
|
re-runs on any item change — it opts out of keying, not of reactivity. **Hydrated, an automatic list adopts the server's rows**
|
|
319
320
|
(their nodes, and a component row's element) instead of rebuilding them; a component row is handed its `.item` AFTER it
|
|
320
321
|
upgrades — its first render may see `undefined`, so read it as `this.item?.label`. Not released; the design is still
|
|
@@ -1026,7 +1027,7 @@ required in the server markup, and one in the server markup that your template d
|
|
|
1026
1027
|
a disagreement. A comment renders nothing, so neither direction changes what a reader sees; matching
|
|
1027
1028
|
on them would only cost every commented template its adoption.
|
|
1028
1029
|
|
|
1029
|
-
On a CDN page, load `vera-renderer-hydration.min.js` beside `vera-renderer.min.js
|
|
1030
|
+
On a CDN page, load `vera-renderer-hydration.min.js` beside `vera-renderer.min.js`, from the same version, and wire both. Apps that never
|
|
1030
1031
|
hydrate download none of this.
|
|
1031
1032
|
|
|
1032
1033
|
### Importing this in Node
|
|
@@ -1289,8 +1290,7 @@ as it does in React. Render a field, not a raw API object.)
|
|
|
1289
1290
|
obviously wrong call, is caught in development: a template that cannot work as written throws there (a name
|
|
1290
1291
|
expression, below; a value in TAG position, `<${x}>`, which needs a tag value from `@verajs/renderer/tag`;
|
|
1291
1292
|
`renderInto` without a container; `keyed` without a template; a template ending inside a tag; a binding beside or
|
|
1292
|
-
inside an element in an SVG/MathML `<title>` or `<style>`, which this renderer reads as text,
|
|
1293
|
-
`<xmp>`, `<noembed>`, `<noframes>` and `<plaintext>`, which the parser does), and a mistake that still renders
|
|
1293
|
+
inside an element in an SVG/MathML `<title>` or `<style>`, which this renderer reads as text), and a mistake that still renders
|
|
1294
1294
|
but not as meant is a `[vera]` warning (a self-closed `<div />`, a boolean child, a value that cannot
|
|
1295
1295
|
listen, `@clik`, a binding on an element the parser drops, content in the wrong namespace, a repeated key) — said
|
|
1296
1296
|
once where the mistake is in the template's source, and each time it happens where it is in a value (a boolean
|
|
@@ -1322,6 +1322,52 @@ checked. A bound `srcdoc`
|
|
|
1322
1322
|
URLs. `@verajs/ssr` applies the same rule, so a server never serves a link the client refuses.
|
|
1323
1323
|
Development builds name each refusal.
|
|
1324
1324
|
|
|
1325
|
+
**Security: a value enters a `<script>` only as a JSON data block.** A value in a script's text is code: on a page
|
|
1326
|
+
`@verajs/ssr` rendered, the browser runs it, and a value holding `<!--<script>` would make the rest of the page script
|
|
1327
|
+
text. So a script hole is accepted only when the script is a JSON data block — its `type`, as written in the template,
|
|
1328
|
+
ends in `json` (`application/json`, `application/ld+json`), with no character reference — for handing state to the
|
|
1329
|
+
client or for JSON-LD:
|
|
1330
|
+
|
|
1331
|
+
```js
|
|
1332
|
+
html`<script type="application/ld+json">${JSON.stringify(schema)}</script>`;
|
|
1333
|
+
```
|
|
1334
|
+
|
|
1335
|
+
Any other script hole is refused, in every build: by `@verajs/ssr` (`ssr-script-hole`) and by this renderer
|
|
1336
|
+
(`script-hole`). A template's HTML `<script>` never runs on the live page, but a page saved from the DOM and served again
|
|
1337
|
+
runs it, and an SVG `<script>` from a template runs in Chromium and WebKit — so an SVG script hole is refused even with
|
|
1338
|
+
a JSON type. The start tag judged is the one that opened the script, never one found in the script's own text.
|
|
1339
|
+
|
|
1340
|
+
**A `<style>`'s or a data block's text stays text after the page is saved and parsed again.** A browser serializes such
|
|
1341
|
+
an element's text exactly as it is, so a value written into it as it stands would become markup once the page is saved
|
|
1342
|
+
from the DOM (`outerHTML`, an editor's publish) and served again. So the renderer and `@verajs/ssr` write the same
|
|
1343
|
+
bytes: the element's statics and values composed together (a closer can form across a hole), a data block's every `<`
|
|
1344
|
+
as `\u003c`, which JSON reads back unchanged, and a style's every `</style` as `<\/style`, the same CSS. Hydration
|
|
1345
|
+
adopts a served text equal to that, and rewrites one that differs.
|
|
1346
|
+
|
|
1347
|
+
**A value in a text-only element is text, the same on every tier and the server** — a `<style>`, a JSON block, an HTML
|
|
1348
|
+
`<title>` or `<textarea>`: nothing for `null`/`undefined`, a list its items' text (nested lists flattened), anything
|
|
1349
|
+
else `String(value)`. A **template** in a `<style>` or a JSON block is **refused** (`template-in-text`; the server's
|
|
1350
|
+
`ssr-template-in-text`) — its markup is not text, so `<style>${rules.map(…)}</style>` joins the rules. In an HTML
|
|
1351
|
+
`<title>` or `<textarea>` the renderer places a template, as it always has, and development warns that it is never
|
|
1352
|
+
shown there (`template-in-text`); **the server refuses it** (`ssr-template-in-text`). That is a recorded difference: such
|
|
1353
|
+
a template is a mistake either way, and the server cannot write elements a browser would keep there (it reads that
|
|
1354
|
+
content back as text). An SVG `<title>` is markup (an integration point), so a template there renders, as the server
|
|
1355
|
+
renders it.
|
|
1356
|
+
|
|
1357
|
+
**A value inside an element whose content is never shown is text that can never become markup** — an `<iframe>`, a
|
|
1358
|
+
`<noscript>`, and the obsolete `<xmp>`, `<noembed>`, `<noframes>` and `<plaintext>`. The renderer writes each value
|
|
1359
|
+
there fully encoded (every ASCII character but a letter, digit or `_` as a character reference), so a page saved from
|
|
1360
|
+
the DOM and parsed again, with scripting on or off, holds no value that ends the element or adds an attribute; an
|
|
1361
|
+
analytics pixel's URL in a `<noscript><img src=${…}>` reads back intact. A template there is refused
|
|
1362
|
+
(`template-in-text`). The server writes these values escaped as text, so its bytes differ from the client's, and
|
|
1363
|
+
hydration rewrites that text rather than adopting it. `@verajs/lite` and `@verajs/static` refuse a value there.
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
**`.textContent` into a `<style>` or `<script>` is the platform's, not a template hole.** A browser serializes such an
|
|
1367
|
+
element's text exactly as it is, so a user value written there with `.textContent=${value}` (or any DOM write) becomes
|
|
1368
|
+
markup the moment the page is saved through `innerHTML`/`outerHTML` and parsed again. Escape `</` in such a value
|
|
1369
|
+
yourself, or put it in a template hole, which does.
|
|
1370
|
+
|
|
1325
1371
|
**Security: spread refuses the injection sinks.** The `.innerHTML` posture above rests on the
|
|
1326
1372
|
template spelling being greppable, obviously yours, and reviewable — three properties a spread key
|
|
1327
1373
|
does not have, because spread names arrive at runtime inside a props object that is often built
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vera-renderer-elements.js","sources":["../../../shared-utils/src/diagnostic.ts","../../../shared-utils/src/utils.ts","../../src/elements-diagnostics.ts","../../src/elements.ts"],"sourcesContent":["/**\n * **Where every diagnostic code is explained.** The URL is permanent: a released bundle is immutable, so every version\n * published points here for ever — the domain cannot lapse and `/e/` cannot be reorganized without breaking links in\n * code nobody can edit; the docs site redirects instead. `scripts/sync-diagnostics.mjs` imports this constant, so the\n * pages and the bundles can never disagree about where they are.\n */\nexport const DOCS = 'https://verajs.dev/e/';\n\n/**\n * **What this copy of the framework has already said** (Brian's ruling, 2026-11-12): the ONE memory behind `warnOnce`, `errorOnce`\n * and `hasWarned`, for DEVELOPMENT-ONLY warnings. It replaced the hand-written once-flags every package kept\n * (`saidLists`, `warnedDrop`, per-element WeakSets, per-key Sets: two naming styles, Brian: no names). **A warning that\n * ships to production keeps its memory at its site** (bytes, measured 2026-11-12: the shared memory costs +80–145 B gz\n * per bundle); development-only warnings use warnOnce. Module state by necessity, since \"once\" spans every call on the\n * page. One per BUNDLE COPY, exactly the scope each flag had, because this package is inlined into every bundle.\n * A code, or `code key` for a string key, in a Set. An object key (an element, a setup function) in a WeakMap, so its\n * entry goes with the object. Marked pure, so a bundle that never prints once drops both.\n */\nconst printed = /* @__PURE__ */ new Set<string>();\nconst printedOn = /* @__PURE__ */ new WeakMap<object, Map<string, Set<unknown>>>();\n/**\n * A once's KEY: none (once per page), a string (once per that string), an object (once per that object: an element, a\n * class, a setup function), or the PAIR `[object, value]`, a value key on that object (a store write: the object and its\n * property; a keyed list: the list and the duplicate key, compared as the list compares them, by value, so `1` and `'1'`\n * stay apart). A pair is the only array a key may be.\n */\ntype OnceKey = string | object | readonly [object, unknown];\n/** Where an object key's (code, value) lives: the value set for that code on that object, made on demand. */\nconst valuesOn = (on: object, code: string, make: boolean): Set<unknown> | undefined => {\n let codes = printedOn.get(on);\n if (codes === undefined) {\n if (!make) return undefined;\n printedOn.set(on, (codes = new Map()));\n }\n let values = codes.get(code);\n if (values === undefined && make) codes.set(code, (values = new Set()));\n return values;\n};\n/** The object and value of an object or pair key. */\nconst split = (key: object): readonly [object, unknown] => (Array.isArray(key) ? (key as unknown as readonly [object, unknown]) : [key, undefined]);\n/** Whether (code, key) is new, recording it if so. */\nconst firstTime = (code: string, key?: OnceKey): boolean => {\n if (key === undefined || typeof key === 'string') {\n const entry = key === undefined ? code : `${code} ${key}`;\n if (printed.has(entry)) return false;\n printed.add(entry);\n return true;\n }\n const [on, sub] = split(key);\n const values = valuesOn(on, code, true)!;\n if (values.has(sub)) return false;\n values.add(sub);\n return true;\n};\n\n/**\n * **One shape for every diagnostic the framework prints** — the short line production keeps, the whole sentence\n * development adds — so a package converting its messages writes a table and a call, never its own format.\n *\n * production `[vera] hydration: element: found <i> — https://verajs.dev/e/hydration-fallback`\n * development `[vera] hydration: element: found <i> — fell back to a client render: … (hydration-fallback)`\n *\n * `subject` is the free information — what the code already has at hand, naming the problem area — the same in both\n * builds. `prose` is development only: the package's table entry (`Prose`), called behind `__DEV__` at the call site so\n * the table goes unreferenced in production and rollup drops it whole. Production prints the code inside the link, so\n * the reader is one click from the explanation, which `scripts/sync-diagnostics.mjs` publishes from the same tables.\n *\n * **Every production message is coded** (Brian, 2026-11-11; this supersedes \"convert where smaller\", 2026-10-02):\n * consistency over a few bytes, so no package keeps a hand-written production line beside its table.\n */\n/*\n * The parameter names are deliberately unlike anything a caller holds: terser will not inline a function whose\n * parameter shadows a name at the call site (measured 2026-10-02 — directives passes its own `code`, and a parameter\n * called `code` left `((e,t,n)=>`…`)(0,t,n)` in its bundle, +8 B; renamed, the call folds to the bare template).\n */\n/**\n * **A misused API, named by its function** — the thrown-error twin of `diagnostic()`: `untrack: expected a function …\n * (untrack-not-function)`, function-first because a stack already names the source and the sweep reads that shape. The\n * prose comes from a package's table, behind `__DEV__`, so a development-only guard costs production nothing.\n */\nexport const misuse = (forName: string, withCode: string, andProse?: false | readonly [string, string?]) =>\n __DEV__ && andProse\n ? `${forName}: ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `${forName}: ${DOCS}${withCode}`;\n\n/**\n * **A misused API and what it was misused ABOUT** — `misuse()` with a subject, in `diagnostic()`'s ` — ` separator:\n * `parseFrontmatter: line 3 — https://verajs.dev/e/cms-frontmatter-unsupported`. The subject is the free information\n * (a line, a URL and its status) and prints in both builds. A sibling rather than an optional parameter on `misuse()`,\n * because `misuse()` is inlined into every bundle that throws and a conditional subject would tax all of them for a\n * shape few need; a sibling is tree-shaken where unused.\n */\nexport const misuseAbout = (forName: string, aboutSubject: string, withCode: string, andProse?: false | readonly [string, string?]) =>\n __DEV__ && andProse\n ? `${forName}: ${aboutSubject} — ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `${forName}: ${aboutSubject} — ${DOCS}${withCode}`;\n\nexport const diagnostic = (\n inArea: string,\n bySubject: string,\n withCode: string,\n andProse?: false | readonly [string, string?]\n) =>\n /** `__DEV__` HERE as well as at the call: production folds this to the one-line form, branch and all. */\n __DEV__ && andProse\n ? `[vera] ${inArea}: ${bySubject} — ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `[vera] ${inArea}: ${bySubject} — ${DOCS}${withCode}`;\n\n/**\n * **Text from outside — a file path, a YAML key, a URL, an error's message — quoted before it reaches a line.** A log is a\n * pipeline, and such text can be shaped by an author or a request: a newline in it forges a line, an ESC sequence hides\n * one (log injection). `JSON.stringify` escapes both; cut to 80 characters so one value cannot fill the log. @verajs/ssr\n * keeps a twin (it cannot import this), held equal by tests/ssr-coded-diagnostics.\n */\n/**\n * `max` caps the length (80 by default); `Infinity` keeps the whole text for a value worth reading in full — a site\n * owner's own path — which is still ESCAPED: truncation and escaping are separate jobs, and a path is not free of control\n * characters just because its owner wrote it (2026-10-09).\n */\nexport const quoted = (text: string, max = 80): string => JSON.stringify(text.length > max ? `${text.slice(0, max)}…` : text);\n\n/**\n * **The errors a package constructs, marked as its own** — so a wrapper that reports an inner refusal (cms's\n * `generateManifest` around a frontmatter line) carries it as it is: already formatted, its outside text already\n * quoted. Anything else is foreign, and quoted. Identity, never a shape test: a message can imitate ours, an identity\n * cannot. @verajs/ssr keeps a twin (it cannot import this).\n */\nconst ours = /* @__PURE__ */ new WeakSet<object>();\nexport const own = <E extends Error>(error: E): E => {\n ours.add(error);\n return error;\n};\nexport const isOwn = (error: unknown): boolean => typeof error === 'object' && error !== null && ours.has(error);\n\n/**\n * **Whether this copy has already said `code` (for `key`)**: for a GUARD only, where deciding to warn costs work worth\n * skipping once the warning is out (development's whole-tree walk for unwired directive attributes, an event-name\n * guess over every property of an element). A site that only prints calls `warnOnce`. Asks, never records.\n */\nexport const hasWarned = (code: string, key?: OnceKey): boolean => {\n if (key === undefined || typeof key === 'string') return printed.has(key === undefined ? code : `${code} ${key}`);\n const [on, sub] = split(key);\n return valuesOn(on, code, false)?.has(sub) === true;\n};\n\ntype Detail = false | readonly [string, string?] | (() => readonly [string, string?] | undefined);\n/**\n * The printer behind both, on one level. `andDetail` is `diagnostic()`'s prose, or a function returning it where building\n * the sentence costs something: it is called only the first time. `...andMore` rides beside the line behind '%s' (an\n * element, a thrown error), never inside it, so text from outside cannot forge a line. The console method is read at the\n * call, so a test that replaces `console.warn` sees it.\n */\nconst sayOnce =\n (level: 'warn' | 'error') =>\n (inArea: string, bySubject: string, withCode: string, andDetail?: Detail, forKey?: OnceKey, ...andMore: unknown[]): void => {\n if (!firstTime(withCode, forKey)) return;\n const line = diagnostic(inArea, bySubject, withCode, typeof andDetail === 'function' ? andDetail() : andDetail);\n if (andMore.length) console[level]('%s', line, ...andMore);\n else console[level](line);\n };\n/**\n * **A diagnostic said once per page** (per key, where one is given: a string, or an object such as the element it is\n * about): `diagnostic()`'s arguments, then the key, then what rides beside the line. Coded in production exactly as\n * `diagnostic()` is, because it IS `diagnostic()`. `errorOnce` is its twin on `console.error`, for a refusal a page should\n * not miss.\n */\nexport const warnOnce = /* @__PURE__ */ sayOnce('warn');\nexport const errorOnce = /* @__PURE__ */ sayOnce('error');\n","import type { HandlerHolder, Untracked } from './types.js';\nimport { diagnostic } from './diagnostic.js';\nimport * as SHARED from './diagnostics.js';\n\n/**\n * Get an object's type.\n *\n * @param obj The object\n * @return The type\n */\nexport const getType = (obj: unknown) => Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();\n\n/**\n * Weak collections need their per-key dependencies stored weakly, or tracking `weakMap.get(obj)`\n * holds `obj` and defeats the whole point of the type. Checked by type string rather than\n * `instanceof`, which fails across realms (iframes, `vm`).\n */\n/**\n * A WeakMap or WeakSet (or WeakRef) — read from `Symbol.toStringTag`, the tag `Object.prototype.toString` itself reads, so\n * the answer is the same (another realm's collections included) without building and lower-casing a string on every first\n * tracked read of every object.\n */\nexport const isWeakCollection = (item: unknown) => {\n const tag = (item as { [Symbol.toStringTag]?: unknown } | null)?.[Symbol.toStringTag];\n return typeof tag === 'string' && (tag[0] === 'W' || tag[0] === 'w');\n};\n\n/**\n * Remove a trailing slash from an url if its not root url (`/`).\n *\n * @param str String to remove trailing slash from\n */\nexport const stripTrailingSlash = (str: string) => (str !== '/' && str.endsWith('/') ? str.slice(0, -1) : str);\n\n/**\n * **Reports an error nothing else handled, the way the platform reports one.** `reportError` fires\n * the window's `error` event — what `window.onerror`, error trackers and test runners listen for —\n * without unwinding the caller, so one failing hook or ref never stops its siblings. A bare\n * `console.error` reached none of those: a component could stop updating while every page-error\n * listener stayed silent. Off-browser (Node has no `reportError`) the console is all there is.\n * `line` is the framework's own line, printed beside the error — a CODED one (2026-10-09):\n * each caller passes `'[vera] <code>'` in production and its table's `diagnostic()` sentence in development, both\n * literal codes at the call site, so the static checks read them. The subject is fixed wording too (`a hook`, `an\n * element ref`), never a tag name: this line is the console's FORMAT (no `'%s'`, which measured +2–3 B on the renderer\n * bundles), so nothing from outside may reach it — the element goes to the `'error'` handlers instead. Production prints it only where the platform has no\n * `reportError` (Node); in a browser, `reportError` alone reports.\n *\n * Shared by core (a hook threw) and the renderer (a ref threw) so the fallback is one rule.\n */\nexport const reportUncaught = (error: unknown, line: string) => {\n if (typeof reportError !== 'function') console.error(line, error);\n else {\n if (__DEV__) console.error(line, error);\n reportError(error);\n }\n};\n\n/**\n * **Reports what user code a render called threw — to the app's `'error'` chain, else as uncaught.** One rule for\n * every callback the framework runs on the user's behalf and survives: a hook (core), an element ref, and an element\n * claim's `create`/`mount`/`unmount` (the renderer). The caller catches at the call site and carries on, so one\n * failing callback never stops its siblings or leaves a commit half applied. `element` is the component the error\n * belongs to, handed to each handler. Every throw is reported — nothing is deduped, as a hook's never was.\n * **Core keeps a deliberate twin** (`reportHookError`, the same rule as a `forEach`): routed through here it measured\n * +11 B gzip on `vera.min.js` (2026-10-09). A change to the rule changes both.\n */\nexport const reportTo = (handlers: readonly unknown[] | undefined, error: unknown, element: Element | undefined, line: string) => {\n if (handlers?.length) for (const handler of handlers) (handler as (error: unknown, element?: Element) => void)(error, element);\n else reportUncaught(error, line);\n};\n\n/** The component a render root belongs to: a shadow root's host, or a light root itself. */\nexport const hostOf = (root: Node | null | undefined): Element | undefined =>\n root == null ? undefined : root.nodeType === 11 ? (root as ShadowRoot).host : (root as Element);\n\n/** `fn(a, b, c)`, tracked as the caller is — the stand-in for core's `untracked` when no core was wired. */\nexport const call: Untracked = (fn, a, b, c) => fn(a!, b!, c!);\n\n/**\n * **Runs a bound handler, and its callers run it UNTRACKED**: the renderer's template `@event` and spread's event key,\n * each through `untracked(dispatch, holder, event)` (2026-10-09). An effect that fires an event synchronously\n * (`el.click()`, `focus()`, `dispatchEvent`) runs the handler INSIDE itself, and the handler's reads subscribed the\n * effect: a handler doing `state.n++` made the effect re-run on every click, a self-feeding loop held to one round per\n * frame, forever (measured). A handler's reads are event-time decisions, never a hook's inputs. The directives engine's\n * delegated `listen` makes the same choice its own way. A function is called with the element as `this`; an object\n * through its `handleEvent`. One function for both callers (Brian's size-audit ruling, 2026-11-13): it was two\n * identical copies, so a fix had two addresses; each bundle still inlines its own.\n */\nexport const dispatch = (holder: HandlerHolder, event: Event) => {\n const handler = holder._handler as EventListener | EventListenerObject | null;\n if (typeof handler === 'function') handler.call(holder._element as never, event);\n else if (typeof handler?.handleEvent === 'function') handler.handleEvent(event);\n};\n\n/**\n * **Whether a property binding is a `<select>`'s SELECTION** — `value` or `selectedIndex` — which the renderer and\n * `spread` both treat as live: re-asserted every render and compared against the live value (as `!value` is), because\n * a select's options can be replaced under an unchanged value, which drops the selection. One rule, asked once per\n * binding by both, so a template and a spread key cannot disagree about it.\n *\n * In development it names the one shape it cannot serve: on a `<select multiple>` both properties read and set a\n * SINGLE selection, so a selection the user adds is kept rather than controlled. Always writing there was measured\n * 2–3% slower on every table with a select per row, to serve an API that does not fit — hence a warning, not a cost.\n */\nexport const isSelection = (element: Element, name: unknown) => {\n if ((name !== 'value' && name !== 'selectedIndex') || element.localName !== 'select') return false;\n return true;\n};\n\n/**\n * Development: the one shape a selection binding cannot serve, named by the module the user wired (`side`). Called only\n * behind `__DEV__` at each call site, so production keeps `isSelection` exactly as small as it was (a `side` argument on\n * it measured +1 B, a default +9 B on vera-renderer.min.js — 2026-10-09).\n */\nexport const saySelectMultiple = (element: Element, name: unknown, side: string) => {\n if (element.hasAttribute('multiple'))\n console.warn(diagnostic(side, '<select multiple>', 'select-multiple', __DEV__ && SHARED.selectMultiple(String(name))));\n};\n\n/**\n * `target[key]`, as a function — how a component's GETTER is read through `untracked`. Not `Reflect.get`: `untracked`\n * passes three arguments, and `Reflect.get`'s third is the RECEIVER — `undefined` there runs the getter with no `this`.\n */\nexport const read = (target: object, key: string) => (target as Record<string, unknown>)[key];\n\n/**\n * **What a thrown value says, whatever was thrown — and it never throws itself.** A caught value comes from author\n * code (a `resolve` option, a motion tick or vocabulary function), and JavaScript can throw anything: `null`, an object\n * with no prototype (`String()` finds no `toString`), one whose `toString` or `message` getter throws, a Proxy whose\n * traps throw. Formatting it naively replaced the real failure with an unrelated TypeError from inside the framework.\n * Anything unreadable becomes a fixed phrase; `Object.prototype.toString` is no fallback, since it reads\n * `Symbol.toStringTag` through a Proxy's trap too.\n *\n * **A deliberate duplicate of `thrownMessage` in `packages/ssr/src/vera/escaping.ts` — fix both copies.** `@verajs/ssr`\n * is compiled per file with no bundling, so it cannot import this private, unpublished package at run time;\n * `tests/thrown-message-copies.test.mjs` runs one table of thrown values against both, so they cannot drift.\n */\nexport const thrownMessage = (error: unknown): string => {\n try {\n if (error instanceof Error) return String(error.message);\n const message = (error as { message?: unknown } | null)?.message;\n return typeof message === 'string' ? message : String(error);\n } catch {\n return '[unprintable value thrown]';\n }\n};\n","/** **`@verajs/renderer/elements`'s diagnostics — DEVELOPMENT ONLY.** Its bundle's own table, merged into the renderer's json. */\nimport type { Prose } from '@verajs/shared-utils';\n\nexport const PROSE: Record<string, Prose> = {\n 'claim-threw': (phase, outcome) => [\n `threw in ${phase}; its error is printed beside this line, and ${outcome}.`,\n \"Fix the claim's callback, or wire an 'error' insert to handle what claims throw.\",\n ],\n 'elements-hook-replaced': () => [\n \"a 'template' hook set an instance hook before `elements` (priority 10) and is replaced.\",\n 'Claim elements through the `element` insert instead of a second instance hook.',\n ],\n};\n","/**\n * **`@verajs/renderer/elements` — attach behavior to elements in templates.**\n *\n * ```js\n * const autofocus = { mount: (element) => element.focus() };\n * wire([renderer, elements, { on: 'element', fn: (el) => (el.hasAttribute('autofocus') ? autofocus : undefined) }]);\n * ```\n *\n * Every `'element'` claimant is asked about each element of a template ONCE, as the template is BUILT — on its\n * canonical content, so a tag and its static attributes are real and no binding is ever applied (a hydrated first\n * instance, whose elements are the server's with bound values in them, changes nothing). The answers are two flat\n * lists shared by every instance: element positions in document pre-order, and their behaviors. A template nobody\n * claimed anything in gets no instance hook at all. Each instance finds its claimed elements with one short walk to\n * those positions; once the render that created it has finished, each behavior's `mount` runs, and what it returns is\n * handed to `unmount` at teardown. Nothing runs per update.\n *\n * Built on the renderer's `'template'` insert and instance hook (`InstanceHook`); it imports nothing — the registry\n * arrives through its connector. An app that does not wire it pays nothing.\n */\nimport type { ElementBehavior, InstanceHook } from './types.js';\nimport { diagnostic, hostOf, reportTo } from '@verajs/shared-utils';\nimport { PROSE } from './elements-diagnostics.js';\n\ntype Claim = (element: Element) => ElementBehavior | undefined;\n\nlet registered: Map<string, unknown[]> | null = null;\n\n/**\n * **A claim's callbacks follow the ref rule** (Brian, 2026-10-09): user code a render calls is caught AT ITS CALL SITE\n * — so a template with no claims runs exactly the path it did — reported to the app's `'error'` chain with the\n * component it belongs to (else as uncaught), and the render, the other claims and the teardown carry on. A mid-commit\n * throw once left a component's root empty for good; `mount` propagating aborted every later claim's mount.\n */\nconst report = (error: unknown, root: Node | null, line: string) => reportTo(registered?.get('error'), error, hostOf(root), line);\n\n/**\n * **The next element of an instance in document pre-order, never leaving it.** A root is a fragment, or — for a\n * single-root template — its one element, which is then position 0. Bounded by the root rather than by the tree it\n * sits in, because a hydrated instance is already in the page.\n */\nconst firstIn = (root: Node): Element | null => (root.nodeType === 1 ? (root as Element) : (root as ParentNode).firstElementChild);\nconst nextIn = (node: Element, root: Node): Element | null => {\n if (node.firstElementChild !== null) return node.firstElementChild;\n for (let at: Element | null = node; at !== null && at !== root; at = at.parentElement)\n if (at.nextElementSibling !== null) return at.nextElementSibling;\n return null;\n};\n\n/**\n * One instance's claims until it mounts — its claimed elements and their behaviors, interleaved, where it rendered,\n * whether it was adopted — and then only what `unmount` needs. **The elements are released at mount**: per-instance\n * state that keeps DOM references past the moment it needs them costs every operation on the page (measured: ~7% on\n * select and swap of a table whose every row was claimed, operations that never touch it).\n */\ntype State = { f: (Element | ElementBehavior)[] | null; r: Node | null; a: boolean; k: unknown[] | undefined; d: boolean };\n\n/** The instance hook for one template, from the positions and behaviors its claimants answered. */\nconst hookFor = (positions: number[], behaviors: ElementBehavior[]): InstanceHook => ({\n $c: (instance, root, adopted) => {\n const found: (Element | ElementBehavior)[] = [];\n /**\n * ADOPTED, the instance arrives as its elements in template order (hydration pairs them): its live root already\n * holds what its nested parts rendered, so counting there would land on the wrong element.\n */\n const listed = Array.isArray(instance);\n let node = listed ? null : firstIn(instance as Node);\n let at = 0;\n for (let k = 0; k < positions.length; k++) {\n if (listed) node = (instance as readonly Element[])[positions[k]];\n else for (; at < positions[k]; at++) node = nextIn(node!, instance as Node);\n /**\n * At creation — before the first update, and before the instance is connected anywhere. A claim whose `create`\n * throws is reported and DROPPED for this instance (it never mounts or unmounts, being half made); the element\n * stays as the template built it — a claim inserts nothing — and every other claim carries on. The ref rule.\n */\n try {\n behaviors[k].create?.(node!, adopted);\n } catch (error) {\n report(error, root, __DEV__ ? diagnostic('elements', 'an element claim', 'claim-threw', __DEV__ && PROSE['claim-threw']('create', 'the render continued without it')) : '[vera] claim-threw');\n continue;\n }\n found.push(node!, behaviors[k]);\n }\n return { f: found, r: root, a: adopted, k: undefined, d: false } as State;\n },\n $m: (given) => {\n const state = given as State;\n /** Torn down before its render finished: it never mounts. */\n if (state.d) return;\n const found = state.f!;\n const context = { root: state.r, adopted: state.a };\n state.f = null;\n for (let i = 0; i < found.length; i += 2) {\n const behavior = found[i + 1] as ElementBehavior;\n let value;\n try {\n value = behavior.mount?.(found[i] as Element, context);\n } catch (error) {\n report(error, state.r, __DEV__ ? diagnostic('elements', 'an element claim', 'claim-threw', __DEV__ && PROSE['claim-threw']('mount', 'the others still mounted')) : '[vera] claim-threw');\n continue;\n }\n if (value !== undefined && behavior.unmount !== undefined) (state.k ??= []).push(found[i], behavior, value);\n }\n },\n $q: (given) => {\n const state = given as State;\n state.d = true;\n const kept = state.k;\n if (kept !== undefined)\n for (let i = 0; i < kept.length; i += 3)\n try {\n (kept[i + 1] as ElementBehavior).unmount!(kept[i + 2], kept[i] as Element);\n } catch (error) {\n report(error, state.r, __DEV__ ? diagnostic('elements', 'an element claim', 'claim-threw', __DEV__ && PROSE['claim-threw']('unmount', 'the rest of the teardown ran')) : '[vera] claim-threw');\n }\n },\n});\n\n/**\n * Asks the claimants about the template's canonical content, once, as it is built — and gives it an instance hook\n * only if something was claimed. The content is READ, never changed (see the `'template'` insert's contract).\n */\nconst claimTemplate = (built: object, _result: unknown, _readScope: unknown, root: Node) => {\n const claims = registered?.get('element') as Claim[] | undefined;\n if (claims === undefined || claims.length === 0) return;\n const template = built as { _$inst$?: InstanceHook };\n if (__DEV__ && template._$inst$ !== undefined)\n console.warn(diagnostic('elements', 'template', 'elements-hook-replaced', __DEV__ && PROSE['elements-hook-replaced']()));\n const positions: number[] = [];\n const behaviors: ElementBehavior[] = [];\n let at = 0;\n for (let node = firstIn(root); node !== null; node = nextIn(node, root), at++)\n for (let i = 0; i < claims.length; i++) {\n const behavior = claims[i](node);\n if (behavior !== undefined) {\n positions.push(at);\n behaviors.push(behavior);\n }\n }\n if (positions.length > 0) template._$inst$ = hookFor(positions, behaviors);\n};\n\n/** Wire it as `wire([renderer, elements, …claims])`. A bare module: it has no options. */\nexport const elements = [\n (registry: Map<string, unknown[]>) => {\n registered = registry;\n },\n { name: '@verajs/renderer/elements', on: 'template' as const, fn: claimTemplate, priority: 10 },\n];\n\nexport type { ElementBehavior } from './types.js';\n"],"names":[],"mappings":"AAAA;;;;;AAKG;AACI,MAAM,IAAI,GAAG,uBAAuB;AA2FpC,MAAM,UAAU,GAAG,CACxB,MAAc,EACd,SAAiB,EACjB,QAAgB,EAChB,QAA6C;AAE7C;AACA,OAAO,IAAI;AACT,MAAE,CAAA,OAAA,EAAU,MAAM,CAAA,EAAA,EAAK,SAAS,CAAA,GAAA,EAAM,QAAQ,CAAC,CAAC,CAAC,CAAA,EAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAA,CAAA,EAAI,QAAQ,CAAC,CAAC,CAAC,CAAA,CAAE,GAAG,EAAE,CAAA,EAAA,EAAK,QAAQ,CAAA,CAAA;MACnG,CAAA,OAAA,EAAU,MAAM,CAAA,EAAA,EAAK,SAAS,MAAM,IAAI,CAAA,EAAG,QAAQ,CAAA,CAAE;;ACxE3D;;;;;;;;;;;;;;AAcG;AACI,MAAM,cAAc,GAAG,CAAC,KAAc,EAAE,IAAY,KAAI;IAC7D,IAAI,OAAO,WAAW,KAAK,UAAU;AAAE,QAAA,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;SAC5D;AACH,QAAA,IAAI,OAAO;AAAE,YAAA,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;QACvC,WAAW,CAAC,KAAK,CAAC;IACpB;AACF,CAAC;AAED;;;;;;;;AAQG;AACI,MAAM,QAAQ,GAAG,CAAC,QAAwC,EAAE,KAAc,EAAE,OAA4B,EAAE,IAAY,KAAI;IAC/H,IAAI,QAAQ,EAAE,MAAM;QAAE,KAAK,MAAM,OAAO,IAAI,QAAQ;AAAG,YAAA,OAAuD,CAAC,KAAK,EAAE,OAAO,CAAC;;AACzH,QAAA,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC;AAClC,CA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QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAChC,YAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;AAC1B,gBAAA,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;AAClB,gBAAA,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC1B;QACF;AACF,IAAA,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC;AAC5E,CAAC;AAED;AACO,MAAM,QAAQ,GAAG;IACtB,CAAC,QAAgC,KAAI;QACnC,UAAU,GAAG,QAAQ;IACvB,CAAC;AACD,IAAA,EAAE,IAAI,EAAE,2BAA2B,EAAE,EAAE,EAAE,UAAmB,EAAE,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,EAAE;;;;;"}
|
|
1
|
+
{"version":3,"file":"vera-renderer-elements.js","sources":["../../../shared-utils/src/diagnostic.ts","../../../shared-utils/src/utils.ts","../../src/elements-diagnostics.ts","../../src/elements.ts"],"sourcesContent":["/**\n * **Where every diagnostic code is explained.** The URL is permanent: a released bundle is immutable, so every version\n * published points here for ever — the domain cannot lapse and `/e/` cannot be reorganized without breaking links in\n * code nobody can edit; the docs site redirects instead. `scripts/sync-diagnostics.mjs` imports this constant, so the\n * pages and the bundles can never disagree about where they are.\n */\nexport const DOCS = 'https://verajs.dev/e/';\n\n/**\n * **What this copy of the framework has already said** (Brian's ruling, 2026-11-12): the ONE memory behind `warnOnce`, `errorOnce`\n * and `hasWarned`, for DEVELOPMENT-ONLY warnings. It replaced the hand-written once-flags every package kept\n * (`saidLists`, `warnedDrop`, per-element WeakSets, per-key Sets: two naming styles, Brian: no names). **A warning that\n * ships to production keeps its memory at its site** (bytes, measured 2026-11-12: the shared memory costs +80–145 B gz\n * per bundle); development-only warnings use warnOnce. Module state by necessity, since \"once\" spans every call on the\n * page. One per BUNDLE COPY, exactly the scope each flag had, because this package is inlined into every bundle.\n * A code, or `code key` for a string key, in a Set. An object key (an element, a setup function) in a WeakMap, so its\n * entry goes with the object. Marked pure, so a bundle that never prints once drops both.\n */\nconst printed = /* @__PURE__ */ new Set<string>();\nconst printedOn = /* @__PURE__ */ new WeakMap<object, Map<string, Set<unknown>>>();\n/**\n * A once's KEY: none (once per page), a string (once per that string), an object (once per that object: an element, a\n * class, a setup function), or the PAIR `[object, value]`, a value key on that object (a store write: the object and its\n * property; a keyed list: the list and the duplicate key, compared as the list compares them, by value, so `1` and `'1'`\n * stay apart). A pair is the only array a key may be.\n */\ntype OnceKey = string | object | readonly [object, unknown];\n/** Where an object key's (code, value) lives: the value set for that code on that object, made on demand. */\nconst valuesOn = (on: object, code: string, make: boolean): Set<unknown> | undefined => {\n let codes = printedOn.get(on);\n if (codes === undefined) {\n if (!make) return undefined;\n printedOn.set(on, (codes = new Map()));\n }\n let values = codes.get(code);\n if (values === undefined && make) codes.set(code, (values = new Set()));\n return values;\n};\n/** The object and value of an object or pair key. */\nconst split = (key: object): readonly [object, unknown] => (Array.isArray(key) ? (key as unknown as readonly [object, unknown]) : [key, undefined]);\n/** Whether (code, key) is new, recording it if so. */\nconst firstTime = (code: string, key?: OnceKey): boolean => {\n if (key === undefined || typeof key === 'string') {\n const entry = key === undefined ? code : `${code} ${key}`;\n if (printed.has(entry)) return false;\n printed.add(entry);\n return true;\n }\n const [on, sub] = split(key);\n const values = valuesOn(on, code, true)!;\n if (values.has(sub)) return false;\n values.add(sub);\n return true;\n};\n\n/**\n * **One shape for every diagnostic the framework prints** — the short line production keeps, the whole sentence\n * development adds — so a package converting its messages writes a table and a call, never its own format.\n *\n * production `[vera] hydration: element: found <i> — https://verajs.dev/e/hydration-fallback`\n * development `[vera] hydration: element: found <i> — fell back to a client render: … (hydration-fallback)`\n *\n * `subject` is the free information — what the code already has at hand, naming the problem area — the same in both\n * builds. `prose` is development only: the package's table entry (`Prose`), called behind `__DEV__` at the call site so\n * the table goes unreferenced in production and rollup drops it whole. Production prints the code inside the link, so\n * the reader is one click from the explanation, which `scripts/sync-diagnostics.mjs` publishes from the same tables.\n *\n * **Every production message is coded** (Brian, 2026-11-11; this supersedes \"convert where smaller\", 2026-10-02):\n * consistency over a few bytes, so no package keeps a hand-written production line beside its table.\n */\n/*\n * The parameter names are deliberately unlike anything a caller holds: terser will not inline a function whose\n * parameter shadows a name at the call site (measured 2026-10-02 — directives passes its own `code`, and a parameter\n * called `code` left `((e,t,n)=>`…`)(0,t,n)` in its bundle, +8 B; renamed, the call folds to the bare template).\n */\n/**\n * **A misused API, named by its function** — the thrown-error twin of `diagnostic()`: `untrack: expected a function …\n * (untrack-not-function)`, function-first because a stack already names the source and the sweep reads that shape. The\n * prose comes from a package's table, behind `__DEV__`, so a development-only guard costs production nothing.\n */\nexport const misuse = (forName: string, withCode: string, andProse?: false | readonly [string, string?]) =>\n __DEV__ && andProse\n ? `${forName}: ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `${forName}: ${DOCS}${withCode}`;\n\n/**\n * **A misused API and what it was misused ABOUT** — `misuse()` with a subject, in `diagnostic()`'s ` — ` separator:\n * `parseFrontmatter: line 3 — https://verajs.dev/e/cms-frontmatter-unsupported`. The subject is the free information\n * (a line, a URL and its status) and prints in both builds. A sibling rather than an optional parameter on `misuse()`,\n * because `misuse()` is inlined into every bundle that throws and a conditional subject would tax all of them for a\n * shape few need; a sibling is tree-shaken where unused.\n */\nexport const misuseAbout = (forName: string, aboutSubject: string, withCode: string, andProse?: false | readonly [string, string?]) =>\n __DEV__ && andProse\n ? `${forName}: ${aboutSubject} — ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `${forName}: ${aboutSubject} — ${DOCS}${withCode}`;\n\nexport const diagnostic = (\n inArea: string,\n bySubject: string,\n withCode: string,\n andProse?: false | readonly [string, string?]\n) =>\n /** `__DEV__` HERE as well as at the call: production folds this to the one-line form, branch and all. */\n __DEV__ && andProse\n ? `[vera] ${inArea}: ${bySubject} — ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `[vera] ${inArea}: ${bySubject} — ${DOCS}${withCode}`;\n\n/**\n * **Text from outside — a file path, a YAML key, a URL, an error's message — quoted before it reaches a line.** A log is a\n * pipeline, and such text can be shaped by an author or a request: a newline in it forges a line, an ESC sequence hides\n * one (log injection). `JSON.stringify` escapes both; cut to 80 characters so one value cannot fill the log. @verajs/ssr\n * keeps a twin (it cannot import this), held equal by tests/ssr-coded-diagnostics.\n */\n/**\n * `max` caps the length (80 by default); `Infinity` keeps the whole text for a value worth reading in full — a site\n * owner's own path — which is still ESCAPED: truncation and escaping are separate jobs, and a path is not free of control\n * characters just because its owner wrote it (2026-10-09).\n */\nexport const quoted = (text: string, max = 80): string => JSON.stringify(text.length > max ? `${text.slice(0, max)}…` : text);\n\n/**\n * **The errors a package constructs, marked as its own** — so a wrapper that reports an inner refusal (cms's\n * `generateManifest` around a frontmatter line) carries it as it is: already formatted, its outside text already\n * quoted. Anything else is foreign, and quoted. Identity, never a shape test: a message can imitate ours, an identity\n * cannot. @verajs/ssr keeps a twin (it cannot import this).\n */\nconst ours = /* @__PURE__ */ new WeakSet<object>();\nexport const own = <E extends Error>(error: E): E => {\n ours.add(error);\n return error;\n};\nexport const isOwn = (error: unknown): boolean => typeof error === 'object' && error !== null && ours.has(error);\n\n/**\n * **Whether this copy has already said `code` (for `key`)**: for a GUARD only, where deciding to warn costs work worth\n * skipping once the warning is out (development's whole-tree walk for unwired directive attributes, an event-name\n * guess over every property of an element). A site that only prints calls `warnOnce`. Asks, never records.\n */\nexport const hasWarned = (code: string, key?: OnceKey): boolean => {\n if (key === undefined || typeof key === 'string') return printed.has(key === undefined ? code : `${code} ${key}`);\n const [on, sub] = split(key);\n return valuesOn(on, code, false)?.has(sub) === true;\n};\n\ntype Detail = false | readonly [string, string?] | (() => readonly [string, string?] | undefined);\n/**\n * The printer behind both, on one level. `andDetail` is `diagnostic()`'s prose, or a function returning it where building\n * the sentence costs something: it is called only the first time. `...andMore` rides beside the line behind '%s' (an\n * element, a thrown error), never inside it, so text from outside cannot forge a line. The console method is read at the\n * call, so a test that replaces `console.warn` sees it.\n */\nconst sayOnce =\n (level: 'warn' | 'error') =>\n (inArea: string, bySubject: string, withCode: string, andDetail?: Detail, forKey?: OnceKey, ...andMore: unknown[]): void => {\n if (!firstTime(withCode, forKey)) return;\n const line = diagnostic(inArea, bySubject, withCode, typeof andDetail === 'function' ? andDetail() : andDetail);\n if (andMore.length) console[level]('%s', line, ...andMore);\n else console[level](line);\n };\n/**\n * **A diagnostic said once per page** (per key, where one is given: a string, or an object such as the element it is\n * about): `diagnostic()`'s arguments, then the key, then what rides beside the line. Coded in production exactly as\n * `diagnostic()` is, because it IS `diagnostic()`. `errorOnce` is its twin on `console.error`, for a refusal a page should\n * not miss.\n */\nexport const warnOnce = /* @__PURE__ */ sayOnce('warn');\nexport const errorOnce = /* @__PURE__ */ sayOnce('error');\n","import type { HandlerHolder, Untracked } from './types.js';\nimport { diagnostic } from './diagnostic.js';\nimport * as SHARED from './diagnostics.js';\n\n/**\n * Get an object's type.\n *\n * @param obj The object\n * @return The type\n */\nexport const getType = (obj: unknown) => Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();\n\n/**\n * Weak collections need their per-key dependencies stored weakly, or tracking `weakMap.get(obj)`\n * holds `obj` and defeats the whole point of the type. Checked by type string rather than\n * `instanceof`, which fails across realms (iframes, `vm`).\n */\n/**\n * A WeakMap or WeakSet (or WeakRef) — read from `Symbol.toStringTag`, the tag `Object.prototype.toString` itself reads, so\n * the answer is the same (another realm's collections included) without building and lower-casing a string on every first\n * tracked read of every object.\n */\nexport const isWeakCollection = (item: unknown) => {\n const tag = (item as { [Symbol.toStringTag]?: unknown } | null)?.[Symbol.toStringTag];\n return typeof tag === 'string' && (tag[0] === 'W' || tag[0] === 'w');\n};\n\n/**\n * Remove a trailing slash from an url if its not root url (`/`).\n *\n * @param str String to remove trailing slash from\n */\nexport const stripTrailingSlash = (str: string) => (str !== '/' && str.endsWith('/') ? str.slice(0, -1) : str);\n\n/**\n * **Reports an error nothing else handled, the way the platform reports one.** `reportError` fires\n * the window's `error` event — what `window.onerror`, error trackers and test runners listen for —\n * without unwinding the caller, so one failing hook or ref never stops its siblings. A bare\n * `console.error` reached none of those: a component could stop updating while every page-error\n * listener stayed silent. Off-browser (Node has no `reportError`) the console is all there is.\n * `line` is the framework's own line, printed beside the error — a CODED one (2026-10-09):\n * each caller passes `'[vera] <code>'` in production and its table's `diagnostic()` sentence in development, both\n * literal codes at the call site, so the static checks read them. The subject is fixed wording too (`a hook`, `an\n * element ref`), never a tag name: this line is the console's FORMAT (no `'%s'`, which measured +2–3 B on the renderer\n * bundles), so nothing from outside may reach it — the element goes to the `'error'` handlers instead. Production prints it only where the platform has no\n * `reportError` (Node); in a browser, `reportError` alone reports.\n *\n * Shared by core (a hook threw) and the renderer (a ref threw) so the fallback is one rule.\n */\nexport const reportUncaught = (error: unknown, line: string) => {\n if (typeof reportError !== 'function') console.error(line, error);\n else {\n if (__DEV__) console.error(line, error);\n reportError(error);\n }\n};\n\n/**\n * **Reports what user code a render called threw — to the app's `'error'` chain, else as uncaught.** One rule for\n * every callback the framework runs on the user's behalf and survives: a hook (core), an element ref, and an element\n * claim's `create`/`mount`/`unmount` (the renderer). The caller catches at the call site and carries on, so one\n * failing callback never stops its siblings or leaves a commit half applied. `element` is the component the error\n * belongs to, handed to each handler. Every throw is reported — nothing is deduped, as a hook's never was.\n * **Core keeps a deliberate twin** (`reportHookError`, the same rule as a `forEach`): routed through here it measured\n * +11 B gzip on `vera.min.js` (2026-10-09). A change to the rule changes both.\n */\nexport const reportTo = (handlers: readonly unknown[] | undefined, error: unknown, element: Element | undefined, line: string) => {\n if (handlers?.length) for (const handler of handlers) (handler as (error: unknown, element?: Element) => void)(error, element);\n else reportUncaught(error, line);\n};\n\n/** The component a render root belongs to: a shadow root's host, or a light root itself. */\nexport const hostOf = (root: Node | null | undefined): Element | undefined =>\n root == null ? undefined : root.nodeType === 11 ? (root as ShadowRoot).host : (root as Element);\n\n/** `fn(a, b, c)`, tracked as the caller is — the stand-in for core's `untracked` when no core was wired. */\nexport const call: Untracked = (fn, a, b, c) => fn(a!, b!, c!);\n\n/**\n * **Runs a bound handler, and its callers run it UNTRACKED**: the renderer's template `@event` and spread's event key,\n * each through `untracked(dispatch, holder, event)` (2026-10-09). An effect that fires an event synchronously\n * (`el.click()`, `focus()`, `dispatchEvent`) runs the handler INSIDE itself, and the handler's reads subscribed the\n * effect: a handler doing `state.n++` made the effect re-run on every click, a self-feeding loop held to one round per\n * frame, forever (measured). A handler's reads are event-time decisions, never a hook's inputs. The directives engine's\n * delegated `listen` makes the same choice its own way. A function is called with the element as `this`; an object\n * through its `handleEvent`. One function for both callers (Brian's size-audit ruling, 2026-11-13): it was two\n * identical copies, so a fix had two addresses; each bundle still inlines its own.\n */\nexport const dispatch = (holder: HandlerHolder, event: Event) => {\n const handler = holder._handler as EventListener | EventListenerObject | null;\n if (typeof handler === 'function') handler.call(holder._element as never, event);\n else if (typeof handler?.handleEvent === 'function') handler.handleEvent(event);\n};\n\n/**\n * **Whether a property binding is a `<select>`'s SELECTION** — `value` or `selectedIndex` — which the renderer and\n * `spread` both treat as live: re-asserted every render and compared against the live value (as `!value` is), because\n * a select's options can be replaced under an unchanged value, which drops the selection. One rule, asked once per\n * binding by both, so a template and a spread key cannot disagree about it.\n *\n * In development it names the one shape it cannot serve: on a `<select multiple>` both properties read and set a\n * SINGLE selection, so a selection the user adds is kept rather than controlled. Always writing there was measured\n * 2–3% slower on every table with a select per row, to serve an API that does not fit — hence a warning, not a cost.\n */\nexport const isSelection = (element: Element, name: unknown) => {\n if ((name !== 'value' && name !== 'selectedIndex') || element.localName !== 'select') return false;\n return true;\n};\n\n/**\n * Development: the one shape a selection binding cannot serve, named by the module the user wired (`side`). Called only\n * behind `__DEV__` at each call site, so production keeps `isSelection` exactly as small as it was (a `side` argument on\n * it measured +1 B, a default +9 B on vera-renderer.min.js — 2026-10-09).\n */\nexport const saySelectMultiple = (element: Element, name: unknown, side: string) => {\n if (element.hasAttribute('multiple'))\n console.warn(diagnostic(side, '<select multiple>', 'select-multiple', __DEV__ && SHARED.selectMultiple(String(name))));\n};\n\n/**\n * `target[key]`, as a function — how a component's GETTER is read through `untracked`. Not `Reflect.get`: `untracked`\n * passes three arguments, and `Reflect.get`'s third is the RECEIVER — `undefined` there runs the getter with no `this`.\n */\nexport const read = (target: object, key: string) => (target as Record<string, unknown>)[key];\n\n/**\n * **What a thrown value says, whatever was thrown — and it never throws itself.** A caught value comes from author\n * code (a `resolve` option, a motion tick or vocabulary function), and JavaScript can throw anything: `null`, an object\n * with no prototype (`String()` finds no `toString`), one whose `toString` or `message` getter throws, a Proxy whose\n * traps throw. Formatting it naively replaced the real failure with an unrelated TypeError from inside the framework.\n * Anything unreadable becomes a fixed phrase; `Object.prototype.toString` is no fallback, since it reads\n * `Symbol.toStringTag` through a Proxy's trap too.\n *\n * **A deliberate duplicate of `thrownMessage` in `packages/ssr/src/vera/escaping.ts` — fix both copies.** `@verajs/ssr`\n * is compiled per file with no bundling, so it cannot import this private, unpublished package at run time;\n * `tests/thrown-message-copies.test.mjs` runs one table of thrown values against both, so they cannot drift.\n */\nexport const thrownMessage = (error: unknown): string => {\n try {\n if (error instanceof Error) return String(error.message);\n const message = (error as { message?: unknown } | null)?.message;\n return typeof message === 'string' ? message : String(error);\n } catch {\n return '[unprintable value thrown]';\n }\n};\n\n/** `data-tone` → `dataTone`: the prop an observed attribute arrives as, in every package that defines components (`@verajs/core`'s `define`, its checks, `@verajs/lite`). */\nexport const camel = (name: string) => name.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase());\n","/** **`@verajs/renderer/elements`'s diagnostics — DEVELOPMENT ONLY.** Its bundle's own table, merged into the renderer's json. */\nimport type { Prose } from '@verajs/shared-utils';\n\nexport const PROSE: Record<string, Prose> = {\n 'claim-threw': (phase, outcome) => [\n `threw in ${phase}; its error is printed beside this line, and ${outcome}.`,\n \"Fix the claim's callback, or wire an 'error' insert to handle what claims throw.\",\n ],\n 'elements-hook-replaced': () => [\n \"a 'template' hook set an instance hook before `elements` (priority 10) and is replaced.\",\n 'Claim elements through the `element` insert instead of a second instance hook.',\n ],\n};\n","/**\n * **`@verajs/renderer/elements` — attach behavior to elements in templates.**\n *\n * ```js\n * const autofocus = { mount: (element) => element.focus() };\n * wire([renderer, elements, { on: 'element', fn: (el) => (el.hasAttribute('autofocus') ? autofocus : undefined) }]);\n * ```\n *\n * Every `'element'` claimant is asked about each element of a template ONCE, as the template is BUILT — on its\n * canonical content, so a tag and its static attributes are real and no binding is ever applied (a hydrated first\n * instance, whose elements are the server's with bound values in them, changes nothing). The answers are two flat\n * lists shared by every instance: element positions in document pre-order, and their behaviors. A template nobody\n * claimed anything in gets no instance hook at all. Each instance finds its claimed elements with one short walk to\n * those positions; once the render that created it has finished, each behavior's `mount` runs, and what it returns is\n * handed to `unmount` at teardown. Nothing runs per update.\n *\n * Built on the renderer's `'template'` insert and instance hook (`InstanceHook`); it imports nothing — the registry\n * arrives through its connector. An app that does not wire it pays nothing.\n */\nimport type { ElementBehavior, InstanceHook } from './types.js';\nimport { diagnostic, hostOf, reportTo } from '@verajs/shared-utils';\nimport { PROSE } from './elements-diagnostics.js';\n\ntype Claim = (element: Element) => ElementBehavior | undefined;\n\nlet registered: Map<string, unknown[]> | null = null;\n\n/**\n * **A claim's callbacks follow the ref rule** (Brian, 2026-10-09): user code a render calls is caught AT ITS CALL SITE\n * — so a template with no claims runs exactly the path it did — reported to the app's `'error'` chain with the\n * component it belongs to (else as uncaught), and the render, the other claims and the teardown carry on. A mid-commit\n * throw once left a component's root empty for good; `mount` propagating aborted every later claim's mount.\n */\nconst report = (error: unknown, root: Node | null, line: string) => reportTo(registered?.get('error'), error, hostOf(root), line);\n\n/**\n * **The next element of an instance in document pre-order, never leaving it.** A root is a fragment, or — for a\n * single-root template — its one element, which is then position 0. Bounded by the root rather than by the tree it\n * sits in, because a hydrated instance is already in the page.\n */\nconst firstIn = (root: Node): Element | null => (root.nodeType === 1 ? (root as Element) : (root as ParentNode).firstElementChild);\nconst nextIn = (node: Element, root: Node): Element | null => {\n if (node.firstElementChild !== null) return node.firstElementChild;\n for (let at: Element | null = node; at !== null && at !== root; at = at.parentElement)\n if (at.nextElementSibling !== null) return at.nextElementSibling;\n return null;\n};\n\n/**\n * One instance's claims until it mounts — its claimed elements and their behaviors, interleaved, where it rendered,\n * whether it was adopted — and then only what `unmount` needs. **The elements are released at mount**: per-instance\n * state that keeps DOM references past the moment it needs them costs every operation on the page (measured: ~7% on\n * select and swap of a table whose every row was claimed, operations that never touch it).\n */\ntype State = { f: (Element | ElementBehavior)[] | null; r: Node | null; a: boolean; k: unknown[] | undefined; d: boolean };\n\n/** The instance hook for one template, from the positions and behaviors its claimants answered. */\nconst hookFor = (positions: number[], behaviors: ElementBehavior[]): InstanceHook => ({\n $c: (instance, root, adopted) => {\n const found: (Element | ElementBehavior)[] = [];\n /**\n * ADOPTED, the instance arrives as its elements in template order (hydration pairs them): its live root already\n * holds what its nested parts rendered, so counting there would land on the wrong element.\n */\n const listed = Array.isArray(instance);\n let node = listed ? null : firstIn(instance as Node);\n let at = 0;\n for (let k = 0; k < positions.length; k++) {\n if (listed) node = (instance as readonly Element[])[positions[k]];\n else for (; at < positions[k]; at++) node = nextIn(node!, instance as Node);\n /**\n * At creation — before the first update, and before the instance is connected anywhere. A claim whose `create`\n * throws is reported and DROPPED for this instance (it never mounts or unmounts, being half made); the element\n * stays as the template built it — a claim inserts nothing — and every other claim carries on. The ref rule.\n */\n try {\n behaviors[k].create?.(node!, adopted);\n } catch (error) {\n report(error, root, __DEV__ ? diagnostic('elements', 'an element claim', 'claim-threw', __DEV__ && PROSE['claim-threw']('create', 'the render continued without it')) : '[vera] claim-threw');\n continue;\n }\n found.push(node!, behaviors[k]);\n }\n return { f: found, r: root, a: adopted, k: undefined, d: false } as State;\n },\n $m: (given) => {\n const state = given as State;\n /** Torn down before its render finished: it never mounts. */\n if (state.d) return;\n const found = state.f!;\n const context = { root: state.r, adopted: state.a };\n state.f = null;\n for (let i = 0; i < found.length; i += 2) {\n const behavior = found[i + 1] as ElementBehavior;\n let value;\n try {\n value = behavior.mount?.(found[i] as Element, context);\n } catch (error) {\n report(error, state.r, __DEV__ ? diagnostic('elements', 'an element claim', 'claim-threw', __DEV__ && PROSE['claim-threw']('mount', 'the others still mounted')) : '[vera] claim-threw');\n continue;\n }\n if (value !== undefined && behavior.unmount !== undefined) (state.k ??= []).push(found[i], behavior, value);\n }\n },\n $q: (given) => {\n const state = given as State;\n state.d = true;\n const kept = state.k;\n if (kept !== undefined)\n for (let i = 0; i < kept.length; i += 3)\n try {\n (kept[i + 1] as ElementBehavior).unmount!(kept[i + 2], kept[i] as Element);\n } catch (error) {\n report(error, state.r, __DEV__ ? diagnostic('elements', 'an element claim', 'claim-threw', __DEV__ && PROSE['claim-threw']('unmount', 'the rest of the teardown ran')) : '[vera] claim-threw');\n }\n },\n});\n\n/**\n * Asks the claimants about the template's canonical content, once, as it is built — and gives it an instance hook\n * only if something was claimed. The content is READ, never changed (see the `'template'` insert's contract).\n */\nconst claimTemplate = (built: object, _result: unknown, _readScope: unknown, root: Node) => {\n const claims = registered?.get('element') as Claim[] | undefined;\n if (claims === undefined || claims.length === 0) return;\n const template = built as { _$inst$?: InstanceHook };\n if (__DEV__ && template._$inst$ !== undefined)\n console.warn(diagnostic('elements', 'template', 'elements-hook-replaced', __DEV__ && PROSE['elements-hook-replaced']()));\n const positions: number[] = [];\n const behaviors: ElementBehavior[] = [];\n let at = 0;\n for (let node = firstIn(root); node !== null; node = nextIn(node, root), at++)\n for (let i = 0; i < claims.length; i++) {\n const behavior = claims[i](node);\n if (behavior !== undefined) {\n positions.push(at);\n behaviors.push(behavior);\n }\n }\n if (positions.length > 0) template._$inst$ = hookFor(positions, behaviors);\n};\n\n/** Wire it as `wire([renderer, elements, …claims])`. A bare module: it has no options. */\nexport const elements = [\n (registry: Map<string, unknown[]>) => {\n registered = registry;\n },\n { name: '@verajs/renderer/elements', on: 'template' as const, fn: claimTemplate, priority: 10 },\n];\n\nexport type { ElementBehavior } from './types.js';\n"],"names":[],"mappings":"AAAA;;;;;AAKG;AACI,MAAM,IAAI,GAAG,uBAAuB;AA2FpC,MAAM,UAAU,GAAG,CACxB,MAAc,EACd,SAAiB,EACjB,QAAgB,EAChB,QAA6C;AAE7C;AACA,OAAO,IAAI;AACT,MAAE,CAAA,OAAA,EAAU,MAAM,CAAA,EAAA,EAAK,SAAS,CAAA,GAAA,EAAM,QAAQ,CAAC,CAAC,CAAC,CAAA,EAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAA,CAAA,EAAI,QAAQ,CAAC,CAAC,CAAC,CAAA,CAAE,GAAG,EAAE,CAAA,EAAA,EAAK,QAAQ,CAAA,CAAA;MACnG,CAAA,OAAA,EAAU,MAAM,CAAA,EAAA,EAAK,SAAS,MAAM,IAAI,CAAA,EAAG,QAAQ,CAAA,CAAE;;ACxE3D;;;;;;;;;;;;;;AAcG;AACI,MAAM,cAAc,GAAG,CAAC,KAAc,EAAE,IAAY,KAAI;IAC7D,IAAI,OAAO,WAAW,KAAK,UAAU;AAAE,QAAA,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;SAC5D;AACH,QAAA,IAAI,OAAO;AAAE,YAAA,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;QACvC,WAAW,CAAC,KAAK,CAAC;IACpB;AACF,CAAC;AAED;;;;;;;;AAQG;AACI,MAAM,QAAQ,GAAG,CAAC,QAAwC,EAAE,KAAc,EAAE,OAA4B,EAAE,IAAY,KAAI;IAC/H,IAAI,QAAQ,EAAE,MAAM;QAAE,KAAK,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AAG,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE;AAC3E,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAChC,YAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;AAC1B,gBAAA,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;AAClB,gBAAA,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC1B;QACF;AACF,IAAA,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC;AAC5E,CAAC;AAED;AACO,MAAM,QAAQ,GAAG;IACtB,CAAC,QAAgC,KAAI;QACnC,UAAU,GAAG,QAAQ;IACvB,CAAC;AACD,IAAA,EAAE,IAAI,EAAE,2BAA2B,EAAE,EAAE,EAAE,UAAmB,EAAE,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,EAAE;;;;;"}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* capture (`_$capture$`), both read by hydration. One number for both: the three ship in one package, and a change to
|
|
17
17
|
* either seam bumps it. A hydration that meets another number declines (the page renders fresh) and says so.
|
|
18
18
|
*/
|
|
19
|
-
const PROTOCOL =
|
|
19
|
+
const PROTOCOL = 2;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* **Where every diagnostic code is explained.** The URL is permanent: a released bundle is immutable, so every version
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vera-renderer-hydrate-slots.js","sources":["../../src/kinds.ts","../../../shared-utils/src/diagnostic.ts","../../src/hydrate-slots-diagnostics.ts","../../src/hydrate-slots.ts"],"sourcesContent":["/**\n * **The renderer's binding kinds and child-part modes** — numbers both `renderer.ts` and the separately bundled\n * `hydration.ts` read, from ONE source (each bundle inlines them; they are literals in the output). A change here\n * changes the hand-off's protocol: bump `$V` in `renderer.ts`.\n */\n/** A binding's kind, resolved once per template. */\nexport const IGNORED = 0; // consumed, nothing rendered: inside a comment, the later values of a multi-part attribute\nexport const CHILD = 1; // anchored on a primed empty text node the template carries\nexport const SOLE = 2; // its element's only content: no anchor in the template, the first commit writes `textContent`\nexport const ATTR = 3;\nexport const PROPERTY = 4;\nexport const BOOLEAN = 5;\n/** `EVENT` through `ADOPT` hold a `Slot` record in their node slot — one range test, in `instantiate` and `commit`. */\nexport const EVENT = 6;\n/** An element-position expression: a ref, or a value that applies itself (`_$apply$`). */\nexport const REF = 7;\n/** An element-position expression ON a `<select>`: a value applying itself there (a spread) waits for `flush`. */\nexport const SELECT_REF = 8;\n/** `.name` on a custom element — see `adoptProperty` in shared-utils. */\nexport const ADOPT = 9;\n/**\n * Kinds from here on re-assert on EVERY render, so the update loop never skips them as unchanged:\n * `!name` writes from the live DOM's point of view (a sibling radio's click unchecks this one with no\n * event on it), and a `<select>`'s selection is re-applied after its options exist — see `flush`.\n */\nexport const LIVE = 10;\n/** A `<select>`'s selection — `value` or `selectedIndex` (`isSelection`) — written when the pass ends: see `flush`. */\nexport const SELECT = 11;\n/** `!name` on a custom element: compared against the LIVE value — read through `untracked`, it is the component's getter. */\nexport const LIVE_CUSTOM = 12;\n/** A binding that must never write — and, from here on, the kinds `commit` handles before anything is computed. */\nexport const REFUSED = 13;\n/** A `<select>`'s `selectedIndex` — the rare spelling of its selection, queued as `SELECT` is (see `flush`). */\nexport const SELECT_INDEX = 14;\n\n\n/** A child part's mode: what its range currently holds. */\nexport const EMPTY = 0;\nexport const TEXT = 1;\nexport const TEMPLATE = 2;\nexport const LIST = 3;\nexport const NODE = 4;\n\n/**\n * **The hydration hand-off's positions** — the renderer sets `$H` to an array at `connect`, and `hydration.ts` reads\n * it by these. An array, not an object of named fields: the names cost every app bytes (−35 B gzipped measured,\n * 2026-10-02), and these constants inline to literals in both bundles. The first two are FROZEN across protocols — a\n * hydration from another release reads the protocol at 0 and, on a mismatch, can still install its clearing hook at 1.\n * Any other change here is a protocol change: bump `PROTOCOL`.\n */\n/**\n * **The protocol of this package's first-party seams** — the renderer's hand-off (`$H`, at `HANDOFF_PROTOCOL`) and slots'\n * capture (`_$capture$`), both read by hydration. One number for both: the three ship in one package, and a change to\n * either seam bumps it. A hydration that meets another number declines (the page renders fresh) and says so.\n */\nexport const PROTOCOL = 1;\n/** The protocol number — FROZEN at 0. */\nexport const HANDOFF_PROTOCOL = 0;\n/** The first-render hook's setter — FROZEN at 1. */\nexport const HANDOFF_ADOPTER = 1;\nexport const HANDOFF_GET_TEMPLATE = 2;\nexport const HANDOFF_CHILD_PART = 3;\nexport const HANDOFF_INSTANCE = 4;\nexport const HANDOFF_SLOT = 5;\nexport const HANDOFF_UNSET = 6;\nexport const HANDOFF_UPGRADED = 7;\nexport const HANDOFF_COMMIT = 8;\nexport const HANDOFF_COMMIT_AS = 9;\nexport const HANDOFF_HOOK_UP = 10;\nexport const HANDOFF_RESOLVE = 11;\nexport const HANDOFF_ROOTS = 12;\nexport const HANDOFF_TO_TEXT = 13;\nexport const HANDOFF_REMOVAL_WORK = 14;\n","/**\n * **Where every diagnostic code is explained.** The URL is permanent: a released bundle is immutable, so every version\n * published points here for ever — the domain cannot lapse and `/e/` cannot be reorganized without breaking links in\n * code nobody can edit; the docs site redirects instead. `scripts/sync-diagnostics.mjs` imports this constant, so the\n * pages and the bundles can never disagree about where they are.\n */\nexport const DOCS = 'https://verajs.dev/e/';\n\n/**\n * **What this copy of the framework has already said** (Brian's ruling, 2026-11-12): the ONE memory behind `warnOnce`, `errorOnce`\n * and `hasWarned`, for DEVELOPMENT-ONLY warnings. It replaced the hand-written once-flags every package kept\n * (`saidLists`, `warnedDrop`, per-element WeakSets, per-key Sets: two naming styles, Brian: no names). **A warning that\n * ships to production keeps its memory at its site** (bytes, measured 2026-11-12: the shared memory costs +80–145 B gz\n * per bundle); development-only warnings use warnOnce. Module state by necessity, since \"once\" spans every call on the\n * page. One per BUNDLE COPY, exactly the scope each flag had, because this package is inlined into every bundle.\n * A code, or `code key` for a string key, in a Set. An object key (an element, a setup function) in a WeakMap, so its\n * entry goes with the object. Marked pure, so a bundle that never prints once drops both.\n */\nconst printed = /* @__PURE__ */ new Set<string>();\nconst printedOn = /* @__PURE__ */ new WeakMap<object, Map<string, Set<unknown>>>();\n/**\n * A once's KEY: none (once per page), a string (once per that string), an object (once per that object: an element, a\n * class, a setup function), or the PAIR `[object, value]`, a value key on that object (a store write: the object and its\n * property; a keyed list: the list and the duplicate key, compared as the list compares them, by value, so `1` and `'1'`\n * stay apart). A pair is the only array a key may be.\n */\ntype OnceKey = string | object | readonly [object, unknown];\n/** Where an object key's (code, value) lives: the value set for that code on that object, made on demand. */\nconst valuesOn = (on: object, code: string, make: boolean): Set<unknown> | undefined => {\n let codes = printedOn.get(on);\n if (codes === undefined) {\n if (!make) return undefined;\n printedOn.set(on, (codes = new Map()));\n }\n let values = codes.get(code);\n if (values === undefined && make) codes.set(code, (values = new Set()));\n return values;\n};\n/** The object and value of an object or pair key. */\nconst split = (key: object): readonly [object, unknown] => (Array.isArray(key) ? (key as unknown as readonly [object, unknown]) : [key, undefined]);\n/** Whether (code, key) is new, recording it if so. */\nconst firstTime = (code: string, key?: OnceKey): boolean => {\n if (key === undefined || typeof key === 'string') {\n const entry = key === undefined ? code : `${code} ${key}`;\n if (printed.has(entry)) return false;\n printed.add(entry);\n return true;\n }\n const [on, sub] = split(key);\n const values = valuesOn(on, code, true)!;\n if (values.has(sub)) return false;\n values.add(sub);\n return true;\n};\n\n/**\n * **One shape for every diagnostic the framework prints** — the short line production keeps, the whole sentence\n * development adds — so a package converting its messages writes a table and a call, never its own format.\n *\n * production `[vera] hydration: element: found <i> — https://verajs.dev/e/hydration-fallback`\n * development `[vera] hydration: element: found <i> — fell back to a client render: … (hydration-fallback)`\n *\n * `subject` is the free information — what the code already has at hand, naming the problem area — the same in both\n * builds. `prose` is development only: the package's table entry (`Prose`), called behind `__DEV__` at the call site so\n * the table goes unreferenced in production and rollup drops it whole. Production prints the code inside the link, so\n * the reader is one click from the explanation, which `scripts/sync-diagnostics.mjs` publishes from the same tables.\n *\n * **Every production message is coded** (Brian, 2026-11-11; this supersedes \"convert where smaller\", 2026-10-02):\n * consistency over a few bytes, so no package keeps a hand-written production line beside its table.\n */\n/*\n * The parameter names are deliberately unlike anything a caller holds: terser will not inline a function whose\n * parameter shadows a name at the call site (measured 2026-10-02 — directives passes its own `code`, and a parameter\n * called `code` left `((e,t,n)=>`…`)(0,t,n)` in its bundle, +8 B; renamed, the call folds to the bare template).\n */\n/**\n * **A misused API, named by its function** — the thrown-error twin of `diagnostic()`: `untrack: expected a function …\n * (untrack-not-function)`, function-first because a stack already names the source and the sweep reads that shape. The\n * prose comes from a package's table, behind `__DEV__`, so a development-only guard costs production nothing.\n */\nexport const misuse = (forName: string, withCode: string, andProse?: false | readonly [string, string?]) =>\n __DEV__ && andProse\n ? `${forName}: ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `${forName}: ${DOCS}${withCode}`;\n\n/**\n * **A misused API and what it was misused ABOUT** — `misuse()` with a subject, in `diagnostic()`'s ` — ` separator:\n * `parseFrontmatter: line 3 — https://verajs.dev/e/cms-frontmatter-unsupported`. The subject is the free information\n * (a line, a URL and its status) and prints in both builds. A sibling rather than an optional parameter on `misuse()`,\n * because `misuse()` is inlined into every bundle that throws and a conditional subject would tax all of them for a\n * shape few need; a sibling is tree-shaken where unused.\n */\nexport const misuseAbout = (forName: string, aboutSubject: string, withCode: string, andProse?: false | readonly [string, string?]) =>\n __DEV__ && andProse\n ? `${forName}: ${aboutSubject} — ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `${forName}: ${aboutSubject} — ${DOCS}${withCode}`;\n\nexport const diagnostic = (\n inArea: string,\n bySubject: string,\n withCode: string,\n andProse?: false | readonly [string, string?]\n) =>\n /** `__DEV__` HERE as well as at the call: production folds this to the one-line form, branch and all. */\n __DEV__ && andProse\n ? `[vera] ${inArea}: ${bySubject} — ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `[vera] ${inArea}: ${bySubject} — ${DOCS}${withCode}`;\n\n/**\n * **Text from outside — a file path, a YAML key, a URL, an error's message — quoted before it reaches a line.** A log is a\n * pipeline, and such text can be shaped by an author or a request: a newline in it forges a line, an ESC sequence hides\n * one (log injection). `JSON.stringify` escapes both; cut to 80 characters so one value cannot fill the log. @verajs/ssr\n * keeps a twin (it cannot import this), held equal by tests/ssr-coded-diagnostics.\n */\n/**\n * `max` caps the length (80 by default); `Infinity` keeps the whole text for a value worth reading in full — a site\n * owner's own path — which is still ESCAPED: truncation and escaping are separate jobs, and a path is not free of control\n * characters just because its owner wrote it (2026-10-09).\n */\nexport const quoted = (text: string, max = 80): string => JSON.stringify(text.length > max ? `${text.slice(0, max)}…` : text);\n\n/**\n * **The errors a package constructs, marked as its own** — so a wrapper that reports an inner refusal (cms's\n * `generateManifest` around a frontmatter line) carries it as it is: already formatted, its outside text already\n * quoted. Anything else is foreign, and quoted. Identity, never a shape test: a message can imitate ours, an identity\n * cannot. @verajs/ssr keeps a twin (it cannot import this).\n */\nconst ours = /* @__PURE__ */ new WeakSet<object>();\nexport const own = <E extends Error>(error: E): E => {\n ours.add(error);\n return error;\n};\nexport const isOwn = (error: unknown): boolean => typeof error === 'object' && error !== null && ours.has(error);\n\n/**\n * **Whether this copy has already said `code` (for `key`)**: for a GUARD only, where deciding to warn costs work worth\n * skipping once the warning is out (development's whole-tree walk for unwired directive attributes, an event-name\n * guess over every property of an element). A site that only prints calls `warnOnce`. Asks, never records.\n */\nexport const hasWarned = (code: string, key?: OnceKey): boolean => {\n if (key === undefined || typeof key === 'string') return printed.has(key === undefined ? code : `${code} ${key}`);\n const [on, sub] = split(key);\n return valuesOn(on, code, false)?.has(sub) === true;\n};\n\ntype Detail = false | readonly [string, string?] | (() => readonly [string, string?] | undefined);\n/**\n * The printer behind both, on one level. `andDetail` is `diagnostic()`'s prose, or a function returning it where building\n * the sentence costs something: it is called only the first time. `...andMore` rides beside the line behind '%s' (an\n * element, a thrown error), never inside it, so text from outside cannot forge a line. The console method is read at the\n * call, so a test that replaces `console.warn` sees it.\n */\nconst sayOnce =\n (level: 'warn' | 'error') =>\n (inArea: string, bySubject: string, withCode: string, andDetail?: Detail, forKey?: OnceKey, ...andMore: unknown[]): void => {\n if (!firstTime(withCode, forKey)) return;\n const line = diagnostic(inArea, bySubject, withCode, typeof andDetail === 'function' ? andDetail() : andDetail);\n if (andMore.length) console[level]('%s', line, ...andMore);\n else console[level](line);\n };\n/**\n * **A diagnostic said once per page** (per key, where one is given: a string, or an object such as the element it is\n * about): `diagnostic()`'s arguments, then the key, then what rides beside the line. Coded in production exactly as\n * `diagnostic()` is, because it IS `diagnostic()`. `errorOnce` is its twin on `console.error`, for a refusal a page should\n * not miss.\n */\nexport const warnOnce = /* @__PURE__ */ sayOnce('warn');\nexport const errorOnce = /* @__PURE__ */ sayOnce('error');\n","/** **`@verajs/renderer/hydrate-slots`' diagnostics — DEVELOPMENT ONLY.** Its bundle's own table, merged into the renderer's json. */\nimport type { Prose } from '@verajs/shared-utils';\n\nexport const PROSE: Record<string, Prose> = {\n 'hydrate-slots-unwired': () => [\n 'reads the light-DOM statement through `slots`, which is not wired.',\n 'Wire `slots` beside it: `wire([renderer, hydration, slots, hydrateSlots])`.',\n ],\n};\n","/**\n * **`@verajs/renderer/hydrate-slots` — hydrating light-DOM slots.** `wire([renderer, hydration, slots, hydrateSlots])`.\n *\n * Everything only a page that HYDRATES LIGHT SLOTS runs, kept out of both modules so neither pays for the other (Brian,\n * 2026-10-07): the server's format (`data-vm-light` — its number, the light order — and the carrier), each filled slot's\n * range and detached copy, and the rescue. Hydration calls it through `_$hydrateSlots$`;\n * it captures through slots' `_$capture$`. Slots' own distribution then recomputes every assignment from the nodes'\n * names, so the server's placement decides at most WHETHER a node moves, never where it ends up.\n *\n * Without it, hydration refuses a served light host before touching anything (`hydration-slots`): the page stands as\n * served, and a component boundary reports it once.\n */\nimport { PROTOCOL } from './kinds.js';\nimport { diagnostic } from '@verajs/shared-utils';\nimport { PROSE } from './hydrate-slots-diagnostics.js';\nimport type { CaptureSeam, HydrateSlots, HydrationCursor, HydrationFail, LightCapture, ServedHost } from './types.js';\n\n/** The registry as this module uses it — `get` named so `wire`'s registry is assignable (a type of optional members alone is \"weak\"). */\ntype Registry = { get(name: string): unknown[] | undefined; _$capture$?: CaptureSeam; _$hydrateSlots$?: HydrateSlots };\n/** A served host being adopted: what hydration sees (`ServedHost`), and what this module keeps beside it. */\n/** `_`-named where only this module reads them — the minifier shortens those; `carrier` is hydration's to read too. */\ntype Served = ServedHost & { _host: Element; _runs: string; carrier: HTMLElement | null; _pools: Node[][]; _capture: LightCapture };\n\n/** What `@verajs/ssr` writes — a deliberate second address of its writer; `slots-ssr-client-parity` holds them together. */\nconst FORMAT = '1';\nconst LIGHT_ATTR = 'data-vm-light';\nconst UNASSIGNED = 'data-vm-unassigned';\nconst isMark = (node: Node, data: string) => node.nodeType === 8 && (node as Comment).data === data;\n/** The slottable nodes from `from` up to `to` — comments are never light content. */\nconst pool = (from: Node | null, to: Node | null): Node[] => {\n const out: Node[] = [];\n for (let node = from; node !== null && node !== to; node = node.nextSibling) if (node.nodeType !== 8) out.push(node);\n return out;\n};\n/**\n * The pools' nodes in light order, as the statement gives it — `null` unless it accounts for every one, exactly. The\n * statement counts a run of adjacent TEXT as one light child, as the parser makes it; a walk may since have split it\n * (an outer template's static text beside its value), so the pieces that follow one taken are taken with it.\n */\nconst ordered = (runs: string, pools: Node[][]): Node[] | null => {\n const order: Node[] = [];\n for (const run of runs === '' ? [] : runs.split(',')) {\n const [index, count = '1'] = run.split('*');\n const nodes = pools[+index];\n for (let k = +count; k > 0; k--) {\n let node = nodes?.shift();\n if (node === undefined) return null;\n order.push(node);\n while (node.nodeType === 3 && nodes![0] !== undefined && nodes![0] === node.nextSibling && nodes![0].nodeType === 3) order.push((node = nodes!.shift()!));\n }\n }\n return pools.every((nodes) => nodes.length === 0) ? order : null;\n};\n/** The `]` that closes the range `start` opens — `null` if another `[` or the parent's end comes first: not well-formed. */\nconst endOf = (start: Node): ChildNode | null => {\n let end = start.nextSibling;\n while (end !== null && !isMark(end, ']') && !isMark(end, '[')) end = end.nextSibling;\n return end !== null && isMark(end, ']') ? end : null;\n};\nconst SERVED = new WeakSet<Node>();\n/** Every well-formed range under `parent`, in document order — never entering a range, the carrier, or a served host. */\nconst scan = (parent: Node, out: Node[][], skip: Node | null) => {\n for (let node = parent.firstChild; node !== null; node = node.nextSibling) {\n if (node === skip) continue;\n if (isMark(node, '[')) {\n const end = endOf(node);\n if (end !== null) {\n out.push(pool(node.nextSibling, end));\n node = end;\n }\n } else if (node.nodeType === 1 && !(node as Element).hasAttribute(LIGHT_ATTR) && !SERVED.has(node)) scan(node, out, null);\n }\n};\n\n/** The server's carrier — the host's first child, when it is `<ins data-vm-unassigned>` — or `null`. */\nconst carrierOf = (host: Element): HTMLElement | null => {\n const first = host.firstChild;\n return first !== null && first.nodeType === 1 && (first as Element).hasAttribute(UNASSIGNED) ? (first as HTMLElement) : null;\n};\n/** The statement's runs (after its format number), or `null` for another format or none. */\nconst statementOf = (spec: string | null): string | null => {\n const colon = spec === null ? -1 : spec.indexOf(':');\n return colon < 0 || spec!.slice(0, colon) !== FORMAT ? null : spec!.slice(colon + 1);\n};\n/** Every well-formed range's light nodes, then the carrier's — the pools a statement indexes, found by structure. */\nconst poolsOf = (host: Element, carrier: Node | null): Node[][] => {\n const pools: Node[][] = [];\n scan(host, pools, carrier);\n if (carrier !== null) pools.push(pool(carrier.firstChild, null));\n return pools;\n};\n/** A served host not yet adopted: its light children in light order, read fresh from its statement — or `null`. */\nconst stated = (host: Element): Node[] | null => {\n const runs = statementOf(host.getAttribute(LIGHT_ATTR));\n return runs === null ? null : ordered(runs, poolsOf(host, carrierOf(host)));\n};\n\nlet registry: Registry;\n/** Hydration's mismatch, handed over at `open`. */\nlet fail: HydrationFail;\n\n/** A served host, read: its statement, its carrier. Slots must be wired, and of this release. */\nconst open = (host: Element, failWith: HydrationFail): Served => {\n fail = failWith;\n const seam = registry._$capture$;\n /**\n * A wiring state (the diagnostic shape). Production prints the code alone: the code-and-link shape measured +14 B, the\n * bare code 0 B — Brian's byte rule (a production line carries its code where the bundle is not larger), 2026-10-09.\n */\n if (seam === undefined)\n throw new Error(\n __DEV__ ? diagnostic('hydrate-slots', `<${host.localName}>`, 'hydrate-slots-unwired', __DEV__ && PROSE['hydrate-slots-unwired']()) : '[vera] hydrate-slots-unwired'\n );\n const spec = host.getAttribute(LIGHT_ATTR)!;\n host.removeAttribute(LIGHT_ATTR);\n SERVED.add(host);\n if (seam[0] !== PROTOCOL) fail('protocol', host, __DEV__ && (() => `slots protocol ${seam[0]}, expected ${PROTOCOL}`));\n const runs = statementOf(spec);\n const served = { _host: host, _runs: runs ?? '', carrier: carrierOf(host), _pools: [], _capture: seam[1] };\n /** Another release's server: rescued HERE — hydration holds no state for this host until `open` returns. */\n if (runs === null) {\n rescue(served);\n /** Named in every build (Brian, 2026-10-02): a deploy, not a developer, meets it. */\n fail('format', host, () => `${__DEV__ ? `server format ${JSON.stringify(spec.split(':')[0])}, expected ${FORMAT}: ` : ''}update @verajs/ssr and @verajs/renderer together`);\n }\n return served;\n};\n\n/** At a canonical `<slot>`: a range at the cursor is its region — the slot itself a detached copy, as the client keeps it. */\nconst slot = (canonical: Element, cursor: HydrationCursor, served: ServedHost): Element | null => {\n if (canonical.localName !== 'slot') return null;\n const rs = cursor.offset === 0 ? cursor.node : null;\n if (rs === null || !isMark(rs, '[')) return null;\n const re = endOf(rs);\n if (re === null) return fail('slot', rs, __DEV__ && (() => `a filled slot's range here is not well-formed`));\n (served as Served)._pools.push(pool(rs.nextSibling, re));\n const copy = cursor.parent.ownerDocument!.importNode(canonical, true) as Element & { _$region$?: [Comment, Comment] };\n copy._$region$ = [rs as Comment, re as Comment];\n cursor.node = re.nextSibling;\n return copy;\n};\n\n/** Light hosts a template placed RUNS into, walked in this adoption: captured (or converted) at its close. */\nlet pending: HydrationCursor[] = [];\n\n/**\n * **A light host a template wrote runs into, seated** — whoever walks a light host's content first captures it. Its\n * light children become units in light order: each node outside a run a static, each run `[start, nodes, end]` (its part's\n * anchors, held by `insert`, and the light nodes between them). The statement's order: captured now, waiting for the\n * host's own slots (`wait`). The live record's: each run made one unit of it (`runOf`). Anchors that do not pair up as\n * the template's runs — a run whose items are not each one element — decline.\n */\nconst seat = (cursor: HydrationCursor) => {\n const { parent, _marks: marks, _runs: runs, end } = cursor as Required<HydrationCursor>;\n const host = parent as Element;\n if (marks.length !== runs * 4)\n fail('run', host, __DEV__ && (() => `a list or value this template writes into a light-slot component is not one element per item`));\n const [, capture, lightNodes, records, standIn, placed, adopted] = registry._$capture$!;\n /**\n * The light children NOW, not as the walk began: a text child the walk split is several light children, as a client\n * render makes it — read as the walk began, its pieces were never captured and the next distribution dropped them.\n */\n const nodes = (end === 0 ? lightNodes(host) : stated(host)) ?? fail('run', host, false);\n const index = (node: unknown) => (node === null ? nodes.length : nodes.indexOf(node as Node));\n /** The statement's order: every light child captured as a static first, waiting for the host's own slots. */\n if (end !== 0) capture(host, null, nodes, carrierOf(host), true);\n const record = records.get(host)!;\n const { holding } = record;\n const ref = holding.lastChild;\n const doc = host.ownerDocument;\n for (let m = 0; m < marks.length; m += 4) {\n const k = index(marks[m + 1]);\n const run = nodes.slice(k, index(marks[m + 3]));\n /**\n * **The run, as the client keeps one**, in place of the statics its nodes were: its unit's two comments in holding,\n * its part's anchors inside them, and at each node's place a stand-in if a slot holds it (it stays there), or the\n * node itself if it waits unassigned. Only holding and the record change; no slotted node moves.\n */\n const at = record.units.findIndex((unit) => unit.a === nodes[k]);\n record.units = record.units.filter((unit) => !run.includes(unit.a));\n const unit = { a: doc.createComment(''), z: doc.createComment('') };\n holding.insertBefore(unit.a, ref);\n holding.insertBefore(marks[m] as Node, ref);\n for (const node of run)\n if (node.parentNode === holding) {\n holding.insertBefore(node, ref);\n placed.set(node, null);\n } else {\n standIn(node, holding, ref);\n if (!placed.has(node)) placed.set(node, adopted);\n }\n holding.insertBefore(marks[m + 2] as Node, ref);\n holding.insertBefore(unit.z, ref);\n record.units.splice(at < 0 ? record.units.length : at, 0, unit);\n }\n /** Nothing to mark: holding is watched, so slots notes these writes as it notes any other. */\n};\n\n/** The walk matched: the light children, in light order, captured where they stand — before anything commits. */\nconst close = (adopted: ServedHost | null) => {\n for (const cursor of pending) seat(cursor);\n pending = [];\n if (adopted === null) return;\n const served = adopted as Served;\n const { _host: host, carrier, _pools: pools } = served;\n if (carrier !== null) pools.push(pool(carrier.firstChild, null));\n served._capture(host, null, ordered(served._runs, pools) ?? fail('slots', host, __DEV__ && (() => `its light-slot statement does not account for what its slots hold`)), carrier);\n};\n\n/**\n * It did not: every well-formed range's nodes and the carrier's, captured where they stand before the clear. The clear\n * detaches them with the old markup and the fresh render's end places each by identity, slotted or held — moving them\n * into the carrier first only moved each light node twice more (measured: three disconnect/connect pairs for one).\n */\nconst rescue = (served: ServedHost | null) => {\n pending = [];\n if (served === null) return;\n const { _host: host, _runs: runs, _capture: capture, carrier } = served as Served;\n const pools = poolsOf(host, carrier);\n /** Every node first: `ordered` consumes the pools, and one that fails partway has taken some. */\n const all = pools.flat();\n capture(host, null, ordered(runs, pools) ?? all, carrier);\n};\n\n/**\n * **A light host a template places content into** (the outer walk's light cursor): its children in light order. Slots'\n * live record is the one source once it exists — a node the page added since is in it, and the template need not\n * account for it; before that (the host not yet adopted), the server's statement, read fresh and never cached, which the\n * template must account for exactly. Neither: `null`, and the walk reads the host's DOM.\n */\nconst light = (host: Element, canonical: Element, plan: ReadonlyMap<Node, readonly number[]>, values: readonly unknown[]): HydrationCursor | null => {\n /** Only a custom element the template places content into can be a light host. */\n if (canonical.firstChild === null || !host.localName.includes('-')) return null;\n /** RUNS the template writes directly among those children: a value that is not text (a text value is claimed in place). */\n let runs = 0;\n for (let node: Node | null = canonical.firstChild; node !== null; node = node.nextSibling)\n if (node.nodeType === 3) {\n const owned = plan.get(node);\n if (owned !== undefined && values[owned[0]] != null && typeof values[owned[0]] === 'object') runs++;\n }\n const seam = registry._$capture$;\n const live = seam?.[0] === PROTOCOL ? seam[2](host) : null;\n if (live !== null) return walker(host, live, 0, runs);\n const nodes = stated(host);\n return nodes === null ? null : walker(host, nodes, nodes.length, runs);\n};\n/**\n * A cursor over `nodes` — the walk must account for the first `end` of them (all of a statement's, none of a record's);\n * with runs, held until the adoption's close seats it.\n */\nconst walker = (host: Element, nodes: Node[], end: number, runs: number): HydrationCursor => {\n const cursor = { parent: host, node: nodes[0] ?? null, offset: 0, light: nodes, at: 0, end, _runs: runs, _marks: [] };\n if (runs > 0) pending.push(cursor);\n return cursor;\n};\n\n/**\n * An insert on a light walk. A run's anchor is held, with the node it stands before, for the unit `seat` builds — split\n * first if the walk stands inside a text child, as a plain insert would; text (an empty value's anchor) goes in place.\n */\nconst insert = (cursor: HydrationCursor, node: Node) => {\n if (cursor.offset > 0) {\n cursor.node = (cursor.node as Text).splitText(cursor.offset);\n cursor.offset = 0;\n }\n const at = cursor.node;\n if (node.nodeType === 3) (at === null ? cursor.parent : at.parentNode!).insertBefore(node, at);\n else cursor._marks!.push(node, at);\n};\n\n/** The walk's step, once this piece is wired: on a light cursor the next light child, else the next sibling. */\nconst next = (cursor: HydrationCursor, node: Node): Node | null => {\n const nodes = cursor.light;\n return nodes === undefined ? node.nextSibling : (nodes[++cursor.at!] ?? null);\n};\n\n/** `wire([renderer, hydration, slots, hydrateSlots])`. */\nexport const hydrateSlots = (given: Registry) => {\n registry = given;\n given._$hydrateSlots$ = [PROTOCOL, open, slot, close, rescue, light, next, insert];\n};\n"],"names":[],"mappings":"AAAA;;;;AAIG;A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ds.ts","../../../shared-utils/src/diagnostic.ts","../../src/hydrate-slots-diagnostics.ts","../../src/hydrate-slots.ts"],"sourcesContent":["/**\n * **The renderer's binding kinds and child-part modes** — numbers both `renderer.ts` and the separately bundled\n * `hydration.ts` read, from ONE source (each bundle inlines them; they are literals in the output). A change here\n * changes the hand-off's protocol: bump `$V` in `renderer.ts`.\n */\n/** A binding's kind, resolved once per template. */\nexport const IGNORED = 0; // consumed, nothing rendered: inside a comment, the later values of a multi-part attribute\nexport const CHILD = 1; // anchored on a primed empty text node the template carries\nexport const SOLE = 2; // its element's only content: no anchor in the template, the first commit writes `textContent`\nexport const ATTR = 3;\nexport const PROPERTY = 4;\nexport const BOOLEAN = 5;\n/** `EVENT` through `ADOPT` hold a `Slot` record in their node slot — one range test, in `instantiate` and `commit`. */\nexport const EVENT = 6;\n/** An element-position expression: a ref, or a value that applies itself (`_$apply$`). */\nexport const REF = 7;\n/** An element-position expression ON a `<select>`: a value applying itself there (a spread) waits for `flush`. */\nexport const SELECT_REF = 8;\n/** `.name` on a custom element — see `adoptProperty` in shared-utils. */\nexport const ADOPT = 9;\n/**\n * Kinds from here on re-assert on EVERY render, so the update loop never skips them as unchanged:\n * `!name` writes from the live DOM's point of view (a sibling radio's click unchecks this one with no\n * event on it), and a `<select>`'s selection is re-applied after its options exist — see `flush`.\n */\nexport const LIVE = 10;\n/** A `<select>`'s selection — `value` or `selectedIndex` (`isSelection`) — written when the pass ends: see `flush`. */\nexport const SELECT = 11;\n/** `!name` on a custom element: compared against the LIVE value — read through `untracked`, it is the component's getter. */\nexport const LIVE_CUSTOM = 12;\n/** A binding that must never write — and, from here on, the kinds `commit` handles before anything is computed. */\nexport const REFUSED = 13;\n/** A `<select>`'s `selectedIndex` — the rare spelling of its selection, queued as `SELECT` is (see `flush`). */\nexport const SELECT_INDEX = 14;\n/**\n * **An HTML `<style>`'s or JSON data block's whole text** — ONE binding (the element's first value; the others are\n * consumed, as a multi-part attribute's are) composes the statics and values and writes the element's text when it\n * changed. Its text is serialized VERBATIM (BROWSER-LEDGER), so it is written unable to end its element, as the server\n * writes it: in a style each `</style` as `<\\/style`, in a JSON block every `<` as `\\u003c` — on the COMPOSED text, since\n * a closer can form across a hole. Committed in `commit`'s cold branch: the hot text line is untouched.\n */\nexport const RAW_STYLE = 15;\nexport const RAW_JSON = 16;\n/**\n * **An element whose content is never shown** (`<iframe>`, `<noscript>`, `<xmp>`, `<noembed>`, `<noframes>`,\n * `<plaintext>`): its statics and its values composed as text, each VALUE fully encoded (every ASCII non-word character\n * as a character reference), so a page saved from the DOM and parsed again — with scripting on (raw text) or off\n * (markup) — holds no value that can end the element or add an attribute.\n */\nexport const RAW_ENCODED = 17;\n\n\n/** A child part's mode: what its range currently holds. */\nexport const EMPTY = 0;\nexport const TEXT = 1;\nexport const TEMPLATE = 2;\nexport const LIST = 3;\nexport const NODE = 4;\n\n/**\n * **The hydration hand-off's positions** — the renderer sets `$H` to an array at `connect`, and `hydration.ts` reads\n * it by these. An array, not an object of named fields: the names cost every app bytes (−35 B gzipped measured,\n * 2026-10-02), and these constants inline to literals in both bundles. The first two are FROZEN across protocols — a\n * hydration from another release reads the protocol at 0 and, on a mismatch, can still install its clearing hook at 1.\n * Any other change here is a protocol change: bump `PROTOCOL`.\n */\n/**\n * **The protocol of this package's first-party seams** — the renderer's hand-off (`$H`, at `HANDOFF_PROTOCOL`) and slots'\n * capture (`_$capture$`), both read by hydration. One number for both: the three ship in one package, and a change to\n * either seam bumps it. A hydration that meets another number declines (the page renders fresh) and says so.\n */\nexport const PROTOCOL = 2;\n/** The protocol number — FROZEN at 0. */\nexport const HANDOFF_PROTOCOL = 0;\n/** The first-render hook's setter — FROZEN at 1. */\nexport const HANDOFF_ADOPTER = 1;\nexport const HANDOFF_GET_TEMPLATE = 2;\nexport const HANDOFF_CHILD_PART = 3;\nexport const HANDOFF_INSTANCE = 4;\nexport const HANDOFF_SLOT = 5;\nexport const HANDOFF_UNSET = 6;\nexport const HANDOFF_UPGRADED = 7;\nexport const HANDOFF_COMMIT = 8;\nexport const HANDOFF_COMMIT_AS = 9;\nexport const HANDOFF_HOOK_UP = 10;\nexport const HANDOFF_RESOLVE = 11;\nexport const HANDOFF_ROOTS = 12;\nexport const HANDOFF_TO_TEXT = 13;\nexport const HANDOFF_REMOVAL_WORK = 14;\n","/**\n * **Where every diagnostic code is explained.** The URL is permanent: a released bundle is immutable, so every version\n * published points here for ever — the domain cannot lapse and `/e/` cannot be reorganized without breaking links in\n * code nobody can edit; the docs site redirects instead. `scripts/sync-diagnostics.mjs` imports this constant, so the\n * pages and the bundles can never disagree about where they are.\n */\nexport const DOCS = 'https://verajs.dev/e/';\n\n/**\n * **What this copy of the framework has already said** (Brian's ruling, 2026-11-12): the ONE memory behind `warnOnce`, `errorOnce`\n * and `hasWarned`, for DEVELOPMENT-ONLY warnings. It replaced the hand-written once-flags every package kept\n * (`saidLists`, `warnedDrop`, per-element WeakSets, per-key Sets: two naming styles, Brian: no names). **A warning that\n * ships to production keeps its memory at its site** (bytes, measured 2026-11-12: the shared memory costs +80–145 B gz\n * per bundle); development-only warnings use warnOnce. Module state by necessity, since \"once\" spans every call on the\n * page. One per BUNDLE COPY, exactly the scope each flag had, because this package is inlined into every bundle.\n * A code, or `code key` for a string key, in a Set. An object key (an element, a setup function) in a WeakMap, so its\n * entry goes with the object. Marked pure, so a bundle that never prints once drops both.\n */\nconst printed = /* @__PURE__ */ new Set<string>();\nconst printedOn = /* @__PURE__ */ new WeakMap<object, Map<string, Set<unknown>>>();\n/**\n * A once's KEY: none (once per page), a string (once per that string), an object (once per that object: an element, a\n * class, a setup function), or the PAIR `[object, value]`, a value key on that object (a store write: the object and its\n * property; a keyed list: the list and the duplicate key, compared as the list compares them, by value, so `1` and `'1'`\n * stay apart). A pair is the only array a key may be.\n */\ntype OnceKey = string | object | readonly [object, unknown];\n/** Where an object key's (code, value) lives: the value set for that code on that object, made on demand. */\nconst valuesOn = (on: object, code: string, make: boolean): Set<unknown> | undefined => {\n let codes = printedOn.get(on);\n if (codes === undefined) {\n if (!make) return undefined;\n printedOn.set(on, (codes = new Map()));\n }\n let values = codes.get(code);\n if (values === undefined && make) codes.set(code, (values = new Set()));\n return values;\n};\n/** The object and value of an object or pair key. */\nconst split = (key: object): readonly [object, unknown] => (Array.isArray(key) ? (key as unknown as readonly [object, unknown]) : [key, undefined]);\n/** Whether (code, key) is new, recording it if so. */\nconst firstTime = (code: string, key?: OnceKey): boolean => {\n if (key === undefined || typeof key === 'string') {\n const entry = key === undefined ? code : `${code} ${key}`;\n if (printed.has(entry)) return false;\n printed.add(entry);\n return true;\n }\n const [on, sub] = split(key);\n const values = valuesOn(on, code, true)!;\n if (values.has(sub)) return false;\n values.add(sub);\n return true;\n};\n\n/**\n * **One shape for every diagnostic the framework prints** — the short line production keeps, the whole sentence\n * development adds — so a package converting its messages writes a table and a call, never its own format.\n *\n * production `[vera] hydration: element: found <i> — https://verajs.dev/e/hydration-fallback`\n * development `[vera] hydration: element: found <i> — fell back to a client render: … (hydration-fallback)`\n *\n * `subject` is the free information — what the code already has at hand, naming the problem area — the same in both\n * builds. `prose` is development only: the package's table entry (`Prose`), called behind `__DEV__` at the call site so\n * the table goes unreferenced in production and rollup drops it whole. Production prints the code inside the link, so\n * the reader is one click from the explanation, which `scripts/sync-diagnostics.mjs` publishes from the same tables.\n *\n * **Every production message is coded** (Brian, 2026-11-11; this supersedes \"convert where smaller\", 2026-10-02):\n * consistency over a few bytes, so no package keeps a hand-written production line beside its table.\n */\n/*\n * The parameter names are deliberately unlike anything a caller holds: terser will not inline a function whose\n * parameter shadows a name at the call site (measured 2026-10-02 — directives passes its own `code`, and a parameter\n * called `code` left `((e,t,n)=>`…`)(0,t,n)` in its bundle, +8 B; renamed, the call folds to the bare template).\n */\n/**\n * **A misused API, named by its function** — the thrown-error twin of `diagnostic()`: `untrack: expected a function …\n * (untrack-not-function)`, function-first because a stack already names the source and the sweep reads that shape. The\n * prose comes from a package's table, behind `__DEV__`, so a development-only guard costs production nothing.\n */\nexport const misuse = (forName: string, withCode: string, andProse?: false | readonly [string, string?]) =>\n __DEV__ && andProse\n ? `${forName}: ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `${forName}: ${DOCS}${withCode}`;\n\n/**\n * **A misused API and what it was misused ABOUT** — `misuse()` with a subject, in `diagnostic()`'s ` — ` separator:\n * `parseFrontmatter: line 3 — https://verajs.dev/e/cms-frontmatter-unsupported`. The subject is the free information\n * (a line, a URL and its status) and prints in both builds. A sibling rather than an optional parameter on `misuse()`,\n * because `misuse()` is inlined into every bundle that throws and a conditional subject would tax all of them for a\n * shape few need; a sibling is tree-shaken where unused.\n */\nexport const misuseAbout = (forName: string, aboutSubject: string, withCode: string, andProse?: false | readonly [string, string?]) =>\n __DEV__ && andProse\n ? `${forName}: ${aboutSubject} — ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `${forName}: ${aboutSubject} — ${DOCS}${withCode}`;\n\nexport const diagnostic = (\n inArea: string,\n bySubject: string,\n withCode: string,\n andProse?: false | readonly [string, string?]\n) =>\n /** `__DEV__` HERE as well as at the call: production folds this to the one-line form, branch and all. */\n __DEV__ && andProse\n ? `[vera] ${inArea}: ${bySubject} — ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `[vera] ${inArea}: ${bySubject} — ${DOCS}${withCode}`;\n\n/**\n * **Text from outside — a file path, a YAML key, a URL, an error's message — quoted before it reaches a line.** A log is a\n * pipeline, and such text can be shaped by an author or a request: a newline in it forges a line, an ESC sequence hides\n * one (log injection). `JSON.stringify` escapes both; cut to 80 characters so one value cannot fill the log. @verajs/ssr\n * keeps a twin (it cannot import this), held equal by tests/ssr-coded-diagnostics.\n */\n/**\n * `max` caps the length (80 by default); `Infinity` keeps the whole text for a value worth reading in full — a site\n * owner's own path — which is still ESCAPED: truncation and escaping are separate jobs, and a path is not free of control\n * characters just because its owner wrote it (2026-10-09).\n */\nexport const quoted = (text: string, max = 80): string => JSON.stringify(text.length > max ? `${text.slice(0, max)}…` : text);\n\n/**\n * **The errors a package constructs, marked as its own** — so a wrapper that reports an inner refusal (cms's\n * `generateManifest` around a frontmatter line) carries it as it is: already formatted, its outside text already\n * quoted. Anything else is foreign, and quoted. Identity, never a shape test: a message can imitate ours, an identity\n * cannot. @verajs/ssr keeps a twin (it cannot import this).\n */\nconst ours = /* @__PURE__ */ new WeakSet<object>();\nexport const own = <E extends Error>(error: E): E => {\n ours.add(error);\n return error;\n};\nexport const isOwn = (error: unknown): boolean => typeof error === 'object' && error !== null && ours.has(error);\n\n/**\n * **Whether this copy has already said `code` (for `key`)**: for a GUARD only, where deciding to warn costs work worth\n * skipping once the warning is out (development's whole-tree walk for unwired directive attributes, an event-name\n * guess over every property of an element). A site that only prints calls `warnOnce`. Asks, never records.\n */\nexport const hasWarned = (code: string, key?: OnceKey): boolean => {\n if (key === undefined || typeof key === 'string') return printed.has(key === undefined ? code : `${code} ${key}`);\n const [on, sub] = split(key);\n return valuesOn(on, code, false)?.has(sub) === true;\n};\n\ntype Detail = false | readonly [string, string?] | (() => readonly [string, string?] | undefined);\n/**\n * The printer behind both, on one level. `andDetail` is `diagnostic()`'s prose, or a function returning it where building\n * the sentence costs something: it is called only the first time. `...andMore` rides beside the line behind '%s' (an\n * element, a thrown error), never inside it, so text from outside cannot forge a line. The console method is read at the\n * call, so a test that replaces `console.warn` sees it.\n */\nconst sayOnce =\n (level: 'warn' | 'error') =>\n (inArea: string, bySubject: string, withCode: string, andDetail?: Detail, forKey?: OnceKey, ...andMore: unknown[]): void => {\n if (!firstTime(withCode, forKey)) return;\n const line = diagnostic(inArea, bySubject, withCode, typeof andDetail === 'function' ? andDetail() : andDetail);\n if (andMore.length) console[level]('%s', line, ...andMore);\n else console[level](line);\n };\n/**\n * **A diagnostic said once per page** (per key, where one is given: a string, or an object such as the element it is\n * about): `diagnostic()`'s arguments, then the key, then what rides beside the line. Coded in production exactly as\n * `diagnostic()` is, because it IS `diagnostic()`. `errorOnce` is its twin on `console.error`, for a refusal a page should\n * not miss.\n */\nexport const warnOnce = /* @__PURE__ */ sayOnce('warn');\nexport const errorOnce = /* @__PURE__ */ sayOnce('error');\n","/** **`@verajs/renderer/hydrate-slots`' diagnostics — DEVELOPMENT ONLY.** Its bundle's own table, merged into the renderer's json. */\nimport type { Prose } from '@verajs/shared-utils';\n\nexport const PROSE: Record<string, Prose> = {\n 'hydrate-slots-unwired': () => [\n 'reads the light-DOM statement through `slots`, which is not wired.',\n 'Wire `slots` beside it: `wire([renderer, hydration, slots, hydrateSlots])`.',\n ],\n};\n","/**\n * **`@verajs/renderer/hydrate-slots` — hydrating light-DOM slots.** `wire([renderer, hydration, slots, hydrateSlots])`.\n *\n * Everything only a page that HYDRATES LIGHT SLOTS runs, kept out of both modules so neither pays for the other (Brian,\n * 2026-10-07): the server's format (`data-vm-light` — its number, the light order — and the carrier), each filled slot's\n * range and detached copy, and the rescue. Hydration calls it through `_$hydrateSlots$`;\n * it captures through slots' `_$capture$`. Slots' own distribution then recomputes every assignment from the nodes'\n * names, so the server's placement decides at most WHETHER a node moves, never where it ends up.\n *\n * Without it, hydration refuses a served light host before touching anything (`hydration-slots`): the page stands as\n * served, and a component boundary reports it once.\n */\nimport { PROTOCOL } from './kinds.js';\nimport { diagnostic } from '@verajs/shared-utils';\nimport { PROSE } from './hydrate-slots-diagnostics.js';\nimport type { CaptureSeam, HydrateSlots, HydrationCursor, HydrationFail, LightCapture, ServedHost } from './types.js';\n\n/** The registry as this module uses it — `get` named so `wire`'s registry is assignable (a type of optional members alone is \"weak\"). */\ntype Registry = { get(name: string): unknown[] | undefined; _$capture$?: CaptureSeam; _$hydrateSlots$?: HydrateSlots };\n/** A served host being adopted: what hydration sees (`ServedHost`), and what this module keeps beside it. */\n/** `_`-named where only this module reads them — the minifier shortens those; `carrier` is hydration's to read too. */\ntype Served = ServedHost & { _host: Element; _runs: string; carrier: HTMLElement | null; _pools: Node[][]; _capture: LightCapture };\n\n/** What `@verajs/ssr` writes — a deliberate second address of its writer; `slots-ssr-client-parity` holds them together. */\nconst FORMAT = '1';\nconst LIGHT_ATTR = 'data-vm-light';\nconst UNASSIGNED = 'data-vm-unassigned';\nconst isMark = (node: Node, data: string) => node.nodeType === 8 && (node as Comment).data === data;\n/** The slottable nodes from `from` up to `to` — comments are never light content. */\nconst pool = (from: Node | null, to: Node | null): Node[] => {\n const out: Node[] = [];\n for (let node = from; node !== null && node !== to; node = node.nextSibling) if (node.nodeType !== 8) out.push(node);\n return out;\n};\n/**\n * The pools' nodes in light order, as the statement gives it — `null` unless it accounts for every one, exactly. The\n * statement counts a run of adjacent TEXT as one light child, as the parser makes it; a walk may since have split it\n * (an outer template's static text beside its value), so the pieces that follow one taken are taken with it.\n */\nconst ordered = (runs: string, pools: Node[][]): Node[] | null => {\n const order: Node[] = [];\n for (const run of runs === '' ? [] : runs.split(',')) {\n const [index, count = '1'] = run.split('*');\n const nodes = pools[+index];\n for (let k = +count; k > 0; k--) {\n let node = nodes?.shift();\n if (node === undefined) return null;\n order.push(node);\n while (node.nodeType === 3 && nodes![0] !== undefined && nodes![0] === node.nextSibling && nodes![0].nodeType === 3) order.push((node = nodes!.shift()!));\n }\n }\n return pools.every((nodes) => nodes.length === 0) ? order : null;\n};\n/** The `]` that closes the range `start` opens — `null` if another `[` or the parent's end comes first: not well-formed. */\nconst endOf = (start: Node): ChildNode | null => {\n let end = start.nextSibling;\n while (end !== null && !isMark(end, ']') && !isMark(end, '[')) end = end.nextSibling;\n return end !== null && isMark(end, ']') ? end : null;\n};\nconst SERVED = new WeakSet<Node>();\n/** Every well-formed range under `parent`, in document order — never entering a range, the carrier, or a served host. */\nconst scan = (parent: Node, out: Node[][], skip: Node | null) => {\n for (let node = parent.firstChild; node !== null; node = node.nextSibling) {\n if (node === skip) continue;\n if (isMark(node, '[')) {\n const end = endOf(node);\n if (end !== null) {\n out.push(pool(node.nextSibling, end));\n node = end;\n }\n } else if (node.nodeType === 1 && !(node as Element).hasAttribute(LIGHT_ATTR) && !SERVED.has(node)) scan(node, out, null);\n }\n};\n\n/** The server's carrier — the host's first child, when it is `<ins data-vm-unassigned>` — or `null`. */\nconst carrierOf = (host: Element): HTMLElement | null => {\n const first = host.firstChild;\n return first !== null && first.nodeType === 1 && (first as Element).hasAttribute(UNASSIGNED) ? (first as HTMLElement) : null;\n};\n/** The statement's runs (after its format number), or `null` for another format or none. */\nconst statementOf = (spec: string | null): string | null => {\n const colon = spec === null ? -1 : spec.indexOf(':');\n return colon < 0 || spec!.slice(0, colon) !== FORMAT ? null : spec!.slice(colon + 1);\n};\n/** Every well-formed range's light nodes, then the carrier's — the pools a statement indexes, found by structure. */\nconst poolsOf = (host: Element, carrier: Node | null): Node[][] => {\n const pools: Node[][] = [];\n scan(host, pools, carrier);\n if (carrier !== null) pools.push(pool(carrier.firstChild, null));\n return pools;\n};\n/** A served host not yet adopted: its light children in light order, read fresh from its statement — or `null`. */\nconst stated = (host: Element): Node[] | null => {\n const runs = statementOf(host.getAttribute(LIGHT_ATTR));\n return runs === null ? null : ordered(runs, poolsOf(host, carrierOf(host)));\n};\n\nlet registry: Registry;\n/** Hydration's mismatch, handed over at `open`. */\nlet fail: HydrationFail;\n\n/** A served host, read: its statement, its carrier. Slots must be wired, and of this release. */\nconst open = (host: Element, failWith: HydrationFail): Served => {\n fail = failWith;\n const seam = registry._$capture$;\n /**\n * A wiring state (the diagnostic shape). Production prints the code alone: the code-and-link shape measured +14 B, the\n * bare code 0 B — Brian's byte rule (a production line carries its code where the bundle is not larger), 2026-10-09.\n */\n if (seam === undefined)\n throw new Error(\n __DEV__ ? diagnostic('hydrate-slots', `<${host.localName}>`, 'hydrate-slots-unwired', __DEV__ && PROSE['hydrate-slots-unwired']()) : '[vera] hydrate-slots-unwired'\n );\n const spec = host.getAttribute(LIGHT_ATTR)!;\n host.removeAttribute(LIGHT_ATTR);\n SERVED.add(host);\n if (seam[0] !== PROTOCOL) fail('protocol', host, __DEV__ && (() => `slots protocol ${seam[0]}, expected ${PROTOCOL}`));\n const runs = statementOf(spec);\n const served = { _host: host, _runs: runs ?? '', carrier: carrierOf(host), _pools: [], _capture: seam[1] };\n /** Another release's server: rescued HERE — hydration holds no state for this host until `open` returns. */\n if (runs === null) {\n rescue(served);\n /** Named in every build (Brian, 2026-10-02): a deploy, not a developer, meets it. */\n fail('format', host, () => `${__DEV__ ? `server format ${JSON.stringify(spec.split(':')[0])}, expected ${FORMAT}: ` : ''}update @verajs/ssr and @verajs/renderer together`);\n }\n return served;\n};\n\n/** At a canonical `<slot>`: a range at the cursor is its region — the slot itself a detached copy, as the client keeps it. */\nconst slot = (canonical: Element, cursor: HydrationCursor, served: ServedHost): Element | null => {\n if (canonical.localName !== 'slot') return null;\n const rs = cursor.offset === 0 ? cursor.node : null;\n if (rs === null || !isMark(rs, '[')) return null;\n const re = endOf(rs);\n if (re === null) return fail('slot', rs, __DEV__ && (() => `a filled slot's range here is not well-formed`));\n (served as Served)._pools.push(pool(rs.nextSibling, re));\n const copy = cursor.parent.ownerDocument!.importNode(canonical, true) as Element & { _$region$?: [Comment, Comment] };\n copy._$region$ = [rs as Comment, re as Comment];\n cursor.node = re.nextSibling;\n return copy;\n};\n\n/** Light hosts a template placed RUNS into, walked in this adoption: captured (or converted) at its close. */\nlet pending: HydrationCursor[] = [];\n\n/**\n * **A light host a template wrote runs into, seated** — whoever walks a light host's content first captures it. Its\n * light children become units in light order: each node outside a run a static, each run `[start, nodes, end]` (its part's\n * anchors, held by `insert`, and the light nodes between them). The statement's order: captured now, waiting for the\n * host's own slots (`wait`). The live record's: each run made one unit of it (`runOf`). Anchors that do not pair up as\n * the template's runs — a run whose items are not each one element — decline.\n */\nconst seat = (cursor: HydrationCursor) => {\n const { parent, _marks: marks, _runs: runs, end } = cursor as Required<HydrationCursor>;\n const host = parent as Element;\n if (marks.length !== runs * 4)\n fail('run', host, __DEV__ && (() => `a list or value this template writes into a light-slot component is not one element per item`));\n const [, capture, lightNodes, records, standIn, placed, adopted] = registry._$capture$!;\n /**\n * The light children NOW, not as the walk began: a text child the walk split is several light children, as a client\n * render makes it — read as the walk began, its pieces were never captured and the next distribution dropped them.\n */\n const nodes = (end === 0 ? lightNodes(host) : stated(host)) ?? fail('run', host, false);\n const index = (node: unknown) => (node === null ? nodes.length : nodes.indexOf(node as Node));\n /** The statement's order: every light child captured as a static first, waiting for the host's own slots. */\n if (end !== 0) capture(host, null, nodes, carrierOf(host), true);\n const record = records.get(host)!;\n const { holding } = record;\n const ref = holding.lastChild;\n const doc = host.ownerDocument;\n for (let m = 0; m < marks.length; m += 4) {\n const k = index(marks[m + 1]);\n const run = nodes.slice(k, index(marks[m + 3]));\n /**\n * **The run, as the client keeps one**, in place of the statics its nodes were: its unit's two comments in holding,\n * its part's anchors inside them, and at each node's place a stand-in if a slot holds it (it stays there), or the\n * node itself if it waits unassigned. Only holding and the record change; no slotted node moves.\n */\n const at = record.units.findIndex((unit) => unit.a === nodes[k]);\n record.units = record.units.filter((unit) => !run.includes(unit.a));\n const unit = { a: doc.createComment(''), z: doc.createComment('') };\n holding.insertBefore(unit.a, ref);\n holding.insertBefore(marks[m] as Node, ref);\n for (const node of run)\n if (node.parentNode === holding) {\n holding.insertBefore(node, ref);\n placed.set(node, null);\n } else {\n standIn(node, holding, ref);\n if (!placed.has(node)) placed.set(node, adopted);\n }\n holding.insertBefore(marks[m + 2] as Node, ref);\n holding.insertBefore(unit.z, ref);\n record.units.splice(at < 0 ? record.units.length : at, 0, unit);\n }\n /** Nothing to mark: holding is watched, so slots notes these writes as it notes any other. */\n};\n\n/** The walk matched: the light children, in light order, captured where they stand — before anything commits. */\nconst close = (adopted: ServedHost | null) => {\n for (const cursor of pending) seat(cursor);\n pending = [];\n if (adopted === null) return;\n const served = adopted as Served;\n const { _host: host, carrier, _pools: pools } = served;\n if (carrier !== null) pools.push(pool(carrier.firstChild, null));\n served._capture(host, null, ordered(served._runs, pools) ?? fail('slots', host, __DEV__ && (() => `its light-slot statement does not account for what its slots hold`)), carrier);\n};\n\n/**\n * It did not: every well-formed range's nodes and the carrier's, captured where they stand before the clear. The clear\n * detaches them with the old markup and the fresh render's end places each by identity, slotted or held — moving them\n * into the carrier first only moved each light node twice more (measured: three disconnect/connect pairs for one).\n */\nconst rescue = (served: ServedHost | null) => {\n pending = [];\n if (served === null) return;\n const { _host: host, _runs: runs, _capture: capture, carrier } = served as Served;\n const pools = poolsOf(host, carrier);\n /** Every node first: `ordered` consumes the pools, and one that fails partway has taken some. */\n const all = pools.flat();\n capture(host, null, ordered(runs, pools) ?? all, carrier);\n};\n\n/**\n * **A light host a template places content into** (the outer walk's light cursor): its children in light order. Slots'\n * live record is the one source once it exists — a node the page added since is in it, and the template need not\n * account for it; before that (the host not yet adopted), the server's statement, read fresh and never cached, which the\n * template must account for exactly. Neither: `null`, and the walk reads the host's DOM.\n */\nconst light = (host: Element, canonical: Element, plan: ReadonlyMap<Node, readonly number[]>, values: readonly unknown[]): HydrationCursor | null => {\n /** Only a custom element the template places content into can be a light host. */\n if (canonical.firstChild === null || !host.localName.includes('-')) return null;\n /** RUNS the template writes directly among those children: a value that is not text (a text value is claimed in place). */\n let runs = 0;\n for (let node: Node | null = canonical.firstChild; node !== null; node = node.nextSibling)\n if (node.nodeType === 3) {\n const owned = plan.get(node);\n if (owned !== undefined && values[owned[0]] != null && typeof values[owned[0]] === 'object') runs++;\n }\n const seam = registry._$capture$;\n const live = seam?.[0] === PROTOCOL ? seam[2](host) : null;\n if (live !== null) return walker(host, live, 0, runs);\n const nodes = stated(host);\n return nodes === null ? null : walker(host, nodes, nodes.length, runs);\n};\n/**\n * A cursor over `nodes` — the walk must account for the first `end` of them (all of a statement's, none of a record's);\n * with runs, held until the adoption's close seats it.\n */\nconst walker = (host: Element, nodes: Node[], end: number, runs: number): HydrationCursor => {\n const cursor = { parent: host, node: nodes[0] ?? null, offset: 0, light: nodes, at: 0, end, _runs: runs, _marks: [] };\n if (runs > 0) pending.push(cursor);\n return cursor;\n};\n\n/**\n * An insert on a light walk. A run's anchor is held, with the node it stands before, for the unit `seat` builds — split\n * first if the walk stands inside a text child, as a plain insert would; text (an empty value's anchor) goes in place.\n */\nconst insert = (cursor: HydrationCursor, node: Node) => {\n if (cursor.offset > 0) {\n cursor.node = (cursor.node as Text).splitText(cursor.offset);\n cursor.offset = 0;\n }\n const at = cursor.node;\n if (node.nodeType === 3) (at === null ? cursor.parent : at.parentNode!).insertBefore(node, at);\n else cursor._marks!.push(node, at);\n};\n\n/** The walk's step, once this piece is wired: on a light cursor the next light child, else the next sibling. */\nconst next = (cursor: HydrationCursor, node: Node): Node | null => {\n const nodes = cursor.light;\n return nodes === undefined ? node.nextSibling : (nodes[++cursor.at!] ?? null);\n};\n\n/** `wire([renderer, hydration, slots, hydrateSlots])`. */\nexport const hydrateSlots = (given: Registry) => {\n registry = given;\n given._$hydrateSlots$ = [PROTOCOL, open, slot, close, rescue, light, next, insert];\n};\n"],"names":[],"mappings":"AAAA;;;;AAIG;AACH;AAsDA;;;;;;AAMG;AACH;;;;AAIG;AACI,MAAM,QAAQ,GAAG,CAAC;;ACvEzB;;;;;AAKG;AACI,MAAM,IAAI,GAAG,uBAAuB;AA2FpC,MAAM,UAAU,GAAG,CACxB,MAAc,EACd,SAAiB,EACjB,QAAgB,EAChB,QAA6C;AAE7C;AACA,OAAO,IAAI;AACT,MAAE,CAAA,OAAA,EAAU,MAAM,CAAA,EAAA,EAAK,SAAS,CAAA,GAAA,EAAM,QAAQ,CAAC,CAAC,CAAC,CAAA,EAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAA,CAAA,EAAI,QAAQ,CAAC,CAAC,CAAC,CAAA,CAAE,GAAG,EAAE,CAAA,EAAA,EAAK,QAAQ,CAAA,CAAA;MACnG,CAAA,OAAA,EAAU,MAAM,CAAA,EAAA,EAAK,SAAS,MAAM,IAAI,CAAA,EAAG,QAAQ,CAAA,CAAE;;ACvGpD,MAAM,KAAK,GAA0B;IAC1C,uBAAuB,EAAE,MAAM;QAC7B,oEAA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ACzF,MAAM,CAAC,MAAO,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;AACpC,CAAC;AAED;AACA,MAAM,IAAI,GAAG,CAAC,MAAuB,EAAE,IAAU,KAAiB;AAChE,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK;IAC1B,OAAO,KAAK,KAAK,SAAS,GAAG,IAAI,CAAC,WAAW,IAAI,KAAK,CAAC,EAAE,MAAM,CAAC,EAAG,CAAC,IAAI,IAAI,CAAC;AAC/E,CAAC;AAED;AACO,MAAM,YAAY,GAAG,CAAC,KAAe,KAAI;IAC9C,QAAQ,GAAG,KAAK;IAChB,KAAK,CAAC,eAAe,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC;AACpF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vera-renderer-hydration.d.ts","sources":["../../src/types.ts","../../src/renderer.ts","../../src/hydration.ts"],"mappings":"AAAA;;;;;;;;;;;;;;;;;AAiBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjBH;;;;;;;;;;;;;;;;AAgBG;;;;
|
|
1
|
+
{"version":3,"file":"vera-renderer-hydration.d.ts","sources":["../../src/types.ts","../../src/renderer.ts","../../src/hydration.ts"],"mappings":"AAAA;;;;;;;;;;;;;;;;;AAiBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjBH;;;;;;;;;;;;;;;;AAgBG;;;;AAgDA,QAAA,IAAA;AACH;AACA;AACA;AAEA;AACA;AAEA;;;;;;AAMG;AACH;AACA;AACA;;;;AAIG;AACH;AACA;AACA,qBAAA,IAAA,KAAA,QAAA;AACA;AACA;AAGA;;;;;;;;AAQG;AACH;AACA;AACA,wBAAmB,cAAA;AACnB;;AAQA;AACA;AACA;;;;AAIG,cAAA,IAAA;AACH,cAAM,OAAa;AACnB;;;AAGG;AACH,uBAAoB,KAAA;AACpB;;;;AAIG;AACH;AAEA,cAAA,QAAA;AACA;AACA;AACA;AAEA;;;AAGG;AACH,eAAA,QAAA;;;;;;AAMG,0BAAA,QAAA,WAAA,oBAAA,QAAA,IAAA;AACH;AAuBM;AACA,KAAA,IAAA,GAAA,QAAA,GAAA,SAAA;;;AAWA;AACG;AACH;;AAEJ;AACF;AACA;;;AAGG;AACH,cAAA,SAAA;;;AAGG;AACH,QAAM,IAAA;;;QAEsC,IAAA;AAC1C,QAAA,QAAa;QACb,IAAA;AACA;;AAEA;WAAU,GAAA,CAAA,sBAA4B,QAAK;;;AAE7C;AACA;AACE;AACA;AACE,SAAA,IAAA;uBACA,OAAA,cAAA,IAAA;AACA,sBAAY;;;;;;AAIhB;AAEA;;AAEE;;;AAGA;AACA;;AAEA;;+BAEoB,IAAA,OAAA,IAAA,UAAA,IAAA;;AAEpB,aAAoB,IAAA,mBAAA,IAAA;AACpB;;;AAGG,aAAA,IAAA,OAAA,IAAA,kBAAA,IAAA;AACH;AACA,aAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7MC;AACH;AACA;AACA;AACA,KAAA,SACO;AAgFP;AACA,cAAa,SAAK,UAAA,QAAA;;;;","names":[]}
|
|
@@ -11,6 +11,15 @@ true && andProse
|
|
|
11
11
|
? `[vera] ${inArea}: ${bySubject} — ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`
|
|
12
12
|
: `[vera] ${inArea}: ${bySubject} — ${DOCS}${withCode}`;
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* **A raw-text element's composed text, unable to end its element** — the rule every side writes, byte for byte (the
|
|
16
|
+
* server's `styleHole` and JSON rule, the renderer, hydration's comparison, lite, static): in a style each `</style`
|
|
17
|
+
* (any case) as `<\/style` (the same CSS), in a JSON data block every `<` as `\u003c` (the same JSON). A style's or a
|
|
18
|
+
* JSON block's text is serialized VERBATIM (BROWSER-LEDGER), so written as composed, a value became markup once the page
|
|
19
|
+
* was saved from the DOM and parsed again. Applied to the COMPOSED text: a closer can form across a hole. Idempotent —
|
|
20
|
+
* neither form leaves what it replaces.
|
|
21
|
+
*/
|
|
22
|
+
const closedRawText = (text, json) => json ? text.replace(/</g, '\\u003c') : text.replace(/<\/(style)/gi, '<\\/$1');
|
|
14
23
|
/**
|
|
15
24
|
* **The properties that replace an element's whole content** — a binding to one owns the element's children, so it
|
|
16
25
|
* cannot share the element with content of its own (markup, or a child binding the write would strand: a later commit
|
|
@@ -68,6 +77,22 @@ const LIVE = 10;
|
|
|
68
77
|
const SELECT = 11;
|
|
69
78
|
/** A `<select>`'s `selectedIndex` — the rare spelling of its selection, queued as `SELECT` is (see `flush`). */
|
|
70
79
|
const SELECT_INDEX = 14;
|
|
80
|
+
/**
|
|
81
|
+
* **An HTML `<style>`'s or JSON data block's whole text** — ONE binding (the element's first value; the others are
|
|
82
|
+
* consumed, as a multi-part attribute's are) composes the statics and values and writes the element's text when it
|
|
83
|
+
* changed. Its text is serialized VERBATIM (BROWSER-LEDGER), so it is written unable to end its element, as the server
|
|
84
|
+
* writes it: in a style each `</style` as `<\/style`, in a JSON block every `<` as `\u003c` — on the COMPOSED text, since
|
|
85
|
+
* a closer can form across a hole. Committed in `commit`'s cold branch: the hot text line is untouched.
|
|
86
|
+
*/
|
|
87
|
+
const RAW_STYLE = 15;
|
|
88
|
+
const RAW_JSON = 16;
|
|
89
|
+
/**
|
|
90
|
+
* **An element whose content is never shown** (`<iframe>`, `<noscript>`, `<xmp>`, `<noembed>`, `<noframes>`,
|
|
91
|
+
* `<plaintext>`): its statics and its values composed as text, each VALUE fully encoded (every ASCII non-word character
|
|
92
|
+
* as a character reference), so a page saved from the DOM and parsed again — with scripting on (raw text) or off
|
|
93
|
+
* (markup) — holds no value that can end the element or add an attribute.
|
|
94
|
+
*/
|
|
95
|
+
const RAW_ENCODED = 17;
|
|
71
96
|
const TEXT = 1;
|
|
72
97
|
const TEMPLATE = 2;
|
|
73
98
|
const LIST = 3;
|
|
@@ -84,7 +109,7 @@ const NODE = 4;
|
|
|
84
109
|
* capture (`_$capture$`), both read by hydration. One number for both: the three ship in one package, and a change to
|
|
85
110
|
* either seam bumps it. A hydration that meets another number declines (the page renders fresh) and says so.
|
|
86
111
|
*/
|
|
87
|
-
const PROTOCOL =
|
|
112
|
+
const PROTOCOL = 2;
|
|
88
113
|
/** The protocol number — FROZEN at 0. */
|
|
89
114
|
const HANDOFF_PROTOCOL = 0;
|
|
90
115
|
/** The first-render hook's setter — FROZEN at 1. */
|
|
@@ -407,7 +432,7 @@ const commitBinding = (into, i, kind, live) => {
|
|
|
407
432
|
later(APPLY, raw, live, bindings[slot]);
|
|
408
433
|
return;
|
|
409
434
|
}
|
|
410
|
-
if (kind === ATTR) {
|
|
435
|
+
if (kind === ATTR || kind >= RAW_STYLE) {
|
|
411
436
|
const parts = template.$J[i];
|
|
412
437
|
let text;
|
|
413
438
|
if (parts === null)
|
|
@@ -423,7 +448,19 @@ const commitBinding = (into, i, kind, live) => {
|
|
|
423
448
|
text += H[HANDOFF_TO_TEXT](v) + parts[p];
|
|
424
449
|
}
|
|
425
450
|
}
|
|
426
|
-
|
|
451
|
+
/**
|
|
452
|
+
* A style's or JSON block's whole text (a lone value, or statics and values composed): ADOPTED when the served text is the
|
|
453
|
+
* composed text as the client writes it (`closedRawText`, the server's bytes) — seeded with the composed text, as the
|
|
454
|
+
* base's commit stores it — and otherwise left to the base's commit, which rewrites it.
|
|
455
|
+
*/
|
|
456
|
+
if (kind !== ATTR) {
|
|
457
|
+
if (text !== undefined && kind !== RAW_ENCODED && live.textContent === /*@__NOINLINE__*/ closedRawText(text ?? '', kind === RAW_JSON)) {
|
|
458
|
+
/** As the base's commit stores it: a lone value itself, a composed text otherwise. */
|
|
459
|
+
bindings[slot + 1] = parts === null ? raw : text;
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
else if (text !== undefined) {
|
|
427
464
|
const server = live.getAttribute(name);
|
|
428
465
|
/**
|
|
429
466
|
* Equal — both texts, or both absent: the client value itself is seeded, exactly what the base's commit would
|
|
@@ -464,7 +501,8 @@ const adoptElement = (canonical, live, into, owned) => {
|
|
|
464
501
|
if (kind === SOLE)
|
|
465
502
|
sole = i;
|
|
466
503
|
else {
|
|
467
|
-
|
|
504
|
+
/** …and a style's or JSON block's text binding writes its element's text: no children to walk. */
|
|
505
|
+
if (((kind === PROPERTY || kind === LIVE) && CONTENT_PROPERTY.test(into.template.$N[i])) || kind >= RAW_STYLE)
|
|
468
506
|
content = true;
|
|
469
507
|
commitBinding(into, i, kind, live);
|
|
470
508
|
}
|