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

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 (78) hide show
  1. package/dist/dev.cjs +86 -61
  2. package/dist/dev.js +81 -60
  3. package/dist/server.cjs +34 -17
  4. package/dist/server.js +35 -19
  5. package/dist/web.cjs +83 -59
  6. package/dist/web.js +78 -58
  7. package/frames/dist/client.cjs +8 -8
  8. package/frames/dist/client.dev.cjs +8 -8
  9. package/frames/dist/client.dev.js +8 -8
  10. package/frames/dist/client.js +8 -8
  11. package/frames/dist/server.cjs +28 -18
  12. package/frames/dist/server.js +29 -19
  13. package/package.json +20 -22
  14. package/serialization/dist/decode.cjs +3 -3
  15. package/serialization/dist/decode.js +3 -3
  16. package/serialization/dist/serialization.cjs +7 -11
  17. package/serialization/dist/serialization.js +7 -6
  18. package/serialization/types/index.d.ts +69 -157
  19. package/serialization/types/serializer-decode.d.ts +89 -112
  20. package/serialization/types/serializer.d.ts +94 -0
  21. package/serialization/types-cjs/index.d.cts +69 -157
  22. package/serialization/types-cjs/serializer-decode.d.cts +89 -112
  23. package/serialization/types-cjs/serializer.d.cts +94 -0
  24. package/types/client.d.ts +150 -290
  25. package/types/constants.d.ts +18 -0
  26. package/types/cookies.d.ts +31 -75
  27. package/types/frames/frame-client.d.ts +287 -277
  28. package/types/frames/frame-container-plugin.d.ts +71 -0
  29. package/types/frames/frame-sink.d.ts +58 -160
  30. package/types/frames/frame-transport.d.ts +161 -194
  31. package/types/frames/serializer-decode.d.ts +159 -0
  32. package/types/frames/serializer.d.ts +69 -157
  33. package/types/head.d.ts +16 -0
  34. package/types/index.d.ts +0 -65
  35. package/types/index.server.d.ts +125 -0
  36. package/types/jsx.d.ts +5 -13
  37. package/types/reconcile.d.ts +1 -0
  38. package/types/render.d.ts +4 -0
  39. package/types/response.d.ts +41 -153
  40. package/types/serializer-decode.d.ts +89 -112
  41. package/types/serializer.d.ts +69 -157
  42. package/types/server-functions/client.d.ts +93 -222
  43. package/types/server-functions/flash.d.ts +10 -30
  44. package/types/server-functions/registry.d.ts +63 -0
  45. package/types/server-functions/rich-args.d.ts +1 -10
  46. package/types/server-functions/server.d.ts +292 -574
  47. package/types/server-functions/shared.d.ts +112 -458
  48. package/types/server-mock.d.ts +2 -2
  49. package/types/server.d.ts +242 -434
  50. package/types-cjs/client.d.cts +150 -290
  51. package/types-cjs/constants.d.cts +18 -0
  52. package/types-cjs/cookies.d.cts +31 -75
  53. package/types-cjs/frames/frame-client.d.cts +287 -277
  54. package/types-cjs/frames/frame-container-plugin.d.cts +71 -0
  55. package/types-cjs/frames/frame-sink.d.cts +58 -160
  56. package/types-cjs/frames/frame-transport.d.cts +161 -194
  57. package/types-cjs/frames/serializer-decode.d.cts +159 -0
  58. package/types-cjs/frames/serializer.d.cts +69 -157
  59. package/types-cjs/head.d.cts +16 -0
  60. package/types-cjs/index.d.cts +0 -65
  61. package/types-cjs/index.server.d.cts +125 -0
  62. package/types-cjs/jsx.d.cts +5 -13
  63. package/types-cjs/reconcile.d.cts +1 -0
  64. package/types-cjs/render.d.cts +4 -0
  65. package/types-cjs/response.d.cts +41 -153
  66. package/types-cjs/serializer-decode.d.cts +89 -112
  67. package/types-cjs/serializer.d.cts +69 -157
  68. package/types-cjs/server-functions/client.d.cts +93 -222
  69. package/types-cjs/server-functions/flash.d.cts +10 -30
  70. package/types-cjs/server-functions/registry.d.cts +63 -0
  71. package/types-cjs/server-functions/rich-args.d.cts +1 -10
  72. package/types-cjs/server-functions/server.d.cts +292 -574
  73. package/types-cjs/server-functions/shared.d.cts +112 -458
  74. package/types-cjs/server-mock.d.cts +2 -2
  75. package/types-cjs/server.d.cts +242 -434
  76. package/LICENSE +0 -21
  77. package/types/core.d.ts +0 -9
  78. package/types-cjs/core.d.cts +0 -9
