@vidact/runtime 0.2.0-beta.0 → 0.2.0-beta.4
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/CHANGELOG.md +37 -0
- package/README.md +1 -1
- package/dist/actions.d.ts +32 -30
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +251 -266
- package/dist/actions.js.map +1 -1
- package/dist/async.d.ts +20 -17
- package/dist/async.d.ts.map +1 -1
- package/dist/async.js +18 -17
- package/dist/async.js.map +1 -1
- package/dist/compiled/async-resource.d.ts +9 -6
- package/dist/compiled/async-resource.d.ts.map +1 -1
- package/dist/compiled/async-resource.js +69 -77
- package/dist/compiled/async-resource.js.map +1 -1
- package/dist/compiled/core.d.ts +136 -147
- package/dist/compiled/core.d.ts.map +1 -1
- package/dist/compiled/core.js +2669 -2985
- package/dist/compiled/core.js.map +1 -1
- package/dist/compiled/types.d.ts +44 -56
- package/dist/compiled/types.d.ts.map +1 -1
- package/dist/compiled/types.js +10 -6
- package/dist/compiled/types.js.map +1 -1
- package/dist/compiled/validation.d.ts +4 -1
- package/dist/compiled/validation.d.ts.map +1 -1
- package/dist/compiled/validation.js +17 -20
- package/dist/compiled/validation.js.map +1 -1
- package/dist/component-spread.d.ts +5 -3
- package/dist/component-spread.d.ts.map +1 -1
- package/dist/component-spread.js +49 -67
- package/dist/component-spread.js.map +1 -1
- package/dist/concurrent.d.ts +20 -18
- package/dist/concurrent.d.ts.map +1 -1
- package/dist/concurrent.js +191 -210
- package/dist/concurrent.js.map +1 -1
- package/dist/direct-dom.d.ts +17 -12
- package/dist/direct-dom.d.ts.map +1 -1
- package/dist/direct-dom.js +187 -221
- package/dist/direct-dom.js.map +1 -1
- package/dist/dom/attributes.d.ts +9 -6
- package/dist/dom/attributes.d.ts.map +1 -1
- package/dist/dom/attributes.js +65 -47
- package/dist/dom/attributes.js.map +1 -1
- package/dist/dom/events.d.ts +5 -2
- package/dist/dom/events.d.ts.map +1 -1
- package/dist/dom/events.js +53 -65
- package/dist/dom/events.js.map +1 -1
- package/dist/dom/forms.d.ts +9 -6
- package/dist/dom/forms.d.ts.map +1 -1
- package/dist/dom/forms.js +152 -198
- package/dist/dom/forms.js.map +1 -1
- package/dist/dom/intrinsic.d.ts +17 -15
- package/dist/dom/intrinsic.d.ts.map +1 -1
- package/dist/dom/intrinsic.js +48 -50
- package/dist/dom/intrinsic.js.map +1 -1
- package/dist/dom/namespace.d.ts +4 -1
- package/dist/dom/namespace.d.ts.map +1 -1
- package/dist/dom/namespace.js +25 -28
- package/dist/dom/namespace.js.map +1 -1
- package/dist/dom/namespaces.d.ts +11 -8
- package/dist/dom/namespaces.d.ts.map +1 -1
- package/dist/dom/namespaces.js +14 -12
- package/dist/dom/namespaces.js.map +1 -1
- package/dist/dom/properties.d.ts +18 -16
- package/dist/dom/properties.d.ts.map +1 -1
- package/dist/dom/properties.js +273 -296
- package/dist/dom/properties.js.map +1 -1
- package/dist/dom/style-properties.d.ts +4 -1
- package/dist/dom/style-properties.d.ts.map +1 -1
- package/dist/dom/style-properties.js +49 -45
- package/dist/dom/style-properties.js.map +1 -1
- package/dist/dom/styles.d.ts +5 -2
- package/dist/dom/styles.d.ts.map +1 -1
- package/dist/dom/styles.js +47 -67
- package/dist/dom/styles.js.map +1 -1
- package/dist/dom-forms.d.ts +4 -1
- package/dist/dom-forms.d.ts.map +1 -1
- package/dist/dom-forms.js +16 -13
- package/dist/dom-forms.js.map +1 -1
- package/dist/dom-styles.d.ts +4 -1
- package/dist/dom-styles.d.ts.map +1 -1
- package/dist/dom-styles.js +10 -7
- package/dist/dom-styles.js.map +1 -1
- package/dist/framework-hydrate.d.ts +20 -17
- package/dist/framework-hydrate.d.ts.map +1 -1
- package/dist/framework-hydrate.js +128 -146
- package/dist/framework-hydrate.js.map +1 -1
- package/dist/framework-protocol.d.ts +27 -25
- package/dist/framework-protocol.d.ts.map +1 -1
- package/dist/framework-protocol.js +173 -211
- package/dist/framework-protocol.js.map +1 -1
- package/dist/framework.d.ts +34 -32
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +74 -93
- package/dist/framework.js.map +1 -1
- package/dist/hydrate.d.ts +11 -8
- package/dist/hydrate.d.ts.map +1 -1
- package/dist/hydrate.js +13 -9
- package/dist/hydrate.js.map +1 -1
- package/dist/hydration-bridge.d.ts +61 -58
- package/dist/hydration-bridge.d.ts.map +1 -1
- package/dist/hydration-bridge.js +67 -66
- package/dist/hydration-bridge.js.map +1 -1
- package/dist/hydration.d.ts +31 -28
- package/dist/hydration.d.ts.map +1 -1
- package/dist/hydration.js +376 -462
- package/dist/hydration.js.map +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.js +11 -13
- package/dist/indexed-list.d.ts +8 -5
- package/dist/indexed-list.d.ts.map +1 -1
- package/dist/indexed-list.js +14 -7
- package/dist/indexed-list.js.map +1 -1
- package/dist/jsx-runtime.d.ts +10 -8
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx-runtime.js +28 -23
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/keyed-list.d.ts +13 -14
- package/dist/keyed-list.d.ts.map +1 -1
- package/dist/keyed-list.js +132 -160
- package/dist/keyed-list.js.map +1 -1
- package/dist/metadata.d.ts +6 -3
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +131 -164
- package/dist/metadata.js.map +1 -1
- package/dist/nested-prop.d.ts +4 -2
- package/dist/nested-prop.d.ts.map +1 -1
- package/dist/nested-prop.js +17 -16
- package/dist/nested-prop.js.map +1 -1
- package/dist/profiling.d.ts +11 -8
- package/dist/profiling.d.ts.map +1 -1
- package/dist/profiling.js +17 -17
- package/dist/profiling.js.map +1 -1
- package/dist/protocol.d.ts +5 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +8 -5
- package/dist/protocol.js.map +1 -1
- package/dist/raw-html.d.ts +5 -2
- package/dist/raw-html.d.ts.map +1 -1
- package/dist/raw-html.js +86 -146
- package/dist/raw-html.js.map +1 -1
- package/dist/ref.d.ts +8 -3
- package/dist/ref.d.ts.map +1 -1
- package/dist/ref.js +10 -2
- package/dist/ref.js.map +1 -1
- package/dist/renderable-protocol.d.ts +26 -8
- package/dist/renderable-protocol.d.ts.map +1 -1
- package/dist/renderable-protocol.js +30 -9
- package/dist/renderable-protocol.js.map +1 -1
- package/dist/renderable.d.ts +27 -22
- package/dist/renderable.d.ts.map +1 -1
- package/dist/renderable.js +141 -133
- package/dist/renderable.js.map +1 -1
- package/dist/retained-ui.d.ts +9 -6
- package/dist/retained-ui.d.ts.map +1 -1
- package/dist/retained-ui.js +12 -10
- package/dist/retained-ui.js.map +1 -1
- package/dist/root.d.ts +18 -15
- package/dist/root.d.ts.map +1 -1
- package/dist/root.js +73 -85
- package/dist/root.js.map +1 -1
- package/dist/scheduler.d.ts +10 -8
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/scheduler.js +97 -105
- package/dist/scheduler.js.map +1 -1
- package/dist/server-framework.d.ts +45 -42
- package/dist/server-framework.d.ts.map +1 -1
- package/dist/server-framework.js +209 -217
- package/dist/server-framework.js.map +1 -1
- package/dist/server.d.ts +130 -128
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +592 -706
- package/dist/server.js.map +1 -1
- package/dist/shared/promise.d.ts +6 -3
- package/dist/shared/promise.d.ts.map +1 -1
- package/dist/shared/promise.js +21 -19
- package/dist/shared/promise.js.map +1 -1
- package/dist/source-mask.d.ts +9 -6
- package/dist/source-mask.d.ts.map +1 -1
- package/dist/source-mask.js +45 -63
- package/dist/source-mask.js.map +1 -1
- package/dist/spread.d.ts +5 -2
- package/dist/spread.d.ts.map +1 -1
- package/dist/spread.js +79 -99
- package/dist/spread.js.map +1 -1
- package/dist/state-slot.d.ts +18 -15
- package/dist/state-slot.d.ts.map +1 -1
- package/dist/state-slot.js +43 -42
- package/dist/state-slot.js.map +1 -1
- package/dist/testing.d.ts +9 -6
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +16 -12
- package/dist/testing.js.map +1 -1
- package/package.json +8 -7
- package/src/actions.ts +415 -0
- package/src/async.ts +78 -0
- package/src/compiled/async-resource.ts +113 -0
- package/src/compiled/core.ts +4026 -0
- package/src/compiled/types.ts +96 -0
- package/src/compiled/validation.ts +23 -0
- package/src/component-spread.ts +86 -0
- package/src/concurrent.ts +310 -0
- package/src/direct-dom.ts +365 -0
- package/src/dom/attributes.ts +55 -0
- package/src/dom/events.ts +93 -0
- package/src/dom/forms.ts +220 -0
- package/src/dom/intrinsic.ts +94 -0
- package/src/dom/namespace.ts +30 -0
- package/src/dom/namespaces.ts +14 -0
- package/src/dom/properties.ts +355 -0
- package/src/dom/style-properties.ts +46 -0
- package/src/dom/styles.ts +86 -0
- package/src/dom-forms.ts +23 -0
- package/src/dom-styles.ts +11 -0
- package/src/env.d.ts +6 -0
- package/src/framework-hydrate.ts +224 -0
- package/src/framework-protocol.ts +335 -0
- package/src/framework.ts +161 -0
- package/src/hydrate.ts +38 -0
- package/src/hydration-bridge.ts +183 -0
- package/src/hydration.ts +556 -0
- package/src/index.ts +92 -0
- package/src/indexed-list.ts +20 -0
- package/src/jsx-runtime.ts +55 -0
- package/src/keyed-list.ts +233 -0
- package/src/metadata.ts +212 -0
- package/src/nested-prop.ts +27 -0
- package/src/profiling.ts +43 -0
- package/src/protocol.ts +8 -0
- package/src/raw-html.ts +206 -0
- package/src/ref.ts +13 -0
- package/src/renderable-protocol.ts +63 -0
- package/src/renderable.ts +283 -0
- package/src/retained-ui.ts +19 -0
- package/src/root.ts +122 -0
- package/src/scheduler.ts +136 -0
- package/src/server-framework.ts +397 -0
- package/src/server.ts +1143 -0
- package/src/shared/promise.ts +28 -0
- package/src/source-mask.ts +83 -0
- package/src/spread.ts +131 -0
- package/src/state-slot.ts +76 -0
- package/src/testing.ts +27 -0
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -1,165 +1,147 @@
|
|
|
1
|
-
import { decodeFrameworkValue, isClientReference
|
|
2
|
-
import { isClientBoundaryDefinition } from
|
|
3
|
-
import { installHydration } from
|
|
4
|
-
import { hydrateRoot } from
|
|
1
|
+
import { decodeFrameworkValue, isClientReference } from "./framework-protocol.js";
|
|
2
|
+
import { isClientBoundaryDefinition } from "./framework.js";
|
|
3
|
+
import { installHydration } from "./hydration.js";
|
|
4
|
+
import { hydrateRoot } from "./root.js";
|
|
5
|
+
//#region src/framework-hydrate.ts
|
|
5
6
|
installHydration();
|
|
6
|
-
const DEFAULT_REPLAY_EVENTS = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
target.dispatchEvent(new Event(record.type, { bubbles: record.bubbles, cancelable: record.cancelable }));
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
size: () => records.length,
|
|
58
|
-
};
|
|
7
|
+
const DEFAULT_REPLAY_EVENTS = [
|
|
8
|
+
"click",
|
|
9
|
+
"input",
|
|
10
|
+
"change",
|
|
11
|
+
"submit"
|
|
12
|
+
];
|
|
13
|
+
function createEventReplayQueue(host, events = DEFAULT_REPLAY_EVENTS) {
|
|
14
|
+
const records = [];
|
|
15
|
+
let disposed = false;
|
|
16
|
+
const capture = (event) => {
|
|
17
|
+
const target = event.target;
|
|
18
|
+
if (!(target instanceof Node)) return;
|
|
19
|
+
const path = nodePath(host, target);
|
|
20
|
+
if (path === void 0) return;
|
|
21
|
+
if (event.type === "submit") event.preventDefault();
|
|
22
|
+
records.push({
|
|
23
|
+
type: event.type,
|
|
24
|
+
path,
|
|
25
|
+
bubbles: event.bubbles,
|
|
26
|
+
cancelable: event.cancelable,
|
|
27
|
+
...target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement ? { value: target.value } : {},
|
|
28
|
+
...target instanceof HTMLInputElement ? { checked: target.checked } : {}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
for (const event of events) host.addEventListener(event, capture, true);
|
|
32
|
+
const dispose = () => {
|
|
33
|
+
if (disposed) return;
|
|
34
|
+
disposed = true;
|
|
35
|
+
for (const event of events) host.removeEventListener(event, capture, true);
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
dispose,
|
|
39
|
+
replay() {
|
|
40
|
+
dispose();
|
|
41
|
+
for (const record of records.splice(0)) {
|
|
42
|
+
const target = resolveNodePath(host, record.path);
|
|
43
|
+
if (!(target instanceof Element)) continue;
|
|
44
|
+
if (record.value !== void 0 && (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement)) target.value = record.value;
|
|
45
|
+
if (record.checked !== void 0 && target instanceof HTMLInputElement) target.checked = record.checked;
|
|
46
|
+
target.dispatchEvent(new Event(record.type, {
|
|
47
|
+
bubbles: record.bubbles,
|
|
48
|
+
cancelable: record.cancelable
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
size: () => records.length
|
|
53
|
+
};
|
|
59
54
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
55
|
+
function hydrateFrameworkBoundary(host, application, options) {
|
|
56
|
+
try {
|
|
57
|
+
const root = hydrateRoot(host, application, options);
|
|
58
|
+
options?.replay?.replay();
|
|
59
|
+
return root;
|
|
60
|
+
} catch (error) {
|
|
61
|
+
options?.replay?.dispose();
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
70
64
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const applications = await Promise.all(payloads.map((payload) => prepareClientBoundary(nextLoader, payload)));
|
|
102
|
-
for (const [index, compiledRoot] of roots.entries()) {
|
|
103
|
-
compiledRoot.replace(applications[index]);
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
};
|
|
65
|
+
async function hydrateClientBoundaries(root, loadModule, options) {
|
|
66
|
+
const hosts = clientBoundaryHosts(root);
|
|
67
|
+
const payloads = hosts.map(readClientBoundaryPayload);
|
|
68
|
+
const replays = hosts.map((host) => createEventReplayQueue(host));
|
|
69
|
+
const roots = [];
|
|
70
|
+
try {
|
|
71
|
+
const applications = await Promise.all(payloads.map((payload) => prepareClientBoundary(loadModule, payload)));
|
|
72
|
+
for (const [index, host] of hosts.entries()) {
|
|
73
|
+
const identifierPrefix = host.getAttribute("data-vidact-identifier-prefix") ?? "";
|
|
74
|
+
roots[index] = hydrateFrameworkBoundary(host, applications[index], {
|
|
75
|
+
...options,
|
|
76
|
+
identifierPrefix,
|
|
77
|
+
replay: replays[index]
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
for (const replay of replays) replay.dispose();
|
|
82
|
+
for (const compiledRoot of roots) compiledRoot?.unmount();
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
roots,
|
|
87
|
+
dispose() {
|
|
88
|
+
for (const compiledRoot of roots) compiledRoot.unmount();
|
|
89
|
+
},
|
|
90
|
+
async replace(nextLoader = loadModule) {
|
|
91
|
+
const applications = await Promise.all(payloads.map((payload) => prepareClientBoundary(nextLoader, payload)));
|
|
92
|
+
for (const [index, compiledRoot] of roots.entries()) compiledRoot.replace(applications[index]);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
107
95
|
}
|
|
108
96
|
async function prepareClientBoundary(loadModule, { reference, props }) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
97
|
+
const definition = await loadClientBoundary(loadModule, reference);
|
|
98
|
+
const prepared = await definition.prepare?.(props);
|
|
99
|
+
return () => definition.render(props, prepared);
|
|
112
100
|
}
|
|
113
101
|
async function loadClientBoundary(loadModule, reference) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
throw new TypeError(`client module ${reference.id} does not export Vidact boundary ${reference.exportName}`);
|
|
118
|
-
}
|
|
119
|
-
return definition;
|
|
102
|
+
const definition = (await loadModule(reference))[reference.exportName];
|
|
103
|
+
if (!isClientBoundaryDefinition(definition)) throw new TypeError(`client module ${reference.id} does not export Vidact boundary ${reference.exportName}`);
|
|
104
|
+
return definition;
|
|
120
105
|
}
|
|
121
106
|
function clientBoundaryHosts(root) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
? [root, ...descendants]
|
|
126
|
-
: descendants;
|
|
107
|
+
const selector = "[data-vidact-client-boundary][data-vidact-client-payload]";
|
|
108
|
+
const descendants = [...root.querySelectorAll(selector)];
|
|
109
|
+
return root instanceof HTMLElement && root.matches(selector) ? [root, ...descendants] : descendants;
|
|
127
110
|
}
|
|
128
111
|
function readClientBoundaryPayload(host) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
return { reference: payload.reference, props: payload.props };
|
|
112
|
+
const encoded = host.getAttribute("data-vidact-client-payload");
|
|
113
|
+
if (encoded === null) throw new TypeError("client boundary payload is missing");
|
|
114
|
+
const payload = decodeFrameworkValue(encoded);
|
|
115
|
+
if (!isRecord(payload) || !Object.hasOwn(payload, "props") || !isClientReference(payload.reference)) throw new TypeError("invalid Vidact client boundary payload");
|
|
116
|
+
return {
|
|
117
|
+
reference: payload.reference,
|
|
118
|
+
props: payload.props
|
|
119
|
+
};
|
|
139
120
|
}
|
|
140
121
|
function isRecord(value) {
|
|
141
|
-
|
|
122
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
142
123
|
}
|
|
143
124
|
function nodePath(root, node) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return current === root ? path.toReversed() : undefined;
|
|
125
|
+
const path = [];
|
|
126
|
+
let current = node;
|
|
127
|
+
while (current !== null && current !== root) {
|
|
128
|
+
const parentNode = current.parentNode;
|
|
129
|
+
if (parentNode === null) return void 0;
|
|
130
|
+
path.push(Array.prototype.indexOf.call(parentNode.childNodes, current));
|
|
131
|
+
current = parentNode;
|
|
132
|
+
}
|
|
133
|
+
return current === root ? path.toReversed() : void 0;
|
|
154
134
|
}
|
|
155
135
|
function resolveNodePath(root, path) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return current;
|
|
136
|
+
let current = root;
|
|
137
|
+
for (const index of path) {
|
|
138
|
+
const next = current.childNodes[index];
|
|
139
|
+
if (next === void 0) return void 0;
|
|
140
|
+
current = next;
|
|
141
|
+
}
|
|
142
|
+
return current;
|
|
164
143
|
}
|
|
144
|
+
//#endregion
|
|
145
|
+
export { createEventReplayQueue, hydrateClientBoundaries, hydrateFrameworkBoundary };
|
|
146
|
+
|
|
165
147
|
//# sourceMappingURL=framework-hydrate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-hydrate.js","
|
|
1
|
+
{"version":3,"file":"framework-hydrate.js","names":[],"sources":["../src/framework-hydrate.ts"],"mappings":";;;;;AAYA,iBAAiB;AA2BjB,MAAM,wBAAwB;CAAC;CAAS;CAAS;CAAU;AAAQ;AAEnE,SAAgB,uBACd,MACA,SAA4B,uBACV;CAClB,MAAM,UAA0B,CAAC;CACjC,IAAI,WAAW;CACf,MAAM,WAAW,UAAuB;EACtC,MAAM,SAAS,MAAM;EACrB,IAAI,EAAE,kBAAkB,OAAO;EAC/B,MAAM,OAAO,SAAS,MAAM,MAAM;EAClC,IAAI,SAAS,KAAA,GAAW;EACxB,IAAI,MAAM,SAAS,UAAU,MAAM,eAAe;EAClD,QAAQ,KAAK;GACX,MAAM,MAAM;GACZ;GACA,SAAS,MAAM;GACf,YAAY,MAAM;GAClB,GAAI,kBAAkB,oBAAoB,kBAAkB,sBACxD,EAAE,OAAO,OAAO,MAAM,IACtB,CAAC;GACL,GAAI,kBAAkB,mBAAmB,EAAE,SAAS,OAAO,QAAQ,IAAI,CAAC;EAC1E,CAAC;CACH;CACA,KAAK,MAAM,SAAS,QAAQ,KAAK,iBAAiB,OAAO,SAAS,IAAI;CACtE,MAAM,gBAAsB;EAC1B,IAAI,UAAU;EACd,WAAW;EACX,KAAK,MAAM,SAAS,QAAQ,KAAK,oBAAoB,OAAO,SAAS,IAAI;CAC3E;CACA,OAAO;EACL;EACA,SAAS;GACP,QAAQ;GACR,KAAK,MAAM,UAAU,QAAQ,OAAO,CAAC,GAAG;IACtC,MAAM,SAAS,gBAAgB,MAAM,OAAO,IAAI;IAChD,IAAI,EAAE,kBAAkB,UA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AAC;CACxB,IAAI,UAAuB;CAC3B,OAAO,YAAY,QAAQ,YAAY,MAAM;EAC3C,MAAM,aAAgC,QAAQ;EAC9C,IAAI,eAAe,MAAM,OAAO,KAAA;EAChC,KAAK,KAAK,MAAM,UAAU,QAAQ,KAAK,WAAW,YAAY,OAAO,CAAW;EAChF,UAAU;CACZ;CACA,OAAO,YAAY,OAAO,KAAK,WAAW,IAAI,KAAA;AAChD;AAEA,SAAS,gBAAgB,MAAkB,MAA2C;CACpF,IAAI,UAAgB;CACpB,KAAK,MAAM,SAAS,MAAM;EACxB,MAAM,OAAO,QAAQ,WAAW;EAChC,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;EAC/B,UAAU;CACZ;CACA,OAAO;AACT"}
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
+
//#region src/framework-protocol.d.ts
|
|
1
2
|
declare const CLIENT_REFERENCE: unique symbol;
|
|
2
3
|
declare const SERVER_REFERENCE: unique symbol;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
declare const VIDACT_FRAMEWORK_PROTOCOL = "vidact-framework-v1";
|
|
5
|
+
interface ClientReference {
|
|
6
|
+
readonly [CLIENT_REFERENCE]: true;
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly exportName: string;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
interface ServerFunctionReference {
|
|
11
|
+
readonly [SERVER_REFERENCE]: true;
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly bound: readonly FrameworkValue[];
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
type FrameworkValue = null | undefined | boolean | string | number | bigint | readonly FrameworkValue[] | {
|
|
16
|
+
readonly [key: string]: FrameworkValue;
|
|
16
17
|
} | ClientReference | ServerFunctionReference;
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
interface ClientModuleManifest {
|
|
19
|
+
readonly has: (id: string, exportName: string) => boolean;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
interface ServerFunctionRegistry {
|
|
22
|
+
readonly invoke: (id: string, arguments_: readonly FrameworkValue[], signal?: AbortSignal) => Promise<FrameworkValue>;
|
|
23
|
+
readonly register: (id: string, implementation: (...arguments_: FrameworkValue[]) => FrameworkValue | PromiseLike<FrameworkValue>) => () => void;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
declare function createClientReference(id: string, exportName?: string): ClientReference;
|
|
26
|
+
declare function createServerFunctionReference(id: string, bound?: readonly FrameworkValue[]): ServerFunctionReference;
|
|
27
|
+
declare function createClientModuleManifest(references: Readonly<Record<string, readonly string[]>>): ClientModuleManifest;
|
|
28
|
+
declare function createServerFunctionRegistry(): ServerFunctionRegistry;
|
|
29
|
+
declare function encodeFrameworkValue(value: FrameworkValue, manifest?: ClientModuleManifest): string;
|
|
30
|
+
declare function decodeFrameworkValue(payload: string, manifest?: ClientModuleManifest): FrameworkValue;
|
|
31
|
+
declare function invokeServerFunctionPayload(registry: ServerFunctionRegistry, payload: string, signal?: AbortSignal): Promise<string>;
|
|
32
|
+
declare function isClientReference(value: unknown): value is ClientReference;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { ClientModuleManifest, ClientReference, FrameworkValue, ServerFunctionReference, ServerFunctionRegistry, VIDACT_FRAMEWORK_PROTOCOL, createClientModuleManifest, createClientReference, createServerFunctionReference, createServerFunctionRegistry, decodeFrameworkValue, encodeFrameworkValue, invokeServerFunctionPayload, isClientReference };
|
|
33
35
|
//# sourceMappingURL=framework-protocol.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-protocol.d.ts","
|
|
1
|
+
{"version":3,"file":"framework-protocol.d.ts","names":[],"sources":["../src/framework-protocol.ts"],"mappings":";cAEM;cACA;cAEO;UAEI;YACL;WACD;WACA;;UAGM;YACL;WACD;WACA,gBAAgB;;KAGf,kFAOC;YACG,cAAc;IAC1B,kBACA;UAEa;WACN,MAAM,YAAY;;UAGZ;WACN,SACP,YACA,qBAAqB,kBACrB,SAAS,gBACN,QAAQ;WACJ,WACP,YACA,oBACK,YAAY,qBACZ,iBAAiB,YAAY;;iBA2BtB,sBAAsB,YAAY,sBAAyB;iBAM3D,8BACd,YACA,iBAAgB,mBACf;iBAKa,2BACd,YAAY,SAAS,qCACpB;iBAea,gCAAgC;iBA0BhC,qBACd,OAAO,gBACP,WAAW;iBAaG,qBACd,iBACA,WAAW,uBACV;iBAiBa,4BACd,UAAU,wBACV,iBACA,SAAS,cACR;iBAwHa,kBAAkB,iBAAiB,SAAS"}
|