@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.
- package/dist/client-nav.d.ts +20 -2
- package/dist/client-nav.js +560 -50
- package/dist/dom-core.d.ts +337 -0
- package/dist/dom-core.js +4565 -0
- package/dist/dom-ssr.d.ts +78 -0
- package/dist/dom-ssr.js +970 -0
- package/dist/dom.client.d.ts +4 -0
- package/dist/dom.client.js +5 -0
- package/dist/dom.d.ts +3 -219
- package/dist/dom.js +3 -4377
- package/dist/serve-host.d.ts +13 -0
- package/dist/serve-host.mjs +184 -16
- package/dist/server.d.ts +8 -0
- package/dist/server.js +218 -10
- package/dist/vmz-dom.d.ts +5 -0
- package/dist/vmz-dom.js +6 -0
- package/dist/vmz-runtime.d.ts +5 -0
- package/dist/vmz-runtime.js +6 -0
- package/package.json +8 -1
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VMZ DOM client runtime — precise patches, no VDOM diff (SSR lives in dom-ssr).
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
* Direct components expose `__vmzCreate` / `__vmzSerialize` / `__vmzPlan`.
|
|
6
|
+
* Mount and client patches run that same schedule (SSR/hydrate/resume in dom-ssr).
|
|
7
|
+
* Field writes only run registered dep patches — never re-create structure.
|
|
8
|
+
*/
|
|
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
|
+
export declare function noteDomCreate(): void;
|
|
42
|
+
/** @param {Record<string, any>} map */
|
|
43
|
+
export declare function registerComponents(map: any): void;
|
|
44
|
+
/** Sync registry lookup (SSR serialize / client). */
|
|
45
|
+
export declare function getRegisteredComponent(name: any): any;
|
|
46
|
+
/**
|
|
47
|
+
* Lazy component loader for EventEntry mixed packs (set by entry-client / entry-event).
|
|
48
|
+
* @param {string} name
|
|
49
|
+
* @returns {Promise<any>}
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveComponent(name: any): Promise<any>;
|
|
52
|
+
/**
|
|
53
|
+
* Mount once; later updates are dep patches only (never re-run structure).
|
|
54
|
+
* Requires compiler `__vmzCreate` (production Direct emit — no blueprint fallback).
|
|
55
|
+
* @param {new (props?: object) => any} Component
|
|
56
|
+
* @param {Element} container
|
|
57
|
+
* @param {object} [props]
|
|
58
|
+
*/
|
|
59
|
+
export declare function mount(Component: any, container: any, props?: {}): Promise<any>;
|
|
60
|
+
/**
|
|
61
|
+
* Nested Direct `component` schedules child onMount asynchronously; drain before return
|
|
62
|
+
* so SSR/hydrate callers see post-mount DOM (e.g. UserCard Ada, not Loading…).
|
|
63
|
+
* @param {object} inst
|
|
64
|
+
*/
|
|
65
|
+
export declare function settlePendingChildMounts(inst: any): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* @param {new (props?: object) => any} Component
|
|
68
|
+
* @param {object} inst
|
|
69
|
+
*/
|
|
70
|
+
export declare function runDirectCreate(Component: any, inst: any): any;
|
|
71
|
+
/** Host API for compiler-emitted `__vmzCreate` (direct path, Program IR B). */
|
|
72
|
+
export declare const directApi: {
|
|
73
|
+
/** @type {object | null} */
|
|
74
|
+
_inst: any;
|
|
75
|
+
/** @type {Array<{ deps: string[], fn: => any, bindingId?: number|string|null }> | null} */
|
|
76
|
+
_branchBinds: any;
|
|
77
|
+
/** @type {Array< => void> | null} */
|
|
78
|
+
_itemPatches: any;
|
|
79
|
+
/**
|
|
80
|
+
* Active keyed-each context (/): item binds + event delegation.
|
|
81
|
+
* @type {null | {
|
|
82
|
+
* noteItemBind: (bindingId: number|string|null, deps: string[], fn: => void) => void,
|
|
83
|
+
* needDelegate: (type: string) => void,
|
|
84
|
+
* }}
|
|
85
|
+
*/
|
|
86
|
+
_eachCtx: any;
|
|
87
|
+
el(tag: any): any;
|
|
88
|
+
text(value: any): Text;
|
|
89
|
+
frag(): DocumentFragment;
|
|
90
|
+
attr(el: any, name: any, value: any): void;
|
|
91
|
+
on(el: any, type: any, handler: any): void;
|
|
92
|
+
/**
|
|
93
|
+
* Bind a named instance method (no arrow / Function#toString).
|
|
94
|
+
* Learns `skipFlush` after a sync invocation that schedules no dirty work
|
|
95
|
+
* (stride / transpose self-apply DOM).
|
|
96
|
+
* @param {Element} el
|
|
97
|
+
* @param {string} type
|
|
98
|
+
* @param {string} methodName
|
|
99
|
+
* @param {{ skipFlush?: boolean } | null | undefined} [opts]
|
|
100
|
+
*/
|
|
101
|
+
onMethod(el: any, type: any, methodName: any, opts: any): void;
|
|
102
|
+
/**
|
|
103
|
+
* @param {object} inst
|
|
104
|
+
* @param {number|string|null} bindingId
|
|
105
|
+
* @param {string[]} deps
|
|
106
|
+
* @param {() => any} get
|
|
107
|
+
* @param {Text} textNode
|
|
108
|
+
* @param {{ stable: string[], branches: Array<{ cond?: => any, deps: string[] }> } | null | undefined} [cf]
|
|
109
|
+
*/
|
|
110
|
+
bindText(inst: any, bindingId: any, deps: any, get: any, textNode: any, cf: any): void;
|
|
111
|
+
/**
|
|
112
|
+
* @param {object} inst
|
|
113
|
+
* @param {number|string|null} bindingId
|
|
114
|
+
* @param {string[]} deps
|
|
115
|
+
* @param {() => any} get
|
|
116
|
+
* @param {Element} el
|
|
117
|
+
* @param {string} name
|
|
118
|
+
* @param {{ stable: string[], branches: Array<{ cond?: => any, deps: string[] }> } | null | undefined} [cf]
|
|
119
|
+
*/
|
|
120
|
+
bindAttr(inst: any, bindingId: any, deps: any, get: any, el: any, name: any, cf: any): void;
|
|
121
|
+
setHtml(el: any, value: any): void;
|
|
122
|
+
/**
|
|
123
|
+
* Trusted HTML binding (`html={expr}`). Author/plugin responsibility.
|
|
124
|
+
* @param {object} inst
|
|
125
|
+
* @param {number|string|null} bindingId
|
|
126
|
+
* @param {string[]} deps
|
|
127
|
+
* @param {() => any} get
|
|
128
|
+
* @param {Element} el
|
|
129
|
+
* @param {{ stable: string[], branches: Array<{ cond?: => any, deps: string[] }> } | null | undefined} [cf]
|
|
130
|
+
*/
|
|
131
|
+
bindHtml(inst: any, bindingId: any, deps: any, get: any, el: any, cf: any): void;
|
|
132
|
+
/**
|
|
133
|
+
* Nested component (sync Direct child or island schedule).
|
|
134
|
+
* @param {object} hostInst
|
|
135
|
+
* @param {string} name
|
|
136
|
+
* @param {Record<string, any>} props
|
|
137
|
+
* @param {string | null} client
|
|
138
|
+
*/
|
|
139
|
+
component(hostInst: any, name: any, props: any, client: any): HTMLDivElement;
|
|
140
|
+
/**
|
|
141
|
+
* Keep nested Direct child props live with parent field writes.
|
|
142
|
+
* @param {object} hostInst
|
|
143
|
+
* @param {HTMLElement} hostEl
|
|
144
|
+
* @param {string} propName
|
|
145
|
+
* @param {string[]} deps
|
|
146
|
+
* @param {() => any} get
|
|
147
|
+
*/
|
|
148
|
+
bindComponentProp(hostInst: any, hostEl: any, propName: any, deps: any, get: any): void;
|
|
149
|
+
/**
|
|
150
|
+
* Project parent children into nested Direct component default `<slot>`.
|
|
151
|
+
* @param {HTMLElement} hostEl
|
|
152
|
+
* @param {Node} node
|
|
153
|
+
*/
|
|
154
|
+
projectDefaultSlot(hostEl: any, node: any): void;
|
|
155
|
+
/**
|
|
156
|
+
* Direct if/else — no blueprint `kind: "if"` dispatch.
|
|
157
|
+
* @param {object} inst
|
|
158
|
+
* @param {number|string|null} bindingId
|
|
159
|
+
* @param {string[]} deps
|
|
160
|
+
* @param {Array<{ cond?: => any, create: (api: typeof directApi) => Node }>} branches
|
|
161
|
+
* @param {number|string|null} [regionId]
|
|
162
|
+
*/
|
|
163
|
+
ifBlock(inst: any, bindingId: any, deps: any, branches: any, regionId?: any): HTMLSpanElement;
|
|
164
|
+
/**
|
|
165
|
+
* Direct keyed each — no blueprint `kind: "each"` dispatch.
|
|
166
|
+
* /: Set/Map + Fragment batch insert; item-local binds; host field dispatch; event delegate.
|
|
167
|
+
* @param {object} inst
|
|
168
|
+
* @param {number|string|null} bindingId
|
|
169
|
+
* @param {string[]} deps
|
|
170
|
+
* @param {{ as?: string, list: => any, key?: (box: {item:any,index:number}) => any, createItem: (api: typeof directApi, box: {item:any,index:number}) => Node }} spec
|
|
171
|
+
* @param {number|string|null} [regionId]
|
|
172
|
+
*/
|
|
173
|
+
eachBlock(inst: any, bindingId: any, deps: any, spec: any, regionId?: any): DocumentFragment;
|
|
174
|
+
};
|
|
175
|
+
export declare function isEventPropName(name: any): boolean;
|
|
176
|
+
/** HTML boolean attributes: presence means true; `false`/`null` must remove the attr. */
|
|
177
|
+
export declare const BOOLEAN_HTML_ATTRS: Set<string>;
|
|
178
|
+
/**
|
|
179
|
+
* @param {Element} el
|
|
180
|
+
* @param {string} name
|
|
181
|
+
* @param {any} value
|
|
182
|
+
*/
|
|
183
|
+
export declare function applyDomAttr(el: any, name: any, value: any): void;
|
|
184
|
+
export declare function stripFns(obj: any): {};
|
|
185
|
+
/**
|
|
186
|
+
* Snapshot plain state/prop field values for Island HMR (session).
|
|
187
|
+
* @param {object} inst
|
|
188
|
+
* @returns {Record<string, unknown> | null}
|
|
189
|
+
*/
|
|
190
|
+
export declare function snapshotInstanceState(inst: any): {};
|
|
191
|
+
/**
|
|
192
|
+
* @param {object} inst
|
|
193
|
+
* @param {Record<string, unknown> | null | undefined} state
|
|
194
|
+
*/
|
|
195
|
+
export declare function applyPreservedState(inst: any, state: any): void;
|
|
196
|
+
/**
|
|
197
|
+
* Tear down binders and stop patches. Safe to call more than once.
|
|
198
|
+
* Field writes after destroy no longer update DOM (values may still change).
|
|
199
|
+
*: also dispose owned DOM trees (child __vmzInst / region __vmzDispose).
|
|
200
|
+
* @param {object} inst
|
|
201
|
+
*/
|
|
202
|
+
export declare function destroy(inst: any): void;
|
|
203
|
+
/**
|
|
204
|
+
*: walk a DOM subtree and run lifetime dispose hooks + nested instance destroy.
|
|
205
|
+
* Does not mark the *calling* parent destroyed; safe from destroy(inst).
|
|
206
|
+
* @param {Node | null | undefined} root
|
|
207
|
+
*/
|
|
208
|
+
export declare function disposeDomTree(root: any): void;
|
|
209
|
+
export declare function scheduleClient(strategy: any, fn: any): void;
|
|
210
|
+
/** @param {string} strategy */
|
|
211
|
+
export declare function isEventEntryStrategy(strategy: any): boolean;
|
|
212
|
+
export declare function scheduleClientOn(el: any, strategy: any, fn: any): void;
|
|
213
|
+
/**
|
|
214
|
+
* AsyncTask cancel protocol (first slice): keyed generation + AbortSignal.
|
|
215
|
+
* Superseded runs and `destroy(inst)` abort prior work; stale results must not apply.
|
|
216
|
+
* @param {object} inst
|
|
217
|
+
* @param {string} key
|
|
218
|
+
* @param {(signal: AbortSignal, meta: { generation: number }) => any | Promise<any>} fn
|
|
219
|
+
* @returns {Promise<any>}
|
|
220
|
+
*/
|
|
221
|
+
export declare function __vmzRunTask(inst: any, key: any, fn: any): Promise<any>;
|
|
222
|
+
/** Abort all keyed tasks on an instance (also called from destroy). */
|
|
223
|
+
export declare function __vmzCancelTasks(inst: any): void;
|
|
224
|
+
/** @returns {'pending'|'success'|'error'|'cancelled'|null} */
|
|
225
|
+
export declare function __vmzTaskStatus(inst: any, key: any): any;
|
|
226
|
+
export declare function createInstance(Component: any, props?: {}): any;
|
|
227
|
+
/**
|
|
228
|
+
* Mark a plain object as intentionally shared across ownership boundaries.
|
|
229
|
+
* @param {any} value
|
|
230
|
+
*/
|
|
231
|
+
export declare function __vmzAllowShared(value: any): any;
|
|
232
|
+
/**
|
|
233
|
+
* Take exclusive ownership intent: clear multi-owner registry for this object.
|
|
234
|
+
* Subsequent field assigns re-register from the assigning instance only.
|
|
235
|
+
* @param {any} value
|
|
236
|
+
*/
|
|
237
|
+
export declare function __vmzTakeShared(value: any): any;
|
|
238
|
+
/**
|
|
239
|
+
* @returns {Array<{ kind: string, message: string }>}
|
|
240
|
+
*/
|
|
241
|
+
export declare function __vmzSharedCrossComponentDiagnostics(): any[];
|
|
242
|
+
export declare function __vmzSharedCrossComponentDiagnosticsReset(): void;
|
|
243
|
+
/**
|
|
244
|
+
* Read a nested path under a field root (for compound / update expansion).
|
|
245
|
+
* @param {any} inst
|
|
246
|
+
* @param {string} root
|
|
247
|
+
* @param {string[]} segs
|
|
248
|
+
*/
|
|
249
|
+
export declare function __vmzReadPath(inst: any, root: any, segs: any): any;
|
|
250
|
+
/**
|
|
251
|
+
* Short-circuit logical path assign (`||=` / `&&=` / `??=`).
|
|
252
|
+
* @param {any} inst
|
|
253
|
+
* @param {string} root
|
|
254
|
+
* @param {string[]} segs
|
|
255
|
+
* @param {'||'|'&&'|'??'} kind
|
|
256
|
+
* @param {any} rhs
|
|
257
|
+
*/
|
|
258
|
+
export declare function __vmzWritePathLogical(inst: any, root: any, segs: any, kind: any, rhs: any): any;
|
|
259
|
+
export declare function __vmzWritePath(inst: any, root: any, segs: any, value: any): any;
|
|
260
|
+
/**
|
|
261
|
+
* Array-item leaf write without segs array alloc (`rows[i].label = v`).
|
|
262
|
+
* @param {any} inst
|
|
263
|
+
* @param {string} root
|
|
264
|
+
* @param {string|number} idx
|
|
265
|
+
* @param {string} leaf
|
|
266
|
+
* @param {any} value
|
|
267
|
+
*/
|
|
268
|
+
export declare function __vmzWritePathItem(inst: any, root: any, idx: any, leaf: any, value: any): any;
|
|
269
|
+
/**
|
|
270
|
+
* In-place two-index swap on an owned list field (WriteBarrier Slice 5).
|
|
271
|
+
* Prefers eachBlock O(1) DOM transpose hook; otherwise schedules a list replace.
|
|
272
|
+
* @param {any} inst
|
|
273
|
+
* @param {string} root
|
|
274
|
+
* @param {number|string} ia
|
|
275
|
+
* @param {number|string} ib
|
|
276
|
+
*/
|
|
277
|
+
export declare function __vmzListTranspose(inst: any, root: any, ia: any, ib: any): void;
|
|
278
|
+
/**
|
|
279
|
+
* Compound leaf write (`rows[i].label += x`) — one item touch, no separate ReadPath.
|
|
280
|
+
* @param {any} inst
|
|
281
|
+
* @param {string} root
|
|
282
|
+
* @param {string[]} segs
|
|
283
|
+
* @param {string} op
|
|
284
|
+
* @param {any} rhs
|
|
285
|
+
*/
|
|
286
|
+
export declare function __vmzWritePathCompound(inst: any, root: any, segs: any, op: any, rhs: any): any;
|
|
287
|
+
/**
|
|
288
|
+
* Array-item compound without segs array alloc (`rows[i].label += x`).
|
|
289
|
+
* @param {any} inst
|
|
290
|
+
* @param {string} root
|
|
291
|
+
* @param {string|number} idx
|
|
292
|
+
* @param {string} leaf
|
|
293
|
+
* @param {string} op
|
|
294
|
+
* @param {any} rhs
|
|
295
|
+
*/
|
|
296
|
+
export declare function __vmzWritePathCompoundItem(inst: any, root: any, idx: any, leaf: any, op: any, rhs: any): any;
|
|
297
|
+
/**
|
|
298
|
+
* Stride compound over an owned array (`for (i=start; i<n; i+=step) arr[i].leaf op= rhs`).
|
|
299
|
+
* Mutates + applies DOM in one pass when eachBlock leaf hook is installed (update-every-Nth).
|
|
300
|
+
* @param {any} inst
|
|
301
|
+
* @param {string} root
|
|
302
|
+
* @param {string} leaf
|
|
303
|
+
* @param {string} op
|
|
304
|
+
* @param {any} rhs
|
|
305
|
+
* @param {number|string} start
|
|
306
|
+
* @param {number|string} step
|
|
307
|
+
*/
|
|
308
|
+
export declare function __vmzArrayItemCompoundStride(inst: any, root: any, leaf: any, op: any, rhs: any, start: any, step: any): void;
|
|
309
|
+
/**
|
|
310
|
+
* Compiler-inserted array mutator barrier (push/pop/splice/…).
|
|
311
|
+
* Applies the mutator on the plain array and schedules a structural notice
|
|
312
|
+
* at `root` + `baseSegs` (empty baseSegs → field replace).
|
|
313
|
+
*
|
|
314
|
+
* @param {any} inst
|
|
315
|
+
* @param {string} root
|
|
316
|
+
* @param {string[]} baseSegs
|
|
317
|
+
* @param {string} method
|
|
318
|
+
* @param {any[]} args
|
|
319
|
+
*/
|
|
320
|
+
export declare function __vmzArrayMutate(inst: any, root: any, baseSegs: any, method: any, args: any): any;
|
|
321
|
+
/**
|
|
322
|
+
* WriteBarrier: true when value is an owned plain object with path barriers (no Proxy).
|
|
323
|
+
* @param {any} value
|
|
324
|
+
*/
|
|
325
|
+
export declare function __vmzIsWriteBarrierOwned(value: any): boolean;
|
|
326
|
+
/**
|
|
327
|
+
* True when value is the Proxy wrapper from array (or residual) reactive wrap.
|
|
328
|
+
* @param {any} value
|
|
329
|
+
*/
|
|
330
|
+
export declare function __vmzIsReactiveProxy(value: any): boolean;
|
|
331
|
+
/** @param {object} inst */
|
|
332
|
+
export declare function flushPending(inst: any): any;
|
|
333
|
+
/**
|
|
334
|
+
* True when the container already has meaningful DOM (SSR / resume shell).
|
|
335
|
+
* @param {Element} el
|
|
336
|
+
*/
|
|
337
|
+
export declare function hasMeaningfulChild(el: any): boolean;
|