@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.21

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 (124) hide show
  1. package/README.md +1 -1
  2. package/dist/server.dev.js +5165 -0
  3. package/dist/server.js +1876 -374
  4. package/dist/{server.cjs → server.observe.js} +2070 -577
  5. package/dist/{dev.cjs → web.dev.js} +955 -567
  6. package/dist/web.js +646 -350
  7. package/dist/{dev.js → web.observe.js} +699 -421
  8. package/frames/dist/assets.js +92 -0
  9. package/frames/dist/client.dev.js +1296 -1198
  10. package/frames/dist/client.js +1128 -1191
  11. package/frames/dist/client.observe.js +2041 -0
  12. package/frames/dist/regions.js +171 -0
  13. package/frames/dist/server.dev.js +2545 -0
  14. package/frames/dist/server.js +1683 -3004
  15. package/frames/dist/server.observe.js +2544 -0
  16. package/frames/dist/trace.js +45 -0
  17. package/frames/dist/wire.js +594 -0
  18. package/frames/package.json +2 -25
  19. package/package.json +244 -256
  20. package/performance-tracks/dist/performance-tracks.dev.js +679 -0
  21. package/performance-tracks/dist/performance-tracks.js +6 -0
  22. package/performance-tracks/dist/performance-tracks.observe.js +667 -0
  23. package/performance-tracks/package.json +7 -0
  24. package/performance-tracks/types/index.d.ts +69 -0
  25. package/serialization/decode/package.json +2 -15
  26. package/serialization/dist/decode.js +121 -25
  27. package/serialization/dist/serialization.js +282 -88
  28. package/serialization/package.json +2 -15
  29. package/serialization/types/index.d.ts +115 -153
  30. package/serialization/types/serializer-decode.d.ts +173 -114
  31. package/serialization/types/serializer.d.ts +144 -0
  32. package/server-functions/dist/client.dev.js +1462 -0
  33. package/server-functions/dist/client.js +667 -165
  34. package/server-functions/dist/client.observe.js +1441 -0
  35. package/server-functions/dist/rich-args.js +102 -1
  36. package/server-functions/dist/server.dev.js +2802 -299
  37. package/server-functions/dist/server.js +2724 -314
  38. package/server-functions/dist/server.observe.js +3680 -0
  39. package/server-functions/package.json +2 -35
  40. package/server-functions/rich-args/package.json +2 -15
  41. package/skills/server-components/SKILL.md +117 -0
  42. package/storage/package.json +2 -15
  43. package/types/client.d.ts +342 -288
  44. package/types/constants.d.ts +22 -0
  45. package/types/cookies.d.ts +32 -84
  46. package/types/diagnostics.d.ts +80 -0
  47. package/types/frames/assets-tier.d.ts +78 -0
  48. package/types/frames/client.d.ts +40 -1
  49. package/types/frames/frame-client.d.ts +443 -280
  50. package/types/frames/frame-container-plugin.d.ts +64 -0
  51. package/types/frames/frame-morph.d.ts +29 -0
  52. package/types/frames/frame-sink.d.ts +141 -161
  53. package/types/frames/frame-transport.d.ts +263 -184
  54. package/types/frames/regions-tier.d.ts +60 -0
  55. package/types/frames/serializer-decode.d.ts +241 -0
  56. package/types/frames/serializer.d.ts +115 -153
  57. package/types/frames/server.d.ts +2 -2
  58. package/types/frames/trace-tier.d.ts +2 -0
  59. package/types/frames/tree-rewrite.d.ts +39 -0
  60. package/types/frames/wire-tier.d.ts +169 -0
  61. package/types/head.d.ts +20 -0
  62. package/types/index.d.ts +98 -81
  63. package/types/index.server.d.ts +159 -0
  64. package/types/jsx.d.ts +49 -44
  65. package/types/observe.d.ts +535 -0
  66. package/types/reconcile.d.ts +1 -0
  67. package/types/render.d.ts +11 -0
  68. package/types/request-error-hook.d.ts +5 -0
  69. package/types/response.d.ts +95 -147
  70. package/types/serializer-decode.d.ts +173 -114
  71. package/types/serializer.d.ts +115 -153
  72. package/types/server-functions/argument-codec.d.ts +30 -0
  73. package/types/server-functions/client.d.ts +237 -223
  74. package/types/server-functions/flash.d.ts +28 -30
  75. package/types/server-functions/registry.d.ts +105 -0
  76. package/types/server-functions/rich-args.d.ts +1 -10
  77. package/types/server-functions/server.d.ts +538 -531
  78. package/types/server-functions/shared.d.ts +398 -425
  79. package/types/server-functions/uploads.d.ts +53 -0
  80. package/types/server-mock.d.ts +154 -20
  81. package/types/server-observe.d.ts +86 -0
  82. package/types/server.d.ts +601 -422
  83. package/types/trace.d.ts +127 -0
  84. package/LICENSE +0 -21
  85. package/dist/web.cjs +0 -2033
  86. package/frames/dist/client.cjs +0 -2002
  87. package/frames/dist/client.dev.cjs +0 -2022
  88. package/frames/dist/server.cjs +0 -3877
  89. package/serialization/dist/decode.cjs +0 -139
  90. package/serialization/dist/serialization.cjs +0 -261
  91. package/serialization/types-cjs/index.d.cts +0 -182
  92. package/serialization/types-cjs/package.json +0 -3
  93. package/serialization/types-cjs/serializer-decode.d.cts +0 -182
  94. package/server-functions/dist/client.cjs +0 -834
  95. package/server-functions/dist/rich-args.cjs +0 -11
  96. package/server-functions/dist/server.cjs +0 -1242
  97. package/server-functions/dist/server.dev.cjs +0 -1242
  98. package/storage/dist/storage.cjs +0 -12
  99. package/storage/types-cjs/index.d.cts +0 -28
  100. package/storage/types-cjs/package.json +0 -3
  101. package/types/core.d.ts +0 -9
  102. package/types-cjs/client.d.cts +0 -337
  103. package/types-cjs/cookies.d.cts +0 -93
  104. package/types-cjs/core.d.cts +0 -9
  105. package/types-cjs/frames/client.d.cts +0 -36
  106. package/types-cjs/frames/frame-client.d.cts +0 -356
  107. package/types-cjs/frames/frame-sink.d.cts +0 -194
  108. package/types-cjs/frames/frame-transport.d.cts +0 -222
  109. package/types-cjs/frames/serializer.d.cts +0 -182
  110. package/types-cjs/frames/server.d.cts +0 -52
  111. package/types-cjs/index.d.cts +0 -244
  112. package/types-cjs/jsx-properties.d.cts +0 -93
  113. package/types-cjs/jsx.d.cts +0 -4159
  114. package/types-cjs/package.json +0 -3
  115. package/types-cjs/response.d.cts +0 -174
  116. package/types-cjs/serializer-decode.d.cts +0 -182
  117. package/types-cjs/serializer.d.cts +0 -182
  118. package/types-cjs/server-functions/client.d.cts +0 -262
  119. package/types-cjs/server-functions/flash.d.cts +0 -38
  120. package/types-cjs/server-functions/rich-args.d.cts +0 -10
  121. package/types-cjs/server-functions/server.d.cts +0 -681
  122. package/types-cjs/server-functions/shared.d.cts +0 -523
  123. package/types-cjs/server-mock.d.cts +0 -286
  124. package/types-cjs/server.d.cts +0 -544
