@solidjs/web 2.0.0-rc.14 → 2.0.0-rc.16

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 (58) hide show
  1. package/README.md +1 -1
  2. package/dist/server.dev.js +475 -591
  3. package/dist/server.js +459 -489
  4. package/dist/server.observe.js +459 -498
  5. package/dist/web.dev.js +206 -220
  6. package/dist/web.js +196 -208
  7. package/dist/web.observe.js +206 -213
  8. package/frames/dist/client.dev.js +664 -643
  9. package/frames/dist/client.js +593 -582
  10. package/frames/dist/client.observe.js +624 -589
  11. package/frames/dist/regions.js +43 -2
  12. package/frames/dist/server.dev.js +578 -450
  13. package/frames/dist/server.js +578 -397
  14. package/frames/dist/server.observe.js +578 -397
  15. package/frames/dist/trace.js +4 -1
  16. package/frames/dist/wire.js +371 -6
  17. package/package.json +13 -13
  18. package/serialization/dist/decode.js +11 -9
  19. package/serialization/dist/serialization.js +11 -9
  20. package/serialization/types/serializer-decode.d.ts +2 -2
  21. package/server-functions/dist/client.dev.js +5 -2
  22. package/server-functions/dist/client.js +3 -2
  23. package/server-functions/dist/client.observe.js +5 -2
  24. package/server-functions/dist/rich-args.js +33 -1
  25. package/server-functions/dist/server.dev.js +218 -35
  26. package/server-functions/dist/server.js +218 -35
  27. package/server-functions/dist/server.observe.js +218 -35
  28. package/skills/server-components/SKILL.md +74 -185
  29. package/types/client.d.ts +112 -10
  30. package/types/constants.d.ts +2 -1
  31. package/types/frames/assets-tier.d.ts +2 -2
  32. package/types/frames/client.d.ts +8 -3
  33. package/types/frames/frame-client.d.ts +121 -157
  34. package/types/frames/frame-morph.d.ts +28 -0
  35. package/types/frames/frame-sink.d.ts +13 -9
  36. package/types/frames/frame-transport.d.ts +30 -1
  37. package/types/frames/regions-tier.d.ts +15 -0
  38. package/types/frames/serializer-decode.d.ts +2 -2
  39. package/types/frames/server.d.ts +1 -53
  40. package/types/frames/wire-tier.d.ts +54 -1
  41. package/types/head.d.ts +1 -0
  42. package/types/index.d.ts +57 -50
  43. package/types/index.server.d.ts +3 -27
  44. package/types/jsx.d.ts +14 -17
  45. package/types/observe.d.ts +14 -7
  46. package/types/render.d.ts +3 -1
  47. package/types/response.d.ts +31 -8
  48. package/types/serializer-decode.d.ts +2 -2
  49. package/types/server-functions/argument-codec.d.ts +21 -0
  50. package/types/server-functions/client.d.ts +18 -5
  51. package/types/server-functions/server.d.ts +6 -2
  52. package/types/server-functions/shared.d.ts +19 -0
  53. package/types/server-mock.d.ts +9 -2
  54. package/types/server-observe.d.ts +3 -2
  55. package/types/server.d.ts +124 -67
  56. package/frames/dist/bind.dev.js +0 -326
  57. package/frames/dist/bind.js +0 -295
  58. package/types/frames/bind-tier.d.ts +0 -60
@@ -13,55 +13,21 @@
13
13
  * Every export in this module is `@experimental`.
14
14
  */
15
15
  /**
16
- * One transport chunk of a frame stream, addressed by frame `id`. Any
17
- * chunk may carry `tiers` (see `TierAnnouncement`).
16
+ * Row ops for a live hole whose value is a `For`'s rows (#4064): the new
17
+ * row count `n` and the rows that changed or were appended, as
18
+ * `[index, html]`. A count below the range's truncates it.
19
+ */
20
+ export type HoleRows = {
21
+ n: number;
22
+ r: [number, string][];
23
+ };
24
+ /**
25
+ * A `data` message: one node of the response-scoped data table the
26
+ * records' `{$ref}` args resolve through — not frame state (it never enters
27
+ * the store), ordered ahead of the records that read it.
18
28
  * @experimental
19
29
  */