package/types/client.d.ts CHANGED
@@ -1,199 +1,8 @@
1
+ import { getOwner, createComponent, untrack, merge as mergeProps } from "solid-js";
2
+ import { effect, memo } from "./render.js";
1
3
  import { JSX } from "./jsx.js";
2
4
  import type { RequestEventLocals } from "./server.js";
3
- // Element/property classification tables consumed by the JSX compiler and
4
- // custom renderers. Compiler/tooling surface; not for hand-written code.
5
- /** Compiler/tooling table; not for hand-written code. @internal */
6
- export const DOMWithState: Record<string, Record<string, 1 | 2>>;
7
- /** Compiler/tooling table; not for hand-written code. @internal */
8
- export const ChildProperties: Set<string>;
9
- /** Compiler/tooling table; not for hand-written code. @internal */
10
- export const DelegatedEvents: Set<string>;
11
- /** Compiler/tooling table; not for hand-written code. @internal */
12
- export const DOMElements: Set<string>;
13
- /** Compiler/tooling table; not for hand-written code. @internal */
14
- export const SVGElements: Set<string>;
15
- /** Compiler/tooling table; not for hand-written code. @internal */
16
- export const MathMLElements: Set<string>;
17
- /** Compiler/tooling table; not for hand-written code. @internal */
18
- export const VoidElements: Set<string>;
19
- /** Compiler/tooling table; not for hand-written code. @internal */
20
- export const RawTextElements: Set<string>;
21
- /** Compiler/tooling table; not for hand-written code. @internal */
22
- export const Namespaces: Record<string, string>;
23
-
24
5
  type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