@@ -0,0 +1,169 @@
1
+ import type { FrameHost, FrameHostOptions } from "./frame-client.js";
2
+ /**
3
+ * A frame's mount as the live appliers reach it (the frame's `#live`):
4
+ * `e` its element, `t` its live-target cache, `c` its claim, `k` its slot
5
+ * index builder, `s` what each hole's range shows, `x` the give-up for a row-op record (mark it spent,
6
+ * cancel the connection so the resume re-sends the hole whole); `w`, in
7
+ * dev builds only, the diagnostic for a hole whose closing comment is gone
8
+ * (this chunk is built once for every condition, so the gate is the eager
9
+ * client's).
10
+ */
11
+ interface LiveMount {
12
+ e: Element;
13
+ t: Map<string, Node>;
14
+ c: unknown;
15
+ k(found: Map<string, any>): void;
16
+ s(): Record<string, string>;
17
+ x(key: string, record: unknown): void;
18
+ w?: false | ((marker: string, open: Node) => void);
19
+ }
20
+ /**
21
+ * The host the handler hands over: the frame host, carrying the lazily
22
+ * loaded deserializer's load (`prepareData`) the transport awaits before a
23
+ * chunk that reads data — forwarded unchanged to the connection's proxy.
24
+ */
25
+ type Host = FrameHost & Pick<FrameHostOptions, "prepareData">;
26
+ /** A live loop's wire slot (see `LIVE_WIRE` in server-functions/shared.ts). */
27
+ interface WireSlot {
28
+ connection: Connection;
29
+ open(body: ReadableStream<Uint8Array> | null): {
30
+ next(): Promise<IteratorResult<string>>;
31
+ cancel?(reason?: unknown): unknown;
32
+ };
33
+ }
34
+ /** The connection slot the loop renews per connect (`wire.connection`). */
35
+ interface Connection {
36
+ ended?: Promise<ConnectionEnd>;
37
+ cancel?(reason: Error): void;
38
+ done?: boolean;
39
+ }
40
+ /** How a connection ended, as the loop reads it off `connection.ended`. */
41
+ interface ConnectionEnd {
42
+ open: number;
43
+ error: Error;
44
+ sweep(): void;
45
+ close(): void;
46
+ }
47
+ /**
48
+ * Ledger upkeep for an applied content record (the frame's `#recordHave`
49
+ * hands every one here): `""` is the root and RESETS the ledger to the
50
+ * root's digest and hole map; any other key takes the record's digest and
51
+ * the map of holes inside it. A record without a digest (an older
52
+ * producer) leaves the entry as it was. Without a ledger (no digest-
53
+ * carrying root applied) there is nothing to keep — the next resume is a
54
+ * full snapshot either way.
55
+ * @internal
56
+ */
57
+ export declare function have(frame: object, key: string, record: {
58
+ digest?: string;
59
+ holes?: Record<string, string>;
60
+ }): void;
61
+ /**
62
+ * The have-list of what a mount shows — the server-minted digests of the
63
+ * root skeleton under `""`, each live hole and attr hole by ledger key,
64
+ * each revealed fragment by name. `undefined` when the content's provenance
65
+ * carried no digests, or applied before this tier was resident (a
66
+ * document-adopted interior, a plain call's response): a resume then takes
67
+ * the full snapshot.
68
+ * @internal
69
+ */
70
+ export declare function haveOf(frame: object): Record<string, string> | undefined;
71
+ /**
72
+ * Encodes a have-list for the header: `key=digest` pairs, comma-joined
73
+ * (keys never contain either separator; the root's key is empty).
74
+ * `undefined` when the list is empty or over budget.
75
+ * @internal
76
+ */
77
+ export declare function encodeHaveList(have: Record<string, string>): string | undefined;
78
+ /**
79
+ * What a `live` (re)connect of a call resumes from (the handler's
80
+ * `resume`): the address's version ordinal as the position and, when a
81
+ * mount shows the address with a ledger, its have-list under
82
+ * `FRAME_HAVE_HEADER` — omitted over budget, so the render is a full
83
+ * snapshot then. `undefined` when nothing here has shown the call. The
84
+ * ledger is the MOUNT's (it tracks what the DOM shows); the first mount
85
+ * under the address speaks for all — they show the same store.
86
+ * @internal
87
+ */
88
+ export declare function resume(host: FrameHost, info: {
89
+ id: string;
90
+ args: unknown[];
91
+ }, versions: Map<string, number>): {
92
+ position: string;
93
+ headers?: Record<string, string>;
94
+ } | undefined;
95
+ /**
96
+ * Supersession (§9.5, Client face 4): a newer version for the address from
97
+ * another response — a getter refetch, a preload, a mutation's region —
98
+ * makes the open connection's later chunks inert under the stale-guard, so
99
+ * it is cancelled and the loop reconnects from the death. The handler's
100
+ * `bump` calls this for every bump, the loop's own reconnect included
101
+ * (whose predecessor has already ended and left the slot).
102
+ * @internal
103
+ */
104
+ export declare function cancel(host: object, address: string): void;
105
+ /**
106
+ * The live arm of the handler's `handle` (§9.5, Client face 2): the binding
107
+ * resolves the call now, and the response's lifetime — its end and how it
108
+ * ended — reaches the loop through its wire slot, so frames CONSUME the
109
+ * loop rather than mirror it: death → the loop's backoff and re-invoke,
110
+ * which resolves this same binding again (stable per address, so an
111
+ * equals-gated reader keeps its instance); completion → the loop
112
+ * completes.
113
+ *
114
+ * A live connection already streaming this address is JOINED: this
115
+ * response is ended here (the server tears its render down on the
116
+ * cancel) and the joining loop sees the shared connection's death when it
117
+ * comes, reconnecting like the loop that owns it (one of the two wins the
118
+ * next slot; the other joins again). Otherwise the response OPENS the
119
+ * address's connection: `bump` versions it and `begin` moves the store to
120
+ * the version at the header; the body is read through the loop's reader
121
+ * when it is framed as an event stream (`ChunkReader` otherwise), handed to
122
+ * the transport under the wire slot; and the end is judged HERE by what the
123
+ * body left open — `complete` is the bounded signal, an unkeyed `error` the
124
+ * failing kind of it; a body that ends with any still open is a DEATH, never
125
+ * a completion (§9.5, Wire) — and told to the loop with the sweep it may run
126
+ * over the open frames if the iteration ends for good by error (`close`
127
+ * leaves them as they stand: a superseding reconnect re-renders them). The
128
+ * transport's own end-of-body sweep (an error record per open frame, the
129
+ * no-loop verdict) is swallowed: the loop decides. A rejected read is a
130
+ * death the loop already sees, not an error record.
131
+ * @internal
132
+ */
133
+ export declare function connect(response: Response, wire: WireSlot, address: string, binding: unknown, host: Host, bump: (address: string) => number, begin: (address: string, version: number) => void): unknown;
134
+ /**
135
+ * Morph a live hole's marked range (`<!--lh:N-->…<!--lh:/N-->`, marker =
136
+ * `lh:N`) to its re-emitted html — the client half of the Stage 3 hole
137
+ * ledger. The same range-anchored reconcile as the root morph, so
138
+ * interior element identity (focus, media, third-party widget state)
139
+ * survives value ticks. A hole's content may hold slot ranges: the morph
140
+ * then resolves them against the frame's displaced-range index (`index`,
141
+ * one per flush pass: `r` the slot ranges by occurrence, `g` the subtrees
142
+ * the morphs inserted whole), as the root's does, so an occurrence the new
143
+ * content still has keeps its range — interior and mounted state —
144
+ * wherever it moved; the sync after the pass mounts the new ones and
145
+ * unmounts the ones gone. Returns whether the markers were found and the
146
+ * morph ran.
147
+ * @internal
148
+ */
149
+ export declare function hole(f: LiveMount, marker: string, record: any, index: {
150
+ r?: Map<string, any>;
151
+ g?: Node[];
152
+ }): boolean;
153
+ /**
154
+ * Apply a live attr-hole re-emission: find the element addressed
155
+ * `data-lha="addr"` in the frame's range, parse the rebuilt attribute
156
+ * text through a scratch element (native entity decoding), and patch the
157
+ * element to match it the way the root morph matches server output
158
+ * (`morphAttributes`): set what's present, remove what is not — the text
159
+ * is the tag's WHOLE attribute area, so a name absent from it has
160
+ * vanished on the server, whether or not the emission names it in
161
+ * `removed` (a resume's re-emission cannot: the server holds the client's
162
+ * previous text only as a digest). The address itself and a
163
+ * `<details>`/`<dialog>` `open` are the morph's exceptions here too.
164
+ * Returns false when the element isn't in the DOM yet (pending; later
165
+ * flushes retry).
166
+ * @internal
167
+ */
168
+ export declare function attrs(f: LiveMount, addr: string, record: any): boolean;
169
+ export { graft, morph } from "./frame-morph.js";
@@ -0,0 +1,20 @@
1
+ export declare const HEAD_ELIGIBLE_TAGS: Set<string>;
2
+ export declare const HEAD_ATTR_NAME: RegExp;
3
+ export declare const RESOURCE_LINK_RELS: Set<string>;
4
+ export declare const RESOURCE_QUALIFIERS: string[];
5
+ export declare const STYLESHEET_FETCH_META: Set<string>;
6
+ export declare function evalHeadValue(v: any): any;
7
+ export declare function evalHeadProps(props: any, presets: any): {};
8
+ export declare function classifyHeadTag(desc: any): {
9
+ resource: boolean;
10
+ rel: any;
11
+ } | {
12
+ resource: boolean;
13
+ rel?: undefined;
14
+ };
15
+ export declare function qualifierValue(name: any, value: any): any;
16
+ export declare function asciiLowerCase(value: any): any;
17
+ export declare function headBodyText(tag: any, props: any, text: any): any;
18
+ export declare function resourceIdentity(tag: any, props: any): string;
19
+ export declare function replaceableIdentity(tag: any, props: any, key: any, unique: any): any;
20
+ export declare function resolveHead(groups: any): Map<any, any>;
package/types/index.d.ts CHANGED
@@ -1,21 +1,10 @@
1
- import { hydrate as hydrateCore } from "./client.js";
2
- import { Component } from "solid-js";
1
+ import { Component, type DynamicOptions } from "solid-js";
3
2
  import type { JSX } from "./jsx.js";
