foldkit-ssr 0.1.0 → 0.3.0
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/README.md +267 -49
- package/dist/client-4jzvxuwf.d.mts +360 -0
- package/dist/client-4jzvxuwf.d.mts.map +1 -0
- package/dist/client-CsCXJa_9.mjs +1058 -0
- package/dist/client-CsCXJa_9.mjs.map +1 -0
- package/dist/client.d.mts +2 -0
- package/dist/client.mjs +2 -0
- package/dist/index.d.mts +75 -252
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +265 -939
- package/dist/index.mjs.map +1 -1
- package/dist/vite.d.mts +94 -0
- package/dist/vite.d.mts.map +1 -0
- package/dist/vite.mjs +151 -0
- package/dist/vite.mjs.map +1 -0
- package/package.json +26 -11
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { Layer, Option, Result, Schema, Stream } from "effect";
|
|
2
|
+
import { ActiveSurface, Metadata, WritableProjection } from "foldkit-surface";
|
|
3
|
+
import { Attribute, Html, HtmlBuilder, KeyboardModifiers } from "foldkit/html";
|
|
4
|
+
import { Runtime } from "foldkit";
|
|
5
|
+
import { Ports } from "foldkit/port";
|
|
6
|
+
//#region src/resumable.d.ts
|
|
7
|
+
/** The attribute prefix of an element's binding marker. */
|
|
8
|
+
declare const BINDING_ATTRIBUTE = "data-foldkit-plus-on-";
|
|
9
|
+
/** The posted field that carries a form's encoded Message, for the server fallback. */
|
|
10
|
+
declare const FALLBACK_FIELD = "foldkit-plus-message";
|
|
11
|
+
/** The attribute on a placement's root naming its slot, while the server renders. */
|
|
12
|
+
declare const SLOT_ATTRIBUTE = "data-foldkit-plus-slot";
|
|
13
|
+
declare const invalid: unique symbol;
|
|
14
|
+
/** A compile-time failure that names its cause. */
|
|
15
|
+
interface Invalid<Message extends string> {
|
|
16
|
+
readonly [invalid]: Message;
|
|
17
|
+
}
|
|
18
|
+
type IsUnion<T, U = T> = T extends unknown ? ([U] extends [T] ? false : true) : never;
|
|
19
|
+
/** A Message constructor from `defineMessageUnion`: a tagged Schema that can be called. */
|
|
20
|
+
type AnyMemberSchema = Schema.Top & {
|
|
21
|
+
readonly fields: Schema.Struct.Fields;
|
|
22
|
+
};
|
|
23
|
+
/** The Message a member makes. */
|
|
24
|
+
type Made<M> = M extends {
|
|
25
|
+
readonly Type: infer T;
|
|
26
|
+
} ? T : never;
|
|
27
|
+
/** The fields a member's event may be given fixed: all but `_tag`. */
|
|
28
|
+
type Fixable<M> = Partial<Omit<Made<M>, '_tag'>>;
|
|
29
|
+
/** The fields of a member the event fills: those neither `_tag` nor fixed. */
|
|
30
|
+
type Rest<M, Fixed> = Omit<Made<M>, '_tag' | keyof Fixed>;
|
|
31
|
+
type ProducesMessage<M, Message> = [Made<M>] extends [Message] ? unknown : Invalid<"the member is not one of this view's Messages">;
|
|
32
|
+
type TextHoleCheck<M, Fixed> = [keyof Rest<M, Fixed>] extends [never] ? Invalid<'the member has no field left for the event to fill'> : true extends IsUnion<keyof Rest<M, Fixed>> ? Invalid<'the member leaves more than one field for the event to fill: fix the others'> : Rest<M, Fixed>[keyof Rest<M, Fixed>] extends string ? string extends Rest<M, Fixed>[keyof Rest<M, Fixed>] ? unknown : Invalid<'the field the event fills must be a string'> : Invalid<'the field the event fills must be a string'>;
|
|
33
|
+
type KeyHoleCheck<M, Fixed> = [keyof Rest<M, Fixed>] extends ['key' | 'modifiers'] ? ['key' | 'modifiers'] extends [keyof Rest<M, Fixed>] ? unknown : Invalid<'the member must leave exactly key and modifiers for the event to fill'> : Invalid<'the member must leave exactly key and modifiers for the event to fill'>;
|
|
34
|
+
/** `OnInput` and `OnChange`: a closure, or a member whose one string field the event fills. */
|
|
35
|
+
interface TextHole<Message> {
|
|
36
|
+
(toMessage: (value: string) => Message): Attribute<Message>;
|
|
37
|
+
<M extends AnyMemberSchema, const Fixed extends Fixable<M> = {}>(member: M & ProducesMessage<M, Message> & TextHoleCheck<M, Fixed>, fixed?: Fixed): Attribute<Message>;
|
|
38
|
+
}
|
|
39
|
+
/** `OnKeyDown` and `OnKeyUp`: a closure, or a member whose `key` and `modifiers` the event fills. */
|
|
40
|
+
interface KeyHole<Message> {
|
|
41
|
+
(toMessage: (key: string, modifiers: KeyboardModifiers) => Message): Attribute<Message>;
|
|
42
|
+
<M extends AnyMemberSchema, const Fixed extends Fixable<M> = {}>(member: M & ProducesMessage<M, Message> & KeyHoleCheck<M, Fixed>, fixed?: Fixed): Attribute<Message>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A builder a view is given: Foldkit's `HtmlBuilder`, or a Surface renderer's,
|
|
46
|
+
* which leaves out Foldkit's phantom key. Its Message is what `OnClick` takes.
|
|
47
|
+
*/
|
|
48
|
+
type AnyBuilder = {
|
|
49
|
+
readonly OnClick: (message: never, ...rest: ReadonlyArray<never>) => unknown;
|
|
50
|
+
};
|
|
51
|
+
/** The Message a builder's handlers make. */
|
|
52
|
+
type MessageOf<Builder> = Builder extends {
|
|
53
|
+
readonly OnClick: (message: infer Message, ...rest: ReadonlyArray<never>) => unknown;
|
|
54
|
+
} ? Message : never;
|
|
55
|
+
/**
|
|
56
|
+
* The resumable builder for a view whose Messages are `Message`: its elements
|
|
57
|
+
* and attributes, and the hole forms of the four value events. One shape
|
|
58
|
+
* whether it wraps a view's `HtmlBuilder` or a Surface renderer's builder, so a
|
|
59
|
+
* helper typed with it takes either. It keeps Foldkit's phantom Message key,
|
|
60
|
+
* so a placement's view accepts it as the parent's builder.
|
|
61
|
+
*/
|
|
62
|
+
type ResumableBuilder<Message> = Omit<HtmlBuilder<Message>, 'OnInput' | 'OnChange' | 'OnKeyDown' | 'OnKeyUp'> & {
|
|
63
|
+
readonly OnInput: TextHole<Message>;
|
|
64
|
+
readonly OnChange: TextHole<Message>;
|
|
65
|
+
readonly OnKeyDown: KeyHole<Message>;
|
|
66
|
+
readonly OnKeyUp: KeyHole<Message>;
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/context.d.ts
|
|
70
|
+
type Region = ReadonlyArray<Html | string>;
|
|
71
|
+
/** An element whose handler for `event` is a function, which the page cannot describe. */
|
|
72
|
+
interface UnnamedHandler {
|
|
73
|
+
readonly element: string;
|
|
74
|
+
readonly event: string;
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/listen.d.ts
|
|
78
|
+
/**
|
|
79
|
+
* A binding as the envelope carries it: Foldkit's attribute (`OnSubmit`,
|
|
80
|
+
* `OnBlur`), whose tag says what its handler does beside dispatching; the
|
|
81
|
+
* Message, encoded through the application's Message Schema (for a hole, with
|
|
82
|
+
* the hole filled by a placeholder); the fields the event fills, `depth`
|
|
83
|
+
* placement wrappers down; and the attribute's options. Its ordinal is its
|
|
84
|
+
* index.
|
|
85
|
+
*/
|
|
86
|
+
interface EncodedBinding {
|
|
87
|
+
readonly attribute: string;
|
|
88
|
+
readonly message: unknown;
|
|
89
|
+
readonly hole?: ReadonlyArray<string>;
|
|
90
|
+
readonly depth?: number;
|
|
91
|
+
readonly options?: unknown;
|
|
92
|
+
}
|
|
93
|
+
/** A binding decoded from the page: its Message is one of the application's. */
|
|
94
|
+
interface DecodedBinding {
|
|
95
|
+
readonly attribute: string;
|
|
96
|
+
readonly event: string;
|
|
97
|
+
readonly message: unknown;
|
|
98
|
+
readonly hole?: ReadonlyArray<string> | undefined;
|
|
99
|
+
readonly depth?: number | undefined;
|
|
100
|
+
readonly options?: unknown;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* What the markers make of one event: the Messages its bindings dispatch, in
|
|
104
|
+
* the order the live page would, and, when the walk met a handler the page
|
|
105
|
+
* could not name, that element. An answer with `unnamed` is incomplete: the
|
|
106
|
+
* live page would do more than its Messages say.
|
|
107
|
+
*/
|
|
108
|
+
interface Answer {
|
|
109
|
+
readonly event: Event;
|
|
110
|
+
readonly messages: ReadonlyArray<unknown>;
|
|
111
|
+
readonly unnamed?: Element | undefined;
|
|
112
|
+
}
|
|
113
|
+
interface ListenOptions {
|
|
114
|
+
readonly bindings: ReadonlyArray<DecodedBinding>;
|
|
115
|
+
readonly onAnswer: (answer: Answer) => void;
|
|
116
|
+
/**
|
|
117
|
+
* Every event the page's markers name, as the envelope lists them. Given,
|
|
118
|
+
* `listen` needs no pass over the page to find the events a marker names
|
|
119
|
+
* with `*` alone; without it, it reads every element's attributes, which on
|
|
120
|
+
* a large page is most of its cost.
|
|
121
|
+
*/
|
|
122
|
+
readonly events?: Iterable<string> | undefined;
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/shared.d.ts
|
|
126
|
+
/**
|
|
127
|
+
* The attribute Foldkit's server stamps on an application's root, as
|
|
128
|
+
* `foldkit/experimental/server` exports it. Written out here so a page can
|
|
129
|
+
* find its root without that module; a test pins the two together.
|
|
130
|
+
*/
|
|
131
|
+
declare const FOLDKIT_APP_ATTRIBUTE = "data-foldkit-app";
|
|
132
|
+
/**
|
|
133
|
+
* The attribute on the stamped root that carries a page's resume envelope.
|
|
134
|
+
* Foldkit pairs its own handoff the same way: the build id rides on the root
|
|
135
|
+
* beside the app stamp, and the client reads it before adopting anything.
|
|
136
|
+
*/
|
|
137
|
+
declare const RESUME_ATTRIBUTE = "data-foldkit-plus-resume";
|
|
138
|
+
/**
|
|
139
|
+
* What a page says of itself beyond Foldkit's `Document` (`title`, `lang`,
|
|
140
|
+
* `dir`, `canonical`, `ogUrl`): what a search result and a link preview show.
|
|
141
|
+
* `title` is the preview's title (`og:title`), when it differs from the
|
|
142
|
+
* document's. Dates are ISO 8601 text; `jsonLd` is structured data, each
|
|
143
|
+
* entry written as its own script.
|
|
144
|
+
*/
|
|
145
|
+
interface Meta {
|
|
146
|
+
readonly description?: string | undefined;
|
|
147
|
+
readonly title?: string | undefined;
|
|
148
|
+
readonly image?: string | undefined;
|
|
149
|
+
readonly type?: 'website' | 'article' | undefined;
|
|
150
|
+
readonly siteName?: string | undefined;
|
|
151
|
+
readonly article?: {
|
|
152
|
+
readonly published?: string | undefined;
|
|
153
|
+
readonly modified?: string | undefined;
|
|
154
|
+
} | undefined;
|
|
155
|
+
readonly robots?: string | undefined;
|
|
156
|
+
readonly alternates?: ReadonlyArray<{
|
|
157
|
+
readonly hreflang: string;
|
|
158
|
+
readonly href: string;
|
|
159
|
+
}> | undefined;
|
|
160
|
+
readonly jsonLd?: ReadonlyArray<Readonly<Record<string, unknown>>> | undefined;
|
|
161
|
+
}
|
|
162
|
+
/** Marks each head element a plan's `meta` wrote, so the browser can replace them. */
|
|
163
|
+
declare const META_ATTRIBUTE = "data-foldkit-meta";
|
|
164
|
+
/** The head markup of a `Meta`, every value escaped, one element per line. */
|
|
165
|
+
declare const metaMarkup: (meta: Meta) => string;
|
|
166
|
+
/**
|
|
167
|
+
* Which part of the Model the browser owns, and what it starts from.
|
|
168
|
+
*
|
|
169
|
+
* `state` is a writable projection of that part, from `Projection.pick` or
|
|
170
|
+
* `Projection.compose`. `baseline` is the Model the browser sets it onto, by
|
|
171
|
+
* default the application's own initial Model. `boot` names the Commands the
|
|
172
|
+
* browser runs on load, since `init` does not run there.
|
|
173
|
+
*/
|
|
174
|
+
interface ResumePlan<Model, Fields extends Schema.Struct.Fields, Commands = unknown> {
|
|
175
|
+
readonly id: string;
|
|
176
|
+
readonly state: WritableProjection<Model, Fields>;
|
|
177
|
+
readonly baseline: Model;
|
|
178
|
+
readonly boot?: ((model: Model) => Commands) | undefined;
|
|
179
|
+
/** Model paths allowed to start from the baseline, as `ModelRef.dependency` gives them. */
|
|
180
|
+
readonly local: ReadonlyArray<ReadonlyArray<string>>;
|
|
181
|
+
/** The Surfaces the browser may activate, which the plan must cover. */
|
|
182
|
+
readonly surfaces: ReadonlyArray<ActiveSurface<Model>>;
|
|
183
|
+
/** State another package owns, each captured and restored by that package. */
|
|
184
|
+
readonly parts: ReadonlyArray<ResumePart<Model>>;
|
|
185
|
+
/** The application's Message Schema, which encodes the page's bindings. */
|
|
186
|
+
readonly Message?: Schema.Top | undefined;
|
|
187
|
+
/**
|
|
188
|
+
* When the browser boots the runtime: `now` on load, `idle` when the browser
|
|
189
|
+
* is idle or on the first interaction, `on-interaction` on the first only.
|
|
190
|
+
* Until then the page answers events from its bindings and queues the
|
|
191
|
+
* Messages, which the runtime runs through `update` before any other.
|
|
192
|
+
*/
|
|
193
|
+
readonly start: Start;
|
|
194
|
+
/** Subscription and Managed Resource keys that may start late (decision 10). */
|
|
195
|
+
readonly deferrable: ReadonlyArray<string>;
|
|
196
|
+
/**
|
|
197
|
+
* `server`: a form whose `OnSubmit` names a Message also posts it to the
|
|
198
|
+
* page's own URL, and `SSR.handle` runs `update` there, so the form works
|
|
199
|
+
* with scripts off or not yet loaded.
|
|
200
|
+
*/
|
|
201
|
+
readonly fallback?: 'server' | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* What the page says of itself, from the Model: rendered into the head on
|
|
204
|
+
* the server, checked like the view, and kept in step in the browser.
|
|
205
|
+
*/
|
|
206
|
+
readonly meta?: ((model: Model) => Meta) | undefined;
|
|
207
|
+
/**
|
|
208
|
+
* The data the page was built from, for the browser's freshness check: a
|
|
209
|
+
* Remote cursor, a revision number, anything the check compares. Unset
|
|
210
|
+
* when the page has no age.
|
|
211
|
+
*/
|
|
212
|
+
readonly version?: unknown | undefined;
|
|
213
|
+
}
|
|
214
|
+
type Start = 'now' | 'idle' | 'on-interaction';
|
|
215
|
+
/**
|
|
216
|
+
* A package's contribution to the envelope, for state the plan's slice cannot
|
|
217
|
+
* carry, such as Remote's normalized store. On the server `capture` takes what
|
|
218
|
+
* the active Surfaces' projections read and returns it as JSON; in the browser
|
|
219
|
+
* `restore` sets it onto the Model, or says why it cannot. A part owns its
|
|
220
|
+
* encoding: this package only carries the value.
|
|
221
|
+
*
|
|
222
|
+
* `covers` names the metadata keys whose reads the part resumes, so the
|
|
223
|
+
* coverage check counts those reads as sent. `Remote.resume(Data)` is one.
|
|
224
|
+
*/
|
|
225
|
+
interface ResumePart<Model> {
|
|
226
|
+
readonly id: string;
|
|
227
|
+
readonly covers: ReadonlyArray<string>;
|
|
228
|
+
readonly capture: (model: Model, projections: ReadonlyArray<{
|
|
229
|
+
readonly metadata: Metadata;
|
|
230
|
+
}>) => unknown;
|
|
231
|
+
readonly restore: (model: Model, value: unknown) => Result.Result<Model, string>;
|
|
232
|
+
/**
|
|
233
|
+
* Whether a Subscription or Managed Resource entry of this part's package
|
|
234
|
+
* may start late, when a deferred boot is asked for. A part knows its own
|
|
235
|
+
* entries; nothing is deferrable by default.
|
|
236
|
+
*/
|
|
237
|
+
readonly deferrable?: ((key: string, entry: unknown) => boolean) | undefined;
|
|
238
|
+
}
|
|
239
|
+
declare const ResumeRefused_base: Schema.Class<ResumeRefused, Schema.TaggedStruct<"ResumeRefused", {
|
|
240
|
+
readonly reason: Schema.Literals<readonly ["Missing", "Duplicate", "Unreadable", "Protocol", "Plan", "Invalid", "Route"]>;
|
|
241
|
+
readonly message: Schema.String;
|
|
242
|
+
}>, import("effect/Cause").YieldableError>;
|
|
243
|
+
/** Why a page's resume envelope was refused. */
|
|
244
|
+
declare class ResumeRefused extends ResumeRefused_base {}
|
|
245
|
+
/**
|
|
246
|
+
* How a page's recorded route is compared with the browser's. `full` compares
|
|
247
|
+
* path and query. `path` compares the path alone, ignoring a trailing slash or
|
|
248
|
+
* `index.html`, for a page generated as a file: a static host serves one file
|
|
249
|
+
* for every query, and for `/about` and `/about/` alike.
|
|
250
|
+
*/
|
|
251
|
+
type RouteMatch = 'full' | 'path';
|
|
252
|
+
/** The attribute on a static region's element, naming the region. */
|
|
253
|
+
declare const STATIC_ATTRIBUTE = "data-foldkit-plus-static";
|
|
254
|
+
/**
|
|
255
|
+
* The `makeApplication` options `SSR` hands to Foldkit as they are, typed as
|
|
256
|
+
* Foldkit types them.
|
|
257
|
+
*/
|
|
258
|
+
type ApplicationOptions<Model, Message> = Partial<Pick<Runtime.RoutingApplicationConfig<Model, Message, never, never, Ports | undefined>, 'routing' | 'ports' | 'crash' | 'slow' | 'viewTransition' | 'freezeModel' | 'preserveScroll' | 'devTools'>>;
|
|
259
|
+
/**
|
|
260
|
+
* The part of a Foldkit application config a server render and a resumed
|
|
261
|
+
* client need. The full `makeApplication` config fits, whichever of its four
|
|
262
|
+
* shapes, and its callbacks (`routing`'s, say) are typed from `update`'s
|
|
263
|
+
* Message as Foldkit types them.
|
|
264
|
+
*/
|
|
265
|
+
interface ResumableConfig<Model, Message = any> extends ApplicationOptions<Model, Message> {
|
|
266
|
+
readonly Model: Schema.Codec<Model, any, unknown, unknown>;
|
|
267
|
+
readonly init: (...args: ReadonlyArray<any>) => {
|
|
268
|
+
readonly model: Model;
|
|
269
|
+
readonly commands?: ReadonlyArray<{
|
|
270
|
+
readonly name: string;
|
|
271
|
+
}> | undefined;
|
|
272
|
+
};
|
|
273
|
+
readonly update: (model: Model, message: Message) => {
|
|
274
|
+
readonly model: Model;
|
|
275
|
+
};
|
|
276
|
+
readonly view: (model: Model, h: any) => unknown;
|
|
277
|
+
readonly container: HTMLElement | null;
|
|
278
|
+
readonly Flags?: unknown;
|
|
279
|
+
readonly subscriptions?: Readonly<Record<string, unknown>> | undefined;
|
|
280
|
+
readonly managedResources?: Readonly<Record<string, unknown>> | undefined;
|
|
281
|
+
/** The services Commands need, as Foldkit's runtime provides them. */
|
|
282
|
+
readonly resources?: Layer.Layer<never, never, never> | undefined;
|
|
283
|
+
/**
|
|
284
|
+
* Bundles whose bodies load on demand (`Bundle.lazy`). The server loads
|
|
285
|
+
* them before it renders; the browser loads them before it boots, answering
|
|
286
|
+
* from the markers meanwhile, so a page never shows a bundle's placeholder.
|
|
287
|
+
*/
|
|
288
|
+
readonly lazy?: ReadonlyArray<Loadable> | undefined;
|
|
289
|
+
}
|
|
290
|
+
/** What `SSR` needs of a lazy bundle: `Bundle.lazy` gives it. */
|
|
291
|
+
interface Loadable {
|
|
292
|
+
readonly name: string;
|
|
293
|
+
readonly load: () => Promise<void>;
|
|
294
|
+
readonly isLoaded: () => boolean;
|
|
295
|
+
}
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/client.d.ts
|
|
298
|
+
/** The resumable track: bindings the server's markup names, so a page can answer before it boots. */
|
|
299
|
+
declare const Resume: {
|
|
300
|
+
builder: <Builder extends AnyBuilder>(h: Builder) => ResumableBuilder<MessageOf<Builder>>;
|
|
301
|
+
view: <Model, Builder extends AnyBuilder, Out>(render: (model: Model, rh: ResumableBuilder<MessageOf<Builder>>) => Out) => (model: Model, h: Builder) => Out;
|
|
302
|
+
bindings: <Model, Fields extends Schema.Struct.Fields>(plan: ResumePlan<Model, Fields>, page: ParentNode, root: Element, model: Model) => Result.Result<ReadonlyArray<DecodedBinding>, ResumeRefused>;
|
|
303
|
+
listen: (root: Element, options: ListenOptions) => (() => void);
|
|
304
|
+
};
|
|
305
|
+
/** The browser's part of `SSR`: the same functions, without the server's. */
|
|
306
|
+
declare const SSR: {
|
|
307
|
+
plan: <Model, Fields extends Schema.Struct.Fields, Commands = unknown>(application: {
|
|
308
|
+
readonly initial: Model;
|
|
309
|
+
readonly owner?: object;
|
|
310
|
+
readonly Message?: Schema.Top | undefined;
|
|
311
|
+
}, config: {
|
|
312
|
+
readonly id: string;
|
|
313
|
+
readonly state: import("foldkit-surface").WritableProjection<Model, Fields>;
|
|
314
|
+
readonly baseline?: Model | undefined;
|
|
315
|
+
readonly boot?: ((model: Model) => Commands) | undefined;
|
|
316
|
+
readonly local?: ReadonlyArray<{
|
|
317
|
+
readonly dependency: ReadonlyArray<string>;
|
|
318
|
+
}> | undefined;
|
|
319
|
+
readonly surfaces?: ReadonlyArray<import("foldkit-surface").ActiveSurface<Model>> | undefined;
|
|
320
|
+
readonly parts?: ReadonlyArray<ResumePart<Model>> | undefined;
|
|
321
|
+
readonly start?: Start | undefined;
|
|
322
|
+
readonly deferrable?: ReadonlyArray<string> | undefined;
|
|
323
|
+
readonly fallback?: "server" | undefined;
|
|
324
|
+
readonly meta?: ((model: Model) => Meta) | undefined;
|
|
325
|
+
readonly version?: unknown | undefined;
|
|
326
|
+
}) => ResumePlan<Model, Fields, Commands>;
|
|
327
|
+
resume: <Model, Fields extends Schema.Struct.Fields>(plan: ResumePlan<Model, Fields>, page: ParentNode, options?: {
|
|
328
|
+
readonly route?: string | undefined;
|
|
329
|
+
}) => Result.Result<Model, ResumeRefused>;
|
|
330
|
+
hydrate: <Model, Fields extends Schema.Struct.Fields, Message = any>(config: ResumableConfig<Model, Message>, plan: ResumePlan<Model, Fields>, options: {
|
|
331
|
+
readonly buildId: string;
|
|
332
|
+
/**
|
|
333
|
+
* Whether this page is taken over: asked before anything is adopted, so
|
|
334
|
+
* a page showing another reader's data never becomes live facts. Omitted
|
|
335
|
+
* adopts as before. Must not throw: a throwing predicate propagates out
|
|
336
|
+
* of `hydrate` with no runtime booted and nothing contained.
|
|
337
|
+
*/
|
|
338
|
+
readonly when?: ((page: Document) => boolean) | undefined;
|
|
339
|
+
/**
|
|
340
|
+
* What a declined or stale page does: `render` runs the application
|
|
341
|
+
* afresh where the rendered page is, replacing its markup in place (the
|
|
342
|
+
* config's container with no served page). Omitted contains the page the
|
|
343
|
+
* way a resume failure does.
|
|
344
|
+
*/
|
|
345
|
+
readonly otherwise?: "render" | undefined;
|
|
346
|
+
/**
|
|
347
|
+
* Whether the plan's data version is still current: asked once, with
|
|
348
|
+
* `plan.version`, before anything is adopted. Omitted never asks. A plan
|
|
349
|
+
* with no version still asks, with `undefined` (a check shaped like
|
|
350
|
+
* `version === expected` then marks every such page stale). Must not
|
|
351
|
+
* throw, as `when`.
|
|
352
|
+
*/
|
|
353
|
+
readonly fresh?: ((version: unknown) => boolean) | undefined;
|
|
354
|
+
}) => void;
|
|
355
|
+
static: (id: string, render: (ih: import("foldkit/html").HtmlBuilder<never>) => Region) => import("foldkit/html").Html;
|
|
356
|
+
serving: () => boolean;
|
|
357
|
+
};
|
|
358
|
+
//#endregion
|
|
359
|
+
export { SLOT_ATTRIBUTE as C, ResumableBuilder as S, EncodedBinding as _, META_ATTRIBUTE as a, BINDING_ATTRIBUTE as b, ResumableConfig as c, ResumeRefused as d, RouteMatch as f, DecodedBinding as g, metaMarkup as h, Loadable as i, ResumePart as l, Start as m, SSR as n, Meta as o, STATIC_ATTRIBUTE as p, FOLDKIT_APP_ATTRIBUTE as r, RESUME_ATTRIBUTE as s, Resume as t, ResumePlan as u, Region as v, FALLBACK_FIELD as x, UnnamedHandler as y };
|
|
360
|
+
//# sourceMappingURL=client-4jzvxuwf.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-4jzvxuwf.d.mts","names":[],"sources":["../src/resumable.ts","../src/context.ts","../src/listen.ts","../src/shared.ts","../src/client.ts"],"mappings":";;;;;;;cAoBa;;cA4GA;;cAMA;cAEC;;UAGG,QAAQ;YACb,UAAU;;KAGjB,QAAQ,GAAG,IAAI,KAAK,sBAAsB,YAAY;;KAGtD,kBAAkB,OAAO;WAAiB,QAAQ,OAAO,OAAO;;;KAGhE,KAAK,KAAK;WAAqB,YAAY;IAAM;;KAGjD,QAAQ,KAAK,QAAQ,KAAK,KAAK;;KAG/B,KAAK,GAAG,SAAS,KAAK,KAAK,mBAAmB;KAE9C,gBAAgB,GAAG,YAAY,KAAK,aAAa,qBAElD;KAEC,cAAc,GAAG,gBAAgB,KAAK,GAAG,0BAC1C,6EACa,cAAc,KAAK,GAAG,UACjC,yFACA,KAAK,GAAG,aAAa,KAAK,GAAG,wCACZ,KAAK,GAAG,aAAa,KAAK,GAAG,oBAE1C,wDACF;KAEH,aAAa,GAAG,gBAAgB,KAAK,GAAG,6EACJ,KAAK,GAAG,oBAE3C,mFACF;;UAGa,SAAS;GACvB,YAAY,kBAAkB,UAAU,UAAU;GAClD,UAAU,uBAAuB,cAAc,QAAQ,SACtD,QAAQ,IAAI,gBAAgB,GAAG,WAAW,cAAc,GAAG,QAC3D,QAAQ,QACP,UAAU;;;UAIE,QAAQ;GACtB,YAAY,aAAa,WAAW,sBAAsB,UAAU,UAAU;GAC9E,UAAU,uBAAuB,cAAc,QAAQ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