@vmz/core 0.1.31 → 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.
- package/dist/{client-nav.d.ts → browser/client-nav.d.ts} +4 -13
- package/dist/{client-nav.js → browser/client-nav.js} +16 -74
- package/dist/browser/direct-api.types.d.ts +58 -0
- package/dist/browser/direct-api.types.js +4 -0
- package/dist/browser/direct-host-box.d.ts +11 -0
- package/dist/{direct-host-box.js → browser/direct-host-box.js} +2 -18
- package/dist/browser/dom-core.d.ts +246 -0
- package/dist/browser/dom-core.js +2453 -0
- package/dist/browser/dom-core.types.d.ts +138 -0
- package/dist/browser/dom-core.types.js +4 -0
- package/dist/{position-context.js → browser/position-context.js} +1 -1
- package/dist/browser/unknown-component.d.ts +14 -0
- package/dist/{unknown-component.js → browser/unknown-component.js} +4 -28
- package/dist/{dom.browser.d.ts → faces/dom.browser.d.ts} +2 -2
- package/dist/{dom.browser.js → faces/dom.browser.js} +2 -3
- package/dist/faces/dom.client.d.ts +4 -0
- package/dist/faces/dom.client.js +4 -0
- package/dist/faces/dom.d.ts +6 -0
- package/dist/faces/dom.js +6 -0
- package/dist/{http.d.ts → faces/http.d.ts} +1 -1
- package/dist/{http.js → faces/http.js} +1 -2
- package/dist/{server.d.ts → faces/server.d.ts} +8 -25
- package/dist/{server.js → faces/server.js} +25 -155
- package/dist/{vmz-dom.d.ts → faces/vmz-dom.d.ts} +1 -1
- package/dist/{vmz-dom.js → faces/vmz-dom.js} +1 -2
- package/dist/{vmz-runtime.d.ts → faces/vmz-runtime.d.ts} +1 -1
- package/dist/{vmz-runtime.js → faces/vmz-runtime.js} +1 -2
- package/dist/host/deployment-registry.d.ts +16 -0
- package/dist/{deployment-registry.js → host/deployment-registry.js} +1 -68
- package/dist/host/list-client-components.d.ts +14 -0
- package/dist/{list-client-components.js → host/list-client-components.js} +0 -37
- package/dist/{localize-body-links.js → host/localize-body-links.js} +0 -1
- package/dist/host/native-addon.d.ts +6 -0
- package/dist/{native-addon.js → host/native-addon.js} +0 -20
- package/dist/host/render-host.d.ts +20 -0
- package/dist/{render-host.js → host/render-host.js} +0 -16
- package/dist/{serve-host.d.ts → host/serve-host.d.ts} +3 -3
- package/dist/{serve-host.mjs → host/serve-host.mjs} +47 -185
- package/dist/shared/host.types.d.ts +67 -0
- package/dist/shared/host.types.js +4 -0
- package/dist/shared/server.types.d.ts +39 -0
- package/dist/shared/server.types.js +4 -0
- package/dist/{dom-ssr.d.ts → ssr/dom-ssr.d.ts} +8 -37
- package/dist/{dom-ssr.js → ssr/dom-ssr.js} +162 -219
- package/package.json +34 -34
- package/dist/deployment-registry.d.ts +0 -70
- package/dist/direct-host-box.d.ts +0 -26
- package/dist/dom-core.d.ts +0 -402
- package/dist/dom-core.js +0 -4813
- package/dist/dom.client.d.ts +0 -4
- package/dist/dom.client.js +0 -5
- package/dist/dom.d.ts +0 -6
- package/dist/dom.js +0 -7
- package/dist/list-client-components.d.ts +0 -62
- package/dist/native-addon.d.ts +0 -12
- package/dist/render-host.d.ts +0 -32
- package/dist/unknown-component.d.ts +0 -40
- /package/dist/{position-context.d.ts → browser/position-context.d.ts} +0 -0
- /package/dist/{index.d.ts → faces/index.d.ts} +0 -0
- /package/dist/{index.js → faces/index.js} +0 -0
- /package/dist/{localize-body-links.d.ts → host/localize-body-links.d.ts} +0 -0
- /package/dist/{route-layout-chain.d.ts → host/route-layout-chain.d.ts} +0 -0
- /package/dist/{route-layout-chain.js → host/route-layout-chain.js} +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared host / Node runtime types for `@vmz/core`.
|
|
3
|
+
*/
|
|
4
|
+
import type { ServerResponse } from 'node:http';
|
|
5
|
+
export type ComponentEntry = {
|
|
6
|
+
chunkId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
entry: string;
|
|
9
|
+
source?: string;
|
|
10
|
+
};
|
|
11
|
+
export type HostRequestOpts = {
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
searchParams?: URLSearchParams;
|
|
14
|
+
cookieHeader?: string;
|
|
15
|
+
method?: string;
|
|
16
|
+
body?: unknown;
|
|
17
|
+
};
|
|
18
|
+
export type LocaleHostCtx = {
|
|
19
|
+
localeId?: string;
|
|
20
|
+
dir?: string;
|
|
21
|
+
alternates?: unknown;
|
|
22
|
+
};
|
|
23
|
+
export type ClosedAccessResult = {
|
|
24
|
+
kind: 'allow';
|
|
25
|
+
props?: Record<string, unknown>;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'redirect';
|
|
28
|
+
location: string;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'deny';
|
|
31
|
+
} | {
|
|
32
|
+
kind: 'not-found';
|
|
33
|
+
};
|
|
34
|
+
export type SseClient = Pick<ServerResponse, 'write' | 'end'>;
|
|
35
|
+
export type DeploymentDocument = Record<string, unknown>;
|
|
36
|
+
export type ComponentRegistryMap = Record<string, unknown>;
|
|
37
|
+
export type LoadComponentEntriesOpts = {
|
|
38
|
+
strict?: boolean;
|
|
39
|
+
closureRoots?: string[];
|
|
40
|
+
explicit?: Record<string, string>;
|
|
41
|
+
};
|
|
42
|
+
export type DedupeComponentEntriesOpts = {
|
|
43
|
+
strict?: boolean;
|
|
44
|
+
};
|
|
45
|
+
export type ImportComponentEntriesOpts = {
|
|
46
|
+
cacheBust?: string | number;
|
|
47
|
+
loaded?: Set<string>;
|
|
48
|
+
};
|
|
49
|
+
export type BootstrapComponentRegistryOpts = LoadComponentEntriesOpts & ImportComponentEntriesOpts & {
|
|
50
|
+
preload?: 'all' | 'closure' | 'none';
|
|
51
|
+
};
|
|
52
|
+
export type ClientComponentListEntry = {
|
|
53
|
+
name: string;
|
|
54
|
+
entry: string;
|
|
55
|
+
chunkId?: string;
|
|
56
|
+
};
|
|
57
|
+
export type ListClientComponentsOpts = {
|
|
58
|
+
strict?: boolean;
|
|
59
|
+
};
|
|
60
|
+
export type PreloadComponentRegistryOpts = ListClientComponentsOpts & {
|
|
61
|
+
cacheBust?: string | number;
|
|
62
|
+
include?: (entry: ClientComponentListEntry) => boolean;
|
|
63
|
+
explicit?: Record<string, string>;
|
|
64
|
+
closureRoots?: string[];
|
|
65
|
+
preload?: 'all' | 'closure' | 'none';
|
|
66
|
+
};
|
|
67
|
+
export type NativeAddon = Record<string, unknown>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for `@vmz/core` server / RPC runtime (`faces/server.ts`).
|
|
3
|
+
*/
|
|
4
|
+
import type { IncomingMessage } from 'node:http';
|
|
5
|
+
export type RpcRequest = {
|
|
6
|
+
moduleId: string;
|
|
7
|
+
method: string;
|
|
8
|
+
args?: unknown[];
|
|
9
|
+
};
|
|
10
|
+
export type Route = {
|
|
11
|
+
verb: string;
|
|
12
|
+
path: string;
|
|
13
|
+
moduleId: string;
|
|
14
|
+
method: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
};
|
|
17
|
+
export type PageStreamResult = AsyncIterable<string> | {
|
|
18
|
+
status?: number;
|
|
19
|
+
stream?: AsyncIterable<string>;
|
|
20
|
+
redirect?: string;
|
|
21
|
+
headers?: Record<string, string>;
|
|
22
|
+
} | null;
|
|
23
|
+
export type NodeRequestOptions = {
|
|
24
|
+
distDir?: string;
|
|
25
|
+
renderIndex?: () => Promise<string> | string;
|
|
26
|
+
renderIndexStream?: (opts?: {
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
}) => AsyncIterable<string>;
|
|
29
|
+
renderPage?: (pathname: string) => Promise<string | null> | string | null;
|
|
30
|
+
renderPageStream?: (pathname: string, opts?: {
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
searchParams?: URLSearchParams;
|
|
33
|
+
cookieHeader?: string;
|
|
34
|
+
method?: string;
|
|
35
|
+
body?: unknown;
|
|
36
|
+
}) => Promise<PageStreamResult> | PageStreamResult;
|
|
37
|
+
req?: IncomingMessage;
|
|
38
|
+
};
|
|
39
|
+
export type ServerModuleResolver = (id: string) => string | URL;
|
|
@@ -1,76 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* VMZ DOM SSR / hydrate / resume
|
|
2
|
+
* VMZ DOM SSR / hydrate / resume ??precise patches, no VDOM diff.
|
|
3
3
|
* Imports client DOM primitives from ./dom-core.js for tree-shakeable browser entry.
|
|
4
4
|
*/
|
|
5
|
-
import { findOwnedDefaultSlot } from '
|
|
6
|
-
export declare function renderToString(Component: any, props?:
|
|
5
|
+
import { findOwnedDefaultSlot } from '../browser/dom-core.js';
|
|
6
|
+
export declare function renderToString(Component: any, props?: any, opts?: any): Promise<any>;
|
|
7
7
|
/**
|
|
8
8
|
* Stream SSR via the same Direct serialize schedule as `renderToString`.
|
|
9
|
-
* Yields HTML chunks (open tag
|
|
9
|
+
* Yields HTML chunks (open tag ??children ??close). Joining chunks equals `renderToString`.
|
|
10
10
|
* Supports AbortSignal for cancel; consumers should respect backpressure (await between chunks).
|
|
11
|
-
* @param {new (props?: object) => any} Component
|
|
12
|
-
* @param {object} [props]
|
|
13
|
-
* @param {{ signal?: AbortSignal, slotHtml?: string }} [opts]
|
|
14
|
-
* @returns {AsyncGenerator<string, void, void>}
|
|
15
11
|
*/
|
|
16
|
-
export declare function renderToStream(Component: any, props?:
|
|
12
|
+
export declare function renderToStream(Component: any, props?: any, opts?: any): AsyncGenerator<any, void, unknown>;
|
|
17
13
|
/**
|
|
18
14
|
* Live-DOM counterpart: first default `<slot>` owned by this tree, not by a nested
|
|
19
15
|
* `[data-vmz]` component (Button/Link labels, etc.).
|
|
20
16
|
* Re-exported from dom-core (single implementation).
|
|
21
|
-
* @param {Element | null | undefined} root
|
|
22
|
-
* @returns {Element | null}
|
|
23
17
|
*/
|
|
24
18
|
export { findOwnedDefaultSlot };
|
|
25
19
|
/**
|
|
26
|
-
* Hydrate/mount a file-route page inside an optional layout chain (outer
|
|
20
|
+
* Hydrate/mount a file-route page inside an optional layout chain (outer ??inner).
|
|
27
21
|
* Mirrors SSR `slotHtml` wrapping: each layout's owned default slot becomes the
|
|
28
22
|
* outlet for the next layout or the page. Retains layout instances on `container`
|
|
29
23
|
* so SPA transitions can dispose only the page host.
|
|
30
|
-
* @param {new (props?: object) => any} Page
|
|
31
|
-
* @param {Element} container
|
|
32
|
-
* @param {object} [props]
|
|
33
|
-
* @param {Array<new (props?: object) => any>} [layoutCtors] outer → inner
|
|
34
|
-
* @param {{ preserveState?: boolean | Record<string, unknown>, skipOnMount?: boolean }} [opts]
|
|
35
24
|
*/
|
|
36
25
|
export declare function hydrateRoute(Page: any, container: any, props?: {}, layoutCtors?: any[], opts?: {}): Promise<any>;
|
|
37
26
|
/**
|
|
38
27
|
* SPA same-layout transition: dispose only the page host, keep layout instances.
|
|
39
28
|
* Callers must verify `data-vmz-layout` is unchanged before using this.
|
|
40
|
-
* @param {new (props?: object) => any} Page
|
|
41
|
-
* @param {Element} container `#app` that already has `__vmzPageHost` / `__vmzLayoutInsts`
|
|
42
|
-
* @param {object} [props]
|
|
43
|
-
* @param {{ preserveState?: boolean | Record<string, unknown>, skipOnMount?: boolean }} [opts]
|
|
44
29
|
*/
|
|
45
|
-
export declare function hydrateRoutePage(Page: any, container: any, props?:
|
|
30
|
+
export declare function hydrateRoutePage(Page: any, container: any, props?: any, opts?: any): Promise<any>;
|
|
46
31
|
/**
|
|
47
32
|
* resume: attach to existing Island DOM without re-running construct structure or onMount.
|
|
48
33
|
* Consumes ResumeEntry product (`data-vmz-resume`) derived from the same Execution Plan.
|
|
49
|
-
* @param {new (props?: object) => any} Component
|
|
50
|
-
* @param {HTMLElement} container
|
|
51
|
-
* @param {{ props?: object, state?: Record<string, unknown>, strategy?: string } | null} [slice]
|
|
52
34
|
*/
|
|
53
35
|
export declare function resume(Component: any, container: any, slice?: any): Promise<any>;
|
|
54
36
|
/**
|
|
55
37
|
* Resume all `[data-vmz-island]` hosts (prefer ResumeEntry / EventEntry over mount).
|
|
56
38
|
* Event strategy islands wait for the DOM event before attach (lazy EventEntry).
|
|
57
|
-
* @param {ParentNode} [root]
|
|
58
39
|
*/
|
|
59
40
|
export declare function resumeIslands(root?: Document): void;
|
|
60
41
|
/**
|
|
61
42
|
* EventEntry attach: only wire `client:event` / `client:event:*` islands.
|
|
62
43
|
* Idle/load/visible ResumeEntries are left alone (static shell can defer framework work).
|
|
63
|
-
* @param {ParentNode} [root]
|
|
64
44
|
*/
|
|
65
45
|
export declare function attachEventEntries(root?: Document): void;
|
|
66
|
-
|
|
67
|
-
* @param {new (props?: object) => any} Component
|
|
68
|
-
* @param {HTMLElement} container
|
|
69
|
-
* @param {object} [props]
|
|
70
|
-
* @param {{ preserveState?: boolean | Record<string, unknown>, skipOnMount?: boolean }} [opts]
|
|
71
|
-
*/
|
|
72
|
-
export declare function hydrate(Component: any, container: any, props?: {}, opts?: {}): Promise<any>;
|
|
73
|
-
/**
|
|
74
|
-
* @param {ParentNode} [root]
|
|
75
|
-
*/
|
|
46
|
+
export declare function hydrate(Component: any, container: any, props?: any, opts?: any): Promise<any>;
|
|
76
47
|
export declare function hydrateIslands(root?: Document): void;
|