4
3
  export * from "./client.js";
5
4
  export * from "./server-mock.js";
6
5
  export * from "./response.js";
7
6
  export type { JSX } from "./jsx.js";
8
7
  export { For, Show, Switch, Match, Errored, Loading, Repeat, Reveal, NoHydration, Hydration } from "solid-js";
9
- import { merge } from "solid-js";
10
- /**
11
- * Compiler-emitted prop-spread helper. The JSX transform (in
12
- * `dom-expressions`) emits `mergeProps(...)` calls when compiling prop
13
- * spreads on components — it is *not* a user-facing API. Application code
14
- * should import `merge` from `solid-js` directly.
15
- *
16
- * @internal
17
- */
18
- export declare const mergeProps: typeof merge;
19
8
  /**
20
9
  * Build-time constant indicating whether code is running on the server. This
21
10
  * client entry sets it to `false`; the matching server entry (`@solidjs/web`
@@ -54,68 +43,15 @@ export declare const isServer: boolean;
54
43
  * ```
55
44
  */
56
45
  export declare const isDev: boolean;
57
- type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
58
46
  export type IntrinsicElement = Extract<keyof JSX.IntrinsicElements, string>;
59
47
  export type ValidComponent = IntrinsicElement | Component<any> | (string & {});
60
48
  export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
