@solidjs/web 2.0.0-beta.3 → 2.0.0-beta.30
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/README.md +27 -4
- package/dist/dev.cjs +1211 -205
- package/dist/dev.js +1175 -199
- package/dist/server.cjs +1342 -234
- package/dist/server.js +1304 -231
- package/dist/web.cjs +1195 -196
- package/dist/web.js +1159 -190
- package/frames/dist/client.cjs +1746 -0
- package/frames/dist/client.dev.cjs +1759 -0
- package/frames/dist/client.dev.js +1747 -0
- package/frames/dist/client.js +1734 -0
- package/frames/dist/server.cjs +2426 -0
- package/frames/dist/server.js +2414 -0
- package/frames/package.json +30 -0
- package/package.json +287 -38
- package/serialization/dist/serialization.cjs +169 -0
- package/serialization/dist/serialization.js +159 -0
- package/serialization/package.json +20 -0
- package/serialization/types/index.d.ts +157 -0
- package/serialization/types-cjs/index.d.cts +157 -0
- package/serialization/types-cjs/package.json +3 -0
- package/server-functions/dist/client.cjs +613 -0
- package/server-functions/dist/client.js +585 -0
- package/server-functions/dist/server.cjs +904 -0
- package/server-functions/dist/server.js +875 -0
- package/server-functions/package.json +30 -0
- package/storage/package.json +8 -3
- package/storage/types/index.d.ts +26 -0
- package/storage/types-cjs/index.d.cts +28 -0
- package/storage/types-cjs/package.json +3 -0
- package/types/client.d.ts +125 -21
- package/types/core.d.ts +4 -3
- package/types/frames/client.d.ts +20 -0
- package/types/frames/frame-client.d.ts +270 -0
- package/types/frames/frame-sink.d.ts +168 -0
- package/types/frames/frame-transport.d.ts +196 -0
- package/types/frames/serializer.d.ts +157 -0
- package/types/frames/server.d.ts +30 -0
- package/types/index.d.ts +211 -26
- package/types/jsx-properties.d.ts +93 -0
- package/types/jsx.d.ts +4150 -1
- package/types/response.d.ts +129 -0
- package/types/serializer.d.ts +157 -0
- package/types/server-functions/client.d.ts +200 -0
- package/types/server-functions/flash.d.ts +38 -0
- package/types/server-functions/server.d.ts +490 -0
- package/types/server-functions/shared.d.ts +445 -0
- package/types/server-mock.d.ts +93 -0
- package/types/server.d.ts +221 -28
- package/types-cjs/client.d.cts +192 -0
- package/types-cjs/core.d.cts +4 -0
- package/types-cjs/frames/client.d.cts +20 -0
- package/types-cjs/frames/frame-client.d.cts +270 -0
- package/types-cjs/frames/frame-sink.d.cts +168 -0
- package/types-cjs/frames/frame-transport.d.cts +196 -0
- package/types-cjs/frames/serializer.d.cts +157 -0
- package/types-cjs/frames/server.d.cts +30 -0
- package/types-cjs/index.d.cts +231 -0
- package/types-cjs/jsx-properties.d.cts +93 -0
- package/types-cjs/jsx.d.cts +4150 -0
- package/types-cjs/package.json +3 -0
- package/types-cjs/response.d.cts +129 -0
- package/types-cjs/serializer.d.cts +157 -0
- package/types-cjs/server-functions/client.d.cts +200 -0
- package/types-cjs/server-functions/flash.d.cts +38 -0
- package/types-cjs/server-functions/server.d.cts +490 -0
- package/types-cjs/server-functions/shared.d.cts +445 -0
- package/types-cjs/server-mock.d.cts +165 -0
- package/types-cjs/server.d.cts +349 -0
- package/storage/types/src/client.d.ts +0 -1
- package/storage/types/src/index.d.ts +0 -46
- package/storage/types/src/server-mock.d.ts +0 -72
- package/storage/types/storage/src/index.d.ts +0 -2
package/types/server.d.ts
CHANGED
|
@@ -1,22 +1,82 @@
|
|
|
1
1
|
import { JSX } from "./jsx.js";
|
|
2
|
-
|
|
2
|
+
import { SerializerPlugin } from "./serializer.js";
|
|
3
|
+
export const DOMWithState: Record<string, Record<string, 1 | 2>>;
|
|
3
4
|
export const ChildProperties: Set<string>;
|
|
4
5
|
export const DelegatedEvents: Set<string>;
|
|
5
6
|
export const DOMElements: Set<string>;
|
|
6
7
|
export const SVGElements: Set<string>;
|
|
7
|
-
export const
|
|
8
|
+
export const MathMLElements: Set<string>;
|
|
9
|
+
export const VoidElements: Set<string>;
|
|
10
|
+
export const RawTextElements: Set<string>;
|
|
11
|
+
export const Namespaces: Record<string, string>;
|
|
8
12
|
|
|
9
13
|
type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
|
|
10
14
|
|
|
15
|
+
/** Static asset manifest produced by a build (e.g. parsed Vite manifest.json). */
|
|
16
|
+
export type AssetManifest = Record<
|
|
17
|
+
string,
|
|
18
|
+
{ file: string; css?: string[]; isEntry?: boolean; imports?: string[] }
|
|
19
|
+
> & { _base?: string };
|
|
20
|
+
|
|
21
|
+
/** Inline style content, e.g. dev CSS collected from a bundler's module graph. */
|
|
22
|
+
export type InlineStyleAsset = {
|
|
23
|
+
id: string;
|
|
24
|
+
content: string;
|
|
25
|
+
attrs?: Record<string, string>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type ResolvedAssets = {
|
|
29
|
+
js: string[];
|
|
30
|
+
css: (string | InlineStyleAsset)[];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Resolver form of the manifest option — the primitive a dev server
|
|
35
|
+
* implements against its live module graph (a static manifest object is
|
|
36
|
+
* normalized into a sync resolver internally). `resolve` may return a
|
|
37
|
+
* promise (async resolvers require streaming rendering); CSS entries may be
|
|
38
|
+
* URL strings (emitted as load-gated `<link>` tags) or inline-style
|
|
39
|
+
* descriptors (emitted as `<style>` tags). A bare `resolve`-shaped function
|
|
40
|
+
* is accepted as shorthand for `{ resolve }`.
|
|
41
|
+
*/
|
|
42
|
+
export type AssetResolver = {
|
|
43
|
+
resolve(
|
|
44
|
+
key: string
|
|
45
|
+
): ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
|
|
46
|
+
/**
|
|
47
|
+
* Synchronous fast path answering with whatever is knowable without async
|
|
48
|
+
* work (typically js URLs, omitting css). Sync consumers — e.g. a lazy
|
|
49
|
+
* component's `moduleUrl` getter used by islands — use this when `resolve`
|
|
50
|
+
* would return a promise, so adapters should provide it whenever possible.
|
|
51
|
+
*/
|
|
52
|
+
resolveSync?(key: string): ResolvedAssets | null | undefined;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** Bare-function shorthand for `AssetResolver` (no sync fast path). */
|
|
56
|
+
export type AssetResolverFn = (
|
|
57
|
+
key: string
|
|
58
|
+
) => ResolvedAssets | null | undefined | Promise<ResolvedAssets | null | undefined>;
|
|
59
|
+
|
|
11
60
|
export function renderToString<T>(
|
|
12
61
|
fn: () => T,
|
|
13
62
|
options?: {
|
|
14
63
|
nonce?: string;
|
|
15
64
|
renderId?: string;
|
|
16
65
|
noScripts?: boolean;
|
|
17
|
-
plugins?:
|
|
18
|
-
manifest?:
|
|
66
|
+
plugins?: SerializerPlugin[];
|
|
67
|
+
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
19
68
|
onError?: (err: any) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Embedded-render contract for hosts that own the document. When the
|
|
71
|
+
* render output contains no `</head>`, everything head-bound (resolved
|
|
72
|
+
* `useHead` winners, eager resources, tracked asset links, inline
|
|
73
|
+
* styles) is delivered here as one HTML string — prelude (charset/base)
|
|
74
|
+
* first — for the host to splice into its own `<head>` template, instead
|
|
75
|
+
* of being dropped. Called synchronously before `renderToString`
|
|
76
|
+
* returns; not called when the output has a `</head>` (splicing is
|
|
77
|
+
* automatic then).
|
|
78
|
+
*/
|
|
79
|
+
onHead?: (head: string) => void;
|
|
20
80
|
}
|
|
21
81
|
): string;
|
|
22
82
|
/** @deprecated use renderToStream which also returns a promise */
|
|
@@ -27,8 +87,8 @@ export function renderToStringAsync<T>(
|
|
|
27
87
|
nonce?: string;
|
|
28
88
|
renderId?: string;
|
|
29
89
|
noScripts?: boolean;
|
|
30
|
-
plugins?:
|
|
31
|
-
manifest?:
|
|
90
|
+
plugins?: SerializerPlugin[];
|
|
91
|
+
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
32
92
|
onError?: (err: any) => void;
|
|
33
93
|
}
|
|
34
94
|
): Promise<string>;
|
|
@@ -38,16 +98,38 @@ export function renderToStream<T>(
|
|
|
38
98
|
nonce?: string;
|
|
39
99
|
renderId?: string;
|
|
40
100
|
noScripts?: boolean;
|
|
41
|
-
plugins?:
|
|
42
|
-
manifest?:
|
|
101
|
+
plugins?: SerializerPlugin[];
|
|
102
|
+
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
43
103
|
onCompleteShell?: (info: { write: (v: string) => void }) => void;
|
|
44
104
|
onCompleteAll?: (info: { write: (v: string) => void }) => void;
|
|
45
105
|
onError?: (err: any) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Embedded-render contract for hosts that own the document. When the
|
|
108
|
+
* shell contains no `</head>`, everything head-bound at first flush
|
|
109
|
+
* (resolved `useHead` winners, eager resources, tracked asset links,
|
|
110
|
+
* inline styles) is delivered here as one HTML string — prelude first —
|
|
111
|
+
* before the shell chunk is emitted, so the host can write its own
|
|
112
|
+
* `<head>` ahead of piping the stream. Post-shell head updates flow
|
|
113
|
+
* through the stream itself and apply in the browser. Not called when
|
|
114
|
+
* the shell has a `</head>` (splicing is automatic then).
|
|
115
|
+
*/
|
|
116
|
+
onHead?: (head: string) => void;
|
|
46
117
|
}
|
|
47
118
|
): {
|
|
48
119
|
then: (fn: (html: string) => void) => void;
|
|
49
120
|
pipe: (writable: { write: (v: string) => void; end: () => void }) => void;
|
|
50
121
|
pipeTo: (writable: WritableStream) => Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Lazy `ReadableStream<Uint8Array>` view of the render — hand it straight
|
|
124
|
+
* to `new Response(stream.readable)`. First access starts the render
|
|
125
|
+
* piping through an internal `TransformStream` (chunks are UTF-8 encoded
|
|
126
|
+
* bytes, the same as `pipeTo` writes) and the stream is cached, so
|
|
127
|
+
* repeated access returns the same instance. Like `pipe`/`pipeTo`, this
|
|
128
|
+
* consumes the render: use exactly one of the three — mixing distinct
|
|
129
|
+
* consumers (`readable` after `pipe`/`pipeTo`, or vice versa) throws an
|
|
130
|
+
* error naming the conflict.
|
|
131
|
+
*/
|
|
132
|
+
readonly readable: ReadableStream<Uint8Array>;
|
|
51
133
|
};
|
|
52
134
|
|
|
53
135
|
export function HydrationScript(props: { nonce?: string; eventNames?: string[] }): JSX.Element;
|
|
@@ -62,25 +144,105 @@ export function ssrClassName(value: string | { [k: string]: boolean } | Array<an
|
|
|
62
144
|
export function ssrStyle(value: string | { [k: string]: string }): string;
|
|
63
145
|
export function ssrStyleProperty(name: string, value: any): string;
|
|
64
146
|
export function ssrAttribute(key: string, value: any): string;
|
|
147
|
+
export function ssrGroup<T extends () => any[]>(fn: T, n: number): T;
|
|
148
|
+
export function scope<T>(fn: () => T): () => unknown;
|
|
65
149
|
export function ssrHydrationKey(): string;
|
|
66
150
|
export function resolveSSRNode(node: any, result?: any, top?: boolean): any;
|
|
67
151
|
export function escape(s: any, attr?: boolean): any;
|
|
68
|
-
export function applyRef(
|
|
152
|
+
export function applyRef(
|
|
153
|
+
r: ((element: any) => void) | ((element: any) => void)[],
|
|
154
|
+
element: any
|
|
155
|
+
): void;
|
|
156
|
+
/** @deprecated Use `useHead` — removed before `0.50.0` stable. */
|
|
69
157
|
export function useAssets(fn: () => JSX.Element): void;
|
|
158
|
+
/**
|
|
159
|
+
* @deprecated Use the `onHead` render option — removed before `0.50.0`
|
|
160
|
+
* stable. Reads ambient render state, so it is unsafe across concurrent
|
|
161
|
+
* renders; `onHead` is closure-bound to its render and also carries
|
|
162
|
+
* `useHead` output, which this does not.
|
|
163
|
+
*/
|
|
70
164
|
export function getAssets(): string;
|
|
165
|
+
/**
|
|
166
|
+
* A head tag descriptor. Props values may be getters (evaluated lazily on
|
|
167
|
+
* the server — at the owning flush boundary — and reactively on the client);
|
|
168
|
+
* `children` is the text body (title text, inline style/script content).
|
|
169
|
+
* `key` overrides the built-in dedupe identity (`title` is a hard singleton
|
|
170
|
+
* that `key` cannot fork).
|
|
171
|
+
*/
|
|
172
|
+
export type HeadTag = {
|
|
173
|
+
tag: "title" | "meta" | "link" | "style" | "script" | "base";
|
|
174
|
+
props: Record<string, any>;
|
|
175
|
+
key?: string | (() => string);
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Registers head tags with the render's head registry. An array is a group —
|
|
179
|
+
* one replacement set; a single tag is a group of one. Replaceable tags
|
|
180
|
+
* (title/meta/canonical/…) resolve by last-committed group and stream as
|
|
181
|
+
* patches with their suspense boundary's reveal; resource tags (preload and
|
|
182
|
+
* friends, stylesheets, `script[src]`) emit eagerly and dedupe by identity.
|
|
183
|
+
* See docs/head-management-rfc.md.
|
|
184
|
+
*/
|
|
185
|
+
export function useHead(tag: HeadTag | HeadTag[]): void;
|
|
71
186
|
export function getHydrationKey(): string | undefined;
|
|
72
|
-
export function effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void
|
|
187
|
+
export function effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void): void;
|
|
73
188
|
export function memo<T>(fn: () => T, equal: boolean): () => T;
|
|
74
189
|
export function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
|
|
75
190
|
export function mergeProps(...sources: unknown[]): unknown;
|
|
76
191
|
export function getOwner(): unknown;
|
|
77
|
-
export function
|
|
78
|
-
|
|
192
|
+
export function generateHydrationScript(options?: {
|
|
193
|
+
nonce?: string;
|
|
194
|
+
eventNames?: string[];
|
|
195
|
+
}): string;
|
|
196
|
+
/**
|
|
197
|
+
* Registered symbol (`Symbol.for("solid.RequestContext")`) naming the
|
|
198
|
+
* global slot where `provideRequestEvent` parks the AsyncLocalStorage that
|
|
199
|
+
* scopes request events. Integration plumbing — application code reads the
|
|
200
|
+
* event through `getRequestEvent()` instead.
|
|
201
|
+
* @internal
|
|
202
|
+
*/
|
|
79
203
|
export declare const RequestContext: unique symbol;
|
|
204
|
+
/**
|
|
205
|
+
* The mutable response head an integration's handler exposes on the request
|
|
206
|
+
* event as `event.response`: status/statusText/headers it will apply when
|
|
207
|
+
* sending the response. A scaffold, not a `Response` — application code
|
|
208
|
+
* (e.g. JSX response components) writes to it during render, and the
|
|
209
|
+
* handler reads it when the head goes out. Core does not declare the
|
|
210
|
+
* `response` property on `RequestEvent` itself: integrations that provide
|
|
211
|
+
* one declare it through module augmentation (as `@solidjs/router` does),
|
|
212
|
+
* and this type names the shape they agree on. Core's server-function
|
|
213
|
+
* handler reads its `Set-Cookie` headers when folding single-flight
|
|
214
|
+
* cookies but never requires it.
|
|
215
|
+
*/
|
|
216
|
+
export interface ResponseStub {
|
|
217
|
+
status?: number;
|
|
218
|
+
statusText?: string;
|
|
219
|
+
headers: Headers;
|
|
220
|
+
/**
|
|
221
|
+
* Set by the integration once the response head has been derived/sent
|
|
222
|
+
* from this stub — status and headers can no longer change. Consumers
|
|
223
|
+
* that write response metadata during render (e.g. JSX response
|
|
224
|
+
* components) must treat later status/header writes and cleanup-time
|
|
225
|
+
* retractions as no-ops.
|
|
226
|
+
*/
|
|
227
|
+
committed?: boolean;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* The per-request context available on the server: the incoming `Request`
|
|
232
|
+
* and a `locals` bag integrations and middleware can hang state on.
|
|
233
|
+
* Frameworks typically extend this shape with richer fields (e.g. a
|
|
234
|
+
* `response` head — see `ResponseStub`).
|
|
235
|
+
*/
|
|
80
236
|
export interface RequestEvent {
|
|
81
237
|
request: Request;
|
|
82
238
|
locals: Record<string | number | symbol, any>;
|
|
83
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* The current request event, when called on the server inside a request
|
|
242
|
+
* scope (established by `provideRequestEvent` from `@solidjs/web/storage`
|
|
243
|
+
* or by the framework). Undefined on the client and outside a request.
|
|
244
|
+
* Read it above `await` boundaries in partially-polyfilled environments.
|
|
245
|
+
*/
|
|
84
246
|
export function getRequestEvent(): RequestEvent | undefined;
|
|
85
247
|
|
|
86
248
|
export function Assets(props: { children?: JSX.Element }): JSX.Element;
|
|
@@ -104,15 +266,26 @@ export function insert<T>(
|
|
|
104
266
|
): JSX.Element;
|
|
105
267
|
|
|
106
268
|
/** @deprecated not supported on the server side */
|
|
107
|
-
export function spread<T>(
|
|
108
|
-
node: Element,
|
|
109
|
-
accessor: T,
|
|
110
|
-
isSVG?: Boolean,
|
|
111
|
-
skipChildren?: Boolean
|
|
112
|
-
): void;
|
|
269
|
+
export function spread<T>(node: Element, accessor: T, skipChildren?: Boolean): void;
|
|
113
270
|
|
|
114
271
|
/** @deprecated not supported on the server side */
|
|
115
|
-
export function delegateEvents(eventNames: string[]
|
|
272
|
+
export function delegateEvents(eventNames: string[]): void;
|
|
273
|
+
/** @deprecated not supported on the server side */
|
|
274
|
+
export function registerDelegatedRoot(root: MountableElement): void;
|
|
275
|
+
/** @deprecated not supported on the server side */
|
|
276
|
+
export function unregisterDelegatedRoot(root: MountableElement): void;
|
|
277
|
+
/** @deprecated not supported on the server side */
|
|
278
|
+
export function registerDelegatedContainer(
|
|
279
|
+
container: MountableElement,
|
|
280
|
+
owner?: MountableElement
|
|
281
|
+
): void;
|
|
282
|
+
/** @deprecated not supported on the server side */
|
|
283
|
+
export function unregisterDelegatedContainer(
|
|
284
|
+
container: MountableElement,
|
|
285
|
+
owner?: MountableElement
|
|
286
|
+
): void;
|
|
287
|
+
/** @deprecated not supported on the server side */
|
|
288
|
+
export function getDelegatedRoot(node: MountableElement): MountableElement | undefined;
|
|
116
289
|
/** @deprecated not supported on the server side */
|
|
117
290
|
export function dynamicProperty(props: unknown, key: string): unknown;
|
|
118
291
|
/** @deprecated not supported on the server side */
|
|
@@ -120,24 +293,35 @@ export function setAttribute(node: Element, name: string, value: string): void;
|
|
|
120
293
|
/** @deprecated not supported on the server side */
|
|
121
294
|
export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
|
|
122
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Server no-op: element claims are a client-only concern, but consumers may
|
|
298
|
+
* register isomorphically. Returns a no-op unregister function.
|
|
299
|
+
*/
|
|
300
|
+
export function registerElementClaim(handler: (element: Element) => void): () => void;
|
|
301
|
+
/** Server no-op: returns `node` unchanged. Claims never fire during SSR. */
|
|
302
|
+
export function claimElement<T extends Element>(node: T): T;
|
|
303
|
+
/** Server no-op: returns `root` unchanged. Claims never fire during SSR. */
|
|
304
|
+
export function claimElementTree<T extends Node>(root: T): T;
|
|
305
|
+
|
|
123
306
|
/** @deprecated not supported on the server side */
|
|
124
|
-
export function
|
|
125
|
-
node: Element,
|
|
126
|
-
name: string,
|
|
127
|
-
handler: () => void,
|
|
128
|
-
delegate: boolean
|
|
129
|
-
): void;
|
|
307
|
+
export function addEvent(node: Element, name: string, handler: () => void, delegate: boolean): void;
|
|
130
308
|
|
|
131
309
|
/** @deprecated not supported on the server side */
|
|
132
310
|
export function render(code: () => JSX.Element, element: MountableElement): () => void;
|
|
133
|
-
/**
|
|
134
|
-
|
|
311
|
+
/**
|
|
312
|
+
* @deprecated not supported on the server side
|
|
313
|
+
* @param flag
|
|
314
|
+
* - `undefined` — clone the template as-is (uses `cloneNode`).
|
|
315
|
+
* - `1` — use `document.importNode` instead of `cloneNode`.
|
|
316
|
+
* - `2` — the template html is wrapped; the outer tag is stripped at clone time.
|
|
317
|
+
*/
|
|
318
|
+
export function template(html: string, flag?: 1 | 2): () => Element;
|
|
135
319
|
/** @deprecated not supported on the server side */
|
|
136
320
|
export function setProperty(node: Element, name: string, value: any): void;
|
|
137
321
|
/** @deprecated not supported on the server side */
|
|
138
322
|
export function className(node: Element, value: string): void;
|
|
139
323
|
/** @deprecated not supported on the server side */
|
|
140
|
-
export function assign(node: Element, props: any,
|
|
324
|
+
export function assign(node: Element, props: any, skipChildren?: Boolean): void;
|
|
141
325
|
|
|
142
326
|
/** @deprecated not supported on the server side */
|
|
143
327
|
export function hydrate(
|
|
@@ -154,3 +338,12 @@ export function getNextMatch(start: Node, elementName: string): Element;
|
|
|
154
338
|
export function getNextMarker(start: Node): [Node, Array<Node>];
|
|
155
339
|
/** @deprecated not supported on the server side */
|
|
156
340
|
export function runHydrationEvents(): void;
|
|
341
|
+
/** @deprecated not supported on the server side */
|
|
342
|
+
export function ref(
|
|
343
|
+
fn: () => ((element: Element) => void) | ((element: Element) => void)[],
|
|
344
|
+
element: Element
|
|
345
|
+
): void;
|
|
346
|
+
/** @deprecated not supported on the server side */
|
|
347
|
+
export function setStyleProperty(node: Element, name: string, value: any): void;
|
|
348
|
+
/** @deprecated not supported on the server side — register assets through the render context instead */
|
|
349
|
+
export function acquireAsset(descriptor: unknown): () => void;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { JSX } from "./jsx.cjs";
|
|
2
|
+
export const DOMWithState: Record<string, Record<string, 1 | 2>>;
|
|
3
|
+
export const ChildProperties: Set<string>;
|
|
4
|
+
export const DelegatedEvents: Set<string>;
|
|
5
|
+
export const DOMElements: Set<string>;
|
|
6
|
+
export const SVGElements: Set<string>;
|
|
7
|
+
export const MathMLElements: Set<string>;
|
|
8
|
+
export const VoidElements: Set<string>;
|
|
9
|
+
export const RawTextElements: Set<string>;
|
|
10
|
+
export const Namespaces: Record<string, string>;
|
|
11
|
+
|
|
12
|
+
type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
|
|
13
|
+
export function render(
|
|
14
|
+
code: () => JSX.Element,
|
|
15
|
+
element: MountableElement,
|
|
16
|
+
init?: JSX.Element,
|
|
17
|
+
options?: { owner?: unknown }
|
|
18
|
+
): () => void;
|
|
19
|
+
/**
|
|
20
|
+
* @param flag
|
|
21
|
+
* - `undefined` — clone the template as-is (uses `cloneNode`).
|
|
22
|
+
* - `1` — use `document.importNode` instead of `cloneNode`.
|
|
23
|
+
* - `2` — the template html is wrapped; the outer tag is stripped at clone time.
|
|
24
|
+
*/
|
|
25
|
+
export function template(html: string, flag?: 1 | 2): () => Element;
|
|
26
|
+
export function scope<T extends () => any>(fn: T): T;
|
|
27
|
+
export function effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void): void;
|
|
28
|
+
export function memo<T>(fn: () => T, equal: boolean): () => T;
|
|
29
|
+
export function untrack<T>(fn: () => T): T;
|
|
30
|
+
export function insert<T>(
|
|
31
|
+
parent: MountableElement,
|
|
32
|
+
accessor: (() => T) | T,
|
|
33
|
+
marker?: Node | null,
|
|
34
|
+
init?: JSX.Element,
|
|
35
|
+
options?: {
|
|
36
|
+
/**
|
|
37
|
+
* Live accessor for the slot's logical host in the source tree (portals).
|
|
38
|
+
* Each top-level node the slot manages is tagged with a `_$host` getter
|
|
39
|
+
* backed by this accessor so delegated events retarget correctly.
|
|
40
|
+
*/
|
|
41
|
+
host?: () => Node | null;
|
|
42
|
+
/** Defer the insert effect to the queue instead of running it inline. */
|
|
43
|
+
schedule?: boolean;
|
|
44
|
+
}
|
|
45
|
+
): JSX.Element;
|
|
46
|
+
export function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
|
|
47
|
+
export function delegateEvents(eventNames: string[]): void;
|
|
48
|
+
export function registerDelegatedRoot(root: MountableElement): void;
|
|
49
|
+
export function unregisterDelegatedRoot(root: MountableElement): void;
|
|
50
|
+
export function registerDelegatedContainer(
|
|
51
|
+
container: MountableElement,
|
|
52
|
+
owner?: MountableElement
|
|
53
|
+
): void;
|
|
54
|
+
export function unregisterDelegatedContainer(
|
|
55
|
+
container: MountableElement,
|
|
56
|
+
owner?: MountableElement
|
|
57
|
+
): void;
|
|
58
|
+
export function getDelegatedRoot(node: MountableElement): MountableElement | undefined;
|
|
59
|
+
export function spread<T>(node: Element, accessor: T, skipChildren?: Boolean): void;
|
|
60
|
+
export function assign(
|
|
61
|
+
node: Element,
|
|
62
|
+
props: any,
|
|
63
|
+
skipChildren?: Boolean,
|
|
64
|
+
prevProps?: any,
|
|
65
|
+
skipRef?: Boolean
|
|
66
|
+
): void;
|
|
67
|
+
export function setAttribute(node: Element, name: string, value: string): void;
|
|
68
|
+
export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Register a consumer for compiler-emitted element claims. Compiled DOM
|
|
71
|
+
* output claims navigation-relevant elements (`a[href]`, `form[action]`) at
|
|
72
|
+
* creation, and compiler-owned writes to `href`/`action` re-invoke the same
|
|
73
|
+
* handlers — so handlers must be idempotent and must check the element's
|
|
74
|
+
* relevance themselves (rechecks can fire for any element whose
|
|
75
|
+
* `href`/`action` is written, e.g. `<link href>`). Handlers run under the
|
|
76
|
+
* reactive owner current at element creation; scope per-element state and
|
|
77
|
+
* cleanup through your own reactive system. Dormant until registered —
|
|
78
|
+
* without a handler the emitted claims are null checks. Returns an
|
|
79
|
+
* unregister function.
|
|
80
|
+
*/
|
|
81
|
+
export function registerElementClaim(handler: (element: Element) => void): () => void;
|
|
82
|
+
/**
|
|
83
|
+
* Claim `node` for registered consumers (see `registerElementClaim`).
|
|
84
|
+
* Emitted by the compiler at element creation; idempotent by contract.
|
|
85
|
+
*/
|
|
86
|
+
export function claimElement<T extends Element>(node: T): T;
|
|
87
|
+
/**
|
|
88
|
+
* Sweep-claim every navigation-relevant element (`a[href]`, `form[action]`)
|
|
89
|
+
* in `root` — the subtree equivalent of the per-element `claimElement`
|
|
90
|
+
* compiled output emits, for content that becomes live DOM without compiled
|
|
91
|
+
* creation code (frame streams, adopted SSR ranges). Dormant without a
|
|
92
|
+
* registered consumer.
|
|
93
|
+
*/
|
|
94
|
+
export function claimElementTree<T extends Node>(root: T): T;
|
|
95
|
+
export function className(node: Element, value: JSX.ClassValue, prev?: JSX.ClassValue): void;
|
|
96
|
+
export function setProperty(node: Element, name: string, value: any): void;
|
|
97
|
+
export function setStyleProperty(node: Element, name: string, value: any): void;
|
|
98
|
+
export function addEvent(
|
|
99
|
+
node: Element,
|
|
100
|
+
name: string,
|
|
101
|
+
handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions),
|
|
102
|
+
delegate: boolean
|
|
103
|
+
): void;
|
|
104
|
+
export function style(
|
|
105
|
+
node: Element,
|
|
106
|
+
value: { [k: string]: string },
|
|
107
|
+
prev?: { [k: string]: string }
|
|
108
|
+
): void;
|
|
109
|
+
export function getOwner(): unknown;
|
|
110
|
+
export function mergeProps(...sources: unknown[]): unknown;
|
|
111
|
+
export function dynamicProperty(props: unknown, key: string): unknown;
|
|
112
|
+
export function applyRef<T extends Element = Element>(
|
|
113
|
+
r: ((element: NoInfer<T>) => void) | ((element: NoInfer<T>) => void)[],
|
|
114
|
+
element: T
|
|
115
|
+
): void;
|
|
116
|
+
export function ref(
|
|
117
|
+
fn: () => ((element: Element) => void) | ((element: Element) => void)[],
|
|
118
|
+
element: Element
|
|
119
|
+
): void;
|
|
120
|
+
|
|
121
|
+
export function hydrate(
|
|
122
|
+
fn: () => JSX.Element,
|
|
123
|
+
node: MountableElement,
|
|
124
|
+
options?: { renderId?: string; owner?: unknown }
|
|
125
|
+
): () => void;
|
|
126
|
+
export function getHydrationKey(): string | undefined;
|
|
127
|
+
export function getNextElement(template?: () => Element): Element;
|
|
128
|
+
export function getNextMatch(start: Node, elementName: string): Element;
|
|
129
|
+
export function getNextMarker(start: Node): [Node, Array<Node>];
|
|
130
|
+
/** @deprecated Use `useHead` — removed before `0.50.0` stable. */
|
|
131
|
+
export function useAssets(fn: () => JSX.Element): void;
|
|
132
|
+
/** @deprecated Use `useHead` — removed before `0.50.0` stable. */
|
|
133
|
+
export function getAssets(): string;
|
|
134
|
+
/**
|
|
135
|
+
* A head tag descriptor. Props values may be getters (reactive on the
|
|
136
|
+
* client); `children` is the text body. `key` overrides the built-in dedupe
|
|
137
|
+
* identity (`title` is a hard singleton that `key` cannot fork).
|
|
138
|
+
*/
|
|
139
|
+
export type HeadTag = {
|
|
140
|
+
tag: "title" | "meta" | "link" | "style" | "script" | "base";
|
|
141
|
+
props: Record<string, any>;
|
|
142
|
+
key?: string | (() => string);
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Registers head tags with the ambient head registry under the current
|
|
146
|
+
* owner. An array is a group — one replacement set. Resolution is
|
|
147
|
+
* last-committed group per identity; disposal restores the previous winner.
|
|
148
|
+
* During hydration the server-flushed head state stays authoritative until
|
|
149
|
+
* hydration completes. See docs/head-management-rfc.md.
|
|
150
|
+
*/
|
|
151
|
+
export function useHead(tag: HeadTag | HeadTag[]): void;
|
|
152
|
+
export type AssetDescriptor =
|
|
153
|
+
| { type: "style"; href: string; attrs?: Record<string, string> }
|
|
154
|
+
| { type: "inline-style"; id: string; content?: string; attrs?: Record<string, string> }
|
|
155
|
+
| { type: "module"; href: string }
|
|
156
|
+
| ExclusiveAssetDescriptor<any>;
|
|
157
|
+
export interface ExclusiveAssetDescriptor<T> {
|
|
158
|
+
policy: "exclusive";
|
|
159
|
+
key: string;
|
|
160
|
+
value: T;
|
|
161
|
+
get(): T;
|
|
162
|
+
set(value: T): void;
|
|
163
|
+
}
|
|
164
|
+
export function acquireAsset(descriptor: AssetDescriptor): () => void;
|
|
165
|
+
export function HydrationScript(props?: { nonce?: string; eventNames?: string[] }): JSX.Element;
|
|
166
|
+
export function generateHydrationScript(options?: {
|
|
167
|
+
nonce?: string;
|
|
168
|
+
eventNames?: string[];
|
|
169
|
+
}): string;
|
|
170
|
+
export function Assets(props: { children?: JSX.Element }): JSX.Element;
|
|
171
|
+
/**
|
|
172
|
+
* See the server entry's `ResponseStub` — the shape of the mutable response
|
|
173
|
+
* head integrations expose as `event.response` via module augmentation.
|
|
174
|
+
*/
|
|
175
|
+
export interface ResponseStub {
|
|
176
|
+
status?: number;
|
|
177
|
+
statusText?: string;
|
|
178
|
+
headers: Headers;
|
|
179
|
+
/**
|
|
180
|
+
* Set by the integration once the response head has been derived/sent
|
|
181
|
+
* from this stub (status/headers can no longer change); consumers must
|
|
182
|
+
* treat later writes and cleanup-time retractions as no-ops.
|
|
183
|
+
*/
|
|
184
|
+
committed?: boolean;
|
|
185
|
+
}
|
|
186
|
+
export interface RequestEvent {
|
|
187
|
+
request: Request;
|
|
188
|
+
locals: Record<string | number | symbol, any>;
|
|
189
|
+
}
|
|
190
|
+
export declare const RequestContext: unique symbol;
|
|
191
|
+
export function getRequestEvent(): RequestEvent | undefined;
|
|
192
|
+
export function runHydrationEvents(): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { getOwner, runWithOwner, createComponent, createRoot as root, sharedConfig, untrack, merge as mergeProps, flatten, ssrHandleError, ssrScope, NoHydration, Hydration, runInServerComponentScope } from "solid-js";
|
|
2
|
+
export declare const effect: (fn: any, effectFn: any, options: any) => void;
|
|
3
|
+
export declare const memo: (fn: any) => import("solid-js").SourceAccessor<any>;
|
|
4
|
+
export declare const runWithHydrationScope: (id: any, fn: any) => unknown;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { createFrame, createFrameHost, createFrameElement, FRAME_APPLIED_EVENT } from "./frame-client.cjs";
|
|
2
|
+
export { FRAME_STREAM_HEADER, applyFrameResponse, isFrameStreamResponse, createServerComponentHandler } from "./frame-transport.cjs";
|
|
3
|
+
export { createJSONDataTable } from "./serializer.cjs";
|
|
4
|
+
export type { Slot } from "./server.cjs";
|
|
5
|
+
export declare function getFrameHost(): any;
|
|
6
|
+
/**
|
|
7
|
+
* Installs the server-component transport policy on the server-function
|
|
8
|
+
* client: boundary identity is the call's intrinsic (function, arguments)
|
|
9
|
+
* address — per-args, exactly like the query cache, so a cached component
|
|
10
|
+
* always mounts the boundary showing the call it was cached for. Repeat
|
|
11
|
+
* calls for the same args resolve the identical component (refetches morph
|
|
12
|
+
* in place, cache hits pass `dynamic`'s equals-gate); a source switching
|
|
13
|
+
* args swaps boundaries, re-materialized instantly from the host's
|
|
14
|
+
* retained state.
|
|
15
|
+
*
|
|
16
|
+
* Call once in the client entry (an explicit call — the package is
|
|
17
|
+
* `sideEffects: false`, so a bare import would be tree-shaken away);
|
|
18
|
+
* call again to rebind to a custom host.
|
|
19
|
+
*/
|
|
20
|
+
export declare function installServerComponents(host?: any): void;
|