@solidjs/web 2.0.0-experimental.9 → 2.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +22 -4
  2. package/dist/dev.cjs +1585 -225
  3. package/dist/dev.js +1510 -201
  4. package/dist/server.cjs +2642 -264
  5. package/dist/server.js +2542 -217
  6. package/dist/web.cjs +1523 -218
  7. package/dist/web.js +1448 -194
  8. package/frames/dist/client.cjs +1916 -0
  9. package/frames/dist/client.dev.cjs +1933 -0
  10. package/frames/dist/client.dev.js +1921 -0
  11. package/frames/dist/client.js +1904 -0
  12. package/frames/dist/server.cjs +3667 -0
  13. package/frames/dist/server.js +3654 -0
  14. package/frames/package.json +30 -0
  15. package/package.json +349 -37
  16. package/serialization/decode/package.json +20 -0
  17. package/serialization/dist/decode.cjs +110 -0
  18. package/serialization/dist/decode.js +104 -0
  19. package/serialization/dist/serialization.cjs +232 -0
  20. package/serialization/dist/serialization.js +215 -0
  21. package/serialization/package.json +20 -0
  22. package/serialization/types/index.d.ts +182 -0
  23. package/serialization/types/serializer-decode.d.ts +182 -0
  24. package/serialization/types-cjs/index.d.cts +182 -0
  25. package/serialization/types-cjs/package.json +3 -0
  26. package/serialization/types-cjs/serializer-decode.d.cts +182 -0
  27. package/server-functions/dist/client.cjs +646 -0
  28. package/server-functions/dist/client.js +617 -0
  29. package/server-functions/dist/rich-args.cjs +11 -0
  30. package/server-functions/dist/rich-args.js +9 -0
  31. package/server-functions/dist/server.cjs +1077 -0
  32. package/server-functions/dist/server.dev.cjs +1077 -0
  33. package/server-functions/dist/server.dev.js +1045 -0
  34. package/server-functions/dist/server.js +1045 -0
  35. package/server-functions/package.json +40 -0
  36. package/server-functions/rich-args/package.json +20 -0
  37. package/storage/package.json +8 -3
  38. package/storage/types/index.d.ts +26 -0
  39. package/storage/types-cjs/index.d.cts +28 -0
  40. package/storage/types-cjs/package.json +3 -0
  41. package/types/client.d.ts +290 -27
  42. package/types/cookies.d.ts +93 -0
  43. package/types/core.d.ts +6 -2
  44. package/types/frames/client.d.ts +36 -0
  45. package/types/frames/frame-client.d.ts +338 -0
  46. package/types/frames/frame-sink.d.ts +194 -0
  47. package/types/frames/frame-transport.d.ts +222 -0
  48. package/types/frames/serializer.d.ts +182 -0
  49. package/types/frames/server.d.ts +52 -0
  50. package/types/index.d.ts +209 -24
  51. package/types/jsx-properties.d.ts +93 -0
  52. package/types/jsx.d.ts +4150 -1
  53. package/types/response.d.ts +174 -0
  54. package/types/serializer-decode.d.ts +182 -0
  55. package/types/serializer.d.ts +182 -0
  56. package/types/server-functions/client.d.ts +201 -0
  57. package/types/server-functions/flash.d.ts +38 -0
  58. package/types/server-functions/rich-args.d.ts +10 -0
  59. package/types/server-functions/server.d.ts +588 -0
  60. package/types/server-functions/shared.d.ts +523 -0
  61. package/types/server-mock.d.ts +249 -12
  62. package/types/server.d.ts +424 -51
  63. package/types-cjs/client.d.cts +337 -0
  64. package/types-cjs/cookies.d.cts +93 -0
  65. package/types-cjs/core.d.cts +6 -0
  66. package/types-cjs/frames/client.d.cts +36 -0
  67. package/types-cjs/frames/frame-client.d.cts +338 -0
  68. package/types-cjs/frames/frame-sink.d.cts +194 -0
  69. package/types-cjs/frames/frame-transport.d.cts +222 -0
  70. package/types-cjs/frames/serializer.d.cts +182 -0
  71. package/types-cjs/frames/server.d.cts +52 -0
  72. package/types-cjs/index.d.cts +230 -0
  73. package/types-cjs/jsx-properties.d.cts +93 -0
  74. package/types-cjs/jsx.d.cts +4150 -0
  75. package/types-cjs/package.json +3 -0
  76. package/types-cjs/response.d.cts +174 -0
  77. package/types-cjs/serializer-decode.d.cts +182 -0
  78. package/types-cjs/serializer.d.cts +182 -0
  79. package/types-cjs/server-functions/client.d.cts +201 -0
  80. package/types-cjs/server-functions/flash.d.cts +38 -0
  81. package/types-cjs/server-functions/rich-args.d.cts +10 -0
  82. package/types-cjs/server-functions/server.d.cts +588 -0
  83. package/types-cjs/server-functions/shared.d.cts +523 -0
  84. package/types-cjs/server-mock.d.cts +277 -0
  85. package/types-cjs/server.d.cts +523 -0