49
+ /** @deprecated Props of the deprecated `<Dynamic>`; see `dynamic()`. */
61
50
  export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
62
51
  [K in keyof P]: P[K];
63
52
  } & {
64
53
  component: T | null | undefined | false;
65
54
  };
66
- /**
67
- * Renders a component tree into a DOM element. Returns a dispose function
68
- * that tears the tree down and cleans up reactive scopes when called.
69
- *
70
- * @example
71
- * ```tsx
72
- * import { render } from "@solidjs/web";
73
- *
74
- * const dispose = render(() => <App />, document.getElementById("root")!);
75
- *
76
- * // Later, to unmount:
77
- * dispose();
78
- * ```
79
- *
80
- * @remarks
81
- * The top-level insert is queued via `insertOptions: { schedule: true }` so
82
- * its initial DOM attach goes through the effect queue rather than executing
83
- * inline. This lets the mount participate in transitions: if an uncaught
84
- * async read surfaces during the initial render (no `Loading` ancestor
85
- * absorbs it), the mount is held by the transition and attaches atomically
86
- * once all pending settles. On the no-async happy path the tail `flush()`
87
- * drains the queued callback so the attach is synchronous by the time
88
- * `render()` returns. The dev enforcement window scopes
89
- * `ASYNC_OUTSIDE_LOADING_BOUNDARY` to the initial mount only.
90
- */
91
- export declare function render(code: () => JSX.Element, element: MountableElement, init?: unknown, options?: {
92
- renderId?: string;
93
- }): () => void;
94
- /**
95
- * Resumes a server-rendered tree on the client, attaching event listeners
96
- * and reactive bindings without reconstructing the DOM. Returns a `dispose`
97
- * function that tears down reactive scopes (DOM nodes are left in place).
98
- *
99
- * Use this when the page HTML was produced by `renderToString` or
100
- * `renderToStream`. For client-only apps, use `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
- * When the server renders a full document but the client hydrates only the
106
- * app subtree, the server must give that subtree its own id namespace: wrap
107
- * the document shell in `<NoHydration>` and re-enter with `<Hydration>`
108
- * around the app. Otherwise the app's hydration ids are allocated under the
109
- * document component's owner tree and this walk can never claim them.
110
- *
111
- * @example
112
- * ```tsx
113
- * import { hydrate } from "@solidjs/web";
114
- *
115
- * hydrate(() => <App />, document.getElementById("root")!);
116
- * ```
117
- */
118
- export declare const hydrate: typeof hydrateCore;
119
55
  /**
120
56
  * Renders its children into a different part of the DOM (modal roots,
121
57
  * tooltips, layers that need to escape an `overflow: hidden` ancestor).
@@ -137,27 +73,106 @@ export declare const hydrate: typeof hydrateCore;
137
73
  * </Portal>
138
74
  * ```
139
75
  *
140
- * @description https://docs.solidjs.com/reference/components/portal
76
+ * @description https://v2.solidjs.com/reference/solid-web/components/portal
141
77
  */
