@verajs/renderer 0.2.2 → 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 +757 -225
- package/dist/development/vera-renderer-elements.d.ts +39 -0
- package/dist/development/vera-renderer-elements.d.ts.map +1 -0
- package/dist/development/vera-renderer-elements.js +193 -0
- package/dist/development/vera-renderer-elements.js.map +1 -0
- package/dist/development/vera-renderer-hydrate-slots.d.ts +94 -0
- package/dist/development/vera-renderer-hydrate-slots.d.ts.map +1 -0
- package/dist/development/vera-renderer-hydrate-slots.js +325 -0
- package/dist/development/vera-renderer-hydrate-slots.js.map +1 -0
- package/dist/development/vera-renderer-hydration.d.ts +332 -0
- package/dist/development/vera-renderer-hydration.d.ts.map +1 -0
- package/dist/development/vera-renderer-hydration.js +902 -0
- package/dist/development/vera-renderer-hydration.js.map +1 -0
- package/dist/development/vera-renderer-keyed.d.ts +25 -8
- package/dist/development/vera-renderer-keyed.d.ts.map +1 -1
- package/dist/development/vera-renderer-keyed.js +843 -268
- package/dist/development/vera-renderer-keyed.js.map +1 -1
- package/dist/development/vera-renderer-multi-window.d.ts +5 -0
- package/dist/development/vera-renderer-multi-window.d.ts.map +1 -0
- package/dist/development/vera-renderer-multi-window.js +40 -0
- package/dist/development/vera-renderer-multi-window.js.map +1 -0
- package/dist/development/vera-renderer-namespaces.d.ts +64 -0
- package/dist/development/vera-renderer-namespaces.d.ts.map +1 -0
- package/dist/development/vera-renderer-namespaces.js +94 -0
- package/dist/development/vera-renderer-namespaces.js.map +1 -0
- package/dist/development/vera-renderer-native-elements.d.ts +13 -0
- package/dist/development/vera-renderer-native-elements.d.ts.map +1 -0
- package/dist/development/vera-renderer-native-elements.js +231 -0
- package/dist/development/vera-renderer-native-elements.js.map +1 -0
- package/dist/development/vera-renderer-portal.d.ts +29 -0
- package/dist/development/vera-renderer-portal.d.ts.map +1 -0
- package/dist/development/vera-renderer-portal.js +167 -0
- package/dist/development/vera-renderer-portal.js.map +1 -0
- package/dist/development/vera-renderer-profiler.d.ts +48 -96
- package/dist/development/vera-renderer-profiler.d.ts.map +1 -1
- package/dist/development/vera-renderer-profiler.js +2632 -2142
- package/dist/development/vera-renderer-profiler.js.map +1 -1
- package/dist/development/vera-renderer-slots.d.ts +88 -92
- package/dist/development/vera-renderer-slots.d.ts.map +1 -1
- package/dist/development/vera-renderer-slots.js +1834 -1237
- package/dist/development/vera-renderer-slots.js.map +1 -1
- package/dist/development/vera-renderer-spread.d.ts +7 -41
- package/dist/development/vera-renderer-spread.d.ts.map +1 -1
- package/dist/development/vera-renderer-spread.js +539 -477
- package/dist/development/vera-renderer-spread.js.map +1 -1
- package/dist/development/vera-renderer-tag.d.ts +12 -3
- package/dist/development/vera-renderer-tag.d.ts.map +1 -1
- package/dist/development/vera-renderer-tag.js +671 -513
- package/dist/development/vera-renderer-tag.js.map +1 -1
- package/dist/development/vera-renderer-until.d.ts +24 -0
- package/dist/development/vera-renderer-until.d.ts.map +1 -0
- package/dist/development/vera-renderer-until.js +83 -0
- package/dist/development/vera-renderer-until.js.map +1 -0
- package/dist/development/vera-renderer.d.ts +48 -96
- package/dist/development/vera-renderer.d.ts.map +1 -1
- package/dist/development/vera-renderer.js +2607 -2104
- package/dist/development/vera-renderer.js.map +1 -1
- package/dist/vera-renderer-elements.min.js +2 -0
- package/dist/vera-renderer-elements.min.js.map +1 -0
- package/dist/vera-renderer-hydrate-slots.min.js +2 -0
- package/dist/vera-renderer-hydrate-slots.min.js.map +1 -0
- package/dist/vera-renderer-hydration.min.js +3 -0
- package/dist/vera-renderer-hydration.min.js.map +1 -0
- package/dist/vera-renderer-keyed.min.js +1 -1
- package/dist/vera-renderer-keyed.min.js.map +1 -1
- package/dist/vera-renderer-multi-window.min.js +2 -0
- package/dist/vera-renderer-multi-window.min.js.map +1 -0
- package/dist/vera-renderer-namespaces.min.js +2 -0
- package/dist/vera-renderer-namespaces.min.js.map +1 -0
- package/dist/vera-renderer-native-elements.min.js +2 -0
- package/dist/vera-renderer-native-elements.min.js.map +1 -0
- package/dist/vera-renderer-portal.min.js +2 -0
- package/dist/vera-renderer-portal.min.js.map +1 -0
- 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 +1 -1
- package/dist/vera-renderer-spread.min.js.map +1 -1
- package/dist/vera-renderer-tag.min.js +1 -1
- package/dist/vera-renderer-tag.min.js.map +1 -1
- package/dist/vera-renderer-until.min.js +2 -0
- package/dist/vera-renderer-until.min.js.map +1 -0
- package/dist/vera-renderer.min.js +1 -1
- package/dist/vera-renderer.min.js.map +1 -1
- package/package.json +52 -9
- package/dist/development/vera-renderer-hydrate.d.ts +0 -147
- package/dist/development/vera-renderer-hydrate.d.ts.map +0 -1
- package/dist/development/vera-renderer-hydrate.js +0 -3136
- package/dist/development/vera-renderer-hydrate.js.map +0 -1
- package/dist/vera-renderer-hydrate.min.js +0 -2
- package/dist/vera-renderer-hydrate.min.js.map +0 -1
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The renderer's cross-file and public types — one `types.ts` at the import-graph root, per
|
|
3
|
+
* CODE-PRINCIPLES §1.
|
|
4
|
+
*
|
|
5
|
+
* **What is here and what deliberately is not.** Everything in this file is a pure data shape: it
|
|
6
|
+
* names no runtime value, so it can sit upstream of every module in the package and nothing here
|
|
7
|
+
* can pull a class into the import graph. The renderer's remaining cross-file types — `Item`,
|
|
8
|
+
* `ListStrategy`, `KeyedResult` — name the `Instance` and `ChildPart` CLASSES in their definitions,
|
|
9
|
+
* which puts them structurally downstream of `renderer.ts`; they stay beside those classes, and
|
|
10
|
+
* §1's "one file at the import-graph root" records that limit rather than pretending otherwise.
|
|
11
|
+
* Restating a class's shape here to satisfy the letter of the rule would create exactly the twin
|
|
12
|
+
* §1 forbids.
|
|
13
|
+
*
|
|
14
|
+
* Moving `ProfileReport` and `OverlayOptions` here dissolved a real cycle: `profiler.ts` imported
|
|
15
|
+
* `OverlayOptions` from `overlay.ts` while `overlay.ts` imported `ProfileReport` back from
|
|
16
|
+
* `profiler.ts`. Type-only, so it was erased and never a runtime cycle — but it is the shape this
|
|
17
|
+
* file's position in the graph exists to make impossible.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* What a template tag (`html`, `svg`, `mathml`) produces — the compiled shape every renderer entry
|
|
21
|
+
* point accepts, and the one type a consumer normally names.
|
|
22
|
+
*
|
|
23
|
+
* `strings` is the template literal's own `strings` array and is the TEMPLATE'S IDENTITY: the
|
|
24
|
+
* engine interns it per call site, so two literals with identical text are two templates and
|
|
25
|
+
* rendering one after the other is a teardown, not an update. Anything building these by hand must
|
|
26
|
+
* hand back the same array to get an update.
|
|
27
|
+
*/
|
|
28
|
+
type TemplateResult = {
|
|
29
|
+
/** 1 = html, 2 = svg, 3 = mathml — the markers core's built-in tags produce. */
|
|
30
|
+
_$litType$?: number;
|
|
31
|
+
strings: TemplateStringsArray;
|
|
32
|
+
values: unknown[];
|
|
33
|
+
/** Set by `keyed()`; drives keyed list reconciliation. */
|
|
34
|
+
key?: unknown;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* **An instance hook: per-template behavior for every instance, with nothing on the hot path.**
|
|
38
|
+
*
|
|
39
|
+
* A `'template'` hook sets one as the template's `_$inst$` while the template is built — only
|
|
40
|
+
* templates that need it carry one, so every other instance pays one property read. For every
|
|
41
|
+
* instance of that template the renderer CREATES it calls `$c` BEFORE the first update, with the
|
|
42
|
+
* instance's fresh fragment and the render root (`null` for a commit outside any `renderInto`, such as
|
|
43
|
+
* an applier resolving later) — and for an instance hydration ADOPTS, `$c` too, told `adopted`, with the
|
|
44
|
+
* instance's live elements in template pre-order in place of a root (a live root also holds what its
|
|
45
|
+
* nested parts rendered, so counting from it would find the wrong elements); `$m`
|
|
46
|
+
* once the RENDER that created the instance has finished — so bindings are live, a `<slot
|
|
47
|
+
* name=${…}>` has its name, and the instance is in place in its container rather than in a detached
|
|
48
|
+
* fragment (a nested instance is inserted only when its outer one is) — with whatever `$c` returned;
|
|
49
|
+
* an instance torn down before then never gets `$m`; and `$q` at teardown with whatever `$m` returned. An `undefined` at
|
|
50
|
+
* either step ends the instance's part in it.
|
|
51
|
+
*
|
|
52
|
+
* **Its shape is measured, not chosen for tidiness** (2026-09-26, three engines):
|
|
53
|
+
* - **One object with methods, not closures returned per instance.** The effect shape — a function
|
|
54
|
+
* returning a mount returning a cleanup — allocated two closures for every slotted instance, and
|
|
55
|
+
* Chromium showed it: slotted creation +3–4% against the renderer before slots moved out. Here the
|
|
56
|
+
* instance keeps plain state and the methods live once per template.
|
|
57
|
+
* - **One hook, not a list.** A list costs every hooked instance a loop and Firefox about 3%, plus
|
|
58
|
+
* 79 B. A second consumer composes — its `'template'` hook wraps the `_$inst$` it finds — so the
|
|
59
|
+
* list's only advantage is paid for by nobody today. `@verajs/renderer/elements` runs at priority
|
|
60
|
+
* 10, before any default-priority hook, so it is the one wrapped — and several consumers share it
|
|
61
|
+
* as `'element'` claims instead of each writing a hook.
|
|
62
|
+
*
|
|
63
|
+
* `@verajs/renderer/elements` is the user: it asks its claimants about each element once per
|
|
64
|
+
* template and mounts and unmounts their behaviors per instance — slots' `<slot>` claim among them. `$`-sigiled throughout, so it survives property mangling across the
|
|
65
|
+
* bundle boundary.
|
|
66
|
+
*/
|
|
67
|
+
type InstanceHook = {
|
|
68
|
+
/**
|
|
69
|
+
* Before the first update: the hook's own state for this instance, or `undefined` to take no part. `root` is the
|
|
70
|
+
* instance's root — the clone's fragment, or its one element for a single-root template (then position 0) — or, for
|
|
71
|
+
* an ADOPTED instance, its elements in template pre-order (position `p` is `root[p]`). The renderer keeps the state
|
|
72
|
+
* in one slot of the instance and hands it back; what is in it is the hook's business.
|
|
73
|
+
*/
|
|
74
|
+
$c(root: Node | readonly Element[], renderRoot: Node | null, adopted: boolean): unknown;
|
|
75
|
+
/** Once the render that created the instance has finished, with that state. */
|
|
76
|
+
$m(state: unknown): void;
|
|
77
|
+
/** At the instance's teardown — before or after its mount — with that state. */
|
|
78
|
+
$q(state: unknown): void;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Where hydration's walk stands among a live parent's children: a node, and an offset into it when it is text — server
|
|
82
|
+
* text runs arrive MERGED (`a${x}b` is one text node), so a static and a value share a node until the walk splits them.
|
|
83
|
+
* `hydrate-slots` moves it past a filled slot's range. Plain names, so property mangling leaves them alone.
|
|
84
|
+
*/
|
|
85
|
+
type HydrationCursor = {
|
|
86
|
+
parent: Node;
|
|
87
|
+
node: Node | null;
|
|
88
|
+
offset: number;
|
|
89
|
+
/**
|
|
90
|
+
* Walking a LIGHT host's children in light order (`hydrate-slots`): the list, `node`'s index in it, and how many of
|
|
91
|
+
* them the template must account for — all of a list read from the server's statement, none of a live record's (a
|
|
92
|
+
* node the page added since is the host's, not the template's). ABSENT on every other walk, so a page without light
|
|
93
|
+
* hosts walks one three-field shape: carrying them on every cursor cost Chrome's hydrate 14% (measured 2026-10-07).
|
|
94
|
+
*/
|
|
95
|
+
light?: Node[];
|
|
96
|
+
at?: number;
|
|
97
|
+
end?: number;
|
|
98
|
+
/**
|
|
99
|
+
* On a light walk, how many RUNS the template writes among those children, and each anchor the walk set for them with
|
|
100
|
+
* the node it stands before (`null`: the end) — `hydrate-slots`' own, so `_`-named: the minifier shortens them.
|
|
101
|
+
*/
|
|
102
|
+
_runs?: number;
|
|
103
|
+
_marks?: (Node | null)[];
|
|
104
|
+
};
|
|
105
|
+
/** Hydration's mismatch: records the cause and the first node that disagreed, and stops the adoption by throwing. */
|
|
106
|
+
type HydrationFail = (cause: string, at: Node | null, reason: false | (() => string)) => never;
|
|
107
|
+
/** A served light host as hydration sees it: only its carrier (`<ins data-vm-unassigned>`), which the walk passes over. */
|
|
108
|
+
type ServedHost = {
|
|
109
|
+
readonly carrier: Node | null;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* **Hydrating light slots is its own piece** (`@verajs/renderer/hydrate-slots`): hydration calls it through these
|
|
113
|
+
* positions (`_$hydrateSlots$`), stamped with the package's seam protocol — open a served host, take a filled slot's
|
|
114
|
+
* range at a canonical `<slot>` (its detached copy, or `null`), close a matched walk, rescue a mismatched one.
|
|
115
|
+
*/
|
|
116
|
+
type HydrateSlots = [
|
|
117
|
+
protocol: number,
|
|
118
|
+
open: (host: Element, fail: HydrationFail) => ServedHost,
|
|
119
|
+
slot: (canonical: Element, cursor: HydrationCursor, served: ServedHost) => Element | null,
|
|
120
|
+
close: (served: ServedHost | null) => void,
|
|
121
|
+
rescue: (served: ServedHost | null) => void,
|
|
122
|
+
/**
|
|
123
|
+
* The cursor that walks a light host's children in light order, for a template placing content into it — over the
|
|
124
|
+
* live record's list, else the statement's (strict) — or `null`: walked as its DOM stands. Given the canonical
|
|
125
|
+
* element, its adoption's plan and values, so a RUN written among those children (a value that is not text) can decline.
|
|
126
|
+
*/
|
|
127
|
+
light: (host: Element, canonical: Element, plan: ReadonlyMap<Node, readonly number[]>, values: readonly unknown[]) => HydrationCursor | null,
|
|
128
|
+
/** The walk's step, light-aware: the next light child on a light cursor, else the next sibling. Hydration adopts it once the piece is wired. */
|
|
129
|
+
next: (cursor: HydrationCursor, node: Node) => Node | null,
|
|
130
|
+
/** An insert on a light walk: an anchor of a RUN is held for the unit the piece builds, text put in place. */
|
|
131
|
+
insert: (cursor: HydrationCursor, node: Node) => void
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @verajs/renderer — a template-identity renderer.
|
|
136
|
+
*
|
|
137
|
+
* A tagged template's `strings` array is interned per call site, so it keys a parsed `<template>`.
|
|
138
|
+
* An instance clones it and binds the expression positions; every later render of the same shape
|
|
139
|
+
* commits only the values that changed. Lists reconcile by index here, by key through
|
|
140
|
+
* `@verajs/renderer/keyed`.
|
|
141
|
+
*
|
|
142
|
+
* Contracts the speed pays for:
|
|
143
|
+
* - The renderer owns its container below the mount point: a part that owns a whole parent clears it
|
|
144
|
+
* with one `textContent = ''`.
|
|
145
|
+
* - Do not `normalize()` rendered content — child anchors are text nodes.
|
|
146
|
+
* - A string renders as text, never as markup. There is no `innerHTML` sink.
|
|
147
|
+
*
|
|
148
|
+
* Internal members are `_`-prefixed because the production build mangles `/^_[a-z]/`. `$`-named
|
|
149
|
+
* members cross bundle boundaries (keyed, spread, slots) and survive mangling by not matching it.
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
declare class Template {
|
|
153
|
+
/** What an instance clones: the single root element, or the whole content fragment. */
|
|
154
|
+
$R: Node;
|
|
155
|
+
/** No element in it can be custom — see `instantiate`. */
|
|
156
|
+
_plain: boolean;
|
|
157
|
+
$K: number[];
|
|
158
|
+
$N: string[];
|
|
159
|
+
/** The statics around a bound attribute's values; `null` for one full-value expression. */
|
|
160
|
+
$J: (string[] | null)[];
|
|
161
|
+
/** Child-index hops from `$R` to each binding's node. */
|
|
162
|
+
$P: number[][];
|
|
163
|
+
/** The template statically writes the attribute too, so a first nullish commit must still remove it. */
|
|
164
|
+
_present: boolean[];
|
|
165
|
+
/**
|
|
166
|
+
* Per binding, whether it names a URL a browser navigates to (a `javascript:` value is refused, see `SCRIPT_URL`):
|
|
167
|
+
* 0 not one; 1 converted once, and that string checked and written; 2 a custom element's property — strings only.
|
|
168
|
+
*/
|
|
169
|
+
$L: number[];
|
|
170
|
+
/**
|
|
171
|
+
* **An extension marked this template** (`'template'` insert): namespaces' resolver, an instance hook. False for
|
|
172
|
+
* every template of an app that wires none — ONE read per instance created, never a per-row cost otherwise.
|
|
173
|
+
*/
|
|
174
|
+
$X: boolean;
|
|
175
|
+
/** Namespaces' resolver: which template to build at a position, given its parent. */
|
|
176
|
+
_$at$?: (parent: Node) => Template;
|
|
177
|
+
/** The namespace this template was parsed in, for a resolver asked about a detached fragment. */
|
|
178
|
+
_$ns$?: string | null;
|
|
179
|
+
/** The instance hook — elements (and slots): claim at creation, mount at the render's end, unmount at teardown. */
|
|
180
|
+
_$inst$?: InstanceHook;
|
|
181
|
+
/** Development only: tag-shape mistakes found at construction, said at the template's FIRST instance (`sayShape`). */
|
|
182
|
+
_shape?: [string, string][];
|
|
183
|
+
/**
|
|
184
|
+
* Development only: element positions on an element a SOLE binding owns — see `ownsContent`. Marked per instance in
|
|
185
|
+
* `instantiate`; hydration needs no mark, because the server's output carries the content or its empty anchor.
|
|
186
|
+
*/
|
|
187
|
+
_owned?: number[];
|
|
188
|
+
/** Development only: the template holds a `<slot>` and was built while light-DOM slots was not wired (`saySlotless`). */
|
|
189
|
+
_slotless?: boolean;
|
|
190
|
+
constructor(result: TemplateResult);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* The record an `@event`, element-position or custom-element `.prop` binding holds in its node slot.
|
|
194
|
+
* For an event it is the LISTENER — a stable object, so swapping handlers never touches the DOM and a
|
|
195
|
+
* re-add through `null` is deduped by the platform; for a ref it is the key an `_$apply$` value keeps
|
|
196
|
+
* its ownership by; for `.prop` on a custom element, `_state` is where adoption stands (`adoptProperty`:
|
|
197
|
+
* 0 still adopting, 1 received, 2 refused).
|
|
198
|
+
*/
|
|
199
|
+
declare class Slot {
|
|
200
|
+
_element: Element;
|
|
201
|
+
_handler: unknown;
|
|
202
|
+
_state: number;
|
|
203
|
+
constructor(element: Element);
|
|
204
|
+
/** Runs the handler UNTRACKED — see shared-utils' `dispatch`. */
|
|
205
|
+
handleEvent(event: Event): void;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* A rendered template. Its bindings live in ONE array of `[node, committed value]` pairs rather than a
|
|
209
|
+
* part object each — a row allocates the instance and that array, nothing else. The instance is also
|
|
210
|
+
* its own list item: `$k` is the key a keyed list reads.
|
|
211
|
+
*/
|
|
212
|
+
declare class Instance {
|
|
213
|
+
$k: unknown;
|
|
214
|
+
/**
|
|
215
|
+
* The result last committed into this instance as a list item, recorded ONLY for a result marked `_$same$` (what
|
|
216
|
+
* `each` stamps). Always-on, the skip changed two contracts (a live `!value` binding re-syncing after typing; a result
|
|
217
|
+
* mutated in place re-rendering), so it is opt-in: an unmarked result never takes it (2026-10-18).
|
|
218
|
+
*/
|
|
219
|
+
$j: unknown;
|
|
220
|
+
_template: Template;
|
|
221
|
+
/** The strings this instance was built from — the same-shape identity. */
|
|
222
|
+
_strings: TemplateStringsArray;
|
|
223
|
+
/** The cloned root: the element for a single-root template, else the (soon emptied) fragment. */
|
|
224
|
+
$R: Node;
|
|
225
|
+
_bindings: unknown[];
|
|
226
|
+
constructor(template: Template, strings: TemplateStringsArray, root: Node, bindings: unknown[]);
|
|
227
|
+
}
|
|
228
|
+
/** A list item: an instance of a single-root template (its element is its whole range), or a markered part. */
|
|
229
|
+
type Item = Instance | ChildPart;
|
|
230
|
+
/**
|
|
231
|
+
* A child position that holds anything but plain text: a template, a list, a node, or nothing — or
|
|
232
|
+
* text it took over from an upgraded binding. It owns the range between two comment markers
|
|
233
|
+
* — the root part's too, so content before and after a render stays — or, for a SOLE position, its element's whole
|
|
234
|
+
* content (`$w`, no markers at all).
|
|
235
|
+
*
|
|
236
|
+
* **The ownership invariant — whoever writes an element's content owns it, and owns its verification.** Two cases:
|
|
237
|
+
* a PLAIN element whose whole content is one binding belongs to that binding (the part is its range, and hydration
|
|
238
|
+
* adopts it with no markers); a CUSTOM element's children belong to the component (a binding inside it keeps its
|
|
239
|
+
* markers, and hydration compares them only when the template itself writes content inside the tag). Slots
|
|
240
|
+
* inherit both.
|
|
241
|
+
*/
|
|
242
|
+
declare class ChildPart {
|
|
243
|
+
$s: Comment | null;
|
|
244
|
+
$e: Node | null;
|
|
245
|
+
/** The element this part owns entirely (a SOLE position), or `null` for a part between markers. */
|
|
246
|
+
$w: Node | null;
|
|
247
|
+
$o: number;
|
|
248
|
+
$v: unknown;
|
|
249
|
+
$l: Text | null;
|
|
250
|
+
$n: Instance | null;
|
|
251
|
+
$i: Item[] | null;
|
|
252
|
+
/** The key a keyed list reads when this part is one of its items. */
|
|
253
|
+
$k: unknown;
|
|
254
|
+
/** Instances `hold()` parked here, by template identity — they outlive interim content. */
|
|
255
|
+
_held: Map<TemplateStringsArray, Instance> | null;
|
|
256
|
+
/** Whatever the last `_$child$` applier returned here (its continuity), and which applier that was. */
|
|
257
|
+
$z: unknown;
|
|
258
|
+
$a: unknown;
|
|
259
|
+
/** Released: its component was removed, and every user value it held dropped (see `releaseRoot`). */
|
|
260
|
+
$x: boolean;
|
|
261
|
+
/** The container whose render attached the applier — a later `_$commit$` runs as a render of it. */
|
|
262
|
+
$R?: Node | null;
|
|
263
|
+
constructor(start: Comment | null, end: Node | null);
|
|
264
|
+
_insert(node: Node): void;
|
|
265
|
+
/**
|
|
266
|
+
* Tells the CURRENT content that it is going away — the part itself stays, so what `hold()` parked here stays
|
|
267
|
+
* parked and can still come back. Reached only when `notifyOnRemoval` is set.
|
|
268
|
+
*/
|
|
269
|
+
_detach(): void;
|
|
270
|
+
/** The part itself is going away: its current content, and everything `hold()` parked here (then collectable). */
|
|
271
|
+
_destroy(): void;
|
|
272
|
+
_clear(): void;
|
|
273
|
+
/**
|
|
274
|
+
* How a `_$child$` applier renders — `_$`-named so it survives mangling, because third parties call
|
|
275
|
+
* it. Its own state survives its own commit. A commit that arrives outside its container's render (an
|
|
276
|
+
* applier resolving later) runs as a render of that container, while it still contains the part.
|
|
277
|
+
*/
|
|
278
|
+
_$commit$(value: unknown): void;
|
|
279
|
+
$p(value: unknown): void;
|
|
280
|
+
/** Creates one list item before `ref`. */
|
|
281
|
+
$c(value: unknown, parent: Node, ref: Node | null): Item;
|
|
282
|
+
/** Commits `value` into an item; returns the item now standing there (an instance whose shape changed becomes a part). */
|
|
283
|
+
$u(item: Item, value: unknown): Item;
|
|
284
|
+
/** The item's first node — its move handle and the insertion reference before it. */
|
|
285
|
+
$f(item: Item): Node;
|
|
286
|
+
/** Moves an item before `ref`. */
|
|
287
|
+
$m(item: Item, ref: Node | null, parent?: Node): void;
|
|
288
|
+
/** Removes an item. */
|
|
289
|
+
$d(item: Item): void;
|
|
290
|
+
_commitList(values: unknown[]): void;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** What the renderer hands over (`renderer.ts`, `connect`), by the `HANDOFF_*` positions in `kinds.ts`. */
|
|
294
|
+
type Handoff = [
|
|
295
|
+
protocol: number,
|
|
296
|
+
adopter: (adopt: (result: unknown, container: Node) => boolean) => void,
|
|
297
|
+
getTemplate: (result: TemplateResult) => Template,
|
|
298
|
+
ChildPart: new (start: Comment | null, end: Node | null) => ChildPart,
|
|
299
|
+
Instance: new (template: Template, strings: TemplateStringsArray, root: Node, bindings: unknown[]) => Instance,
|
|
300
|
+
Slot: new (element: Element) => Slot,
|
|
301
|
+
unset: object,
|
|
302
|
+
upgraded: object,
|
|
303
|
+
commit: (template: Template, bindings: unknown[], i: number, kind: number, values: unknown[]) => void,
|
|
304
|
+
commitAs: (root: Node | null, part: ChildPart, value: unknown, home?: Node | null) => void,
|
|
305
|
+
hookUp: (instance: Instance, root: Node | readonly Element[], adopted: boolean) => void,
|
|
306
|
+
resolve: (template: Template, parent: Node) => Template,
|
|
307
|
+
roots: {
|
|
308
|
+
set(node: Node, part: ChildPart): void;
|
|
309
|
+
},
|
|
310
|
+
toText: (value: unknown) => string,
|
|
311
|
+
removalWork: () => void
|
|
312
|
+
];
|
|
313
|
+
/**
|
|
314
|
+
* **Light-DOM slots' seam** (`@verajs/renderer/slots` installs it, off-chain like `_$done$`): its own `capture`, stamped
|
|
315
|
+
* with this package's seam protocol — a served host's light children, in light order, captured where the server put
|
|
316
|
+
* them, the server's carrier as their holding. Everything about the SERVER's format is read here; slots knows none of it.
|
|
317
|
+
*/
|
|
318
|
+
type Registry = {
|
|
319
|
+
get(name: string): unknown[] | undefined;
|
|
320
|
+
$H?: Handoff;
|
|
321
|
+
$t?: Untracked;
|
|
322
|
+
_$hydrateSlots$?: HydrateSlots;
|
|
323
|
+
_$hydrating$?: boolean;
|
|
324
|
+
/** Slots' seam: present when slots is wired — read here only to know that. */
|
|
325
|
+
_$capture$?: unknown;
|
|
326
|
+
};
|
|
327
|
+
type Untracked = <A extends unknown[], R>(fn: (...args: A) => R, ...args: A) => R;
|
|
328
|
+
/** `wire([renderer, hydration])` — after the renderer, whose `connect` sets the hand-off. */
|
|
329
|
+
declare const hydration: (given: Registry) => void;
|
|
330
|
+
|
|
331
|
+
export { hydration };
|
|
332
|
+
//# sourceMappingURL=vera-renderer-hydration.d.ts.map
|
|
@@ -0,0 +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;;;;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":[]}
|