25
- export function render(
26
- code: () => JSX.Element,
27
- element: MountableElement,
28
- init?: JSX.Element,
29
- options?: { owner?: unknown }
30
- ): () => void;
31
- /**
32
- * Compiler-emitted primitive; not for hand-written code.
33
- * @param flag
34
- * - `undefined` — clone the template as-is (uses `cloneNode`).
35
- * - `1` — use `document.importNode` instead of `cloneNode`.
36
- * - `2` — the template html is wrapped; the outer tag is stripped at clone time.
37
- * @internal
38
- */
39
- export function template(html: string, flag?: 1 | 2): () => Element;
40
- /** Compiler-emitted primitive; not for hand-written code. @internal */
41
- export function scope<T extends () => any>(fn: T): T;
42
- /** Compiler-emitted primitive; not for hand-written code. @internal */
43
- export function effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void): void;
44
- /** Compiler-emitted primitive; not for hand-written code. @internal */
45
- export function memo<T>(fn: () => T, equal: boolean): () => T;
46
- /**
47
- * Compiler-emitted primitive; not for hand-written code — import `untrack`
48
- * from `solid-js` instead.
49
- * @internal
50
- */
51
- export function untrack<T>(fn: () => T): T;
52
- /**
53
- * Compiler-emitted primitive; not for hand-written code.
54
- * @internal
55
- */
56
- export function insert<T>(
57
- parent: MountableElement,
58
- accessor: (() => T) | T,
59
- marker?: Node | null,
60
- init?: JSX.Element,
61
- options?: {
62
- /**
63
- * Live accessor for the slot's logical host in the source tree (portals).
64
- * Each top-level node the slot manages is tagged with a `_$host` getter
65
- * backed by this accessor so delegated events retarget correctly.
66
- */
67
- host?: () => Node | null;
68
- /** Defer the insert effect to the queue instead of running it inline. */
69
- schedule?: boolean;
70
- }
71
- ): JSX.Element;
72
- /** Compiler-emitted primitive; not for hand-written code. @internal */
73
- export function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
74
- /** Compiler-emitted primitive; not for hand-written code. @internal */
75
- export function delegateEvents(eventNames: string[]): void;
76
- /** Event-delegation plumbing (Portal/custom-root wiring). Integration plumbing. @internal */
77
- export function registerDelegatedRoot(root: MountableElement): void;
78
- /** Event-delegation plumbing (Portal/custom-root wiring). Integration plumbing. @internal */
79
- export function unregisterDelegatedRoot(root: MountableElement): void;
80
- /** Event-delegation plumbing (Portal/custom-root wiring). Integration plumbing. @internal */
81
- export function registerDelegatedContainer(
82
- container: MountableElement,
83
- owner?: MountableElement
84
- ): void;
85
- /** Event-delegation plumbing (Portal/custom-root wiring). Integration plumbing. @internal */
86
- export function unregisterDelegatedContainer(
87
- container: MountableElement,
88
- owner?: MountableElement
89
- ): void;
90
- /** Event-delegation plumbing (Portal/custom-root wiring). Integration plumbing. @internal */
91
- export function getDelegatedRoot(node: MountableElement): MountableElement | undefined;
92
- /** Compiler-emitted primitive; not for hand-written code. @internal */
93
- export function spread<T>(node: Element, accessor: T, skipChildren?: Boolean): void;
94
- /** Compiler-emitted primitive; not for hand-written code. @internal */
95
- export function assign(
96
- node: Element,
97
- props: any,
98
- skipChildren?: Boolean,
99
- prevProps?: any,
100
- skipRef?: Boolean
101
- ): void;
102
- /** Compiler-emitted primitive; not for hand-written code. @internal */
103
- export function setAttribute(node: Element, name: string, value: string): void;
104
- /** Compiler-emitted primitive; not for hand-written code. @internal */
105
- export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
106
- /**
107
- * Register a consumer for compiler-emitted element claims. Compiled DOM
108
- * output claims navigation-relevant elements (`a[href]`, `form[action]`) at
109
- * creation, and compiler-owned writes to `href`/`action` re-invoke the same
110
- * handlers — so handlers must be idempotent and must check the element's
111
- * relevance themselves (rechecks can fire for any element whose
112
- * `href`/`action` is written, e.g. `<link href>`). Handlers run under the
113
- * reactive owner current at element creation; scope per-element state and
114
- * cleanup through your own reactive system. Dormant until registered —
115
- * without a handler the emitted claims are null checks. Returns an
116
- * unregister function.
117
- *
118
- * Integration plumbing (routers register the consumer); not meant for
119
- * application code.
120
- * @internal
121
- */
122
- export function registerElementClaim(handler: (element: Element) => void): () => void;
123
- /**
124
- * Claim `node` for registered consumers (see `registerElementClaim`).
125
- * Emitted by the compiler at element creation; idempotent by contract.
126
- * @internal
127
- */
128
- export function claimElement<T extends Element>(node: T): T;
129
- /**
130
- * Sweep-claim every navigation-relevant element (`a[href]`, `form[action]`)
131
- * in `root` — the subtree equivalent of the per-element `claimElement`
132
- * compiled output emits, for content that becomes live DOM without compiled
133
- * creation code (frame streams, adopted SSR ranges). Dormant without a
134
- * registered consumer.
135
- *
136
- * Integration plumbing; not meant for application code.
137
- * @internal
138
- */
139
- export function claimElementTree<T extends Node>(root: T): T;
140
- /** Compiler-emitted primitive; not for hand-written code. @internal */
141
- export function className(node: Element, value: JSX.ClassValue, prev?: JSX.ClassValue): void;
142
- /** Compiler-emitted primitive; not for hand-written code. @internal */
143
- export function setProperty(node: Element, name: string, value: any): void;
144
- /** Compiler-emitted primitive; not for hand-written code. @internal */
145
- export function setStyleProperty(node: Element, name: string, value: any): void;
146
- /** Compiler-emitted primitive; not for hand-written code. @internal */
147
- export function addEvent(
148
- node: Element,
149
- name: string,
150
- handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions),
151
- delegate: boolean
152
- ): void;
153
- /** Compiler-emitted primitive; not for hand-written code. @internal */
154
- export function style(
155
- node: Element,
156
- value: { [k: string]: string },
157
- prev?: { [k: string]: string }
158
- ): void;
159
- /**
160
- * Compiler-emitted primitive; not for hand-written code — import `getOwner`
161
- * from `solid-js` instead.
162
- * @internal
163
- */
164
- export function getOwner(): unknown;
165
- /**
166
- * Compiler-emitted prop-spread helper; not for hand-written code — import
167
- * `merge` from `solid-js` instead.
168
- * @internal
169
- */
170
- export function mergeProps(...sources: unknown[]): unknown;
171
- /** Compiler-emitted primitive; not for hand-written code. @internal */
172
- export function dynamicProperty(props: unknown, key: string): unknown;
173
- /** Compiler-emitted primitive; not for hand-written code. @internal */
174
- export function applyRef<T extends Element = Element>(
175
- r: ((element: NoInfer<T>) => void) | ((element: NoInfer<T>) => void)[],
176
- element: T
177
- ): void;
178
- /** Compiler-emitted primitive; not for hand-written code. @internal */
179
- export function ref(
180
- fn: () => ((element: Element) => void) | ((element: Element) => void)[],
181
- element: Element
182
- ): void;
183
-
184
- export function hydrate(
185
- fn: () => JSX.Element,
186
- node: MountableElement,
187
- options?: { renderId?: string; owner?: unknown }
188
- ): () => void;
189
- /** Hydration-walk primitive; not for hand-written code. @internal */
190
- export function getHydrationKey(): string | undefined;
191
- /** Hydration-walk primitive; not for hand-written code. @internal */
192
- export function getNextElement(template?: () => Element): Element;
193
- /** Hydration-walk primitive; not for hand-written code. @internal */
194
- export function getNextMatch(start: Node, elementName: string): Element;
195
- /** Hydration-walk primitive; not for hand-written code. @internal */
196
- export function getNextMarker(start: Node): [Node, Array<Node>];
197
6
  /**
198
7
  * A head tag descriptor. Props values may be getters (reactive on the
199
8
  * client); `children` is the text body. `key` overrides the built-in dedupe
@@ -207,42 +16,30 @@ export function getNextMarker(start: Node): [Node, Array<Node>];
207
16
  * read them from the getter. See docs/head-management-rfc.md.
208
17
  */
