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