@solidjs/web 2.0.0-rc.0 → 2.0.0-rc.10
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/README.md +1 -1
- package/dist/server.dev.js +4472 -0
- package/dist/server.js +1363 -224
- package/dist/{server.cjs → server.observe.js} +1563 -424
- package/dist/{dev.cjs → web.dev.js} +708 -365
- package/dist/web.js +460 -144
- package/dist/{dev.js → web.observe.js} +511 -213
- package/frames/dist/client.dev.js +464 -72
- package/frames/dist/client.js +364 -71
- package/frames/dist/{client.dev.cjs → client.observe.js} +487 -134
- package/frames/dist/server.dev.js +1713 -0
- package/frames/dist/server.js +553 -2495
- package/frames/dist/server.observe.js +1713 -0
- package/frames/package.json +2 -25
- package/package.json +214 -254
- package/performance-tracks/dist/performance-tracks.dev.js +678 -0
- package/performance-tracks/dist/performance-tracks.js +6 -0
- package/performance-tracks/dist/performance-tracks.observe.js +666 -0
- package/performance-tracks/package.json +7 -0
- package/performance-tracks/types/index.d.ts +67 -0
- package/serialization/decode/package.json +2 -15
- package/serialization/dist/decode.js +101 -12
- package/serialization/dist/serialization.js +112 -20
- package/serialization/package.json +2 -15
- package/serialization/types/index.d.ts +76 -157
- package/serialization/types/serializer-decode.d.ts +149 -112
- package/serialization/types/serializer.d.ts +101 -0
- package/server-functions/dist/client.dev.js +1364 -0
- package/server-functions/dist/client.js +745 -85
- package/server-functions/dist/client.observe.js +1343 -0
- package/server-functions/dist/server.dev.js +2203 -175
- package/server-functions/dist/server.js +2111 -176
- package/server-functions/dist/server.observe.js +3043 -0
- package/server-functions/package.json +2 -35
- package/server-functions/rich-args/package.json +2 -15
- package/storage/package.json +2 -15
- package/types/client.d.ts +193 -288
- package/types/constants.d.ts +20 -0
- package/types/cookies.d.ts +32 -84
- package/types/diagnostics.d.ts +56 -0
- package/types/frames/client.d.ts +1 -1
- package/types/frames/frame-client.d.ts +323 -259
- package/types/frames/frame-container-plugin.d.ts +72 -0
- package/types/frames/frame-sink.d.ts +101 -158
- package/types/frames/frame-transport.d.ts +192 -190
- package/types/frames/serializer-decode.d.ts +219 -0
- package/types/frames/serializer.d.ts +76 -157
- package/types/frames/server.d.ts +1 -1
- package/types/head.d.ts +19 -0
- package/types/index.d.ts +62 -76
- package/types/index.server.d.ts +174 -0
- package/types/jsx.d.ts +33 -26
- package/types/observe.d.ts +358 -0
- package/types/reconcile.d.ts +1 -0
- package/types/render.d.ts +9 -0
- package/types/response.d.ts +75 -150
- package/types/serializer-decode.d.ts +149 -112
- package/types/serializer.d.ts +76 -157
- package/types/server-functions/client.d.ts +202 -174
- package/types/server-functions/flash.d.ts +28 -30
- package/types/server-functions/registry.d.ts +102 -0
- package/types/server-functions/rich-args.d.ts +1 -10
- package/types/server-functions/server.d.ts +518 -454
- package/types/server-functions/shared.d.ts +366 -425
- package/types/server-mock.d.ts +110 -13
- package/types/server-observe.d.ts +77 -0
- package/types/server.d.ts +425 -425
- package/types/trace.d.ts +127 -0
- package/LICENSE +0 -21
- package/dist/web.cjs +0 -2007
- package/frames/dist/client.cjs +0 -1916
- package/frames/dist/server.cjs +0 -3667
- package/serialization/dist/decode.cjs +0 -110
- package/serialization/dist/serialization.cjs +0 -232
- package/serialization/types-cjs/index.d.cts +0 -182
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -182
- package/server-functions/dist/client.cjs +0 -646
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -1077
- package/server-functions/dist/server.dev.cjs +0 -1077
- package/storage/dist/storage.cjs +0 -12
- package/storage/types-cjs/index.d.cts +0 -28
- package/storage/types-cjs/package.json +0 -3
- package/types/core.d.ts +0 -6
- package/types-cjs/client.d.cts +0 -337
- package/types-cjs/cookies.d.cts +0 -93
- package/types-cjs/core.d.cts +0 -6
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -338
- package/types-cjs/frames/frame-sink.d.cts +0 -194
- package/types-cjs/frames/frame-transport.d.cts +0 -222
- package/types-cjs/frames/serializer.d.cts +0 -182
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/index.d.cts +0 -230
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4150
- package/types-cjs/package.json +0 -3
- package/types-cjs/response.d.cts +0 -174
- package/types-cjs/serializer-decode.d.cts +0 -182
- package/types-cjs/serializer.d.cts +0 -182
- package/types-cjs/server-functions/client.d.cts +0 -201
- package/types-cjs/server-functions/flash.d.cts +0 -38
- package/types-cjs/server-functions/rich-args.d.cts +0 -10
- package/types-cjs/server-functions/server.d.cts +0 -588
- package/types-cjs/server-functions/shared.d.cts +0 -523
- package/types-cjs/server-mock.d.cts +0 -277
- package/types-cjs/server.d.cts +0 -523
|
@@ -12,54 +12,96 @@
|
|
|
12
12
|
* shapes and the wire format may change between prereleases (RFC 11).
|
|
13
13
|
* Every export in this module is `@experimental`.
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
15
|
/**
|
|
17
16
|
* One transport chunk of a frame stream, addressed by frame `id`.
|
|
18
17
|
* @experimental
|
|
19
18
|
*/
|
|
20
|
-
export type FrameChunk =
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
19
|
+
export type FrameChunk = {
|
|
20
|
+
type: "start";
|
|
21
|
+
id: string;
|
|
22
|
+
version: number;
|
|
23
|
+
} | {
|
|
24
|
+
type: "html";
|
|
25
|
+
id: string;
|
|
26
|
+
version: number;
|
|
27
|
+
html: string;
|
|
28
|
+
/** Server-minted digest of the root's skeleton (RFC 11 §9.5, Hole hashes). */
|
|
29
|
+
digest?: string;
|
|
30
|
+
/** Digests of the live holes inside the html, by ledger key (`lh:N`, `lha:N`). */
|
|
31
|
+
holes?: Record<string, string>;
|
|
32
|
+
} | {
|
|
33
|
+
type: "fragment";
|
|
34
|
+
id: string;
|
|
35
|
+
version: number;
|
|
36
|
+
key: string;
|
|
37
|
+
html: string;
|
|
38
|
+
digest?: string;
|
|
39
|
+
holes?: Record<string, string>;
|
|
40
|
+
} | {
|
|
41
|
+
type: "hole";
|
|
42
|
+
id: string;
|
|
43
|
+
version: number;
|
|
44
|
+
key: string;
|
|
45
|
+
html: string;
|
|
46
|
+
digest?: string;
|
|
47
|
+
holes?: Record<string, string>;
|
|
48
|
+
} | {
|
|
49
|
+
type: "attr";
|
|
50
|
+
id: string;
|
|
51
|
+
version: number;
|
|
52
|
+
key: string;
|
|
53
|
+
attrs: string;
|
|
54
|
+
removed?: string[];
|
|
55
|
+
digest?: string;
|
|
56
|
+
} | {
|
|
57
|
+
type: "reveal";
|
|
58
|
+
id: string;
|
|
59
|
+
version: number;
|
|
60
|
+
keys: string[];
|
|
61
|
+
waitForStyles?: boolean;
|
|
62
|
+
fallback?: boolean;
|
|
63
|
+
} | {
|
|
64
|
+
type: "data";
|
|
65
|
+
id: string;
|
|
66
|
+
version: number;
|
|
67
|
+
key?: string;
|
|
68
|
+
node?: unknown;
|
|
69
|
+
initial?: boolean;
|
|
70
|
+
/** Eval-style hydration script — only when produced with the hydration serializer. */
|
|
71
|
+
payload?: string;
|
|
72
|
+
} | {
|
|
73
|
+
type: "assets";
|
|
74
|
+
id: string;
|
|
75
|
+
version: number;
|
|
76
|
+
key: string;
|
|
77
|
+
modules?: string[];
|
|
78
|
+
styles?: string[];
|
|
79
|
+
inlineStyles?: {
|
|
80
|
+
id: string;
|
|
81
|
+
content?: string;
|
|
82
|
+
attrs?: Record<string, string>;
|
|
83
|
+
}[];
|
|
84
|
+
preloads?: {
|
|
85
|
+
href?: string;
|
|
86
|
+
attrs: Record<string, string>;
|
|
87
|
+
}[];
|
|
88
|
+
} | {
|
|
89
|
+
type: "slot";
|
|
90
|
+
id: string;
|
|
91
|
+
version: number;
|
|
92
|
+
key: string;
|
|
93
|
+
args: Record<string, unknown>;
|
|
94
|
+
} | {
|
|
95
|
+
type: "complete";
|
|
96
|
+
id: string;
|
|
97
|
+
version: number;
|
|
98
|
+
} | {
|
|
99
|
+
type: "error";
|
|
100
|
+
id: string;
|
|
101
|
+
version: number;
|
|
102
|
+
key?: string;
|
|
103
|
+
error: unknown;
|
|
104
|
+
};
|
|
63
105
|
/**
|
|
64
106
|
* One store write applied to a frame: `r` maps record keys to values
|
|
65
107
|
* (`chunkToRecords` produces these from wire chunks) and `version` is the
|
|
@@ -67,63 +109,64 @@ export function chunkToRecords(chunk: FrameChunk): Record<string, unknown>;
|
|
|
67
109
|
* @experimental
|
|
68
110
|
*/
|
|
69
111
|
export interface FrameWrite {
|
|
70
|
-
|
|
71
|
-
|
|
112
|
+
version: number;
|
|
113
|
+
r: Record<string, unknown>;
|
|
72
114
|
}
|
|
73
|
-
|
|
74
115
|
/**
|
|
75
116
|
* Context passed to a slot callback.
|
|
76
117
|
* @experimental
|
|
77
118
|
*/
|
|
78
119
|
export interface SlotContext {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
/**
|
|
121
|
+
* True only for the hydration-attach invocation of an adopted
|
|
122
|
+
* document-SSR range — the one call a consumer may answer with a claim
|
|
123
|
+
* (`existing` IS the server-rendered output for these args). Unset on
|
|
124
|
+
* stream-driven re-calls: those must render for real, or content the
|
|
125
|
+
* re-call displaced (e.g. `{$frame}` region ranges) is dropped.
|
|
126
|
+
*/
|
|
127
|
+
adopted?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Whether this occurrence is a render-prop CALL (the producer placed it
|
|
130
|
+
* with arguments — possibly empty — via a slot record) as opposed to a
|
|
131
|
+
* direct-insert position. Consumers cannot tell from the resolved props
|
|
132
|
+
* alone: an argless render prop and a direct insert both arrive as `{}`,
|
|
133
|
+
* but one is a function to invoke and the other a value to place.
|
|
134
|
+
*/
|
|
135
|
+
invoked?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Register cleanup for when this occurrence's range is removed from the
|
|
138
|
+
* server content, or the owning frame is disposed.
|
|
139
|
+
*/
|
|
140
|
+
onCleanup(fn: () => void): void;
|
|
141
|
+
/**
|
|
142
|
+
* Live-props opt-in: a binding that registers here receives the
|
|
143
|
+
* re-resolved props when a re-sent record's args CHANGE in value, instead
|
|
144
|
+
* of the occurrence being re-called — the invocation's instance (and its
|
|
145
|
+
* client state) survives the change. Register synchronously during the
|
|
146
|
+
* invocation; one updater per occurrence (last registration wins). A
|
|
147
|
+
* genuine re-call or unmount clears it before/with the binding it served.
|
|
148
|
+
*/
|
|
149
|
+
onUpdate(fn: (props: Record<string, unknown>) => void): void;
|
|
150
|
+
/**
|
|
151
|
+
* The range's current interior — server-rendered client content on an
|
|
152
|
+
* adopted document-SSR boot, or the previous output on a re-call. A
|
|
153
|
+
* framework binding hydrates onto it and returns `undefined` to claim it
|
|
154
|
+
* in place (zero DOM mutation).
|
|
155
|
+
*/
|
|
156
|
+
existing: ChildNode[];
|
|
157
|
+
/**
|
|
158
|
+
* The range's own marker comments, when the occurrence has a placed range.
|
|
159
|
+
* A framework binding whose slot content is reactive at the top level (a
|
|
160
|
+
* boundary accessor, changing route children) owns the interior instead of
|
|
161
|
+
* returning nodes: bind before `end` with the framework's insert primitive
|
|
162
|
+
* and return `undefined` — the frame leaves the range alone (server morphs
|
|
163
|
+
* already protect slot ranges).
|
|
164
|
+
*/
|
|
165
|
+
range?: {
|
|
166
|
+
start: Comment;
|
|
167
|
+
end: Comment;
|
|
168
|
+
};
|
|
125
169
|
}
|
|
126
|
-
|
|
127
170
|
/**
|
|
128
171
|
* Client content for a server-declared slot. Direct-insert occurrences
|
|
129
172
|
* call it with empty props; render-prop occurrences pass the occurrence's
|
|
@@ -133,39 +176,47 @@ export interface SlotContext {
|
|
|
133
176
|
* @experimental
|
|
134
177
|
*/
|
|
135
178
|
export type Slot = (props: Record<string, unknown>, ctx: SlotContext) => Node | Node[] | undefined;
|
|
136
|
-
|
|
137
179
|
/** @experimental */
|
|
138
180
|
export interface Frame {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
181
|
+
/** Merge a write into the store and flush (morph/reveal/slot sync). */
|
|
182
|
+
apply(write: FrameWrite): void;
|
|
183
|
+
/** The active version, or undefined before the first apply. */
|
|
184
|
+
readonly version: number | undefined;
|
|
185
|
+
/** Read-only view of the resident record store. */
|
|
186
|
+
readonly store: Readonly<Record<string, unknown>>;
|
|
187
|
+
/** The stream's error record, if an `error` chunk arrived. */
|
|
188
|
+
readonly error: unknown;
|
|
189
|
+
/** Whether the named fragment has been revealed into the boundary. */
|
|
190
|
+
isRevealed(segment: string): boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Re-key this live frame to a different boundary id (the mount-preserving
|
|
193
|
+
* half of a call-site handoff): nothing tears down — the element, store,
|
|
194
|
+
* and slot state stay — while leaving the old id stashes a retention
|
|
195
|
+
* snapshot under it and joining the new id seeds/drains its retained
|
|
196
|
+
* store and buffered chunks. Version affinity resets: histories are per
|
|
197
|
+
* boundary id.
|
|
198
|
+
*/
|
|
199
|
+
rebind(id: string): void;
|
|
200
|
+
/**
|
|
201
|
+
* Forget the version baseline without touching content — the next write
|
|
202
|
+
* is accepted whatever its number. Called by the host after seeding a
|
|
203
|
+
* registration from a retained snapshot, whose numbering belongs to a
|
|
204
|
+
* different stream space.
|
|
205
|
+
*/
|
|
206
|
+
rebase(): void;
|
|
207
|
+
/**
|
|
208
|
+
* The frame's have-list (RFC 11 §9.5): the server-minted digests of
|
|
209
|
+
* what this frame currently SHOWS — the root skeleton under `""`, each
|
|
210
|
+
* live hole and attr hole by ledger key, each revealed fragment by name.
|
|
211
|
+
* Kept at apply time, never derived from the DOM. `undefined` when the
|
|
212
|
+
* content's provenance carried no digests (a document-adopted interior
|
|
213
|
+
* with no seed, a re-materialized capture): a resume then takes the full
|
|
214
|
+
* snapshot.
|
|
215
|
+
*/
|
|
216
|
+
have?(): Record<string, string> | undefined;
|
|
217
|
+
/** Tear down: slot cleanups cascade, later chunks are ignored. Idempotent. */
|
|
218
|
+
dispose(): void;
|
|
167
219
|
}
|
|
168
|
-
|
|
169
220
|
/**
|
|
170
221
|
* Routes a flat stream of addressed chunks to frames by id, buffering chunks
|
|
171
222
|
* for frames that have not registered yet (only the newest version's chunks
|
|
@@ -177,152 +228,165 @@ export interface Frame {
|
|
|
177
228
|
* @experimental
|
|
178
229
|
*/
|
|
179
230
|
export interface FrameHost {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
231
|
+
register(id: string, frame: Frame): void;
|
|
232
|
+
/** Remove one frame (or all frames of the id when `frame` is omitted). */
|
|
233
|
+
unregister(id: string, frame?: Frame): void;
|
|
234
|
+
apply(chunk: FrameChunk): void;
|
|
235
|
+
/** The first registered frame under the id, if any. */
|
|
236
|
+
get(id: string): Frame | undefined;
|
|
237
|
+
serialize(value: unknown): {
|
|
238
|
+
$ref: string;
|
|
239
|
+
};
|
|
240
|
+
/** `frameId` is the resolving frame's id — route to its stream's table. */
|
|
241
|
+
resolve(ref: {
|
|
242
|
+
$ref: string;
|
|
243
|
+
}, frameId?: string): unknown;
|
|
244
|
+
/** See FrameHostOptions.revive. */
|
|
245
|
+
revive?(value: unknown): unknown;
|
|
246
|
+
/** See FrameHostOptions.isContainer. */
|
|
247
|
+
isContainer?(value: unknown): boolean;
|
|
193
248
|
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* The bubbling DOM event (`"frame:applied"`) a frame dispatches from its
|
|
197
|
-
* parent element whenever server content lands in the document — root
|
|
198
|
-
* materialize/morph, segment reveal, fallback materialization — with
|
|
199
|
-
* `detail: { id, version, reason }`. One document-level listener sees every
|
|
200
|
-
* boundary (nested region frames dispatch too); use it to re-apply
|
|
201
|
-
* client-owned decorations on server-owned markup (router affordance
|
|
202
|
-
* reflection, e.g. `aria-current`) without a MutationObserver.
|
|
203
|
-
* @experimental
|
|
204
|
-
*/
|
|
205
|
-
export const FRAME_APPLIED_EVENT: "frame:applied";
|
|
206
|
-
|
|
207
249
|
/**
|
|
208
250
|
* Options for `createFrameHost`.
|
|
209
251
|
* @experimental
|
|
210
252
|
*/
|
|
211
253
|
export interface FrameHostOptions {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Backs `{$ref}` slot args (typically a codec data table's `resolve`).
|
|
256
|
+
* `frameId` identifies the resolving frame — data tables are
|
|
257
|
+
* response-scoped, so multi-stream hosts route by it (nested region ids
|
|
258
|
+
* prefix-match their root).
|
|
259
|
+
*/
|
|
260
|
+
resolve?(ref: {
|
|
261
|
+
$ref: string;
|
|
262
|
+
}, frameId?: string): unknown;
|
|
263
|
+
/** Test/host-side counterpart of `resolve`. */
|
|
264
|
+
serialize?(value: unknown): {
|
|
265
|
+
$ref: string;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Receives each `data` chunk whole. Wire a codec table:
|
|
269
|
+
* `applyData: c => table.apply(c)` (see `createJSONDataTable`).
|
|
270
|
+
*/
|
|
271
|
+
applyData?(chunk: Extract<FrameChunk, {
|
|
272
|
+
type: "data";
|
|
273
|
+
}>): void;
|
|
274
|
+
/**
|
|
275
|
+
* A lazily-loaded deserializer's load, awaited by the transport before it
|
|
276
|
+
* delivers a `data` chunk — `applyData`/`resolve` can assume the codec is
|
|
277
|
+
* resident once data has arrived. Keeps codec weight out of the eager
|
|
278
|
+
* client graph for responses that never carry serialized data.
|
|
279
|
+
*/
|
|
280
|
+
prepareData?(): Promise<unknown>;
|
|
281
|
+
/**
|
|
282
|
+
* Revive protocol markers inside LITERAL slot args (values that are
|
|
283
|
+
* neither `{$ref}` nor `{$frame}`) at arg-resolution time. Document-face
|
|
284
|
+
* container traces ride this way — inline in the record, revived by the
|
|
285
|
+
* integration (`reviveContainerTraces`) into live local containers.
|
|
286
|
+
*/
|
|
287
|
+
revive?(value: unknown): unknown;
|
|
288
|
+
/**
|
|
289
|
+
* Whether a resolved arg value is a LIVE CONTAINER (a materialized trace —
|
|
290
|
+
* see `isMaterializedContainer`). The record-dedupe compare must know: a
|
|
291
|
+
* pending container's property reads throw not-ready, so async probes and
|
|
292
|
+
* serialization compares would detonate it. Containers compare by
|
|
293
|
+
* identity only.
|
|
294
|
+
*/
|
|
295
|
+
isContainer?(value: unknown): boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Arms event types for behavior claims: the `_bnd` sweep collects the
|
|
298
|
+
* event names it finds and hands them here so delegated dispatch can
|
|
299
|
+
* reach them. Platform glue passes its `delegateEvents` — the option
|
|
300
|
+
* exists (rather than client.js importing the event system) so
|
|
301
|
+
* tree-shaken subsets without events pay nothing. Frames registered
|
|
302
|
+
* with this host inherit it unless they pass their own `delegate`.
|
|
303
|
+
*/
|
|
304
|
+
delegate?(eventNames: Iterable<string>): void;
|
|
248
305
|
}
|
|
249
|
-
|
|
250
|
-
/** @experimental */
|
|
251
|
-
export function createFrameHost(options?: FrameHostOptions): FrameHost;
|
|
252
|
-
|
|
253
306
|
/**
|
|
254
307
|
* Options for `createFrame` / `createFrameElement`.
|
|
255
308
|
* @experimental
|
|
256
309
|
*/
|
|
257
310
|
export interface FrameOptions {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
311
|
+
/** Register with this host under `id`, receiving routed/buffered chunks. */
|
|
312
|
+
host?: FrameHost;
|
|
313
|
+
id?: string;
|
|
314
|
+
/** Client content keyed by prop name (occurrences resolve by prop). */
|
|
315
|
+
slots?: Record<string, Slot>;
|
|
316
|
+
/**
|
|
317
|
+
* Raw client props for behavior-claim resolution: server elements carrying
|
|
318
|
+
* `_bnd="pos=prop"` markers (compiled under the `serverComponents` option)
|
|
319
|
+
* resolve ref/event positions by name through this object — read live at
|
|
320
|
+
* dispatch/materialize time, so compiled prop getters stay latest-value.
|
|
321
|
+
*/
|
|
322
|
+
props?: Record<string, unknown>;
|
|
323
|
+
/**
|
|
324
|
+
* Adopt existing server-rendered DOM: the first apply morphs against it,
|
|
325
|
+
* and slots sync immediately (hydration attach) — a document-SSR boot
|
|
326
|
+
* needs no chunk.
|
|
327
|
+
*/
|
|
328
|
+
adopt?: boolean;
|
|
329
|
+
/** Called after each apply flush (tests/telemetry). */
|
|
330
|
+
onApply?(info: {
|
|
331
|
+
version: number;
|
|
332
|
+
reason: "materialize" | "morph" | "reveal" | "error";
|
|
333
|
+
}): void;
|
|
334
|
+
/**
|
|
335
|
+
* Wraps element-claim sweeps (`a[href]`/`form[action]` in materialized
|
|
336
|
+
* server content — and only those) so claim consumers register their
|
|
337
|
+
* per-element cleanup against the boundary's reactive owner, e.g.
|
|
338
|
+
* `fn => runWithOwner(owner, fn)`. Nested region frames inherit it.
|
|
339
|
+
* Without it, sweeps run under whatever owner is current (none, for
|
|
340
|
+
* streamed chunks).
|
|
341
|
+
*/
|
|
342
|
+
ownerScope?<T>(fn: () => T): T;
|
|
343
|
+
/** Per-frame override of the host's `delegate` (see FrameHostOptions). */
|
|
344
|
+
delegate?(eventNames: Iterable<string>): void;
|
|
345
|
+
/**
|
|
346
|
+
* Boundary-driven segment reveal. When present, `#revealSegment` hands the
|
|
347
|
+
* placeholder seam to this hook instead of swapping imperatively: the binding
|
|
348
|
+
* reconstructs a client `<Loading>` there — `fallback` is the placeholder's
|
|
349
|
+
* own template content (shown while holding), `content()` materializes the
|
|
350
|
+
* segment and renders its client fills INSIDE the boundary so their readiness
|
|
351
|
+
* gates the reveal — and inserts it before `before`. An unboundaried async
|
|
352
|
+
* fill suspends up to that boundary and is covered instead of orphaned; one
|
|
353
|
+
* boundary per revealed segment, i.e. per author-placed `<Loading>`. Omit it
|
|
354
|
+
* for the framework-agnostic imperative swap (no reactive reveal).
|
|
355
|
+
*/
|
|
356
|
+
reveal?(seam: {
|
|
357
|
+
before: Node;
|
|
358
|
+
fallback: Node[];
|
|
359
|
+
content: () => Node | DocumentFragment;
|
|
360
|
+
}): void;
|
|
361
|
+
/**
|
|
362
|
+
* Document-face record-race guard (adopt path only — solidjs/solid#2968).
|
|
363
|
+
* Nothing on the wire formally orders an occurrence's args-record data
|
|
364
|
+
* script before the event that triggers adoption, so a recordless
|
|
365
|
+
* occurrence is ambiguous while this returns true: the frame defers its
|
|
366
|
+
* mount one macrotask (all currently parsed scripts run first), calls
|
|
367
|
+
* `drainRecords`, and classifies with whatever is then resolvable. Return
|
|
368
|
+
* false once the document can run no further data scripts.
|
|
369
|
+
*/
|
|
370
|
+
recordsPending?(): boolean;
|
|
371
|
+
/** Re-absorb the document's arrived-by-now records (idempotent per key). */
|
|
372
|
+
drainRecords?(): void;
|
|
304
373
|
}
|
|
305
|
-
|
|
374
|
+
export declare function chunkToRecords(chunk: FrameChunk): Record<string, unknown>;
|
|
375
|
+
export declare function createFrameHost(options?: FrameHostOptions): FrameHost;
|
|
306
376
|
/**
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
377
|
+
* The bubbling DOM event a frame dispatches from its parent element after
|
|
378
|
+
* server content lands in the document (root materialize/morph, segment
|
|
379
|
+
* reveal, fallback materialization) — `detail: { id, version, reason }`.
|
|
380
|
+
* Document-level listeners (router affordance reflection, scroll
|
|
381
|
+
* restoration) react to server-driven DOM changes without a
|
|
382
|
+
* MutationObserver; nested region frames dispatch too and the event
|
|
383
|
+
* bubbles, so one listener sees every boundary. Client-side renders never
|
|
384
|
+
* fire it — client code has reactivity to subscribe with.
|
|
313
385
|
*/
|
|
314
|
-
export
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
* contract the producer emits at t=0 and the consumer creates/adopts.
|
|
319
|
-
* @experimental
|
|
320
|
-
*/
|
|
321
|
-
export const FRAME_TAG: "dx-frame";
|
|
322
|
-
/** @experimental */
|
|
323
|
-
export const FRAME_ID_ATTR: "data-fid";
|
|
324
|
-
|
|
325
|
-
/**
|
|
386
|
+
export declare const FRAME_APPLIED_EVENT = "frame:applied";
|
|
387
|
+
export declare function createFrame(boundary: Element, options?: FrameOptions): Frame;
|
|
388
|
+
export declare const FRAME_TAG = "solid-frame";
|
|
389
|
+
export declare const FRAME_ID_ATTR = "data-fid"; /**
|
|
326
390
|
* Create a boundary/region ELEMENT and bind a host-registered frame to it.
|
|
327
391
|
* The frame mounts INTO the element (server content is its children, morphed
|
|
328
392
|
* in place). Because the boundary is a real node, `insert` places the
|
|
@@ -331,8 +395,8 @@ export const FRAME_ID_ATTR: "data-fid";
|
|
|
331
395
|
* `dispose()` (register it with your owner's cleanup).
|
|
332
396
|
* @experimental
|
|
333
397
|
*/
|
|
334
|
-
export function createFrameElement(options: FrameOptions): {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
398
|
+
export declare function createFrameElement(options: FrameOptions): {
|
|
399
|
+
readonly element: Element;
|
|
400
|
+
readonly frame: Frame;
|
|
401
|
+
dispose(): void;
|
|
338
402
|
};
|