209
18
  export type HeadTag = {
210
- tag: "title" | "meta" | "link" | "style" | "script" | "base";
211
- props: Record<string, any>;
212
- key?: string | (() => string);
19
+ tag: "title" | "meta" | "link" | "style" | "script" | "base";
20
+ props: Record<string, any>;
21
+ key?: string | (() => string);
213
22
  };
214
- /**
215
- * Registers head tags with the ambient head registry under the current
216
- * owner. An array is a group — one replacement set; a function is a
217
- * reactive group whose membership is tracked and re-read on change.
218
- * Resolution is last-committed group per identity (reactive updates keep
219
- * the registration's original commit position); disposal restores the
220
- * previous winner. During hydration the server-flushed head state stays
221
- * authoritative until hydration completes. See docs/head-management-rfc.md.
222
- */
223
- export function useHead(tag: HeadTag | HeadTag[] | (() => HeadTag | HeadTag[])): void;
224
- export type AssetDescriptor =
225
- | { type: "style"; href: string; attrs?: Record<string, string> }
226
- | { type: "inline-style"; id: string; content?: string; attrs?: Record<string, string> }
227
- | { type: "module"; href: string }
228
- | ExclusiveAssetDescriptor<any>;
23
+ export type AssetDescriptor = {
24
+ type: "style";
25
+ href: string;
26
+ attrs?: Record<string, string>;
27
+ } | {
28
+ type: "inline-style";
29
+ id: string;
30
+ content?: string;
31
+ attrs?: Record<string, string>;
32
+ } | {
33
+ type: "module";
34
+ href: string;
35
+ } | ExclusiveAssetDescriptor<any>;
229
36
  export interface ExclusiveAssetDescriptor<T> {
230
- policy: "exclusive";
231
- key: string;
232
- value: T;
233
- get(): T;
234
- set(value: T): void;
37
+ policy: "exclusive";
38
+ key: string;
39
+ value: T;
40
+ get(): T;
41
+ set(value: T): void;
235
42
  }
236
- /**
237
- * @internal Ref-counted client asset ownership: acquire adopts or mounts the
238
- * asset, the returned release follows the owner (with a grace period for
239
- * back-and-forth navigation). Internal machinery, not a public CSS-lifecycle
240
- * API — per the head-management RFC (docs/head-management-rfc.md), ambient
241
- * bundler-injected CSS is never lifecycle-managed, and the head registry
242
- * owns the lifecycle of directly-mounted stylesheets outright. This keeps
243
- * its non-head roles (exclusive slots, owner-following DOM ownership).
244
- */
245
- export function acquireAsset(descriptor: AssetDescriptor): () => void;
246
43
  /**
247
44
  * Registry entry returned by `warmAsset`. Stylesheet entries carry load
248
45
  * tracking for the client reveal gate (docs/client-css-reveal-gating.md):
@@ -250,38 +47,23 @@ export function acquireAsset(descriptor: AssetDescriptor): () => void;
250
47
  * sheet releases the gate, parity with the server gate.
251
48
  */
252
49
  export interface AssetEntry {
253
- loadState?: "pending" | "loaded" | "errored";
254
- loadPromise?: Promise<void>;
50
+ loadState?: "pending" | "loaded" | "errored";
51
+ loadPromise?: Promise<void>;
255
52
  }
