@solidjs/web 2.0.0-beta.0 → 2.0.0-beta.10

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.
@@ -0,0 +1,171 @@
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;
@@ -0,0 +1,29 @@
1
+ import type { ArrayElement as SolidArrayElement, Element as SolidElement } from "solid-js";
2
+ import type { JSX as DOMJSX } from "dom-expressions/src/jsx.js";
3
+ export declare namespace JSX {
4
+ type WithSolidChildren<T> = Omit<T, "children"> & {
5
+ children?: Element;
6
+ };
7
+ export type Element = SolidElement;
8
+ export interface ArrayElement extends SolidArrayElement {
9
+ }
10
+ export interface ElementClass extends DOMJSX.ElementClass {
11
+ }
12
+ export interface ElementAttributesProperty extends DOMJSX.ElementAttributesProperty {
13
+ }
14
+ export interface ElementChildrenAttribute extends DOMJSX.ElementChildrenAttribute {
15
+ }
16
+ export interface IntrinsicAttributes extends DOMJSX.IntrinsicAttributes {
17
+ }
18
+ export type IntrinsicElements = {
19
+ [K in keyof DOMJSX.IntrinsicElements]: WithSolidChildren<DOMJSX.IntrinsicElements[K]>;
20
+ };
21
+ export type HTMLAttributes<T> = WithSolidChildren<DOMJSX.HTMLAttributes<T>>;
22
+ export type SVGAttributes<T> = WithSolidChildren<DOMJSX.SVGAttributes<T>>;
23
+ export type MathMLAttributes<T> = WithSolidChildren<DOMJSX.MathMLAttributes<T>>;
24
+ export interface CustomEvents extends DOMJSX.CustomEvents {
25
+ }
26
+ export type EventHandler<T, E extends Event> = DOMJSX.EventHandler<T, E>;
27
+ export type EventHandlerUnion<T, E extends Event> = DOMJSX.EventHandlerUnion<T, E>;
28
+ export {};
29
+ }
@@ -0,0 +1,161 @@
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;
@@ -0,0 +1,2 @@
1
+ import type { RequestEvent } from "@solidjs/web";
2
+ export declare function provideRequestEvent<T extends RequestEvent, U>(init: T, cb: () => U): U;
package/types/client.d.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  import { JSX } from "./jsx.js";
2
- export const Properties: Set<string>;
2
+ export const DOMWithState: Record<string, Record<string, 1 | 2>>;
3
3
  export const ChildProperties: Set<string>;
4
4
  export const DelegatedEvents: Set<string>;
5
5
  export const DOMElements: Set<string>;
6
6
  export const SVGElements: Set<string>;
7
- export const SVGNamespace: Record<string, 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>;
8
11
 
9
12
  type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
10
13
  export function render(
@@ -13,8 +16,14 @@ export function render(
13
16
  init?: JSX.Element,
14
17
  options?: { owner?: unknown }
15
18
  ): () => void;
16
- export function template(html: string, isImportNode?: boolean, isSVG?: boolean, isMathML?: boolean): () => Element;
17
- export function effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void, init?: T): 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 effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void): void;
18
27
  export function memo<T>(fn: () => T, equal: boolean): () => T;
19
28
  export function untrack<T>(fn: () => T): T;
