@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
package/types/client.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getOwner, createComponent, untrack, merge as mergeProps } from "solid-js";
|
|
2
|
-
import type { ClientErrorHook } from "solid-js";
|
|
2
|
+
import type { ClientErrorHook, Owner } from "solid-js";
|
|
3
3
|
import { effect, memo } from "./render.js";
|
|
4
4
|
import { JSX } from "./jsx.js";
|
|
5
|
-
import type { RequestEventLocals, HydrationWriter, HydrationValue } from "./server.js";
|
|
5
|
+
import type { RequestEventLocals, HydrationWriter, HydrationValue, LinkClaimHandler } from "./server.js";
|
|
6
6
|
import type { TraceContext } from "./trace.js";
|
|
7
7
|
type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
|
|
8
8
|
/**
|
|
@@ -74,7 +74,7 @@ export interface ResponseStub {
|
|
|
74
74
|
* `locals`, whichever entry typed the event.
|
|
75
75
|
*/
|
|
76
76
|
export { RequestEventLocals } from "./server.js";
|
|
77
|
-
export type { HydrationWriter, HydrationValue } from "./server.js";
|
|
77
|
+
export type { HydrationWriter, HydrationValue, LinkClaimHandler } from "./server.js";
|
|
78
78
|
export interface RequestEvent {
|
|
79
79
|
request: Request;
|
|
80
80
|
locals: RequestEventLocals;
|
|
@@ -85,14 +85,18 @@ export type { TraceContext, TraceProvider } from "./trace.js";
|
|
|
85
85
|
export type { ServerFunction, ServerFunctionMetadata, ServerFunctionRPC } from "./server-functions/shared.js";
|
|
86
86
|
export declare const waitAsset: (promise: Promise<unknown>) => void;
|
|
87
87
|
export { DOMWithState, ChildProperties, DOMElements, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DelegatedEvents } from "./constants.js";
|
|
88
|
+
type CSPNonce = string | {
|
|
89
|
+
script: string | false;
|
|
90
|
+
style: string | false;
|
|
91
|
+
};
|
|
88
92
|
/** Client stub — hydration bootstrap is a server-only emit. */
|
|
89
93
|
export declare function generateHydrationScript(_options?: {
|
|
90
94
|
eventNames?: string[];
|
|
91
|
-
nonce?:
|
|
95
|
+
nonce?: CSPNonce;
|
|
92
96
|
}): string;
|
|
93
97
|
/** Client stub — valid JSX component, renders nothing. */
|
|
94
98
|
export declare function HydrationScript(_props?: {
|
|
95
|
-
nonce?:
|
|
99
|
+
nonce?: CSPNonce;
|
|
96
100
|
eventNames?: string[];
|
|
97
101
|
}): null;
|
|
98
102
|
export { effect, memo, untrack, getOwner, createComponent };
|
|
@@ -118,6 +122,24 @@ export declare const getHydrationWriter: () => HydrationWriter | undefined;
|
|
|
118
122
|
* `globalThis._$HY = { r: { "sq:key": value } }`.
|
|
119
123
|
*/
|
|
120
124
|
export declare function takeHydrationValue<T = unknown>(key: string): HydrationValue<T> | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Client stub — a render's link handler is set during server rendering
|
|
127
|
+
* (see the server entry's `setLinkClaim`). Always `false` here, so a router
|
|
128
|
+
* can call it unguarded from isomorphic setup code.
|
|
129
|
+
* @experimental
|
|
130
|
+
*/
|
|
131
|
+
export declare function setLinkClaim(_handler: LinkClaimHandler | undefined): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Whether the server render that produced this document ran a link handler
|
|
134
|
+
* (`setLinkClaim`), so its anchors carry the server's link state
|
|
135
|
+
* (`aria-current="page"`, `data-active`) in the HTML. Reads the `links`
|
|
136
|
+
* hydration record the render wrote once; non-destructive, readable before
|
|
137
|
+
* and after hydration. `false` on a page rendered without the router — the
|
|
138
|
+
* absence of link state on an anchor then means nothing, and a link
|
|
139
|
+
* consumer must resolve it itself. Server: `false`.
|
|
140
|
+
* @experimental
|
|
141
|
+
*/
|
|
142
|
+
export declare function hasServerLinkState(): boolean;
|
|
121
143
|
/**
|
|
122
144
|
* Client stub — the trace a request belongs to is a server-side reading
|
|
123
145
|
* (the incoming `traceparent`, the render's origination); the browser SDK
|
|
@@ -159,11 +181,59 @@ export declare function registerDelegatedRoot(root: MountableElement): void;
|
|
|
159
181
|
export declare function unregisterDelegatedRoot(root: MountableElement): void;
|
|
160
182
|
export declare function registerDelegatedContainer(container: MountableElement, owner?: MountableElement): void;
|
|
161
183
|
export declare function unregisterDelegatedContainer(container: MountableElement, owner?: MountableElement): void;
|
|
184
|
+
/**
|
|
185
|
+
* Runs `fn` as a handler of the DOM event `e`, inside the interaction frame
|
|
186
|
+
* the runtime opens for `e` — the one its own listeners for `e` run in. A
|
|
187
|
+
* listener the runtime did not attach (a router's `document` click handler,
|
|
188
|
+
* analytics, drag-and-drop) wraps its body in this, so its work joins the
|
|
189
|
+
* same interaction record as the component handlers for the same event
|
|
190
|
+
* instead of running outside one. In production builds this is `fn()`.
|
|
191
|
+
*
|
|
192
|
+
* Use it for listeners that respond to the user (`click`, `submit`,
|
|
193
|
+
* `keydown`), not for passive ones (`mousemove`, `focusin` preloads), which
|
|
194
|
+
* would each record an interaction.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```ts
|
|
198
|
+
* document.addEventListener("click", e =>
|
|
199
|
+
* dispatchAsInteraction(e, () => handleAnchorClick(e))
|
|
200
|
+
* );
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
export declare function dispatchAsInteraction<T>(e: Event, fn: () => T): T;
|
|
162
204
|
export declare function getDelegatedRoot(node: MountableElement): MountableElement | undefined;
|
|
163
205
|
export declare function setProperty(node: Element, name: string, value: any): void;
|
|
164
|
-
|
|
206
|
+
/** Options for `registerElementClaim`. */
|
|
207
|
+
export type ElementClaimOptions = {
|
|
208
|
+
/**
|
|
209
|
+
* Attribute names whose compiler-owned writes re-claim an already claimed
|
|
210
|
+
* element, as plain names: `href` covers the `href` attribute, the
|
|
211
|
+
* `prop:href` property path and the `xlink:href` namespaced path alike.
|
|
212
|
+
* Defaults to `["href", "action"]`. The write sites consult the union of
|
|
213
|
+
* every registered consumer's set.
|
|
214
|
+
*/
|
|
215
|
+
attributes?: readonly string[];
|
|
216
|
+
}; /**
|
|
217
|
+
* Register a consumer for compiler-emitted element claims. Compiled DOM
|
|
218
|
+
* output claims navigation-relevant elements (`a[href]`, `form[action]`)
|
|
219
|
+
* once at mount, after their initial attributes are applied — so a handler
|
|
220
|
+
* sees the element's final initial attributes and is told about one mount
|
|
221
|
+
* exactly once. Afterwards compiler-owned writes to an attribute in the
|
|
222
|
+
* consumer's declared set (`options.attributes`, default `href`/`action`;
|
|
223
|
+
* `prop:href` and `xlink:href` map to `href`) re-invoke the handlers — so
|
|
224
|
+
* handlers must be idempotent and must check the element's relevance
|
|
225
|
+
* themselves. Handlers run under the reactive owner the element was created
|
|
226
|
+
* with; scope per-element state and cleanup through your own reactive
|
|
227
|
+
* system. Dormant until registered — without a handler the emitted claims
|
|
228
|
+
* are null checks. Returns an unregister function.
|
|
229
|
+
*
|
|
230
|
+
* Integration plumbing (routers register the consumer); not meant for
|
|
231
|
+
* application code.
|
|
232
|
+
* @internal
|
|
233
|
+
*/
|
|
234
|
+
export declare function registerElementClaim(handler: (element: Element) => void, options?: ElementClaimOptions): () => void;
|
|
165
235
|
export declare function claimElementTree<T extends Node>(root: T): T;
|
|
166
|
-
export declare function claimElement<T extends Element>(node: T): T;
|
|
236
|
+
export declare function claimElement<T extends Element>(node: T, owner?: Owner | null): T;
|
|
167
237
|
export declare function setAttribute(node: Element, name: string, value: string): void;
|
|
168
238
|
export declare function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
|
|
169
239
|
export declare function className(node: Element, value: JSX.ClassValue, prev?: JSX.ClassValue): void;
|
|
@@ -188,7 +258,17 @@ export declare function style(node: Element, value: {
|
|
|
188
258
|
* literal is already the compute's own); a proxy is copied with ONE
|
|
189
259
|
* `ownKeys` trap (its own trap keeps the key set tracked) plus one tracked
|
|
190
260
|
* read per key; a clsx-style class array is re-mapped element-wise (className
|
|
191
|
-
* allocates for an array anyway; measured at parity).
|
|
261
|
+
* allocates for an array anyway; measured at parity).
|
|
262
|
+
*
|
|
263
|
+
* The proxy's keys are read with `Reflect.ownKeys` directly — what
|
|
264
|
+
* `sourceKeys(value, SOURCE_PROXY)` resolves to by definition (`leafOf` is
|
|
265
|
+
* the identity for a proxy kind; `leafKeys` answers a proxy with one
|
|
266
|
+
* `ownKeys` trap) — rather than through `sourceKeys`, whose kind argument is
|
|
267
|
+
* a runtime value: calling it here retained the merge/omit view walkers
|
|
268
|
+
* (`collectKeys`, `mergeKeysOf`, `hiddenByAny`, …, ≈ 1.1 KB minified) on
|
|
269
|
+
* every compiled page with a dynamic `class`/`style`, reached by nothing
|
|
270
|
+
* (hydration-split-measured.md, candidate (e)). `spread()` still reads its
|
|
271
|
+
* sources through `sourceKeys`, so a page with an element spread keeps them. */
|
|
192
272
|
export declare function readShallow(value: unknown): unknown;
|
|
193
273
|
/** Compiler-emitted primitive; not for hand-written code. @internal */
|
|
194
274
|
export declare function setStyleProperty(node: Element, name: string, value: any): void;
|
|
@@ -253,5 +333,37 @@ export declare function getNextMarker(start: Node): [Node, Array<Node>];
|
|
|
253
333
|
export declare function getFirstChild(node: any, expectedTag: any): any;
|
|
254
334
|
export declare function getNextSibling(node: any, expectedTag: any): any;
|
|
255
335
|
export declare function runHydrationEvents(): void;
|
|
336
|
+
/**
|
|
337
|
+
* Installs the server-component half of hydration — solid's
|
|
338
|
+
* (`enableServerComponentHydration`: the hold, the claim window, fragment
|
|
339
|
+
* ownership, the ledger's published answer) and this runtime's two terms of
|
|
340
|
+
* the claim walk:
|
|
341
|
+
*
|
|
342
|
+
* - `sharedConfig.claimRoots` (ruling 95): a claimed tree isn't always IN
|
|
343
|
+
* the document — a frame adoption whose slot fill resolved async claims
|
|
344
|
+
* its server-rendered range after a pending boundary displaced it
|
|
345
|
+
* (re-inserted on reveal). Such claim scopes declare their roots, and
|
|
346
|
+
* descent from one is as claimed as being connected; fresh clones
|
|
347
|
+
* descend from neither.
|
|
348
|
+
* - The root sweep's frame exclusion (ruling 97): frame regions
|
|
349
|
+
* (`data-fid` — the frame runtime's element brand, an importless
|
|
350
|
+
* duplicate like FRAME_ID_ATTR in frame-client/frame-sink) are another
|
|
351
|
+
* layer's property. Their fills claim through their own windows on their
|
|
352
|
+
* own schedule (a lazy route module may adopt long after the root
|
|
353
|
+
* completes), so collecting them in the ambient sweep only sets up the
|
|
354
|
+
* completion sweep to report legitimately-late claims as unclaimed.
|
|
355
|
+
* Whether the root has frames is one question about the page, not one
|
|
356
|
+
* per keyed node: found once per sweep, containment-tested against the
|
|
357
|
+
* list rather than `closest("[data-fid]")` from every node.
|
|
358
|
+
*
|
|
359
|
+
* The same shape as `hydrate()` — solid's half, then this runtime's — one
|
|
360
|
+
* call for the integration. Before `hydrate()` runs its root sweep (the
|
|
361
|
+
* frames client calls it from `installServerComponents()`, which precedes
|
|
362
|
+
* `hydrate()` in every entry) and again wherever it re-attempts its reveal
|
|
363
|
+
* hook; idempotent. Cross-package wiring; not for application code.
|
|
364
|
+
*
|
|
365
|
+
* @internal
|
|
366
|
+
*/
|
|
367
|
+
export declare function installServerComponentHydration(): void;
|
|
256
368
|
export declare function getHydrationKey(): string | undefined;
|
|
257
369
|
export declare const RequestContext: unique symbol;
|
package/types/constants.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
declare const DOMWithState: Record<string, Record<string, 1 | 2>>;
|
|
8
8
|
declare const ChildProperties: Set<string>;
|
|
9
|
+
declare const LinkAttributes: Set<string>;
|
|
9
10
|
declare const $$SLOT: unique symbol;
|
|
10
11
|
declare const $$HOST: unique symbol;
|
|
11
12
|
declare const DelegatedEvents: Set<string>;
|
|
@@ -17,4 +18,5 @@ declare const RawTextElements: Set<string>;
|
|
|
17
18
|
declare const DOMElements: Set<string>;
|
|
18
19
|
declare const COMPOSED_BODY_FRAMING: ReadonlySet<string>;
|
|
19
20
|
declare function isHttpNavigationTarget(target: string): boolean;
|
|
20
|
-
|
|
21
|
+
declare function isEventName(name: string): boolean;
|
|
22
|
+
export { DOMWithState, ChildProperties, LinkAttributes, DelegatedEvents, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DOMElements, $$SLOT, $$HOST, COMPOSED_BODY_FRAMING, isHttpNavigationTarget, isEventName };
|
package/types/diagnostics.d.ts
CHANGED
|
@@ -52,5 +52,13 @@ export declare function unscopedHoleAllocatedIds(before: string, after: string,
|
|
|
52
52
|
hole?: number;
|
|
53
53
|
registered?: string;
|
|
54
54
|
}, subject?: unknown): void;
|
|
55
|
+
/**
|
|
56
|
+
* Dev CHECK: a function reached an attribute whose name starts with `on` but
|
|
57
|
+
* is not an event handler — a lowercase `onclick`, or a 1.x `on:click`. Only
|
|
58
|
+
* `on` + an uppercase letter (`onClick`) binds an event in 2.0; anything else
|
|
59
|
+
* is a plain attribute, so the function is stringified into the attribute's
|
|
60
|
+
* text. Reported once per attribute name so a row template reports once.
|
|
61
|
+
*/
|
|
62
|
+
export declare function lowercaseEventAttribute(name: string, node: Element): void;
|
|
55
63
|
/** `Name: message` for an Error, `String(value)` otherwise. */
|
|
56
64
|
export declare function errorText(error: unknown): string;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@solidjs/web/frames/assets` — the frames client's ASSETS tier (frames
|
|
3
|
+
* savings pass §3 row C5): what a segment's `seg:<k>:assets` record does to
|
|
4
|
+
* the document head, loaded on demand through the tier mechanism
|
|
5
|
+
* (`prepareTier("assets")`, frame-client.ts).
|
|
6
|
+
*
|
|
7
|
+
* What rides in this chunk, and so leaves the eager frames client: the
|
|
8
|
+
* import-free mirror of the client asset registry's head conventions
|
|
9
|
+
* (`ensureStylesheet` / `ensurePreload` / `ensureModulePreload` /
|
|
10
|
+
* `applyInlineStyles`, `findHeadElement`'s attribute-compared lookup and
|
|
11
|
+
* head.ts's `qualifierValue`), the per-frame flush a pending stylesheet
|
|
12
|
+
* wakes, and the assets pass over a record (modules, typed preloads, inline
|
|
13
|
+
* styles). The eager client keeps the record itself (`chunkToRecords`'
|
|
14
|
+
* `assets` case, the host's `seg::assets` accumulate), the pass's walk over
|
|
15
|
+
* the store, and the reveal's READINESS TERM: a segment whose assets record
|
|
16
|
+
* carries stylesheets or inline styles while this tier is not resident is
|
|
17
|
+
* not ready — the server's `<Loading>` fallback stays on screen; the reveal
|
|
18
|
+
* happens at max(tier load, stylesheet load) (frames savings pass §1,
|
|
19
|
+
* "assets": no FOUC, no blank). Once the tier is resident only stylesheets
|
|
20
|
+
* gate: inline styles apply at the record's arrival (the walk runs ahead of
|
|
21
|
+
* the segments in the same flush), modules and preloads likewise, and a
|
|
22
|
+
* segment with none of these never waits on the tier.
|
|
23
|
+
*
|
|
24
|
+
* The module's exports ARE its dispatch: `prepareTier` stamps the load with
|
|
25
|
+
* the module once it has resolved (`tierLoads.assets.r`), and the eager
|
|
26
|
+
* client calls `gate` from `#segmentReady` and `apply` from `#flush`'s
|
|
27
|
+
* assets walk off that stamp. No `install()`: the tier registers nothing
|
|
28
|
+
* and imports nothing of the client — it needs no shared instance, only
|
|
29
|
+
* the frame handed to `gate` (its `apply` is the flush a settled sheet
|
|
30
|
+
* triggers).
|
|
31
|
+
*
|
|
32
|
+
* The server announces this tier wherever it emits an assets chunk
|
|
33
|
+
* (`sink.needs("assets")` — the shell's pre-flush assets, a style-gated
|
|
34
|
+
* fragment's, a late module / preload; frame-sink.ts): `X-Frame-Tiers` /
|
|
35
|
+
* `chunk.tiers` on a stream, `_$HY.r["sc:tiers"]` + a `modulepreload` on a
|
|
36
|
+
* document — so the load is a warm start; an un-announced record starts it
|
|
37
|
+
* from the readiness check or the walk and the segment waits (the same DOM,
|
|
38
|
+
* later).
|
|
39
|
+
* @experimental
|
|
40
|
+
*/
|
|
41
|
+
import type { Frame } from "./frame-client.js";
|
|
42
|
+
/** A stylesheet entry as the sink writes it: a url, or `{ href, attrs }`. */
|
|
43
|
+
export type StylesheetEntry = string | {
|
|
44
|
+
href: string;
|
|
45
|
+
attrs?: Record<string, string>;
|
|
46
|
+
};
|
|
47
|
+
/** A typed preload entry (`<link rel="preload">`): request-qualifying attributes, optional href. */
|
|
48
|
+
export interface PreloadEntry {
|
|
49
|
+
href?: string;
|
|
50
|
+
attrs: Record<string, string>;
|
|
51
|
+
}
|
|
52
|
+
/** An inline style entry (`<style data-asset>`). */
|
|
53
|
+
export interface InlineStyleEntry {
|
|
54
|
+
id: string;
|
|
55
|
+
content?: string;
|
|
56
|
+
attrs?: Record<string, string>;
|
|
57
|
+
}
|
|
58
|
+
/** The head-affecting members of a `seg:<k>:assets` record. */
|
|
59
|
+
export interface AssetsRecord {
|
|
60
|
+
modules?: string[];
|
|
61
|
+
styles?: StylesheetEntry[];
|
|
62
|
+
inlineStyles?: InlineStyleEntry[];
|
|
63
|
+
preloads?: PreloadEntry[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The stylesheet gate for one segment (`#segmentReady`'s style term, once
|
|
67
|
+
* the tier is resident): ensure every named sheet is in the head — pending
|
|
68
|
+
* links are inserted now, even while another prerequisite is missing, so
|
|
69
|
+
* the load overlaps the rest of the stream — and report whether all have
|
|
70
|
+
* settled. `frame` is re-flushed when a pending one settles.
|
|
71
|
+
*/
|
|
72
|
+
export declare function gate(entries: StylesheetEntry[], frame: Frame): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* The assets pass for one record (`#flush`'s walk, once per record identity
|
|
75
|
+
* per mount): module preloads, typed preloads, inline styles. Stylesheets
|
|
76
|
+
* are the gate's (`gate`) — never applied here.
|
|
77
|
+
*/
|
|
78
|
+
export declare function apply(record: AssetsRecord): void;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register a text start marker's position on its parent element's consumer
|
|
3
|
+
* entry for the occurrence — the one its attribute markers opened, if any,
|
|
4
|
+
* so an element is one consumer however its positions are spelled. The slot
|
|
5
|
+
* sync's walk dispatches here (frame-client.ts `collectSlots`).
|
|
6
|
+
*/
|
|
7
|
+
export declare function text(start: Comment, elements: Map<string, any>): void;
|
|
8
|
+
/**
|
|
9
|
+
* An element's positions join each occurrence's consumer list, in document
|
|
10
|
+
* order. The slot sync's walk dispatches here for every server element with
|
|
11
|
+
* attributes (frame-client.ts `collectSlots`).
|
|
12
|
+
*/
|
|
13
|
+
export declare function positions(el: Element, elements: Map<string, any>): void;
|
|
14
|
+
/**
|
|
15
|
+
* The consumer set the slot sync found for a MOUNTED data occurrence — at
|
|
16
|
+
* the mount (the set the fill was handed) and on every re-sync. A changed
|
|
17
|
+
* set (a morph replaced one of its elements, a response added or dropped a
|
|
18
|
+
* bound position) rebinds in place through the mount's rebinder: the fill's
|
|
19
|
+
* computation stays, the binding gets the new set.
|
|
20
|
+
*/
|
|
21
|
+
export declare function sync(frame: object, occurrence: string, consumers: any[]): void;
|
|
22
|
+
/** The mount's rebind callback (`ctx.onRebind`), registered during the
|
|
23
|
+
* invocation — before `sync` records the mount's set. */
|
|
24
|
+
export declare function rebinder(frame: object, occurrence: string, fn: (consumers: any[]) => void): void;
|
|
25
|
+
/** The occurrence is gone (unmounted, or re-invoked: the new invocation
|
|
26
|
+
* registers its own rebinder). */
|
|
27
|
+
export declare function unmount(frame: object, occurrence: string): void;
|
|
28
|
+
/** The positions of an incoming element a client fill writes (see
|
|
29
|
+
* `owned`). */
|
|
30
|
+
interface Owned {
|
|
31
|
+
attrs: Set<string>;
|
|
32
|
+
class: string[] | null;
|
|
33
|
+
style: string[] | null;
|
|
34
|
+
}
|
|
35
|
+
export declare function owned(el: Element): Owned | null;
|
|
36
|
+
/**
|
|
37
|
+
* Apply the server's value for `name` (null: absent) to an element with
|
|
38
|
+
* binding-slot positions: a client-owned attribute is left alone; owned
|
|
39
|
+
* `class`/`style` NAMES are re-imposed over the server's string. Returns
|
|
40
|
+
* whether the attribute changed, or undefined when the position is not
|
|
41
|
+
* owned and the caller writes it. (The eager wrapper answers `undefined`
|
|
42
|
+
* itself for a null `owned`; the arms call here with one.)
|
|
43
|
+
*/
|
|
44
|
+
export declare function apply(oldEl: Element, name: string, value: string, owned: Owned): boolean | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Bind a binding-slot occurrence (principles §9.2.3). The fill runs ONCE,
|
|
47
|
+
* untracked, under the occurrence's owner — a component body: a top-level
|
|
48
|
+
* read is a one-time read (dev names it through `untrack`'s label), and state
|
|
49
|
+
* created in the body lives as long as the occurrence. Its object's value
|
|
50
|
+
* positions are written by one render effect over every consuming element,
|
|
51
|
+
* diffed per position by `assign`, so a getter's change re-reads the
|
|
52
|
+
* occurrence and touches only what moved. Handlers and refs are read once
|
|
53
|
+
* when an element binds and handed to `assign`, which binds them as client
|
|
54
|
+
* JSX does (delegation, tuples). A consumer change (`ctx.onRebind`: the morph
|
|
55
|
+
* replaced an element, a response bound a new position) rebinds without
|
|
56
|
+
* re-running the fill. The client entry's `slotsFor` dispatches here under
|
|
57
|
+
* the occurrence's owner (client.ts).
|
|
58
|
+
*/
|
|
59
|
+
export declare function bind(fill: (args: any) => any, args: any, ctx: any, label: string | undefined): void;
|
|
60
|
+
export {};
|
package/types/frames/client.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { type TierModule } from "./frame-client.js";
|
|
1
2
|
export { createFrame, createFrameHost, createFrameElement, FRAME_APPLIED_EVENT } from "./frame-client.js";
|
|
2
|
-
export {
|
|
3
|
-
|
|
3
|
+
export type { TierModule } from "./frame-client.js";
|
|
4
|
+
/** @internal */
|
|
5
|
+
export { isAsyncValue } from "./frame-client.js";
|
|
6
|
+
export { FRAME_STREAM_HEADER, applyFrameResponse, isFrameStreamResponse, createServerComponentHandler } from "./frame-transport.js";
|
|
7
|
+
export type { Slot, BindingSlot, SlotOutput, SlotError } from "./server.js";
|
|
4
8
|
/**
|
|
5
9
|
* Client-condition twin of the server face's `asyncArg` (DR-2 value tier):
|
|
6
10
|
* the identity that types an async value crossing the slot border as its
|
|
@@ -16,6 +20,24 @@ export declare function asyncArg<T>(value: PromiseLike<T> | AsyncIterable<T>): T
|
|
|
16
20
|
* @experimental
|
|
17
21
|
*/
|
|
18
22
|
export declare function getFrameHost(): any;
|
|
23
|
+
/**
|
|
24
|
+
* Options for `installServerComponents`.
|
|
25
|
+
* @experimental
|
|
26
|
+
*/
|
|
27
|
+
export interface InstallOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Frames-client tiers by name → loader. A tier's module's exports are its
|
|
30
|
+
* appliers (the runtime dispatches to them once resident) and its
|
|
31
|
+
* optional `install()` is called once the import resolves; every live
|
|
32
|
+
* frame is then flushed so what the tier makes applicable applies (a held
|
|
33
|
+
* occurrence mounts, a style-gated segment requests its sheets). A name
|
|
34
|
+
* with no loader is resident (eager); `trace` (`@solidjs/web/frames/trace`),
|
|
35
|
+
* `regions` (`@solidjs/web/frames/regions`) and `assets`
|
|
36
|
+
* (`@solidjs/web/frames/assets`) have built-in loaders that an entry here
|
|
37
|
+
* replaces. See `installServerComponents`.
|
|
38
|
+
*/
|
|
39
|
+
tiers?: Record<string, () => Promise<TierModule>>;
|
|
40
|
+
}
|
|
19
41
|
/**
|
|
20
42
|
* Installs the server-component transport policy on the server-function
|
|
21
43
|
* client — the identity split (DR-1): CONTENT is keyed by the call's
|
|
@@ -31,6 +53,18 @@ export declare function getFrameHost(): any;
|
|
|
31
53
|
* Call once in the client entry (an explicit call — the package is
|
|
32
54
|
* `sideEffects: false`, so a bare import would be tree-shaken away);
|
|
33
55
|
* call again to rebind to a custom host.
|
|
56
|
+
*
|
|
57
|
+
* `options.tiers` maps a frames-client tier's name to its loader (`() =>
|
|
58
|
+
* import(...)`, the module whose exports are the tier's appliers, with an
|
|
59
|
+
* optional `install()`): the client resolves tier chunks itself, so the
|
|
60
|
+
* server announces NAMES only (`_$HY.r["sc:tiers"]`, `X-Frame-Tiers`) and
|
|
61
|
+
* the loads start here from the document's record — the `modulepreload`
|
|
62
|
+
* the document may also carry made the fetch warm. The built-in table
|
|
63
|
+
* carries `trace` (the container tier's client half,
|
|
64
|
+
* `@solidjs/web/frames/trace`), `regions` (nested server-content regions,
|
|
65
|
+
* `@solidjs/web/frames/regions`) and `assets` (the head mirror and the
|
|
66
|
+
* stylesheet gate, `@solidjs/web/frames/assets`); a loader given here for
|
|
67
|
+
* a name replaces the built-in one (tests gate a tier's load this way).
|
|
34
68
|
* @experimental
|
|
35
69
|
*/
|
|
36
|
-
export declare function installServerComponents(host?: any): void;
|
|
70
|
+
export declare function installServerComponents(host?: any, options?: InstallOptions): void;
|