@@ -0,0 +1,338 @@
1
+ /**
2
+ * Client frame runtime — the consumer side of a frame stream. A frame
3
+ * renders server-owned content into a DOM boundary from a resident keyed
4
+ * record store: chunks are writes, not events, so application is
5
+ * prerequisite-driven and order-independent. Client-owned slot ranges
6
+ * inside the boundary are preserved across server updates — the
7
+ * version is a stale-guard only ("policy A"): newer content morphs in
8
+ * place, and teardown is `dispose()`, never a version bump.
9
+ *
10
+ * EXPERIMENTAL — the frames/server-components surface ships as an
11
+ * experimental preview, excluded from the 2.0 stability guarantee: API
12
+ * shapes and the wire format may change between prereleases (RFC 11).
13
+ * Every export in this module is `@experimental`.
14
+ */
15
+
16
+ /**
17
+ * One transport chunk of a frame stream, addressed by frame `id`.
18
+ * @experimental
19
+ */
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
+
63
+ /**
64
+ * One store write applied to a frame: `r` maps record keys to values
65
+ * (`chunkToRecords` produces these from wire chunks) and `version` is the
66
+ * stream stamp — an older version than the frame's current one is ignored.
67
+ * @experimental
68
+ */
69
+ export interface FrameWrite {
70
+ version: number;
71
+ r: Record<string, unknown>;
72
+ }
73
+
74
+ /**
75
+ * Context passed to a slot callback.
76
+ * @experimental
77
+ */
78
+ 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 };
125
+ }
126
+
127
+ /**
128
+ * Client content for a server-declared slot. Direct-insert occurrences
129
+ * call it with empty props; render-prop occurrences pass the occurrence's
130
+ * resolved args (primitives literal, `{$ref}` data resolved through the
131
+ * host, `{$frame}` regions as marker-range fragments). Return nodes to fill
132
+ * the range, or `undefined` to claim `ctx.existing` untouched.
133
+ * @experimental
134
+ */
135
+ export type Slot = (props: Record<string, unknown>, ctx: SlotContext) => Node | Node[] | undefined;
136
+
137
+ /** @experimental */
138
+ 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;
167
+ }
168
+
169
+ /**
170
+ * Routes a flat stream of addressed chunks to frames by id, buffering chunks
171
+ * for frames that have not registered yet (only the newest version's chunks
172
+ * are kept). `data` chunks are response-scoped and go to `applyData`.
173
+ *
174
+ * An id may have several frames (the same server component mounted more
175
+ * than once): chunks fan out to all of them, and a frame registering after
176
+ * delivery is seeded from a sibling's store.
177
+ * @experimental
178
+ */
179
+ 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;
193
+ }
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
+ /**
208
+ * Options for `createFrameHost`.
209
+ * @experimental
210
+ */
211
+ 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
+
250
+ /** @experimental */
251
+ export function createFrameHost(options?: FrameHostOptions): FrameHost;
252
+
253
+ /**
254
+ * Options for `createFrame` / `createFrameElement`.
255
+ * @experimental
256
+ */
257
+ export interface FrameOptions {
258
+ /** Register with this host under `id`, receiving routed/buffered chunks. */
259
+ host?: FrameHost;
260
+ id?: string;
261
+ /** Client content keyed by prop name (occurrences resolve by prop). */
262
+ slots?: Record<string, Slot>;
263
+ /**
264
+ * Adopt existing server-rendered DOM: the first apply morphs against it,
265
+ * and slots sync immediately (hydration attach) — a document-SSR boot
266
+ * needs no chunk.
267
+ */
268
+ adopt?: boolean;
269
+ /** Called after each apply flush (tests/telemetry). */
270
+ onApply?(info: { version: number; reason: "materialize" | "morph" | "reveal" | "error" }): void;
271
+ /**
272
+ * Wraps element-claim sweeps (`a[href]`/`form[action]` in materialized
273
+ * server content — and only those) so claim consumers register their
274
+ * per-element cleanup against the boundary's reactive owner, e.g.
275
+ * `fn => runWithOwner(owner, fn)`. Nested region frames inherit it.
276
+ * Without it, sweeps run under whatever owner is current (none, for
277
+ * streamed chunks).
278
+ */
279
+ ownerScope?<T>(fn: () => T): T;
280
+ /**
281
+ * Boundary-driven segment reveal. When present, `#revealSegment` hands the
282
+ * placeholder seam to this hook instead of swapping imperatively: the binding
283
+ * reconstructs a client `<Loading>` there — `fallback` is the placeholder's
284
+ * own template content (shown while holding), `content()` materializes the
285
+ * segment and renders its client fills INSIDE the boundary so their readiness
286
+ * gates the reveal — and inserts it before `before`. An unboundaried async
287
+ * fill suspends up to that boundary and is covered instead of orphaned; one
288
+ * boundary per revealed segment, i.e. per author-placed `<Loading>`. Omit it
289
+ * for the framework-agnostic imperative swap (no reactive reveal).
290
+ */
291
+ reveal?(seam: { before: Node; fallback: Node[]; content: () => Node | DocumentFragment }): void;
292
+ /**
293
+ * Document-face record-race guard (adopt path only — solidjs/solid#2968).
294
+ * Nothing on the wire formally orders an occurrence's args-record data
295
+ * script before the event that triggers adoption, so a recordless
296
+ * occurrence is ambiguous while this returns true: the frame defers its
297
+ * mount one macrotask (all currently parsed scripts run first), calls
298
+ * `drainRecords`, and classifies with whatever is then resolvable. Return
299
+ * false once the document can run no further data scripts.
300
+ */
301
+ recordsPending?(): boolean;
302
+ /** Re-absorb the document's arrived-by-now records (idempotent per key). */
303
+ drainRecords?(): void;
304
+ }
305
+
306
+ /**
307
+ * A frame rendering into an EXISTING element boundary. Pass `adopt: true` for
308
+ * the document-SSR path: the element already holds server-rendered content,
309
+ * so the first apply morphs against it and slots sync immediately (hydration
310
+ * attach), claiming their server-rendered DOM — a document boot needs no
311
+ * chunk.
312
+ * @experimental
313
+ */
314
+ export function createFrame(boundary: Element, options?: FrameOptions): Frame;
315
+
316
+ /**
317
+ * The default boundary/region element tag and its id attribute — the DOM
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
+ /**
326
+ * Create a boundary/region ELEMENT and bind a host-registered frame to it.
327
+ * The frame mounts INTO the element (server content is its children, morphed
328
+ * in place). Because the boundary is a real node, `insert` places the
329
+ * returned `element` in any position — single, array, or fragment — with no
330
+ * special-casing. One frame per element; lifecycle belongs to the creator via
331
+ * `dispose()` (register it with your owner's cleanup).
332
+ * @experimental
333
+ */
334
+ export function createFrameElement(options: FrameOptions): {
335
+ readonly element: Element;
336
+ readonly frame: Frame;
337
+ dispose(): void;
338
+ };
@@ -0,0 +1,194 @@
1
+ // EXPERIMENTAL — the frames/server-components surface ships as an
2
+ // experimental preview, excluded from the 2.0 stability guarantee: API
3
+ // shapes and the wire format may change between prereleases (RFC 11).
4
+ // Every export in this module is @experimental.
5
+ import { FrameChunk } from "./frame-client.js";
6
+
7
+ /**
8
+ * Addresses a frame stream: the boundary id and this response's version.
9
+ * @experimental
10
+ */
11
+ export interface FrameAddress {
12
+ id: string;
13
+ version: number;
14
+ }
15
+
16
+ /**
17
+ * The emission surface `renderToStream` routes through when producing a
18
+ * frame stream instead of a document (see the `sink` render option). Each
19
+ * method emits transport-agnostic chunks; `emit` is the envelope boundary.
20
+ * @internal Compiler/renderer wiring — use `renderToFrameStream` or
21
+ * `renderServerComponent` instead.
22
+ * @experimental
23
+ */
24
+ export function createFrameSink(
25
+ emit: (chunk: FrameChunk) => void,
26
+ frame: FrameAddress
27
+ ): Record<string, (...args: any[]) => void>;
28
+
29
+ /**
30
+ * Options shared by the frame producers.
31
+ * @experimental
32
+ */
33
+ export interface FrameStreamOptions {
34
+ /** Boundary address; defaults to `{ id: "", version: 1 }`. */
35
+ frame?: { id?: string; version?: number };
36
+ /** Remaining `renderToStream` options (plugins, onError, manifest, ...). */
37
+ [key: string]: unknown;
38
+ }
39
+
40
+ /**
41
+ * A produced frame stream: pipe chunks, or await the collected array.
42
+ * @experimental
43
+ */
44
+ export interface FrameStream extends PromiseLike<FrameChunk[]> {
45
+ pipe(writable: { write(chunk: FrameChunk): void; end?(): void }): void;
46
+ }
47
+
48
+ /**
49
+ * Render to a FrameChunk stream: the same render core as `renderToStream`
50
+ * with emission swapped to the frame sink and the document writable replaced
51
+ * by a chunk envelope (`start` up front, `complete` at stream end). Data
52
+ * records default to the keyed JSON codec (decode with
53
+ * `createJSONDataTable`).
54
+ * @experimental
55
+ */
56
+ export function renderToFrameStream(code: () => unknown, options?: FrameStreamOptions): FrameStream;
57
+
58
+ /**
59
+ * Render a **server component** — a `props => JSX` function, typically
60
+ * returned from a server function — to a FrameChunk stream. `props` is a
61
+ * slot-props proxy, not data:
62
+ *
63
+ * - reading a prop as a child emits a marker range the client fills;
64
+ * - calling a prop as a render function emits a `slot` chunk for a fresh
65
+ * occurrence (a primitive `$key` arg names it, so client state follows the
66
+ * entity across responses — the slot-level analogue of For's `keyed`
67
+ * function; positional otherwise, which is the right default for most
68
+ * flows);
69
+ * - primitive args ride the chunk; server JSX args stream as nested regions
70
+ * (`{$frame}` — html once, never data); other values serialize as `{$ref}`
71
+ * data records with referential dedupe.
72
+ *
73
+ * The props a *client* passes never reach the server — server inputs are the
74
+ * function's arguments.
75
+ * @experimental
76
+ */
77
+ export function renderServerComponent(
78
+ component: (props: Record<string, any>) => unknown,
79
+ options?: FrameStreamOptions
80
+ ): FrameStream;
81
+
82
+ /**
83
+ * The slot props proxy used by `renderServerComponent`. Every key
84
+ * virtually exists (`in` is always true — a prop is a position the client
85
+ * may fill), enumeration is empty by design, and serialization goes through
86
+ * the live render context, so it must only be used during the frame's
87
+ * render.
88
+ * @internal Exposed for framework bindings composing their own producers.
89
+ * @experimental
90
+ */
91
+ export function createSlotProps(
92
+ sink: ReturnType<typeof createFrameSink>,
93
+ frame: FrameAddress
94
+ ): Record<string, any>;
95
+
96
+ /**
97
+ * A server component as an HTTP Response: the chunk stream framed with the
98
+ * server-function wire convention, tagged `X-Frame-Stream: <frame id>` for
99
+ * the client and `X-Content-Raw` so the server-function handler forwards it
100
+ * untouched. `init` (headers/status, e.g. from a `respond()` envelope)
101
+ * merges in; the frame tags win on conflict.
102
+ * @experimental
103
+ */
104
+ export function serverComponentResponse(
105
+ component: (props: Record<string, any>) => unknown,
106
+ options?: FrameStreamOptions,
107
+ init?: { headers?: HeadersInit; status?: number }
108
+ ): Response;
109
+
110
+ /**
111
+ * The server-component convention as a `transformResult` policy for
112
+ * `handleServerFunctionRequest`: a function result — or a `respond()`
113
+ * envelope whose value is a function — becomes a frame-stream Response,
114
+ * with the frame id defaulting to the server function's id so repeat calls
115
+ * target the same client boundary. Everything else passes through.
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * handleServerFunctionRequest(request, {
120
+ * transformResult: frameTransformResult,
121
+ * provideEvent
122
+ * });
123
+ * ```
124
+ * @experimental
125
+ */
126
+ export function frameTransformResult(event: unknown, result: unknown): unknown;
127
+
128
+ // === Document SSR (t = 0) ===
129
+
130
+ /**
131
+ * Document-mode slot props — the t = 0 counterpart of
132
+ * `createSlotProps`: the server component renders INLINE in the
133
+ * document and the client's real props render server-side inside its
134
+ * positions (the one hydration-time exception), wrapped in the same marker
135
+ * dialect the chunk producer emits so the adopting client binds slots and
136
+ * regions onto the server-rendered ranges.
137
+ * @experimental
138
+ */
139
+ export function createDocumentSlotProps(
140
+ clientProps: Record<string, unknown>,
141
+ frameId: string
142
+ ): Record<string, unknown>;
143
+
144
+ /**
145
+ * The in-process mirror of `frameTransformResult` for DOCUMENT SSR: install
146
+ * as `configureServerFunctionsServer({ transformDirectResult })` and a
147
+ * direct (same-process) server-function result that is a function comes back
148
+ * as an inline-renderable server component (frame markers + document
149
+ * slot props), branded with its function id and the call's wire address.
150
+ * Non-function results pass through.
151
+ * @experimental
152
+ */
153
+ export function frameTransformDirectResult<T>(
154
+ value: T,
155
+ options: { id: string; args?: unknown[] }
156
+ ): T;
157
+
158
+ /**
159
+ * The frame half of single-flight, as a `transformFlightResult` policy for
160
+ * `handleServerFunctionRequest`: when part of what a mutation invalidated is
161
+ * markup (a component-valued flight-data entry), the frame stream carries
162
+ * the whole payload — each component's content as a region addressed by its
163
+ * call, the `{ value, data }` envelope as `outcome` chunks with the
164
+ * component entries serialized as flight references. Returns `undefined`
165
+ * when nothing invalidated is markup (the response stays the plain
166
+ * single-flight envelope).
167
+ * @experimental
168
+ */
169
+ export function frameTransformFlightResult(
170
+ event: unknown,
171
+ outcome: { value: unknown; data: unknown },
172
+ context?: unknown
173
+ ): Promise<Response | undefined>;
174
+
175
+ // The brands and the codec plugin live with the transport (client bundles
176
+ // resolve flight references against the live registry); re-exported here for
177
+ // server integrations importing the document-SSR surface.
178
+ export {
179
+ SERVER_COMPONENT,
180
+ SERVER_COMPONENT_ADDRESS,
181
+ SERVER_COMPONENT_SOURCE,
182
+ ServerComponentPlugin
183
+ } from "./frame-transport.js";
184
+
185
+ /**
186
+ * Statement form of the `self._$SC` placeholder-registry bootstrap
187
+ * (idempotent — first definition wins). No longer required in the document
188
+ * shell: each hydration script's first serialized server-component reference
189
+ * self-bootstraps the registry. Kept for integrations still installing it
190
+ * document-wide; the client upgrades the registry via
191
+ * `installServerComponents()`.
192
+ * @experimental
193
+ */
194
+ export const SERVER_COMPONENT_BOOTSTRAP: string;