@solidjs/web 2.0.0-rc.6 → 2.0.0-rc.8

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 (82) hide show
  1. package/dist/{server.cjs → server.dev.js} +274 -272
  2. package/dist/server.js +119 -36
  3. package/dist/{dev.js → web.dev.js} +131 -399
  4. package/dist/web.js +78 -388
  5. package/dist/{web.cjs → web.observe.js} +174 -622
  6. package/frames/dist/client.dev.js +11 -3
  7. package/frames/dist/client.js +11 -3
  8. package/frames/dist/{server.cjs → server.dev.js} +375 -125
  9. package/frames/dist/server.js +253 -32
  10. package/frames/package.json +7 -15
  11. package/package.json +88 -251
  12. package/serialization/decode/package.json +3 -9
  13. package/serialization/dist/decode.js +18 -4
  14. package/serialization/dist/serialization.js +18 -4
  15. package/serialization/package.json +3 -9
  16. package/serialization/types/serializer-decode.d.ts +49 -2
  17. package/server-functions/dist/client.js +13 -14
  18. package/server-functions/dist/server.dev.js +359 -85
  19. package/server-functions/dist/server.js +352 -86
  20. package/server-functions/package.json +6 -24
  21. package/server-functions/rich-args/package.json +3 -9
  22. package/storage/package.json +3 -9
  23. package/types/client.d.ts +17 -3
  24. package/types/frames/frame-client.d.ts +1 -1
  25. package/types/frames/serializer-decode.d.ts +49 -2
  26. package/types/head.d.ts +3 -0
  27. package/types/index.d.ts +18 -7
  28. package/types/index.server.d.ts +31 -9
  29. package/types/render.d.ts +3 -1
  30. package/types/serializer-decode.d.ts +49 -2
  31. package/types/server-functions/flash.d.ts +12 -3
  32. package/types/server-functions/server.d.ts +50 -3
  33. package/types/server-mock.d.ts +43 -7
  34. package/types/server.d.ts +48 -6
  35. package/dist/dev.cjs +0 -2590
  36. package/frames/dist/client.cjs +0 -2035
  37. package/frames/dist/client.dev.cjs +0 -2055
  38. package/serialization/dist/decode.cjs +0 -141
  39. package/serialization/dist/serialization.cjs +0 -261
  40. package/serialization/types-cjs/index.d.cts +0 -101
  41. package/serialization/types-cjs/package.json +0 -3
  42. package/serialization/types-cjs/serializer-decode.d.cts +0 -172
  43. package/serialization/types-cjs/serializer.d.cts +0 -101
  44. package/server-functions/dist/client.cjs +0 -1070
  45. package/server-functions/dist/rich-args.cjs +0 -11
  46. package/server-functions/dist/server.cjs +0 -2133
  47. package/server-functions/dist/server.dev.cjs +0 -2153
  48. package/storage/dist/storage.cjs +0 -12
  49. package/storage/types-cjs/index.d.cts +0 -28
  50. package/storage/types-cjs/package.json +0 -3
  51. package/types/patch-driver.d.ts +0 -3
  52. package/types-cjs/client.d.cts +0 -200
  53. package/types-cjs/constants.d.cts +0 -20
  54. package/types-cjs/cookies.d.cts +0 -41
  55. package/types-cjs/frames/client.d.cts +0 -36
  56. package/types-cjs/frames/frame-client.d.cts +0 -370
  57. package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
  58. package/types-cjs/frames/frame-sink.d.cts +0 -92
  59. package/types-cjs/frames/frame-transport.d.cts +0 -189
  60. package/types-cjs/frames/serializer-decode.d.cts +0 -172
  61. package/types-cjs/frames/serializer.d.cts +0 -101
  62. package/types-cjs/frames/server.d.cts +0 -52
  63. package/types-cjs/head.d.cts +0 -16
  64. package/types-cjs/index.d.cts +0 -180
  65. package/types-cjs/index.server.d.cts +0 -125
  66. package/types-cjs/jsx-properties.d.cts +0 -93
  67. package/types-cjs/jsx.d.cts +0 -4146
  68. package/types-cjs/package.json +0 -3
  69. package/types-cjs/patch-driver.d.cts +0 -3
  70. package/types-cjs/reconcile.d.cts +0 -1
  71. package/types-cjs/render.d.cts +0 -4
  72. package/types-cjs/response.d.cts +0 -81
  73. package/types-cjs/serializer-decode.d.cts +0 -172
  74. package/types-cjs/serializer.d.cts +0 -101
  75. package/types-cjs/server-functions/client.d.cts +0 -184
  76. package/types-cjs/server-functions/flash.d.cts +0 -27
  77. package/types-cjs/server-functions/registry.d.cts +0 -100
  78. package/types-cjs/server-functions/rich-args.d.cts +0 -1
  79. package/types-cjs/server-functions/server.d.cts +0 -522
  80. package/types-cjs/server-functions/shared.d.cts +0 -283
  81. package/types-cjs/server-mock.d.cts +0 -301
  82. package/types-cjs/server.d.cts +0 -366