142
78
  export declare function Portal(props: {
143
79
  mount?: Element;
144
80
  children: JSX.Element;
145
81
  }): JSX.Element;
146
- export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false): Component<ComponentProps<T>>;
82
+ export type { DynamicOptions } from "solid-js";
83
+ export { dynamicComponent } from "solid-js";
147
84
  /**
148
- * Renders an arbitrary custom or native component and forwards the other
149
- * props. JSX form of `dynamic()` — same primitive, picked at the JSX site.
85
+ * Returns a stable `Component` whose identity is driven by a reactive (and
86
+ * optionally async) `source`. The returned component can be used anywhere a
87
+ * normal component is used; children and props flow through JSX as usual.
88
+ *
89
+ * `source` may return a component, a native tag name (`'input'`, `'textarea'`,
90
+ * etc.), `undefined`, or a `Promise` of any of the above. A pending promise
91
+ * propagates as `NotReadyError` through the surrounding reactive scope, so
92
+ * async swaps compose with `<Loading>` boundaries the same way as `lazy`.
93
+ *
94
+ * During SSR a pending source streams in behind its boundary by default. Pass
95
+ * `{ deferStream: true }` to hold the document's first flush until it settles
96
+ * (the same option `createMemo` takes); the client ignores it.
97
+ *
98
+ * For a tag-name source the element's namespace is inferred from the tag. A
99
+ * tag that exists in both HTML and SVG (`a`, `script`, `style`, `title`) is
100
+ * created as HTML unless the instance passes `xmlns` — the same attribute
101
+ * compiled JSX uses for the same purpose. `is` (customized built-ins) and
102
+ * `xmlns` are read once at creation and then applied as ordinary attributes.
103
+ *
104
+ * `{ static: true }` says the source cannot change: it is called once,
105
+ * untracked, when `dynamic()` is called, and each instance renders the result
106
+ * with no computation of its own — a tag name goes straight to the compiled
107
+ * element path (create or claim, spread), a component is called directly. No
108
+ * owner is created on either side, so hydration keys stay aligned with the
109
+ * compiled output. Use it for a constant (`dynamic(() => "li", { static: true })`
110
+ * in a runtime `styled()`), or per instance from the shape of a prop:
111
+ * `isStatic(props, "as")` is true when the caller wrote `as="button"`
112
+ * (a data property) and false when they wrote `as={cond() ? …}` (a getter),
113
+ * so a polymorphic component keeps a reactive public `as` and still pays
114
+ * nothing for the literal case. A static source may not return a promise.
150
115
  *
151
116
  * @example
152
117
  * ```tsx
153
- * <Dynamic
154
- * component={multiline() ? RichTextEditor : "input"}
155
- * value={value()}
156
- * onInput={onInput}
157
- * />
118
+ * // `source` can return either a custom Component or a native tag
119
+ * // name — they're interchangeable, and the returned reference is a
120
+ * // stable Component you can use anywhere a normal one would go.
121
+ * const Field = dynamic(() => multiline() ? RichTextEditor : "input");
122
+ * return <Field value={value()} onInput={onInput} />;
123
+ *
124
+ * // An ambiguous tag inside an SVG tree: say which namespace you mean.
125
+ * const Link = dynamic(() => "a");
126
+ * <svg><Link xmlns="http://www.w3.org/2000/svg" href="/x">…</Link></svg>
127
+ *
128
+ * // A polymorphic component: no memo when `as` arrived as a literal.
129
+ * function Polymorphic(props) {
130
+ * const Tag = dynamic(() => props.as, { static: isStatic(props, "as") });
131
+ * return <Tag {...omit(props, "as")} />;
132
+ * }
133
+ * ```
134
+ *
135
+ * @description https://v2.solidjs.com/reference/solid-web/components/dynamic
136
+ */
137
+ /**
138
+ * A component from a reactive source. The source may answer with the
139
+ * component itself, a promise of it, or an async iterable of it — a `live`
140
+ * server component reference's answer is the last: the memo underneath pumps
141
+ * the iterable as it pumps any async source, and its value is the component
142
+ * the server answered with (a reconnect re-yields the same binding and is
143
+ * equality-quiet; nothing here re-mounts).
144
+ *
145
+ * Under SSR an async answer is an ordinary async memo's: its landing is
146
+ * serialized per instance and adopted here at hydration, so the source may
147
+ * stay async only when what it resolves to can cross — a server component
148
+ * (as a reference) or a serializable value (a tag name). A promise of a
149
+ * client component function is a dev error on the server
150
+ * (`DYNAMIC_ASYNC_COMPONENT`): resolve the async upstream, or use `lazy()`.
151
+ *
152
+ * Cost: because a source may answer with a tag name, one `dynamic` on a page
153
+ * retains the element runtime (create/claim, `spread`, the namespace tables)
154
+ * for everyone. A source that only ever answers with a component — a server
155
+ * component mount — should use `dynamicComponent`, which never does.
156
+ */
157
+ export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | AsyncIterable<T> | null | undefined | false, options?: DynamicOptions): Component<ComponentProps<T>>;
158
+ /**
159
+ * @deprecated Use `dynamic()`. `<Dynamic>` is the same primitive, but its
160
+ * shape puts the tag in the same bag as the element's props: every instance
161
+ * merges `component` in at the call site, `omit()`s it back out here, and
162
+ * builds a fresh `dynamic()` factory (with its memo) because there is nowhere
163
+ * to hoist one. `dynamic()` has none of that and is one line longer:
164
+ *
165
+ * ```tsx
166
+ * // before
167
+ * <Dynamic component={multiline() ? RichTextEditor : "input"} value={value()} />
168
+ *
169
+ * // after — hoist per component instance (or per module for a constant)
170
+ * const Field = dynamic(() => multiline() ? RichTextEditor : "input");
171
+ * <Field value={value()} />
158
172
  * ```
159
173
  *
160
- * @description https://docs.solidjs.com/reference/components/dynamic
174
+ * Remains available in 2.0 (deprecated, no runtime warning); prefer `dynamic()`
175
+ * in new code.
161
176
  */