256
- /**
257
- * @internal Warm half of `acquireAsset`: idempotent and refcount-free,
258
- * callable from a compute phase so the fetch starts at discovery and
259
- * overlaps a transition's data wait. Stylesheets warm as
260
- * `rel="preload" as="style"` and are flipped live by `acquireAsset` at
261
- * commit — a branch superseded before it commits leaks only an inert
262
- * preload, never an applied sheet. Only link-backed descriptors warm;
263
- * inline styles and exclusive slots return `undefined`.
264
- */
265
- export function warmAsset(descriptor: AssetDescriptor): AssetEntry | undefined;
266
- export function HydrationScript(props?: { nonce?: string; eventNames?: string[] }): JSX.Element;
267
- export function generateHydrationScript(options?: {
268
- nonce?: string;
269
- eventNames?: string[];
270
- }): string;
271
53
  /**
272
54
  * See the server entry's `ResponseStub` — the shape of the mutable response
273
55
  * head integrations expose as `event.response` via module augmentation.
274
56
  */
275
57
  export interface ResponseStub {
276
- status?: number;
277
- statusText?: string;
278
- headers: Headers;
279
- /**
280
- * Set by the integration once the response head has been derived/sent
281
- * from this stub (status/headers can no longer change); consumers must
282
- * treat later writes and cleanup-time retractions as no-ops.
283
- */
284
- committed?: boolean;
58
+ status?: number;
59
+ statusText?: string;
60
+ headers: Headers;
61
+ /**
62
+ * Set by the integration once the response head has been derived/sent
63
+ * from this stub (status/headers can no longer change); consumers must
64
+ * treat later writes and cleanup-time retractions as no-ops.
65
+ */
66
+ committed?: boolean;
285
67
  }
286
68
  /**
287
69
  * See the server entry's `RequestEventLocals` — the augmentable type of
@@ -291,47 +73,125 @@ export interface ResponseStub {
291
73
  */
292
74
  export { RequestEventLocals } from "./server.js";
293
75
  export interface RequestEvent {
294
- request: Request;
295
- locals: RequestEventLocals;
76
+ request: Request;
77
+ locals: RequestEventLocals;
296
78
  }
297
- /**
298
- * Registered symbol (`Symbol.for("solid.RequestContext")`) naming the global
299
- * slot where `provideRequestEvent` parks the AsyncLocalStorage scoping
300
- * request events. Integration plumbing read the event through
301
- * `getRequestEvent()` instead.
79
+ export type { CookieOptions } from "./cookies.js";
80
+ export type { ServerFunction, ServerFunctionMetadata, ServerFunctionRPC } from "./server-functions/shared.js";
81
+ export declare const waitAsset: (promise: Promise<unknown>) => void;
82
+ export { DOMWithState, ChildProperties, DOMElements, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DelegatedEvents } from "./constants.js";
83
+ /** Client stub — hydration bootstrap is a server-only emit. */
84
+ export declare function generateHydrationScript(_options?: {
85
+ eventNames?: string[];
86
+ nonce?: string;
87
+ }): string;
88
+ /** Client stub — valid JSX component, renders nothing. */
89
+ export declare function HydrationScript(_props?: {
90
+ nonce?: string;
91
+ eventNames?: string[];
92
+ }): null;
93
+ export { effect, memo, untrack, getOwner, createComponent };
94
+ /**
95
+ * Compiler-emitted prop-spread helper. The JSX transform emits
96
+ * `mergeProps(...)` when compiling prop spreads on components — not a
97
+ * user-facing API. Application code should import `merge` from `solid-js`.
302
98
  * @internal
303
99
  */
304
- export declare const RequestContext: unique symbol;
305
- export function getRequestEvent(): RequestEvent | undefined;
306
- /**
307
- * The cookie codec (the platform-gap primitives — see cookies.d.ts for the
308
- * blessed patterns): the real implementation on both entries, never a
309
- * stub — a pure value transformer has legitimate browser uses
310
- * (`document.cookie`). Tree-shakes away when unused.
311
- */
100
+ export { mergeProps };
101
+ export declare const getRequestEvent: () => RequestEvent | undefined;
312
102
  export { parseCookieHeader, serializeCookie } from "./cookies.js";