@@ -1,180 +0,0 @@
1
- import { Component } from "solid-js";
2
- import type { JSX } from "./jsx.cjs";
3
- export * from "./client.cjs";
4
- export { patchDriver, rowProof, driveList } from "./patch-driver.cjs";
5
- export * from "./server-mock.cjs";
6
- export * from "./response.cjs";
7
- export type { JSX } from "./jsx.cjs";
8
- export { For, Show, Switch, Match, Errored, Loading, Repeat, Reveal, NoHydration, Hydration } from "solid-js";
9
- /**
10
- * Build-time constant indicating whether code is running on the server. This
11
- * client entry sets it to `false`; the matching server entry (`@solidjs/web`
12
- * resolved through the `solid` server export condition) sets it to `true`.
13
- *
14
- * Bundlers can dead-code-eliminate branches gated on `isServer`, so guarding
15
- * browser-only code with `if (!isServer) {…}` keeps it out of the SSR bundle
16
- * entirely.
17
- *
18
- * @example
19
- * ```ts
20
- * import { isServer } from "@solidjs/web";
21
- *
22
- * if (!isServer) {
23
- * // Browser-only: tree-shaken out of the SSR bundle.
24
- * window.addEventListener("resize", onResize);
25
- * }
26
- * ```
27
- */
28
- export declare const isServer: boolean;
29
- /**
30
- * Build-time constant indicating whether code is running in a dev build.
31
- * Replaced statically (`_SOLID_DEV_`) by the bundler integration, so guards
32
- * like `if (isDev) {…}` are stripped from production builds.
33
- *
34
- * Use this to gate dev-only diagnostics, warnings, or expensive invariants
35
- * that should never ship to production.
36
- *
37
- * @example
38
- * ```ts
39
- * import { isDev } from "@solidjs/web";
40
- *
41
- * if (isDev) {
42
- * console.warn("debug-only path");
43
- * }
44
- * ```
45
- */
46
- export declare const isDev: boolean;
47
- export type IntrinsicElement = Extract<keyof JSX.IntrinsicElements, string>;
48
- export type ValidComponent = IntrinsicElement | Component<any> | (string & {});
49
- export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
50
- export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
51
- [K in keyof P]: P[K];
52
- } & {
53
- component: T | null | undefined | false;
54
- };
55
- /**
56
- * Renders its children into a different part of the DOM (modal roots,
57
- * tooltips, layers that need to escape an `overflow: hidden` ancestor).
58
- *
59
- * If `mount` is omitted, the portal attaches to `document.body`. The portal
60
- * still participates in the parent's reactive scope and disposes when the
61
- * parent does.
62
- *
63
- * Portals are client-only islands: the server renders nothing for them, and
64
- * under hydration the children render fresh once hydration settles. Async
65
- * read inside a portal therefore starts on the client — data that should be
66
- * fetched on the server belongs above the portal (hoist the read, not the
67
- * render), and async UI inside one wants its own `<Loading>` boundary.
68
- *
69
- * @example
70
- * ```tsx
71
- * <Portal mount={document.getElementById("modal-root")!}>
72
- * <Dialog />
73
- * </Portal>
74
- * ```
75
- *
76
- * @description https://docs.solidjs.com/reference/components/portal
77
- */
78
- export declare function Portal(props: {
79
- mount?: Element;
80
- children: JSX.Element;
81
- }): JSX.Element;
82
- export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false): Component<ComponentProps<T>>;
83
- /**
84
- * Renders an arbitrary custom or native component and forwards the other
85
- * props. JSX form of `dynamic()` — same primitive, picked at the JSX site.
86
- *
87
- * @example
88
- * ```tsx
89
- * <Dynamic
90
- * component={multiline() ? RichTextEditor : "input"}
91
- * value={value()}
92
- * onInput={onInput}
93
- * />
94
- * ```
95
- *
96
- * @description https://docs.solidjs.com/reference/components/dynamic
97
- */
98
- export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
99
- /**
100
- * Wraps a dynamically imported component so it renders only in the browser.
101
- * The server renders `props.fallback` (and nothing else); the client shows
102
- * the fallback until the import resolves and the tree has mounted, then
103
- * swaps the real component in.
104
- *
105
- * Unlike `lazy()`, this avoids Suspense entirely and never server-renders
106
- * the wrapped component — only the fallback — so the component participates
107
- * in no hydration asset manifest and its code is guaranteed to never run on
108
- * the server (safe for browser-only libraries touching `window`, DOM
109
- * measurement, etc.). The mount gate keeps hydration safe: during hydration
110
- * the fallback is rendered exactly as the server did, and the swap happens
111
- * only after settle, so there is no mismatch.
112
- *
113
- * By default the import starts as soon as `clientOnly` is called (module
114
- * load); pass `{ lazy: true }` to defer the import to the component's first
115
- * render. Pass `{ export: "Name" }` to use a named export of the resolved
116
- * module instead of its default (mirrors `lazy()`'s option).
117
- *
118
- * @example
119
- * ```tsx
120
- * const Chart = clientOnly(() => import("./Chart.jsx"));
121
- * // <Chart fallback={<div>Loading chart…</div>} data={data()} />
122
- * ```
123
- */
124
- export declare function clientOnly<M extends Record<string, any>, K extends keyof M & string>(fn: () => Promise<M>, options: {
125
- lazy?: boolean;
126
- export: K;
127
- }, moduleUrl?: string): Component<ComponentProps<M[K]> & {
128
- fallback?: JSX.Element;
129
- }>;
130
- export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
131
- default: T;
132
- }>, options?: {
133
- lazy?: boolean;
134
- export?: string;
135
- }, moduleUrl?: string): Component<ComponentProps<T> & {
136
- fallback?: JSX.Element;
137
- }>;
138
- /**
139
- * Declares the HTTP response status (and optional status text) for the
140
- * lifetime of the current reactive scope during SSR — call it bare in a
141
- * component or reactive-scope body where the status is decided (a 404
142
- * route, an error fallback). Client build: a no-op — the response head was
143
- * sent long ago.
144
- *
145
- * Naming note — this is a scope-tied *declaration*, not a mutation: "while
146
- * this reactive scope is live, the response has this status." Solid
147
- * reserves `set*` verbs for event-time mutation; like
148
- * `createSignal`/`onCleanup` this is called in scope bodies and un-declares
149
- * on scope disposal.
150
- *
151
- * Retraction semantics (server): the write snapshots the previous
152
- * `event.response` status at write time and restores it when the owning
153
- * scope is disposed — so a boundary that errored, declared a status, and
154
- * then recovered retracts its write instead of stomping a status a
155
- * surviving part of the tree legitimately set. Once the integration marks
156
- * the response head `committed` (head derived/sent), writes and
157
- * retractions are no-ops.
158
- */
159
- export declare function httpStatus(_code: number, _text?: string): void;
160
- /**
161
- * Declares an HTTP response header (or with `append`, appends to one) for
162
- * the lifetime of the current reactive scope during SSR — call it bare in a
163
- * component or reactive-scope body. Client build: a no-op — the response
164
- * head was sent long ago.
165
- *
166
- * Naming note — this is a scope-tied *declaration*, not a mutation: "while
167
- * this reactive scope is live, the response has this header." Solid
168
- * reserves `set*` verbs for event-time mutation; like
169
- * `createSignal`/`onCleanup` this is called in scope bodies and un-declares
170
- * on scope disposal.
171
- *
172
- * Retraction semantics (server): the header's prior value is snapshotted at
173
- * write time and restored when the owning scope is disposed (deleted if
174
- * there was none) — a boundary that errors or recovers retracts its writes.
175
- * Once the integration marks the response head `committed` (head
176
- * derived/sent), writes and retractions are no-ops.
177
- */
178
- export declare function httpHeader(_name: string, _value: string, _options?: {
179
- append?: boolean;
180
- }): void;
@@ -1,125 +0,0 @@
1
- import { type Component } from "solid-js";
2
- import type { JSX } from "./jsx.cjs";
3
- export * from "./server.cjs";
4
- export * from "./response.cjs";
5
- export type { JSX } from "./jsx.cjs";
6
- export { For, Show, Loading, Reveal, Switch, Match, Repeat, Errored, NoHydration, Hydration } from "solid-js";
7
- /**
8
- * Build-time constant indicating whether code is running on the server. This
9
- * is the server entry; the value is `true`. The client entry of `@solidjs/web`
10
- * sets it to `false`. See the client-entry JSDoc for the canonical guard
11
- * pattern.
12
- */
13
- export declare const isServer: boolean;
14
- /**
15
- * Build-time constant indicating whether code is running in a dev build.
16
- * The server entry hard-codes `false` (SSR builds are production by
17
- * convention); the client entry's value is set by `_SOLID_DEV_` substitution.
18
- */
19
- export declare const isDev: boolean;
20
- export type IntrinsicElement = Extract<keyof JSX.IntrinsicElements, string>;
21
- export type ValidComponent = IntrinsicElement | Component<any> | (string & {});
22
- export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
23
- export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false): Component<ComponentProps<T>>;
24
- export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
25
- [K in keyof P]: P[K];
26
- } & {
27
- component: T | null | undefined | false;
28
- };
29
- export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
30
- /**
31
- * Portals are client-only islands: the server renders nothing for them —
32
- * `props.children` is never evaluated, no async is started, and nothing is
33
- * serialized. The client renders the content fresh once hydration settles.
34
- * Throwing here instead (as earlier betas did) is strictly worse: an ancestor
35
- * `Errored` catches it and bakes the error fallback into the streamed HTML
36
- * for a tree that renders fine client-side (#2876).
37
- *
38
- * The one thing both sides must still agree on is the parent's child-id
39
- * counter: the client Portal scopes its internals under one owner (one slot),
40
- * so consume the matching slot here or every hydration id after the portal
41
- * drifts.
42
- */
43
- export declare function Portal(props: {
44
- mount?: Element;
45
- children: JSX.Element;
46
- }): JSX.Element;
47
- /**
48
- * Server half of `clientOnly`: the wrapped component never renders on the
49
- * server — the import is never even started — only `props.fallback` is
50
- * SSR'd. The client build swaps the real component in after load + mount.
51
- * See the client entry's JSDoc for the full contract.
52
- *
53
- * `moduleUrl` is injected by the bundler's module-URL pass (the same one
54
- * that annotates `lazy()`, padding the options slot when a call site omits
55
- * it); when present and an asset manifest is set, the render emits early
56
- * preload hints for the module — see `registerClientOnlyPreload` for why
57
- * they stay out of the hydration asset map. Without it (untransformed code)
58
- * or without a manifest, behavior is unchanged.
59
- */
60
- export declare function clientOnly<M extends Record<string, any>, K extends keyof M & string>(fn: () => Promise<M>, options: {
61
- lazy?: boolean;
62
- export: K;
63
- }, moduleUrl?: string): Component<ComponentProps<M[K]> & {
64
- fallback?: JSX.Element;
65
- }>;
66
- export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
67
- default: T;
68
- }>, options?: {
69
- lazy?: boolean;
70
- export?: string;
71
- }, moduleUrl?: string): Component<ComponentProps<T> & {
72
- fallback?: JSX.Element;
73
- }>;
74
- /**
75
- * Declares the HTTP response status (and optional status text) for the
76
- * lifetime of the current reactive scope during SSR, writing to the request
77
- * event's `response` head (core's `ResponseStub`, exposed by the
78
- * integration).
79
- *
80
- * Naming note — this is a scope-tied *declaration*, not a mutation: "while
81
- * this reactive scope is live, the response has this status." Solid reserves
82
- * `set*` verbs for event-time mutation; `httpStatus` is called bare in a
83
- * component or reactive-scope body (like `createSignal`/`onCleanup`) and
84
- * un-declares on scope disposal.
85
- *
86
- * Retraction semantics: disposal retracts only this scope's declaration —
87
- * the response falls back to the latest still-live declaration, or to the
88
- * base status the integration had set before the first declaration. A
89
- * boundary that errored, declared a status, and then recovered retracts its
90
- * write without stomping a status a surviving part of the tree legitimately
91
- * set (e.g. a 404 page whose inner boundary recovers stays a 404), and
92
- * sibling scopes may dispose in any order (#2984). Both the write and the
93
- * cleanup are no-ops once the integration marks the response head
94
- * `committed` (head derived/sent — status can no longer change). On the
95
- * client this is a no-op.
96
- */
97
- export declare function httpStatus(code: number, text?: string): void;
98
- /**
99
- * Declares an HTTP response header (or with `append`, appends to one) for
100
- * the lifetime of the current reactive scope during SSR, writing to the
101
- * request event's `response` head (core's `ResponseStub`, exposed by the
102
- * integration).
103
- *
104
- * Naming note — this is a scope-tied *declaration*, not a mutation: "while
105
- * this reactive scope is live, the response has this header." Solid reserves
106
- * `set*` verbs for event-time mutation; `httpHeader` is called bare in a
107
- * component or reactive-scope body (like `createSignal`/`onCleanup`) and
108
- * un-declares on scope disposal.
109
- *
110
- * Retraction semantics: disposal retracts only this scope's declaration —
111
- * the header is recomputed by replaying the still-live declarations, in
112
- * their original write order, over the base value the integration had set
113
- * before the first declaration (deleted when there is neither). Sibling
114
- * scopes may therefore dispose in any order without disturbing each
115
- * other's contributions (#2984). For `set-cookie` — the one header whose
116
- * multiple values must survive as separate entries — the base is captured
117
- * and replayed entry-exact (`getSetCookie()` + re-append; `get()`/`set()`
118
- * would comma-join the entries and then collapse them into one corrupt
119
- * header). Both the write and the cleanup are no-ops once the integration
120
- * marks the response head `committed` (head derived/sent — headers can no
121
- * longer change). On the client this is a no-op.
122
- */
123
- export declare function httpHeader(name: string, value: string, options?: {
124
- append?: boolean;
125
- }): void;
@@ -1,93 +0,0 @@
1
- /**
2
- * Shared type-level helpers used to derive `prop:*` attribute typings from
3
- * DOM element interfaces (e.g. `HTMLInputElement`, `HTMLButtonElement`).
4
- *
5
- * The wrapping of each value (`FunctionMaybe<T>` in `jsx-h.d.ts` vs. the
6
- * raw value in `jsx.d.ts`) is applied by each consumer when composing its
7
- * own `Properties<T>` mapped type. That way this file stays identical in
8
- * both reactive and non-reactive contexts and only needs to exist once.
9
- *
10
- * originally from
11
- * @url https://github.com/potahtml/pota
12
- */
13
-
14
- /** Base-class properties shared by all elements — skipped from `prop:*`. */
15
- export type SkipPropsFrom = HTMLUnknownElement & HTMLElement & Element & Node;
16
-
17
- /**
18
- * Value types allowed on a `prop:*`. Primitives plus the writable
19
- * non-primitive DOM-object props worth exposing:
20
- *
21
- * - `HTMLMediaElement.srcObject`
22
- * - `HTMLButtonElement.popoverTargetElement` / `commandForElement` (and the same via
23
- * `PopoverTargetAttributes` mixin on `HTMLInputElement`)
24
- */
25
- export type PropValue =
26
- | string
27
- | number
28
- | boolean
29
- | null
30
- | MediaStream
31
- | MediaSource
32
- | Blob
33
- | File
34
- | Date
35
- | Element;
36
-
37
- /**
38
- * Ergonomics widening for emitted `prop:*` value types:
39
- *
40
- * - general `string` → `string | number` (HTML coerces numbers)
41
- * - string literal unions (`'on' | 'off'`) stay exact, so users still get autocomplete /
42
- * narrowing
43
- * - other types pass through unchanged
44
- */
45
- type WidenString<V> = string extends V ? string | number : V;
46
- export type WidenPropValue<V> = [V] extends [string] ? WidenString<V> : V;
47
-
48
- /**
49
- * Structurally identical → `Y`; distinct → `N`. Used by `IsReadonlyKey` to detect
50
- * readonly keys by comparing `Pick<T, K>` with `Readonly<Pick<T, K>>`.
51
- */
52
- export type IfEquals<A, B, Y = unknown, N = never> =
53
- (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? Y : N;
54
-
55
- /**
56
- * True when `K` is readonly on `T`. Singleton-constant properties (e.g.
57
- * `tagName: "INPUT"`, `nodeType: 1`) are always `readonly` in `lib.dom.d.ts`, so this
58
- * single check covers both readonly and singleton-literal cases.
59
- */
60
- export type IsReadonlyKey<T, K extends keyof T> = IfEquals<
61
- Pick<T, K>,
62
- Readonly<Pick<T, K>>,
63
- true,
64
- false
65
- >;
66
-
67
- /**
68
- * Resolves to the `prop:K` string literal when `K` is a writable, element-specific
69
- * property suitable for a `prop:*` attribute; otherwise resolves to `never` so the
70
- * key is filtered out of the resulting mapped type.
71
- *
72
- * Filters out:
73
- *
74
- * - base-class keys (via `SkipPropsFrom`)
75
- * - aria-* keys (already typed via `AriaAttributes`)
76
- * - readonly keys
77
- * - keys whose value types fall outside `PropValue`
78
- * - the generic `string` index signature (e.g. `HTMLFormElement[name: string]: any`),
79
- * which would otherwise shadow every key with an `any`-typed `prop:*`
80
- */
81
- export type PropKey<T, K extends keyof T> = K extends keyof SkipPropsFrom
82
- ? never
83
- : K extends string
84
- ? string extends K
85
- ? never
86
- : K extends `aria${string}`
87
- ? never
88
- : T[K] extends PropValue
89
- ? IsReadonlyKey<T, K> extends true
90
- ? never
91
- : `prop:${K}`
92
- : never
93
- : never;