162
177
  export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
163
178
  /**
@@ -216,9 +231,10 @@ export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
216
231
  * `event.response` status at write time and restores it when the owning
217
232
  * scope is disposed — so a boundary that errored, declared a status, and
218
233
  * then recovered retracts its write instead of stomping a status a
219
- * surviving part of the tree legitimately set. Once the integration marks
220
- * the response head `committed` (head derived/sent), writes and
221
- * retractions are no-ops.
234
+ * surviving part of the tree legitimately set. Once the response head is
235
+ * `committed` (head derived/sent — the shell flush of a piped
236
+ * `renderToStream`, the completion of an awaited one or of
237
+ * `renderToString`), writes and retractions are no-ops.
222
238
  */
223
239
  export declare function httpStatus(_code: number, _text?: string): void;
224
240
  /**
@@ -236,8 +252,9 @@ export declare function httpStatus(_code: number, _text?: string): void;
236
252
  * Retraction semantics (server): the header's prior value is snapshotted at
237
253
  * write time and restored when the owning scope is disposed (deleted if
238
254
  * there was none) — a boundary that errors or recovers retracts its writes.
239
- * Once the integration marks the response head `committed` (head
240
- * derived/sent), writes and retractions are no-ops.
255
+ * Once the response head is `committed` (head derived/sent — the shell
256
+ * flush of a piped `renderToStream`, the completion of an awaited one or
257
+ * of `renderToString`), writes and retractions are no-ops.
241
258
  */
