@verajs/renderer 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +1000 -12
  2. package/dist/development/vera-renderer-hydrate.d.ts +32 -13
  3. package/dist/development/vera-renderer-hydrate.d.ts.map +1 -1
  4. package/dist/development/vera-renderer-hydrate.js +1812 -234
  5. package/dist/development/vera-renderer-hydrate.js.map +1 -1
  6. package/dist/development/vera-renderer-keyed.d.ts +17 -0
  7. package/dist/development/vera-renderer-keyed.d.ts.map +1 -0
  8. package/dist/development/vera-renderer-keyed.js +322 -0
  9. package/dist/development/vera-renderer-keyed.js.map +1 -0
  10. package/dist/development/vera-renderer-profiler.d.ts +57 -17
  11. package/dist/development/vera-renderer-profiler.d.ts.map +1 -1
  12. package/dist/development/vera-renderer-profiler.js +1445 -209
  13. package/dist/development/vera-renderer-profiler.js.map +1 -1
  14. package/dist/development/vera-renderer-slots.d.ts +103 -0
  15. package/dist/development/vera-renderer-slots.d.ts.map +1 -0
  16. package/dist/development/vera-renderer-slots.js +1387 -0
  17. package/dist/development/vera-renderer-slots.js.map +1 -0
  18. package/dist/development/vera-renderer-spread.d.ts +51 -0
  19. package/dist/development/vera-renderer-spread.d.ts.map +1 -0
  20. package/dist/development/vera-renderer-spread.js +499 -0
  21. package/dist/development/vera-renderer-spread.js.map +1 -0
  22. package/dist/development/vera-renderer-tag.d.ts +61 -0
  23. package/dist/development/vera-renderer-tag.d.ts.map +1 -0
  24. package/dist/development/vera-renderer-tag.js +727 -0
  25. package/dist/development/vera-renderer-tag.js.map +1 -0
  26. package/dist/development/vera-renderer.d.ts +41 -16
  27. package/dist/development/vera-renderer.d.ts.map +1 -1
  28. package/dist/development/vera-renderer.js +1375 -200
  29. package/dist/development/vera-renderer.js.map +1 -1
  30. package/dist/vera-renderer-hydrate.min.js +1 -1
  31. package/dist/vera-renderer-hydrate.min.js.map +1 -1
  32. package/dist/vera-renderer-keyed.min.js +2 -0
  33. package/dist/vera-renderer-keyed.min.js.map +1 -0
  34. package/dist/vera-renderer-slots.min.js +2 -0
  35. package/dist/vera-renderer-slots.min.js.map +1 -0
  36. package/dist/vera-renderer-spread.min.js +2 -0
  37. package/dist/vera-renderer-spread.min.js.map +1 -0
  38. package/dist/vera-renderer-tag.min.js +2 -0
  39. package/dist/vera-renderer-tag.min.js.map +1 -0
  40. package/dist/vera-renderer.min.js +1 -1
  41. package/dist/vera-renderer.min.js.map +1 -1
  42. package/package.json +24 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vera-renderer-slots.js","sources":["../../src/slots.ts"],"sourcesContent":["/**\n * Light-DOM slots — the `'slot'` insert the renderer's seam consults. Wire it beside the renderer\n * and every light-rendered template's `<slot name=\"…\">` distributes the host's own children,\n * exactly as shadow DOM would have:\n *\n * ```js\n * import { renderer } from '@verajs/renderer';\n * import { slots } from '@verajs/renderer/slots';\n * wire([renderer, slots]);\n * ```\n *\n * ```html\n * <my-card><h2 slot=\"header\">Hello</h2>Body text</my-card>\n * ```\n *\n * **Additive entry** (the `keyed`/`spread` family): imports nothing, reaches the renderer only\n * through the wired seam, safe alongside any renderer entry on a CDN page.\n *\n * **Wire it at the app entry, before anything renders.** The renderer resolves this seam once per\n * TEMPLATE, and templates are cached per call site for the life of the page — so a component that\n * rendered before the wiring keeps a slotless template forever. That is the same contract every\n * insert carries; the alternative (re-checking the registry per instance) would put a lookup on\n * the hot path of every app, slots or not.\n *\n * The semantics contract is the platform's own assignment algorithm: elements go to the slot\n * their `slot` attribute names, text nodes (whitespace included) to the default slot, comments\n * are never slottables (which also keeps the renderer's root marker out of capture), duplicate\n * slot names — first in mount order wins and later ones show fallback, fallback renders only\n * while nothing is assigned and comes back when a slot empties, and capture takes the host's\n * DIRECT children only, so nested components compose.\n *\n * **Post-render additions are NATIVE, and the mechanism is ownership, not position.** The host's\n * childList holds both the user's content and the component's output, and the old rules told them\n * apart by where a node sat — which made bare text unreachable at the tail and a late insertion\n * join its slot out of order. Now the renderer stamps everything it emits at a captured host's\n * top level (a non-enumerable `_$own$` property: `true` for a root part's own output — the\n * structural `_end === null` test, so async commits are covered — and the placing part for\n * content from an outer template). An unstamped top-level addition is therefore knowably the\n * user's: captured with full native semantics, text included, no `slot` attribute required\n * (`slot=\"\"`/`slot=\"name\"` still route). Ordering reads the same fact — placed content extends\n * its part's own group; an unstamped node before the boundary takes its document position ahead\n * of content distributed away, and past it, appends. **Re-slotting keeps that answer**: a node\n * whose `slot` attribute changes has not moved in the light tree, so it rejoins by a rank taken\n * when it was first captured rather than by arrival — otherwise an item toggled into a \"pinned\"\n * slot jumped to the end of the pinned list instead of holding its place.\n *\n * **What remains is reach, not order** — the earlier note here said hand-edits among several\n * `${…}` parts' content ordered \"approximately\", which measurement does not support: every\n * position a user can actually reach orders exactly as the platform does, and every order light\n * produces is one a shadow root also produces. What light has FEWER of is positions. A distributed\n * child is no longer a direct child of the host, so `host.insertBefore(node, thatChild)` throws\n * `NotFoundError` where a shadow host accepts it, and positions among an already-distributed\n * group cannot be named at the host's top level at all. `child.before(node)` / `child.after(node)`\n * go through the node's current parent and work identically in both modes; that is what the README\n * teaches, and `tests/renderer-slots.test.mjs` pins both the throw and the answer. And one parity note: whitespace appended to a\n * light host now suppresses the default fallback, because it does exactly that in a shadow root\n * (measured). `tests/slots-transition-parity.test.mjs` holds the matrix.\n *\n * **A `<slot>` cannot sit inside table markup**, in either mode: the parser's table insertion mode\n * rejects the element and foster-parents it out, so the slot lands before the `<table>` and takes\n * its distributed content with it. Measured against a shadow root given the same markup — it does\n * the same thing, so the modes agree and this is the platform's rule rather than this module's.\n * Ordinary bindings are fine (`<tbody>${rows}</tbody>` renders correctly) because the renderer's\n * anchor is a COMMENT, which table parsing permits where it rejects elements.\n *\n * **Pop-out rule.** Every *document* touch derives from the node itself (`ownerDocument`), so a\n * component rendered into a second window creates its nodes in that window's document.\n *\n * The one global read is `MutationObserver`, deliberately: an observer is not bound to the realm\n * of the nodes it watches, so deriving the constructor from `ownerDocument.defaultView` would buy\n * nothing and cost bytes on every capture. **Measured, not assumed** — `tests/browser/\n * slots-realm.test.js` renders a host in a second same-origin document and asserts that live\n * additions, `slot` changes and removals all reach their slots, on Chromium, Firefox and WebKit.\n * Behaviour the platform decides is not settled under jsdom.\n */\n\n/** What the seam holds per taken-over slot; `_$park$` rescues the user's nodes before the\n * instance's DOM is bulk-discarded on a branch-away, and un-registers the binding. */\ntype SeamState = { _$park$: () => void };\n\ntype Binding = {\n _start: Comment;\n _end: Comment;\n /** Read from `_slot` at mount and kept in step with it, so `<slot name=${…}>` works. */\n _name: string;\n /**\n * **The displaced region, parked in a fragment — empty whenever the region is on screen.**\n *\n * It began as an array of the slot's template children, detached one by one. That is a snapshot,\n * and the region it stands for is not static: a slot NESTED in this fallback keeps distributing\n * while displaced, so the array recorded a state that had moved on. Two failures came out of it,\n * one of them content loss — see `fill`.\n *\n * A fragment is the same idea without the snapshot. Displacing appends the region into it and\n * restoring inserts it back in one call, so anything that happened inside while it was away\n * comes back too, in place, with no list to keep in step. It also keeps every anchor PARENTED\n * while displaced, which is what lets a nested binding go on working instead of tripping `fill`'s\n * discarded-anchors guard.\n */\n _fallback: DocumentFragment;\n _assigned: boolean;\n /**\n * **The `<slot>` element itself, kept out of the document but alive as the component's API\n * object.** It is already what the template's own bindings attached to — `@slotchange`, `&ref`,\n * `name=${…}` all commit onto this element — so keeping it costs nothing and makes those\n * bindings mean what they mean in a shadow root: events dispatch on it, `&ref` hands it over,\n * and `assignedNodes()`/`assignedElements()` answer from the live assignment.\n */\n _slot?: Element;\n /** What this binding last SHOWED, so `slotchange` fires on change like the platform's does and\n * not on every fill. */\n _shown: Node[];\n _queued: boolean;\n};\n\ntype HostState = {\n /** The host this state belongs to — `flushPending` hands it to the record handler. */\n _host: Element;\n /** True while `flushPending` is processing, so the fills it causes do not recurse into it. */\n _flushing: boolean;\n /** Assignment by slot name ('' is the default slot). Arrays are the live membership. */\n _map: Map<string, Node[]>;\n /**\n * Every mounted binding, in MOUNT order — which is tree order, so the first one carrying a name\n * is the one that receives it, exactly as the platform picks the first matching slot.\n *\n * A flat list rather than a map keyed by name, because a slot's name is not fixed:\n * `<slot name=${section}>` can change between renders, and a keyed map would have to be re-keyed\n * on every such change. Finding the active one is then a scan, which is fine because bindings per\n * host are a handful — a rich component has three or four.\n *\n * **Measured rather than assumed**, since a scan invites the question: against the map-keyed\n * version, at 10, 50 and even an absurd 200 slots on one host, mount was within noise, and live\n * mutations and `slotted()` reads are FLAT in the number of slots (re-verified 2026-09-05:\n * re-slot cost moves ~3% from 10 to 200 slots; reads sub-microsecond throughout).\n *\n * Mount is mildly superlinear and it belongs to the DOM work, not to this — a sentence that has\n * now been checked the hard way. Re-measured under jsdom after the fragment/rank work, mount\n * looked QUADRATIC (400/100 ratio ~14) and three times its old absolute, which reads as an\n * algorithmic regression in this file. Chromium, same probe, same build: 0.8/1.8/3.2/7.6 ms at\n * 50/100/200/400 slots — ratio 4.2, mildly superlinear, fifty times faster than jsdom at the top\n * end. The scare was jsdom-as-oracle, the exact mistake this project's rules exist to prevent,\n * aimed for once at this very comment. Benchmark this module on an engine or not at all.\n */\n _bindings: Binding[];\n /** Captured nodes that are not currently displayed wait here — out of the document, exactly\n * like an unassigned light child under native shadow DOM (present, not rendered). */\n _holding: DocumentFragment;\n /**\n * Every `_fallback` park fragment on this host, so `fill` can tell one of OUR resting places\n * from a tree the user has taken a node into.\n *\n * A set rather than a check against the binding being filled, because the two need not be the\n * same binding: a node placed by a slot nested in another slot's fallback rests in the OUTER\n * binding's fragment, and at three levels of nesting it rests in one belonging to neither. The\n * per-binding comparison happens to be right at depth two and silently wrong below it, which is\n * the kind of correct-looking check this file has been bitten by before.\n */\n _parks: WeakSet<Node>;\n /** node → its current slot name, for every node ever captured: the identity test that lets\n * the observer spot USER removals and re-slottings amid the template's own mutations. */\n _names: WeakMap<Node, string>;\n /** Each kept `<slot>` element back to its binding, so a `name` change is recognised. */\n _ghosts: WeakMap<Element, Binding>;\n /**\n * **Light-tree order, remembered — because distributing a node destroys it.**\n *\n * Native `assignedNodes()` answers in flat-tree order, which for a light child is simply its\n * position among the host's children. A shadow host keeps every child where it was, so that\n * position is always readable. Here the children are MOVED — into a slot's region, or out to\n * the holding fragment when nothing claims them — and once two captured nodes live in different\n * places, nothing in the DOM says which came first.\n *\n * That is invisible while a node stays in one bucket, because the bucket was built in order. It\n * surfaces when a node CHANGES slot: it joins a bucket that may already hold nodes which come\n * after it in the light tree, and the only honest answer is a position the DOM no longer knows.\n * Appending was the old answer and it read as arrival order — an item toggled into a \"pinned\"\n * slot jumped to the end of the pinned list instead of holding its place.\n *\n * A rank per node is the whole mechanism: assigned once, when the node is first captured, and\n * never touched again — because re-slotting does not move a node in the LIGHT tree, which is the\n * tree this orders. Ranks are compared, never trusted as indices, so gaps from removals are\n * harmless.\n */\n _rank: WeakMap<Node, number>;\n _next: number;\n /** Ranks below every existing one, for a node inserted into the light region ahead of content\n * already distributed away — see `take`. Counts down; the two never meet in any real host. */\n _min: number;\n /** The host window's `Event` — see `signal` for why it cannot be taken from the slot. */\n _event: typeof Event;\n _observer: MutationObserver;\n /**\n * **The boundary between the host's LIGHT REGION and the component's own render.** One comment,\n * appended at capture time — after the children are lifted, before the component's first render\n * appends its output — so everything that ever sits before it at the host's top level is host\n * content, and everything after is the component's. Two things stand on it:\n *\n * 1. The observer captures a top-level addition BEFORE the sentinel with full native semantics —\n * no `slot` attribute required, text included. The attribute rule was written for USER\n * mutations, whose ambiguity is real only at the host's tail; it was also catching the\n * RENDERER's own re-renders of `<host>${…}</host>`, whose new nodes always land in the light\n * region, and stranding them invisibly (measured: every `→ null → back` transition, every\n * template swap, every list refill in a light host showed FALLBACK or stale content forever,\n * while shadow passed all of them). That divergence is since gone entirely — ownership\n * stamps replaced the region heuristic, and post-render additions are native.\n * 2. `_$home$` hands it to the renderer, so a text part that upgrades AFTER its text node was\n * captured plants its markers here — in the host — instead of chasing the node into the\n * slot, where the next fill swept markers and all into the holding fragment and the part\n * spent the rest of the page rendering into detached space.\n */\n _sentinel: Comment;\n};\n\nconst HOSTS = new WeakMap<Element, HostState>();\n/** The host mark's shared descriptor — non-enumerable, for the same invisibility the stamps get. */\nconst HOSTED: PropertyDescriptor = { value: true, enumerable: false, configurable: true };\n/** Every captured node → its host's sentinel, for `_$home$`. Entries die with their nodes. */\nconst HOMES = new WeakMap<Node, Comment>();\n/**\n * **The light tree's surviving skeleton, indexed.** Distribution moves the CONTENT out of the\n * host, but the part markers never move — so a comment's neighbours at capture time are exactly\n * the positional record a late hand-edit needs. Each comment in the initial walk maps to the\n * member captured immediately after it; placement walks forward from an inserted node to the\n * first recorded comment whose member is still in the right bucket, and goes before that member.\n * A WeakMap and a walk over LIVE nodes only, so a torn-down part's markers take their entries\n * with them and staleness needs no bookkeeping. (Verified before building: a part keeps the SAME\n * marker nodes across template-identity rebuilds, emptying included, so landmarks cannot churn.)\n */\nconst LANDMARKS = new WeakMap<Node, Node>();\n\n/**\n * What the observer watches, wherever it watches. Hoisted because captured nodes rest in more than\n * one place and every one of them needs the SAME watch — see the `observe` calls in `capture` and\n * the park fragment in `takeOverSlot`.\n */\nconst WATCHING = { childList: true, subtree: true, attributes: true, attributeFilter: ['slot'] };\n\n/**\n * Slottables are elements and text nodes — comments and the rest are never assigned (`null`).\n *\n * **A deliberate twin of `slotNameOf` in `@verajs/ssr`'s `vera/nodes.js`**, which must spell the\n * same rule: independent packages, ssr does not import this one at runtime, so the rule is copied\n * rather than shared. A deliberate duplication is a fix's second address — change one and the\n * other needs the same change. `tests/ssr-slot-assignment-parity.test.mjs` fails if they diverge.\n *\n * `null` here means \"not slottable\", and callers must decide what that implies for THEM: the read\n * path filters those nodes out of `assignedNodes()`, while `serverDistribute` skips them, which\n * leaves them where they are on the client and drops them on a server that has already re-rendered\n * the host. Two different consequences from one answer — see `serverDistribute`.\n */\nconst slotNameOf = (node: Node): string | null =>\n node.nodeType === 3 ? '' : node.nodeType === 1 ? ((node as Element).getAttribute('slot') ?? '') : null;\n\nconst bucketOf = (state: HostState, name: string): Node[] => {\n let bucket = state._map.get(name);\n if (bucket === undefined) state._map.set(name, (bucket = []));\n return bucket;\n};\n\n/** Take one node into the slot system: bucket it, remember it, and physically hold it. */\n/** `ordered`: the caller vouches the node arrives in its final relative order (the initial\n * capture walk and the server-park recovery — both iterate host order), so placement is a plain\n * append: O(1), and immune to the fact that earlier-taken siblings are already in holding and\n * can no longer be position-compared. */\nconst take = (state: HostState, node: Node, ordered = false, atTail = false): string | null => {\n const name = slotNameOf(node);\n if (name === null) return null;\n const bucket = bucketOf(state, name);\n const binding = activeFor(state, name);\n /**\n * **A node captured where it already belongs stays there.** Whoever put it inside the run put it\n * in a POSITION, and evacuating it to the holding fragment throws that away — it comes back at\n * the end, because the fragment has no idea where it was. A keyed list inserting a row into a\n * light host's children is the case: the row is created under the host, moved among its\n * neighbours, and captured in the same batch, and the position is the only thing that says where\n * it goes.\n *\n * Everything else — a node the user appended, one arriving from the holding fragment — is held\n * as before, and `fill` places it.\n */\n const settled = binding !== undefined && node.parentNode === binding._start.parentNode;\n /**\n * **Where a captured node goes in the bucket — one branch per way of knowing.**\n *\n * SETTLED (already inside its slot's run): document order — whoever moved it there meant that\n * position; a keyed mid-insert lands here. PLACED (stamped with the part that put it in the\n * host): after that part's last member, so a grown row extends its own list and two parts'\n * content in one host cannot interleave; no member yet means append, where a first row belongs.\n * UNSTAMPED (a human's): its position speaks — before the boundary it precedes everything\n * distributed away (document order among nodes still beside it); at or past the boundary it\n * was appended, and appends. The last-member fast path keeps the initial capture walk O(1) per\n * node — each child follows the one before it — instead of O(n²) over a big light list.\n */\n const own = (node as { _$own$?: unknown })._$own$;\n let at = bucket.length;\n /**\n * Set when this node sits in the light region ahead of everything already distributed — the rule\n * the unstamped branch below states in words. It is tracked separately from `at` because `at` is\n * a position in ONE bucket, and a node can land at the end of its own bucket while still\n * preceding every node in every other one. That is exactly the case a prepend into an empty\n * bucket makes: `at` is 0 and means nothing, and ranking from bucket neighbours put the node\n * last when it belonged first.\n */\n let front = false;\n if (ordered) {\n /* the caller's order is the order — fall through to the splice */\n } else if (settled) {\n for (let i = 0; i < bucket.length; i++)\n // eslint-disable-next-line no-bitwise -- DOCUMENT_POSITION_FOLLOWING, the platform's own flag\n if ((node.compareDocumentPosition(bucket[i]) & 4) !== 0) {\n at = i;\n break;\n }\n } else if (own !== undefined) {\n for (let i = bucket.length - 1; i >= 0; i--)\n if ((bucket[i] as { _$own$?: unknown })._$own$ === own) {\n at = i + 1;\n break;\n }\n } else {\n const home = node.parentNode;\n const last = bucket[bucket.length - 1];\n const sentinel = state._sentinel;\n /**\n * **The record is the light-tree truth; the sentinel is only a proxy for it.**\n *\n * `front` is \"this node precedes everything already distributed\" — inferred here from the\n * node preceding the `_sentinel` in the LIVE DOM. That inference holds when the host is\n * settled, and BREAKS mid-storm on an adopted seam: `flushPending` can process a genuine\n * tail-append while the sentinel is transiently positioned AFTER it, so the append reads as\n * front and takes a negative rank, sorting before the adopted nodes (run-18 residual, root\n * cause). The observer path knows better: a childList record whose `nextSibling` is null was\n * an APPEND at the light-tree tail, immune to any later churn — so `atTail` overrides the\n * proxy outright. A non-null `nextSibling` (prepend, insertBefore) is left to the existing\n * inference, which the settled and client-storm paths already exercise.\n */\n front =\n !atTail &&\n sentinel.parentNode === home &&\n // eslint-disable-next-line no-bitwise -- the node precedes the boundary: the light region\n (node.compareDocumentPosition(sentinel) & 4) !== 0;\n if (\n !atTail &&\n sentinel.parentNode === home &&\n // eslint-disable-next-line no-bitwise -- the node precedes the boundary: the light region\n (node.compareDocumentPosition(sentinel) & 4) !== 0 &&\n last !== undefined &&\n // eslint-disable-next-line no-bitwise -- fast append: skip the scan when the last member already precedes it\n !(last.parentNode === home && (last.compareDocumentPosition(node) & 4) !== 0)\n ) {\n /**\n * LANDMARKS first — exact where available: the nearest recorded comment after the node\n * names the member it belongs before, which places a hand-edit BETWEEN two parts' groups\n * where the scan below can only say \"ahead of everything distributed\". Skips members that\n * left this bucket (pulled, or another slot's) by walking on; bounded by the sentinel.\n */\n let placed = false;\n for (let next = node.nextSibling; next !== null && next !== sentinel; next = next.nextSibling) {\n const member = next.nodeType === 8 ? LANDMARKS.get(next) : undefined;\n if (member !== undefined) {\n const found = bucket.indexOf(member);\n if (found !== -1) {\n at = found;\n front = false;\n placed = true;\n break;\n }\n }\n }\n /**\n * **Backward too, because the skeleton has landmarks on both sides.** Looking only forward\n * meant that when every following landmark named a member that had since been removed or\n * re-slotted elsewhere, placement fell through to the scan below — which knows nothing\n * finer than \"ahead of everything distributed\" and so put the edit FIRST. Measured against a\n * shadow root given the same disturbance: it answers `A,U` and this answered `U,A`.\n *\n * A preceding landmark names the member captured just after it, so a node inserted after\n * that comment belongs after that member — the mirror of the forward rule, and it resolves\n * exactly when the forward walk cannot.\n */\n if (!placed)\n for (let prev = node.previousSibling; prev !== null; prev = prev.previousSibling) {\n const member = prev.nodeType === 8 ? LANDMARKS.get(prev) : undefined;\n if (member !== undefined) {\n const found = bucket.indexOf(member);\n if (found !== -1) {\n at = found + 1;\n front = false;\n placed = true;\n break;\n }\n }\n }\n if (!placed)\n for (let i = 0; i < bucket.length; i++) {\n const member = bucket[i];\n // eslint-disable-next-line no-bitwise -- first distributed member, or an in-place member that follows\n if (member.parentNode !== home || (node.compareDocumentPosition(member) & 4) !== 0) {\n at = i;\n break;\n }\n }\n }\n }\n /**\n * **A first sighting takes its light-tree rank from the position just computed.**\n *\n * `at` is this module's best answer to \"where does this node belong\", worked out from whatever\n * evidence exists — document position, the part that placed it, landmarks, the sentinel. That\n * answer is about ONE bucket, and re-slotting needs the same fact about the light tree, so the\n * rank is interpolated between the neighbours it landed among rather than invented separately.\n * Deriving it here is what makes the two agree by construction; a counter bumped on arrival\n * instead gave a node inserted at the FRONT of the light tree a tail rank, and re-slotting it\n * then sent it to the end — right where it was, wrong where it went.\n *\n * Midpoints, so an insertion never has to renumber. Doubles run out after about fifty\n * insertions between one adjacent pair, which no light host reaches; a re-capture (removed and\n * re-added) starts fresh at the tail, which is also where the platform puts it.\n */\n if (!state._rank.has(node)) {\n const before = at > 0 ? state._rank.get(bucket[at - 1]) : undefined;\n const after = at < bucket.length ? state._rank.get(bucket[at]) : undefined;\n state._rank.set(\n node,\n front\n ? --state._min\n : after === undefined\n ? state._next++\n : before === undefined\n ? after - 1\n : (before + after) / 2\n );\n }\n bucket.splice(at, 0, node);\n state._names.set(node, name);\n HOMES.set(node, state._sentinel);\n if (!settled) state._holding.appendChild(node);\n return name;\n};\n\nconst pull = (state: HostState, node: Node, name: string) => {\n const bucket = state._map.get(name);\n if (bucket === undefined) return;\n const at = bucket.indexOf(node);\n if (at !== -1) bucket.splice(at, 1);\n};\n\n/**\n * Discard the records the module's own DOM moves just produced. Wholesale discard is CORRECT here\n * for exactly one reason, and `flushPending` is that reason: every mutating operation flushes the\n * user's queued records BEFORE it moves anything, so by the time this runs the queue holds only\n * our own. (The first fix for the run-17 storms re-fed the taken records through the handler\n * instead — and our holding-fragment churn then flowed through arms never designed for it,\n * breaking real re-fallback. Process-then-move is the design that holds: user records are\n * processed while the queue is provably pure-user, ours are discarded while it is provably\n * pure-ours.)\n */\nconst drain = (state: HostState) => {\n state._observer.takeRecords();\n};\n\n/**\n * Process the USER's queued records before the module mutates anything — the run-17 fix.\n *\n * Observer delivery is asynchronous, so a user mutation made earlier in the same task (an append,\n * a `slot` rename, a removal) is still queued when a mount, fill or park starts moving nodes.\n * The old code drained that queue wholesale afterwards, under a comment claiming nothing of the\n * user's could be in it — wrong direction of time: seven deterministic storm divergences, one\n * root cause. At operation ENTRY the queue holds only user records (every previous operation\n * ended by draining its own), so processing here is exactly the observer callback running early.\n * Re-entrant-safe: processing refills, refills fill, and the inner fill's flush must not recurse.\n */\nconst flushPending = (state: HostState) => {\n if (state._flushing) return;\n const records = state._observer.takeRecords();\n if (records.length === 0) return;\n state._flushing = true;\n try {\n processRecords(state._host, state, records);\n } finally {\n state._flushing = false;\n }\n};\n\n/** The binding that OWNS a name — the first in tree order, as the platform picks the first\n * matching slot and leaves any duplicate showing its fallback. */\nconst activeFor = (state: HostState, name: string): Binding | undefined => {\n const bindings = state._bindings;\n for (let i = 0; i < bindings.length; i++) if (bindings[i]._name === name) return bindings[i];\n return undefined;\n};\n\nconst NOTHING: Node[] = [];\n\n/**\n * **`slotchange`, on the element the author bound it to.** Queued rather than dispatched inline:\n * the platform fires it at the microtask checkpoint, and firing synchronously from inside a render\n * would re-enter rendering from a handler. The queue also means the very first dispatch lands\n * after the slot's own `AttrPart`s have attached their listeners, whatever order mounting took.\n *\n * `Event` comes from the HOST's realm, not the module's — a component rendered into a popped-out\n * window must dispatch an event that window's code recognises, or a handler's `instanceof` is\n * false and, measured, a strict DOM refuses the foreign object outright.\n *\n * **From the host, and deliberately not from the slot**, which is the trap: a `<template>`'s\n * content belongs to an inert document that has no browsing context, so the slot element's\n * `ownerDocument.defaultView` is `null` — every clone of it, in every realm. The host is a live\n * element in the real document and is the only one of the two that knows which window this is.\n *\n * (`queueMicrotask` is not realm-bound; the job queue is shared.)\n */\nconst signal = (state: HostState, binding: Binding) => {\n const slot = binding._slot;\n if (slot === undefined || binding._queued) return;\n binding._queued = true;\n queueMicrotask(() => {\n binding._queued = false;\n slot.dispatchEvent(new state._event('slotchange', { bubbles: true, composed: false }));\n });\n};\n\nconst same = (a: Node[], b: Node[]): boolean => {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n return true;\n};\n\n/**\n * Make one binding show what it should: the assignment (when it is the active binding for its\n * name and the bucket has nodes) or its fallback. Current occupants are evacuated first —\n * assigned nodes to holding (they remain captured), an unassigned region into `_fallback`, which\n * is a fragment rather than a list precisely because that region goes on living while it is away.\n * A bucket entry the USER spirited away while it was held (removed from holding, or adopted into\n * their own DOM) is purged rather than stolen back.\n *\n * **What the fragment fixes, stated because it cost real content.** Detaching the region node by\n * node left every anchor inside it parentless, so a binding nested in this fallback hit the guard\n * at the top of this function and returned without placing anything. A child the user added for\n * that inner slot while the outer one was assigned therefore went into its bucket and nowhere\n * else — and when the outer slot later fell back, the old list restored the inner slot's ORIGINAL\n * fallback over the top. The user's node was detached, invisible, and unrecoverable, while the\n * inner slot's own `assignedNodes()` still named it. In a shadow root the same sequence simply\n * shows the node, because there the inner slot never leaves the tree.\n *\n * Parked in a fragment, the anchors keep a parent, the inner binding places into the fragment as\n * it always would, and restoring carries the result back. One call, no list, no re-fill pass.\n */\nconst fill = (state: HostState, binding: Binding) => {\n /** The user's queued mutations first — see `flushPending`. Re-entrant fills skip via the flag. */\n flushPending(state);\n const parent = binding._start.parentNode;\n if (parent === null) return; // anchors already discarded mid-teardown — nothing to show\n /**\n * **The run's current order is remembered before it is taken apart, because it is the intent.**\n *\n * The bucket records what is assigned; its order is the order things were CAPTURED. Re-placing\n * from it therefore undoes any reordering that happened after distribution — and a keyed list\n * rendering a host's children reorders exactly those nodes, in place, where they now live. The\n * symptom was a list that reordered correctly and then snapped back to its original order the\n * next time anything caused a refill.\n *\n * Only the case that is currently wrong changes: when nothing has reordered the run, this order\n * IS the bucket's order and the sort below is the identity.\n */\n const wasShowing = new Map<Node, number>();\n let node = binding._start.nextSibling;\n while (node !== null && node !== binding._end) {\n const next = node.nextSibling;\n wasShowing.set(node, wasShowing.size);\n if (binding._assigned) state._holding.appendChild(node);\n else binding._fallback.appendChild(node);\n node = next;\n }\n const bucket = activeFor(state, binding._name) === binding ? bucketOf(state, binding._name) : NOTHING;\n /**\n * **A stable MERGE, not a re-sort.** Run members keep the run's order (a keyed reorder happens\n * in place, invisible to the observer — the run is its only record). Everything else keeps its\n * BUCKET position, ranked beside the run member it follows: a prepend `take` placed at index 0\n * stays ahead of the run instead of being shoved to the end — which is exactly how the first\n * ordering attempt broke two suites. Equal ranks fall back to bucket order (sort stability is\n * guaranteed), and `NOTHING` is shared and never written to.\n */\n if (wasShowing.size > 0 && bucket !== NOTHING) {\n const rank = new Map<Node, number>();\n let carried = -1;\n for (const member of bucket) {\n const shown = wasShowing.get(member);\n if (shown !== undefined) carried = shown;\n rank.set(member, shown ?? carried + 0.5);\n }\n bucket.sort((a, b) => rank.get(a)! - rank.get(b)!);\n }\n const shown: Node[] = [];\n for (let i = 0; i < bucket.length; i++) {\n const candidate = bucket[i];\n const home = candidate.parentNode;\n if (\n home !== state._holding &&\n home !== null &&\n home !== parent &&\n !state._parks.has(home) &&\n !inAnyRun(state, candidate)\n ) {\n /**\n * The user took this node for themselves while it was unassigned — respect that.\n *\n * `_parks` is the exception and it is not decoration: a node distributed by a slot nested in\n * a displaced fallback rests in that fallback's park fragment, which is a home of OURS. Read\n * as a user adoption it was purged from the bucket instead of being placed, so re-slotting\n * such a node to an outer slot dropped it — visible content, gone, in a sequence a shadow\n * root handles without comment.\n *\n * `!inAnyRun` is the run-27 completion of that same idea: a node RESLOTTED from one slot to\n * another has its bucket moved by the attribute arm but is still PHYSICALLY in its old\n * slot's run when this fill for the NEW slot runs — its parent is that other run's region,\n * which is a location WE control, not a user adoption. Without this the reslot's own fill\n * purged the node it was about to place, and the node vanished (run-27 adopted-seam storm\n * node-loss: concurrent DOM churn shifted delivery so the new-slot fill ran before the node\n * was physically relocated). Another run is the last of our regions the guard did not name.\n */\n bucket.splice(i--, 1);\n state._names.delete(candidate);\n continue;\n }\n parent.insertBefore(candidate, binding._end);\n shown.push(candidate);\n }\n binding._assigned = shown.length > 0;\n if (shown.length === 0) parent.insertBefore(binding._fallback, binding._end);\n if (!same(binding._shown, shown)) {\n binding._shown = shown;\n signal(state, binding);\n }\n};\n\nconst refill = (state: HostState, name: string) => {\n const binding = activeFor(state, name);\n if (binding !== undefined) fill(state, binding);\n};\n\n/**\n * Register one binding for `name` and hand back its park closure — the single source for both the\n * client seam and hydration's adopt, which previously spelled the same registration and the same\n * park body twice (the house's most-repeated defect class). Park rescues assigned user nodes into\n * holding before the instance's DOM is bulk-discarded, unregisters, and promotes the next\n * duplicate slot to the assignment — native's next-in-tree-order.\n */\nconst bind = (state: HostState, binding: Binding): SeamState => {\n state._bindings.push(binding);\n const slot = binding._slot;\n if (slot !== undefined) {\n state._ghosts.set(slot, binding);\n expose(state, binding);\n /** A `name` that is a binding can change between renders, and the element it changes on is\n * not in the host's subtree — so it is watched directly. */\n state._observer.observe(slot, { attributes: true, attributeFilter: ['name'] });\n if (__DEV__) warnInert(slot);\n }\n return {\n _$park$: () => {\n /** A rename or removal queued in this same task decides WHAT gets parked — process it first. */\n flushPending(state);\n if (binding._assigned) {\n let node = binding._start.nextSibling;\n while (node !== null && node !== binding._end) {\n const next = node.nextSibling;\n state._holding.appendChild(node);\n node = next;\n }\n }\n const wasActive = activeFor(state, binding._name) === binding;\n const at = state._bindings.indexOf(binding);\n if (at !== -1) state._bindings.splice(at, 1);\n /** Whoever is now first for that name inherits the assignment — native's next in tree order. */\n if (wasActive) refill(state, binding._name);\n drain(state);\n },\n };\n};\n\n/**\n * Answer `assignedNodes()`/`assignedElements()` from the live assignment, so a handler written for\n * a shadow slot — `event.target.assignedElements()`, or the same through `&ref` — reads the same\n * thing here. A detached element's own implementations return nothing, which is what made the\n * ordinary way of reading a slot come back empty in light mode.\n *\n * `flatten` means what it means on the platform for a slot with nothing assigned: the fallback\n * **that is actually on screen right now**. Both halves of that sentence were wrong.\n *\n * It answered from `_fallback`, which is the restore list — a snapshot of the slot's template\n * children, taken once. That is the right list to re-insert from and the wrong list to report,\n * because the region it stands for is live: a NESTED slot inside fallback content redistributes\n * as its own assignment changes, and a binding inside fallback content re-renders. Reported from\n * the snapshot, a nested slot's flatten kept naming a node the user had already removed from the\n * document, forever.\n *\n * So read from wherever the fallback IS. Rendered, that is the region between the anchors, and\n * reading it there is live by construction rather than by maintenance — nothing has to remember to\n * update it — which also makes the recursion the platform specifies fall out for free, since an\n * inner slot's distributed content is physically in that region. Displaced, there is no region to\n * walk: `fill` detaches the old fallback node by node, anchors included, so `_start` has no parent\n * and the restore list is the only record of it. That is the one honest discriminator here and it\n * needs no new state — a slot nested in another slot's fallback is exactly the case that reaches\n * it, and the platform still answers for such a slot because in a shadow tree it never left.\n *\n * The filter is the second half: the platform's word is *slottables*, so `slotNameOf` — the same\n * predicate that decides assignment everywhere else in this file — is what says which nodes count.\n * Without it the walk hands back a user's own `<!-- -->` written into fallback content, and this\n * module's own markers around a nested slot's content: an implementation detail escaping through\n * a documented API. One predicate closes both.\n */\nconst expose = (state: HostState, binding: Binding) => {\n const slot = binding._slot as HTMLSlotElement;\n const read = (flatten?: boolean): Node[] => {\n const bucket = activeFor(state, binding._name) === binding ? (state._map.get(binding._name) ?? NOTHING) : NOTHING;\n if (bucket.length > 0) return [...bucket];\n if (flatten !== true) return [];\n const shown: Node[] = [];\n for (let n = binding._start.nextSibling; n !== null && n !== binding._end; n = n.nextSibling) shown.push(n);\n return shown.filter((node) => slotNameOf(node) !== null);\n };\n slot.assignedNodes = (options?: { flatten?: boolean }) => read(options?.flatten) as Node[];\n slot.assignedElements = (options?: { flatten?: boolean }) =>\n read(options?.flatten).filter((node) => node.nodeType === 1) as Element[];\n};\n\n/**\n * **What a `<slot>` cannot carry in a light component, said out loud.** A light host has no second\n * tree, so the slot element is not rendered and never can be: `class`, `style`, `id` and the rest\n * have nowhere to apply, whether they were written statically or bound. In a shadow root they do\n * apply — a `<slot>` is a real element there — so this is the one asymmetry left, and silence\n * about it is what made it expensive to find.\n *\n * `name` is excluded because it is the slot's meaning, and events and `&ref` never appear as\n * attributes at all, so they do not trip this.\n */\nconst warnInert = (slot: Element) => {\n const inert: string[] = [];\n for (const attribute of slot.attributes) if (attribute.name !== 'name') inert.push(attribute.name);\n if (inert.length === 0) return;\n const label = slot.getAttribute('name');\n const key = `${label ?? ''}|${inert.join(',')}`;\n if (warnedInert.has(key)) return;\n warnedInert.add(key);\n console.warn(\n `[vera] <slot${label === null ? '' : ` name=\"${label}\"`}> carries ${inert.map((n) => `\\`${n}\\``).join(', ')}, ` +\n `which does nothing in a light-DOM component: the slot element is not rendered, so there is ` +\n `nothing for it to apply to. In a shadow root it would apply. Put it on a real element around ` +\n `the slot instead. (\\`name\\`, \\`@event\\` bindings and \\`&ref\\` all work here.)`\n );\n};\nconst warnedInert = new Set<string>();\n\n/**\n * The user's mutations, batched. Additions join only with an explicit `slot` attribute (the\n * documented rule above); removals and re-slottings of CAPTURED nodes are recognized anywhere by\n * identity. Template-caused records match nothing here: its nodes were never captured, and our\n * own moves were drained before they could arrive.\n */\n/**\n * Is this node currently sitting inside one of OUR runs — between some binding's anchors, in the\n * host or in a not-yet-inserted instance fragment alike? The user-took removal arm needs it: a\n * mount's `fill` moves a captured node into the instance's DETACHED fragment before the fragment\n * enters the host, so at drain time the node is in neither the host nor the holding — exactly the\n * signature the arm reads as \"the user took it\". Position between anchors is the fact that holds\n * in both worlds, and it is the same test the nested-addition arm already trusts.\n */\nconst inAnyRun = (state: HostState, node: Node): boolean => {\n for (const binding of state._bindings) {\n const parent = binding._start.parentNode;\n if (parent === null || parent !== node.parentNode) continue;\n // eslint-disable-next-line no-bitwise -- DOCUMENT_POSITION_FOLLOWING, as in the nested-add arm\n if ((binding._start.compareDocumentPosition(node) & 4) !== 0 && (node.compareDocumentPosition(binding._end) & 4) !== 0)\n return true;\n }\n return false;\n};\n\nconst processRecords = (host: Element, state: HostState, records: MutationRecord[]) => {\n const touched = new Set<string>();\n const moved: Binding[] = [];\n for (const record of records) {\n if (record.type === 'attributes') {\n const node = record.target;\n /**\n * A kept `<slot>` element renaming itself — `<slot name=${section}>` with a new value. Both\n * names are refilled: the one it left (whose next duplicate, if any, inherits) and the one it\n * joined. The binding itself is filled either way, since it may now be a duplicate and owe\n * its fallback.\n */\n const ghost = state._ghosts.get(node as Element);\n if (ghost !== undefined) {\n const next = (node as Element).getAttribute('name') ?? '';\n if (next !== ghost._name) {\n touched.add(ghost._name);\n ghost._name = next;\n touched.add(next);\n moved.push(ghost);\n }\n continue;\n }\n const previous = state._names.get(node);\n if (previous !== undefined) {\n const next = slotNameOf(node)!;\n if (next !== previous) {\n pull(state, node, previous);\n /**\n * By LIGHT ORDER, not arrival. The node has not moved in the light tree — only its\n * `slot` attribute changed — so its rank still says where it belongs among whatever the\n * new bucket already holds. Appending here was the whole of the ordering divergence.\n * `fill`'s stable merge preserves this: a member ahead of the current run ranks before\n * it, which is the same rule that keeps a prepend ahead.\n */\n const joining = bucketOf(state, next);\n const rank = state._rank.get(node)!;\n let at = joining.length;\n for (let i = 0; i < joining.length; i++) {\n const other = state._rank.get(joining[i]);\n if (other !== undefined && other > rank) {\n at = i;\n break;\n }\n }\n joining.splice(at, 0, node);\n state._names.set(node, next);\n touched.add(previous);\n touched.add(next);\n }\n }\n continue;\n }\n for (const node of record.addedNodes) {\n /**\n * **Ownership answers capture outright — the heuristic stack this replaces is gone.**\n *\n * Every node the renderer puts at a captured host's top level is stamped: `true` when it\n * is the render's own output, the placing part when it is content from an outer template.\n * So \"may I capture this?\" is one property read:\n *\n * `true` — the component's own output. Never content. (Without this, a component whose\n * rendered root carries a `slot` attribute had its output eaten.)\n * a part — placed content: captured, ordered by its part (see `take`).\n * absent — a human put it here: captured with full native semantics, TEXT INCLUDED,\n * which retires the `slot=`-after-first-render rule and the tail-text hole in\n * one move. Safe for exactly one reason: the renderer stamps 100% of its own\n * top-level output — measured across every template shape, and structurally\n * guaranteed by the `_end === null` root test, async commits included — so\n * unstamped genuinely means \"not the renderer's\".\n *\n * Deleted here: the insertion-site reconstruction (`record.nextSibling`, the region helper)\n * — it existed because created-then-moved keyed rows were positionally indistinguishable\n * from user content, and they are stamped now — and the tail attribute arm, the fail-closed\n * stand-in for ownership nobody could know. `record.target === host` still bounds this to\n * TOP-LEVEL additions (current parent alone misses same-batch moves); a component's\n * internal renders mutate deeper parents and are never considered.\n */\n if (\n (record.target === host || node.parentNode === host) &&\n (node as { _$own$?: unknown })._$own$ !== true &&\n !state._names.has(node)\n ) {\n /** `nextSibling === null` in the record means an APPEND at the host's end — the\n * light-tree tail, snapshotted at mutation time. `take` uses it to override the\n * sentinel proxy that misfires mid-storm. See the front-detection note there. */\n const name = take(state, node, false, record.nextSibling === null);\n if (name !== null) touched.add(name);\n } else if (!state._names.has(node) && (node as { _$own$?: unknown })._$own$ !== true) {\n /**\n * **A slottable that appeared INSIDE a run, never passing the host's top level.**\n *\n * `splitText` on distributed text is the real case — a highlighting library's core\n * gesture — and the tail is created as a sibling in the COMPONENT's tree, where the rule\n * above does not look. Left uncaptured it was missing from the bucket, so the next refill\n * evacuated it to holding and never brought it back: the text silently lost half of\n * itself, while a shadow root reports both halves assigned and shows them.\n *\n * Captured here, from the record, rather than by having `fill` sweep its run for\n * surprises — the observer holds the exact node, and re-deriving it downstream would be\n * the same inference-instead-of-ownership this module spent its history removing, at the\n * cost of an O(run) scan on every fill of every host forever.\n *\n * Three conditions make it safe, and each is a fact rather than a proxy: the run must be\n * ASSIGNED (a run showing FALLBACK holds the component's own nodes, and adopting those\n * would make a component's fallback into the user's content); the node must lie BETWEEN\n * the anchors, not merely share their parent, or anything dropped elsewhere in that\n * element would be pulled into the slot; and the node's own slot name must MATCH the\n * binding it landed in, so a stray element in a named slot's run is left alone rather\n * than filed under a name it never claimed.\n *\n * Measured before keeping the scan over bindings: with 500 rows rendered inside a host,\n * every one of them an unstamped nested addition that reaches this loop, four bindings\n * cost the same as one (44.5–51.5 ms against 45.1–53.9). DOM work dominates completely.\n */\n for (const binding of state._bindings)\n if (\n binding._assigned &&\n binding._start.parentNode === record.target &&\n // eslint-disable-next-line no-bitwise -- DOCUMENT_POSITION_FOLLOWING, the platform's flag\n (binding._start.compareDocumentPosition(node) & 4) !== 0 &&\n // eslint-disable-next-line no-bitwise -- and the end anchor follows the node in turn\n (node.compareDocumentPosition(binding._end) & 4) !== 0 &&\n slotNameOf(node) === binding._name\n ) {\n take(state, node);\n touched.add(binding._name);\n break;\n }\n }\n }\n for (const node of record.removedNodes) {\n const name = state._names.get(node);\n /**\n * Our evacuations were drained, so an undrained removal of a captured node is the user's.\n * The question is only whether it is still OURS to hold, and there are three answers:\n * detached entirely (`parentNode === null`) is gone; the holding fragment or anywhere in\n * the host's own subtree is a MOVE the add/attribute handling covers — a keyed row created\n * under the host and positioned inside the component in one batch is exactly that; and\n * anywhere else is the user taking the node for themselves.\n *\n * That third case used to read as a move and kept the node captured forever: it was no\n * longer in the run, so the slot showed nothing — not the node, and not its fallback — where\n * a shadow root un-assigns and falls back. `fill` already had the corresponding guard\n * (\"the user took this node\") but nothing brought it a reason to run.\n */\n if (\n name !== undefined &&\n node.parentNode !== state._holding &&\n !host.contains(node) &&\n !inAnyRun(state, node)\n ) {\n pull(state, node, name);\n state._names.delete(node);\n touched.add(name);\n }\n }\n }\n for (const name of touched) refill(state, name);\n for (const binding of moved) fill(state, binding);\n};\n\nconst onMutations = (host: Element, records: MutationRecord[]) => {\n const state = HOSTS.get(host)!;\n processRecords(host, state, records);\n drain(state);\n};\n\n/** Capture the host's children — once, at the first slot the seam hands us for it. */\nconst capture = (host: Element, skipChildren = false, boundary?: Comment): HostState => {\n let state = HOSTS.get(host);\n if (state !== undefined) return state;\n const doc = host.ownerDocument!;\n const created: HostState = (state = {\n _host: host,\n _flushing: false,\n _map: new Map(),\n _bindings: [],\n _holding: doc.createDocumentFragment(),\n _parks: new WeakSet(),\n _rank: new WeakMap(),\n _next: 0,\n _min: 0,\n _names: new WeakMap(),\n _ghosts: new WeakMap(),\n _event: ((doc.defaultView as { Event?: typeof Event } | null)?.Event ?? Event) as typeof Event,\n _observer: new MutationObserver((records) => onMutations(host, records)),\n /**\n * **The renderer's own root marker, when it has one** — it already delimits where the render's\n * output begins, which is exactly this boundary, so a sentinel of our own was a second comment\n * saying the same thing one position to the left. Only the paths that reach `capture` WITHOUT\n * one (hydration adopts per slot, and its render's marker is not in hand there) still mint it.\n */\n _sentinel: boundary ?? doc.createComment(''),\n });\n HOSTS.set(host, created);\n /**\n * The host is MARKED as captured, on itself — this is what the renderer's stamp gate reads in\n * `_insert`/`$c`: one own-property read instead of a seam call, and it cannot go stale in the\n * dangerous direction (a part committing into a not-yet-captured host reads undefined, stamps\n * nothing, and that content is exactly what the initial walk below lifts). Symmetric with the\n * node stamps: ownership facts live on the objects they describe.\n */\n Object.defineProperty(host, '_$hosted$', HOSTED);\n /** Ours to place only if ours to make; the renderer's is already in the document. */\n if (boundary === undefined) host.appendChild(created._sentinel);\n /**\n * A server render parks content no slot claimed in an inert `<template>` — recover it into\n * holding (captured, unrendered, ready if its slot ever mounts) and drop the carrier, so the\n * round trip matches CSR exactly. Done before the children walk so the carrier is never itself\n * mistaken for slot content.\n */\n for (const child of [...host.children])\n if (child.localName === 'template' && child.hasAttribute(UNASSIGNED_MARK)) {\n const held = (child as HTMLTemplateElement).content;\n for (const node of [...held.childNodes]) take(created, node, true);\n host.removeChild(child);\n }\n /** Hydration already has the children distributed and registers them itself; a fresh CSR\n * capture lifts them from the host. */\n if (!skipChildren) {\n /** Comments seen since the last member become its landmarks — see LANDMARKS. */\n let pending: Node[] | null = null;\n for (const node of [...host.childNodes]) {\n if (node.nodeType === 8) (pending ??= []).push(node);\n else if (take(created, node, true) !== null && pending !== null) {\n for (const mark of pending) LANDMARKS.set(mark, node);\n pending = null;\n }\n }\n }\n created._observer.observe(host, WATCHING);\n /**\n * HOLDING IS WATCHED TOO. Unassigned nodes wait in a detached fragment, which is not in the\n * host's subtree — so re-slotting one (`slot=\"a\"` → `\"b\"`) went unseen and the node never moved\n * to its new slot, while native re-assigns a light child whether or not it is currently\n * assigned (measured: displayed nodes re-slotted, held ones silently did not).\n */\n created._observer.observe(created._holding, WATCHING);\n return created;\n};\n\n/** The seam function — called by the renderer once per `<slot>` per instance (see the seam). */\nconst takeOverSlot = (slot: Element, root: Node, name: string): SeamState | null => {\n /**\n * The SERVER declines the client path entirely: SSR renders once and distributes through\n * `_$server$` (markerless, no observer, no anchors). If this ran under the shim it would insert\n * anchors and capture into a fragment, fighting the server pass. `__veraSsrShimmed` is the flag\n * SSR sets when it installs the DOM.\n */\n if ((globalThis as { __veraSsrShimmed?: boolean }).__veraSsrShimmed) return null;\n /** Only an element host is ours: a shadow root keeps native slotting, and a fragment or\n * document container is not a light component. Duck-typed — realm-safe for pop-outs. */\n if (root.nodeType !== 1) return null;\n const host = root as Element;\n /**\n * **A `<slot>` nested inside ANOTHER slot's fallback has already been detached by the time we\n * reach it.** Slots mount in document order, and taking over the outer one lifts its fallback\n * children out of the tree and into `_fallback` — the inner slot among them. Reaching for\n * `parentNode.insertBefore` then threw a TypeError straight out of `renderInto`, taking the whole\n * render with it.\n *\n * Declining leaves it a literal `<slot>` inside that fallback: inert, showing its own fallback\n * children if the outer slot ever falls back. That is a documented divergence from the platform,\n * where an inner slot DOES participate while the outer one shows its fallback — supporting that\n * means taking slots over at the moment a fallback is inserted, which is a feature rather than\n * this fix. What matters here is that markup the platform accepts cannot crash the renderer.\n */\n if (slot.parentNode === null) return null;\n const nestedStates: SeamState[] = [];\n const state = capture(host);\n const doc = slot.ownerDocument!;\n const parent = slot.parentNode;\n const start = doc.createComment('');\n const end = doc.createComment('');\n parent.insertBefore(start, slot);\n parent.insertBefore(end, slot);\n /**\n * **Slots inside this one's FALLBACK are taken over first, while they still have a parent.**\n *\n * The renderer hands slots over in document order, so the outer one arrives first — and the first\n * thing it used to do was detach its fallback children, taking any nested slot out of the tree\n * with them. By the time that inner slot's turn came it had no parent to anchor into: it threw\n * until a guard declined it, and declining left it a literal `<slot>` that showed its own\n * fallback instead of what it was assigned, whenever the outer one later fell back. Measured\n * against a shadow root, which re-slots it: three arrangements, three different wrong answers,\n * one of them showing nothing at all.\n *\n * Doing it here rather than reordering the renderer's mount keeps binding order in TREE order,\n * which is what decides duplicate names. Deepest first, so a slot nested two levels down is live\n * before the one containing it captures it. The renderer still visits these afterwards and the\n * parentless guard declines them, so nothing is taken over twice.\n */\n const nested = [...slot.querySelectorAll('slot')].reverse();\n for (const inner of nested) {\n const innerState = takeOverSlot(inner, root, inner.getAttribute('name') ?? '');\n if (innerState !== null) nestedStates.push(innerState);\n }\n const fallback = doc.createDocumentFragment();\n state._parks.add(fallback);\n /**\n * **And a park is watched too, for exactly the reason holding is.** A displaced fallback is a\n * second detached place captured nodes rest in: a slot nested here goes on distributing while the\n * outer slot is assigned, so its content sits in this fragment, outside the host's subtree. Left\n * unwatched, re-slotting one of those nodes (`slot=\"i\"` → `\"\"`) was invisible and it never moved\n * — the same defect `_holding` already carries a comment about, one level further out.\n */\n state._observer.observe(fallback, WATCHING);\n while (slot.firstChild !== null) fallback.appendChild(slot.firstChild);\n /** Out of the document, but KEPT — it is the component's handle on this slot. */\n parent.removeChild(slot);\n const binding: Binding = {\n _start: start,\n _end: end,\n _name: name,\n _fallback: fallback,\n _assigned: false,\n _slot: slot,\n _shown: [],\n _queued: false,\n };\n const seam = bind(state, binding);\n fill(state, binding);\n drain(state);\n /** Parking this slot has to park the ones living in its fallback, or a branch-away would strand\n * their bindings while their nodes go with the discarded DOM. */\n if (nestedStates.length > 0) {\n const own = seam._$park$;\n const inner = nestedStates;\n seam._$park$ = () => {\n for (const state of inner) state._$park$();\n own();\n };\n }\n return seam;\n};\n\n/**\n * **The capture map records membership, not order.** Native `assignedNodes()` answers in flat-tree\n * order, so this has to as well, and the bucket's own order is the order things were CAPTURED —\n * which stops being the document's the moment anything reorders the distributed nodes. A keyed list\n * rendering a host's children is exactly that: the DOM came out `cab` and this still said `abc`,\n * while the same component in shadow mode said `cab`. The observer cannot fix it either — it\n * deliberately ignores moves inside the component's own tree, or it would react to every render.\n *\n * The common case is a handful of nodes sharing one parent, so that is the fast path: one walk of\n * that parent's children. Members split across parents — some distributed, some still parked in the\n * holding template — fall back to comparing positions, which is exact wherever they are.\n */\nconst inDocumentOrder = (bucket: Node[] | undefined): Node[] => {\n if (bucket === undefined || bucket.length < 2) return bucket === undefined ? [] : [...bucket];\n const parent = bucket[0].parentNode;\n let shared = parent !== null;\n for (let i = 1; shared && i < bucket.length; i++) if (bucket[i].parentNode !== parent) shared = false;\n if (!shared)\n return [...bucket].sort((a, b) =>\n // eslint-disable-next-line no-bitwise -- DOCUMENT_POSITION_FOLLOWING, the platform's own flag\n a === b ? 0 : a.compareDocumentPosition(b) & 4 ? -1 : 1\n );\n const members = new Set(bucket);\n const ordered: Node[] = [];\n for (let node = parent!.firstChild; node !== null; node = node.nextSibling)\n if (members.has(node)) ordered.push(node);\n return ordered;\n};\n\n/**\n * What the user slotted, by name — the component-internal accessor that answers identically in\n * both modes. Shadow: the native assignment. Light: the capture map, in document order (a fresh\n * array; membership is live, so ask again after mutations). `''`/omitted is the default slot.\n */\nexport const slotted = (host: Element, name = ''): Node[] => {\n const state = HOSTS.get(host);\n if (state !== undefined) return inDocumentOrder(state._map.get(name));\n /**\n * **`_root` before `shadowRoot`, because a CLOSED root is not reachable through `shadowRoot`** —\n * it is null there, and reading only that made this return `[]` for a closed component: a silent\n * wrong answer from an accessor documented as answering in either mode. Core keeps the root it\n * attached, in both modes, and exempts `_root` from property mangling precisely so other bundles\n * can read it; `@verajs/styles` already does, for this same reason.\n *\n * Written as a QUOTED access because this bundle mangles `_[a-z]` properties and core's does not\n * mangle this one — `keep_quoted` is what keeps the two spellings the same name in production.\n */\n const root = (host as unknown as Record<string, ShadowRoot | null | undefined>)['_root'] ?? host.shadowRoot;\n if (root != null) {\n /**\n * Matched by READING each slot's name, never by interpolating one into a selector: a name\n * carrying a quote made `slot[name=\"…\"]` an invalid selector and threw a DOMException out of\n * a public accessor, and `slot:not([name])` missed `<slot name=\"\">` — which the platform\n * counts as the default slot (measured against native `assignedNodes`). One rule,\n * `(getAttribute('name') ?? '') === name`, is the platform's own and covers both.\n */\n for (const slot of root.querySelectorAll('slot'))\n if (((slot as HTMLSlotElement).getAttribute('name') ?? '') === name)\n return (slot as HTMLSlotElement).assignedNodes();\n }\n return [];\n};\n\n/**\n * SERVER distribution — a self-contained, observer-free, anchor-free pass for SSR. The client\n * path (capture + anchors + a live observer) is meaningless on a server that renders once and\n * flattens templates through its own serializer, so `@verajs/ssr` calls THIS instead, reached\n * off the insert as `_$server$` (like `_$capture$`) so ssr needs no import of this module.\n *\n * Input: the host after its template rendered — `source` are the user's original children\n * (snapshotted before the template ran), and the host also contains the rendered template with\n * literal `<slot>` elements. Output: markerless distributed light DOM — each `<slot>` UNWRAPPED\n * to its assigned nodes (or its own fallback children), the source consumed, and one attribute\n * (`data-vm-slotted=\"offset,count\"`) when the DEFAULT slot received content, which is all\n * hydration needs to tell assigned-from-fallback there.\n */\n/**\n * **`\"offset,count\"`, on the default slot's PARENT — position, not just extent.** A named slot's\n * content self-identifies (the user's nodes carry their own `slot=\"x\"`); the default slot's does\n * not, because bare text is common there and cannot carry an attribute, so the server states it.\n *\n * The count alone is enough to ADOPT — the adoption walk arrives already standing at the right\n * place. It is not enough to RECOVER, and recovery is the case that matters: when hydration hits\n * a mismatch it discards the container and clean-renders, and for a light host the user's slotted\n * content is *inside* what gets discarded. Marked with only a count on the host, content whose\n * slot the walk never reached could not be found again and was destroyed — silently, under a\n * warning that promised the page was still correct. With the position stated, `_$rescue$` lifts\n * the user's nodes back out before the discard, no walk required, and the clean render\n * redistributes them exactly as it would on a first client render.\n */\nconst SLOTTED_ATTR = 'data-vm-slotted';\n/**\n * Unassigned slot content is PRESERVED, not dropped — native leaves an unassigned light child in\n * the DOM (present, unrendered), and a light host has no second tree to hide it in, so the server\n * parks it in an inert `<template>` (exactly what the element is for: parsed, never rendered).\n * Hydration drains it back into holding, so content for a slot that only appears in another state\n * survives the round trip instead of vanishing from the HTML forever.\n */\nconst UNASSIGNED_MARK = 'data-vm-unassigned';\nconst serverDistribute = (host: Element, source: Node[]) => {\n const buckets = new Map<string, Node[]>();\n for (const node of source) {\n const name = slotNameOf(node);\n if (name === null) continue;\n let bucket = buckets.get(name);\n if (bucket === undefined) buckets.set(name, (bucket = []));\n bucket.push(node);\n if (node.parentNode !== null) node.parentNode.removeChild(node);\n }\n const filled = new Set<string>();\n /** Parents carrying a mark, with the user's first and last node — see the separator pass. */\n const marked: Array<{ parent: Element; first: Node; last: Node; count: number }> = [];\n /** Collect first (the live list mutates as slots are unwrapped). Any nesting order is fine —\n * a slot is replaced by its content, and a slot inside assigned content was itself resolved. */\n const slotEls: Element[] = [...host.querySelectorAll('slot')];\n for (const slot of slotEls) {\n const parent = slot.parentNode;\n if (parent === null) continue; // already unwrapped as another slot's assigned content\n const name = slot.getAttribute('name') ?? '';\n const assigned = !filled.has(name) ? buckets.get(name) : undefined;\n if (assigned !== undefined && assigned.length > 0) {\n filled.add(name);\n for (const node of assigned) parent.insertBefore(node, slot);\n /** The DEFAULT slot's content is unmarkable in the body (it may be bare text), so its\n * PARENT states where it is and how much of it there is. Named slots self-delimit by\n * their own `slot` attribute and need nothing. Offset is stable: slots are unwrapped in\n * document order, so everything before this one is already final. */\n /** The mark is written after the separator pass — see it for why position is computed once,\n * at the end, rather than here where the nodes are still moving. */\n if (name === '')\n marked.push({\n parent: parent as Element,\n first: assigned[0],\n last: assigned[assigned.length - 1],\n count: assigned.length,\n });\n } else {\n /** Fallback: the slot's own children, unwrapped in place. */\n let child = slot.firstChild;\n while (child !== null) {\n const next = child.nextSibling;\n parent.insertBefore(child, slot);\n child = next;\n }\n }\n parent.removeChild(slot);\n }\n /** Whatever no slot claimed goes into the inert carrier, in its original order per name. */\n /**\n * **Separators where two text runs would MERGE, because serialisation is where node identity\n * dies.** The `offset,count` mark counts nodes as they are HERE; the client's parser joins\n * adjacent text into one node, and the mark then addresses a node spanning a boundary it cannot\n * see. Both edges of the user's content are at risk and each corrupts a different reader:\n *\n * - the TRAILING edge breaks adoption's count — measured, `<main><slot>fb</slot> TAIL</main>`\n * served \"BODY TAIL\" and hydrated to \"BODY TAIL TAIL\", the static text adopted twice.\n * - the LEADING edge breaks the offset, which only `rescue` reads — so a hydration bail would\n * slice the wrong range and keep the component's markup instead of the user's.\n *\n * Run AFTER the slot loop, because until every slot is unwrapped the neighbour of a boundary is\n * still a `<slot>` element and the merge is not yet visible. Emitted by the side that KNOWS: the\n * alternative was to have hydration infer the boundary from the canonical template, which works\n * for the shape in front of you and needs a new case for each thing that can follow a slot\n * (static text, another default slot's fallback, a named slot's fallback, and whether that named\n * slot receives content at all) — one rule here removes the class instead of handling members of\n * it. React emits the same 7 bytes for the same reason.\n */\n for (const { first, last } of marked) {\n const doc = host.ownerDocument!;\n const ahead = first.previousSibling;\n if (ahead !== null && ahead.nodeType === 3 && first.nodeType === 3)\n first.parentNode!.insertBefore(doc.createComment(''), first);\n const behind = last.nextSibling;\n if (behind !== null && behind.nodeType === 3 && last.nodeType === 3)\n last.parentNode!.insertBefore(doc.createComment(''), behind);\n }\n\n let carrier: Element | null = null;\n for (const [name, bucket] of buckets) {\n if (filled.has(name) || bucket.length === 0) continue;\n if (carrier === null) {\n carrier = host.ownerDocument!.createElement('template');\n carrier.setAttribute(UNASSIGNED_MARK, '');\n }\n for (const node of bucket) carrier.appendChild(node);\n }\n if (carrier !== null) host.appendChild(carrier);\n\n /**\n * **The mark is written LAST, because it records a POSITION and position is only true once\n * nothing else will move.** Computing it in the slot loop and then inserting separators put the\n * two out of step by exactly one node: the recorded offset addressed the separator rather than\n * the content, and the rescue — the only reader of the offset — kept nothing, so a hydration\n * bail showed the component's own fallback with the user's content gone. Every hydration test\n * still passed, because adoption reads only the count.\n *\n * Writing it here rather than merely after the separators is the difference between a fix and a\n * rule: the carrier append above, and anything added below it later, cannot silently reintroduce\n * the same defect. One place computes position, and it is downstream of every pass that moves a\n * node — which is a property of the ORDER, not of remembering to check.\n */\n for (const { parent, first, count } of marked) {\n let offset = 0;\n for (let n = parent.firstChild; n !== null && n !== first; n = n.nextSibling) offset++;\n parent.setAttribute(SLOTTED_ATTR, `${offset},${count}`);\n }\n};\n\n\n/**\n * Capture a light host's children at its FIRST render, before any slot has necessarily mounted —\n * so content destined for a slot that only appears later (a conditional `<slot>` behind a branch)\n * is held invisibly meanwhile, exactly as native shadow DOM leaves an unassigned light child\n * unrendered. Idempotent (capture is once per host); the renderer calls it once per host lifetime.\n */\n(takeOverSlot as { _$capture$?: (host: Element, boundary?: Comment) => void })._$capture$ = (\n host,\n boundary,\n) => {\n if ((globalThis as { __veraSsrShimmed?: boolean }).__veraSsrShimmed) return;\n capture(host, false, boundary);\n drain(HOSTS.get(host)!);\n};\n/**\n * A captured node's HOME — the sentinel marking the end of its host's light region. The renderer's\n * text-part upgrade calls this: markers for a part whose text node was captured belong in the\n * HOST, not wherever distribution carried the node (see `_sentinel`). Returns null for a node no\n * light host has captured, which is every node in an app without light slots.\n */\n(takeOverSlot as { _$home$?: (node: Node) => Comment | null })._$home$ = (node) => {\n const sentinel = HOMES.get(node);\n return sentinel !== undefined && sentinel.parentNode !== null ? sentinel : null;\n};\n/** The server hook — SSR calls this (never the client capture/anchor path). */\n(takeOverSlot as { _$server$?: (host: Element, source: Node[]) => void })._$server$ = serverDistribute;\n\n/**\n * HYDRATION adopt — wrap already-distributed server nodes as a live binding IN PLACE, so a\n * server-rendered slot component becomes fully interactive with zero node churn: the user's nodes\n * keep their identity (focus, input values), and the capture map + observer come alive for\n * re-renders and mutations. Called by the hydrate entry once per `<slot>` it reconciles.\n *\n * `assigned` are the user's nodes already sitting at the slot position (null/empty ⇒ the slot\n * showed its fallback, which is `fallback` — those nodes are already in place too). `parent` and\n * `before` bound where anchors go. Returns the binding's park state, exactly like `takeOverSlot`.\n */\nconst adoptSlot = (\n host: Element,\n name: string,\n assigned: Node[] | null,\n fallback: Node[],\n parent: Node,\n before: Node | null,\n /** The hydrator's per-instance `<slot>` — a shallow clone of the canonical one, carrying this\n * instance's committed bindings. Appended, so a slots build paired with an older hydrate build\n * degrades to no element rather than breaking. */\n slot?: Element,\n): SeamState => {\n const state = capture(host, /* skipChildren */ true);\n const doc = host.ownerDocument!;\n const start = doc.createComment('');\n const end = doc.createComment('');\n /** Anchors bracket whatever is shown (assigned nodes, or the fallback the server rendered). */\n const firstShown = (assigned && assigned.length > 0 ? assigned[0] : fallback[0]) ?? before;\n parent.insertBefore(start, firstShown ?? before);\n parent.insertBefore(end, before);\n const isAssigned = assigned !== null && assigned.length > 0;\n /**\n * `_fallback` holds the DISPLACED region and is empty while the region is on screen, so which\n * branch this is decides where these nodes belong. Assigned: the server never rendered the\n * fallback and these are clones off the canonical template, displaced from the start — they go\n * into the fragment. Unassigned: the server DID render them and they are live in the page\n * between the anchors, so they stay exactly where they are and the fragment starts empty.\n * Moving them would delete server output from the document.\n */\n const held = doc.createDocumentFragment();\n state._parks.add(held);\n state._observer.observe(held, WATCHING);\n if (isAssigned) for (const node of fallback) held.appendChild(node);\n if (isAssigned)\n for (const node of assigned!) {\n bucketOf(state, name).push(node);\n state._names.set(node, name);\n /**\n * RANKED, like every captured node — the adoption walk visits slots in document order and\n * the server preserved within-name order, so sequential ranks reproduce the light tree.\n * Without this, adopted nodes had NO rank: every later rank-ordered merge (a re-slot's\n * splice, take's interpolation) compared against `undefined` and misplaced them — found by\n * the run-18 adopted-seam storms as membership-right, ORDER-wrong divergences from native.\n */\n state._rank.set(node, state._next++);\n }\n const binding: Binding = {\n _start: start,\n _end: end,\n _name: name,\n _fallback: held,\n _assigned: isAssigned,\n _slot: slot,\n _shown: [],\n _queued: false,\n };\n const seam = bind(state, binding);\n /** The server already put the assignment in place, so nothing is filled here — but a slot that\n * HAS an assignment has just been flattened, and the platform fires `slotchange` for that. A\n * hydrated component therefore hears the same first event a client-rendered one does. */\n if (isAssigned) {\n binding._shown = assigned!.slice();\n signal(state, binding);\n }\n drain(state);\n return seam;\n};\n(takeOverSlot as { _$adopt$?: typeof adoptSlot })._$adopt$ = adoptSlot;\n\n/**\n * HYDRATION rescue — **the user's content must survive a mismatch.** When adoption fails, the\n * hydrator discards the container's server markup and clean-renders it; for a light host the\n * user's slotted nodes are *inside* that markup, so the discard destroyed them and the slots\n * showed fallback, under a warning promising the page was still correct. It was not: content was\n * gone from the page for good.\n *\n * This un-distributes instead: it lifts the user's nodes back out, using exactly the two things\n * the server states about them — a named node carries its own `slot`, and the default slot's\n * parent carries `data-vm-slotted=\"offset,count\"` — and returns them for the caller to re-attach\n * as the host's children. From there nothing is special-cased: the clean render captures them the\n * way it captures any first client render.\n *\n * **Never descends into another component.** A nested host's children are its own source, which\n * it will capture (or rescue) itself when it renders; taking them here would hand one component's\n * content to another. A custom element is therefore collected as a node and never entered.\n *\n * One documented edge: a component whose FALLBACK content carries a `slot` attribute\n * (`<slot name=\"a\"><i slot=\"a\">…</i></slot>`) has that fallback rescued as if the user wrote it.\n * The attribute is meaningless on fallback in native shadow DOM too — it only means anything on a\n * host's children — so the markup was already saying something it does not mean.\n */\nconst rescue = (host: Element): Node[] | null => {\n const rescued: Node[] = [];\n const collect = (parent: Element) => {\n const mark = parent.getAttribute(SLOTTED_ATTR);\n let from = -1;\n let until = -1;\n if (mark !== null) {\n const comma = mark.indexOf(',');\n from = Number(mark.slice(0, comma));\n until = from + Number(mark.slice(comma + 1));\n }\n let index = 0;\n for (let child = parent.firstChild; child !== null; child = child.nextSibling, index++) {\n if (index >= from && index < until) {\n rescued.push(child);\n continue;\n }\n if (child.nodeType !== 1) continue;\n const element = child as Element;\n /**\n * The inert carrier holds what no slot claimed — user content too, and its nodes live in\n * `content`, not `childNodes`.\n *\n * **The tag is checked, not just the attribute.** This walks the SERVER's subtree, which is\n * full of the user's own markup, and `data-vm-unassigned` on anything that is not a\n * `<template>` reached `.content` on an element that has none: a TypeError thrown out of\n * `renderInto`, so the mismatch never finished falling back and the page was left with no\n * client render at all. Reserved attribute or not, a user's markup cannot be allowed to do\n * that — and `capture` was already checking both.\n */\n if (element.localName === 'template' && element.hasAttribute(UNASSIGNED_MARK)) {\n const held = (element as HTMLTemplateElement).content;\n for (let node = held.firstChild; node !== null; node = node.nextSibling) rescued.push(node);\n continue;\n }\n if (element.hasAttribute('slot')) rescued.push(element);\n else if (element.localName.indexOf('-') === -1) collect(element);\n }\n };\n collect(host);\n for (const node of rescued) node.parentNode?.removeChild(node);\n return rescued.length > 0 ? rescued : null;\n};\n(takeOverSlot as { _$rescue$?: typeof rescue })._$rescue$ = rescue;\n\n/**\n * The insert descriptor — `wire([renderer, slots])` and light-DOM slots exist.\n *\n * `fn` no longer needs a cast: `'slot'` is a declared insert point now, so this is checked against\n * `SlotInsert` rather than asserted past the type system. It used to be `as never`, which is what a\n * missing insert type looks like from the inside — and from the OUTSIDE it looked like\n * `wire([renderer, slots])` failing to compile for every TypeScript consumer.\n */\nexport const slots = {\n name: '@verajs/renderer/slots',\n on: 'slot' as const,\n fn: takeOverSlot,\n priority: 50,\n};\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EG;AA4IH,MAAM,KAAK,GAAG,IAAI,OAAO,EAAsB;AAC/C;AACA,MAAM,MAAM,GAAuB,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE;AACzF;AACA,MAAM,KAAK,GAAG,IAAI,OAAO,EAAiB;AAC1C;;;;;;;;;AASG;AACH,MAAM,SAAS,GAAG,IAAI,OAAO,EAAc;AAE3C;;;;AAIG;AACH,MAAM,QAAQ,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,MAAM,CAAC,EAAE;AAEhG;;;;;;;;;;;;AAYG;AACH,MAAM,UAAU,GAAG,CAAC,IAAU,KAC5B,IAAI,CAAC,QAAQ,KAAK,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ,KAAK,CAAC,IAAK,IAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,IAAI;AAExG,MAAM,QAAQ,GAAG,CAAC,KAAgB,EAAE,IAAY,KAAY;IAC1D,IAAI,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;IACjC,IAAI,MAAM,KAAK,SAAS;AAAE,QAAA,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,MAAM,GAAG,EAAE,EAAE;AAC7D,IAAA,OAA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AAE;AAC7E,gBAAA,MAAM,IAAI,GAAI,OAA+B,CAAC,OAAO;AACrD,gBAAA,KAAK,IAAI,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,KAAK,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,WAAW;AAAE,oBAAA,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC3F;YACF;AACA,YAAA,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC;AAAE,gBAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;iBAClD,IAAI,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;gBAAE,OAAO,CAAC,OAAO,CAAC;QAClE;AACF,IAAA,CAAC;IACD,OAAO,CAAC,IAAI,CAAC;IACb,KAAK,MAAM,IAAI,IAAI,OAAO;AAAE,QAAA,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC;AAC9D,IAAA,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,GAAG,OAAO,GAAG,IAAI;AAC5C,CAAC;AACA,YAA8C,CAAC,SAAS,GAAG,MAAM;AAElE;;;;;;;AAOG;AACI,MAAM,KAAK,GAAG;AACnB,IAAA,IAAI,EAAE,wBAAwB;AAC9B,IAAA,EAAE,EAAE,MAAe;AACnB,IAAA,EAAE,EAAE,YAAY;AAChB,IAAA,QAAQ,EAAE,EAAE;;;;;"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * A key that disappeared between renders restores what the element held before the binding existed.
3
+ *
4
+ * This is the question Lit's PR is stuck on, and the trap is asking it as "what value means absent".
5
+ * For a property there is no answer: assigning `undefined` runs through coercing setters, so
6
+ * dropping `.value` yields `""` rather than reverting, and `delete` cannot remove a prototype
7
+ * accessor. Asked instead as *"undo what this binding did"* it is well defined for every kind and
8
+ * never invents a value the author did not write — the initial state was, by definition, acceptable
9
+ * before the binding arrived.
10
+ *
11
+ * And asked that way it needs no code of its own: releasing is writing the initial value back.
12
+ * `null` removes an attribute, `false` untoggles a boolean, `undefined` restores a property to
13
+ * pristine, and an event handler falls to `null` — every case the existing commit already handles.
14
+ * The separate per-kind teardown this replaced was fourteen lines saying the same thing twice.
15
+ *
16
+ * Deliberately unguarded by an ownership check (`is the value still the one we wrote?`). That only
17
+ * matters when a component reassigns a property its parent is binding, which is already confused;
18
+ * per principle #3 the machinery waits for evidence rather than being pre-built.
19
+ */
20
+ declare function apply(this: {
21
+ _props: Record<string, unknown>;
22
+ }, element: Element, part: object): void;
23
+ /**
24
+ * The server half of the protocol: hand back every binding, resolved, and let the renderer that
25
+ * asked decide what belongs in markup.
26
+ *
27
+ * Deliberately *not* a serializer. This package knows what a key means — `.value` is a property,
28
+ * `?disabled` a boolean, `onClick` an event — and nothing else. Whether a property belongs in
29
+ * server markup (`value`, `checked`, `selected` do; the rest are client state) and how a value is
30
+ * escaped are `@verajs/ssr`'s decisions, and principle #8 wants escaping in exactly one place. So
31
+ * this returns data, never a string.
32
+ *
33
+ * Kinds are single characters rather than the module's numeric constants, because this crosses a
34
+ * package boundary: `a`ttribute, `b`oolean, `p`roperty, `e`vent, `r`ef. A ref is client state with
35
+ * no markup, exactly like an event, and the serializer drops both.
36
+ */
37
+ declare function attributes(this: {
38
+ _props: Record<string, unknown>;
39
+ }): [string, string, unknown][];
40
+ /**
41
+ * Branded rather than duck-typed: the element position already means "element ref", and a props bag
42
+ * is indistinguishable from a ref object — `{ value: 5 }` is legitimately either.
43
+ */
44
+ declare const spread: (props: Record<string, unknown>) => {
45
+ _props: Record<string, unknown>;
46
+ _$apply$: typeof apply;
47
+ _$attrs$: typeof attributes;
48
+ };
49
+
50
+ export { spread };
51
+ //# sourceMappingURL=vera-renderer-spread.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vera-renderer-spread.d.ts","sources":["../../src/spread.ts"],"mappings":"AAAA;AACA;;;;;;;;;;;;;;;;AAgBG;AAEH;AACA,iBAAiB,KAAE;AACnB,YAAM,MAAY;AAClB,YAAA,OAAA;AACA;AACA;AACA;AAEA;;;;;;;;;;;;;;;AAeG;AACH;AACA;AAEA,cAAA,MAAA,UAAA,MAAA;;;;;;;;","names":[]}