@vmz/core 0.0.3 → 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,203 +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?: {}): 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 }} [opts]
55
- * @returns {AsyncGenerator<string, void, void>}
56
- */
57
- export declare function renderToStream(Component: any, props?: {}, opts?: {}): AsyncGenerator<any, void, unknown>;
58
- /**
59
- * Mount once; later updates are dep patches only (never re-run structure).
60
- * Requires compiler `__vmzCreate` (production Direct emit — no blueprint fallback).
61
- * @param {new (props?: object) => any} Component
62
- * @param {Element} container
63
- * @param {object} [props]
64
- */
65
- export declare function mount(Component: any, container: any, props?: {}): Promise<any>;
66
- /**
67
- * Snapshot plain state/prop field values for Island HMR (session).
68
- * @param {object} inst
69
- * @returns {Record<string, unknown> | null}
70
- */
71
- export declare function snapshotInstanceState(inst: any): {};
72
- /**
73
- * @param {object} inst
74
- * @param {Record<string, unknown> | null | undefined} state
75
- */
76
- export declare function applyPreservedState(inst: any, state: any): void;
77
- /**
78
- * resume: attach to existing Island DOM without re-running construct structure or onMount.
79
- * Consumes ResumeEntry product (`data-vmz-resume`) derived from the same Execution Plan.
80
- * @param {new (props?: object) => any} Component
81
- * @param {HTMLElement} container
82
- * @param {{ props?: object, state?: Record<string, unknown>, strategy?: string } | null} [slice]
83
- */
84
- export declare function resume(Component: any, container: any, slice?: any): Promise<any>;
85
- /**
86
- * Resume all `[data-vmz-island]` hosts (prefer ResumeEntry / EventEntry over mount).
87
- * Event strategy islands wait for the DOM event before attach (lazy EventEntry).
88
- * @param {ParentNode} [root]
89
- */
90
- export declare function resumeIslands(root?: Document): void;
91
- /**
92
- * EventEntry attach: only wire `client:event` / `client:event:*` islands.
93
- * Idle/load/visible ResumeEntries are left alone (static shell can defer framework work).
94
- * @param {ParentNode} [root]
95
- */
96
- export declare function attachEventEntries(root?: Document): void;
97
- /**
98
- * @param {new (props?: object) => any} Component
99
- * @param {HTMLElement} container
100
- * @param {object} [props]
101
- * @param {{ preserveState?: boolean | Record<string, unknown>, skipOnMount?: boolean }} [opts]
102
- */
103
- export declare function hydrate(Component: any, container: any, props?: {}, opts?: {}): Promise<any>;
104
- /**
105
- * Tear down binders and stop patches. Safe to call more than once.
106
- * Field writes after destroy no longer update DOM (values may still change).
107
- *: also dispose owned DOM trees (child __vmzInst / region __vmzDispose).
108
- * @param {object} inst
109
- */
110
- export declare function destroy(inst: any): void;
111
- /**
112
- *: walk a DOM subtree and run lifetime dispose hooks + nested instance destroy.
113
- * Does not mark the *calling* parent destroyed; safe from destroy(inst).
114
- * @param {Node | null | undefined} root
115
- */
116
- export declare function disposeDomTree(root: any): void;
117
- /**
118
- * @param {ParentNode} [root]
119
- */
120
- export declare function hydrateIslands(root?: Document): void;
121
- export declare function scheduleClient(strategy: any, fn: any): void;
122
- /**
123
- * AsyncTask cancel protocol (first slice): keyed generation + AbortSignal.
124
- * Superseded runs and `destroy(inst)` abort prior work; stale results must not apply.
125
- * @param {object} inst
126
- * @param {string} key
127
- * @param {(signal: AbortSignal, meta: { generation: number }) => any | Promise<any>} fn
128
- * @returns {Promise<any>}
129
- */
130
- export declare function __vmzRunTask(inst: any, key: any, fn: any): Promise<any>;
131
- /** Abort all keyed tasks on an instance (also called from destroy). */
132
- export declare function __vmzCancelTasks(inst: any): void;
133
- /** @returns {'pending'|'success'|'error'|'cancelled'|null} */
134
- export declare function __vmzTaskStatus(inst: any, key: any): any;
135
- /**
136
- * Mark a plain object as intentionally shared across ownership boundaries.
137
- * @param {any} value
138
- */
139
- export declare function __vmzAllowShared(value: any): any;
140
- /**
141
- * Take exclusive ownership intent: clear multi-owner registry for this object.
142
- * Subsequent field assigns re-register from the assigning instance only.
143
- * @param {any} value
144
- */
145
- export declare function __vmzTakeShared(value: any): any;
146
- /**
147
- * @returns {Array<{ kind: string, message: string }>}
148
- */
149
- export declare function __vmzSharedCrossComponentDiagnostics(): any[];
150
- export declare function __vmzSharedCrossComponentDiagnosticsReset(): void;
151
- /**
152
- * Read a nested path under a field root (for compound / update expansion).
153
- * @param {any} inst
154
- * @param {string} root
155
- * @param {string[]} segs
156
- */
157
- export declare function __vmzReadPath(inst: any, root: any, segs: any): any;
158
- /**
159
- * Short-circuit logical path assign (`||=` / `&&=` / `??=`).
160
- * @param {any} inst
161
- * @param {string} root
162
- * @param {string[]} segs
163
- * @param {'||'|'&&'|'??'} kind
164
- * @param {any} rhs
165
- */
166
- export declare function __vmzWritePathLogical(inst: any, root: any, segs: any, kind: any, rhs: any): any;
167
- /**
168
- * Mutates a plain owned object/array and schedules the same path notice Proxy would.
169
- *
170
- * Root-array index assigns (`tags[0] = x`) notify as field replace (structural),
171
- * matching the transitional Proxy wrapArray behavior.
172
- * Shared multi-owner: writing through one field notifies all owners of the same raw object.
173
- *
174
- * @param {any} inst
175
- * @param {string} root field root
176
- * @param {string[]} segs path under root (non-empty); dynamic indices already String(...)'d
177
- * @param {any} value
178
- */
179
- export declare function __vmzWritePath(inst: any, root: any, segs: any, value: any): any;
180
- /**
181
- * Compiler-inserted array mutator barrier (push/pop/splice/…).
182
- * Applies the mutator on the plain array and schedules a structural notice
183
- * at `root` + `baseSegs` (empty baseSegs → field replace).
184
- *
185
- * @param {any} inst
186
- * @param {string} root
187
- * @param {string[]} baseSegs
188
- * @param {string} method
189
- * @param {any[]} args
190
- */
191
- export declare function __vmzArrayMutate(inst: any, root: any, baseSegs: any, method: any, args: any): any;
192
- /**
193
- * WriteBarrier: true when value is an owned plain object with path barriers (no Proxy).
194
- * @param {any} value
195
- */
196
- export declare function __vmzIsWriteBarrierOwned(value: any): boolean;
197
- /**
198
- * True when value is the Proxy wrapper from array (or residual) reactive wrap.
199
- * @param {any} value
200
- */
201
- export declare function __vmzIsReactiveProxy(value: any): boolean;
202
- /** @param {object} inst */
203
- export declare function flushPending(inst: any): Promise<void>;
5
+ export * from './dom-core.js';
6
+ export * from './dom-ssr.js';