@solidjs/web 2.0.0-rc.13 → 2.0.0-rc.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.dev.js +317 -185
- package/dist/server.js +298 -161
- package/dist/server.observe.js +299 -171
- package/dist/web.dev.js +207 -189
- package/dist/web.js +180 -178
- package/dist/web.observe.js +180 -180
- package/frames/dist/assets.js +92 -0
- package/frames/dist/bind.dev.js +326 -0
- package/frames/dist/bind.js +295 -0
- package/frames/dist/client.dev.js +665 -1114
- package/frames/dist/client.js +630 -1087
- package/frames/dist/client.observe.js +629 -1087
- package/frames/dist/regions.js +130 -0
- package/frames/dist/server.dev.js +400 -201
- package/frames/dist/server.js +397 -198
- package/frames/dist/server.observe.js +397 -198
- package/frames/dist/trace.js +45 -0
- package/frames/dist/wire.js +133 -0
- package/package.json +30 -4
- package/performance-tracks/dist/performance-tracks.dev.js +2 -1
- package/performance-tracks/dist/performance-tracks.observe.js +2 -1
- package/performance-tracks/types/index.d.ts +8 -6
- package/serialization/dist/decode.js +38 -9
- package/serialization/dist/serialization.js +40 -11
- package/serialization/types/serializer-decode.d.ts +24 -2
- package/server-functions/dist/client.dev.js +101 -62
- package/server-functions/dist/client.js +101 -62
- package/server-functions/dist/client.observe.js +101 -62
- package/server-functions/dist/server.dev.js +178 -67
- package/server-functions/dist/server.js +178 -67
- package/server-functions/dist/server.observe.js +178 -67
- package/skills/server-components/SKILL.md +65 -43
- package/types/client.d.ts +120 -8
- package/types/constants.d.ts +3 -1
- package/types/diagnostics.d.ts +8 -0
- package/types/frames/assets-tier.d.ts +78 -0
- package/types/frames/bind-tier.d.ts +60 -0
- package/types/frames/client.d.ts +37 -3
- package/types/frames/frame-client.d.ts +249 -78
- package/types/frames/frame-container-plugin.d.ts +2 -2
- package/types/frames/frame-sink.d.ts +33 -0
- package/types/frames/frame-transport.d.ts +66 -18
- package/types/frames/regions-tier.d.ts +45 -0
- package/types/frames/serializer-decode.d.ts +24 -2
- package/types/frames/server.d.ts +33 -9
- package/types/frames/trace-tier.d.ts +2 -0
- package/types/frames/wire-tier.d.ts +116 -0
- package/types/head.d.ts +1 -0
- package/types/index.d.ts +61 -16
- package/types/index.server.d.ts +3 -18
- package/types/jsx.d.ts +4 -13
- package/types/observe.d.ts +4 -2
- package/types/response.d.ts +26 -4
- package/types/serializer-decode.d.ts +24 -2
- package/types/server-functions/client.d.ts +30 -0
- package/types/server-functions/registry.d.ts +4 -1
- package/types/server-functions/shared.d.ts +12 -8
- package/types/server-mock.d.ts +22 -3
- package/types/server.d.ts +119 -17
|
@@ -54,12 +54,6 @@ export interface ServerComponentHandlerOptions<C = unknown> {
|
|
|
54
54
|
* to that address's store. Multi-mount fans out per site.
|
|
55
55
|
*/
|
|
56
56
|
component(fnId: string): C;
|
|
57
|
-
/**
|
|
58
|
-
* A new response is about to stream into an address: rotate
|
|
59
|
-
* response-scoped state (codec data tables) here. `version` is the
|
|
60
|
-
* client-owned stream counter the chunks will be stamped with.
|
|
61
|
-
*/
|
|
62
|
-
onStream?(address: string, version: number, response: Response): void;
|
|
63
57
|
/**
|
|
64
58
|
* Answer a call before any request is made (t = 0 local answers — a
|
|
65
59
|
* boundary the document already carries). Returning `undefined` is a
|
|
@@ -82,6 +76,19 @@ export interface ServerComponentHandlerOptions<C = unknown> {
|
|
|
82
76
|
* value.
|
|
83
77
|
*/
|
|
84
78
|
export declare const FRAME_STREAM_HEADER = "X-Frame-Stream";
|
|
79
|
+
/**
|
|
80
|
+
* The tiers a frame stream needs (frames savings pass §2, the
|
|
81
|
+
* server-announced tier mechanism): the names, comma-separated, of the
|
|
82
|
+
* frames-client tiers the render had minted when the response head left
|
|
83
|
+
* — `bind,regions,assets,trace,wire` — so the client starts their loads
|
|
84
|
+
* before it reads the body. Omitted when nothing was minted. A tier first
|
|
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
|
|
87
|
+
* client without them falls back to detection at the readiness check and
|
|
88
|
+
* holds (frames-rulings 3.1) — the same DOM, later.
|
|
89
|
+
* @experimental
|
|
90
|
+
*/
|
|
91
|
+
export declare const FRAME_TIERS_HEADER = "X-Frame-Tiers";
|
|
85
92
|
/**
|
|
86
93
|
* The resume request's have-list (RFC 11 §9.5, Resume request): the
|
|
87
94
|
* digests the client holds for the address it is reconnecting — the root
|
|
@@ -98,13 +105,6 @@ export declare const FRAME_STREAM_HEADER = "X-Frame-Stream";
|
|
|
98
105
|
export declare const FRAME_HAVE_HEADER = "X-Frame-Have";
|
|
99
106
|
/** The have-list's size ceiling in encoded bytes (see FRAME_HAVE_HEADER). */
|
|
100
107
|
export declare const FRAME_HAVE_BUDGET = 4096;
|
|
101
|
-
/**
|
|
102
|
-
* Encodes a have-list for the header: `key=digest` pairs, comma-joined
|
|
103
|
-
* (keys never contain either separator; the root's key is empty).
|
|
104
|
-
* `undefined` when the list is empty or over budget.
|
|
105
|
-
* @internal
|
|
106
|
-
*/
|
|
107
|
-
export declare function encodeHaveList(have: Record<string, string>): string | undefined;
|
|
108
108
|
/**
|
|
109
109
|
* Decodes a have-list header value; `undefined` for an absent/empty one.
|
|
110
110
|
* Tolerant of malformed entries (skipped) — a wrong entry costs one
|
|
@@ -133,6 +133,41 @@ export declare const SERVER_COMPONENT_ADDRESS: unique symbol;
|
|
|
133
133
|
* `Symbol.for`, so consumers honor it without importing this module.
|
|
134
134
|
*/
|
|
135
135
|
export declare const COMPONENT_BINDING: unique symbol;
|
|
136
|
+
/**
|
|
137
|
+
* The address a content token belongs to; a plain address passes through.
|
|
138
|
+
* @internal
|
|
139
|
+
*/
|
|
140
|
+
export declare function contentAddress(token: string): string;
|
|
141
|
+
/**
|
|
142
|
+
* The live handler's staged content (see `createServerComponentHandler`),
|
|
143
|
+
* by token; a plain address, or a token already committed or superseded,
|
|
144
|
+
* is a no-op. Mounts call both halves from the render effect that follows
|
|
145
|
+
* their address accessor: `preview` from its compute half — under the
|
|
146
|
+
* transaction that delivered the token, so the slot args it pushes into the
|
|
147
|
+
* live fills (see `FrameHost.preview`) are staged with it and a fill's
|
|
148
|
+
* derivation over an arg re-derives in that pass, never one flush behind
|
|
149
|
+
* the intent it held (principles §9.2.2) — and `commit` from its effect
|
|
150
|
+
* half, landing the buffered response as the store's writes in the commit.
|
|
151
|
+
* Installed by the handler (one active handler at a time, as for
|
|
152
|
+
* `resolveServerComponent` below).
|
|
153
|
+
* @internal
|
|
154
|
+
*/
|
|
155
|
+
export declare const stagedContent: {
|
|
156
|
+
preview(token: string): void;
|
|
157
|
+
commit(token: string): void;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* The call recorded for an address — `{ id, meta, args, retry }`, `retry`
|
|
161
|
+
* the thunk that makes the same call again — or `undefined` for an address
|
|
162
|
+
* no response or document answer named.
|
|
163
|
+
* @internal
|
|
164
|
+
*/
|
|
165
|
+
export declare function callFor(address: string): {
|
|
166
|
+
id: string;
|
|
167
|
+
meta: unknown;
|
|
168
|
+
args: unknown[];
|
|
169
|
+
retry(): Promise<unknown>;
|
|
170
|
+
} | undefined;
|
|
136
171
|
export declare function setServerComponentBootstrap(resolve: (ctx: unknown) => string): void;
|
|
137
172
|
/**
|
|
138
173
|
* Seroval plugin for a server component crossing a serialization boundary.
|
|
@@ -183,24 +218,39 @@ export declare const ServerComponentPlugin: {
|
|
|
183
218
|
*/
|
|
184
219
|
export declare function flightCodec(codec?: JSONCodecOptions): JSONCodecOptions;
|
|
185
220
|
export declare function createServerComponentHandler<C>(options: ServerComponentHandlerOptions<C>): {
|
|
221
|
+
/**
|
|
222
|
+
* `retry` (the server-function client's thunk for the call it is
|
|
223
|
+
* answering or dispatched, declared shape included) is recorded behind
|
|
224
|
+
* the call's address for the re-ask (`callFor`, frames-rulings 3.3).
|
|
225
|
+
*/
|
|
186
226
|
intercept?(info: {
|
|
187
227
|
id: string;
|
|
188
228
|
meta: unknown;
|
|
189
229
|
args: unknown[];
|
|
230
|
+
retry?(): Promise<unknown>;
|
|
190
231
|
}): unknown;
|
|
191
232
|
handle(response: Response, ctx: {
|
|
192
233
|
id: string;
|
|
193
234
|
meta: unknown;
|
|
194
235
|
args: unknown[];
|
|
195
236
|
context: unknown;
|
|
237
|
+
retry?(): Promise<unknown>;
|
|
196
238
|
}): unknown;
|
|
239
|
+
/**
|
|
240
|
+
* A `live()` call was made (before its first fetch): starts the live wire
|
|
241
|
+
* tier's load (`prepareTier("wire")`), so the import races only the
|
|
242
|
+
* request — preload-at-call.
|
|
243
|
+
*/
|
|
244
|
+
onLive(): void;
|
|
197
245
|
/**
|
|
198
246
|
* What a `live` (re)connect of the call resumes from (RFC 11 §9.5,
|
|
199
247
|
* Resume request): the address's version ordinal as the position
|
|
200
248
|
* (`Last-Event-ID`) and, when a mount shows the address with a ledger,
|
|
201
249
|
* its have-list under `FRAME_HAVE_HEADER` — omitted over budget, so the
|
|
202
250
|
* render is a full snapshot then. `undefined` when nothing here has
|
|
203
|
-
* shown the call
|
|
251
|
+
* shown the call — or while the live wire tier, which keeps the ledger
|
|
252
|
+
* and answers this, is not resident yet (a first connect over content a
|
|
253
|
+
* plain call applied: a full snapshot, the degraded case accepted).
|
|
204
254
|
*/
|
|
205
255
|
resume(info: {
|
|
206
256
|
id: string;
|
|
@@ -214,10 +264,8 @@ export declare function createServerComponentHandler<C>(options: ServerComponent
|
|
|
214
264
|
* Declares that the document is showing a call: hydration-data references
|
|
215
265
|
* carry their call's address (`_$SC.r(id, address)`) but never travel
|
|
216
266
|
* through the transport, so the integration forwards those records here.
|
|
217
|
-
* Mints the call's binding
|
|
218
|
-
* whose component matches what the document mounted
|
|
219
|
-
* per-function component so cache-seeded readers deliver instead of
|
|
220
|
-
* remounting when their site later switches calls.
|
|
267
|
+
* Mints the call's binding, so a post-load refetch resolves a value
|
|
268
|
+
* whose component matches what the document mounted.
|
|
221
269
|
*/
|
|
222
270
|
showing(address: string, functionId: string): void;
|
|
223
271
|
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `{$frame}` arm of a frame's arg resolution: for each region arg of
|
|
3
|
+
* the record (`regions`: arg name -> wire id), the region ELEMENT the
|
|
4
|
+
* wrapper places goes into `props` — cached per occurrence, so a re-call
|
|
5
|
+
* re-places the SAME element (no marker range to walk, no fragment refill)
|
|
6
|
+
* and the bound frame's parent follows live. `start` is given on the
|
|
7
|
+
* adopt-time mount (the frame's `claiming`): the interior's region elements
|
|
8
|
+
* are discovered first, so the record's addresses resolve to them.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolve(frame: any, occurrence: string, regions: Record<string, string>, props: Record<string, unknown>, start?: unknown): void;
|
|
11
|
+
/**
|
|
12
|
+
* Bind a frame over each of the occurrence's region elements that has none
|
|
13
|
+
* yet — those `resolve` minted during the invoke or, on the adopt path,
|
|
14
|
+
* discovered in the interior before the fill ran (the fill owns its range
|
|
15
|
+
* through the framework's insert; the frame never reads its output back).
|
|
16
|
+
* Bind eagerly — the region ELEMENT always exists (unlike a marker range,
|
|
17
|
+
* which needs placement to count).
|
|
18
|
+
* This is what makes an OCCLUDED region work: its element is created when
|
|
19
|
+
* args resolve but the wrapper doesn't place it until (e.g.) expand, so it
|
|
20
|
+
* must bind and fill (from buffered/streamed chunks) off-DOM, then reveal
|
|
21
|
+
* in place when the wrapper finally inserts the single node. Host
|
|
22
|
+
* buffering flushes any queued childId chunks. The region inherits this
|
|
23
|
+
* frame's slot resolution (`parent`), so client slots revealed in its
|
|
24
|
+
* streamed content are filled by the same callbacks the client threaded
|
|
25
|
+
* down — no global registry.
|
|
26
|
+
*/
|
|
27
|
+
export declare function bind(frame: any, occurrence: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Dispose the frames bound over an occurrence's regions and forget them;
|
|
30
|
+
* without an occurrence, every region of the frame (the frame is being
|
|
31
|
+
* disposed).
|
|
32
|
+
*/
|
|
33
|
+
export declare function unmount(frame: any, occurrence?: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* For the staged preview (`Frame.preview`): whether the record adds a
|
|
36
|
+
* region to the occurrence or renames one of its regions — its chunks ride
|
|
37
|
+
* the new name, so the rename must land with them at the commit, not in
|
|
38
|
+
* the preview. Read off the host's note of the record's `{$frame}` args.
|
|
39
|
+
*/
|
|
40
|
+
export declare function changed(frame: any, occurrence: string, record: {
|
|
41
|
+
regions?: Record<string, string>;
|
|
42
|
+
}): boolean;
|
|
43
|
+
/** The frames bound over the frame's regions (the staged preview recurses
|
|
44
|
+
* into them). */
|
|
45
|
+
export declare function frames(frame: any): any[];
|
|
@@ -121,8 +121,17 @@ export interface JSONCodecOptions {
|
|
|
121
121
|
/**
|
|
122
122
|
* A resident, response-scoped decode table over the keyed JSON codec: apply
|
|
123
123
|
* each frame `data` chunk with `apply`, resolve `{ $ref }` slot args with
|
|
124
|
-
* `resolve
|
|
125
|
-
* (`applyData: c => table.apply(c)
|
|
124
|
+
* `resolve`, and `close` it when the response ends. The frames client host
|
|
125
|
+
* wires one per response (`applyData: c => table.apply(c)`,
|
|
126
|
+
* `closeData: (…) => table.close(error)`).
|
|
127
|
+
*
|
|
128
|
+
* A `{ $ref }` to a key no `apply` has delivered yet is a PENDING READ the
|
|
129
|
+
* table owns (`@internal` behaviour — the frames client is its consumer): a
|
|
130
|
+
* promise marked `s = 0`, settled by the key's `apply` and rejected by
|
|
131
|
+
* `close` — the response ended without delivering the key, so a value that
|
|
132
|
+
* never comes is an error where it is read, not a silence. Stamped `s`/`v`
|
|
133
|
+
* as it settles (`1` fulfilled, `2` rejected — the hydration serializer's
|
|
134
|
+
* marks, which a reader adopts synchronously).
|
|
126
135
|
*
|
|
127
136
|
* Integration-facing; may change (see the entry banner). This serialization
|
|
128
137
|
* entry is the single home of the data table — the frames client consumes
|
|
@@ -134,9 +143,22 @@ export interface JSONDataTable {
|
|
|
134
143
|
node?: unknown;
|
|
135
144
|
initial?: boolean;
|
|
136
145
|
}): void;
|
|
146
|
+
/**
|
|
147
|
+
* The value under `ref`, or the table's pending read of it: a promise
|
|
148
|
+
* marked `s = 0` carrying `c`, the callbacks the table runs in the
|
|
149
|
+
* `apply` / `close` that settles it — the key delivered (whatever its
|
|
150
|
+
* value's shape: a delivered promise is adopted by the read, the
|
|
151
|
+
* callbacks do not wait for it) or the table closed.
|
|
152
|
+
*/
|
|
137
153
|
resolve<T = unknown>(ref: {
|
|
138
154
|
$ref: string;
|
|
139
155
|
}): T;
|
|
156
|
+
/**
|
|
157
|
+
* The response has ended: every pending read of a key it never
|
|
158
|
+
* delivered rejects — with `error` (the response's own) when given, with
|
|
159
|
+
* an `Error` naming the key otherwise. Idempotent.
|
|
160
|
+
*/
|
|
161
|
+
close(error?: unknown): void;
|
|
140
162
|
}
|
|
141
163
|
/**
|
|
142
164
|
* Baseline plugin set for serializing web-platform values. Shared by the
|
package/types/frames/server.d.ts
CHANGED
|
@@ -27,15 +27,39 @@ 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;
|
|
30
31
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
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
|
|
34
50
|
* `<li class={row.rowClass} hidden={row.removed}><input checked={row.done}
|
|
35
51
|
* onInput={row.toggle} /></li>`. One call is one data context: any element
|
|
36
52
|
* in the template may read from it, and the client owns exactly the values
|
|
37
53
|
* the template read. Keys are the client's names; the position decides what
|
|
38
|
-
* a property IS (attribute, class name, style property, handler, ref
|
|
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.
|
|
39
63
|
*
|
|
40
64
|
* `P` is the args the server passes (reactive props to the fill, as for
|
|
41
65
|
* `Slot`); `J` is the object the fill returns — the same type a shared
|
|
@@ -50,11 +74,11 @@ export type Slot<P = {}> = (props: P & {
|
|
|
50
74
|
* prop.
|
|
51
75
|
* @experimental
|
|
52
76
|
*/
|
|
53
|
-
export type
|
|
77
|
+
export type BindingSlot<P = {}, J extends object = Record<string, unknown>> = {} extends P ? (props?: P & {
|
|
54
78
|
$key?: string | number;
|
|
55
|
-
}) => J : (props: P & {
|
|
79
|
+
}) => SlotOutput<J> : (props: P & {
|
|
56
80
|
$key?: string | number;
|
|
57
|
-
}) => J
|
|
81
|
+
}) => SlotOutput<J>;
|
|
58
82
|
/**
|
|
59
83
|
* Types an async value crossing the slot border (DR-2, value tier). What you
|
|
60
84
|
* pass is what ships — the promise / async iterable itself rides the data
|
|
@@ -76,5 +100,5 @@ export type AttributeSlot<P = {}, J extends object = Record<string, unknown>> =
|
|
|
76
100
|
* ```
|
|
77
101
|
*/
|
|
78
102
|
export declare function asyncArg<T>(value: PromiseLike<T> | AsyncIterable<T>): T;
|
|
79
|
-
export {
|
|
80
|
-
export { FRAME_STREAM_HEADER, FRAME_HAVE_HEADER, FRAME_HAVE_BUDGET, isFrameStreamResponse } from "./frame-transport.js";
|
|
103
|
+
export { frameTransformResult, frameTransformFlightResult, frameTransformDirectResult, ServerComponentPlugin, SERVER_COMPONENT_BOOTSTRAP } from "./frame-sink.js";
|
|
104
|
+
export { FRAME_STREAM_HEADER, FRAME_HAVE_HEADER, FRAME_HAVE_BUDGET, FRAME_TIERS_HEADER, isFrameStreamResponse } from "./frame-transport.js";
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { FrameHost, FrameHostOptions } from "./frame-client.js";
|
|
2
|
+
/**
|
|
3
|
+
* The host the handler hands over: the frame host, carrying the lazily
|
|
4
|
+
* loaded deserializer's load (`prepareData`) the transport awaits before a
|
|
5
|
+
* chunk that reads data — forwarded unchanged to the connection's proxy.
|
|
6
|
+
*/
|
|
7
|
+
type Host = FrameHost & Pick<FrameHostOptions, "prepareData">;
|
|
8
|
+
/** A live loop's wire slot (see `LIVE_WIRE` in server-functions/shared.ts). */
|
|
9
|
+
interface WireSlot {
|
|
10
|
+
connection: Connection;
|
|
11
|
+
open(body: ReadableStream<Uint8Array> | null): {
|
|
12
|
+
next(): Promise<IteratorResult<string>>;
|
|
13
|
+
cancel?(reason?: unknown): unknown;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** The connection slot the loop renews per connect (`wire.connection`). */
|
|
17
|
+
interface Connection {
|
|
18
|
+
ended?: Promise<ConnectionEnd>;
|
|
19
|
+
cancel?(reason: Error): void;
|
|
20
|
+
done?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** How a connection ended, as the loop reads it off `connection.ended`. */
|
|
23
|
+
interface ConnectionEnd {
|
|
24
|
+
open: number;
|
|
25
|
+
error: Error;
|
|
26
|
+
sweep(): void;
|
|
27
|
+
close(): void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Ledger upkeep for an applied content record (the frame's `#recordHave`
|
|
31
|
+
* hands every one here): `""` is the root and RESETS the ledger to the
|
|
32
|
+
* root's digest and hole map; any other key takes the record's digest and
|
|
33
|
+
* the map of holes inside it. A record without a digest (an older
|
|
34
|
+
* producer) leaves the entry as it was. Without a ledger (no digest-
|
|
35
|
+
* carrying root applied) there is nothing to keep — the next resume is a
|
|
36
|
+
* full snapshot either way.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export declare function have(frame: object, key: string, record: {
|
|
40
|
+
digest?: string;
|
|
41
|
+
holes?: Record<string, string>;
|
|
42
|
+
}): void;
|
|
43
|
+
/**
|
|
44
|
+
* The have-list of what a mount shows — the server-minted digests of the
|
|
45
|
+
* root skeleton under `""`, each live hole and attr hole by ledger key,
|
|
46
|
+
* each revealed fragment by name. `undefined` when the content's provenance
|
|
47
|
+
* carried no digests, or applied before this tier was resident (a
|
|
48
|
+
* document-adopted interior, a plain call's response): a resume then takes
|
|
49
|
+
* the full snapshot.
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
export declare function haveOf(frame: object): Record<string, string> | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Encodes a have-list for the header: `key=digest` pairs, comma-joined
|
|
55
|
+
* (keys never contain either separator; the root's key is empty).
|
|
56
|
+
* `undefined` when the list is empty or over budget.
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
export declare function encodeHaveList(have: Record<string, string>): string | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* What a `live` (re)connect of a call resumes from (the handler's
|
|
62
|
+
* `resume`): the address's version ordinal as the position and, when a
|
|
63
|
+
* mount shows the address with a ledger, its have-list under
|
|
64
|
+
* `FRAME_HAVE_HEADER` — omitted over budget, so the render is a full
|
|
65
|
+
* snapshot then. `undefined` when nothing here has shown the call. The
|
|
66
|
+
* ledger is the MOUNT's (it tracks what the DOM shows); the first mount
|
|
67
|
+
* under the address speaks for all — they show the same store.
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
export declare function resume(host: FrameHost, info: {
|
|
71
|
+
id: string;
|
|
72
|
+
args: unknown[];
|
|
73
|
+
}, versions: Map<string, number>): {
|
|
74
|
+
position: string;
|
|
75
|
+
headers?: Record<string, string>;
|
|
76
|
+
} | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Supersession (§9.5, Client face 4): a newer version for the address from
|
|
79
|
+
* another response — a getter refetch, a preload, a mutation's region —
|
|
80
|
+
* makes the open connection's later chunks inert under the stale-guard, so
|
|
81
|
+
* it is cancelled and the loop reconnects from the death. The handler's
|
|
82
|
+
* `bump` calls this for every bump, the loop's own reconnect included
|
|
83
|
+
* (whose predecessor has already ended and left the slot).
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
export declare function cancel(host: object, address: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* The live arm of the handler's `handle` (§9.5, Client face 2): the binding
|
|
89
|
+
* resolves the call now, and the response's lifetime — its end and how it
|
|
90
|
+
* ended — reaches the loop through its wire slot, so frames CONSUME the
|
|
91
|
+
* loop rather than mirror it: death → the loop's backoff and re-invoke,
|
|
92
|
+
* which resolves this same binding again (stable per address, so an
|
|
93
|
+
* equals-gated reader keeps its instance); completion → the loop
|
|
94
|
+
* completes.
|
|
95
|
+
*
|
|
96
|
+
* A live connection already streaming this address is JOINED: this
|
|
97
|
+
* response is ended here (the server tears its render down on the
|
|
98
|
+
* cancel) and the joining loop sees the shared connection's death when it
|
|
99
|
+
* comes, reconnecting like the loop that owns it (one of the two wins the
|
|
100
|
+
* next slot; the other joins again). Otherwise the response OPENS the
|
|
101
|
+
* address's connection: `bump` versions it and `begin` moves the store to
|
|
102
|
+
* the version at the header; the body is read through the loop's reader
|
|
103
|
+
* when it is framed as an event stream (`ChunkReader` otherwise), handed to
|
|
104
|
+
* the transport under the wire slot; and the end is judged HERE by what the
|
|
105
|
+
* body left open — `complete` is the bounded signal, an unkeyed `error` the
|
|
106
|
+
* failing kind of it; a body that ends with any still open is a DEATH, never
|
|
107
|
+
* a completion (§9.5, Wire) — and told to the loop with the sweep it may run
|
|
108
|
+
* over the open frames if the iteration ends for good by error (`close`
|
|
109
|
+
* leaves them as they stand: a superseding reconnect re-renders them). The
|
|
110
|
+
* transport's own end-of-body sweep (an error record per open frame, the
|
|
111
|
+
* no-loop verdict) is swallowed: the loop decides. A rejected read is a
|
|
112
|
+
* death the loop already sees, not an error record.
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
export declare function connect(response: Response, wire: WireSlot, address: string, binding: unknown, host: Host, bump: (address: string) => number, begin: (address: string, version: number) => void): unknown;
|
|
116
|
+
export {};
|
package/types/head.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare function classifyHeadTag(desc: any): {
|
|
|
14
14
|
};
|
|
15
15
|
export declare function qualifierValue(name: any, value: any): any;
|
|
16
16
|
export declare function asciiLowerCase(value: any): any;
|
|
17
|
+
export declare function headBodyText(tag: any, props: any, text: any): any;
|
|
17
18
|
export declare function resourceIdentity(tag: any, props: any): string;
|
|
18
19
|
export declare function replaceableIdentity(tag: any, props: any, key: any, unique: any): any;
|
|
19
20
|
export declare function resolveHead(groups: any): Map<any, any>;
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from "solid-js";
|
|
1
|
+
import { Component, type DynamicOptions } from "solid-js";
|
|
2
2
|
import type { JSX } from "./jsx.js";
|
|
3
3
|
export * from "./client.js";
|
|
4
4
|
export * from "./server-mock.js";
|
|
@@ -79,21 +79,61 @@ export declare function Portal(props: {
|
|
|
79
79
|
mount?: Element;
|
|
80
80
|
children: JSX.Element;
|
|
81
81
|
}): JSX.Element;
|
|
82
|
-
export
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
82
|
+
export type { DynamicOptions } from "solid-js";
|
|
83
|
+
export { dynamicComponent } from "solid-js";
|
|
84
|
+
/**
|
|
85
|
+
* Returns a stable `Component` whose identity is driven by a reactive (and
|
|
86
|
+
* optionally async) `source`. The returned component can be used anywhere a
|
|
87
|
+
* normal component is used; children and props flow through JSX as usual.
|
|
88
|
+
*
|
|
89
|
+
* `source` may return a component, a native tag name (`'input'`, `'textarea'`,
|
|
90
|
+
* etc.), `undefined`, or a `Promise` of any of the above. A pending promise
|
|
91
|
+
* propagates as `NotReadyError` through the surrounding reactive scope, so
|
|
92
|
+
* async swaps compose with `<Loading>` boundaries the same way as `lazy`.
|
|
93
|
+
*
|
|
94
|
+
* During SSR a pending source streams in behind its boundary by default. Pass
|
|
95
|
+
* `{ deferStream: true }` to hold the document's first flush until it settles
|
|
96
|
+
* (the same option `createMemo` takes); the client ignores it.
|
|
97
|
+
*
|
|
98
|
+
* For a tag-name source the element's namespace is inferred from the tag. A
|
|
99
|
+
* tag that exists in both HTML and SVG (`a`, `script`, `style`, `title`) is
|
|
100
|
+
* created as HTML unless the instance passes `xmlns` — the same attribute
|
|
101
|
+
* compiled JSX uses for the same purpose. `is` (customized built-ins) and
|
|
102
|
+
* `xmlns` are read once at creation and then applied as ordinary attributes.
|
|
103
|
+
*
|
|
104
|
+
* `{ static: true }` says the source cannot change: it is called once,
|
|
105
|
+
* untracked, when `dynamic()` is called, and each instance renders the result
|
|
106
|
+
* with no computation of its own — a tag name goes straight to the compiled
|
|
107
|
+
* element path (create or claim, spread), a component is called directly. No
|
|
108
|
+
* owner is created on either side, so hydration keys stay aligned with the
|
|
109
|
+
* compiled output. Use it for a constant (`dynamic(() => "li", { static: true })`
|
|
110
|
+
* in a runtime `styled()`), or per instance from the shape of a prop:
|
|
111
|
+
* `isStatic(props, "as")` is true when the caller wrote `as="button"`
|
|
112
|
+
* (a data property) and false when they wrote `as={cond() ? …}` (a getter),
|
|
113
|
+
* so a polymorphic component keeps a reactive public `as` and still pays
|
|
114
|
+
* nothing for the literal case. A static source may not return a promise.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```tsx
|
|
118
|
+
* // `source` can return either a custom Component or a native tag
|
|
119
|
+
* // name — they're interchangeable, and the returned reference is a
|
|
120
|
+
* // stable Component you can use anywhere a normal one would go.
|
|
121
|
+
* const Field = dynamic(() => multiline() ? RichTextEditor : "input");
|
|
122
|
+
* return <Field value={value()} onInput={onInput} />;
|
|
123
|
+
*
|
|
124
|
+
* // An ambiguous tag inside an SVG tree: say which namespace you mean.
|
|
125
|
+
* const Link = dynamic(() => "a");
|
|
126
|
+
* <svg><Link xmlns="http://www.w3.org/2000/svg" href="/x">…</Link></svg>
|
|
127
|
+
*
|
|
128
|
+
* // A polymorphic component: no memo when `as` arrived as a literal.
|
|
129
|
+
* function Polymorphic(props) {
|
|
130
|
+
* const Tag = dynamic(() => props.as, { static: isStatic(props, "as") });
|
|
131
|
+
* return <Tag {...omit(props, "as")} />;
|
|
132
|
+
* }
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @description https://docs.solidjs.com/reference/components/dynamic
|
|
136
|
+
*/
|
|
97
137
|
/**
|
|
98
138
|
* A component from a reactive source. The source may answer with the
|
|
99
139
|
* component itself, a promise of it, or an async iterable of it — a `live`
|
|
@@ -108,6 +148,11 @@ export interface DynamicOptions {
|
|
|
108
148
|
* (as a reference) or a serializable value (a tag name). A promise of a
|
|
109
149
|
* client component function is a dev error on the server
|
|
110
150
|
* (`DYNAMIC_ASYNC_COMPONENT`): resolve the async upstream, or use `lazy()`.
|
|
151
|
+
*
|
|
152
|
+
* Cost: because a source may answer with a tag name, one `dynamic` on a page
|
|
153
|
+
* retains the element runtime (create/claim, `spread`, the namespace tables)
|
|
154
|
+
* for everyone. A source that only ever answers with a component — a server
|
|
155
|
+
* component mount — should use `dynamicComponent`, which never does.
|
|
111
156
|
*/
|
|
112
157
|
export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | AsyncIterable<T> | null | undefined | false, options?: DynamicOptions): Component<ComponentProps<T>>;
|
|
113
158
|
/**
|
package/types/index.server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Component } from "solid-js";
|
|
1
|
+
import { type Component, type DynamicOptions } from "solid-js";
|
|
2
2
|
import type { JSX } from "./jsx.js";
|
|
3
3
|
export * from "./server.js";
|
|
4
4
|
export * from "./response.js";
|
|
@@ -25,23 +25,8 @@ export declare const isDev: boolean;
|
|
|
25
25
|
export type IntrinsicElement = Extract<keyof JSX.IntrinsicElements, string>;
|
|
26
26
|
export type ValidComponent = IntrinsicElement | Component<any> | (string & {});
|
|
27
27
|
export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
* SSR only: hold the document's first flush until the source settles, so
|
|
31
|
-
* the resolved component renders into the shell instead of streaming in
|
|
32
|
-
* behind its boundary's fallback. Same meaning as `createMemo`'s
|
|
33
|
-
* `deferStream`. Default `false` — a `dynamic()` source is data of unknown
|
|
34
|
-
* cost and streams by default (a code-split `lazy()` always holds the shell
|
|
35
|
-
* for its module load, since its code is a prerequisite to the render).
|
|
36
|
-
*/
|
|
37
|
-
deferStream?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* The source cannot change: call it once, untracked, now, and render the
|
|
40
|
-
* result with no computation per instance (see the client `dynamic`). The
|
|
41
|
-
* source must resolve synchronously.
|
|
42
|
-
*/
|
|
43
|
-
static?: boolean;
|
|
44
|
-
}
|
|
28
|
+
export type { DynamicOptions } from "solid-js";
|
|
29
|
+
export { dynamicComponent } from "solid-js";
|
|
45
30
|
export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false, options?: DynamicOptions): Component<ComponentProps<T>>;
|
|
46
31
|
/** @deprecated Props of the deprecated `<Dynamic>`; see `dynamic()`. */
|
|
47
32
|
export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
package/types/jsx.d.ts
CHANGED
|
@@ -253,7 +253,7 @@ export namespace JSX {
|
|
|
253
253
|
/**
|
|
254
254
|
* Entity identity for server markup: the frame morph matches keyed
|
|
255
255
|
* elements across responses by it, so client state attached to the
|
|
256
|
-
* element (
|
|
256
|
+
* element (a binding slot's bound positions, focus) follows the entity
|
|
257
257
|
* through reorders and refetches. SSR compiles it to the `_key`
|
|
258
258
|
* attribute; a DOM compile strips it. On a component, `$key` is slot
|
|
259
259
|
* occurrence identity across responses (optional; a repeated call is
|
|
@@ -1139,20 +1139,11 @@ export namespace JSX {
|
|
|
1139
1139
|
target?: "_self" | "_blank" | "_parent" | "_top" | (string & {}) | RemoveAttribute;
|
|
1140
1140
|
type?: string | RemoveAttribute;
|
|
1141
1141
|
|
|
1142
|
-
// Client-side navigation contract.
|
|
1143
|
-
//
|
|
1144
|
-
//
|
|
1145
|
-
// so plain `<a>` elements participate without per-router augmentation.
|
|
1142
|
+
// Client-side navigation contract. `link` is inert markup on its own —
|
|
1143
|
+
// a routing integration that delegates anchor clicks (e.g. @solidjs/router)
|
|
1144
|
+
// reads it off the element at event time.
|
|
1146
1145
|
/** Marks the anchor as a client-navigation link when the integration requires explicit opt-in. */
|
|
1147
1146
|
link?: BooleanAttribute | RemoveAttribute;
|
|
1148
|
-
/** Serialized (JSON) history state pushed alongside the navigation. */
|
|
1149
|
-
state?: string | RemoveAttribute;
|
|
1150
|
-
/** Suppress scroll restoration/reset after the navigation. */
|
|
1151
|
-
noscroll?: BooleanAttribute | RemoveAttribute;
|
|
1152
|
-
/** Replace the current history entry instead of pushing a new one. */
|
|
1153
|
-
replace?: BooleanAttribute | RemoveAttribute;
|
|
1154
|
-
/** Route preload intent; `"false"` disables the integration's default eager preload. */
|
|
1155
|
-
preload?: boolean | "false" | RemoveAttribute;
|
|
1156
1147
|
|
|
1157
1148
|
/** @experimental */
|
|
1158
1149
|
attributionsrc?: string | RemoveAttribute;
|
package/types/observe.d.ts
CHANGED
|
@@ -106,8 +106,10 @@ export interface RenderEvent {
|
|
|
106
106
|
* `"complete"` — the render ran to its end; `"abandoned"` — the consumer
|
|
107
107
|
* left mid-stream (the sink threw, the readable was cancelled — the
|
|
108
108
|
* `SSR_STREAM_ABANDONED` finding is that request's account) and the
|
|
109
|
-
* render was torn down
|
|
110
|
-
*
|
|
109
|
+
* render was torn down, or `createSSRResponse` discarded the page for a
|
|
110
|
+
* pre-flush redirect (no finding); `"error"` — the render failed: a
|
|
111
|
+
* string render threw, a stream's uncontained failure wound it down
|
|
112
|
+
* through `onError`.
|
|
111
113
|
*/
|
|
112
114
|
outcome: "complete" | "abandoned" | "error";
|
|
113
115
|
/**
|