20
- export type FrameChunk = ({
21
- type: "start";
22
- id: string;
23
- version: number;
24
- } | {
25
- type: "html";
26
- id: string;
27
- version: number;
28
- html: string;
29
- /** Server-minted digest of the root's skeleton (RFC 11 §9.5, Hole hashes). */
30
- digest?: string;
31
- /** Digests of the live holes inside the html, by ledger key (`lh:N`, `lha:N`). */
32
- holes?: Record<string, string>;
33
- } | {
34
- type: "fragment";
35
- id: string;
36
- version: number;
37
- key: string;
38
- html: string;
39
- digest?: string;
40
- holes?: Record<string, string>;
41
- } | {
42
- type: "hole";
43
- id: string;
44
- version: number;
45
- key: string;
46
- html: string;
47
- digest?: string;
48
- holes?: Record<string, string>;
49
- } | {
50
- type: "attr";
51
- id: string;
52
- version: number;
53
- key: string;
54
- attrs: string;
55
- removed?: string[];
56
- digest?: string;
57
- } | {
58
- type: "reveal";
59
- id: string;
60
- version: number;
61
- keys: string[];
62
- waitForStyles?: boolean;
63
- fallback?: boolean;
64
- } | {
30
+ export type FrameData = {
65
31
  type: "data";
66
32
  id: string;
67
33
  version: number;
@@ -70,76 +36,11 @@ export type FrameChunk = ({
70
36
  initial?: boolean;
71
37
  /** Eval-style hydration script — only when produced with the hydration serializer. */
72
38
  payload?: string;
73
- } | {
74
- type: "assets";
75
- id: string;
76
- version: number;
77
- key: string;
78
- modules?: string[];
79
- styles?: string[];
80
- inlineStyles?: {
81
- id: string;
82
- content?: string;
83
- attrs?: Record<string, string>;
84
- }[];
85
- preloads?: {
86
- href?: string;
87
- attrs: Record<string, string>;
88
- }[];
89
- } | {
90
- type: "slot";
91
- id: string;
92
- version: number;
93
- key: string;
94
- args: Record<string, unknown>;
95
- } | {
96
- /**
97
- * One server sweep's re-emissions as one unit (RFC 11 addendum, C13):
98
- * the `hole` / `attr` members a sweep produced, unaddressed (the
99
- * envelope addresses them), applied as one write — one flush, one
100
- * `frame:applied`. A sweep that changed one binding is emitted as
101
- * that member alone.
102
- */
103
- type: "ops";
104
- id: string;
105
- version: number;
106
- ops: ({
107
- type: "hole";
108
- key: string;
109
- html: string;
110
- digest?: string;
111
- } | {
112
- type: "attr";
113
- key: string;
114
- attrs: string;
115
- removed?: string[];
116
- digest?: string;
117
- })[];
118
- } | {
119
- type: "complete";
120
- id: string;
121
- version: number;
122
- /**
123
- * Present when the producer ended a plain (non-`live`) response at
124
- * its streaming bound rather than at its sources' settling (RFC 11
125
- * addendum): `"yields"` — the later-yield count; `"time"` — the
126
- * wall-clock bound after the first flush, or the request's abort
127
- * after it. The content shown is a cut-off, not a settled value;
128
- * `live()` is the declared way past the bound.
129
- */
130
- bound?: "yields" | "time";
131
- } | {
132
- type: "error";
133
- id: string;
134
- version: number;
135
- key?: string;
136
- error: unknown;
137
- }) & TierAnnouncement;
39
+ };
138
40
  /**
139
41
  * The in-band tier announcement (frames savings pass §2; additive — RFC 11
140
42
  * addendum): the frames-client tiers the render first needed since the
141
- * last chunk left — `"bind"`, `"regions"`, `"assets"`, `"trace"`,
142
- * `"wire"` — on whichever chunk leaves next. The response head carries the
43
+ * last message left — `"regions"`, `"assets"`, `"trace"`, `"wire"` — on whichever chunk leaves next. The response head carries the
143
44
  * tiers minted before it (`X-Frame-Tiers`); a tier minted later rides
144
45
  * here. The client starts each named tier's load before applying the
145
46
  * chunk; a `data` chunk additionally AWAITS them (its node tree needs the
@@ -151,9 +52,30 @@ export interface TierAnnouncement {
151
52
  tiers?: string[];
152
53
  }
153
54
  /**
154
- * One store write applied to a frame: `r` maps record keys to values
155
- * (`chunkToRecords` produces these from wire chunks) and `version` is the
156
- * stream stamp — an older version than the frame's current one is ignored.
55
+ * One message of a frame stream on the wire, addressed by frame `id`: a
56
+ * versioned batch of keyed records — the store write itself (`r`, see
57
+ * `FrameWrite`) — or one of the messages that are not records: `start`
58
+ * (a response's version opens on the address), `data` (a node of the
59
+ * response's data table). Any message may carry `tiers` (see
60
+ * `TierAnnouncement`).
61
+ * @experimental
62
+ */
63
+ export type FrameMessage = ({
64
+ type?: undefined;
65
+ id: string;
66
+ version: number;
67
+ r: Record<string, unknown>;
68
+ } | {
69
+ type: "start";
70
+ id: string;
71
+ version: number;
72
+ /** Observe tier: when the response's request went out (see `landing`). */
73
+ startedAt?: number;
74
+ } | FrameData) & TierAnnouncement;
75
+ /**
76
+ * One store write applied to a frame: `r` maps record keys to values (a
77
+ * wire batch's own `r`) and `version` is the stream stamp — an older
78
+ * version than the frame's current one is ignored.
157
79
  * @experimental
158
80
  */
159
81
  export interface FrameWrite {
@@ -207,8 +129,8 @@ export interface SlotContext {
207
129
  * — the anchor the fill owns its interior through: bind or place the
208
130
  * output before `end` (over `existing`) with the framework's insert
209
131
  * primitive. The frame never touches a range's interior itself (server
210
- * morphs protect slot ranges). Absent for a binding-slot occurrence
211
- * (`positions`) and for a range whose end marker is missing.
132
+ * morphs protect slot ranges). Absent for a range whose end marker is
133
+ * missing.
212
134
  */
213
135
  range?: {
214
136
  start: Comment;
@@ -255,11 +177,12 @@ export interface Frame {
255
177
  dispose(): void;
256
178
  }
257
179
  /**
258
- * Routes a flat stream of addressed chunks to frames by id, buffering chunks
259
- * for frames that have not registered yet (only the newest version's chunks
260
- * are kept). `data` chunks are response-scoped and go to `applyData`; a
261
- * `slot` chunk's `{$ref}` args are resolved at the write, through the
262
- * response's data (a value, or a pending read the response settles).
180
+ * Routes a flat stream of addressed messages to frames by id, writing each
181
+ * batch into the address's resident store (an address no frame has
182
+ * registered for yet simply warms). `data` messages are response-scoped and
183
+ * go to `applyData`; a `slot:` record's `{$ref}` args are resolved at the
184
+ * write, through the response's data (a value, or a pending read the
185
+ * response settles).
263
186
  *
264
187
  * An id may have several frames (the same server component mounted more
265
188
  * than once): chunks fan out to all of them, and a frame registering after
@@ -270,17 +193,17 @@ export interface FrameHost {
270
193
  register(id: string, frame: Frame): void;
271
194
  /** Remove one frame (or all frames of the id when `frame` is omitted). */
272
195
  unregister(id: string, frame?: Frame): void;
273
- apply(chunk: FrameChunk): void;
196
+ apply(msg: FrameMessage): void;
274
197
  /**
275
198
  * The reactive half of a staged response (see
276
- * `createServerComponentHandler`): a `slot` chunk's args — settled
277
- * through its own response's table, as at a write — reach the
199
+ * `createServerComponentHandler`): a batch's `slot:` records' args —
200
+ * settled through its own response's table, as at a write — reach the
278
201
  * occurrences mounted under its id as re-resolved props into their live
279
202
  * bindings, while the store, the markup, and every structural change
280
- * wait for the chunk's `apply`. Other chunk types are ignored.
203
+ * wait for the batch's `apply`. Other records are ignored.
281
204
  * @internal
282
205
  */
283
- preview?(chunk: FrameChunk): void;
206
+ preview?(msg: FrameMessage): void;
284
207
  /** The first registered frame under the id, if any. */
285
208
  get(id: string): Frame | undefined;
286
209
  /**
@@ -345,9 +268,7 @@ export interface FrameHostOptions {
345
268
  * `applyData: c => table.apply(c)` (see `createJSONDataTable`); a table
346
269
  * per response keys on `chunk.version` (see `resolve` for `current`).
347
270
  */
348
- applyData?(chunk: Extract<FrameChunk, {
349
- type: "data";
350
- }>, current?: number): void;
271
+ applyData?(chunk: FrameData, current?: number): void;
351
272
  /**
352
273
  * The response (one version of one id) has ended — its `complete`, or
353
274
  * its `error` with no key — and a key it never delivered never comes:
@@ -395,6 +316,13 @@ export interface FrameOptions {
395
316
  * needs no chunk.
396
317
  */
397
318
  adopt?: boolean;
319
+ /**
320
+ * With `adopt`: leave the slot occurrences unmounted for the client's
321
+ * deferred-hydration driver (`setDeferDriver`) to mount on demand. Region
322
+ * frames inside such a frame inherit it. Ignored with no driver set.
323
+ * @internal
324
+ */
325
+ defer?: boolean;
398
326
  /** Called after each apply flush (tests/telemetry). */
399
327
  onApply?(info: {
400
328
  version: number;
@@ -440,37 +368,19 @@ export interface FrameOptions {
440
368
  */
441
369
  hold?(): () => void;
442
370
  }
443
- /** @internal (the bind tier's own copy — see bind-tier.ts) */
444
- export declare const SLOT_MARKER = "_s:";
445
- /** @internal (the bind tier's own copy — see bind-tier.ts) */
446
- export declare const SLOT_TEXT: string;
371
+ export declare const CLAIMED_ELEMENTS = "a[href], form[action]";
372
+ export declare const claimedAttr: (name: any) => boolean;
373
+ export declare const SLOT_START: RegExp;
374
+ export declare const SLOT_END: RegExp;
375
+ export declare const slotEnd: (id: any) => string;
447
376
  /**
448
377
  * Whether a slot arg value is an async value passed whole (a promise or an
449
378
  * async iterable) — DR-2's value tier. The server never resolves these to
450
379
  * dead values; the client suspends at the consumption read.
451
- * @internal (the client entry's and the bind tier's — each its own copy)
380
+ * @internal (the client entry's)
452
381
  */
453
382
  export declare function isAsyncValue(v: any): boolean;
454
- /**
455
- * A value's shape, as the binding-slot shape findings name it.
456
- * @internal (dev only; the client entry's and the bind tier's)
457
- */
458
- export declare function shapeOf(v: unknown): string;
459
- /**
460
- * Dev finding (`BINDING_SLOT_POSITION`): the client side of a binding slot
461
- * has the wrong shape — the fill's return is not an object or the prop is
462
- * not a function (`fill-shape`), or a text position's value is not a
463
- * primitive (`text-shape`). Through the diagnostics channel, so an
464
- * observer captures it beside the server's findings.
465
- * @internal (dev only; the client entry's and the bind tier's)
466
- */
467
- export declare function slotShapeFinding(data: Record<string, string>, message: string): void; /**
468
- * Maps a wire chunk onto resident-store record writes. `data` chunks map to
469
- * no records — they are response-scoped and the host applies them through
470
- * its data hook.
471
- * @experimental
472
- */
473
- export declare function chunkToRecords(chunk: FrameChunk): Record<string, unknown>;
383
+ /** @experimental */
474
384
  export declare function createFrameHost(options?: FrameHostOptions): FrameHost;
475
385
  /**
476
386
  * The bubbling DOM event a frame dispatches from its parent element after
@@ -503,6 +413,33 @@ export declare const tierLoaders: Record<string, () => Promise<TierModule>>;
503
413
  export declare const tierLoads: Record<string, Promise<void> & {
504
414
  r?: any;
505
415
  }>;
416
+ /**
417
+ * Deferred hydration (see client.ts `installServerComponents`): while a
418
+ * driver is installed, an adopting frame with slots mounts NO occurrence at
419
+ * adoption — no walk, no record resolution, no fill — and hands itself to
420
+ * the driver, which mounts occurrences when an event lands in one
421
+ * (`mountEnclosing`), before a write lands (`mountDeferred` with no
422
+ * deadline) and in idle slices (`mountDeferred` with one). Unset, every
423
+ * frame mounts at adoption.
424
+ * @internal
425
+ */
426
+ export declare let deferDriver: ((frame: any) => void) | null;
427
+ /** @internal */
428
+ export declare function setDeferDriver(driver: ((frame: any) => void) | null): void;
429
+ /**
430
+ * @internal Dev only: wraps every deferred occurrence mount, with the claim
431
+ * scope (the document frame's site) and the occurrence id — the frames
432
+ * client's identity-drift check (client.ts).
433
+ */
434
+ export declare let deferMountWatch: ((site: string, id: string, mount: () => void) => void) | null;
435
+ /** @internal */
436
+ export declare function setDeferMountWatch(watch: ((site: string, id: string, mount: () => void) => void) | null): void;
437
+ /** @internal The live frames still owing their adoption-time mounts, outermost first. */
438
+ export declare function deferredFrames(): any[];
439
+ /** @internal Deferred hydration finished page-wide: every frame's adoption hold lifts. */
440
+ export declare function releaseDeferHolds(): void;
441
+ /** @internal The innermost live frame whose element contains `node`. */
442
+ export declare function liveFrameAt(node: Node): any;
506
443
  /**
507
444
  * Start (or join) a tier's load. Idempotent per name; a name with no loader
508
445
  * is resident already and resolves at once. Resolves once the module has
@@ -512,6 +449,24 @@ export declare const tierLoads: Record<string, Promise<void> & {
512
449
  export declare function prepareTier(name: string): Promise<void> & {
513
450
  r?: any;
514
451
  };
452
+ /**
453
+ * Whether a tier's code is resident — eager (no loader: `true`), or
454
+ * installed (its module). A tier that is neither has its load started here
455
+ * (the un-announced fallback: detection at the readiness check), and the
456
+ * caller holds. A tier dispatched off the stamp (`assets`) needs its loader
457
+ * wired — the client entry does; a spec driving this module directly wires
458
+ * and warms it (see frames-assets-client.spec).
459
+ */
460
+ /**
461
+ * A call is about to go to the wire on a page that shows frames: its answer
462
+ * will most likely land over content (a navigation, a refetch), and that
463
+ * morph rides the wire tier — start its load now, so it races the request
464
+ * instead of following the response's header.
465
+ * @internal
466
+ */
467
+ export declare const prepareMorph: () => Promise<void> & {
468
+ r?: any;
469
+ };
515
470
  export declare function createFrame(boundary: Element, options?: FrameOptions): Frame;
516
471
  export declare const FRAME_TAG = "solid-frame";
517
472
  export declare const FRAME_ID_ATTR = "data-fid"; /**
@@ -545,6 +500,10 @@ export declare function makeFrameElement(id: any): HTMLElement;
545
500
  /** Whether `node` is a frame boundary/region element (carries our id attr).
546
501
  * @internal */
547
502
  export declare function isFrameElement(node: any): any;
503
+ /** Parse an HTML string into a document fragment, preserving comments. */
504
+ export declare function parseFragment(html: any): DocumentFragment;
505
+ /** The `<!--pl-KEY-->` comment closing a placeholder range, or null. */
506
+ export declare function rangeClose(start: any, id: any): any;
548
507
  /**
549
508
  * Walk a slot range's interior — every node between `start` and the range's
550
509
  * end marker — calling `cb` on each. The next sibling is captured before the
@@ -553,3 +512,8 @@ export declare function isFrameElement(node: any): any;
553
512
  * @internal (exported for the regions tier — see `makeFrameElement`)
554
513
  */
555
514
  export declare function eachInRange(start: any, key: any, cb: any): any;
515
+ /** If `node` is a `slot:<id>:start` comment, return its id; else `null`. */
516
+ export declare function slotStartId(node: any): string;
517
+ export declare function preservesOpen(el: any): boolean;
518
+ /** The sibling immediately after the `slot:<id>:end` marker for `start`. */
519
+ export declare const afterRange: (start: any, id: any) => any;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Morph a frame's content toward a new root: `ranges` is the frame-wide
3
+ * displaced-range index (the eager client's `#applyRoot` builds it), and
4
+ * subtrees the reconcile inserted whole are grafted afterwards.
5
+ * @internal
6
+ */
7
+ export declare function morph(parent: any, fragment: any, claim: any, ranges: any): void;
8
+ /** Land each displaced range a morph pass left in `ranges` where its
9
+ * occurrence now is under `roots` (see `flushGrafts`). @internal */
10
+ export declare function graft(roots: any, ranges: any): void;
11
+ /**
12
+ * Reconcile the children of `parent` toward the children of `source`, reusing
13
+ * existing DOM in place. `source` is a freshly parsed, disposable node whose
14
+ * children are moved into `parent` only when they are genuinely new.
15
+ *
16
+ * When `boundStart`/`boundEnd` are given, only the nodes in `(boundStart,
17
+ * boundEnd)` are reconciled and new nodes are inserted before `boundEnd` —
18
+ * this is how a range-boundary frame reconciles between its markers without
19
+ * touching the client content around them.
20
+ *
21
+ * `ranges` (threaded through the whole recursion from the frame's root apply)
22
+ * indexes the frame content's slot ranges by occurrence id as they stood
23
+ * BEFORE this morph. Occurrence ids are unique within a frame's content, so
24
+ * a range the new content places under a different parent (keyed list churn)
25
+ * is still THAT occurrence — the index is what lets the morph relocate it,
26
+ * live interior intact, where sibling-scoped matching sees only a new id.
27
+ */
28
+ export declare function reconcileChildren(parent: any, source: any, boundStart?: any, boundEnd?: any, claim?: any, ranges?: any, grafts?: any): void;
@@ -1,4 +1,4 @@
1
- import { FrameChunk } from "./frame-client.js";
1
+ import type { FrameMessage } from "./frame-client.js";
2
2
  /**
3
3
  * Addresses a frame stream: the boundary id and this response's version.
4
4
  * @experimental
@@ -40,15 +40,15 @@ export interface FrameStreamOptions {
40
40
  * its response open and ships each later commit as holes; with no
41
41
  * declaration of liveness anywhere, that response ends here: after this
42
42
  * many emitting sweeps past the first flush the producer emits
43
- * `{ type: "complete", bound: "yields" }` and closes. `live()` is the
43
+ * `:complete` with `:bound: "yields"` and closes. `live()` is the
44
44
  * declared way past the bound; a `live` response is never bounded.
45
45
  * Default 64. `0` / `Infinity` disables the count bound.
46
46
  */
47
47
  maxYields?: number;
48
48
  /**
49
49
  * The plain response's streaming bound, in wall-clock milliseconds after
50
- * the first flush (the same decision): `{ type: "complete", bound:
51
- * "time" }` then the body closes. The request's `signal` aborting after
50
+ * the first flush (the same decision): `:complete` with `:bound:
51
+ * "time"`, then the body closes. The request's `signal` aborting after
52
52
  * the first flush ends a plain response the same way — a platform's
53
53
  * deadline is a time bound the client can tell from a death. Default
54
54
  * 30 000. `0` / `Infinity` disables the timer (the `signal` still ends
@@ -73,12 +73,13 @@ export interface FrameStreamOptions {
73
73
  [key: string]: unknown;
74
74
  }
75
75
  /**
76
- * A produced frame stream: pipe chunks, or await the collected array.
76
+ * A produced frame stream: pipe its wire messages, or await the collected
77
+ * array.
77
78
  * @experimental
78
79
  */
79
- export interface FrameStream extends PromiseLike<FrameChunk[]> {
80
+ export interface FrameStream extends PromiseLike<FrameMessage[]> {
80
81
  pipe(writable: {
81
- write(chunk: FrameChunk): void;
82
+ write(message: FrameMessage): void;
82
83
  end?(): void;
83
84
  }): void;
84
85
  }
@@ -95,12 +96,15 @@ export { SERVER_COMPONENT, SERVER_COMPONENT_SOURCE, SERVER_COMPONENT_ADDRESS, Se
95
96
  export declare const SERVER_COMPONENT_BOOTSTRAP: string; /**
96
97
  * The emission surface `renderToStream` routes through when producing a
97
98
  * frame stream instead of a document (see the `sink` render option). Each
98
- * method emits transport-agnostic chunks; `emit` is the envelope boundary.
99
+ * method writes records; `write` is the envelope boundary.
99
100
  * @internal Compiler/renderer wiring — use `renderToFrameStream` or
100
101
  * `renderServerComponent` instead.
101
102
  * @experimental
102
103
  */
103
- export declare function createFrameSink(emit: (chunk: FrameChunk) => void, frame: FrameAddress, have?: Record<string, string>): Record<string, (...args: any[]) => void>;
104
+ export declare function createFrameSink(write: (message: FrameMessage) => void, frame: FrameAddress, have?: Record<string, string>, hooks?: {
105
+ live?: boolean;
106
+ onYield?: () => void;
107
+ }): Record<string, (...args: any[]) => void>;
104
108
  /**
105
109
  * The root's SKELETON: its html with every live-hole range and slot range
106
110
  * emptied (markers kept). What remains is the structure hole emissions
@@ -83,7 +83,7 @@ export declare const FRAME_STREAM_HEADER = "X-Frame-Stream";
83
83
  * — `bind,regions,assets,trace,wire` — so the client starts their loads
84
84
  * before it reads the body. Omitted when nothing was minted. A tier first
85
85
  * needed after the head rides in-band instead: `tiers` on the next chunk
86
- * (`FrameChunk.tiers`). Additive wire: an old client ignores both; a new
86
+ * (`FrameMessage.tiers`). Additive wire: an old client ignores both; a new
87
87
  * client without them falls back to detection at the readiness check and
88
88
  * holds (frames-rulings 3.1) — the same DOM, later.
89
89
  * @experimental
@@ -114,6 +114,33 @@ export declare const FRAME_HAVE_BUDGET = 4096;
114
114
  export declare function decodeHaveList(text: string | null | undefined): Record<string, string> | undefined;
115
115
  export declare function isFrameStreamResponse(response: Response): boolean;
116
116
  export declare const applyFrameResponse: (response: Response, host: FrameHost, options?: ApplyFrameResponseOptions) => Promise<string>;
117
+ /**
118
+ * Reads a frame-stream Response to completion, applying every chunk to
119
+ * `host`. The client owns boundary identity: pass `options.as` to remap the
120
+ * producer's root frame id onto a local one (the id your insertable/frame
121
+ * registered under), so navigations to the same boundary reuse the same
122
+ * frame regardless of what the server called it. Resolves with the id the
123
+ * chunks were applied under once the stream ends.
124
+ *
125
+ * The client owns versions too: the producer can't know how many streams a
126
+ * boundary has consumed, so `options.version` restamps the response's
127
+ * chunks, making policy A's stale-guard real across navigations. A number
128
+ * versions the whole response — one response IS one version — which holds
129
+ * while a response addresses one boundary. A single-flight response
130
+ * addresses several (each invalidated region is its own boundary, with its
131
+ * own history), so `version` may instead be a function called once per
132
+ * frame in the response.
133
+ *
134
+ * `options.onOutcome` receives the payload text of each `outcome` chunk —
135
+ * the response-scoped single-flight envelope, which is the caller's result
136
+ * rather than anything the host renders.
137
+ */
138
+ /**
139
+ * Whether a message ends its frame's response: a batch writing `:complete`
140
+ * (the server declared the frame done) or `:error` (the failing kind of it).
141
+ * @internal (the live wire tier's too)
142
+ */
143
+ export declare const ends: (msg: any) => boolean;
117
144
  /** Brands an inline-rendered server component with its function id. */
118
145
  export declare const SERVER_COMPONENT: unique symbol;
119
146
  /** The unwrapped server component behind an inline-render wrap. */
@@ -235,6 +262,8 @@ export declare function createServerComponentHandler<C>(options: ServerComponent
235
262
  args: unknown[];
236
263
  context: unknown;
237
264
  retry?(): Promise<unknown>;
265
+ /** Observe tier: when the request went out (`performance.now()`). */
266
+ startedAt?: number;
238
267
  }): unknown;
239
268
  /**
240
269
  * A `live()` call was made (before its first fetch): starts the live wire
@@ -25,6 +25,21 @@ export declare function resolve(frame: any, occurrence: string, regions: Record<
25
25
  * down — no global registry.
26
26
  */
27
27
  export declare function bind(frame: any, occurrence: string): void;
28
+ /**
29
+ * A fill read a region element: the reader's owner places it, as reading
30
+ * `props.children` places client children. The region's nested fills mount
31
+ * under it — those waiting for a placement, and those the last placement's
32
+ * disposal took down with it.
33
+ */
34
+ export declare function place(el: Element): void;
35
+ /**
36
+ * Invoke a fill (`mount`, the binding's) for an occurrence: one in a region
37
+ * mounts under the owner that placed the region — so it reads the context
38
+ * the enclosing fill provides there — and lives as long as that placement.
39
+ * While the region is unplaced (occluded, or its placement disposed) it
40
+ * waits; the next placement mounts it afresh over what the range holds.
41
+ */
42
+ export declare function nest(mount: (props: any, ctx: any) => void, props: any, ctx: any): void;
28
43
  /**
29
44
  * Dispose the frames bound over an occurrence's regions and forget them;
30
45
  * without an occurrence, every region of the frame (the frame is being
@@ -223,8 +223,8 @@ export declare const DEFAULT_WEB_PLUGINS: readonly ({
223
223
  * Integration-facing; may change (see the entry banner).
224
224
  */
225
225
  export declare function resolveSerializerPlugins(customPlugins?: SerializerPlugin[]): SerializerPlugin[];
226
- export declare function resolveCodecOptions({ plugins, disabledFeatures, depthLimit, serializeErrorStacks }?: JSONCodecOptions): {
227
- plugins: SerializerPlugin<any, any>[];
226
+ export declare function resolveCodecOptions(options?: JSONCodecOptions): {
227
+ plugins: any;
228
228
  disabledFeatures: number;
229
229
  depthLimit: number;
230
230
  serializeErrorStacks: boolean;
@@ -27,58 +27,6 @@ import type { Element as SolidElement } from "solid-js";
27
27
  export type Slot<P = {}> = (props: P & {
28
28
  $key?: string | number;
29
29
  }) => SolidElement;
30
- declare const slotError: unique symbol;
31
- /**
32
- * A binding slot's rejected return shape: assigning to it fails, and the
33
- * error names the reason `M`.
34
- * @experimental
35
- */
36
- export type SlotError<M extends string> = {
37
- [slotError]: M;
38
- };
39
- /**
40
- * What a binding slot's fill may return: `J` when it is a plain object with no
41
- * `$`-prefixed key (reserved for occurrence identity), otherwise a
42
- * `SlotError` naming why not.
43
- * @experimental
44
- */
45
- export type SlotOutput<J> = J extends readonly unknown[] ? SlotError<"binding slot output must be an object, not an array"> : J extends Node ? SlotError<"binding slot output must be an object, not a DOM node"> : J extends (...args: any[]) => any ? SlotError<"binding slot output must be an object, not a function"> : J extends PromiseLike<unknown> | AsyncIterable<unknown> ? SlotError<"binding slot output must be settled, not async"> : Extract<keyof J, `$${string}`> extends never ? J : SlotError<`reserved key: ${Extract<keyof J, `$${string}`> & string}`>;
46
- /**
47
- * A binding slot (principles §9.2.3): the client renders an object instead of
48
- * markup, and the server template binds its properties at positions —
49
- * `const row = props.row({ id, completed });` then
50
- * `<li class={row.rowClass} hidden={row.removed}><input checked={row.done}
51
- * onInput={row.toggle} /></li>`. One call is one data context: any element
52
- * in the template may read from it, and the client owns exactly the values
53
- * the template read. Keys are the client's names; the position decides what
54
- * a property IS (attribute, class name, style property, handler, ref, or
55
- * text — `<strong>{list.remaining}</strong>`, a string or number). On
56
- * the server a property is a stand-in, never the value: bind it, never
57
- * branch on it or compute with it.
58
- *
59
- * The fill runs once per occurrence, untracked, as a component body does:
60
- * state it creates lives with the occurrence, a top-level read is a
61
- * one-time read, and a getter is the reactive form. Handlers and refs are
62
- * read once, when an element binds.
63
- *
64
- * `P` is the args the server passes (reactive props to the fill, as for
65
- * `Slot`); `J` is the object the fill returns — the same type a shared
66
- * component takes as a prop when the client renders it directly, so one
67
- * `TodoRow` serves both sides. `$key` is occurrence identity, as for `Slot`,
68
- * and optional: within a render, repeated calls with structurally equal
69
- * args are one occurrence (a call in a component prop is re-evaluated per
70
- * position the component binds), so the natural spelling needs no key;
71
- * `$key` is for state inside the fill's scope that must follow the entity
72
- * across responses. A slot with no args (`P` empty) is called bare —
73
- * `const filters = props.filters();` — and is one occurrence named by the
74
- * prop.
75
- * @experimental
76
- */
77
- export type BindingSlot<P = {}, J extends object = Record<string, unknown>> = {} extends P ? (props?: P & {
78
- $key?: string | number;
79
- }) => SlotOutput<J> : (props: P & {
80
- $key?: string | number;
81
- }) => SlotOutput<J>;
82
30
  /**
83
31
  * Types an async value crossing the slot border (DR-2, value tier). What you
84
32
  * pass is what ships — the promise / async iterable itself rides the data
@@ -100,5 +48,5 @@ export type BindingSlot<P = {}, J extends object = Record<string, unknown>> = {}
100
48
  * ```
101
49
  */
102
50
  export declare function asyncArg<T>(value: PromiseLike<T> | AsyncIterable<T>): T;
103
- export { renderToFrameStream, renderServerComponent, serverComponentResponse, frameTransformResult, frameTransformFlightResult, createFrameSink, frameTransformDirectResult, ServerComponentPlugin, SERVER_COMPONENT_BOOTSTRAP } from "./frame-sink.js";
51
+ export { frameTransformResult, frameTransformFlightResult, frameTransformDirectResult, ServerComponentPlugin, SERVER_COMPONENT_BOOTSTRAP } from "./frame-sink.js";
104
52
  export { FRAME_STREAM_HEADER, FRAME_HAVE_HEADER, FRAME_HAVE_BUDGET, FRAME_TIERS_HEADER, isFrameStreamResponse } from "./frame-transport.js";