@solidjs/web 2.0.0-rc.8 → 2.0.0-rc.9
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 +626 -125
- package/dist/server.js +433 -95
- package/dist/server.observe.js +3980 -0
- package/dist/web.dev.js +208 -60
- package/dist/web.js +175 -58
- package/dist/web.observe.js +175 -58
- package/frames/dist/client.dev.js +103 -4
- package/frames/dist/client.js +5 -2
- package/frames/dist/client.observe.js +2123 -0
- package/frames/dist/server.dev.js +521 -79
- package/frames/dist/server.js +352 -52
- package/frames/dist/server.observe.js +4946 -0
- package/frames/package.json +12 -0
- package/package.json +87 -3
- package/server-functions/dist/client.dev.js +1102 -0
- package/server-functions/dist/client.js +74 -69
- package/server-functions/dist/client.observe.js +1102 -0
- package/server-functions/dist/server.dev.js +402 -31
- package/server-functions/dist/server.js +339 -30
- package/server-functions/dist/server.observe.js +2726 -0
- package/server-functions/package.json +12 -0
- package/types/client.d.ts +22 -1
- package/types/diagnostics.d.ts +24 -0
- package/types/frames/frame-transport.d.ts +1 -1
- package/types/index.d.ts +25 -15
- package/types/index.server.d.ts +35 -8
- package/types/jsx.d.ts +15 -4
- package/types/observe.d.ts +294 -0
- package/types/response.d.ts +18 -0
- package/types/server-functions/client.d.ts +32 -22
- package/types/server-functions/server.d.ts +28 -37
- package/types/server-functions/shared.d.ts +39 -9
- package/types/server-mock.d.ts +26 -4
- package/types/server-observe.d.ts +39 -0
- package/types/server.d.ts +104 -5
- package/types/trace.d.ts +79 -0
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"browser": {
|
|
11
|
+
"development": {
|
|
12
|
+
"types": "../types/server-functions/client.d.ts",
|
|
13
|
+
"default": "./dist/client.dev.js"
|
|
14
|
+
},
|
|
15
|
+
"observe": {
|
|
16
|
+
"types": "../types/server-functions/client.d.ts",
|
|
17
|
+
"default": "./dist/client.observe.js"
|
|
18
|
+
},
|
|
11
19
|
"types": "../types/server-functions/client.d.ts",
|
|
12
20
|
"default": "./dist/client.js"
|
|
13
21
|
},
|
|
@@ -15,6 +23,10 @@
|
|
|
15
23
|
"types": "../types/server-functions/server.d.ts",
|
|
16
24
|
"default": "./dist/server.dev.js"
|
|
17
25
|
},
|
|
26
|
+
"observe": {
|
|
27
|
+
"types": "../types/server-functions/server.d.ts",
|
|
28
|
+
"default": "./dist/server.observe.js"
|
|
29
|
+
},
|
|
18
30
|
"types": "../types/server-functions/server.d.ts",
|
|
19
31
|
"default": "./dist/server.js"
|
|
20
32
|
}
|
package/types/client.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { getOwner, createComponent, untrack, merge as mergeProps } from "solid-js";
|
|
2
|
+
import type { ClientErrorHook } from "solid-js";
|
|
2
3
|
import { effect, memo } from "./render.js";
|
|
3
4
|
import { JSX } from "./jsx.js";
|
|
4
5
|
import type { RequestEventLocals } from "./server.js";
|
|
6
|
+
import type { TraceContext } from "./trace.js";
|
|
5
7
|
type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
|
|
6
8
|
/**
|
|
7
9
|
* A head tag descriptor. Props values may be getters (reactive on the
|
|
@@ -77,6 +79,8 @@ export interface RequestEvent {
|
|
|
77
79
|
locals: RequestEventLocals;
|
|
78
80
|
}
|
|
79
81
|
export type { CookieOptions } from "./cookies.js";
|
|
82
|
+
export type { CallEvent, CallListener, CallLive, FrameAppliedEvent, FrameEvent, FrameListener, FrameLive, FrameProducedEvent, InvocationEvent, InvocationListener, InvocationLive } from "./observe.js";
|
|
83
|
+
export type { TraceContext, TraceProvider, TraceSlot } from "./trace.js";
|
|
80
84
|
export type { ServerFunction, ServerFunctionMetadata, ServerFunctionRPC } from "./server-functions/shared.js";
|
|
81
85
|
export declare const waitAsset: (promise: Promise<unknown>) => void;
|
|
82
86
|
export { DOMWithState, ChildProperties, DOMElements, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DelegatedEvents } from "./constants.js";
|
|
@@ -99,6 +103,12 @@ export { effect, memo, untrack, getOwner, createComponent };
|
|
|
99
103
|
*/
|
|
100
104
|
export { mergeProps };
|
|
101
105
|
export declare const getRequestEvent: () => RequestEvent | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Client stub — the trace a request belongs to is a server-side reading
|
|
108
|
+
* (the incoming `traceparent`, the render's origination); the browser SDK
|
|
109
|
+
* that continues it reads the document's `<meta>`/`Server-Timing` instead.
|
|
110
|
+
*/
|
|
111
|
+
export declare const getTraceContext: () => TraceContext | undefined;
|
|
102
112
|
export { parseCookieHeader, serializeCookie } from "./cookies.js";
|
|
103
113
|
export { clearFlashCookie, hasFlashCookie } from "./cookies.js";
|
|
104
114
|
export { getServerFunctionMetadata, getServerFunctionRPC, isServerFunction } from "./server-functions/registry.js";
|
|
@@ -119,6 +129,14 @@ export { getServerFunctionMetadata, getServerFunctionRPC, isServerFunction } fro
|
|
|
119
129
|
export declare function render(code: () => JSX.Element, element: MountableElement, init?: JSX.Element, options?: {
|
|
120
130
|
owner?: unknown;
|
|
121
131
|
renderId?: string;
|
|
132
|
+
/**
|
|
133
|
+
* This root's client error hook, ahead of `configureClientErrors`':
|
|
134
|
+
* every failure an error boundary under it renders a fallback for —
|
|
135
|
+
* the one event no global handler sees (an uncaught error halts the
|
|
136
|
+
* reactive system and reaches `reportError` / `window.onerror`). Once
|
|
137
|
+
* per error object; no return — the client has no wire to map for.
|
|
138
|
+
*/
|
|
139
|
+
onError?: ClientErrorHook;
|
|
122
140
|
}): () => void;
|
|
123
141
|
export declare function template(html: string, flag?: 1 | 2): () => Element;
|
|
124
142
|
export declare function delegateEvents(eventNames: string[]): void;
|
|
@@ -157,8 +175,10 @@ export declare function style(node: Element, value: {
|
|
|
157
175
|
* read per key; a clsx-style class array is re-mapped element-wise (className
|
|
158
176
|
* allocates for an array anyway; measured at parity). */
|
|
159
177
|
export declare function readShallow(value: unknown): unknown;
|
|
178
|
+
/** Compiler-emitted primitive; not for hand-written code. @internal */
|
|
160
179
|
export declare function setStyleProperty(node: Element, name: string, value: any): void;
|
|
161
|
-
export declare function spread
|
|
180
|
+
export declare function spread(node: Element, sources: unknown[], skipChildren?: Boolean, skip?: (key: string) => boolean): void;
|
|
181
|
+
export declare function spread<T>(node: Element, accessor: T, skipChildren?: Boolean, skip?: (key: string) => boolean): void;
|
|
162
182
|
export declare function dynamicProperty(props: unknown, key: string): unknown;
|
|
163
183
|
export declare function applyRef<T extends Element = Element>(r: ((element: NoInfer<T>) => void) | ((element: NoInfer<T>) => void)[], element: T): void;
|
|
164
184
|
export declare function ref(fn: () => ((element: Element) => void) | ((element: Element) => void)[], element: Element): void;
|
|
@@ -203,6 +223,7 @@ export declare function useHead(tag: HeadTag | HeadTag[] | (() => HeadTag | Head
|
|
|
203
223
|
export declare function hydrate(fn: () => JSX.Element, node: MountableElement, options?: {
|
|
204
224
|
renderId?: string;
|
|
205
225
|
owner?: unknown;
|
|
226
|
+
onError?: ClientErrorHook;
|
|
206
227
|
}): () => void;
|
|
207
228
|
export declare function getNextElement(template?: () => Element): Element;
|
|
208
229
|
export declare function getNextMatch(start: Node, elementName: string): Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type DiagnosticEvent } from "solid-js";
|
|
2
|
+
export type Finding = Omit<DiagnosticEvent, "sequence">;
|
|
3
|
+
/**
|
|
4
|
+
* Records a finding — observe and dev tiers — and, in dev, reports it on the
|
|
5
|
+
* console. `subject` locates it (the current server owner by default; its
|
|
6
|
+
* component labels give the `ownerPath`); pass `null` for a finding with no
|
|
7
|
+
* location by nature (a stream event). No-op in prod.
|
|
8
|
+
*/
|
|
9
|
+
export declare function emitFinding(finding: Finding, subject?: unknown): void;
|
|
10
|
+
/**
|
|
11
|
+
* The structured record alone, for a site that THROWS its message: the
|
|
12
|
+
* thrown error is the console face and the core lands the once-per-code
|
|
13
|
+
* footer beneath it. Reporting as well would print the finding twice.
|
|
14
|
+
*/
|
|
15
|
+
export declare function recordFinding(finding: Finding, subject?: unknown): void;
|
|
16
|
+
/**
|
|
17
|
+
* A dev CHECK: `emitFinding` behind the dev gate, so the site reads as one
|
|
18
|
+
* call and the observe and prod artifacts carry none of it. Extra console
|
|
19
|
+
* arguments (the offending descriptor, the caught error) go on `data` — the
|
|
20
|
+
* structured record keeps them, the console face prints the message.
|
|
21
|
+
*/
|
|
22
|
+
export declare function devCheck(finding: Finding, subject?: unknown): void;
|
|
23
|
+
/** `Name: message` for an Error, `String(value)` otherwise. */
|
|
24
|
+
export declare function errorText(error: unknown): string;
|
|
@@ -98,7 +98,7 @@ export declare const FRAME_STREAM_HEADER = "X-Frame-Stream"; /**
|
|
|
98
98
|
* @experimental
|
|
99
99
|
*/
|
|
100
100
|
export declare function isFrameStreamResponse(response: Response): boolean;
|
|
101
|
-
export declare
|
|
101
|
+
export declare const applyFrameResponse: (response: Response, host: FrameHost, options?: ApplyFrameResponseOptions) => Promise<string>;
|
|
102
102
|
/** Brands an inline-rendered server component with its function id. */
|
|
103
103
|
export declare const SERVER_COMPONENT: unique symbol;
|
|
104
104
|
/** The unwrapped server component behind an inline-render wrap. */
|
package/types/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export declare const isDev: boolean;
|
|
|
46
46
|
export type IntrinsicElement = Extract<keyof JSX.IntrinsicElements, string>;
|
|
47
47
|
export type ValidComponent = IntrinsicElement | Component<any> | (string & {});
|
|
48
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()`. */
|
|
49
50
|
export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
50
51
|
[K in keyof P]: P[K];
|
|
51
52
|
} & {
|
|
@@ -86,22 +87,32 @@ export interface DynamicOptions {
|
|
|
86
87
|
* `deferStream`. Ignored on the client.
|
|
87
88
|
*/
|
|
88
89
|
deferStream?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* The source cannot change: call it once, untracked, now, and render the
|
|
92
|
+
* result with no computation per instance (see `dynamic`). The source must
|
|
93
|
+
* resolve synchronously.
|
|
94
|
+
*/
|
|
95
|
+
static?: boolean;
|
|
89
96
|
}
|
|
90
|
-
export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false,
|
|
97
|
+
export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false, options?: DynamicOptions): Component<ComponentProps<T>>;
|
|
91
98
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
99
|
+
* @deprecated Use `dynamic()`. `<Dynamic>` is the same primitive, but its
|
|
100
|
+
* shape puts the tag in the same bag as the element's props: every instance
|
|
101
|
+
* merges `component` in at the call site, `omit()`s it back out here, and
|
|
102
|
+
* builds a fresh `dynamic()` factory (with its memo) because there is nowhere
|
|
103
|
+
* to hoist one. `dynamic()` has none of that and is one line longer:
|
|
94
104
|
*
|
|
95
|
-
* @example
|
|
96
105
|
* ```tsx
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
106
|
+
* // before
|
|
107
|
+
* <Dynamic component={multiline() ? RichTextEditor : "input"} value={value()} />
|
|
108
|
+
*
|
|
109
|
+
* // after — hoist per component instance (or per module for a constant)
|
|
110
|
+
* const Field = dynamic(() => multiline() ? RichTextEditor : "input");
|
|
111
|
+
* <Field value={value()} />
|
|
102
112
|
* ```
|
|
103
113
|
*
|
|
104
|
-
*
|
|
114
|
+
* Remains available in 2.0 (deprecated, no runtime warning); prefer `dynamic()`
|
|
115
|
+
* in new code.
|
|
105
116
|
*/
|
|
106
117
|
export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
|
|
107
118
|
/**
|
|
@@ -162,8 +173,8 @@ export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
|
|
|
162
173
|
* then recovered retracts its write instead of stomping a status a
|
|
163
174
|
* surviving part of the tree legitimately set. Once the response head is
|
|
164
175
|
* `committed` (head derived/sent — the shell flush of a piped
|
|
165
|
-
* `renderToStream`, the completion of an awaited one
|
|
166
|
-
*
|
|
176
|
+
* `renderToStream`, the completion of an awaited one or of
|
|
177
|
+
* `renderToString`), writes and retractions are no-ops.
|
|
167
178
|
*/
|
|
168
179
|
export declare function httpStatus(_code: number, _text?: string): void;
|
|
169
180
|
/**
|
|
@@ -182,9 +193,8 @@ export declare function httpStatus(_code: number, _text?: string): void;
|
|
|
182
193
|
* write time and restored when the owning scope is disposed (deleted if
|
|
183
194
|
* there was none) — a boundary that errors or recovers retracts its writes.
|
|
184
195
|
* Once the response head is `committed` (head derived/sent — the shell
|
|
185
|
-
* flush of a piped `renderToStream`, the completion of an awaited one
|
|
186
|
-
*
|
|
187
|
-
* retractions are no-ops.
|
|
196
|
+
* flush of a piped `renderToStream`, the completion of an awaited one or
|
|
197
|
+
* of `renderToString`), writes and retractions are no-ops.
|
|
188
198
|
*/
|
|
189
199
|
export declare function httpHeader(_name: string, _value: string, _options?: {
|
|
190
200
|
append?: boolean;
|
package/types/index.server.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type Component } from "solid-js";
|
|
|
2
2
|
import type { JSX } from "./jsx.js";
|
|
3
3
|
export * from "./server.js";
|
|
4
4
|
export * from "./response.js";
|
|
5
|
+
export type { CallEvent, CallListener, CallLive, FrameAppliedEvent, FrameEvent, FrameListener, FrameLive, FrameProducedEvent, InvocationEvent, InvocationListener, InvocationLive } from "./observe.js";
|
|
6
|
+
export type { TraceContext, TraceProvider, TraceSlot } from "./trace.js";
|
|
5
7
|
export type { JSX } from "./jsx.js";
|
|
6
8
|
export { For, Show, Loading, Reveal, Switch, Match, Repeat, Errored, NoHydration, Hydration } from "solid-js";
|
|
7
9
|
/**
|
|
@@ -33,13 +35,39 @@ export interface DynamicOptions {
|
|
|
33
35
|
* for its module load, since its code is a prerequisite to the render).
|
|
34
36
|
*/
|
|
35
37
|
deferStream?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The source cannot change: call it once, untracked, now, and render the
|
|
40
|
+
* result with no computation per instance (see the client `dynamic`). The
|
|
41
|
+
* source must resolve synchronously.
|
|
42
|
+
*/
|
|
43
|
+
static?: boolean;
|
|
36
44
|
}
|
|
37
45
|
export declare function dynamic<T extends ValidComponent>(source: () => T | Promise<T> | null | undefined | false, options?: DynamicOptions): Component<ComponentProps<T>>;
|
|
46
|
+
/** @deprecated Props of the deprecated `<Dynamic>`; see `dynamic()`. */
|
|
38
47
|
export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
39
48
|
[K in keyof P]: P[K];
|
|
40
49
|
} & {
|
|
41
50
|
component: T | null | undefined | false;
|
|
42
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated Use `dynamic()`. `<Dynamic>` is the same primitive, but its
|
|
54
|
+
* shape puts the tag in the same bag as the element's props: every instance
|
|
55
|
+
* merges `component` in at the call site, `omit()`s it back out here, and
|
|
56
|
+
* builds a fresh `dynamic()` factory (with its memo) because there is nowhere
|
|
57
|
+
* to hoist one. `dynamic()` has none of that and is one line longer:
|
|
58
|
+
*
|
|
59
|
+
* ```tsx
|
|
60
|
+
* // before
|
|
61
|
+
* <Dynamic component={multiline() ? RichTextEditor : "input"} value={value()} />
|
|
62
|
+
*
|
|
63
|
+
* // after — hoist per component instance (or per module for a constant)
|
|
64
|
+
* const Field = dynamic(() => multiline() ? RichTextEditor : "input");
|
|
65
|
+
* <Field value={value()} />
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* Remains available in 2.0 (deprecated, no runtime warning); prefer `dynamic()`
|
|
69
|
+
* in new code.
|
|
70
|
+
*/
|
|
43
71
|
export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
|
|
44
72
|
/**
|
|
45
73
|
* Portals are client-only islands: the server renders nothing for them —
|
|
@@ -107,11 +135,11 @@ export declare function clientOnly<T extends Component<any>>(fn: () => Promise<{
|
|
|
107
135
|
* cleanup are no-ops once the response head is `committed` (head
|
|
108
136
|
* derived/sent — status can no longer change). The head commits when it
|
|
109
137
|
* freezes: at shell flush for a piped `renderToStream` (`createSSRResponse`
|
|
110
|
-
* commits on the first write), at completion for an awaited one
|
|
111
|
-
* commits right before its final dispose, so
|
|
112
|
-
* that point are the ones the consumer
|
|
113
|
-
*
|
|
114
|
-
* is a no-op.
|
|
138
|
+
* commits on the first write), and at completion for an awaited one or for
|
|
139
|
+
* `renderToString` (the render commits right before its final dispose, so
|
|
140
|
+
* the declarations still live at that point are the ones the consumer
|
|
141
|
+
* derives the head from; `createSSRResponse` then passes the committed stub
|
|
142
|
+
* through). On the client this is a no-op.
|
|
115
143
|
*/
|
|
116
144
|
export declare function httpStatus(code: number, text?: string): void;
|
|
117
145
|
/**
|
|
@@ -138,9 +166,8 @@ export declare function httpStatus(code: number, text?: string): void;
|
|
|
138
166
|
* header). Both the write and the cleanup are no-ops once the response head
|
|
139
167
|
* is `committed` (head derived/sent — headers can no longer change); the
|
|
140
168
|
* head commits when it freezes — shell flush for a piped `renderToStream`,
|
|
141
|
-
* completion (right before the final dispose) for an awaited one
|
|
142
|
-
* `
|
|
143
|
-
* the client this is a no-op.
|
|
169
|
+
* completion (right before the final dispose) for an awaited one and for
|
|
170
|
+
* `renderToString` — see `httpStatus`. On the client this is a no-op.
|
|
144
171
|
*/
|
|
145
172
|
export declare function httpHeader(name: string, value: string, options?: {
|
|
146
173
|
append?: boolean;
|
package/types/jsx.d.ts
CHANGED
|
@@ -1109,7 +1109,17 @@ export namespace JSX {
|
|
|
1109
1109
|
type HTMLPreloadAs = "fetch" | "font" | "image" | "script" | "style" | "track";
|
|
1110
1110
|
type HTMLLinkAs = HTMLPreloadAs | "audio" | "document" | "embed" | "object" | "video" | "worker";
|
|
1111
1111
|
|
|
1112
|
-
|
|
1112
|
+
/**
|
|
1113
|
+
* `xmlns` on the tags that exist in both HTML and SVG (`a`, `script`, `style`,
|
|
1114
|
+
* `title`). The compiler reads it to pick the namespace when the tag is not
|
|
1115
|
+
* nested under `<svg>` at compile time (e.g. an XML partial), and `dynamic()`
|
|
1116
|
+
* honors it the same way when creating a tag-name element at runtime.
|
|
1117
|
+
*/
|
|
1118
|
+
interface AmbiguousNamespaceAttributes {
|
|
1119
|
+
xmlns?: string | RemoveAttribute;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
interface AnchorHTMLAttributes<T> extends HTMLAttributes<T>, AmbiguousNamespaceAttributes {
|
|
1113
1123
|
download?: string | EnumeratedAcceptsEmpty | RemoveAttribute;
|
|
1114
1124
|
href?: string | SerializableAttributeValue | RemoveAttribute;
|
|
1115
1125
|
hreflang?: string | RemoveAttribute;
|
|
@@ -1698,7 +1708,7 @@ export namespace JSX {
|
|
|
1698
1708
|
max?: number | string | RemoveAttribute;
|
|
1699
1709
|
value?: string | string[] | number | RemoveAttribute;
|
|
1700
1710
|
}
|
|
1701
|
-
interface ScriptHTMLAttributes<T> extends HTMLAttributes<T
|
|
1711
|
+
interface ScriptHTMLAttributes<T> extends HTMLAttributes<T>, AmbiguousNamespaceAttributes {
|
|
1702
1712
|
async?: BooleanAttribute | RemoveAttribute;
|
|
1703
1713
|
blocking?: "render" | RemoveAttribute;
|
|
1704
1714
|
crossorigin?: HTMLCrossorigin | RemoveAttribute;
|
|
@@ -1760,7 +1770,7 @@ export namespace JSX {
|
|
|
1760
1770
|
type?: string | RemoveAttribute;
|
|
1761
1771
|
width?: number | string | RemoveAttribute;
|
|
1762
1772
|
}
|
|
1763
|
-
interface StyleHTMLAttributes<T> extends HTMLAttributes<T
|
|
1773
|
+
interface StyleHTMLAttributes<T> extends HTMLAttributes<T>, AmbiguousNamespaceAttributes {
|
|
1764
1774
|
blocking?: "render" | RemoveAttribute;
|
|
1765
1775
|
media?: string | RemoveAttribute;
|
|
1766
1776
|
|
|
@@ -1861,6 +1871,7 @@ export namespace JSX {
|
|
|
1861
1871
|
interface TimeHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1862
1872
|
datetime?: string | RemoveAttribute;
|
|
1863
1873
|
}
|
|
1874
|
+
interface TitleHTMLAttributes<T> extends HTMLAttributes<T>, AmbiguousNamespaceAttributes {}
|
|
1864
1875
|
interface TrackHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
1865
1876
|
default?: BooleanAttribute | RemoveAttribute;
|
|
1866
1877
|
kind?:
|
|
@@ -3589,7 +3600,7 @@ export namespace JSX {
|
|
|
3589
3600
|
* @url https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title
|
|
3590
3601
|
* @url https://developer.mozilla.org/en-US/docs/Web/API/HTMLTitleElement
|
|
3591
3602
|
*/
|
|
3592
|
-
title:
|
|
3603
|
+
title: TitleHTMLAttributes<HTMLTitleElement> & Properties<HTMLTitleElement>;
|
|
3593
3604
|
/**
|
|
3594
3605
|
* @url https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr
|
|
3595
3606
|
* @url https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import type { ChangeOrigin, Records } from "solid-js";
|
|
2
|
+
import type { RequestEvent } from "./server.js";
|
|
3
|
+
/**
|
|
4
|
+
* The records channel — `OBSERVE.records` — or `undefined` outside observe
|
|
5
|
+
* builds and where no observing core has loaded. An emitter's first check.
|
|
6
|
+
*/
|
|
7
|
+
export declare function records(): Records | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* One server function execution, delivered on
|
|
10
|
+
* `OBSERVE.records.subscribe("invocation", …)` once it settled.
|
|
11
|
+
* Serializable — the live handles (`event`, `args`, the thrown error)
|
|
12
|
+
* travel beside it in `InvocationLive`, not on it.
|
|
13
|
+
*/
|
|
14
|
+
export interface InvocationEvent {
|
|
15
|
+
/** The function id — the name a span or a log line carries. */
|
|
16
|
+
id: string;
|
|
17
|
+
/** `true` for an in-process call during SSR, `false` for HTTP dispatch. */
|
|
18
|
+
direct: boolean;
|
|
19
|
+
/** `performance.now()` when the execution started. */
|
|
20
|
+
at: number;
|
|
21
|
+
/**
|
|
22
|
+
* Start → settle of the execution, in milliseconds. The execution is the
|
|
23
|
+
* `wrapInvocation`-wrapped run: what the request spent on the call,
|
|
24
|
+
* policy included (auth guards, per-function middleware). A generator or
|
|
25
|
+
* stream body settles at handoff — see `deferred`.
|
|
26
|
+
*/
|
|
27
|
+
durationMs: number;
|
|
28
|
+
outcome: "ok" | "error";
|
|
29
|
+
/**
|
|
30
|
+
* The settled value is a body the caller drives — a generator, a
|
|
31
|
+
* `ReadableStream` — so `durationMs` covers the call that produced it,
|
|
32
|
+
* not its consumption.
|
|
33
|
+
*/
|
|
34
|
+
deferred?: true;
|
|
35
|
+
/**
|
|
36
|
+
* Direct calls only: the hydration id of the `<Loading>` boundary whose
|
|
37
|
+
* render pass made the call — the `id` of that boundary's `"boundary"`
|
|
38
|
+
* record — so a boundary's wait can be read as the server-function calls
|
|
39
|
+
* it consisted of. Absent for a call outside any boundary's pass (the
|
|
40
|
+
* shell, or HTTP dispatch).
|
|
41
|
+
*/
|
|
42
|
+
boundary?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The live half of an invocation, for in-process consumers. Not part of the
|
|
46
|
+
* record: `args` and `result` are application data (name/PII policy belongs
|
|
47
|
+
* to the consumer), `error` is the value AS THROWN — before the HTTP
|
|
48
|
+
* handler's production sanitization replaces it on the wire — and `event`
|
|
49
|
+
* is the request event the call ran under (the per-call derived event for
|
|
50
|
+
* direct calls).
|
|
51
|
+
*/
|
|
52
|
+
export interface InvocationLive {
|
|
53
|
+
event: RequestEvent;
|
|
54
|
+
/** HTTP dispatch only; absent for direct calls. */
|
|
55
|
+
request?: Request;
|
|
56
|
+
args: unknown[];
|
|
57
|
+
/** The settled value, when `outcome` is `"ok"`. */
|
|
58
|
+
result?: unknown;
|
|
59
|
+
/** The thrown value, when `outcome` is `"error"`. */
|
|
60
|
+
error?: unknown;
|
|
61
|
+
}
|
|
62
|
+
export type InvocationListener = (event: InvocationEvent, live: InvocationLive) => void;
|
|
63
|
+
/**
|
|
64
|
+
* One server-function call made from the browser — the fetch and its
|
|
65
|
+
* decode, as the caller awaited it — delivered on
|
|
66
|
+
* `OBSERVE.records.subscribe("call", …)` once it settled. The client twin
|
|
67
|
+
* of the server's `"invocation"` record: the two join by `id` (this is the
|
|
68
|
+
* call; that is the execution it caused), and the difference between their
|
|
69
|
+
* durations is the wire. A call an integration answered locally (a
|
|
70
|
+
* handler's `intercept`, at t = 0) made no request and emits nothing.
|
|
71
|
+
*/
|
|
72
|
+
export interface CallEvent {
|
|
73
|
+
/** The function id — the same `id` the server's `"invocation"` record carries. */
|
|
74
|
+
id: string;
|
|
75
|
+
/** `performance.now()` when the call was made. */
|
|
76
|
+
at: number;
|
|
77
|
+
/**
|
|
78
|
+
* Call → settle, in milliseconds: the request built and sent, the
|
|
79
|
+
* response received and decoded (or claimed by the configured
|
|
80
|
+
* `responseHandler`) — the whole await the caller saw. A streaming
|
|
81
|
+
* result settles at handoff — see `deferred`.
|
|
82
|
+
*/
|
|
83
|
+
durationMs: number;
|
|
84
|
+
/** `GET` for a GET-encoded read (`GET(fn)`), `POST` otherwise. */
|
|
85
|
+
method: "GET" | "POST";
|
|
86
|
+
outcome: "ok" | "error";
|
|
87
|
+
/**
|
|
88
|
+
* The response's HTTP status, once one arrived. Absent when the call
|
|
89
|
+
* failed before a response (the fetch itself rejected).
|
|
90
|
+
*/
|
|
91
|
+
status?: number;
|
|
92
|
+
/**
|
|
93
|
+
* What the call ran for, when the attribution engine
|
|
94
|
+
* (`solid-js/attribution`) is enabled and knows: the interaction whose
|
|
95
|
+
* handler made it (`kind: "interaction"`), the navigation whose data
|
|
96
|
+
* needed it (`kind: "navigation"`, its `interaction` the click), the
|
|
97
|
+
* effect or action step, the async landing whose recompute called again —
|
|
98
|
+
* the engine's own origin object, so it IS `InteractionEvent.origin` /
|
|
99
|
+
* `NavigationEvent.origin` / `HoldEvent.origin` by identity: an observer
|
|
100
|
+
* puts the call under the interaction's record without a time join. Read
|
|
101
|
+
* at dispatch, so a call made after an `await` in a handler stamps
|
|
102
|
+
* nothing (the same escape a write there has). Absent without an engine.
|
|
103
|
+
*/
|
|
104
|
+
origin?: ChangeOrigin;
|
|
105
|
+
/**
|
|
106
|
+
* The settled value is a body the caller drives — an async iterable
|
|
107
|
+
* (a `live()` source, a generator result) — so `durationMs` covers the
|
|
108
|
+
* call that produced it, not its consumption.
|
|
109
|
+
*/
|
|
110
|
+
deferred?: true;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The live half of a call, for in-process consumers. `response` is the
|
|
114
|
+
* transport's own object, not a clone: its status and headers are
|
|
115
|
+
* readable, its body is the decode's (already consumed, or being consumed
|
|
116
|
+
* by the caller for a streaming result). `error` is the value as thrown to
|
|
117
|
+
* the caller — a decoded server error, or the transport's own failure.
|
|
118
|
+
*/
|
|
119
|
+
export interface CallLive {
|
|
120
|
+
args: unknown[];
|
|
121
|
+
response?: Response;
|
|
122
|
+
/** The settled value, when `outcome` is `"ok"`. */
|
|
123
|
+
result?: unknown;
|
|
124
|
+
/** The thrown value, when `outcome` is `"error"`. */
|
|
125
|
+
error?: unknown;
|
|
126
|
+
}
|
|
127
|
+
export type CallListener = (event: CallEvent, live: CallLive) => void;
|
|
128
|
+
interface FrameEventBase {
|
|
129
|
+
/**
|
|
130
|
+
* The frame id on the wire: the server function's id when the stream is a
|
|
131
|
+
* server-function response (the same `id` that call's `"invocation"` and
|
|
132
|
+
* `"call"` records carry), or what the producer named it; `""` for a bare
|
|
133
|
+
* `renderToFrameStream` with no `frame` option.
|
|
134
|
+
*/
|
|
135
|
+
id: string;
|
|
136
|
+
/**
|
|
137
|
+
* The stream version: as the producer stamped it on the server; as the
|
|
138
|
+
* client restamped it on the client (the consumer owns versions — one
|
|
139
|
+
* per stream a boundary consumed — so this is the number the frame's
|
|
140
|
+
* stale-guard saw).
|
|
141
|
+
*/
|
|
142
|
+
version: number;
|
|
143
|
+
/** `performance.now()` at the stream's `start` chunk — written, or read. */
|
|
144
|
+
at: number;
|
|
145
|
+
/**
|
|
146
|
+
* Start → `complete`, in milliseconds: the whole stream, fragments
|
|
147
|
+
* included. On the client this is the body's read and apply — the
|
|
148
|
+
* request that produced the response is the `"call"` record's time.
|
|
149
|
+
*/
|
|
150
|
+
durationMs: number;
|
|
151
|
+
/**
|
|
152
|
+
* Start → the shell (`html`) chunk, in milliseconds: the time to first
|
|
153
|
+
* content. Absent when the stream carried no shell (the server's
|
|
154
|
+
* synchronous failure path).
|
|
155
|
+
*/
|
|
156
|
+
shellMs?: number;
|
|
157
|
+
/** Chunks between `start` and `complete` (exclusive), all types. */
|
|
158
|
+
chunks: number;
|
|
159
|
+
/** `fragment` chunks: `<Loading>` content that settled after the shell. */
|
|
160
|
+
fragments: number;
|
|
161
|
+
/** `slot` chunks: render-prop invocations the client fills. */
|
|
162
|
+
slots: number;
|
|
163
|
+
/**
|
|
164
|
+
* Nested server-content regions (a server JSX slot argument): `html`
|
|
165
|
+
* chunks addressed to a child frame id rather than the stream's own.
|
|
166
|
+
*/
|
|
167
|
+
regions: number;
|
|
168
|
+
/** `error` chunks: fragments that failed (their fallback still revealed), plus a sync failure. */
|
|
169
|
+
errors: number;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The server half of a `"frame"` record: one frame stream produced — a
|
|
173
|
+
* server component rendered to the frame transport
|
|
174
|
+
* (`renderServerComponent` / `renderToFrameStream`), from its `start`
|
|
175
|
+
* chunk to its `complete` — delivered once it completed.
|
|
176
|
+
*/
|
|
177
|
+
export interface FrameProducedEvent extends FrameEventBase {
|
|
178
|
+
side: "server";
|
|
179
|
+
/**
|
|
180
|
+
* `complete` — the render ran to the end (fragment failures, if any, are
|
|
181
|
+
* in `errors`); `error` — the render threw synchronously, the stream
|
|
182
|
+
* carried the failure as its only content and completed.
|
|
183
|
+
*/
|
|
184
|
+
outcome: "complete" | "error";
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The client half of a `"frame"` record: one frame stream applied — a
|
|
188
|
+
* frame-stream response read chunk by chunk into the frame host
|
|
189
|
+
* (`applyFrameResponse`), from its `start` to its `complete` — delivered
|
|
190
|
+
* once the stream ended. A single-flight response carries one stream per
|
|
191
|
+
* frame it refreshed; each is its own record, as on the server.
|
|
192
|
+
*/
|
|
193
|
+
export interface FrameAppliedEvent extends FrameEventBase {
|
|
194
|
+
side: "client";
|
|
195
|
+
/**
|
|
196
|
+
* The local id the chunks were applied under, when the consumer remapped
|
|
197
|
+
* the producer's root id onto its own boundary (`applyFrameResponse`'s
|
|
198
|
+
* `as` — the call's address, for the server-component transport).
|
|
199
|
+
* Absent when applied under the wire id.
|
|
200
|
+
*/
|
|
201
|
+
address?: string;
|
|
202
|
+
/**
|
|
203
|
+
* `complete` — the `complete` chunk arrived; `truncated` — the body ended
|
|
204
|
+
* before it (the connection dropped, the producer abandoned the stream);
|
|
205
|
+
* `error` — the read failed (a malformed chunk, a body error), with the
|
|
206
|
+
* failure in `live.error`.
|
|
207
|
+
*/
|
|
208
|
+
outcome: "complete" | "truncated" | "error";
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* One frame stream, from whichever end observed it — delivered on
|
|
212
|
+
* `OBSERVE.records.subscribe("frame", …)`; `side` says which. The two
|
|
213
|
+
* halves share their shape (the same census, the same timings measured
|
|
214
|
+
* where each stands), so a consumer joins them by `id` and `version` and
|
|
215
|
+
* the difference is the wire.
|
|
216
|
+
*/
|
|
217
|
+
export type FrameEvent = FrameProducedEvent | FrameAppliedEvent;
|
|
218
|
+
/** The live half of a frame record. */
|
|
219
|
+
export interface FrameLive {
|
|
220
|
+
/** The value thrown: the server's sync failure, or the client's read failure. */
|
|
221
|
+
error?: unknown;
|
|
222
|
+
/** Client only: the response the stream was read from. */
|
|
223
|
+
response?: Response;
|
|
224
|
+
}
|
|
225
|
+
export type FrameListener = (event: FrameEvent, live: FrameLive) => void;
|
|
226
|
+
declare module "solid-js" {
|
|
227
|
+
interface HostRecordTypes {
|
|
228
|
+
/** Server-function executions, on the server — see `InvocationEvent`. */
|
|
229
|
+
invocation: {
|
|
230
|
+
event: InvocationEvent;
|
|
231
|
+
live: InvocationLive;
|
|
232
|
+
};
|
|
233
|
+
/** Server-function calls, from the client — see `CallEvent`. */
|
|
234
|
+
call: {
|
|
235
|
+
event: CallEvent;
|
|
236
|
+
live: CallLive;
|
|
237
|
+
};
|
|
238
|
+
/** Frame streams, produced or applied — see `FrameEvent`. */
|
|
239
|
+
frame: {
|
|
240
|
+
event: FrameEvent;
|
|
241
|
+
live: FrameLive;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
export declare function settledPromise(value: unknown): Promise<unknown> | undefined;
|
|
246
|
+
export declare function isDeferredBody(value: unknown): boolean;
|
|
247
|
+
/**
|
|
248
|
+
* The census one frame stream's chunks add up to, kept by either half: one
|
|
249
|
+
* chunk of `type`, addressed to the stream's own frame (`own`) or to a
|
|
250
|
+
* nested region's.
|
|
251
|
+
*/
|
|
252
|
+
export declare function frameCensus(event: FrameEventBase, type: string, own: boolean): void;
|
|
253
|
+
/** What the client runtime hands a call observation as the call proceeds. */
|
|
254
|
+
export interface CallObservation {
|
|
255
|
+
/** The response arrived (before decode); its status goes on the record. */
|
|
256
|
+
response(response: Response): void;
|
|
257
|
+
/** The call settled as the caller sees it: the value returned, or the error thrown. */
|
|
258
|
+
settle(outcome: "ok" | "error", value: unknown): void;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Opens the observation of one server-function call from the client, as
|
|
262
|
+
* the request is about to be built; the runtime reports the response when
|
|
263
|
+
* it arrives and the settle when the caller gets its answer. `undefined`
|
|
264
|
+
* with no listener or outside observe builds — the runtime then does
|
|
265
|
+
* nothing extra, not even read the clock.
|
|
266
|
+
*/
|
|
267
|
+
export declare function observeCall(id: string, method: "GET" | "POST", args: unknown[]): CallObservation | undefined;
|
|
268
|
+
/** What the client's stream reader hands a frame observation. */
|
|
269
|
+
export interface FrameApplyObservation {
|
|
270
|
+
/**
|
|
271
|
+
* Every chunk read, after the consumer's remapping (`as`, `version`) —
|
|
272
|
+
* `wireId` is the id the chunk carried before it.
|
|
273
|
+
*/
|
|
274
|
+
chunk(chunk: {
|
|
275
|
+
type: string;
|
|
276
|
+
id: string;
|
|
277
|
+
version: number;
|
|
278
|
+
}, wireId: string): void;
|
|
279
|
+
/**
|
|
280
|
+
* The apply ended — cleanly, or with the failure it threw (a read that
|
|
281
|
+
* failed, a chunk that would not parse, a host that rejected a chunk).
|
|
282
|
+
*/
|
|
283
|
+
end(error?: unknown): void;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Opens the observation of one frame-stream response on the client: every
|
|
287
|
+
* `start` chunk opens a stream record (a single-flight response carries
|
|
288
|
+
* several, in sequence), every chunk until its `complete` is counted to
|
|
289
|
+
* it, and the record is delivered at `complete` — or at the body's end as
|
|
290
|
+
* `truncated`, or at a read failure as `error`. `undefined` with no
|
|
291
|
+
* listener or outside observe builds.
|
|
292
|
+
*/
|
|
293
|
+
export declare function observeFrameApply(response: Response): FrameApplyObservation | undefined;
|
|
294
|
+
export {};
|
package/types/response.d.ts
CHANGED
|
@@ -46,8 +46,26 @@ export declare function isSafeError(value: unknown): value is Error;
|
|
|
46
46
|
* (prefixes, exact names, namespaces) is the integration's business.
|
|
47
47
|
*/
|
|
48
48
|
export declare const REVALIDATE_HEADER = "X-Revalidate";
|
|
49
|
+
/**
|
|
50
|
+
* The reserved `revalidate` key meaning every entry, in every cache: the
|
|
51
|
+
* host-independent spelling of "all" (as `Clear-Site-Data: "*"` spells it),
|
|
52
|
+
* for authors who mean it rather than a host's default. Stands alone —
|
|
53
|
+
* naming it beside other keys is refused, since "everything and also
|
|
54
|
+
* these" is a mistake, not a scope.
|
|
55
|
+
*/
|
|
56
|
+
export declare const REVALIDATE_ALL = "*";
|
|
49
57
|
/** `ResponseInit` accepted by the response helpers, plus `revalidate`. */
|
|
50
58
|
export interface ResponseHelperInit extends ResponseInit {
|
|
59
|
+
/**
|
|
60
|
+
* The cache keys the mutation invalidated, sent as the `X-Revalidate`
|
|
61
|
+
* header for the client's integrations to apply. Three declarations, three
|
|
62
|
+
* scopes: omitted sends no header — the host's default (Solid Router
|
|
63
|
+
* revalidates everything after an action; a router without that
|
|
64
|
+
* convention reloads only what it owns); an empty list sends an empty
|
|
65
|
+
* header — nothing, explicitly; `REVALIDATE_ALL` (`"*"`) — every entry,
|
|
66
|
+
* whatever the host's default. How named keys are matched (prefixes,
|
|
67
|
+
* namespaces) is each integration's business.
|
|
68
|
+
*/
|
|
51
69
|
revalidate?: string | string[];
|
|
52
70
|
}
|
|
53
71
|
/** @internal */
|