242
259
  export declare function httpHeader(_name: string, _value: string, _options?: {
243
260
  append?: boolean;
@@ -0,0 +1,159 @@
1
+ import { type Component, type DynamicOptions } from "solid-js";
2
+ import type { JSX } from "./jsx.js";
3
+ export * from "./server.js";
4
+ export * from "./response.js";
5
+ export type { CallEvent, CallListener, CallLive, CallRequestEvent, CallRequestListener, FrameAppliedEvent, FrameEvent, FrameListener, FrameLive, FrameProducedEvent, InvocationEvent, InvocationListener, InvocationLive, RenderEvent, RenderListener, RenderLive, RenderRoute } from "./observe.js";
6
+ export type { TraceContext, TraceProvider } from "./trace.js";
7
+ export type { JSX } from "./jsx.js";
8
+ export { For, Show, Loading, Reveal, Switch, Match, Repeat, Errored, NoHydration, Hydration } from "solid-js";
9
+ /**
10
+ * Build-time constant indicating whether code is running on the server. This
11
+ * is the server entry; the value is `true`. The client entry of `@solidjs/web`
12
+ * sets it to `false`. See the client-entry JSDoc for the canonical guard
13
+ * pattern.
14
+ */
15
+ export declare const isServer: boolean;
16
+ /**
17
+ * Build-time constant indicating whether code is running in a dev build.
18
+ * Set by `_SOLID_DEV_` substitution per artifact, exactly like the client
19
+ * entry: `dist/server.dev.*` (the `development` export condition) → `true`,
20
+ * `dist/server.*` → `false`. The server runtime's own `_SOLID_DEV_` gates are
21
+ * replaced by the same pass, so this flag and the bundle's internal behavior
22
+ * cannot disagree.
23
+ */
24
+ export declare const isDev: boolean;
25
+ export type IntrinsicElement = Extract<keyof JSX.IntrinsicElements, string>;
26
+ export type ValidComponent = IntrinsicElement | Component<any> | (string & {});
27
+ export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
28
+ export type { DynamicOptions } from "solid-js";
29
+ export { dynamicComponent } from "solid-js";
30
+ export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false, options?: DynamicOptions): Component<ComponentProps<T>>;
31
+ /** @deprecated Props of the deprecated `<Dynamic>`; see `dynamic()`. */
32
+ export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
33
+ [K in keyof P]: P[K];
34
+ } & {
35
+ component: T | null | undefined | false;
36
+ };
37
+ /**
38
+ * @deprecated Use `dynamic()`. `<Dynamic>` is the same primitive, but its
39
+ * shape puts the tag in the same bag as the element's props: every instance
40
+ * merges `component` in at the call site, `omit()`s it back out here, and
41
+ * builds a fresh `dynamic()` factory (with its memo) because there is nowhere
42
+ * to hoist one. `dynamic()` has none of that and is one line longer:
43
+ *
44
+ * ```tsx
45
+ * // before
46
+ * <Dynamic component={multiline() ? RichTextEditor : "input"} value={value()} />
47
+ *
48
+ * // after — hoist per component instance (or per module for a constant)
49
+ * const Field = dynamic(() => multiline() ? RichTextEditor : "input");
50
+ * <Field value={value()} />
51
+ * ```
52
+ *
53
+ * Remains available in 2.0 (deprecated, no runtime warning); prefer `dynamic()`
54
+ * in new code.
55
+ */
56
+ export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
57
+ /**
58
+ * Portals are client-only islands: the server renders nothing for them —
59
+ * `props.children` is never evaluated, no async is started, and nothing is
60
+ * serialized. The client renders the content fresh once hydration settles.
61
+ * Throwing here instead (as earlier betas did) is strictly worse: an ancestor
62
+ * `Errored` catches it and bakes the error fallback into the streamed HTML
63
+ * for a tree that renders fine client-side (#2876).
64
+ *
65
+ * The one thing both sides must still agree on is the parent's child-id
66
+ * counter: the client Portal scopes its internals under one owner (one slot),
67
+ * so consume the matching slot here or every hydration id after the portal
68
+ * drifts.
69
+ */
70
+ export declare function Portal(props: {
71
+ mount?: Element;
72
+ children: JSX.Element;
73
+ }): JSX.Element;
74
+ /**
75
+ * Server half of `clientOnly`: the wrapped component never renders on the
76
+ * server — the import is never even started — only `props.fallback` is
77
+ * SSR'd. The client build swaps the real component in after load + mount.
78
+ * See the client entry's JSDoc for the full contract.
79
+ *
80
+ * `moduleUrl` is injected by the bundler's module-URL pass (the same one
81
+ * that annotates `lazy()`, padding the options slot when a call site omits
82
+ * it); when present and an asset manifest is set, the render emits early
83
+ * preload hints for the module — see `registerClientOnlyPreload` for why
84
+ * they stay out of the hydration asset map. Without it (untransformed code)
85
+ * or without a manifest, behavior is unchanged.
86
+ */
87
+ export declare function clientOnly<M extends Record<string, any>, K extends keyof M & string>(fn: () => Promise<M>, options: {
88
+ lazy?: boolean;
89
+ export: K;
90
+ }, moduleUrl?: string): Component<ComponentProps<M[K]> & {
91
+ fallback?: JSX.Element;
92
+ }>;
93
+ export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
94
+ default: T;
95
+ }>, options?: {
96
+ lazy?: boolean;
97
+ export?: string;
98
+ }, moduleUrl?: string): Component<ComponentProps<T> & {
99
+ fallback?: JSX.Element;
100
+ }>;
101
+ /**
102
+ * Declares the HTTP response status (and optional status text) for the
103
+ * lifetime of the current reactive scope during SSR, writing to the request
104
+ * event's `response` head (core's `ResponseStub`, exposed by the
105
+ * integration).
106
+ *
107
+ * Naming note — this is a scope-tied *declaration*, not a mutation: "while
108
+ * this reactive scope is live, the response has this status." Solid reserves
109
+ * `set*` verbs for event-time mutation; `httpStatus` is called bare in a
110
+ * component or reactive-scope body (like `createSignal`/`onCleanup`) and
111
+ * un-declares on scope disposal.
112
+ *
113
+ * Retraction semantics: disposal retracts only this scope's declaration —
114
+ * the response falls back to the latest still-live declaration, or to the
115
+ * base status the integration had set before the first declaration. A
116
+ * boundary that errored, declared a status, and then recovered retracts its
117
+ * write without stomping a status a surviving part of the tree legitimately
118
+ * set (e.g. a 404 page whose inner boundary recovers stays a 404), and
119
+ * sibling scopes may dispose in any order (#2984). Both the write and the
120
+ * cleanup are no-ops once the response head is `committed` (head
121
+ * derived/sent — status can no longer change). The head commits when it
122
+ * freezes: at shell flush for a piped `renderToStream` (`createSSRResponse`
123
+ * commits on the first write), and at completion for an awaited one or for
124
+ * `renderToString` (the render commits right before its final dispose, so
125
+ * the declarations still live at that point are the ones the consumer
126
+ * derives the head from; `createSSRResponse` then passes the committed stub
127
+ * through). On the client this is a no-op.
128
+ */
129
+ export declare function httpStatus(code: number, text?: string): void;
130
+ /**
131
+ * Declares an HTTP response header (or with `append`, appends to one) for
132
+ * the lifetime of the current reactive scope during SSR, writing to the
133
+ * request event's `response` head (core's `ResponseStub`, exposed by the
134
+ * integration).
135
+ *
136
+ * Naming note — this is a scope-tied *declaration*, not a mutation: "while
137
+ * this reactive scope is live, the response has this header." Solid reserves
138
+ * `set*` verbs for event-time mutation; `httpHeader` is called bare in a
139
+ * component or reactive-scope body (like `createSignal`/`onCleanup`) and
140
+ * un-declares on scope disposal.
141
+ *
142
+ * Retraction semantics: disposal retracts only this scope's declaration —
143
+ * the header is recomputed by replaying the still-live declarations, in
144
+ * their original write order, over the base value the integration had set
145
+ * before the first declaration (deleted when there is neither). Sibling
146
+ * scopes may therefore dispose in any order without disturbing each
147
+ * other's contributions (#2984). For `set-cookie` — the one header whose
148
+ * multiple values must survive as separate entries — the base is captured
149
+ * and replayed entry-exact (`getSetCookie()` + re-append; `get()`/`set()`
150
+ * would comma-join the entries and then collapse them into one corrupt
151
+ * header). Both the write and the cleanup are no-ops once the response head
152
+ * is `committed` (head derived/sent — headers can no longer change); the
153
+ * head commits when it freezes — shell flush for a piped `renderToStream`,
154
+ * completion (right before the final dispose) for an awaited one and for
155
+ * `renderToString` — see `httpStatus`. On the client this is a no-op.
156
+ */
157
+ export declare function httpHeader(name: string, value: string, options?: {
158
+ append?: boolean;
159
+ }): void;