313
- export type { CookieOptions } from "./cookies.js";
103
+ export { clearFlashCookie, hasFlashCookie } from "./cookies.js";
104
+ export { getServerFunctionMetadata, getServerFunctionRPC, isServerFunction } from "./server-functions/registry.js";
314
105
  /**
315
- * The flash cookie's isomorphic half (name/detection/clearing cookie
316
- * utilities living beside the cookie codec) and the codec-free
317
- * server-function layer (reference detection + the late-bound RPC seam).
318
- * On the core entries so integrations consuming them eagerly (routers)
319
- * never import the server-functions entry whose client half is the
320
- * transport + codec from their eager graph. Declared through
321
- * server-functions/shared.d.ts, the declaration home published-types
322
- * layouts ship.
106
+ * Renders a component tree into a DOM element. Returns a dispose function
107
+ * that tears the tree down and cleans up reactive scopes when called.
108
+ *
109
+ * The top-level insert is queued via `{ schedule: true }` so its initial
110
+ * DOM attach goes through the effect queue rather than executing inline.
111
+ * This lets the mount participate in transitions: if an uncaught async
112
+ * read surfaces during the initial render (no `Loading` ancestor absorbs
113
+ * it), the mount is held by the transition and attaches atomically once
114
+ * all pending settles. On the no-async happy path the tail `flush()`
115
+ * drains the queued callback so the attach is synchronous by the time
116
+ * `render()` returns. The dev enforcement window scopes
117
+ * `ASYNC_OUTSIDE_LOADING_BOUNDARY` to the initial mount only.
118
+ */
119
+ export declare function render(code: () => JSX.Element, element: MountableElement, init?: JSX.Element, options?: {
120
+ owner?: unknown;
121
+ renderId?: string;
122
+ }): () => void;
123
+ export declare function template(html: string, flag?: 1 | 2): () => Element;
124
+ export declare function delegateEvents(eventNames: string[]): void;
125
+ export declare function registerDelegatedRoot(root: MountableElement): void;
126
+ export declare function unregisterDelegatedRoot(root: MountableElement): void;
127
+ export declare function registerDelegatedContainer(container: MountableElement, owner?: MountableElement): void;
128
+ export declare function unregisterDelegatedContainer(container: MountableElement, owner?: MountableElement): void;
129
+ export declare function getDelegatedRoot(node: MountableElement): MountableElement | undefined;
130
+ export declare function setProperty(node: Element, name: string, value: any): void;
131
+ export declare function registerElementClaim(handler: (element: Element) => void): () => void;
132
+ export declare function claimElementTree<T extends Node>(root: T): T;
133
+ export declare function claimElement<T extends Element>(node: T): T;
134
+ export declare function setAttribute(node: Element, name: string, value: string): void;
135
+ export declare function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
136
+ export declare function className(node: Element, value: JSX.ClassValue, prev?: JSX.ClassValue): void;
137
+ export declare function addEvent(node: Element, name: string, handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions), delegate: boolean): void;
138
+ export declare function style(node: Element, value: {
139
+ [k: string]: string;
140
+ }, prev?: {
141
+ [k: string]: string;
142
+ }): void;
143
+ export declare function setStyleProperty(node: Element, name: string, value: any): void;
144
+ export declare function spread<T>(node: Element, accessor: T, skipChildren?: Boolean): void;
145
+ export declare function dynamicProperty(props: unknown, key: string): unknown;
146
+ export declare function applyRef<T extends Element = Element>(r: ((element: NoInfer<T>) => void) | ((element: NoInfer<T>) => void)[], element: T): void;
147
+ export declare function ref(fn: () => ((element: Element) => void) | ((element: Element) => void)[], element: Element): void;
148
+ export declare function rowProof(fn: any): any; /** Compiler-emitted primitive; not for hand-written code. @internal */
149
+ export declare function scope<T extends () => any>(fn: T): T;
150
+ export declare function installHydrationRuntime(): void;
151
+ export declare function patchDriver(subject: any, body: any): void; /**
152
+ * Compiler-emitted primitive; not for hand-written code.
153
+ * @internal
323
154
  */
