@solidjs/web 2.0.0-rc.7 → 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.
- package/dist/server.dev.js +15 -2
- package/dist/server.js +15 -2
- package/dist/web.dev.js +41 -9
- package/dist/web.js +39 -8
- package/dist/{web.cjs → web.observe.js} +137 -239
- package/frames/dist/server.dev.js +19 -0
- package/frames/dist/server.js +19 -0
- package/frames/package.json +6 -24
- package/package.json +81 -314
- package/serialization/decode/package.json +3 -9
- package/serialization/package.json +3 -9
- package/serialization/types/serializer-decode.d.ts +49 -2
- package/server-functions/dist/server.dev.js +28 -10
- package/server-functions/dist/server.js +28 -10
- package/server-functions/package.json +6 -24
- package/server-functions/rich-args/package.json +3 -9
- package/storage/package.json +3 -9
- package/types/client.d.ts +17 -0
- package/types/frames/serializer-decode.d.ts +49 -2
- package/types/serializer-decode.d.ts +49 -2
- package/types/server-functions/server.d.ts +27 -4
- package/types/server.d.ts +1 -1
- package/dist/server.cjs +0 -3708
- package/dist/server.dev.cjs +0 -3794
- package/dist/web.dev.cjs +0 -2285
- package/frames/dist/client.cjs +0 -2043
- package/frames/dist/client.dev.cjs +0 -2063
- package/frames/dist/server.cjs +0 -4542
- package/frames/dist/server.dev.cjs +0 -4584
- package/serialization/dist/decode.cjs +0 -155
- package/serialization/dist/serialization.cjs +0 -275
- package/serialization/types-cjs/index.d.cts +0 -101
- package/serialization/types-cjs/package.json +0 -3
- package/serialization/types-cjs/serializer-decode.d.cts +0 -172
- package/serialization/types-cjs/serializer.d.cts +0 -101
- package/server-functions/dist/client.cjs +0 -1069
- package/server-functions/dist/rich-args.cjs +0 -11
- package/server-functions/dist/server.cjs +0 -2381
- package/server-functions/dist/server.dev.cjs +0 -2409
- package/storage/dist/storage.cjs +0 -12
- package/storage/types-cjs/index.d.cts +0 -28
- package/storage/types-cjs/package.json +0 -3
- package/types-cjs/client.d.cts +0 -197
- package/types-cjs/constants.d.cts +0 -20
- package/types-cjs/cookies.d.cts +0 -41
- package/types-cjs/frames/client.d.cts +0 -36
- package/types-cjs/frames/frame-client.d.cts +0 -370
- package/types-cjs/frames/frame-container-plugin.d.cts +0 -71
- package/types-cjs/frames/frame-sink.d.cts +0 -92
- package/types-cjs/frames/frame-transport.d.cts +0 -189
- package/types-cjs/frames/serializer-decode.d.cts +0 -172
- package/types-cjs/frames/serializer.d.cts +0 -101
- package/types-cjs/frames/server.d.cts +0 -52
- package/types-cjs/head.d.cts +0 -19
- package/types-cjs/index.d.cts +0 -191
- package/types-cjs/index.server.d.cts +0 -147
- package/types-cjs/jsx-properties.d.cts +0 -93
- package/types-cjs/jsx.d.cts +0 -4146
- package/types-cjs/package.json +0 -3
- package/types-cjs/reconcile.d.cts +0 -1
- package/types-cjs/render.d.cts +0 -6
- package/types-cjs/response.d.cts +0 -81
- package/types-cjs/serializer-decode.d.cts +0 -172
- package/types-cjs/serializer.d.cts +0 -101
- package/types-cjs/server-functions/client.d.cts +0 -184
- package/types-cjs/server-functions/flash.d.cts +0 -36
- package/types-cjs/server-functions/registry.d.cts +0 -100
- package/types-cjs/server-functions/rich-args.d.cts +0 -1
- package/types-cjs/server-functions/server.d.cts +0 -546
- package/types-cjs/server-functions/shared.d.cts +0 -283
- package/types-cjs/server-mock.d.cts +0 -337
- package/types-cjs/server.d.cts +0 -408
package/types-cjs/index.d.cts
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { Component } from "solid-js";
|
|
2
|
-
import type { JSX } from "./jsx.cjs";
|
|
3
|
-
export * from "./client.cjs";
|
|
4
|
-
export * from "./server-mock.cjs";
|
|
5
|
-
export * from "./response.cjs";
|
|
6
|
-
export type { JSX } from "./jsx.cjs";
|
|
7
|
-
export { For, Show, Switch, Match, Errored, Loading, Repeat, Reveal, NoHydration, Hydration } from "solid-js";
|
|
8
|
-
/**
|
|
9
|
-
* Build-time constant indicating whether code is running on the server. This
|
|
10
|
-
* client entry sets it to `false`; the matching server entry (`@solidjs/web`
|
|
11
|
-
* resolved through the `solid` server export condition) sets it to `true`.
|
|
12
|
-
*
|
|
13
|
-
* Bundlers can dead-code-eliminate branches gated on `isServer`, so guarding
|
|
14
|
-
* browser-only code with `if (!isServer) {…}` keeps it out of the SSR bundle
|
|
15
|
-
* entirely.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* import { isServer } from "@solidjs/web";
|
|
20
|
-
*
|
|
21
|
-
* if (!isServer) {
|
|
22
|
-
* // Browser-only: tree-shaken out of the SSR bundle.
|
|
23
|
-
* window.addEventListener("resize", onResize);
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare const isServer: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Build-time constant indicating whether code is running in a dev build.
|
|
30
|
-
* Replaced statically (`_SOLID_DEV_`) by the bundler integration, so guards
|
|
31
|
-
* like `if (isDev) {…}` are stripped from production builds.
|
|
32
|
-
*
|
|
33
|
-
* Use this to gate dev-only diagnostics, warnings, or expensive invariants
|
|
34
|
-
* that should never ship to production.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```ts
|
|
38
|
-
* import { isDev } from "@solidjs/web";
|
|
39
|
-
*
|
|
40
|
-
* if (isDev) {
|
|
41
|
-
* console.warn("debug-only path");
|
|
42
|
-
* }
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export declare const isDev: boolean;
|
|
46
|
-
export type IntrinsicElement = Extract<keyof JSX.IntrinsicElements, string>;
|
|
47
|
-
export type ValidComponent = IntrinsicElement | Component<any> | (string & {});
|
|
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
|
-
export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
50
|
-
[K in keyof P]: P[K];
|
|
51
|
-
} & {
|
|
52
|
-
component: T | null | undefined | false;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Renders its children into a different part of the DOM (modal roots,
|
|
56
|
-
* tooltips, layers that need to escape an `overflow: hidden` ancestor).
|
|
57
|
-
*
|
|
58
|
-
* If `mount` is omitted, the portal attaches to `document.body`. The portal
|
|
59
|
-
* still participates in the parent's reactive scope and disposes when the
|
|
60
|
-
* parent does.
|
|
61
|
-
*
|
|
62
|
-
* Portals are client-only islands: the server renders nothing for them, and
|
|
63
|
-
* under hydration the children render fresh once hydration settles. Async
|
|
64
|
-
* read inside a portal therefore starts on the client — data that should be
|
|
65
|
-
* fetched on the server belongs above the portal (hoist the read, not the
|
|
66
|
-
* render), and async UI inside one wants its own `<Loading>` boundary.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```tsx
|
|
70
|
-
* <Portal mount={document.getElementById("modal-root")!}>
|
|
71
|
-
* <Dialog />
|
|
72
|
-
* </Portal>
|
|
73
|
-
* ```
|
|
74
|
-
*
|
|
75
|
-
* @description https://docs.solidjs.com/reference/components/portal
|
|
76
|
-
*/
|
|
77
|
-
export declare function Portal(props: {
|
|
78
|
-
mount?: Element;
|
|
79
|
-
children: JSX.Element;
|
|
80
|
-
}): JSX.Element;
|
|
81
|
-
export interface DynamicOptions {
|
|
82
|
-
/**
|
|
83
|
-
* SSR only: hold the document's first flush until the source settles, so
|
|
84
|
-
* the resolved component renders into the shell instead of streaming in
|
|
85
|
-
* behind its boundary's fallback. Same meaning as `createMemo`'s
|
|
86
|
-
* `deferStream`. Ignored on the client.
|
|
87
|
-
*/
|
|
88
|
-
deferStream?: boolean;
|
|
89
|
-
}
|
|
90
|
-
export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false, _options?: DynamicOptions): Component<ComponentProps<T>>;
|
|
91
|
-
/**
|
|
92
|
-
* Renders an arbitrary custom or native component and forwards the other
|
|
93
|
-
* props. JSX form of `dynamic()` — same primitive, picked at the JSX site.
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```tsx
|
|
97
|
-
* <Dynamic
|
|
98
|
-
* component={multiline() ? RichTextEditor : "input"}
|
|
99
|
-
* value={value()}
|
|
100
|
-
* onInput={onInput}
|
|
101
|
-
* />
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* @description https://docs.solidjs.com/reference/components/dynamic
|
|
105
|
-
*/
|
|
106
|
-
export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
|
|
107
|
-
/**
|
|
108
|
-
* Wraps a dynamically imported component so it renders only in the browser.
|
|
109
|
-
* The server renders `props.fallback` (and nothing else); the client shows
|
|
110
|
-
* the fallback until the import resolves and the tree has mounted, then
|
|
111
|
-
* swaps the real component in.
|
|
112
|
-
*
|
|
113
|
-
* Unlike `lazy()`, this avoids Suspense entirely and never server-renders
|
|
114
|
-
* the wrapped component — only the fallback — so the component participates
|
|
115
|
-
* in no hydration asset manifest and its code is guaranteed to never run on
|
|
116
|
-
* the server (safe for browser-only libraries touching `window`, DOM
|
|
117
|
-
* measurement, etc.). The mount gate keeps hydration safe: during hydration
|
|
118
|
-
* the fallback is rendered exactly as the server did, and the swap happens
|
|
119
|
-
* only after settle, so there is no mismatch.
|
|
120
|
-
*
|
|
121
|
-
* By default the import starts as soon as `clientOnly` is called (module
|
|
122
|
-
* load); pass `{ lazy: true }` to defer the import to the component's first
|
|
123
|
-
* render. Pass `{ export: "Name" }` to use a named export of the resolved
|
|
124
|
-
* module instead of its default (mirrors `lazy()`'s option).
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```tsx
|
|
128
|
-
* const Chart = clientOnly(() => import("./Chart.jsx"));
|
|
129
|
-
* // <Chart fallback={<div>Loading chart…</div>} data={data()} />
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
export declare function clientOnly<M extends Record<string, any>, K extends keyof M & string>(fn: () => Promise<M>, options: {
|
|
133
|
-
lazy?: boolean;
|
|
134
|
-
export: K;
|
|
135
|
-
}, moduleUrl?: string): Component<ComponentProps<M[K]> & {
|
|
136
|
-
fallback?: JSX.Element;
|
|
137
|
-
}>;
|
|
138
|
-
export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
|
|
139
|
-
default: T;
|
|
140
|
-
}>, options?: {
|
|
141
|
-
lazy?: boolean;
|
|
142
|
-
export?: string;
|
|
143
|
-
}, moduleUrl?: string): Component<ComponentProps<T> & {
|
|
144
|
-
fallback?: JSX.Element;
|
|
145
|
-
}>;
|
|
146
|
-
/**
|
|
147
|
-
* Declares the HTTP response status (and optional status text) for the
|
|
148
|
-
* lifetime of the current reactive scope during SSR — call it bare in a
|
|
149
|
-
* component or reactive-scope body where the status is decided (a 404
|
|
150
|
-
* route, an error fallback). Client build: a no-op — the response head was
|
|
151
|
-
* sent long ago.
|
|
152
|
-
*
|
|
153
|
-
* Naming note — this is a scope-tied *declaration*, not a mutation: "while
|
|
154
|
-
* this reactive scope is live, the response has this status." Solid
|
|
155
|
-
* reserves `set*` verbs for event-time mutation; like
|
|
156
|
-
* `createSignal`/`onCleanup` this is called in scope bodies and un-declares
|
|
157
|
-
* on scope disposal.
|
|
158
|
-
*
|
|
159
|
-
* Retraction semantics (server): the write snapshots the previous
|
|
160
|
-
* `event.response` status at write time and restores it when the owning
|
|
161
|
-
* scope is disposed — so a boundary that errored, declared a status, and
|
|
162
|
-
* then recovered retracts its write instead of stomping a status a
|
|
163
|
-
* surviving part of the tree legitimately set. Once the response head is
|
|
164
|
-
* `committed` (head derived/sent — the shell flush of a piped
|
|
165
|
-
* `renderToStream`, the completion of an awaited one, `createSSRResponse`
|
|
166
|
-
* for a `renderToString` result), writes and retractions are no-ops.
|
|
167
|
-
*/
|
|
168
|
-
export declare function httpStatus(_code: number, _text?: string): void;
|
|
169
|
-
/**
|
|
170
|
-
* Declares an HTTP response header (or with `append`, appends to one) for
|
|
171
|
-
* the lifetime of the current reactive scope during SSR — call it bare in a
|
|
172
|
-
* component or reactive-scope body. Client build: a no-op — the response
|
|
173
|
-
* head was sent long ago.
|
|
174
|
-
*
|
|
175
|
-
* Naming note — this is a scope-tied *declaration*, not a mutation: "while
|
|
176
|
-
* this reactive scope is live, the response has this header." Solid
|
|
177
|
-
* reserves `set*` verbs for event-time mutation; like
|
|
178
|
-
* `createSignal`/`onCleanup` this is called in scope bodies and un-declares
|
|
179
|
-
* on scope disposal.
|
|
180
|
-
*
|
|
181
|
-
* Retraction semantics (server): the header's prior value is snapshotted at
|
|
182
|
-
* write time and restored when the owning scope is disposed (deleted if
|
|
183
|
-
* there was none) — a boundary that errors or recovers retracts its writes.
|
|
184
|
-
* Once the response head is `committed` (head derived/sent — the shell
|
|
185
|
-
* flush of a piped `renderToStream`, the completion of an awaited one,
|
|
186
|
-
* `createSSRResponse` for a `renderToString` result), writes and
|
|
187
|
-
* retractions are no-ops.
|
|
188
|
-
*/
|
|
189
|
-
export declare function httpHeader(_name: string, _value: string, _options?: {
|
|
190
|
-
append?: boolean;
|
|
191
|
-
}): void;
|
|
@@ -1,147 +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
|
-
* Set by `_SOLID_DEV_` substitution per artifact, exactly like the client
|
|
17
|
-
* entry: `dist/server.dev.*` (the `development` export condition) → `true`,
|
|
18
|
-
* `dist/server.*` → `false`. The server runtime's own `_SOLID_DEV_` gates are
|
|
19
|
-
* replaced by the same pass, so this flag and the bundle's internal behavior
|
|
20
|
-
* cannot disagree.
|
|
21
|
-
*/
|
|
22
|
-
export declare const isDev: boolean;
|
|
23
|
-
export type IntrinsicElement = Extract<keyof JSX.IntrinsicElements, string>;
|
|
24
|
-
export type ValidComponent = IntrinsicElement | Component<any> | (string & {});
|
|
25
|
-
export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
|
|
26
|
-
export interface DynamicOptions {
|
|
27
|
-
/**
|
|
28
|
-
* SSR only: hold the document's first flush until the source settles, so
|
|
29
|
-
* the resolved component renders into the shell instead of streaming in
|
|
30
|
-
* behind its boundary's fallback. Same meaning as `createMemo`'s
|
|
31
|
-
* `deferStream`. Default `false` — a `dynamic()` source is data of unknown
|
|
32
|
-
* cost and streams by default (a code-split `lazy()` always holds the shell
|
|
33
|
-
* for its module load, since its code is a prerequisite to the render).
|
|
34
|
-
*/
|
|
35
|
-
deferStream?: boolean;
|
|
36
|
-
}
|
|
37
|
-
export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false, options?: DynamicOptions): Component<ComponentProps<T>>;
|
|
38
|
-
export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
39
|
-
[K in keyof P]: P[K];
|
|
40
|
-
} & {
|
|
41
|
-
component: T | null | undefined | false;
|
|
42
|
-
};
|
|
43
|
-
export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
|
|
44
|
-
/**
|
|
45
|
-
* Portals are client-only islands: the server renders nothing for them —
|
|
46
|
-
* `props.children` is never evaluated, no async is started, and nothing is
|
|
47
|
-
* serialized. The client renders the content fresh once hydration settles.
|
|
48
|
-
* Throwing here instead (as earlier betas did) is strictly worse: an ancestor
|
|
49
|
-
* `Errored` catches it and bakes the error fallback into the streamed HTML
|
|
50
|
-
* for a tree that renders fine client-side (#2876).
|
|
51
|
-
*
|
|
52
|
-
* The one thing both sides must still agree on is the parent's child-id
|
|
53
|
-
* counter: the client Portal scopes its internals under one owner (one slot),
|
|
54
|
-
* so consume the matching slot here or every hydration id after the portal
|
|
55
|
-
* drifts.
|
|
56
|
-
*/
|
|
57
|
-
export declare function Portal(props: {
|
|
58
|
-
mount?: Element;
|
|
59
|
-
children: JSX.Element;
|
|
60
|
-
}): JSX.Element;
|
|
61
|
-
/**
|
|
62
|
-
* Server half of `clientOnly`: the wrapped component never renders on the
|
|
63
|
-
* server — the import is never even started — only `props.fallback` is
|
|
64
|
-
* SSR'd. The client build swaps the real component in after load + mount.
|
|
65
|
-
* See the client entry's JSDoc for the full contract.
|
|
66
|
-
*
|
|
67
|
-
* `moduleUrl` is injected by the bundler's module-URL pass (the same one
|
|
68
|
-
* that annotates `lazy()`, padding the options slot when a call site omits
|
|
69
|
-
* it); when present and an asset manifest is set, the render emits early
|
|
70
|
-
* preload hints for the module — see `registerClientOnlyPreload` for why
|
|
71
|
-
* they stay out of the hydration asset map. Without it (untransformed code)
|
|
72
|
-
* or without a manifest, behavior is unchanged.
|
|
73
|
-
*/
|
|
74
|
-
export declare function clientOnly<M extends Record<string, any>, K extends keyof M & string>(fn: () => Promise<M>, options: {
|
|
75
|
-
lazy?: boolean;
|
|
76
|
-
export: K;
|
|
77
|
-
}, moduleUrl?: string): Component<ComponentProps<M[K]> & {
|
|
78
|
-
fallback?: JSX.Element;
|
|
79
|
-
}>;
|
|
80
|
-
export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
|
|
81
|
-
default: T;
|
|
82
|
-
}>, options?: {
|
|
83
|
-
lazy?: boolean;
|
|
84
|
-
export?: string;
|
|
85
|
-
}, moduleUrl?: string): Component<ComponentProps<T> & {
|
|
86
|
-
fallback?: JSX.Element;
|
|
87
|
-
}>;
|
|
88
|
-
/**
|
|
89
|
-
* Declares the HTTP response status (and optional status text) for the
|
|
90
|
-
* lifetime of the current reactive scope during SSR, writing to the request
|
|
91
|
-
* event's `response` head (core's `ResponseStub`, exposed by the
|
|
92
|
-
* integration).
|
|
93
|
-
*
|
|
94
|
-
* Naming note — this is a scope-tied *declaration*, not a mutation: "while
|
|
95
|
-
* this reactive scope is live, the response has this status." Solid reserves
|
|
96
|
-
* `set*` verbs for event-time mutation; `httpStatus` is called bare in a
|
|
97
|
-
* component or reactive-scope body (like `createSignal`/`onCleanup`) and
|
|
98
|
-
* un-declares on scope disposal.
|
|
99
|
-
*
|
|
100
|
-
* Retraction semantics: disposal retracts only this scope's declaration —
|
|
101
|
-
* the response falls back to the latest still-live declaration, or to the
|
|
102
|
-
* base status the integration had set before the first declaration. A
|
|
103
|
-
* boundary that errored, declared a status, and then recovered retracts its
|
|
104
|
-
* write without stomping a status a surviving part of the tree legitimately
|
|
105
|
-
* set (e.g. a 404 page whose inner boundary recovers stays a 404), and
|
|
106
|
-
* sibling scopes may dispose in any order (#2984). Both the write and the
|
|
107
|
-
* cleanup are no-ops once the response head is `committed` (head
|
|
108
|
-
* derived/sent — status can no longer change). The head commits when it
|
|
109
|
-
* freezes: at shell flush for a piped `renderToStream` (`createSSRResponse`
|
|
110
|
-
* commits on the first write), at completion for an awaited one (the render
|
|
111
|
-
* commits right before its final dispose, so the declarations still live at
|
|
112
|
-
* that point are the ones the consumer derives the head from), and when
|
|
113
|
-
* `createSSRResponse` receives a `renderToString` result. On the client this
|
|
114
|
-
* is a no-op.
|
|
115
|
-
*/
|
|
116
|
-
export declare function httpStatus(code: number, text?: string): void;
|
|
117
|
-
/**
|
|
118
|
-
* Declares an HTTP response header (or with `append`, appends to one) for
|
|
119
|
-
* the lifetime of the current reactive scope during SSR, writing to the
|
|
120
|
-
* request event's `response` head (core's `ResponseStub`, exposed by the
|
|
121
|
-
* integration).
|
|
122
|
-
*
|
|
123
|
-
* Naming note — this is a scope-tied *declaration*, not a mutation: "while
|
|
124
|
-
* this reactive scope is live, the response has this header." Solid reserves
|
|
125
|
-
* `set*` verbs for event-time mutation; `httpHeader` is called bare in a
|
|
126
|
-
* component or reactive-scope body (like `createSignal`/`onCleanup`) and
|
|
127
|
-
* un-declares on scope disposal.
|
|
128
|
-
*
|
|
129
|
-
* Retraction semantics: disposal retracts only this scope's declaration —
|
|
130
|
-
* the header is recomputed by replaying the still-live declarations, in
|
|
131
|
-
* their original write order, over the base value the integration had set
|
|
132
|
-
* before the first declaration (deleted when there is neither). Sibling
|
|
133
|
-
* scopes may therefore dispose in any order without disturbing each
|
|
134
|
-
* other's contributions (#2984). For `set-cookie` — the one header whose
|
|
135
|
-
* multiple values must survive as separate entries — the base is captured
|
|
136
|
-
* and replayed entry-exact (`getSetCookie()` + re-append; `get()`/`set()`
|
|
137
|
-
* would comma-join the entries and then collapse them into one corrupt
|
|
138
|
-
* header). Both the write and the cleanup are no-ops once the response head
|
|
139
|
-
* is `committed` (head derived/sent — headers can no longer change); the
|
|
140
|
-
* head commits when it freezes — shell flush for a piped `renderToStream`,
|
|
141
|
-
* completion (right before the final dispose) for an awaited one,
|
|
142
|
-
* `createSSRResponse` for a `renderToString` result — see `httpStatus`. On
|
|
143
|
-
* the client this is a no-op.
|
|
144
|
-
*/
|
|
145
|
-
export declare function httpHeader(name: string, value: string, options?: {
|
|
146
|
-
append?: boolean;
|
|
147
|
-
}): 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;
|