@solidjs/web 2.0.0-beta.17 → 2.0.0-beta.19
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/dev.cjs +138 -48
- package/dist/dev.js +134 -50
- package/dist/server.cjs +108 -23
- package/dist/server.js +105 -25
- package/dist/web.cjs +138 -48
- package/dist/web.js +134 -50
- package/package.json +100 -11
- package/serialization/dist/serialization.cjs +83 -0
- package/serialization/dist/serialization.js +75 -0
- package/serialization/package.json +20 -0
- package/serialization/types/index.d.ts +139 -0
- package/serialization/types-cjs/index.d.cts +139 -0
- package/serialization/types-cjs/package.json +3 -0
- package/server-functions/dist/client.cjs +370 -0
- package/server-functions/dist/client.js +363 -0
- package/server-functions/dist/server.cjs +542 -0
- package/server-functions/dist/server.js +531 -0
- package/server-functions/package.json +30 -0
- package/storage/types/index.d.ts +28 -0
- package/storage/types-cjs/index.d.cts +28 -0
- package/types/index.d.ts +8 -1
- package/types/response.d.ts +93 -0
- package/types/serializer.d.ts +139 -0
- package/types/server-functions/client.d.ts +63 -0
- package/types/server-functions/server.d.ts +188 -0
- package/types/server-functions/shared.d.ts +171 -0
- package/types/server.d.ts +70 -15
- package/types-cjs/index.d.cts +8 -1
- package/types-cjs/response.d.cts +93 -0
- package/types-cjs/serializer.d.cts +139 -0
- package/types-cjs/server-functions/client.d.cts +63 -0
- package/types-cjs/server-functions/server.d.cts +188 -0
- package/types-cjs/server-functions/shared.d.cts +171 -0
- package/types-cjs/server.d.cts +70 -15
- package/storage/types/src/client.d.ts +0 -1
- package/storage/types/src/index.d.ts +0 -171
- package/storage/types/src/server-mock.d.ts +0 -161
- package/storage/types/storage/src/index.d.ts +0 -2
- package/storage/types-cjs/src/client.d.cts +0 -1
- package/storage/types-cjs/src/index.d.cts +0 -171
- package/storage/types-cjs/src/server-mock.d.cts +0 -161
- package/storage/types-cjs/storage/src/index.d.cts +0 -2
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { JSONCodecOptions } from "../serializer.cjs";
|
|
2
|
+
|
|
3
|
+
export type { JSONCodecOptions };
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configures the codec options for the server function wire format (extra
|
|
7
|
+
* Seroval plugins, feature policy, depth limit). Both peers must configure
|
|
8
|
+
* identical options or payloads will not round-trip. Usually called
|
|
9
|
+
* indirectly through `configureServerFunctionsClient` /
|
|
10
|
+
* `configureServerFunctionsServer` (their `codec` option writes through to
|
|
11
|
+
* here); call it directly only from universal code configuring both sides
|
|
12
|
+
* at once.
|
|
13
|
+
*/
|
|
14
|
+
export function configureServerFunctionsCodec(codec: JSONCodecOptions | undefined): void;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The currently configured codec options (set through
|
|
18
|
+
* `configureServerFunctionsCodec` or the client/server `codec` option), or
|
|
19
|
+
* undefined when running on the defaults. Integrations pass this to
|
|
20
|
+
* lower-level codec helpers so custom plugins configured by the app apply.
|
|
21
|
+
*/
|
|
22
|
+
export function getServerFunctionsCodec(): JSONCodecOptions | undefined;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Request header carrying the server function id (`"X-Server-Function-Id"`).
|
|
26
|
+
* Integrations can read it to identify which function a request targets;
|
|
27
|
+
* the id also arrives as the `id` query parameter for GET calls and no-JS
|
|
28
|
+
* form posts.
|
|
29
|
+
*/
|
|
30
|
+
export const FUNCTION_HEADER: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Request header carrying a per-call instance id
|
|
34
|
+
* (`"X-Server-Function-Instance"`). Its presence tells the server the call
|
|
35
|
+
* came through the client runtime — its absence marks a no-JS form post or
|
|
36
|
+
* direct HTTP call, which receive plain responses instead of codec-encoded
|
|
37
|
+
* ones.
|
|
38
|
+
*/
|
|
39
|
+
export const INSTANCE_HEADER: string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Header carrying the body format tag (a `BodyFormat` value) —
|
|
43
|
+
* `"X-Server-Function-Format"`.
|
|
44
|
+
*
|
|
45
|
+
* Transport wire detail; not meant for hand-written code.
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export const BODY_FORMAT_HEADER: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* FormData key used when a lone File is sent as the argument.
|
|
52
|
+
*
|
|
53
|
+
* Transport wire detail; not meant for hand-written code.
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export const FILE_FORM_KEY: string;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Wire tags naming how a request/response body was encoded, carried in
|
|
60
|
+
* `BODY_FORMAT_HEADER`.
|
|
61
|
+
*
|
|
62
|
+
* Transport wire detail; not meant for hand-written code.
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export const BodyFormat: {
|
|
66
|
+
readonly Serialized: "0";
|
|
67
|
+
readonly String: "1";
|
|
68
|
+
readonly FormData: "2";
|
|
69
|
+
readonly URLSearchParams: "3";
|
|
70
|
+
readonly Blob: "4";
|
|
71
|
+
readonly File: "5";
|
|
72
|
+
readonly ArrayBuffer: "6";
|
|
73
|
+
readonly Uint8Array: "7";
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Transport wire detail; not meant for hand-written code.
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
export type BodyFormatValue = (typeof BodyFormat)[keyof typeof BodyFormat];
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Picks a direct HTTP encoding (headers + BodyInit) for values that have
|
|
84
|
+
* one — strings, FormData, URLSearchParams, File, Blob, ArrayBuffer,
|
|
85
|
+
* Uint8Array. Returns undefined when the value needs the serializer.
|
|
86
|
+
*
|
|
87
|
+
* Transport building block used by the fetch transport and the HTTP
|
|
88
|
+
* handler; not meant for hand-written code.
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
export function getHeadersAndBody(
|
|
92
|
+
body: unknown
|
|
93
|
+
): { headers?: Record<string, string>; body: BodyInit } | undefined;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Decodes a Request/Response body according to its `BODY_FORMAT_HEADER`
|
|
97
|
+
* tag (falling back to content-type sniffing for form posts that never saw
|
|
98
|
+
* the client runtime). The inverse of `getHeadersAndBody` + the serialized
|
|
99
|
+
* stream. Resolves undefined for bodies without a recognized encoding.
|
|
100
|
+
*
|
|
101
|
+
* Transport building block; use `decodeResponse` from integration code.
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
export function extractBody(
|
|
105
|
+
source: Request | Response,
|
|
106
|
+
codecOptions?: JSONCodecOptions
|
|
107
|
+
): Promise<unknown>;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Serializes a value as a stream of length-prefixed SerovalNode chunks.
|
|
111
|
+
* Async values (promises, streams) keep the stream open until they settle,
|
|
112
|
+
* so one connection carries incremental results. Codec options must match
|
|
113
|
+
* the deserializing peer.
|
|
114
|
+
*
|
|
115
|
+
* Transport building block; not meant for hand-written code.
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
export function serializeStream(
|
|
119
|
+
value: unknown,
|
|
120
|
+
codecOptions?: JSONCodecOptions
|
|
121
|
+
): ReadableStream<Uint8Array>;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* `serializeStream` drained to a string (async values fully awaited).
|
|
125
|
+
*
|
|
126
|
+
* Transport building block; not meant for hand-written code.
|
|
127
|
+
* @internal
|
|
128
|
+
*/
|
|
129
|
+
export function serializeString(value: unknown, codecOptions?: JSONCodecOptions): Promise<string>;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Decodes a framed chunk stream from a Request/Response body. Resolves with
|
|
133
|
+
* the first chunk's value (the source value); later chunks settle the async
|
|
134
|
+
* values referenced inside it as they arrive.
|
|
135
|
+
*
|
|
136
|
+
* Transport building block; use `decodeResponse` from integration code.
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
export function deserializeStream<T = unknown>(
|
|
140
|
+
source: Request | Response,
|
|
141
|
+
codecOptions?: JSONCodecOptions
|
|
142
|
+
): Promise<T>;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* `deserializeStream` for an already-buffered string.
|
|
146
|
+
*
|
|
147
|
+
* Transport building block; not meant for hand-written code.
|
|
148
|
+
* @internal
|
|
149
|
+
*/
|
|
150
|
+
export function deserializeString<T = unknown>(
|
|
151
|
+
text: string,
|
|
152
|
+
codecOptions?: JSONCodecOptions
|
|
153
|
+
): Promise<T>;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Decodes a server function response body using the configured codec. This
|
|
157
|
+
* is the integration-facing decoder: routers call it on responses the
|
|
158
|
+
* transport hands over whole — redirects, revalidation, single-flight
|
|
159
|
+
* payloads — to recover the structured value inside. Resolves undefined for
|
|
160
|
+
* empty bodies and bodies without a recognized encoding (e.g. a raw user
|
|
161
|
+
* Response). Renderer- and platform-neutral: safe to use from universal
|
|
162
|
+
* code.
|
|
163
|
+
*
|
|
164
|
+
* @param response the transport response; its body is read from a clone,
|
|
165
|
+
* so the original stays readable
|
|
166
|
+
* @param codecOptions overrides the configured codec for this call
|
|
167
|
+
*/
|
|
168
|
+
export function decodeResponse<T = unknown>(
|
|
169
|
+
response: Response,
|
|
170
|
+
codecOptions?: JSONCodecOptions
|
|
171
|
+
): Promise<T | undefined>;
|
package/types-cjs/server.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { JSX } from "./jsx.cjs";
|
|
2
|
+
import { SerializerPlugin } from "./serializer.cjs";
|
|
2
3
|
export const DOMWithState: Record<string, Record<string, 1 | 2>>;
|
|
3
4
|
export const ChildProperties: Set<string>;
|
|
4
5
|
export const DelegatedEvents: Set<string>;
|
|
@@ -11,17 +12,59 @@ export const Namespaces: Record<string, string>;
|
|
|
11
12
|
|
|
12
13
|
type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
|
|
13
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
|
+
|
|
14
60
|
export function renderToString<T>(
|
|
15
61
|
fn: () => T,
|
|
16
62
|
options?: {
|
|
17
63
|
nonce?: string;
|
|
18
64
|
renderId?: string;
|
|
19
65
|
noScripts?: boolean;
|
|
20
|
-
plugins?:
|
|
21
|
-
manifest?:
|
|
22
|
-
string,
|
|
23
|
-
{ file: string; css?: string[]; isEntry?: boolean; imports?: string[] }
|
|
24
|
-
> & { _base?: string };
|
|
66
|
+
plugins?: SerializerPlugin[];
|
|
67
|
+
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
25
68
|
onError?: (err: any) => void;
|
|
26
69
|
}
|
|
27
70
|
): string;
|
|
@@ -33,11 +76,8 @@ export function renderToStringAsync<T>(
|
|
|
33
76
|
nonce?: string;
|
|
34
77
|
renderId?: string;
|
|
35
78
|
noScripts?: boolean;
|
|
36
|
-
plugins?:
|
|
37
|
-
manifest?:
|
|
38
|
-
string,
|
|
39
|
-
{ file: string; css?: string[]; isEntry?: boolean; imports?: string[] }
|
|
40
|
-
> & { _base?: string };
|
|
79
|
+
plugins?: SerializerPlugin[];
|
|
80
|
+
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
41
81
|
onError?: (err: any) => void;
|
|
42
82
|
}
|
|
43
83
|
): Promise<string>;
|
|
@@ -47,11 +87,8 @@ export function renderToStream<T>(
|
|
|
47
87
|
nonce?: string;
|
|
48
88
|
renderId?: string;
|
|
49
89
|
noScripts?: boolean;
|
|
50
|
-
plugins?:
|
|
51
|
-
manifest?:
|
|
52
|
-
string,
|
|
53
|
-
{ file: string; css?: string[]; isEntry?: boolean; imports?: string[] }
|
|
54
|
-
> & { _base?: string };
|
|
90
|
+
plugins?: SerializerPlugin[];
|
|
91
|
+
manifest?: AssetManifest | AssetResolver | AssetResolverFn;
|
|
55
92
|
onCompleteShell?: (info: { write: (v: string) => void }) => void;
|
|
56
93
|
onCompleteAll?: (info: { write: (v: string) => void }) => void;
|
|
57
94
|
onError?: (err: any) => void;
|
|
@@ -95,11 +132,29 @@ export function generateHydrationScript(options?: {
|
|
|
95
132
|
nonce?: string;
|
|
96
133
|
eventNames?: string[];
|
|
97
134
|
}): string;
|
|
135
|
+
/**
|
|
136
|
+
* Registered symbol (`Symbol.for("solid.RequestContext")`) naming the
|
|
137
|
+
* global slot where `provideRequestEvent` parks the AsyncLocalStorage that
|
|
138
|
+
* scopes request events. Integration plumbing — application code reads the
|
|
139
|
+
* event through `getRequestEvent()` instead.
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
98
142
|
export declare const RequestContext: unique symbol;
|
|
143
|
+
/**
|
|
144
|
+
* The per-request context available on the server: the incoming `Request`
|
|
145
|
+
* and a `locals` bag integrations and middleware can hang state on.
|
|
146
|
+
* Frameworks typically extend this shape with richer fields.
|
|
147
|
+
*/
|
|
99
148
|
export interface RequestEvent {
|
|
100
149
|
request: Request;
|
|
101
150
|
locals: Record<string | number | symbol, any>;
|
|
102
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* The current request event, when called on the server inside a request
|
|
154
|
+
* scope (established by `provideRequestEvent` from `@solidjs/web/storage`
|
|
155
|
+
* or by the framework). Undefined on the client and outside a request.
|
|
156
|
+
* Read it above `await` boundaries in partially-polyfilled environments.
|
|
157
|
+
*/
|
|
103
158
|
export function getRequestEvent(): RequestEvent | undefined;
|
|
104
159
|
|
|
105
160
|
export function Assets(props: { children?: JSX.Element }): JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@dom-expressions/runtime/src/client.js";
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { hydrate as hydrateCore } from "./client.js";
|
|
2
|
-
import { Component } from "solid-js";
|
|
3
|
-
import type { JSX } from "./jsx.js";
|
|
4
|
-
export * from "./client.js";
|
|
5
|
-
export * from "./server-mock.js";
|
|
6
|
-
export type { JSX } from "./jsx.js";
|
|
7
|
-
export { For, Show, Switch, Match, Errored, Loading, Repeat, Reveal, NoHydration, Hydration } from "solid-js";
|
|
8
|
-
import { merge } from "solid-js";
|
|
9
|
-
/**
|
|
10
|
-
* Compiler-emitted prop-spread helper. The JSX transform (in
|
|
11
|
-
* `dom-expressions`) emits `mergeProps(...)` calls when compiling prop
|
|
12
|
-
* spreads on components — it is *not* a user-facing API. Application code
|
|
13
|
-
* should import `merge` from `solid-js` directly.
|
|
14
|
-
*
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export declare const mergeProps: typeof merge;
|
|
18
|
-
/**
|
|
19
|
-
* Build-time constant indicating whether code is running on the server. This
|
|
20
|
-
* client entry sets it to `false`; the matching server entry (`@solidjs/web`
|
|
21
|
-
* resolved through the `solid` server export condition) sets it to `true`.
|
|
22
|
-
*
|
|
23
|
-
* Bundlers can dead-code-eliminate branches gated on `isServer`, so guarding
|
|
24
|
-
* browser-only code with `if (!isServer) {…}` keeps it out of the SSR bundle
|
|
25
|
-
* entirely.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* import { isServer } from "@solidjs/web";
|
|
30
|
-
*
|
|
31
|
-
* if (!isServer) {
|
|
32
|
-
* // Browser-only: tree-shaken out of the SSR bundle.
|
|
33
|
-
* window.addEventListener("resize", onResize);
|
|
34
|
-
* }
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare const isServer: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Build-time constant indicating whether code is running in a dev build.
|
|
40
|
-
* Replaced statically (`_SOLID_DEV_`) by the bundler integration, so guards
|
|
41
|
-
* like `if (isDev) {…}` are stripped from production builds.
|
|
42
|
-
*
|
|
43
|
-
* Use this to gate dev-only diagnostics, warnings, or expensive invariants
|
|
44
|
-
* that should never ship to production.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```ts
|
|
48
|
-
* import { isDev } from "@solidjs/web";
|
|
49
|
-
*
|
|
50
|
-
* if (isDev) {
|
|
51
|
-
* console.warn("debug-only path");
|
|
52
|
-
* }
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
export declare const isDev: boolean;
|
|
56
|
-
type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
|
|
57
|
-
export type IntrinsicElement = Extract<keyof JSX.IntrinsicElements, string>;
|
|
58
|
-
export type ValidComponent = IntrinsicElement | Component<any> | (string & {});
|
|
59
|
-
export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
|
|
60
|
-
export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
61
|
-
[K in keyof P]: P[K];
|
|
62
|
-
} & {
|
|
63
|
-
component: T | null | undefined | false;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Renders a component tree into a DOM element. Returns a dispose function
|
|
67
|
-
* that tears the tree down and cleans up reactive scopes when called.
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```tsx
|
|
71
|
-
* import { render } from "@solidjs/web";
|
|
72
|
-
*
|
|
73
|
-
* const dispose = render(() => <App />, document.getElementById("root")!);
|
|
74
|
-
*
|
|
75
|
-
* // Later, to unmount:
|
|
76
|
-
* dispose();
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* @remarks
|
|
80
|
-
* The top-level insert is queued via `insertOptions: { schedule: true }` so
|
|
81
|
-
* its initial DOM attach goes through the effect queue rather than executing
|
|
82
|
-
* inline. This lets the mount participate in transitions: if an uncaught
|
|
83
|
-
* async read surfaces during the initial render (no `Loading` ancestor
|
|
84
|
-
* absorbs it), the mount is held by the transition and attaches atomically
|
|
85
|
-
* once all pending settles. On the no-async happy path the tail `flush()`
|
|
86
|
-
* drains the queued callback so the attach is synchronous by the time
|
|
87
|
-
* `render()` returns. The dev enforcement window scopes
|
|
88
|
-
* `ASYNC_OUTSIDE_LOADING_BOUNDARY` to the initial mount only.
|
|
89
|
-
*/
|
|
90
|
-
export declare function render(code: () => JSX.Element, element: MountableElement, init?: unknown, options?: {
|
|
91
|
-
renderId?: string;
|
|
92
|
-
}): () => void;
|
|
93
|
-
/**
|
|
94
|
-
* Resumes a server-rendered tree on the client, attaching event listeners
|
|
95
|
-
* and reactive bindings without reconstructing the DOM. Returns a `dispose`
|
|
96
|
-
* function that tears down reactive scopes (DOM nodes are left in place).
|
|
97
|
-
*
|
|
98
|
-
* Use this when the page HTML was produced by `renderToString`,
|
|
99
|
-
* `renderToStringAsync`, or `renderToStream`. For client-only apps, use
|
|
100
|
-
* `render` instead.
|
|
101
|
-
*
|
|
102
|
-
* Pass `options.renderId` to hydrate one of multiple roots emitted by a
|
|
103
|
-
* server render that used the same id.
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```tsx
|
|
107
|
-
* import { hydrate } from "@solidjs/web";
|
|
108
|
-
*
|
|
109
|
-
* hydrate(() => <App />, document.getElementById("root")!);
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
export declare const hydrate: typeof hydrateCore;
|
|
113
|
-
/**
|
|
114
|
-
* Renders its children into a different part of the DOM (modal roots,
|
|
115
|
-
* tooltips, layers that need to escape an `overflow: hidden` ancestor).
|
|
116
|
-
*
|
|
117
|
-
* If `mount` is omitted, the portal attaches to `document.body`. The portal
|
|
118
|
-
* still participates in the parent's reactive scope and disposes when the
|
|
119
|
-
* parent does.
|
|
120
|
-
*
|
|
121
|
-
* @example
|
|
122
|
-
* ```tsx
|
|
123
|
-
* <Portal mount={document.getElementById("modal-root")!}>
|
|
124
|
-
* <Dialog />
|
|
125
|
-
* </Portal>
|
|
126
|
-
* ```
|
|
127
|
-
*
|
|
128
|
-
* @description https://docs.solidjs.com/reference/components/portal
|
|
129
|
-
*/
|
|
130
|
-
export declare function Portal<T extends boolean = false, S extends boolean = false>(props: {
|
|
131
|
-
mount?: Element;
|
|
132
|
-
children: JSX.Element;
|
|
133
|
-
}): JSX.Element;
|
|
134
|
-
/**
|
|
135
|
-
* Returns a stable `Component` whose identity is driven by a reactive (and
|
|
136
|
-
* optionally async) `source`. The returned component can be used anywhere a
|
|
137
|
-
* normal component is used; children and props flow through JSX as usual.
|
|
138
|
-
*
|
|
139
|
-
* `source` may return a component, a native tag name (`'input'`, `'textarea'`,
|
|
140
|
-
* etc.), `undefined`, or a `Promise` of any of the above. A pending promise
|
|
141
|
-
* propagates as `NotReadyError` through the surrounding reactive scope, so
|
|
142
|
-
* async swaps compose with `<Loading>` boundaries the same way as `lazy`.
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
* ```tsx
|
|
146
|
-
* // `source` can return either a custom Component or a native tag
|
|
147
|
-
* // name — they're interchangeable, and the returned reference is a
|
|
148
|
-
* // stable Component you can use anywhere a normal one would go.
|
|
149
|
-
* const Field = dynamic(() => multiline() ? RichTextEditor : "input");
|
|
150
|
-
* return <Field value={value()} onInput={onInput} />;
|
|
151
|
-
* ```
|
|
152
|
-
*
|
|
153
|
-
* @description https://docs.solidjs.com/reference/components/dynamic
|
|
154
|
-
*/
|
|
155
|
-
export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false): Component<ComponentProps<T>>;
|
|
156
|
-
/**
|
|
157
|
-
* Renders an arbitrary custom or native component and forwards the other
|
|
158
|
-
* props. JSX form of `dynamic()` — same primitive, picked at the JSX site.
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* ```tsx
|
|
162
|
-
* <Dynamic
|
|
163
|
-
* component={multiline() ? RichTextEditor : "input"}
|
|
164
|
-
* value={value()}
|
|
165
|
-
* onInput={onInput}
|
|
166
|
-
* />
|
|
167
|
-
* ```
|
|
168
|
-
*
|
|
169
|
-
* @description https://docs.solidjs.com/reference/components/dynamic
|
|
170
|
-
*/
|
|
171
|
-
export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Renders a component tree synchronously to an HTML string. Async reads inside
|
|
3
|
-
* `<Loading>` boundaries emit their `fallback` content; for full-graph
|
|
4
|
-
* resolution use `renderToStringAsync` instead.
|
|
5
|
-
*
|
|
6
|
-
* Pair the returned HTML with `hydrate()` on the client.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```tsx
|
|
10
|
-
* import { renderToString } from "@solidjs/web";
|
|
11
|
-
*
|
|
12
|
-
* const html = renderToString(() => <App />);
|
|
13
|
-
* res.send(`<!doctype html><html><body><div id="root">${html}</div></body></html>`);
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare function renderToString<T>(fn: () => T, options?: {
|
|
17
|
-
nonce?: string;
|
|
18
|
-
renderId?: string;
|
|
19
|
-
noScripts?: boolean;
|
|
20
|
-
plugins?: any[];
|
|
21
|
-
manifest?: Record<string, {
|
|
22
|
-
file: string;
|
|
23
|
-
css?: string[];
|
|
24
|
-
isEntry?: boolean;
|
|
25
|
-
isDynamicEntry?: boolean;
|
|
26
|
-
imports?: string[];
|
|
27
|
-
}>;
|
|
28
|
-
onError?: (err: any) => void;
|
|
29
|
-
}): string;
|
|
30
|
-
/**
|
|
31
|
-
* Renders a component tree to an HTML string and awaits all async reads in the
|
|
32
|
-
* subtree before resolving. The returned HTML reflects the fully-settled state
|
|
33
|
-
* — no `<Loading>` fallbacks appear in the output.
|
|
34
|
-
*
|
|
35
|
-
* Use this when you want a complete page in one round-trip. For incremental
|
|
36
|
-
* streaming with progressive boundary resolution, use `renderToStream`.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```tsx
|
|
40
|
-
* import { renderToStringAsync } from "@solidjs/web";
|
|
41
|
-
*
|
|
42
|
-
* const html = await renderToStringAsync(() => <App />);
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export declare function renderToStringAsync<T>(fn: () => T, options?: {
|
|
46
|
-
timeoutMs?: number;
|
|
47
|
-
nonce?: string;
|
|
48
|
-
renderId?: string;
|
|
49
|
-
noScripts?: boolean;
|
|
50
|
-
plugins?: any[];
|
|
51
|
-
manifest?: Record<string, {
|
|
52
|
-
file: string;
|
|
53
|
-
css?: string[];
|
|
54
|
-
isEntry?: boolean;
|
|
55
|
-
isDynamicEntry?: boolean;
|
|
56
|
-
imports?: string[];
|
|
57
|
-
}>;
|
|
58
|
-
onError?: (err: any) => void;
|
|
59
|
-
}): Promise<string>;
|
|
60
|
-
/**
|
|
61
|
-
* Streams an HTML response, flushing the synchronous shell first and then
|
|
62
|
-
* progressively emitting async-resolved fragments as their `<Loading>`
|
|
63
|
-
* boundaries settle. Good for time-to-first-byte sensitive pages.
|
|
64
|
-
*
|
|
65
|
-
* Returns an object with `pipe`/`pipeTo` for piping to a Node `Writable` or
|
|
66
|
-
* a Web `WritableStream`, plus a `then` for awaiting full completion.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```tsx
|
|
70
|
-
* import { renderToStream } from "@solidjs/web";
|
|
71
|
-
*
|
|
72
|
-
* // Node:
|
|
73
|
-
* renderToStream(() => <App />).pipe(res);
|
|
74
|
-
*
|
|
75
|
-
* // Web (Workers / Deno):
|
|
76
|
-
* await renderToStream(() => <App />).pipeTo(stream.writable);
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
export declare function renderToStream<T>(fn: () => T, options?: {
|
|
80
|
-
nonce?: string;
|
|
81
|
-
renderId?: string;
|
|
82
|
-
noScripts?: boolean;
|
|
83
|
-
plugins?: any[];
|
|
84
|
-
manifest?: Record<string, {
|
|
85
|
-
file: string;
|
|
86
|
-
css?: string[];
|
|
87
|
-
isEntry?: boolean;
|
|
88
|
-
isDynamicEntry?: boolean;
|
|
89
|
-
imports?: string[];
|
|
90
|
-
}>;
|
|
91
|
-
onCompleteShell?: (info: {
|
|
92
|
-
write: (v: string) => void;
|
|
93
|
-
}) => void;
|
|
94
|
-
onCompleteAll?: (info: {
|
|
95
|
-
write: (v: string) => void;
|
|
96
|
-
}) => void;
|
|
97
|
-
onError?: (err: any) => void;
|
|
98
|
-
}): {
|
|
99
|
-
then: (fn: (html: string) => void) => void;
|
|
100
|
-
pipe: (writable: {
|
|
101
|
-
write: (v: string) => void;
|
|
102
|
-
end: () => void;
|
|
103
|
-
}) => void;
|
|
104
|
-
pipeTo: (writable: WritableStream) => Promise<void>;
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Compiler primitive — emitted by JSX-DOM-Expressions for tagged-template
|
|
108
|
-
* SSR output. Not meant for hand-written code.
|
|
109
|
-
* @internal
|
|
110
|
-
*/
|
|
111
|
-
export declare function ssr(template: string[] | string, ...nodes: any[]): {
|
|
112
|
-
t: string;
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Compiler primitive — emitted by JSX-DOM-Expressions for SSR element
|
|
116
|
-
* output. Not meant for hand-written code.
|
|
117
|
-
* @internal
|
|
118
|
-
*/
|
|
119
|
-
export declare function ssrElement(name: string, props: any, children: any, needsId: boolean): {
|
|
120
|
-
t: string;
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Compiler primitive — serializes a classList object for SSR output. Not
|
|
124
|
-
* meant for hand-written code.
|
|
125
|
-
* @internal
|
|
126
|
-
*/
|
|
127
|
-
export declare function ssrClassList(value: {
|
|
128
|
-
[k: string]: boolean;
|
|
129
|
-
}): string;
|
|
130
|
-
/**
|
|
131
|
-
* Compiler primitive — serializes a style object for SSR output. Not meant
|
|
132
|
-
* for hand-written code.
|
|
133
|
-
* @internal
|
|
134
|
-
*/
|
|
135
|
-
export declare function ssrStyle(value: {
|
|
136
|
-
[k: string]: string;
|
|
137
|
-
}): string;
|
|
138
|
-
/**
|
|
139
|
-
* Compiler primitive — serializes a boolean attribute for SSR output. Not
|
|
140
|
-
* meant for hand-written code.
|
|
141
|
-
* @internal
|
|
142
|
-
*/
|
|
143
|
-
export declare function ssrAttribute(key: string, value: boolean): string;
|
|
144
|
-
/**
|
|
145
|
-
* Compiler primitive — generates the hydration-key attribute for SSR
|
|
146
|
-
* output. Not meant for hand-written code.
|
|
147
|
-
* @internal
|
|
148
|
-
*/
|
|
149
|
-
export declare function ssrHydrationKey(): string;
|
|
150
|
-
/**
|
|
151
|
-
* Compiler primitive — collapses an SSR-shaped node into its HTML string.
|
|
152
|
-
* Not meant for hand-written code.
|
|
153
|
-
* @internal
|
|
154
|
-
*/
|
|
155
|
-
export declare function resolveSSRNode(node: any): string;
|
|
156
|
-
/**
|
|
157
|
-
* Escapes a string for safe inclusion in HTML output. Used by the SSR
|
|
158
|
-
* runtime; not generally part of user code.
|
|
159
|
-
* @internal
|
|
160
|
-
*/
|
|
161
|
-
export declare function escape(html: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@dom-expressions/runtime/src/client.js";
|