20
29
  export function insert<T>(
@@ -26,16 +35,10 @@ export function insert<T>(
26
35
  export function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
27
36
  export function delegateEvents(eventNames: string[], d?: Document): void;
28
37
  export function clearDelegatedEvents(d?: Document): void;
29
- export function spread<T>(
30
- node: Element,
31
- accessor: T,
32
- isSVG?: Boolean,
33
- skipChildren?: Boolean
34
- ): void;
38
+ export function spread<T>(node: Element, accessor: T, skipChildren?: Boolean): void;
35
39
  export function assign(
36
40
  node: Element,
37
41
  props: any,
38
- isSVG?: Boolean,
39
42
  skipChildren?: Boolean,
40
43
  prevProps?: any,
41
44
  skipRef?: Boolean
@@ -45,7 +48,11 @@ export function setAttributeNS(node: Element, namespace: string, name: string, v
45
48
  type ClassList =
46
49
  | Record<string, boolean>
47
50
  | Array<string | number | boolean | null | undefined | Record<string, boolean>>;
48
- export function className(node: Element, value: string | ClassList, isSvg?: boolean, prev?: string | ClassList): void;
51
+ export function className(
52
+ node: Element,
53
+ value: string | ClassList,
54
+ prev?: string | ClassList
55
+ ): void;
49
56
  export function setProperty(node: Element, name: string, value: any): void;
50
57
  export function setStyleProperty(node: Element, name: string, value: any): void;
51
58
  export function addEventListener(
@@ -62,8 +69,14 @@ export function style(
62
69
  export function getOwner(): unknown;
63
70
  export function mergeProps(...sources: unknown[]): unknown;
64
71
  export function dynamicProperty(props: unknown, key: string): unknown;
65
- export function applyRef(r: ((element: Element) => void) | ((element: Element) => void)[], element: Element): void;
66
- export function ref(fn: () => ((element: Element) => void) | ((element: Element) => void)[], element: Element): void;
72
+ export function applyRef(
73
+ r: ((element: Element) => void) | ((element: Element) => void)[],
74
+ element: Element
75
+ ): void;
76
+ export function ref(
77
+ fn: () => ((element: Element) => void) | ((element: Element) => void)[],
78
+ element: Element
79
+ ): void;
67
80
 
68
81
  export function hydrate(
69
82
  fn: () => JSX.Element,
@@ -77,10 +90,11 @@ export function getNextMarker(start: Node): [Node, Array<Node>];
77
90
  export function useAssets(fn: () => JSX.Element): void;
78
91
  export function getAssets(): string;
79
92
  export function HydrationScript(props?: { nonce?: string; eventNames?: string[] }): JSX.Element;
80
- export function generateHydrationScript(options?: { nonce?: string; eventNames?: string[] }): string;
93
+ export function generateHydrationScript(options?: {
94
+ nonce?: string;
95
+ eventNames?: string[];
96
+ }): string;
81
97
  export function Assets(props: { children?: JSX.Element }): JSX.Element;
82
- export function Hydration(props: { children?: JSX.Element }): JSX.Element;
83
- export function NoHydration(props: { children?: JSX.Element }): JSX.Element;
84
98
  export interface RequestEvent {
85
99
  request: Request;
86
100
  locals: Record<string | number | symbol, any>;
package/types/core.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { getOwner, runWithOwner, createComponent, createRoot as root, sharedConfig, untrack, merge as mergeProps, flatten, ssrHandleError, ssrRunInScope } from "solid-js";
2
- export declare const effect: (fn: any, effectFn: any, initial: any) => void;
2
+ export declare const effect: (fn: any, effectFn: any, options: any) => void;
3
3
  export declare const memo: (fn: any) => import("solid-js").Accessor<any>;
package/types/index.d.ts CHANGED
@@ -1,45 +1,171 @@
1
1
  import { hydrate as hydrateCore } from "./client.js";
2
- import { JSX, ComponentProps, ValidComponent } from "solid-js";
2
+ import { Component } from "solid-js";
3
+ import type { JSX } from "./jsx.js";
3
4
  export * from "./client.js";
4
- export { For, Show, Switch, Match, Errored, Loading, merge as mergeProps } from "solid-js";
5
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
+ */
6
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
+ */
7
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
+ */
8
112
  export declare const hydrate: typeof hydrateCore;
9
113
  /**
10
- * Renders components somewhere else in the DOM
114
+ * Renders its children into a different part of the DOM (modal roots,
115
+ * tooltips, layers that need to escape an `overflow: hidden` ancestor).
11
116
  *
12
- * Useful for inserting modals and tooltips outside of an cropping layout. If no mount point is given, the portal is inserted in document.body; it is wrapped in a `<div>` unless the target is document.head or `isSVG` is true. setting `useShadow` to true places the element in a shadow root to isolate styles.
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
+ * ```
13
127
  *
14
128
  * @description https://docs.solidjs.com/reference/components/portal
15
129
  */
16
130
  export declare function Portal<T extends boolean = false, S extends boolean = false>(props: {
17
131
  mount?: Element;
18
132
  children: JSX.Element;
19
- }): Text;
20
- export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
21
- [K in keyof P]: P[K];
22
- } & {
23
- component: T | undefined;
24
- };
133
+ }): JSX.Element;
25
134
  /**
26
- * Renders an arbitrary component or element with the given props
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`.
27
143
  *
28
- * This is a lower level version of the `Dynamic` component, useful for
29
- * performance optimizations in libraries. Do not use this unless you know
30
- * what you are doing.
31
- * ```typescript
32
- * const element = () => multiline() ? 'textarea' : 'input';
33
- * createDynamic(element, { value: value() });
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} />;
34
151
  * ```
152
+ *
35
153
  * @description https://docs.solidjs.com/reference/components/dynamic
36
154
  */
37
- export declare function createDynamic<T extends ValidComponent>(component: () => T | undefined, props: ComponentProps<T>): JSX.Element;
155
+ export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false): Component<ComponentProps<T>>;
38
156
  /**
39
- * Renders an arbitrary custom or native component and passes the other props
40
- * ```typescript
41
- * <Dynamic component={multiline() ? 'textarea' : 'input'} value={value()} />
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
+ * />
42
167
  * ```
168
+ *
43
169
  * @description https://docs.solidjs.com/reference/components/dynamic
44
170
  */
45
171
  export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;