324
- export {
325
- clearFlashCookie,
326
- getServerFunctionMetadata,
327
- getServerFunctionRPC,
328
- hasFlashCookie,
329
- isServerFunction
330
- } from "./server-functions/shared.js";
331
- export type {
332
- ServerFunction,
333
- ServerFunctionMetadata,
334
- ServerFunctionRPC
335
- } from "./server-functions/shared.js";
336
- /** Hydration-walk primitive; not for hand-written code. @internal */
337
- export function runHydrationEvents(): void;
155
+ export declare function insert<T>(parent: MountableElement, accessor: (() => T) | T, marker?: Node | null, init?: JSX.Element, options?: {
156
+ /**
157
+ * Live accessor for the slot's logical host in the source tree (portals).
158
+ * Each top-level node the slot manages is tagged with a `_$host` getter
159
+ * backed by this accessor so delegated events retarget correctly.
160
+ */
161
+ host?: () => Node | null;
162
+ /** Defer the insert effect to the queue instead of running it inline. */
163
+ schedule?: boolean;
164
+ }): JSX.Element;
165
+ export declare function assign(node: Element, props: any, skipChildren?: Boolean, prevProps?: any, skipRef?: Boolean): void;
166
+ export declare function warmAsset(descriptor: AssetDescriptor): AssetEntry | undefined;
167
+ export declare function acquireAsset(descriptor: AssetDescriptor): () => void;
168
+ export declare function useHead(tag: HeadTag | HeadTag[] | (() => HeadTag | HeadTag[])): void;
169
+ /**
170
+ * Resumes a server-rendered tree on the client, attaching event listeners
171
+ * and reactive bindings without reconstructing the DOM. Returns a `dispose`
172
+ * function that tears down reactive scopes (DOM nodes are left in place).
173
+ *
174
+ * Use this when the page HTML was produced by `renderToString` or
175
+ * `renderToStream`. For client-only apps, use `render` instead.
176
+ *
177
+ * Pass `options.renderId` to hydrate one of multiple roots emitted by a
178
+ * server render that used the same id.
179
+ *
180
+ * When the server renders a full document but the client hydrates only the
181
+ * app subtree, the server must give that subtree its own id namespace: wrap
182
+ * the document shell in `<NoHydration>` and re-enter with `<Hydration>`
183
+ * around the app. Otherwise the app's hydration ids are allocated under the
184
+ * document component's owner tree and this walk can never claim them.
185
+ */
186
+ export declare function hydrate(fn: () => JSX.Element, node: MountableElement, options?: {
187
+ renderId?: string;
188
+ owner?: unknown;
189
+ }): () => void;
190
+ export declare function getNextElement(template?: () => Element): Element;
191
+ export declare function getNextMatch(start: Node, elementName: string): Element;
192
+ export declare function getNextMarker(start: Node): [Node, Array<Node>];
193
+ export declare function getFirstChild(node: any, expectedTag: any): any;
194
+ export declare function getNextSibling(node: any, expectedTag: any): any;
195
+ export declare function runHydrationEvents(): void;
196
+ export declare function getHydrationKey(): string | undefined;
197
+ export declare const RequestContext: unique symbol;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Flags
3
+ *
4
+ * - 1 - Stateful property - value derives from reactive state
5
+ * - 2 - Locked to property - value not specially treated
6
+ */
7
+ declare const DOMWithState: Record<string, Record<string, 1 | 2>>;
8
+ declare const ChildProperties: Set<string>;
9
+ declare const $$SLOT: unique symbol;
10
+ declare const $$HOST: unique symbol;
11
+ declare const DelegatedEvents: Set<string>;
12
+ declare const SVGElements: Set<string>;
13
+ declare const MathMLElements: Set<string>;
14
+ declare const Namespaces: Record<string, string>;
15
+ declare const VoidElements: Set<string>;
16
+ declare const RawTextElements: Set<string>;
17
+ declare const DOMElements: Set<string>;
18
+ export { DOMWithState, ChildProperties, DelegatedEvents, SVGElements, MathMLElements, VoidElements, RawTextElements, Namespaces, DOMElements, $$SLOT, $$HOST };
@@ -1,93 +1,49 @@
1
- // Cookie wire format: the platform-gap primitives, and ALL of core's
2
- // cookie surface — core owns the exchange (the request's headers in, the
3
- // response stub's headers out) and the codec, nothing ambient. Blessed
4
- // patterns:
5
- //
6
- // parseCookieHeader(event.request.headers.get("cookie"))
7
- // event.response.headers.append("set-cookie", serializeCookie(name, value, options))
8
- //
9
- // Dependency-free and isomorphic (exported from both entries — real
10
- // implementation, never a stub); integrity/confidentiality layers
11
- // (sessions) belong to the caller, on top of these primitives.
12
-
13
- /**
14
- * Attributes for a `Set-Cookie` header, mirroring RFC 6265. `path`
15
- * defaults to `/`; nothing else is defaulted.
16
- */
17
1
  export interface CookieOptions {
18
- /** Cookie `Path` attribute. Defaults to `/`. */
19
- path?: string;
20
- /** Cookie `Domain` attribute. Emitted only when provided. */
21
- domain?: string;
22
- /** Cookie `Max-Age` attribute, in seconds (truncated to an integer). */
23
- maxAge?: number;
24
- /** Cookie `Expires` attribute. */
25
- expires?: Date;
26
- /** Emit the `HttpOnly` attribute. */
27
- httpOnly?: boolean;
28
- /** Emit the `Secure` attribute. */
29
- secure?: boolean;
30
- /** Cookie `SameSite` attribute, any case. */
31
- sameSite?: "lax" | "strict" | "none" | "Lax" | "Strict" | "None";
2
+ /** Cookie `Path` attribute. Defaults to `/`. */
3
+ path?: string;
4
+ /** Cookie `Domain` attribute. Emitted only when provided. */
5
+ domain?: string;
6
+ /** Cookie `Max-Age` attribute, in seconds (truncated to an integer). */
7
+ maxAge?: number;
8
+ /** Cookie `Expires` attribute. */
9
+ expires?: Date;
10
+ /** Emit the `HttpOnly` attribute. */
11
+ httpOnly?: boolean;
12
+ /** Emit the `Secure` attribute. */
13
+ secure?: boolean;
14
+ /** Cookie `SameSite` attribute, any case. */
15
+ sameSite?: "lax" | "strict" | "none" | "Lax" | "Strict" | "None";
32
16
  }
