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