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
package/dist/index.d.mts
CHANGED
|
@@ -1,198 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as SLOT_ATTRIBUTE, S as ResumableBuilder, _ as EncodedBinding, a as META_ATTRIBUTE, b as BINDING_ATTRIBUTE, c as ResumableConfig, d as ResumeRefused, f as RouteMatch, g as DecodedBinding, h as metaMarkup, i as Loadable, l as ResumePart, m as Start, o as Meta, p as STATIC_ATTRIBUTE, r as FOLDKIT_APP_ATTRIBUTE, s as RESUME_ATTRIBUTE, t as Resume, u as ResumePlan, v as Region, x as FALLBACK_FIELD, y as UnnamedHandler } from "./client-4jzvxuwf.mjs";
|
|
2
|
+
import { Cause, Effect, Result, Schema } from "effect";
|
|
2
3
|
import { EntryModule, RenderError, RenderedApplication } from "foldkit/experimental/server";
|
|
3
|
-
import {
|
|
4
|
-
import { ActiveSurface, Metadata, MetadataSummary, WritableProjection } from "foldkit-surface";
|
|
5
|
-
//#region src/resumable.d.ts
|
|
6
|
-
/** The attribute prefix of an element's binding marker. */
|
|
7
|
-
export declare const BINDING_ATTRIBUTE = "data-foldkit-plus-on-";
|
|
8
|
-
/** The posted field that carries a form's encoded Message, for the server fallback. */
|
|
9
|
-
export declare const FALLBACK_FIELD = "foldkit-plus-message";
|
|
10
|
-
/** The attribute on a placement's root naming its slot, while the server renders. */
|
|
11
|
-
export declare const SLOT_ATTRIBUTE = "data-foldkit-plus-slot";
|
|
12
|
-
declare const invalid: unique symbol;
|
|
13
|
-
/** A compile-time failure that names its cause. */
|
|
14
|
-
interface Invalid<Message extends string> {
|
|
15
|
-
readonly [invalid]: Message;
|
|
16
|
-
}
|
|
17
|
-
type IsUnion<T, U = T> = T extends unknown ? ([U] extends [T] ? false : true) : never;
|
|
18
|
-
/** A Message constructor from `defineMessageUnion`: a tagged Schema that can be called. */
|
|
19
|
-
type AnyMemberSchema = Schema.Top & {
|
|
20
|
-
readonly fields: Schema.Struct.Fields;
|
|
21
|
-
};
|
|
22
|
-
/** The Message a member makes. */
|
|
23
|
-
type Made<M> = M extends {
|
|
24
|
-
readonly Type: infer T;
|
|
25
|
-
} ? T : never;
|
|
26
|
-
/** The fields a member's event may be given fixed: all but `_tag`. */
|
|
27
|
-
type Fixable<M> = Partial<Omit<Made<M>, '_tag'>>;
|
|
28
|
-
/** The fields of a member the event fills: those neither `_tag` nor fixed. */
|
|
29
|
-
type Rest<M, Fixed> = Omit<Made<M>, '_tag' | keyof Fixed>;
|
|
30
|
-
type ProducesMessage<M, Message> = [Made<M>] extends [Message] ? unknown : Invalid<"the member is not one of this view's Messages">;
|
|
31
|
-
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'>;
|
|
32
|
-
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'>;
|
|
33
|
-
/** `OnInput` and `OnChange`: a closure, or a member whose one string field the event fills. */
|
|
34
|
-
interface TextHole<Message> {
|
|
35
|
-
(toMessage: (value: string) => Message): Attribute<Message>;
|
|
36
|
-
<M extends AnyMemberSchema, const Fixed extends Fixable<M> = {}>(member: M & ProducesMessage<M, Message> & TextHoleCheck<M, Fixed>, fixed?: Fixed): Attribute<Message>;
|
|
37
|
-
}
|
|
38
|
-
/** `OnKeyDown` and `OnKeyUp`: a closure, or a member whose `key` and `modifiers` the event fills. */
|
|
39
|
-
interface KeyHole<Message> {
|
|
40
|
-
(toMessage: (key: string, modifiers: KeyboardModifiers) => Message): Attribute<Message>;
|
|
41
|
-
<M extends AnyMemberSchema, const Fixed extends Fixable<M> = {}>(member: M & ProducesMessage<M, Message> & KeyHoleCheck<M, Fixed>, fixed?: Fixed): Attribute<Message>;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* A builder a view is given: Foldkit's `HtmlBuilder`, or a Surface renderer's,
|
|
45
|
-
* which leaves out Foldkit's phantom key. Its Message is what `OnClick` takes.
|
|
46
|
-
*/
|
|
47
|
-
type AnyBuilder = {
|
|
48
|
-
readonly OnClick: (message: never, ...rest: ReadonlyArray<never>) => unknown;
|
|
49
|
-
};
|
|
50
|
-
/** The Message a builder's handlers make. */
|
|
51
|
-
type MessageOf<Builder> = Builder extends {
|
|
52
|
-
readonly OnClick: (message: infer Message, ...rest: ReadonlyArray<never>) => unknown;
|
|
53
|
-
} ? Message : never;
|
|
54
|
-
/**
|
|
55
|
-
* The resumable builder for a view whose Messages are `Message`: its elements
|
|
56
|
-
* and attributes, and the hole forms of the four value events. One shape
|
|
57
|
-
* whether it wraps a view's `HtmlBuilder` or a Surface renderer's builder, so a
|
|
58
|
-
* helper typed with it takes either. It keeps Foldkit's phantom Message key,
|
|
59
|
-
* so a placement's view accepts it as the parent's builder.
|
|
60
|
-
*/
|
|
61
|
-
type ResumableBuilder<Message> = Omit<HtmlBuilder<Message>, 'OnInput' | 'OnChange' | 'OnKeyDown' | 'OnKeyUp'> & {
|
|
62
|
-
readonly OnInput: TextHole<Message>;
|
|
63
|
-
readonly OnChange: TextHole<Message>;
|
|
64
|
-
readonly OnKeyDown: KeyHole<Message>;
|
|
65
|
-
readonly OnKeyUp: KeyHole<Message>;
|
|
66
|
-
};
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region src/listen.d.ts
|
|
69
|
-
/**
|
|
70
|
-
* A binding as the envelope carries it: Foldkit's attribute (`OnSubmit`,
|
|
71
|
-
* `OnBlur`), whose tag says what its handler does beside dispatching; the
|
|
72
|
-
* Message, encoded through the application's Message Schema (for a hole, with
|
|
73
|
-
* the hole filled by a placeholder); the fields the event fills, `depth`
|
|
74
|
-
* placement wrappers down; and the attribute's options. Its ordinal is its
|
|
75
|
-
* index. The page is read through this Schema, so a tampered list is refused.
|
|
76
|
-
*/
|
|
77
|
-
declare const EncodedBinding: Schema.Struct<{
|
|
78
|
-
readonly attribute: Schema.String;
|
|
79
|
-
readonly message: Schema.Unknown;
|
|
80
|
-
readonly hole: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
81
|
-
readonly depth: Schema.optionalKey<Schema.Number>;
|
|
82
|
-
readonly options: Schema.optionalKey<Schema.Unknown>;
|
|
83
|
-
}>;
|
|
84
|
-
type EncodedBinding = typeof EncodedBinding.Type;
|
|
85
|
-
/** A binding decoded from the page: its Message is one of the application's. */
|
|
86
|
-
interface DecodedBinding {
|
|
87
|
-
readonly attribute: string;
|
|
88
|
-
readonly event: string;
|
|
89
|
-
readonly message: unknown;
|
|
90
|
-
readonly hole?: ReadonlyArray<string> | undefined;
|
|
91
|
-
readonly depth?: number | undefined;
|
|
92
|
-
readonly options?: unknown;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* What the markers make of one event: the Messages its bindings dispatch, in
|
|
96
|
-
* the order the live page would, and, when the walk met a handler the page
|
|
97
|
-
* could not name, that element. An answer with `unnamed` is incomplete: the
|
|
98
|
-
* live page would do more than its Messages say.
|
|
99
|
-
*/
|
|
100
|
-
interface Answer {
|
|
101
|
-
readonly event: Event;
|
|
102
|
-
readonly messages: ReadonlyArray<unknown>;
|
|
103
|
-
readonly unnamed?: Element | undefined;
|
|
104
|
-
}
|
|
105
|
-
interface ListenOptions {
|
|
106
|
-
readonly bindings: ReadonlyArray<DecodedBinding>;
|
|
107
|
-
readonly onAnswer: (answer: Answer) => void;
|
|
108
|
-
}
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/context.d.ts
|
|
111
|
-
type Region = ReadonlyArray<Html | string>;
|
|
112
|
-
//#endregion
|
|
4
|
+
import { MetadataSummary } from "foldkit-surface";
|
|
113
5
|
//#region src/index.d.ts
|
|
114
|
-
/** The attribute on the script that carries a page's resume envelope. */
|
|
115
|
-
export declare const RESUME_ATTRIBUTE = "data-foldkit-plus-resume";
|
|
116
|
-
export declare const serializeJsonScript: (value: unknown) => string;
|
|
117
|
-
/**
|
|
118
|
-
* Which part of the Model the browser owns, and what it starts from.
|
|
119
|
-
*
|
|
120
|
-
* `state` is a writable projection of that part, from `Projection.pick` or
|
|
121
|
-
* `Projection.compose`. `baseline` is the Model the browser sets it onto, by
|
|
122
|
-
* default the application's own initial Model. `boot` names the Commands the
|
|
123
|
-
* browser runs on load, since `init` does not run there.
|
|
124
|
-
*/
|
|
125
|
-
export interface ResumePlan<Model, Fields extends Schema.Struct.Fields, Commands = unknown> {
|
|
126
|
-
readonly id: string;
|
|
127
|
-
readonly state: WritableProjection<Model, Fields>;
|
|
128
|
-
readonly baseline: Model;
|
|
129
|
-
readonly boot?: ((model: Model) => Commands) | undefined;
|
|
130
|
-
/** Model paths allowed to start from the baseline, as `ModelRef.dependency` gives them. */
|
|
131
|
-
readonly local: ReadonlyArray<ReadonlyArray<string>>;
|
|
132
|
-
/** The Surfaces the browser may activate, which the plan must cover. */
|
|
133
|
-
readonly surfaces: ReadonlyArray<ActiveSurface<Model>>;
|
|
134
|
-
/** State another package owns, each captured and restored by that package. */
|
|
135
|
-
readonly parts: ReadonlyArray<ResumePart<Model>>;
|
|
136
|
-
/** The application's Message Schema, which encodes the page's bindings. */
|
|
137
|
-
readonly Message?: Schema.Top | undefined;
|
|
138
|
-
/**
|
|
139
|
-
* When the browser boots the runtime: `now` on load, `idle` when the browser
|
|
140
|
-
* is idle or on the first interaction, `on-interaction` on the first only.
|
|
141
|
-
* Until then the page answers events from its bindings and queues the
|
|
142
|
-
* Messages, which replay once the runtime has adopted the page.
|
|
143
|
-
*/
|
|
144
|
-
readonly start: Start;
|
|
145
|
-
/** Subscription and Managed Resource keys that may start late (decision 10). */
|
|
146
|
-
readonly deferrable: ReadonlyArray<string>;
|
|
147
|
-
/**
|
|
148
|
-
* `server`: a form whose `OnSubmit` names a Message also posts it to the
|
|
149
|
-
* page's own URL, and `SSR.handle` runs `update` there, so the form works
|
|
150
|
-
* with scripts off or not yet loaded.
|
|
151
|
-
*/
|
|
152
|
-
readonly fallback?: 'server' | undefined;
|
|
153
|
-
}
|
|
154
|
-
export type Start = 'now' | 'idle' | 'on-interaction';
|
|
155
|
-
/**
|
|
156
|
-
* A package's contribution to the envelope, for state the plan's slice cannot
|
|
157
|
-
* carry, such as Remote's normalized store. On the server `capture` takes what
|
|
158
|
-
* the active Surfaces' projections read and returns it as JSON; in the browser
|
|
159
|
-
* `restore` sets it onto the Model, or says why it cannot. A part owns its
|
|
160
|
-
* encoding: this package only carries the value.
|
|
161
|
-
*
|
|
162
|
-
* `covers` names the metadata keys whose reads the part resumes, so the
|
|
163
|
-
* coverage check counts those reads as sent. `Remote.resume(Data)` is one.
|
|
164
|
-
*/
|
|
165
|
-
export interface ResumePart<Model> {
|
|
166
|
-
readonly id: string;
|
|
167
|
-
readonly covers: ReadonlyArray<string>;
|
|
168
|
-
readonly capture: (model: Model, projections: ReadonlyArray<{
|
|
169
|
-
readonly metadata: Metadata;
|
|
170
|
-
}>) => unknown;
|
|
171
|
-
readonly restore: (model: Model, value: unknown) => Result.Result<Model, string>;
|
|
172
|
-
/**
|
|
173
|
-
* Whether a Subscription or Managed Resource entry of this part's package
|
|
174
|
-
* may start late, when a deferred boot is asked for. A part knows its own
|
|
175
|
-
* entries; nothing is deferrable by default.
|
|
176
|
-
*/
|
|
177
|
-
readonly deferrable?: ((key: string, entry: unknown) => boolean) | undefined;
|
|
178
|
-
}
|
|
179
|
-
declare const ResumeRefused_base: Schema.Class<ResumeRefused, Schema.TaggedStruct<"ResumeRefused", {
|
|
180
|
-
readonly reason: Schema.Literals<readonly ["Missing", "Duplicate", "Unreadable", "Protocol", "Plan", "Invalid", "Route"]>;
|
|
181
|
-
readonly message: Schema.String;
|
|
182
|
-
}>, Cause.YieldableError>;
|
|
183
|
-
/** Why a page's resume envelope was refused. */
|
|
184
|
-
export declare class ResumeRefused extends ResumeRefused_base {}
|
|
185
|
-
/**
|
|
186
|
-
* How a page's recorded route is compared with the browser's. `full` compares
|
|
187
|
-
* path and query. `path` compares the path alone, ignoring a trailing slash or
|
|
188
|
-
* `index.html`, for a page generated as a file: a static host serves one file
|
|
189
|
-
* for every query, and for `/about` and `/about/` alike.
|
|
190
|
-
*/
|
|
191
|
-
type RouteMatch = 'full' | 'path';
|
|
192
6
|
interface EnvelopeOptions {
|
|
193
7
|
readonly route?: string | undefined;
|
|
194
8
|
readonly match?: RouteMatch | undefined;
|
|
195
9
|
readonly bindings?: ReadonlyArray<EncodedBinding> | undefined;
|
|
10
|
+
/** Every event the page's markers name, so the browser listens without scanning for them. */
|
|
11
|
+
readonly events?: ReadonlyArray<string> | undefined;
|
|
196
12
|
}
|
|
197
13
|
/** Where the browser gets a Model path's value: the envelope, the baseline, or nowhere it may. */
|
|
198
14
|
export type Cover = 'state' | 'local' | 'missing';
|
|
@@ -229,49 +45,36 @@ export interface PlanInspection {
|
|
|
229
45
|
readonly surfaces: ReadonlyArray<SurfaceCoverage>;
|
|
230
46
|
}
|
|
231
47
|
declare const ResumeUnsafe_base: Schema.Class<ResumeUnsafe, Schema.TaggedStruct<"ResumeUnsafe", {
|
|
232
|
-
readonly reason: Schema.Literals<readonly ["UndeclaredStartup", "Uncovered", "ViewDependsOnUnsentState", "DuplicateStaticRegion", "UngeneratablePath", "UnrestorablePart", "UnencodableBinding", "EagerStartRequired", "UndeclaredSurfaces", "BindingInStaticRegion"]>;
|
|
48
|
+
readonly reason: Schema.Literals<readonly ["UndeclaredStartup", "Uncovered", "ViewDependsOnUnsentState", "DuplicateStaticRegion", "UngeneratablePath", "UnrestorablePart", "UnencodableBinding", "EagerStartRequired", "UndeclaredSurfaces", "BindingInStaticRegion", "VoidRootWithStyles"]>;
|
|
233
49
|
readonly message: Schema.String;
|
|
234
50
|
}>, Cause.YieldableError>;
|
|
235
51
|
/** Why a server refused to render a page against its plan. */
|
|
236
52
|
export declare class ResumeUnsafe extends ResumeUnsafe_base {}
|
|
237
|
-
/**
|
|
238
|
-
export
|
|
239
|
-
/**
|
|
240
|
-
* The part of a Foldkit application config a server render and a resumed
|
|
241
|
-
* client need. The full `makeApplication` config fits.
|
|
242
|
-
*/
|
|
243
|
-
export interface ResumableConfig<Model> {
|
|
244
|
-
readonly Model: Schema.Codec<Model, any, unknown, unknown>;
|
|
245
|
-
readonly init: (...args: ReadonlyArray<any>) => {
|
|
246
|
-
readonly model: Model;
|
|
247
|
-
readonly commands?: ReadonlyArray<{
|
|
248
|
-
readonly name: string;
|
|
249
|
-
}> | undefined;
|
|
250
|
-
};
|
|
251
|
-
readonly update: (model: Model, message: any) => {
|
|
252
|
-
readonly model: Model;
|
|
253
|
-
};
|
|
254
|
-
readonly view: (model: Model, h: any) => unknown;
|
|
255
|
-
readonly container: HTMLElement | null;
|
|
256
|
-
readonly Flags?: unknown;
|
|
257
|
-
readonly routing?: unknown;
|
|
258
|
-
readonly subscriptions?: Readonly<Record<string, unknown>> | undefined;
|
|
259
|
-
readonly managedResources?: Readonly<Record<string, unknown>> | undefined;
|
|
260
|
-
/** The services Commands need, as Foldkit's runtime provides them. */
|
|
261
|
-
readonly resources?: Layer.Layer<any, any, never> | undefined;
|
|
53
|
+
/** A page the server rendered against a plan, with its envelope. */
|
|
54
|
+
export interface RenderedPage {
|
|
262
55
|
/**
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
56
|
+
* The rendered application with the envelope on its stamped root, so
|
|
57
|
+
* Foldkit's `injectIntoTemplate` places the page whole: the host owns the
|
|
58
|
+
* template, and the entry never splices markup into it.
|
|
266
59
|
*/
|
|
267
|
-
readonly
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
readonly
|
|
272
|
-
|
|
273
|
-
|
|
60
|
+
readonly rendered: RenderedApplication;
|
|
61
|
+
/** The envelope, as carried on the root, for tests and custom hosts. */
|
|
62
|
+
readonly envelope: string;
|
|
63
|
+
/** The head markup of the plan's `meta`, empty without one. */
|
|
64
|
+
readonly meta: string;
|
|
65
|
+
/**
|
|
66
|
+
* Each element whose handler for an event is a function, marked `*`: the
|
|
67
|
+
* page cannot answer that event before the live runtime boots.
|
|
68
|
+
*/
|
|
69
|
+
readonly unnamed: ReadonlyArray<UnnamedHandler>;
|
|
274
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* What a page adds to its head, given what it rendered: such as a stylesheet
|
|
73
|
+
* of the classes the markup uses (`Style.usedIn` in `foldkit-mixins`). The
|
|
74
|
+
* same shape describes `styles`, which rides in the rendered root instead,
|
|
75
|
+
* for pages whose template the host owns.
|
|
76
|
+
*/
|
|
77
|
+
export type Head = (rendered: RenderedApplication) => string;
|
|
275
78
|
/** A page generated at build time, and the file a static host serves it from. */
|
|
276
79
|
export interface GeneratedPage {
|
|
277
80
|
readonly path: string;
|
|
@@ -289,13 +92,6 @@ declare const FallbackRefused_base: Schema.Class<FallbackRefused, Schema.TaggedS
|
|
|
289
92
|
}>, Cause.YieldableError>;
|
|
290
93
|
/** Why a posted form was not handled: the request, not the page or the plan, is at fault. */
|
|
291
94
|
export declare class FallbackRefused extends FallbackRefused_base {}
|
|
292
|
-
/** The resumable track: bindings the server's markup names, so a page can answer before it boots. */
|
|
293
|
-
export declare const Resume: {
|
|
294
|
-
builder: <Builder extends AnyBuilder>(h: Builder) => ResumableBuilder<MessageOf<Builder>>;
|
|
295
|
-
view: <Model, Builder extends AnyBuilder, Out>(render: (model: Model, rh: ResumableBuilder<MessageOf<Builder>>) => Out) => (model: Model, h: Builder) => Out;
|
|
296
|
-
bindings: <Model, Fields extends Schema.Struct.Fields>(plan: ResumePlan<Model, Fields>, page: ParentNode, root: Element, model: Model) => Result.Result<ReadonlyArray<DecodedBinding>, ResumeRefused>;
|
|
297
|
-
listen: (root: Element, options: ListenOptions) => (() => void);
|
|
298
|
-
};
|
|
299
95
|
export declare const SSR: {
|
|
300
96
|
plan: <Model, Fields extends Schema.Struct.Fields, Commands = unknown>(application: {
|
|
301
97
|
readonly initial: Model;
|
|
@@ -303,61 +99,88 @@ export declare const SSR: {
|
|
|
303
99
|
readonly Message?: Schema.Top | undefined;
|
|
304
100
|
}, config: {
|
|
305
101
|
readonly id: string;
|
|
306
|
-
readonly state: WritableProjection<Model, Fields>;
|
|
102
|
+
readonly state: import("foldkit-surface").WritableProjection<Model, Fields>;
|
|
307
103
|
readonly baseline?: Model | undefined;
|
|
308
104
|
readonly boot?: ((model: Model) => Commands) | undefined;
|
|
309
105
|
readonly local?: ReadonlyArray<{
|
|
310
106
|
readonly dependency: ReadonlyArray<string>;
|
|
311
107
|
}> | undefined;
|
|
312
|
-
readonly surfaces?: ReadonlyArray<ActiveSurface<Model>> | undefined;
|
|
108
|
+
readonly surfaces?: ReadonlyArray<import("foldkit-surface").ActiveSurface<Model>> | undefined;
|
|
313
109
|
readonly parts?: ReadonlyArray<ResumePart<Model>> | undefined;
|
|
314
110
|
readonly start?: Start | undefined;
|
|
315
111
|
readonly deferrable?: ReadonlyArray<string> | undefined;
|
|
316
112
|
readonly fallback?: "server" | undefined;
|
|
113
|
+
readonly meta?: ((model: Model) => Meta) | undefined;
|
|
114
|
+
readonly version?: unknown | undefined;
|
|
317
115
|
}) => ResumePlan<Model, Fields, Commands>;
|
|
318
116
|
envelope: <Model, Fields extends Schema.Struct.Fields>(resume: ResumePlan<Model, Fields>, model: Model, options?: EnvelopeOptions) => string;
|
|
319
117
|
resume: <Model, Fields extends Schema.Struct.Fields>(plan: ResumePlan<Model, Fields>, page: ParentNode, options?: {
|
|
320
118
|
readonly route?: string | undefined;
|
|
321
119
|
}) => Result.Result<Model, ResumeRefused>;
|
|
322
|
-
render: <Model, Fields extends Schema.Struct.Fields>(config: ResumableConfig<Model>, plan: ResumePlan<Model, Fields>, options: {
|
|
120
|
+
render: <Model, Fields extends Schema.Struct.Fields, Message = any>(config: ResumableConfig<Model, Message>, plan: ResumePlan<Model, Fields>, options: {
|
|
323
121
|
readonly buildId: string;
|
|
324
122
|
readonly url?: string | undefined;
|
|
325
123
|
readonly flags?: unknown;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Markup for the first paint, given what was rendered, carried as the
|
|
126
|
+
* root's last child: keep it to `<style>`, which the browser drops on
|
|
127
|
+
* hydration. Anything a head owns (`meta`, links) stays with `SSR.page`
|
|
128
|
+
* and `SSR.generate`.
|
|
129
|
+
*/
|
|
130
|
+
readonly styles?: Head | undefined;
|
|
131
|
+
}) => Effect.Effect<RenderedPage, RenderError | ResumeUnsafe>;
|
|
330
132
|
page: (template: string, result: {
|
|
331
133
|
readonly rendered: RenderedApplication;
|
|
332
|
-
readonly
|
|
134
|
+
readonly meta: string;
|
|
135
|
+
}, options?: {
|
|
136
|
+
readonly head?: Head | undefined;
|
|
333
137
|
}) => string;
|
|
334
|
-
hydrate: <Model, Fields extends Schema.Struct.Fields>(config: ResumableConfig<Model>, plan: ResumePlan<Model, Fields>, options: {
|
|
138
|
+
hydrate: <Model, Fields extends Schema.Struct.Fields, Message = any>(config: ResumableConfig<Model, Message>, plan: ResumePlan<Model, Fields>, options: {
|
|
335
139
|
readonly buildId: string;
|
|
140
|
+
readonly when?: ((page: Document) => boolean) | undefined;
|
|
141
|
+
readonly otherwise?: "render" | undefined;
|
|
142
|
+
readonly fresh?: ((version: unknown) => boolean) | undefined;
|
|
336
143
|
}) => void;
|
|
337
144
|
inspect: <Model, Fields extends Schema.Struct.Fields>(plan: ResumePlan<Model, Fields>, model: Model) => PlanInspection;
|
|
338
|
-
static: (id: string, render: (ih: HtmlBuilder<never>) => Region) => Html;
|
|
339
|
-
|
|
145
|
+
static: (id: string, render: (ih: import("foldkit/html").HtmlBuilder<never>) => Region) => import("foldkit/html").Html;
|
|
146
|
+
serving: () => boolean;
|
|
147
|
+
generate: <Model, Fields extends Schema.Struct.Fields, const Paths extends ReadonlyArray<string>, Message = any>(config: ResumableConfig<Model, Message>, plan: ResumePlan<Model, Fields>, options: {
|
|
340
148
|
readonly buildId: string;
|
|
341
149
|
readonly template: string;
|
|
342
150
|
readonly origin: string;
|
|
343
151
|
readonly paths: Paths;
|
|
344
152
|
readonly flags?: ((path: string) => unknown) | undefined;
|
|
153
|
+
readonly head?: Head | undefined;
|
|
345
154
|
}) => Effect.Effect<GeneratedPages<Paths>, RenderError | ResumeUnsafe>;
|
|
346
|
-
entry: <Model, Fields extends Schema.Struct.Fields>(config: ResumableConfig<Model>, plan: ResumePlan<Model, Fields>, options: {
|
|
155
|
+
entry: <Model, Fields extends Schema.Struct.Fields, Message = any>(config: ResumableConfig<Model, Message>, plan: ResumePlan<Model, Fields>, options: {
|
|
347
156
|
readonly buildId: string;
|
|
348
|
-
readonly template: string;
|
|
349
|
-
readonly containerId?: string | undefined;
|
|
350
157
|
readonly flags?: ((request: Request) => unknown | PromiseLike<unknown>) | undefined;
|
|
158
|
+
readonly headers?: ((request: Request) => HeadersInit) | undefined;
|
|
159
|
+
/**
|
|
160
|
+
* Markup for the first paint, carried as the rendered root's last child.
|
|
161
|
+
* The host owns the template in dynamic serving, so this is where
|
|
162
|
+
* per-page styles go; anything a head owns stays with `SSR.generate`.
|
|
163
|
+
*/
|
|
164
|
+
readonly styles?: Head | undefined;
|
|
351
165
|
}) => EntryModule;
|
|
352
|
-
handle: <Model, Fields extends Schema.Struct.Fields>(request: Request, config: ResumableConfig<Model>, plan: ResumePlan<Model, Fields>, options: {
|
|
166
|
+
handle: <Model, Fields extends Schema.Struct.Fields, Message = any>(request: Request, config: ResumableConfig<Model, Message>, plan: ResumePlan<Model, Fields>, options: {
|
|
353
167
|
readonly buildId: string;
|
|
354
168
|
readonly flags?: unknown;
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
readonly envelope: string;
|
|
358
|
-
}, RenderError | ResumeUnsafe | FallbackRefused>;
|
|
169
|
+
readonly styles?: Head | undefined;
|
|
170
|
+
}) => Effect.Effect<RenderedPage, RenderError | ResumeUnsafe | FallbackRefused>;
|
|
359
171
|
serializeJsonScript: (value: unknown) => string;
|
|
172
|
+
sitemap: (pages: ReadonlyArray<{
|
|
173
|
+
readonly path: string;
|
|
174
|
+
readonly modified?: string | undefined;
|
|
175
|
+
}>, options: {
|
|
176
|
+
readonly origin: string;
|
|
177
|
+
}) => string;
|
|
178
|
+
robots: (options: {
|
|
179
|
+
readonly origin: string;
|
|
180
|
+
readonly sitemap?: string | undefined;
|
|
181
|
+
readonly disallow?: ReadonlyArray<string> | undefined;
|
|
182
|
+
}) => string;
|
|
360
183
|
};
|
|
361
184
|
//#endregion
|
|
362
|
-
export type
|
|
185
|
+
export { BINDING_ATTRIBUTE, type DecodedBinding, FALLBACK_FIELD, FOLDKIT_APP_ATTRIBUTE, type Loadable, META_ATTRIBUTE, type Meta, RESUME_ATTRIBUTE, type ResumableBuilder, type ResumableConfig, Resume, type ResumePart, type ResumePlan, ResumeRefused, SLOT_ATTRIBUTE, STATIC_ATTRIBUTE, type Start, type UnnamedHandler, metaMarkup };
|
|
363
186
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;UAmFU;WACC;WACA,QAAQ;WACR,WAAW,cAAc;;WAEzB,SAAS;;;YA6HR;;iBAGK;WACN;;WAEA;;WAEA;aAAwB;aAAuB,OAAO;;;WAEtD,OAAO;aAAyB;aAAuB,OAAO;;;;;;WAK9D,WAAW,cAAc;;WAEzB;;;iBAIM;WACN;WACA,OAAO;WACP,OAAO;;WAEP,OAAO;WACP,UAAU,cAAc;;;;;;;qBAuHtB,qBAAqB;;iBA+HjB;;;;;;WAMN,UAAU;;WAEV;;WAEA;;;;;WAKA,SAAS,cAAc;;;;;;;;YAkMtB,QAAQ,UAAU;;iBAmEb;WACN;WACA;WACA;;;;;;YAOC,eAAe,cAAc,qCAC7B,WAAW,QAAQ;;;;;;qBAgTlB,wBAAwB;qBA+LxB;;;aAz8B0C;aAE/C,UAAA,OAAA;;;;aAIH,WAAC;aAAqC,SAAC,OAAA,UAAA;aACgB,QAAC;;;aAIrD,WAAF,wCAAA,cAAA;aAGQ,QAAb,cAAA,WAAA;aACqC,QADrC;aAE0B,aAAC;aAEhB;aACkB,SAAC,OAAA,UAAA;aAErB;;EA9NQ,WAAA,OAAO,eAAe,OAAO,OAAO,QAAM,QAClD,WAAW,OAAO,SAAO,OAC1B,OAAK,UACH;;aAmWG;;EA6DE,SAAA,OAAO,eAAe,OAAO,OAAO,QAAQ,eAAO,QACzD,gBAAgB,OAAO,UAAQ,MACjC,WAAW,OAAO,SAAO;aAEpB;aACA;aACA;;;;;;;aAOA,SAAS;QAEnB,OAAO,OAAO,cAAc,cAAc;EA4NjC,OAAA,kBAAM;aACG,UAAU;aAA8B;KAAc;aACrD,OAAO;;;;aAnqBwC,SAAC,MAAA;aAS/B;aAUZ,UAAC;;EA0LX,UAAA,OAAO,eAAe,OAAO,OAAO,QAAM,MACnD,WAAW,OAAO,SAAO,OACxB,UACN;;;EAglBD,WAAA,OACA,eAAe,OAAO,OAAO,cACvB,cAAc,uBACpB,eAAO,QAEC,gBAAgB,OAAO,UAAQ,MACjC,WAAW,OAAO,SAAO;aAEpB;aACA;aACA;aACA,OAAO;aACP,UAAU;aACV,OAAO;QAEjB,OAAO,OAAO,eAAe,QAAQ,cAAc;EAyEvC,QAAA,OAAO,eAAe,OAAO,OAAO,QAAQ,eAAO,QACxD,gBAAgB,OAAO,UAAQ,MACjC,WAAW,OAAO,SAAO;aAEpB;aACA,UAAU,SAAS,sBAAsB;aACzC,YAAY,SAAS,YAAY;;;;;;aAMjC,SAAS;QAEnB;EAgNa,SAAA,OAAO,eAAe,OAAO,OAAO,QAAQ,eAAO,SACxD,SAAO,QACR,gBAAgB,OAAO,UAAQ,MACjC,WAAW,OAAO,SAAO;aAEpB;aACA;aACA,SAAS;QAEnB,OAAO,OAAO,cAAc,cAAc,eAAe;;EA/YnD,UAAA,OAAA;aAAyB;aAAuB;MAAgC;aACnE;;EA4BG,SAAA;aACd;aACA;aACA,WAAW"}
|