@vmz/core 0.0.4 → 0.1.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.
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Browser / client-only DOM entry — tree-shakeable (no SSR serialize/hydrate).
3
+ */
4
+ export * from './dom-core.js';
@@ -0,0 +1,5 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * Browser / client-only DOM entry — tree-shakeable (no SSR serialize/hydrate).
4
+ */
5
+ export * from './dom-core.js';
package/dist/dom.d.ts CHANGED
@@ -1,222 +1,6 @@
1
1
  /**
2
2
  * VMZ DOM / SSR runtime — precise patches, no VDOM diff.
3
- *
4
- *
5
- * Direct components expose `__vmzCreate` / `__vmzSerialize` / `__vmzPlan`.
6
- * Mount, SSR, hydrate, and resume all run that same schedule.
7
- * Field writes only run registered dep patches — never re-create structure.
3
+ * Compat barrel for `@vmz/core/dom` (full client + SSR).
8
4
  */
9
- /** @param {boolean} [on] */
10
- export declare function __vmzPrecisionEnable(on?: boolean): void;
11
- /** @param {boolean} [on] */
12
- export declare function __vmzTraceEnable(on?: boolean): void;
13
- export declare function __vmzPrecisionReset(): void;
14
- export declare function __vmzTraceReset(): void;
15
- /**
16
- * StableId event snapshot (`vmz.dx.trace.v0` shape without schema stamp —
17
- * host may wrap via ingestRuntimeTrace).
18
- * @returns {{ schema: string, events: typeof traceBuf.events, status: string }}
19
- */
20
- export declare function __vmzTraceSnapshot(): {
21
- schema: string;
22
- events: any[];
23
- status: string;
24
- };
25
- /** @returns {typeof precision} */
26
- export declare function __vmzPrecisionSnapshot(): {
27
- enabled: boolean;
28
- writes: number;
29
- bindingEvals: number;
30
- patchExecs: number;
31
- domCreates: number;
32
- domMoves: number;
33
- domRemoves: number;
34
- componentExecs: number;
35
- writesByRoot: any;
36
- bindingEvalsByDep: any;
37
- patchesByDep: any;
38
- bindingEvalsByBinding: any;
39
- patchesByBinding: any;
40
- };
41
- /** @param {Record<string, any>} map */
42
- export declare function registerComponents(map: any): void;
43
- /**
44
- * @param {new (props?: object) => any} Component
45
- * @param {object} [props]
46
- */
47
- export declare function renderToString(Component: any, props?: {}, opts?: {}): Promise<any>;
48
- /**
49
- * Stream SSR via the same Direct serialize schedule as `renderToString`.
50
- * Yields HTML chunks (open tag → children → close). Joining chunks equals `renderToString`.
51
- * Supports AbortSignal for cancel; consumers should respect backpressure (await between chunks).
52
- * @param {new (props?: object) => any} Component
53
- * @param {object} [props]
54
- * @param {{ signal?: AbortSignal, slotHtml?: string }} [opts]
55
- * @returns {AsyncGenerator<string, void, void>}
56
- */
57
- export declare function renderToStream(Component: any, props?: {}, opts?: {}): AsyncGenerator<any, void, unknown>;
58
- /**
59
- * Live-DOM counterpart: first default `<slot>` owned by this tree, not by a nested
60
- * `[data-vmz]` component (Button/Link labels, etc.).
61
- * @param {Element | null | undefined} root
62
- * @returns {Element | null}
63
- */
64
- export declare function findOwnedDefaultSlot(root: any): any;
65
- /**
66
- * Hydrate/mount a file-route page inside an optional layout chain (outer → inner).
67
- * Mirrors SSR `slotHtml` wrapping: each layout's owned default slot becomes the
68
- * outlet for the next layout or the page. Retains layout instances on `container`
69
- * so SPA transitions can dispose only the page host.
70
- * @param {new (props?: object) => any} Page
71
- * @param {Element} container
72
- * @param {object} [props]
73
- * @param {Array<new (props?: object) => any>} [layoutCtors] outer → inner
74
- * @param {{ preserveState?: boolean | Record<string, unknown>, skipOnMount?: boolean }} [opts]
75
- */
76
- export declare function hydrateRoute(Page: any, container: any, props?: {}, layoutCtors?: any[], opts?: {}): Promise<any>;
77
- /**
78
- * Mount once; later updates are dep patches only (never re-run structure).
79
- * Requires compiler `__vmzCreate` (production Direct emit — no blueprint fallback).
80
- * @param {new (props?: object) => any} Component
81
- * @param {Element} container
82
- * @param {object} [props]
83
- */
84
- export declare function mount(Component: any, container: any, props?: {}): Promise<any>;
85
- /**
86
- * Snapshot plain state/prop field values for Island HMR (session).
87
- * @param {object} inst
88
- * @returns {Record<string, unknown> | null}
89
- */
90
- export declare function snapshotInstanceState(inst: any): {};
91
- /**
92
- * @param {object} inst
93
- * @param {Record<string, unknown> | null | undefined} state
94
- */
95
- export declare function applyPreservedState(inst: any, state: any): void;
96
- /**
97
- * resume: attach to existing Island DOM without re-running construct structure or onMount.
98
- * Consumes ResumeEntry product (`data-vmz-resume`) derived from the same Execution Plan.
99
- * @param {new (props?: object) => any} Component
100
- * @param {HTMLElement} container
101
- * @param {{ props?: object, state?: Record<string, unknown>, strategy?: string } | null} [slice]
102
- */
103
- export declare function resume(Component: any, container: any, slice?: any): Promise<any>;
104
- /**
105
- * Resume all `[data-vmz-island]` hosts (prefer ResumeEntry / EventEntry over mount).
106
- * Event strategy islands wait for the DOM event before attach (lazy EventEntry).
107
- * @param {ParentNode} [root]
108
- */
109
- export declare function resumeIslands(root?: Document): void;
110
- /**
111
- * EventEntry attach: only wire `client:event` / `client:event:*` islands.
112
- * Idle/load/visible ResumeEntries are left alone (static shell can defer framework work).
113
- * @param {ParentNode} [root]
114
- */
115
- export declare function attachEventEntries(root?: Document): void;
116
- /**
117
- * @param {new (props?: object) => any} Component
118
- * @param {HTMLElement} container
119
- * @param {object} [props]
120
- * @param {{ preserveState?: boolean | Record<string, unknown>, skipOnMount?: boolean }} [opts]
121
- */
122
- export declare function hydrate(Component: any, container: any, props?: {}, opts?: {}): Promise<any>;
123
- /**
124
- * Tear down binders and stop patches. Safe to call more than once.
125
- * Field writes after destroy no longer update DOM (values may still change).
126
- *: also dispose owned DOM trees (child __vmzInst / region __vmzDispose).
127
- * @param {object} inst
128
- */
129
- export declare function destroy(inst: any): void;
130
- /**
131
- *: walk a DOM subtree and run lifetime dispose hooks + nested instance destroy.
132
- * Does not mark the *calling* parent destroyed; safe from destroy(inst).
133
- * @param {Node | null | undefined} root
134
- */
135
- export declare function disposeDomTree(root: any): void;
136
- /**
137
- * @param {ParentNode} [root]
138
- */
139
- export declare function hydrateIslands(root?: Document): void;
140
- export declare function scheduleClient(strategy: any, fn: any): void;
141
- /**
142
- * AsyncTask cancel protocol (first slice): keyed generation + AbortSignal.
143
- * Superseded runs and `destroy(inst)` abort prior work; stale results must not apply.
144
- * @param {object} inst
145
- * @param {string} key
146
- * @param {(signal: AbortSignal, meta: { generation: number }) => any | Promise<any>} fn
147
- * @returns {Promise<any>}
148
- */
149
- export declare function __vmzRunTask(inst: any, key: any, fn: any): Promise<any>;
150
- /** Abort all keyed tasks on an instance (also called from destroy). */
151
- export declare function __vmzCancelTasks(inst: any): void;
152
- /** @returns {'pending'|'success'|'error'|'cancelled'|null} */
153
- export declare function __vmzTaskStatus(inst: any, key: any): any;
154
- /**
155
- * Mark a plain object as intentionally shared across ownership boundaries.
156
- * @param {any} value
157
- */
158
- export declare function __vmzAllowShared(value: any): any;
159
- /**
160
- * Take exclusive ownership intent: clear multi-owner registry for this object.
161
- * Subsequent field assigns re-register from the assigning instance only.
162
- * @param {any} value
163
- */
164
- export declare function __vmzTakeShared(value: any): any;
165
- /**
166
- * @returns {Array<{ kind: string, message: string }>}
167
- */
168
- export declare function __vmzSharedCrossComponentDiagnostics(): any[];
169
- export declare function __vmzSharedCrossComponentDiagnosticsReset(): void;
170
- /**
171
- * Read a nested path under a field root (for compound / update expansion).
172
- * @param {any} inst
173
- * @param {string} root
174
- * @param {string[]} segs
175
- */
176
- export declare function __vmzReadPath(inst: any, root: any, segs: any): any;
177
- /**
178
- * Short-circuit logical path assign (`||=` / `&&=` / `??=`).
179
- * @param {any} inst
180
- * @param {string} root
181
- * @param {string[]} segs
182
- * @param {'||'|'&&'|'??'} kind
183
- * @param {any} rhs
184
- */
185
- export declare function __vmzWritePathLogical(inst: any, root: any, segs: any, kind: any, rhs: any): any;
186
- /**
187
- * Mutates a plain owned object/array and schedules the same path notice Proxy would.
188
- *
189
- * Root-array index assigns (`tags[0] = x`) notify as field replace (structural),
190
- * matching the transitional Proxy wrapArray behavior.
191
- * Shared multi-owner: writing through one field notifies all owners of the same raw object.
192
- *
193
- * @param {any} inst
194
- * @param {string} root field root
195
- * @param {string[]} segs path under root (non-empty); dynamic indices already String(...)'d
196
- * @param {any} value
197
- */
198
- export declare function __vmzWritePath(inst: any, root: any, segs: any, value: any): any;
199
- /**
200
- * Compiler-inserted array mutator barrier (push/pop/splice/…).
201
- * Applies the mutator on the plain array and schedules a structural notice
202
- * at `root` + `baseSegs` (empty baseSegs → field replace).
203
- *
204
- * @param {any} inst
205
- * @param {string} root
206
- * @param {string[]} baseSegs
207
- * @param {string} method
208
- * @param {any[]} args
209
- */
210
- export declare function __vmzArrayMutate(inst: any, root: any, baseSegs: any, method: any, args: any): any;
211
- /**
212
- * WriteBarrier: true when value is an owned plain object with path barriers (no Proxy).
213
- * @param {any} value
214
- */
215
- export declare function __vmzIsWriteBarrierOwned(value: any): boolean;
216
- /**
217
- * True when value is the Proxy wrapper from array (or residual) reactive wrap.
218
- * @param {any} value
219
- */
220
- export declare function __vmzIsReactiveProxy(value: any): boolean;
221
- /** @param {object} inst */
222
- export declare function flushPending(inst: any): Promise<void>;
5
+ export * from './dom-core.js';
6
+ export * from './dom-ssr.js';