33
-
34
17
  /**
35
18
  * Parses a `Cookie` request header into a name → value map. Names and
36
19
  * values are `decodeURIComponent`-decoded (falling back to the raw text
37
- * when decoding throws); a quoted value keeps its content. `null`/empty
38
- * input parses to an empty map.
20
+ * when decoding throws cookies set by other producers are not
21
+ * necessarily percent-encoded); a quoted value keeps its content, per the
22
+ * RFC 6265 grammar. `null`/empty input parses to an empty map.
39
23
  *
40
24
  * The read half of the platform gap — the blessed request-cookie read is
41
25
  * `parseCookieHeader(event.request.headers.get("cookie"))`.
42
26
  */
43
- export function parseCookieHeader(header: string | null | undefined): Record<string, string>;
44
-
27
+ export declare function parseCookieHeader(header: string | null | undefined): Record<string, string>;
45
28
  /**
46
29
  * Serializes a cookie to a `Set-Cookie` header value. The name and value
47
30
  * are `encodeURIComponent`-encoded (the parser decodes symmetrically);
48
- * `path` defaults to `/` and every other attribute is emitted exactly
49
- * when the caller asked for it.
31
+ * `path` defaults to `/` the only defaulted attribute and every other
32
+ * attribute is emitted exactly when the caller asked for it: `domain`,
33
+ * `maxAge` (seconds, truncated to an integer), `expires` (a `Date`),
34
+ * `httpOnly`, `secure`, `sameSite` (`"lax" | "strict" | "none"`, any
35
+ * case).
50
36
  *
51
37
  * The write half of the platform gap — the blessed response-cookie write
52
38
  * is `event.response.headers.append("set-cookie", serializeCookie(name,
53
39
  * value, options))`, which every head materialization path carries to the
54
40
  * wire entry-by-entry.
55
41
  */
56
- export function serializeCookie(name: string, value: string, options?: CookieOptions): string;
57
-
58
- /**
59
- * Name of the cookie carrying the outcome of a server function call made
60
- * without the client runtime (`"flash"`). A no-JS form post has no way to
61
- * receive a value the browser follows the redirect and renders the next
62
- * page so the handler stashes the outcome here for the render after it
63
- * to pick up, which is how a form submitted without JavaScript still shows
64
- * its result.
65
- *
66
- * The name, detection and clearing are cookie utilities and isomorphic
67
- * (integrations read the cookie from code that also ships to the browser);
68
- * the codec that fills and decodes it is server-only and lives behind the
69
- * server-functions server entry.
70
- */
71
- export const FLASH_COOKIE: string;
72
-
73
- /**
74
- * Whether a Cookie header carries a flash cookie, readable or not. Cheap
75
- * enough to call on every render so the clear can be queued before the
76
- * response headers flush.
77
- */
78
- export function hasFlashCookie(cookieHeader: string | null): boolean;
79
-
80
- /**
81
- * The `Set-Cookie` value clearing the flash cookie. The outcome is
82
- * one-shot: append this as soon as the cookie is detected, whether or not
83
- * it decodes, so a stale outcome cannot resurface on a later request.
84
- */
85
- export function clearFlashCookie(): string;
86
-
87
- /**
88
- * The raw encoded flash payload out of a Cookie header, if present — the
89
- * codec's own accessor.
90
- *
91
- * @internal
92
- */
93
- export function matchFlashCookie(cookieHeader: string | null): string | undefined;
42
+ export declare function serializeCookie(name: string, value: string, options?: CookieOptions): string;
43
+ export declare const FLASH_COOKIE = "flash";
44
+ /** Whether a Cookie header carries a flash cookie (readable or not). */
45
+ export declare function hasFlashCookie(cookieHeader: string | null): boolean;
46
+ /** The raw encoded flash payload out of a Cookie header, if present. */
47
+ export declare function matchFlashCookie(cookieHeader: string | null): string | undefined;
48
+ /** The Set-Cookie value clearing the flash cookie after it has been read. */
49
+ export declare function clearFlashCookie(): string;