@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.
Files changed (42) hide show
  1. package/dist/dev.cjs +138 -48
  2. package/dist/dev.js +134 -50
  3. package/dist/server.cjs +108 -23
  4. package/dist/server.js +105 -25
  5. package/dist/web.cjs +138 -48
  6. package/dist/web.js +134 -50
  7. package/package.json +100 -11
  8. package/serialization/dist/serialization.cjs +83 -0
  9. package/serialization/dist/serialization.js +75 -0
  10. package/serialization/package.json +20 -0
  11. package/serialization/types/index.d.ts +139 -0
  12. package/serialization/types-cjs/index.d.cts +139 -0
  13. package/serialization/types-cjs/package.json +3 -0
  14. package/server-functions/dist/client.cjs +370 -0
  15. package/server-functions/dist/client.js +363 -0
  16. package/server-functions/dist/server.cjs +542 -0
  17. package/server-functions/dist/server.js +531 -0
  18. package/server-functions/package.json +30 -0
  19. package/storage/types/index.d.ts +28 -0
  20. package/storage/types-cjs/index.d.cts +28 -0
  21. package/types/index.d.ts +8 -1
  22. package/types/response.d.ts +93 -0
  23. package/types/serializer.d.ts +139 -0
  24. package/types/server-functions/client.d.ts +63 -0
  25. package/types/server-functions/server.d.ts +188 -0
  26. package/types/server-functions/shared.d.ts +171 -0
  27. package/types/server.d.ts +70 -15
  28. package/types-cjs/index.d.cts +8 -1
  29. package/types-cjs/response.d.cts +93 -0
  30. package/types-cjs/serializer.d.cts +139 -0
  31. package/types-cjs/server-functions/client.d.cts +63 -0
  32. package/types-cjs/server-functions/server.d.cts +188 -0
  33. package/types-cjs/server-functions/shared.d.cts +171 -0
  34. package/types-cjs/server.d.cts +70 -15
  35. package/storage/types/src/client.d.ts +0 -1
  36. package/storage/types/src/index.d.ts +0 -171
  37. package/storage/types/src/server-mock.d.ts +0 -161
  38. package/storage/types/storage/src/index.d.ts +0 -2
  39. package/storage/types-cjs/src/client.d.cts +0 -1
  40. package/storage/types-cjs/src/index.d.cts +0 -171
  41. package/storage/types-cjs/src/server-mock.d.cts +0 -161
  42. package/storage/types-cjs/storage/src/index.d.cts +0 -2
@@ -1,171 +0,0 @@
1
- import { hydrate as hydrateCore } from "./client.cjs";
2
- import { Component } from "solid-js";
3
- import type { JSX } from "./jsx.cjs";
4
- export * from "./client.cjs";
5
- export * from "./server-mock.cjs";
6
- export type { JSX } from "./jsx.cjs";
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,2 +0,0 @@
1
- import type { RequestEvent } from "@solidjs/web";
2
- export declare function provideRequestEvent<T extends RequestEvent, U>(init: T, cb: () => U): U;