foldkit-builder 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,2996 @@
1
+ import { Option, Pipeable, Schema } from "effect";
2
+ import { Bundle } from "foldkit-bundle";
3
+ import { AnyBlock, Catalog, CatalogAction, Document, NodeId, Operation, PropsOf } from "foldkit-composition";
4
+ import { Renderer } from "foldkit-composition/foldkit";
5
+ import { Control } from "foldkit-form";
6
+ import { Entity } from "foldkit-entity";
7
+ import { Metadata } from "foldkit-metadata";
8
+ import { TreeNavigation } from "foldkit-primitives/interaction";
9
+ import { Html, HtmlBuilder, KeyboardModifiers } from "foldkit/html";
10
+ import "foldkit/message";
11
+ import * as Submodel from "foldkit/submodel";
12
+ import * as ManagedResource from "foldkit/managedResource";
13
+ import * as Subscription from "foldkit/subscription";
14
+ import * as Update from "foldkit/update";
15
+ import { CallableTaggedStruct } from "foldkit/schema";
16
+ import "foldkit/url";
17
+ //#region ../bundle/src/placed.d.ts
18
+ declare const PlacedTypeId: unique symbol;
19
+ /**
20
+ * Args for a placement: a static value, or a factory deriving them from the
21
+ * parent seed — the fields `assembly.initial(rest)` was given, before any
22
+ * placement initialised. A factory runs once per initialization and its result
23
+ * is retained for the placement's `init`, `update`, helpers, Subscriptions,
24
+ * and resources; it never re-runs against changing parent state, so keep it
25
+ * pure of its seed.
26
+ *
27
+ * When no initialization ran — a hand-built Model in a test, which never went
28
+ * through `initial` — `update` derives from the given parent per use, without
29
+ * retaining, so each Model is folded with its own seed.
30
+ *
31
+ * Read only seed fields (route, auth, workspace, ...), never sibling
32
+ * placement fields: every factory sees the same base seed, so a sibling read
33
+ * is consistently absent rather than order-dependent.
34
+ */
35
+ type ArgsSource<Seed, Args> = Args | ((seed: Seed) => Args);
36
+ interface PlaceConfig<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, ParentSeed = Parent> {
37
+ /**
38
+ * The bundle's args: a static value, or a factory from the parent seed (the
39
+ * fields `assembly.initial(rest)` was given, minus this placement's own
40
+ * field). A factory is computed once per initialization and retained for
41
+ * `init`, `update`, and helpers. Subscriptions and resources built from it
42
+ * require `initial`/`config` to have run first; a bundle with neither
43
+ * contributes empty records either way.
44
+ */
45
+ readonly args?: ArgsSource<ParentSeed, Args>;
46
+ /** Handles the child's OutMessage in parent terms, with the child already written back. */
47
+ readonly onOut?: (outMessage: OutMessage, context: Update.FoldContext<Message, LinkMessage>) => Update.Step<NoInfer<Parent>, OutStepMessage, R2>;
48
+ /**
49
+ * Observes each of the child's Messages in parent terms, after the child has
50
+ * handled it and its `onOut` has run, so the parent's own update needs no arm
51
+ * for the wrapper. Helpers are not Messages and do not reach it.
52
+ */
53
+ readonly onMessage?: (message: Message) => Update.Step<NoInfer<Parent>, OutStepMessage, R2>;
54
+ /** Prefix for the placement's Subscription and resource keys. Defaults to `Name@path`. */
55
+ readonly key?: string;
56
+ /** A gate beside the Link's own: Subscriptions and resources run only while both hold. */
57
+ readonly when?: (parent: Parent) => boolean;
58
+ }
59
+ /** A lifted resource record: each child entry in parent terms, keyed by the placement. */
60
+ type PlacedResources<Parent, ParentMessage, Resources> = Readonly<Record<string, { readonly [K in keyof Resources]: Resources[K] extends ManagedResource.Entry<any, any, infer Requirements, infer Value, infer Service, infer OnAcquired extends (...args: ReadonlyArray<any>) => any> ? ManagedResource.Entry<Parent, ParentMessage, Requirements, Value, Service, (...args: Parameters<OnAcquired>) => ParentMessage> : never; }[keyof Resources]>>;
61
+ type PlacedHelpers<Parent, ParentMessage, R, Helpers> = { readonly [K in keyof Helpers]: Helpers[K] extends ((model: any, ...input: infer Input) => any) ? (...input: Input) => Update.Step<Parent, ParentMessage, R> : never; };
62
+ interface Placed<Name extends string, Parent, ParentMessage, Model, Message, R, S, ViewInputs, Resources, Helpers, Field extends string = string, Claimed extends string = string> {
63
+ readonly [PlacedTypeId]: typeof PlacedTypeId;
64
+ /** Types only: the top-level Model field this placement owns, or `string` when unknown. */
65
+ readonly field?: Field;
66
+ /** Types only: the parent Message tag this placement routes, or `string` when unknown. */
67
+ readonly claims?: Claimed;
68
+ readonly name: Name;
69
+ /** `Name@path`, or the configured `key`: the prefix of every Subscription and resource key. */
70
+ readonly key: string;
71
+ /** The encoded args as text, when the bundle has an args Schema. */
72
+ readonly argsSummary: string | undefined;
73
+ /** Whether `args` was given as a seed factory; resolved once per initialization. */
74
+ readonly hasDynamicArgs: boolean;
75
+ /**
76
+ * Derives the factory's args from `seed`, validates them against the
77
+ * bundle's args Schema, and retains them for `init`, `update`, helpers,
78
+ * Subscriptions, and resources. A no-op for static args. The assembly calls
79
+ * this with the base seed before running inits, so every factory sees the
80
+ * same parent state whatever the placement order.
81
+ */
82
+ readonly resolveArgs: (seed: unknown) => void;
83
+ /**
84
+ * Assembly use: marks the placement skipped because `rest` provides its
85
+ * top-level field, so its factory never runs and its records contribute
86
+ * nothing while the child is absent. Cleared by the next `resolveArgs`.
87
+ */
88
+ readonly skipArgs: () => void;
89
+ readonly link: Link<Parent, ParentMessage, Model, Message>;
90
+ /** Writes the child's initial Model and starts its `init` Commands. */
91
+ readonly init: Update.Step<Parent, ParentMessage, R>;
92
+ /** Folds the Message when it belongs to this placement; `None` otherwise. */
93
+ readonly update: (parent: Parent, message: AnyMessage) => Option.Option<Update.Return<Parent, ParentMessage, R>>;
94
+ readonly subscriptions: Subscription.Subscriptions<Parent, ParentMessage, S>;
95
+ readonly resources: PlacedResources<Parent, ParentMessage, Resources>;
96
+ /**
97
+ * Renders the child through `h.submodel`; nothing while the child is absent.
98
+ * Generic over the parent's whole Message, which must include this placement's.
99
+ */
100
+ readonly view: PlacedView<Parent, ParentMessage, ViewInputs>;
101
+ /**
102
+ * The same view in another slot, for rendering one placement in two DOM
103
+ * positions (desktop and mobile). `h.submodel` throws on a repeated slot.
104
+ */
105
+ readonly viewIn: (slot: string) => PlacedView<Parent, ParentMessage, ViewInputs>;
106
+ readonly helpers: PlacedHelpers<Parent, ParentMessage, R, Helpers>;
107
+ }
108
+ /**
109
+ * What a placement's view needs of a builder: `submodel`, and `OnClick` to
110
+ * read its Message from. A wrapper of Foldkit's builder that keeps both, such
111
+ * as `foldkit-ssr`'s resumable builder, is one.
112
+ */
113
+ type BuilderLike = Pick<HtmlBuilder<any>, 'submodel' | 'OnClick'>;
114
+ type PlacedView<Parent, ParentMessage, ViewInputs> = [ViewInputs] extends [void] ? <H extends BuilderLike>(parent: Parent, h: ViewBuilder<H, ParentMessage>) => Html : <H extends BuilderLike>(parent: Parent, h: ViewBuilder<H, ParentMessage>, viewInputs: ViewInputs) => Html;
115
+ /** A readable type error: intersected onto a parameter, its message names the fix. */
116
+ interface Invalid<Message extends string> {
117
+ readonly invalid: Message;
118
+ }
119
+ type BuilderMessage<H> = H extends {
120
+ readonly OnClick: (message: infer M, ...rest: any) => any;
121
+ } ? M : never;
122
+ /**
123
+ * The parent's `h`, checked to accept this placement's Messages. Generic over the
124
+ * whole builder rather than its Message: inferring a Message through
125
+ * `HtmlBuilder` costs thousands of type instantiations per call, while the
126
+ * builder infers as itself and its Message is extracted once per builder type.
127
+ */
128
+ type ViewBuilder<H, ParentMessage> = H & ([ParentMessage] extends [BuilderMessage<H>] ? unknown : Invalid<"The parent Message does not include this placement's wrapper variant; spread its Link.wrapper(...).cases into defineMessageUnion">);
129
+ /** The tag of a Link's parent variant, or `string` when it cannot be read. */
130
+ type TagOf<LinkMessage> = LinkMessage extends {
131
+ readonly _tag: infer Tag extends string;
132
+ } ? Tag : string;
133
+ //#endregion
134
+ //#region ../bundle/src/link.d.ts
135
+ declare const LinkTypeId: unique symbol;
136
+ /** The parent Message variant `Tag({ message })` that carries a child's Messages. */
137
+ type Wrapped<Tag extends string, ChildMessage> = {
138
+ readonly _tag: Tag;
139
+ readonly message: ChildMessage;
140
+ };
141
+ /**
142
+ * Both directions between a child Message and its parent variant. Spread
143
+ * `cases` into the parent's `defineMessageUnion` so the variant is part of the
144
+ * parent Message.
145
+ */
146
+ interface Wrapper<Tag extends string, ChildMessage> {
147
+ readonly tag: Tag;
148
+ readonly Schema: CallableTaggedStruct<Tag, {
149
+ readonly message: Schema.Codec<ChildMessage, unknown>;
150
+ }>;
151
+ readonly cases: { readonly [K in Tag]: {
152
+ readonly message: Schema.Codec<ChildMessage, unknown>;
153
+ }; };
154
+ readonly make: (message: ChildMessage) => Wrapped<Tag, ChildMessage>;
155
+ readonly toParentMessage: (message: ChildMessage) => Wrapped<Tag, ChildMessage>;
156
+ readonly fromParentMessage: (message: AnyMessage) => Option.Option<ChildMessage>;
157
+ }
158
+ /** Every Foldkit Message is tagged; routing only needs the tag. */
159
+ type AnyMessage = {
160
+ readonly _tag: string;
161
+ };
162
+ /**
163
+ * `Field` is the parent's top-level field the child is written into, when the
164
+ * Link is one: `never` for a child nested deeper, and `string` when unknown.
165
+ */
166
+ interface Link<Parent, ParentMessage, Child, ChildMessage, Field extends string = string> extends Pipeable.Pipeable {
167
+ readonly [LinkTypeId]: typeof LinkTypeId;
168
+ /** Types only: the top-level field, so `placements.initial` knows who writes it. */
169
+ readonly field?: Field;
170
+ readonly read: (parent: Parent) => Option.Option<Child>;
171
+ readonly write: (parent: Parent, child: Child) => Parent;
172
+ readonly toParentMessage: (message: ChildMessage) => ParentMessage;
173
+ /** Recognises this child's variant among all of the parent's Messages. */
174
+ readonly fromParentMessage: (message: AnyMessage) => Option.Option<ChildMessage>;
175
+ /** The parent's own gate: while it returns `false`, the child's Subscriptions and resources stop. */
176
+ readonly when: Option.Option<(parent: Parent) => boolean>;
177
+ /** Where the child lives, for placement keys and diagnostics. */
178
+ readonly path: ReadonlyArray<string>;
179
+ /** The parent Message tags this link's Messages travel under, outermost first. */
180
+ readonly messages: ReadonlyArray<string>;
181
+ /** The application a Link built from a Surface field ref belongs to, for its Module contract. */
182
+ readonly owner?: object | undefined;
183
+ }
184
+ /** A Message union's variant `Tag({ message })`, as `defineMessageUnion` declares it. */
185
+ type Variant = {
186
+ readonly fields: {
187
+ readonly _tag: Schema.tag<string>;
188
+ readonly message: Schema.Top;
189
+ };
190
+ };
191
+ type VariantTag<V extends Variant> = V['fields']['_tag'] extends Schema.tag<infer Tag extends string> ? Tag : never;
192
+ type OnlyMessage<V extends Variant> = [Exclude<keyof V['fields'], '_tag' | 'message'>] extends [never] ? unknown : Invalid<'A wrapper variant carries only `message`; this variant has other fields'>;
193
+ /**
194
+ * The parent variant `Tag({ message })` for a child's Messages: from a tag and
195
+ * the child's Message Schema, whose `cases` then go into the parent's union, or
196
+ * from a variant the parent's union already declares.
197
+ */
198
+ declare function wrapper<const Tag extends string, ChildMessage>(tag: Tag, childMessage: Schema.Codec<ChildMessage, unknown>): Wrapper<Tag, ChildMessage>;
199
+ declare function wrapper<V extends Variant>(variant: V & OnlyMessage<V>): Wrapper<VariantTag<V>, V['fields']['message']['Type']>;
200
+ interface MakeConfig<Parent, Tag extends string, Child, ChildMessage, Path> {
201
+ readonly read: (parent: Parent) => Option.Option<Child>;
202
+ readonly write: (parent: Parent, child: Child) => Parent;
203
+ readonly wrapper: Wrapper<Tag, ChildMessage>;
204
+ readonly when?: (parent: Parent) => boolean;
205
+ readonly path: Path;
206
+ readonly owner?: object | undefined;
207
+ }
208
+ /**
209
+ * The top-level field a path names. `initial` treats a one-segment path as the
210
+ * field the placement writes, so a longer one names none.
211
+ */
212
+ type FieldOfPath<Path> = Path extends readonly [infer Field extends string] ? Field : Path extends readonly [string, ...ReadonlyArray<string>] ? never : string;
213
+ type OptionKeys<Parent> = { [K in keyof Parent]: Parent[K] extends Option.Option<unknown> ? K : never; }[keyof Parent] & string;
214
+ type OptionValue<A> = A extends Option.Option<infer Value> ? Value : never;
215
+ /** The parent Message variant `Tag({ key, message })` that carries one collection item's Messages. */
216
+ type KeyedWrapped<Tag extends string, ChildMessage, Key extends string = string> = {
217
+ readonly _tag: Tag;
218
+ readonly key: Key;
219
+ readonly message: ChildMessage;
220
+ };
221
+ type KeyedFields<ChildMessage, Key extends string> = {
222
+ readonly key: Schema.Codec<Key, string>;
223
+ readonly message: Schema.Codec<ChildMessage, unknown>;
224
+ };
225
+ /** Both directions between an item's Message and its keyed parent variant. */
226
+ interface KeyedWrapper<Tag extends string, ChildMessage, Key extends string = string> {
227
+ readonly tag: Tag;
228
+ readonly Schema: CallableTaggedStruct<Tag, KeyedFields<ChildMessage, Key>>;
229
+ readonly cases: { readonly [K in Tag]: KeyedFields<ChildMessage, Key>; };
230
+ readonly make: (key: Key, message: ChildMessage) => KeyedWrapped<Tag, ChildMessage, Key>;
231
+ readonly fromParentMessage: (message: AnyMessage) => Option.Option<readonly [key: Key, message: ChildMessage]>;
232
+ }
233
+ /**
234
+ * Where a keyed collection of children lives. The storage is the Link's
235
+ * business: a record by key, an array identified by id, or anything with these
236
+ * operations. `entries` is the order views and Subscriptions follow.
237
+ */
238
+ interface CollectionLink<Parent, ParentMessage, Child, ChildMessage, Key extends string = string, Field extends string = string> {
239
+ /** Types only: the top-level field holding the items, or `string` when unknown. */
240
+ readonly field?: Field;
241
+ /** The storage with no items, for a parent's initial Model. */
242
+ readonly empty: unknown;
243
+ readonly entries: (parent: Parent) => ReadonlyArray<readonly [key: Key, child: Child]>;
244
+ readonly get: (parent: Parent, key: Key) => Option.Option<Child>;
245
+ /** Writes one item; `None` removes it. */
246
+ readonly write: (parent: Parent, key: Key, child: Option.Option<Child>) => Parent;
247
+ readonly toParentMessage: (key: Key, message: ChildMessage) => ParentMessage;
248
+ readonly fromParentMessage: (message: AnyMessage) => Option.Option<readonly [key: Key, message: ChildMessage]>;
249
+ /** The parent's gate per item: while it returns `false`, that item's Subscriptions stop. */
250
+ readonly when: Option.Option<(parent: Parent, key: Key) => boolean>;
251
+ readonly path: ReadonlyArray<string>;
252
+ /** The parent Message tag this collection's Messages travel under. */
253
+ readonly messages: ReadonlyArray<string>;
254
+ }
255
+ type RecordKeys<Parent> = { [K in keyof Parent]: Parent[K] extends Readonly<Record<string, unknown>> ? K : never; }[keyof Parent] & string;
256
+ type RecordValue<A> = A extends Readonly<Record<string, infer Value>> ? Value : never;
257
+ type ArrayKeys<Parent> = { [K in keyof Parent]: Parent[K] extends ReadonlyArray<unknown> ? K : never; }[keyof Parent] & string;
258
+ type ArrayItem<A> = A extends ReadonlyArray<infer Item> ? Item : never;
259
+ declare const Link: {
260
+ readonly wrapper: typeof wrapper;
261
+ readonly make: <Parent, const Tag extends string, Child, ChildMessage, const Path extends ReadonlyArray<string> = readonly string[]>(config: MakeConfig<Parent, Tag, Child, ChildMessage, Path>) => Link<Parent, Wrapped<Tag, ChildMessage>, Child, ChildMessage, FieldOfPath<Path>>;
262
+ readonly field: <Parent>() => <const Key extends keyof Parent & string, const Tag extends string, ChildMessage>(key: Key, wrap: Wrapper<Tag, ChildMessage>, options?: {
263
+ readonly when?: (parent: Parent) => boolean;
264
+ }) => Link<Parent, Wrapped<Tag, ChildMessage>, Parent[Key], ChildMessage, Key>;
265
+ readonly optional: <Parent>() => <const Key extends OptionKeys<Parent>, const Tag extends string, ChildMessage>(key: Key, wrap: Wrapper<Tag, ChildMessage>, options?: {
266
+ readonly when?: (parent: Parent) => boolean;
267
+ }) => Link<Parent, Wrapped<Tag, ChildMessage>, OptionValue<Parent[Key]>, ChildMessage, Key>;
268
+ readonly compose: <A, AMessage, B, BMessage extends AnyMessage, C, CMessage>(outer: Link<A, AMessage, B, BMessage, string>, inner: Link<B, BMessage, C, CMessage, string>) => Link<A, AMessage, C, CMessage, never>;
269
+ readonly andThen: {
270
+ <B, BMessage extends AnyMessage, C, CMessage>(inner: Link<B, BMessage, C, CMessage, string>): <A, AMessage>(outer: Link<A, AMessage, B, BMessage, string>) => Link<A, AMessage, C, CMessage, never>;
271
+ <A, AMessage, B, BMessage extends AnyMessage, C, CMessage>(outer: Link<A, AMessage, B, BMessage, string>, inner: Link<B, BMessage, C, CMessage, string>): Link<A, AMessage, C, CMessage, never>;
272
+ };
273
+ readonly when: {
274
+ <Parent>(predicate: (parent: Parent) => boolean): <ParentMessage, Child, ChildMessage, Field extends string>(self: Link<Parent, ParentMessage, Child, ChildMessage, Field>) => Link<Parent, ParentMessage, Child, ChildMessage, Field>;
275
+ <Parent, ParentMessage, Child, ChildMessage, Field extends string>(self: Link<Parent, ParentMessage, Child, ChildMessage, Field>, predicate: (parent: Parent) => boolean): Link<Parent, ParentMessage, Child, ChildMessage, Field>;
276
+ };
277
+ readonly foldInit: <Parent, ParentMessage, Child, ChildMessage, Field extends string>(link: Link<Parent, ParentMessage, Child, ChildMessage, Field>, rest: Omit<Parent, Field>) => {
278
+ readonly toParentModel: (child: Child) => Parent;
279
+ readonly toParentMessage: (message: ChildMessage) => ParentMessage;
280
+ };
281
+ readonly keyedWrapper: <const Tag extends string, ChildMessage, Key extends string = string>(tag: Tag, childMessage: Schema.Codec<ChildMessage, unknown>, key?: Schema.Codec<Key, string>) => KeyedWrapper<Tag, ChildMessage, Key>;
282
+ readonly collection: <Parent>() => <const Field extends RecordKeys<Parent>, const Tag extends string, ChildMessage, Key extends string>(field: Field, wrap: KeyedWrapper<Tag, ChildMessage, Key>, options?: {
283
+ readonly when?: (parent: Parent, key: Key) => boolean;
284
+ }) => CollectionLink<Parent, KeyedWrapped<Tag, ChildMessage, Key>, RecordValue<Parent[Field]>, ChildMessage, Key, Field>;
285
+ readonly collectionById: <Parent>() => <const Field extends ArrayKeys<Parent>, const Tag extends string, ChildMessage, Key extends string>(field: Field, wrap: KeyedWrapper<Tag, ChildMessage, Key>, options: {
286
+ readonly id: (item: ArrayItem<Parent[Field]>) => Key;
287
+ readonly when?: (parent: Parent, key: Key) => boolean;
288
+ }) => CollectionLink<Parent, KeyedWrapped<Tag, ChildMessage, Key>, ArrayItem<Parent[Field]>, ChildMessage, Key, Field>;
289
+ readonly child: <Parent, ParentMessage, Child, ChildMessage, Services>(link: Link<Parent, ParentMessage, Child, ChildMessage, string>, update: (model: Child, message: ChildMessage) => Update.Return<Child, ChildMessage, Services>, view: (model: Child, h: HtmlBuilder<ChildMessage>) => Html, slotId: string) => {
290
+ readonly update: (parent: Parent, message: ChildMessage) => Update.Return<Parent, ParentMessage, Services>;
291
+ readonly view: PlacedView<Parent, ParentMessage, void>;
292
+ };
293
+ };
294
+ //#endregion
295
+ //#region ../bundle/src/collection.d.ts
296
+ declare const PlacedCollectionTypeId: unique symbol;
297
+ interface EachConfig<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, Key extends string = string, ParentSeed = Parent> {
298
+ /**
299
+ * The args every item's `init` and `update` receive: a static value, or a
300
+ * factory from the parent seed, computed once per initialization and
301
+ * retained. Adding items requires `initial`/`config` to have run; `update`
302
+ * on a Model no initialization produced derives per use instead.
303
+ */
304
+ readonly args?: ArgsSource<ParentSeed, Args>;
305
+ /** Handles an item's OutMessage in parent terms, with the item already written back. */
306
+ readonly onOut?: (outMessage: OutMessage, key: Key, context: Update.FoldContext<Message, LinkMessage>) => Update.Step<NoInfer<Parent>, OutStepMessage, R2>;
307
+ /** Observes each item's Messages in parent terms, after the item has handled it and its `onOut` has run. */
308
+ readonly onMessage?: (message: Message, key: Key) => Update.Step<NoInfer<Parent>, OutStepMessage, R2>;
309
+ /** Prefix for the collection's Subscription keys. Defaults to `Name@path[]`. */
310
+ readonly key?: string;
311
+ readonly when?: (parent: Parent, key: Key) => boolean;
312
+ }
313
+ type CollectionView<Parent, ParentMessage, ViewInputs, Key extends string = string> = [ViewInputs] extends [void] ? <H extends BuilderLike>(parent: Parent, h: ViewBuilder<H, ParentMessage>, key: Key) => Html : <H extends BuilderLike>(parent: Parent, h: ViewBuilder<H, ParentMessage>, key: Key, viewInputs: ViewInputs) => Html;
314
+ type CollectionHelpers<Parent, ParentMessage, R, Helpers, Key extends string = string> = { readonly [K in keyof Helpers]: Helpers[K] extends ((model: any, ...input: infer Input) => any) ? (key: Key, ...input: Input) => Update.Step<Parent, ParentMessage, R> : never; };
315
+ interface PlacedCollection<Name extends string, Parent, ParentMessage, Model, Message, R, S, ViewInputs, Helpers, Field extends string = string, Key extends string = string, Claimed extends string = string> {
316
+ readonly [PlacedCollectionTypeId]: typeof PlacedCollectionTypeId;
317
+ /** Types only: the record field this collection owns, or `string` when unknown. */
318
+ readonly field?: Field;
319
+ /** Types only: the parent Message tag this collection routes, or `string` when unknown. */
320
+ readonly claims?: Claimed;
321
+ readonly name: Name;
322
+ /** `Name@path[]`, or the configured `key`: the prefix of every Subscription key. */
323
+ readonly key: string;
324
+ /** The encoded args as text, when the bundle has an args Schema. */
325
+ readonly argsSummary: string | undefined;
326
+ /** Whether `args` was given as a seed factory; resolved once per initialization. */
327
+ readonly hasDynamicArgs: boolean;
328
+ /**
329
+ * Derives the factory's args from `seed` and retains them for `add`,
330
+ * `update`, and Subscriptions. A no-op for static args.
331
+ */
332
+ readonly resolveArgs: (seed: unknown) => void;
333
+ readonly link: CollectionLink<Parent, ParentMessage, Model, Message, Key>;
334
+ /** Folds the Message into its item; `None` when it is not this collection's. A missing key leaves the parent unchanged. */
335
+ readonly update: (parent: Parent, message: AnyMessage) => Option.Option<Update.Return<Parent, ParentMessage, R>>;
336
+ /**
337
+ * Writes a new item from `init` and starts its Commands. `prepare` adjusts the
338
+ * initial Model first, for what only the parent knows, such as the item's id.
339
+ * An existing item is replaced.
340
+ */
341
+ readonly add: (key: Key, prepare?: (model: Model) => Model) => Update.Step<Parent, ParentMessage, R>;
342
+ /** Removes an item; its Subscriptions stop with it, and later Messages for it are ignored. */
343
+ readonly remove: (key: Key) => Update.Step<Parent, ParentMessage, never>;
344
+ readonly subscriptions: Subscription.Subscriptions<Parent, ParentMessage, S>;
345
+ /** One item's view; nothing when the key is missing. */
346
+ readonly view: CollectionView<Parent, ParentMessage, ViewInputs, Key>;
347
+ /** Every item's view, in the order of the Link's `entries`. */
348
+ readonly viewAll: <H extends BuilderLike>(parent: Parent, h: ViewBuilder<H, ParentMessage>, ...viewInputs: [ViewInputs] extends [void] ? [] : [viewInputs: ViewInputs]) => ReadonlyArray<Html>;
349
+ readonly helpers: CollectionHelpers<Parent, ParentMessage, R, Helpers, Key>;
350
+ }
351
+ //#endregion
352
+ //#region ../bundle/src/bundle.d.ts
353
+ /**
354
+ * The parent seed a factory observes: the parent without the placement's own
355
+ * field, or the whole parent where the field is unknown (`string`).
356
+ */
357
+ type SeedFor<Parent, Field extends string> = string extends Field ? Parent : Omit<Parent, Field>;
358
+ declare const BundleTypeId: unique symbol;
359
+ /** A child Managed Resource entry: its requirements are an `Option`, so the entry can release. */
360
+ type ResourceEntry<Model, Message> = ManagedResource.Entry<Model, Message, Option.Option<any>, any, any>;
361
+ type ResourceEntries<Model, Message> = Readonly<Record<string, ResourceEntry<Model, Message>>>;
362
+ /** A programmatic entry point, like `Dialog.open`: the child Model plus any input. */
363
+ type Helper<Model, Message, OutMessage, R> = (model: Model, ...input: ReadonlyArray<any>) => Update.ReturnWithOutMessage<Model, Message, OutMessage, R>;
364
+ interface BundleSpec<Name extends string, Args, Model, Message extends AnyMessage, OutMessage, R, S, ViewInputs, Resources extends ResourceEntries<Model, Message>, Helpers extends Readonly<Record<string, Helper<Model, Message, OutMessage, R>>>> {
365
+ readonly name: Name;
366
+ readonly Model: Schema.Codec<Model, unknown>;
367
+ readonly Message: Schema.Codec<Message, unknown>;
368
+ /**
369
+ * The args Schema. When given, `Args` is inferred from it, a placement's args
370
+ * are checked against it, and Module lists them.
371
+ */
372
+ readonly args?: Schema.Codec<Args, unknown>;
373
+ /** Set by `with`: the bound args, encoded as text, for Module. */
374
+ readonly preset?: string | undefined;
375
+ /** Runs when the bundle is placed; its Commands start with the placement. */
376
+ readonly init: (args: Args) => Update.Return<Model, Message, R>;
377
+ readonly update: (model: Model, message: Message, args: Args) => Update.ReturnWithOutMessage<Model, Message, OutMessage, R>;
378
+ readonly subscriptions?: (args: Args) => Subscription.Subscriptions<Model, Message, S>;
379
+ readonly resources?: (args: Args) => Resources;
380
+ readonly view?: Submodel.View<Model, Message, ViewInputs>;
381
+ readonly helpers?: Helpers;
382
+ }
383
+ interface Bundle$1<Name extends string, Args, Model, Message extends AnyMessage, OutMessage, R, S, ViewInputs, Resources extends ResourceEntries<Model, Message>, Helpers extends Readonly<Record<string, Helper<Model, Message, OutMessage, R>>>> extends BundleSpec<Name, Args, Model, Message, OutMessage, R, S, ViewInputs, Resources, Helpers>, Pipeable.Pipeable {
384
+ readonly [BundleTypeId]: typeof BundleTypeId;
385
+ /**
386
+ * A preset: the same bundle with its args bound, so placements need no `args`.
387
+ * The args are checked against the args Schema when there is one.
388
+ */
389
+ readonly with: (args: Args) => Bundle$1<Name, void, Model, Message, OutMessage, R, S, ViewInputs, Resources, Helpers>;
390
+ /** Places the bundle where `link` points. */
391
+ readonly at: <Parent, LinkMessage, Field extends string, OutStepMessage = never, R2 = never>(link: Link<Parent, LinkMessage, Model, Message, Field>, ...config: PlaceConfigParam<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, SeedFor<Parent, Field>>) => Placed<Name, Parent, LinkMessage | OutStepMessage, Model, Message, R | R2, S, ViewInputs, Resources, Helpers, Field, TagOf<LinkMessage>>;
392
+ /** Places the bundle once per key of the collection `link` points at. */
393
+ readonly each: [keyof Resources] extends [never] ? <Parent, LinkMessage, Key extends string, Field extends string, OutStepMessage = never, R2 = never>(link: CollectionLink<Parent, LinkMessage, Model, Message, Key, Field>, ...config: EachConfigParam<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, Key, SeedFor<Parent, Field>>) => PlacedCollection<Name, Parent, LinkMessage | OutStepMessage, Model, Message, R | R2, S, ViewInputs, Helpers, Field, Key, TagOf<LinkMessage>> : Invalid<'Bundle.each does not support Managed Resources yet: the runtime provides a resource by one tag, so items would share it'>;
394
+ }
395
+ /**
396
+ * What placing needs: `args` when `init` takes them, and `onOut` when the
397
+ * bundle has an OutMessage, so an OutMessage is never dropped by omission.
398
+ * `args` is a static value or a factory from the parent seed (the parent
399
+ * without this placement's own field); the seed type defaults to the whole
400
+ * parent where the field is unknown.
401
+ */
402
+ type PlacementConfig<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, ParentSeed = Parent> = {
403
+ /** Prefix for the placement's Subscription and resource keys. Defaults to `Name@path`. */
404
+ readonly key?: string;
405
+ /** A gate beside the Link's own: the child's Subscriptions and resources run only while both hold. */
406
+ readonly when?: (parent: Parent) => boolean;
407
+ /** Observes each of the child's Messages in parent terms, after the child handled it. */
408
+ readonly onMessage?: Required<PlaceConfig<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, ParentSeed>>['onMessage'];
409
+ } & ([Args] extends [void] ? {
410
+ readonly args?: never;
411
+ } : {
412
+ readonly args: ArgsSource<ParentSeed, Args>;
413
+ }) & ([OutMessage] extends [never] ? {
414
+ readonly onOut?: never;
415
+ } : {
416
+ readonly onOut: Required<PlaceConfig<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, ParentSeed>>['onOut'];
417
+ });
418
+ /** The config argument is optional only when it would be empty. */
419
+ type PlaceConfigParam<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, ParentSeed = Parent> = [Args] extends [void] ? [OutMessage] extends [never] ? [config?: PlacementConfig<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, ParentSeed>] : [config: PlacementConfig<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, ParentSeed>] : [config: PlacementConfig<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, ParentSeed>];
420
+ type EachOptions<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, Key extends string = string, ParentSeed = Parent> = {
421
+ readonly key?: string;
422
+ /** A gate per item beside the Link's own: an item's Subscriptions run only while both hold. */
423
+ readonly when?: (parent: Parent, key: Key) => boolean;
424
+ /** Observes each item's Messages in parent terms, after the item handled it. */
425
+ readonly onMessage?: Required<EachConfig<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, Key, ParentSeed>>['onMessage'];
426
+ } & ([Args] extends [void] ? {
427
+ readonly args?: never;
428
+ } : {
429
+ readonly args: ArgsSource<ParentSeed, Args>;
430
+ }) & ([OutMessage] extends [never] ? {
431
+ readonly onOut?: never;
432
+ } : {
433
+ readonly onOut: Required<EachConfig<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, Key, ParentSeed>>['onOut'];
434
+ });
435
+ type EachConfigParam<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, Key extends string = string, ParentSeed = Parent> = [Args] extends [void] ? [OutMessage] extends [never] ? [config?: EachOptions<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, Key, ParentSeed>] : [config: EachOptions<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, Key, ParentSeed>] : [config: EachOptions<Args, Parent, LinkMessage, Message, OutMessage, OutStepMessage, R2, Key, ParentSeed>];
436
+ //#endregion
437
+ //#region src/settings.d.ts
438
+ /** A form over `fields`, named `name`, with the controls `hints` asks for. */
439
+ declare const make: (name: string, fields: Readonly<Record<string, Schema.Top>>, hints: Readonly<Record<string, Control>>) => {
440
+ form: {
441
+ bundle: Bundle$1<string, void, import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
442
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
443
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, {
444
+ readonly _tag: "Nested";
445
+ readonly key: string;
446
+ readonly row: string;
447
+ readonly message: unknown;
448
+ } | {
449
+ readonly _tag: "Submitted";
450
+ } | {
451
+ readonly _tag: "ValidatedAll";
452
+ } | {
453
+ readonly _tag: "Reset";
454
+ } | {
455
+ readonly _tag: "RowAdded";
456
+ readonly key: string;
457
+ } | {
458
+ readonly _tag: "RowRemoved";
459
+ readonly key: string;
460
+ readonly row: string;
461
+ } | {
462
+ readonly _tag: "About";
463
+ readonly subject: {
464
+ readonly [x: string]: string;
465
+ };
466
+ } | {
467
+ readonly _tag: "Changed";
468
+ readonly key: string;
469
+ readonly value: string | boolean | readonly string[];
470
+ } | {
471
+ readonly _tag: "Blurred";
472
+ readonly key: string;
473
+ } | {
474
+ readonly _tag: "Searched";
475
+ readonly key: string;
476
+ readonly text: string;
477
+ } | {
478
+ readonly _tag: "Checked";
479
+ readonly key: string;
480
+ readonly draft: string | boolean | readonly string[];
481
+ readonly error: string | null;
482
+ } | {
483
+ readonly _tag: "Refused";
484
+ readonly key: string;
485
+ readonly error: string;
486
+ } | {
487
+ readonly _tag: "Control";
488
+ readonly key: never;
489
+ readonly message: unknown;
490
+ }, import("foldkit-form").Submitted<{
491
+ readonly [x: string]: unknown;
492
+ }>, never, never, void, {}, {
493
+ fill: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
494
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
495
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, values: Partial<{
496
+ readonly [x: string]: unknown;
497
+ }>) => {
498
+ readonly model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
499
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
500
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
501
+ };
502
+ }>;
503
+ Message: import("foldkit/message").MessageUnion<{
504
+ Changed: {
505
+ key: Schema.Literals<readonly [string, ...string[]]>;
506
+ value: Schema.Union<readonly [Schema.String, Schema.Boolean, Schema.$Array<Schema.String>]>;
507
+ };
508
+ Blurred: {
509
+ key: Schema.Literals<readonly [string, ...string[]]>;
510
+ };
511
+ ValidatedAll: {};
512
+ Submitted: {};
513
+ Reset: {};
514
+ Checked: {
515
+ key: Schema.Literals<readonly [string, ...string[]]>;
516
+ draft: Schema.Union<readonly [Schema.String, Schema.Boolean, Schema.$Array<Schema.String>]>;
517
+ error: Schema.NullOr<Schema.String>;
518
+ };
519
+ Refused: {
520
+ key: Schema.Literals<readonly [string, ...string[]]>;
521
+ error: Schema.String;
522
+ };
523
+ About: {
524
+ subject: Schema.$Record<Schema.String, Schema.String>;
525
+ };
526
+ Searched: {
527
+ key: Schema.Literals<readonly [string, ...string[]]>;
528
+ text: Schema.String;
529
+ };
530
+ Nested: {
531
+ key: Schema.String;
532
+ row: Schema.String;
533
+ message: Schema.Unknown;
534
+ };
535
+ Control: {
536
+ key: Schema.Literals<readonly [never, ...never[]]>;
537
+ message: Schema.Unknown;
538
+ };
539
+ RowAdded: {
540
+ key: Schema.String;
541
+ };
542
+ RowRemoved: {
543
+ key: Schema.String;
544
+ row: Schema.String;
545
+ };
546
+ }>;
547
+ input: import("foldkit-entity").EntityInput<Entity<string, Readonly<Record<string, Schema.Top>>, {}, {}>, Readonly<Record<string, Schema.Top>>, {
548
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
549
+ }>;
550
+ authoredChanged: (before: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
551
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
552
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, after: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
553
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
554
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => boolean;
555
+ fill: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
556
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
557
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, values: Partial<{
558
+ readonly [x: string]: unknown;
559
+ }>) => {
560
+ readonly model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
561
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
562
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
563
+ };
564
+ initial: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
565
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
566
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
567
+ controls: import("foldkit-form").FormControl<string>[];
568
+ field: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
569
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
570
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, key: string) => import("foldkit/fieldValidation").Field<import("foldkit-form").Draft>;
571
+ control: <K extends never>(key: K) => {
572
+ readonly field: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
573
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
574
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => import("foldkit/fieldValidation").Field<string>;
575
+ readonly send: (message: never) => {
576
+ readonly _tag: "Nested";
577
+ readonly key: string;
578
+ readonly row: string;
579
+ readonly message: unknown;
580
+ } | {
581
+ readonly _tag: "Submitted";
582
+ } | {
583
+ readonly _tag: "ValidatedAll";
584
+ } | {
585
+ readonly _tag: "Reset";
586
+ } | {
587
+ readonly _tag: "RowAdded";
588
+ readonly key: string;
589
+ } | {
590
+ readonly _tag: "RowRemoved";
591
+ readonly key: string;
592
+ readonly row: string;
593
+ } | {
594
+ readonly _tag: "About";
595
+ readonly subject: {
596
+ readonly [x: string]: string;
597
+ };
598
+ } | {
599
+ readonly _tag: "Changed";
600
+ readonly key: string;
601
+ readonly value: string | boolean | readonly string[];
602
+ } | {
603
+ readonly _tag: "Blurred";
604
+ readonly key: string;
605
+ } | {
606
+ readonly _tag: "Searched";
607
+ readonly key: string;
608
+ readonly text: string;
609
+ } | {
610
+ readonly _tag: "Checked";
611
+ readonly key: string;
612
+ readonly draft: string | boolean | readonly string[];
613
+ readonly error: string | null;
614
+ } | {
615
+ readonly _tag: "Refused";
616
+ readonly key: string;
617
+ readonly error: string;
618
+ } | {
619
+ readonly _tag: "Control";
620
+ readonly key: never;
621
+ readonly message: unknown;
622
+ };
623
+ };
624
+ search: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
625
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
626
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, key: string) => string;
627
+ subject: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
628
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
629
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => Readonly<Record<string, string>>;
630
+ nested: {};
631
+ row: <K extends never>(key: K, row: string) => import("foldkit-form").RowHandle<K extends never ? NonNullable<{}[K]> : import("foldkit-form").NestedForm, {
632
+ readonly _tag: "Nested";
633
+ readonly key: string;
634
+ readonly row: string;
635
+ readonly message: unknown;
636
+ } | {
637
+ readonly _tag: "Submitted";
638
+ } | {
639
+ readonly _tag: "ValidatedAll";
640
+ } | {
641
+ readonly _tag: "Reset";
642
+ } | {
643
+ readonly _tag: "RowAdded";
644
+ readonly key: string;
645
+ } | {
646
+ readonly _tag: "RowRemoved";
647
+ readonly key: string;
648
+ readonly row: string;
649
+ } | {
650
+ readonly _tag: "About";
651
+ readonly subject: {
652
+ readonly [x: string]: string;
653
+ };
654
+ } | {
655
+ readonly _tag: "Changed";
656
+ readonly key: string;
657
+ readonly value: string | boolean | readonly string[];
658
+ } | {
659
+ readonly _tag: "Blurred";
660
+ readonly key: string;
661
+ } | {
662
+ readonly _tag: "Searched";
663
+ readonly key: string;
664
+ readonly text: string;
665
+ } | {
666
+ readonly _tag: "Checked";
667
+ readonly key: string;
668
+ readonly draft: string | boolean | readonly string[];
669
+ readonly error: string | null;
670
+ } | {
671
+ readonly _tag: "Refused";
672
+ readonly key: string;
673
+ readonly error: string;
674
+ } | {
675
+ readonly _tag: "Control";
676
+ readonly key: never;
677
+ readonly message: unknown;
678
+ }>;
679
+ isFollowing: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
680
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
681
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, key: string) => boolean;
682
+ rows: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
683
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
684
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, key: never) => never;
685
+ canSubmit: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
686
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
687
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => boolean;
688
+ isValid: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
689
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
690
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => boolean;
691
+ value: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
692
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
693
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => Option.Option<{
694
+ readonly [x: string]: unknown;
695
+ }>;
696
+ settled: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
697
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
698
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
699
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
700
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
701
+ partial: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
702
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
703
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => Partial<{
704
+ readonly [x: string]: unknown;
705
+ }>;
706
+ engine: {
707
+ submit: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
708
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
709
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => {
710
+ model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
711
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
712
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
713
+ commands: readonly Readonly<{
714
+ name: string;
715
+ args?: Record<string, unknown>;
716
+ key?: string;
717
+ effect: import("effect/Effect").Effect<{
718
+ readonly _tag: "Nested";
719
+ readonly key: string;
720
+ readonly row: string;
721
+ readonly message: unknown;
722
+ } | {
723
+ readonly _tag: "Submitted";
724
+ } | {
725
+ readonly _tag: "ValidatedAll";
726
+ } | {
727
+ readonly _tag: "Reset";
728
+ } | {
729
+ readonly _tag: "RowAdded";
730
+ readonly key: string;
731
+ } | {
732
+ readonly _tag: "RowRemoved";
733
+ readonly key: string;
734
+ readonly row: string;
735
+ } | {
736
+ readonly _tag: "About";
737
+ readonly subject: {
738
+ readonly [x: string]: string;
739
+ };
740
+ } | {
741
+ readonly _tag: "Changed";
742
+ readonly key: string;
743
+ readonly value: string | boolean | readonly string[];
744
+ } | {
745
+ readonly _tag: "Blurred";
746
+ readonly key: string;
747
+ } | {
748
+ readonly _tag: "Searched";
749
+ readonly key: string;
750
+ readonly text: string;
751
+ } | {
752
+ readonly _tag: "Checked";
753
+ readonly key: string;
754
+ readonly draft: string | boolean | readonly string[];
755
+ readonly error: string | null;
756
+ } | {
757
+ readonly _tag: "Refused";
758
+ readonly key: string;
759
+ readonly error: string;
760
+ } | {
761
+ readonly _tag: "Control";
762
+ readonly key: never;
763
+ readonly message: unknown;
764
+ }, never, never>;
765
+ }>[];
766
+ };
767
+ validateAll: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
768
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
769
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => {
770
+ readonly model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
771
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
772
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
773
+ readonly commands: readonly Readonly<{
774
+ name: string;
775
+ args?: Record<string, unknown>;
776
+ key?: string;
777
+ effect: import("effect/Effect").Effect<{
778
+ readonly _tag: "Nested";
779
+ readonly key: string;
780
+ readonly row: string;
781
+ readonly message: unknown;
782
+ } | {
783
+ readonly _tag: "Submitted";
784
+ } | {
785
+ readonly _tag: "ValidatedAll";
786
+ } | {
787
+ readonly _tag: "Reset";
788
+ } | {
789
+ readonly _tag: "RowAdded";
790
+ readonly key: string;
791
+ } | {
792
+ readonly _tag: "RowRemoved";
793
+ readonly key: string;
794
+ readonly row: string;
795
+ } | {
796
+ readonly _tag: "About";
797
+ readonly subject: {
798
+ readonly [x: string]: string;
799
+ };
800
+ } | {
801
+ readonly _tag: "Changed";
802
+ readonly key: string;
803
+ readonly value: string | boolean | readonly string[];
804
+ } | {
805
+ readonly _tag: "Blurred";
806
+ readonly key: string;
807
+ } | {
808
+ readonly _tag: "Searched";
809
+ readonly key: string;
810
+ readonly text: string;
811
+ } | {
812
+ readonly _tag: "Checked";
813
+ readonly key: string;
814
+ readonly draft: string | boolean | readonly string[];
815
+ readonly error: string | null;
816
+ } | {
817
+ readonly _tag: "Refused";
818
+ readonly key: string;
819
+ readonly error: string;
820
+ } | {
821
+ readonly _tag: "Control";
822
+ readonly key: never;
823
+ readonly message: unknown;
824
+ }, never, never>;
825
+ }>[];
826
+ };
827
+ isValidating: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
828
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
829
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => boolean;
830
+ authoredChanged: (before: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
831
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
832
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, after: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
833
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
834
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => boolean;
835
+ value: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
836
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
837
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => {
838
+ readonly [x: string]: unknown;
839
+ } | undefined;
840
+ };
841
+ pipe<A>(this: A): A;
842
+ pipe<A, B = never>(this: A, ab: (_: A) => B): B;
843
+ pipe<A, B_1 = never, C = never>(this: A, ab: (_: A) => B_1, bc: (_: B_1) => C): C;
844
+ pipe<A, B_2 = never, C_1 = never, D = never>(this: A, ab: (_: A) => B_2, bc: (_: B_2) => C_1, cd: (_: C_1) => D): D;
845
+ pipe<A, B_3 = never, C_2 = never, D_1 = never, E_1 = never>(this: A, ab: (_: A) => B_3, bc: (_: B_3) => C_2, cd: (_: C_2) => D_1, de: (_: D_1) => E_1): E_1;
846
+ pipe<A, B_4 = never, C_3 = never, D_2 = never, E_2 = never, F = never>(this: A, ab: (_: A) => B_4, bc: (_: B_4) => C_3, cd: (_: C_3) => D_2, de: (_: D_2) => E_2, ef: (_: E_2) => F): F;
847
+ pipe<A, B_5 = never, C_4 = never, D_3 = never, E_3 = never, F_1 = never, G = never>(this: A, ab: (_: A) => B_5, bc: (_: B_5) => C_4, cd: (_: C_4) => D_3, de: (_: D_3) => E_3, ef: (_: E_3) => F_1, fg: (_: F_1) => G): G;
848
+ pipe<A, B_6 = never, C_5 = never, D_4 = never, E_4 = never, F_2 = never, G_1 = never, H = never>(this: A, ab: (_: A) => B_6, bc: (_: B_6) => C_5, cd: (_: C_5) => D_4, de: (_: D_4) => E_4, ef: (_: E_4) => F_2, fg: (_: F_2) => G_1, gh: (_: G_1) => H): H;
849
+ pipe<A, B_7 = never, C_6 = never, D_5 = never, E_5 = never, F_3 = never, G_2 = never, H_1 = never, I = never>(this: A, ab: (_: A) => B_7, bc: (_: B_7) => C_6, cd: (_: C_6) => D_5, de: (_: D_5) => E_5, ef: (_: E_5) => F_3, fg: (_: F_3) => G_2, gh: (_: G_2) => H_1, hi: (_: H_1) => I): I;
850
+ pipe<A, B_8 = never, C_7 = never, D_6 = never, E_6 = never, F_4 = never, G_3 = never, H_2 = never, I_1 = never, J = never>(this: A, ab: (_: A) => B_8, bc: (_: B_8) => C_7, cd: (_: C_7) => D_6, de: (_: D_6) => E_6, ef: (_: E_6) => F_4, fg: (_: F_4) => G_3, gh: (_: G_3) => H_2, hi: (_: H_2) => I_1, ij: (_: I_1) => J): J;
851
+ pipe<A, B_9 = never, C_8 = never, D_7 = never, E_7 = never, F_5 = never, G_4 = never, H_3 = never, I_2 = never, J_1 = never, K = never>(this: A, ab: (_: A) => B_9, bc: (_: B_9) => C_8, cd: (_: C_8) => D_7, de: (_: D_7) => E_7, ef: (_: E_7) => F_5, fg: (_: F_5) => G_4, gh: (_: G_4) => H_3, hi: (_: H_3) => I_2, ij: (_: I_2) => J_1, jk: (_: J_1) => K): K;
852
+ pipe<A, B_10 = never, C_9 = never, D_8 = never, E_8 = never, F_6 = never, G_5 = never, H_4 = never, I_3 = never, J_2 = never, K_1 = never, L = never>(this: A, ab: (_: A) => B_10, bc: (_: B_10) => C_9, cd: (_: C_9) => D_8, de: (_: D_8) => E_8, ef: (_: E_8) => F_6, fg: (_: F_6) => G_5, gh: (_: G_5) => H_4, hi: (_: H_4) => I_3, ij: (_: I_3) => J_2, jk: (_: J_2) => K_1, kl: (_: K_1) => L): L;
853
+ pipe<A, B_11 = never, C_10 = never, D_9 = never, E_9 = never, F_7 = never, G_6 = never, H_5 = never, I_4 = never, J_3 = never, K_2 = never, L_1 = never, M = never>(this: A, ab: (_: A) => B_11, bc: (_: B_11) => C_10, cd: (_: C_10) => D_9, de: (_: D_9) => E_9, ef: (_: E_9) => F_7, fg: (_: F_7) => G_6, gh: (_: G_6) => H_5, hi: (_: H_5) => I_4, ij: (_: I_4) => J_3, jk: (_: J_3) => K_2, kl: (_: K_2) => L_1, lm: (_: L_1) => M): M;
854
+ pipe<A, B_12 = never, C_11 = never, D_10 = never, E_10 = never, F_8 = never, G_7 = never, H_6 = never, I_5 = never, J_4 = never, K_3 = never, L_2 = never, M_1 = never, N = never>(this: A, ab: (_: A) => B_12, bc: (_: B_12) => C_11, cd: (_: C_11) => D_10, de: (_: D_10) => E_10, ef: (_: E_10) => F_8, fg: (_: F_8) => G_7, gh: (_: G_7) => H_6, hi: (_: H_6) => I_5, ij: (_: I_5) => J_4, jk: (_: J_4) => K_3, kl: (_: K_3) => L_2, lm: (_: L_2) => M_1, mn: (_: M_1) => N): N;
855
+ pipe<A, B_13 = never, C_12 = never, D_11 = never, E_11 = never, F_9 = never, G_8 = never, H_7 = never, I_6 = never, J_5 = never, K_4 = never, L_3 = never, M_2 = never, N_1 = never, O = never>(this: A, ab: (_: A) => B_13, bc: (_: B_13) => C_12, cd: (_: C_12) => D_11, de: (_: D_11) => E_11, ef: (_: E_11) => F_9, fg: (_: F_9) => G_8, gh: (_: G_8) => H_7, hi: (_: H_7) => I_6, ij: (_: I_6) => J_5, jk: (_: J_5) => K_4, kl: (_: K_4) => L_3, lm: (_: L_3) => M_2, mn: (_: M_2) => N_1, no: (_: N_1) => O): O;
856
+ pipe<A, B_14 = never, C_13 = never, D_12 = never, E_12 = never, F_10 = never, G_9 = never, H_8 = never, I_7 = never, J_6 = never, K_5 = never, L_4 = never, M_3 = never, N_2 = never, O_1 = never, P = never>(this: A, ab: (_: A) => B_14, bc: (_: B_14) => C_13, cd: (_: C_13) => D_12, de: (_: D_12) => E_12, ef: (_: E_12) => F_10, fg: (_: F_10) => G_9, gh: (_: G_9) => H_8, hi: (_: H_8) => I_7, ij: (_: I_7) => J_6, jk: (_: J_6) => K_5, kl: (_: K_5) => L_4, lm: (_: L_4) => M_3, mn: (_: M_3) => N_2, no: (_: N_2) => O_1, op: (_: O_1) => P): P;
857
+ pipe<A, B_15 = never, C_14 = never, D_13 = never, E_13 = never, F_11 = never, G_10 = never, H_9 = never, I_8 = never, J_7 = never, K_6 = never, L_5 = never, M_4 = never, N_3 = never, O_2 = never, P_1 = never, Q = never>(this: A, ab: (_: A) => B_15, bc: (_: B_15) => C_14, cd: (_: C_14) => D_13, de: (_: D_13) => E_13, ef: (_: E_13) => F_11, fg: (_: F_11) => G_10, gh: (_: G_10) => H_9, hi: (_: H_9) => I_8, ij: (_: I_8) => J_7, jk: (_: J_7) => K_6, kl: (_: K_6) => L_5, lm: (_: L_5) => M_4, mn: (_: M_4) => N_3, no: (_: N_3) => O_2, op: (_: O_2) => P_1, pq: (_: P_1) => Q): Q;
858
+ pipe<A, B_16 = never, C_15 = never, D_14 = never, E_14 = never, F_12 = never, G_11 = never, H_10 = never, I_9 = never, J_8 = never, K_7 = never, L_6 = never, M_5 = never, N_4 = never, O_3 = never, P_2 = never, Q_1 = never, R_1 = never>(this: A, ab: (_: A) => B_16, bc: (_: B_16) => C_15, cd: (_: C_15) => D_14, de: (_: D_14) => E_14, ef: (_: E_14) => F_12, fg: (_: F_12) => G_11, gh: (_: G_11) => H_10, hi: (_: H_10) => I_9, ij: (_: I_9) => J_8, jk: (_: J_8) => K_7, kl: (_: K_7) => L_6, lm: (_: L_6) => M_5, mn: (_: M_5) => N_4, no: (_: N_4) => O_3, op: (_: O_3) => P_2, pq: (_: P_2) => Q_1, qr: (_: Q_1) => R_1): R_1;
859
+ pipe<A, B_17 = never, C_16 = never, D_15 = never, E_15 = never, F_13 = never, G_12 = never, H_11 = never, I_10 = never, J_9 = never, K_8 = never, L_7 = never, M_6 = never, N_5 = never, O_4 = never, P_3 = never, Q_2 = never, R_2 = never, S = never>(this: A, ab: (_: A) => B_17, bc: (_: B_17) => C_16, cd: (_: C_16) => D_15, de: (_: D_15) => E_15, ef: (_: E_15) => F_13, fg: (_: F_13) => G_12, gh: (_: G_12) => H_11, hi: (_: H_11) => I_10, ij: (_: I_10) => J_9, jk: (_: J_9) => K_8, kl: (_: K_8) => L_7, lm: (_: L_7) => M_6, mn: (_: M_6) => N_5, no: (_: N_5) => O_4, op: (_: O_4) => P_3, pq: (_: P_3) => Q_2, qr: (_: Q_2) => R_2, rs: (_: R_2) => S): S;
860
+ pipe<A, B_18 = never, C_17 = never, D_16 = never, E_16 = never, F_14 = never, G_13 = never, H_12 = never, I_11 = never, J_10 = never, K_9 = never, L_8 = never, M_7 = never, N_6 = never, O_5 = never, P_4 = never, Q_3 = never, R_3 = never, S_1 = never, T = never>(this: A, ab: (_: A) => B_18, bc: (_: B_18) => C_17, cd: (_: C_17) => D_16, de: (_: D_16) => E_16, ef: (_: E_16) => F_14, fg: (_: F_14) => G_13, gh: (_: G_13) => H_12, hi: (_: H_12) => I_11, ij: (_: I_11) => J_10, jk: (_: J_10) => K_9, kl: (_: K_9) => L_8, lm: (_: L_8) => M_7, mn: (_: M_7) => N_6, no: (_: N_6) => O_5, op: (_: O_5) => P_4, pq: (_: P_4) => Q_3, qr: (_: Q_3) => R_3, rs: (_: R_3) => S_1, st: (_: S_1) => T): T;
861
+ pipe<A, B_19 = never, C_18 = never, D_17 = never, E_17 = never, F_15 = never, G_14 = never, H_13 = never, I_12 = never, J_11 = never, K_10 = never, L_9 = never, M_8 = never, N_7 = never, O_6 = never, P_5 = never, Q_4 = never, R_4 = never, S_2 = never, T_1 = never, U = never>(this: A, ab: (_: A) => B_19, bc: (_: B_19) => C_18, cd: (_: C_18) => D_17, de: (_: D_17) => E_17, ef: (_: E_17) => F_15, fg: (_: F_15) => G_14, gh: (_: G_14) => H_13, hi: (_: H_13) => I_12, ij: (_: I_12) => J_11, jk: (_: J_11) => K_10, kl: (_: K_10) => L_9, lm: (_: L_9) => M_8, mn: (_: M_8) => N_7, no: (_: N_7) => O_6, op: (_: O_6) => P_5, pq: (_: P_5) => Q_4, qr: (_: Q_4) => R_4, rs: (_: R_4) => S_2, st: (_: S_2) => T_1, tu: (_: T_1) => U): U;
862
+ pipe<A, B_20 = never, C_19 = never, D_18 = never, E_18 = never, F_16 = never, G_15 = never, H_14 = never, I_13 = never, J_12 = never, K_11 = never, L_10 = never, M_9 = never, N_8 = never, O_7 = never, P_6 = never, Q_5 = never, R_5 = never, S_3 = never, T_2 = never, U_1 = never>(this: A, ab: (_: A) => B_20, bc: (_: B_20) => C_19, cd: (_: C_19) => D_18, de: (_: D_18) => E_18, ef: (_: E_18) => F_16, fg: (_: F_16) => G_15, gh: (_: G_15) => H_14, hi: (_: H_14) => I_13, ij: (_: I_13) => J_12, jk: (_: J_12) => K_11, kl: (_: K_11) => L_10, lm: (_: L_10) => M_9, mn: (_: M_9) => N_8, no: (_: N_8) => O_7, op: (_: O_7) => P_6, pq: (_: P_6) => Q_5, qr: (_: Q_5) => R_5, rs: (_: R_5) => S_3, st: (_: S_3) => T_2, tu: (_: T_2) => U_1): U_1;
863
+ name: string;
864
+ options: import("foldkit-form").FormOptions<Readonly<Record<string, Schema.Top>>, {
865
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
866
+ }, never, {}, Readonly<Record<string, Control<unknown>>>>;
867
+ types: {
868
+ readonly Name: string;
869
+ readonly E: Entity<string, Readonly<Record<string, Schema.Top>>, {}, {}>;
870
+ readonly Fields: Readonly<Record<string, Schema.Top>>;
871
+ readonly Members: {
872
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
873
+ };
874
+ readonly R: never;
875
+ readonly Nest: {};
876
+ readonly Inputs: Readonly<Record<string, Control<unknown>>>;
877
+ };
878
+ };
879
+ /** Every key the form's Schema names, edited or shown. */
880
+ keys: string[];
881
+ /** The props the form does not edit, labelled as its fields are, and as stored: shown, not changed. */
882
+ shown: (stored: Readonly<Record<string, unknown>>) => ReadonlyArray<{
883
+ readonly key: string;
884
+ readonly label: string;
885
+ readonly value: unknown;
886
+ }>;
887
+ /**
888
+ * `model` with the fields `keep` spares filled from a node's stored props.
889
+ * A stored prop that does not decode is shown as it is, with its error.
890
+ */
891
+ fill: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
892
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
893
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, stored: Readonly<Record<string, unknown>>, keep?: (key: string) => boolean) => import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
894
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
895
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
896
+ /** The form's Model as the Builder's Model holds it: JSON. */
897
+ encode: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
898
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
899
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => Schema.Json;
900
+ /** A held form Model read back; none if it no longer fits, which a refill then replaces. */
901
+ decode: (held: Schema.Json) => Option.Option<import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
902
+ readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
903
+ }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>>;
904
+ encodeMessage: (message: {
905
+ readonly _tag: "Refused";
906
+ readonly key: string;
907
+ readonly error: string;
908
+ } | {
909
+ readonly _tag: "Changed";
910
+ readonly key: string;
911
+ readonly value: string | boolean | readonly string[];
912
+ } | {
913
+ readonly _tag: "Blurred";
914
+ readonly key: string;
915
+ } | {
916
+ readonly _tag: "ValidatedAll";
917
+ } | {
918
+ readonly _tag: "Submitted";
919
+ } | {
920
+ readonly _tag: "Reset";
921
+ } | {
922
+ readonly _tag: "Checked";
923
+ readonly key: string;
924
+ readonly draft: string | boolean | readonly string[];
925
+ readonly error: string | null;
926
+ } | {
927
+ readonly _tag: "About";
928
+ readonly subject: {
929
+ readonly [x: string]: string;
930
+ };
931
+ } | {
932
+ readonly _tag: "Searched";
933
+ readonly key: string;
934
+ readonly text: string;
935
+ } | {
936
+ readonly _tag: "Nested";
937
+ readonly key: string;
938
+ readonly row: string;
939
+ readonly message: unknown;
940
+ } | {
941
+ readonly _tag: "Control";
942
+ readonly key: never;
943
+ readonly message: unknown;
944
+ } | {
945
+ readonly _tag: "RowAdded";
946
+ readonly key: string;
947
+ } | {
948
+ readonly _tag: "RowRemoved";
949
+ readonly key: string;
950
+ readonly row: string;
951
+ }) => Schema.Json;
952
+ decodeMessage: (held: Schema.Json) => Option.Option<{
953
+ readonly _tag: "Refused";
954
+ readonly key: string;
955
+ readonly error: string;
956
+ } | {
957
+ readonly _tag: "Changed";
958
+ readonly key: string;
959
+ readonly value: string | boolean | readonly string[];
960
+ } | {
961
+ readonly _tag: "Blurred";
962
+ readonly key: string;
963
+ } | {
964
+ readonly _tag: "ValidatedAll";
965
+ } | {
966
+ readonly _tag: "Submitted";
967
+ } | {
968
+ readonly _tag: "Reset";
969
+ } | {
970
+ readonly _tag: "Checked";
971
+ readonly key: string;
972
+ readonly draft: string | boolean | readonly string[];
973
+ readonly error: string | null;
974
+ } | {
975
+ readonly _tag: "About";
976
+ readonly subject: {
977
+ readonly [x: string]: string;
978
+ };
979
+ } | {
980
+ readonly _tag: "Searched";
981
+ readonly key: string;
982
+ readonly text: string;
983
+ } | {
984
+ readonly _tag: "Nested";
985
+ readonly key: string;
986
+ readonly row: string;
987
+ readonly message: unknown;
988
+ } | {
989
+ readonly _tag: "Control";
990
+ readonly key: never;
991
+ readonly message: unknown;
992
+ } | {
993
+ readonly _tag: "RowAdded";
994
+ readonly key: string;
995
+ } | {
996
+ readonly _tag: "RowRemoved";
997
+ readonly key: string;
998
+ readonly row: string;
999
+ }>;
1000
+ /**
1001
+ * A Message of the Bundle behind `key`'s control (an `Input.bundle`), as the
1002
+ * form's own. Built from runtime fields, the form's type names no such key,
1003
+ * so it is checked here: a key not edited by one throws.
1004
+ */
1005
+ control: (key: string, message: unknown) => {
1006
+ readonly _tag: "Refused";
1007
+ readonly key: string;
1008
+ readonly error: string;
1009
+ } | {
1010
+ readonly _tag: "Changed";
1011
+ readonly key: string;
1012
+ readonly value: string | boolean | readonly string[];
1013
+ } | {
1014
+ readonly _tag: "Blurred";
1015
+ readonly key: string;
1016
+ } | {
1017
+ readonly _tag: "ValidatedAll";
1018
+ } | {
1019
+ readonly _tag: "Submitted";
1020
+ } | {
1021
+ readonly _tag: "Reset";
1022
+ } | {
1023
+ readonly _tag: "Checked";
1024
+ readonly key: string;
1025
+ readonly draft: string | boolean | readonly string[];
1026
+ readonly error: string | null;
1027
+ } | {
1028
+ readonly _tag: "About";
1029
+ readonly subject: {
1030
+ readonly [x: string]: string;
1031
+ };
1032
+ } | {
1033
+ readonly _tag: "Searched";
1034
+ readonly key: string;
1035
+ readonly text: string;
1036
+ } | {
1037
+ readonly _tag: "Nested";
1038
+ readonly key: string;
1039
+ readonly row: string;
1040
+ readonly message: unknown;
1041
+ } | {
1042
+ readonly _tag: "Control";
1043
+ readonly key: never;
1044
+ readonly message: unknown;
1045
+ } | {
1046
+ readonly _tag: "RowAdded";
1047
+ readonly key: string;
1048
+ } | {
1049
+ readonly _tag: "RowRemoved";
1050
+ readonly key: string;
1051
+ readonly row: string;
1052
+ };
1053
+ /**
1054
+ * What a new value starts from, as the Document stores it: each field's
1055
+ * empty value where it decodes (`''`, `null`, `false`), else a number's
1056
+ * zero or a select's first choice; a field with neither is left out. It is
1057
+ * not checked: a zero a number's check refuses, or a field left out, makes
1058
+ * a value the Document refuses when it is set.
1059
+ */
1060
+ seed: () => Readonly<Record<string, Schema.Json>>;
1061
+ /** A value from the form, as the Document stores it; none for a prop the form does not edit. */
1062
+ stored: (key: string, value: unknown) => Option.Option<Schema.Json>;
1063
+ };
1064
+ /** A form over a node's values and the codecs the Builder holds it with. */
1065
+ type Settings = ReturnType<typeof make>;
1066
+ /** A Block's props as a form, made at the first use and kept: one per Block. */
1067
+ export declare const settingsOf: (block: AnyBlock) => Settings;
1068
+ /**
1069
+ * The input an event of a Block runs an action with, as a form, made at the
1070
+ * first use and kept. One per Block, event and action, so two events of one
1071
+ * node that run the same action draw their fields under ids of their own.
1072
+ */
1073
+ export declare const inputOf: (block: AnyBlock, event: string, action: CatalogAction) => Settings;
1074
+ /** The control a prop is drawn with: the Block's hint, else what its Schema says. */
1075
+ export declare const controlOf: (block: AnyBlock, key: string, schema: Schema.Top) => Control | undefined;
1076
+ //#endregion
1077
+ //#region src/words.d.ts
1078
+ /**
1079
+ * The Builder's own words: what it says to assistive technology of each edit,
1080
+ * its commands' labels, and the refusals it makes itself. Words are text; a
1081
+ * word that takes a value names it as a blank (`'Moved {label}{at}'`), as a
1082
+ * form's and a view's words do, so one object can hold them all. A Block is
1083
+ * named by its label (`Block.words`), the Catalog's word.
1084
+ */
1085
+ interface EditWords {
1086
+ /** Where a node is after an edit, after its name: ", 2 of 3 in Section body". Blanks `{position}`, `{count}`, `{container}`. */
1087
+ readonly at: string;
1088
+ /** The container of a root. */
1089
+ readonly thePage: string;
1090
+ /** The container of a node in a Region: the holder's `{label}` and the `{region}`. */
1091
+ readonly inRegion: string;
1092
+ /** An edit, said: its node's `{label}` and where it is now, `{at}`. */
1093
+ readonly moved: string;
1094
+ readonly added: string;
1095
+ readonly duplicated: string;
1096
+ /** A removal, said: the node's `{label}`. */
1097
+ readonly removed: string;
1098
+ readonly editedPage: string;
1099
+ readonly undone: string;
1100
+ readonly redone: string;
1101
+ /** A drag that ended with nothing done: a node, or a new one from the palette. */
1102
+ readonly notMoved: string;
1103
+ readonly notAdded: string;
1104
+ /** A copy and a cut, said: the node's `{label}`. */
1105
+ readonly copied: string;
1106
+ readonly cut: string;
1107
+ /** The refusals the Builder makes itself: nothing to paste, as nothing copied or not a page. */
1108
+ readonly nothingCopied: string;
1109
+ readonly notAPage: string;
1110
+ /** A Block that cannot be inserted: `{block}`. */
1111
+ readonly noStartingProps: string;
1112
+ readonly startingPropsFail: string;
1113
+ /** A node the page does not hold, or one changed while its copy was made: `{id}`. */
1114
+ readonly notANode: string;
1115
+ readonly copyChanged: string;
1116
+ /** A pattern the Catalog lacks: `{name}`. */
1117
+ readonly unknownPattern: string;
1118
+ /** A paste the page has no place for: its root's Block, `{label}`. */
1119
+ readonly noPlace: string;
1120
+ /** A refusal `apply` made: blanks `{code}` and `{message}`, by default its own message. */
1121
+ readonly refusal: string;
1122
+ /** The commands' labels. */
1123
+ readonly moveUp: string;
1124
+ readonly moveDown: string;
1125
+ readonly moveOut: string;
1126
+ readonly moveIn: string;
1127
+ readonly duplicate: string;
1128
+ readonly copy: string;
1129
+ readonly cutCommand: string;
1130
+ readonly delete: string;
1131
+ readonly undo: string;
1132
+ readonly redo: string;
1133
+ readonly paste: string;
1134
+ readonly editText: string;
1135
+ readonly deselect: string;
1136
+ }
1137
+ export declare const editWords: EditWords;
1138
+ //#endregion
1139
+ //#region src/index.d.ts
1140
+ export declare const Panel: Schema.Literals<readonly ["insert", "layers", "properties"]>;
1141
+ export declare const Viewport: Schema.Literals<readonly ["wide", "medium", "narrow"]>;
1142
+ /** The layers panel's keyboard focus and which rows are open: a tree that starts open. */
1143
+ export declare const Layers: Bundle.Declared<Bundle.Bundle<"TreeNavigation", {
1144
+ readonly openByDefault: boolean;
1145
+ }, {
1146
+ readonly current: string | null;
1147
+ readonly toggled: readonly string[];
1148
+ }, {
1149
+ readonly _tag: "Focused";
1150
+ readonly id: string;
1151
+ } | {
1152
+ readonly _tag: "Opened";
1153
+ readonly id: string;
1154
+ } | {
1155
+ readonly _tag: "Closed";
1156
+ readonly id: string;
1157
+ }, never, never, never, void, {}, {}>, "layers">;
1158
+ export declare const layersArgs: TreeNavigation.Args;
1159
+ /** What the editor says to assistive technology: a move, an insert, a refusal. */
1160
+ export declare const Announcer: Bundle.Declared<Bundle.Bundle<"LiveAnnounce", {
1161
+ readonly debounceMs: number;
1162
+ readonly clearAfterMs: number;
1163
+ }, {
1164
+ readonly polite: string;
1165
+ readonly assertive: string;
1166
+ readonly pending: {
1167
+ readonly message: string;
1168
+ readonly politeness: "polite" | "assertive";
1169
+ } | null;
1170
+ readonly generation: number;
1171
+ }, {
1172
+ readonly _tag: "Read";
1173
+ readonly generation: number;
1174
+ } | {
1175
+ readonly _tag: "Cleared";
1176
+ readonly generation: number;
1177
+ } | {
1178
+ readonly _tag: "Announced";
1179
+ readonly message: string;
1180
+ readonly politeness: "polite" | "assertive";
1181
+ }, never, never, never, void, {}, {}>, "announcer">;
1182
+ /** Where over a node a drop lands: before it, inside it, or after it. */
1183
+ export declare const DropZone: Schema.Literals<readonly ["before", "inside", "after"]>;
1184
+ export type DropZone = typeof DropZone.Type;
1185
+ /** What a drag carries: a node on the page, or a new node of a Block, from the palette. */
1186
+ export declare const DragSource: Schema.Union<readonly [Schema.TaggedStruct<"Existing", {
1187
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1188
+ }>, Schema.TaggedStruct<"New", {
1189
+ readonly block: Schema.String;
1190
+ }>]>;
1191
+ export type DragSource = typeof DragSource.Type;
1192
+ /** A drag under way: what is dragged, what it is over, and where it would go. */
1193
+ export declare const Drag: Schema.Struct<{
1194
+ readonly source: Schema.Union<readonly [Schema.TaggedStruct<"Existing", {
1195
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1196
+ }>, Schema.TaggedStruct<"New", {
1197
+ readonly block: Schema.String;
1198
+ }>]>;
1199
+ /**
1200
+ * The node it is over and the zone of it; none while it is over nothing, or
1201
+ * over the page's own space, which `at` then tells apart.
1202
+ */
1203
+ readonly over: Schema.OptionFromNullOr<Schema.Struct<{
1204
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1205
+ readonly zone: Schema.Literals<readonly ["before", "inside", "after"]>;
1206
+ /** The empty Region of the node it is over, which a drop goes into. */
1207
+ readonly region: Schema.OptionFromNullOr<Schema.String>;
1208
+ }>>;
1209
+ /**
1210
+ * Where a drop now puts it; none where a drop there would be refused.
1211
+ * `over.zone` is where it lands: `inside` a node that takes nothing is `after`.
1212
+ */
1213
+ readonly at: Schema.OptionFromNullOr<Schema.Union<readonly [Schema.TaggedStruct<"Root", {
1214
+ readonly index: import("effect/Schema").Int;
1215
+ }>, Schema.TaggedStruct<"Region", {
1216
+ readonly parent: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">;
1217
+ readonly region: import("effect/Schema").String;
1218
+ readonly index: import("effect/Schema").Int;
1219
+ }>]>>;
1220
+ }>;
1221
+ export type Drag = typeof Drag.Type;
1222
+ /** A value of the page's context, as the editor previews it. */
1223
+ export declare const ContextValue: Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.Null]>;
1224
+ export type ContextValue = typeof ContextValue.Type;
1225
+ declare const Model$1: Schema.Struct<{
1226
+ /** The page and its undo steps: `page.present` is the Document being edited. */
1227
+ readonly page: Schema.Struct<{
1228
+ readonly past: Schema.$Array<Schema.Codec<{
1229
+ readonly format: 1;
1230
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1231
+ readonly nodes: {
1232
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
1233
+ readonly block: string;
1234
+ readonly props: {
1235
+ readonly [x: string]: Schema.Json;
1236
+ };
1237
+ readonly regions: {
1238
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1239
+ };
1240
+ readonly when?: Schema.Json | undefined;
1241
+ readonly appearance?: Schema.Json | undefined;
1242
+ readonly actions?: {
1243
+ readonly [x: string]: Schema.Json;
1244
+ } | undefined;
1245
+ };
1246
+ };
1247
+ }, unknown, never, never>>;
1248
+ readonly present: Schema.Codec<{
1249
+ readonly format: 1;
1250
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1251
+ readonly nodes: {
1252
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
1253
+ readonly block: string;
1254
+ readonly props: {
1255
+ readonly [x: string]: Schema.Json;
1256
+ };
1257
+ readonly regions: {
1258
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1259
+ };
1260
+ readonly when?: Schema.Json | undefined;
1261
+ readonly appearance?: Schema.Json | undefined;
1262
+ readonly actions?: {
1263
+ readonly [x: string]: Schema.Json;
1264
+ } | undefined;
1265
+ };
1266
+ };
1267
+ }, unknown, never, never>;
1268
+ readonly future: Schema.$Array<Schema.Codec<{
1269
+ readonly format: 1;
1270
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1271
+ readonly nodes: {
1272
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
1273
+ readonly block: string;
1274
+ readonly props: {
1275
+ readonly [x: string]: Schema.Json;
1276
+ };
1277
+ readonly regions: {
1278
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1279
+ };
1280
+ readonly when?: Schema.Json | undefined;
1281
+ readonly appearance?: Schema.Json | undefined;
1282
+ readonly actions?: {
1283
+ readonly [x: string]: Schema.Json;
1284
+ } | undefined;
1285
+ };
1286
+ };
1287
+ }, unknown, never, never>>;
1288
+ readonly group: Schema.NullOr<Schema.String>;
1289
+ }>;
1290
+ /** The node the inspector and the node actions work on. */
1291
+ readonly selected: Schema.OptionFromNullOr<Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">>;
1292
+ /** The node under the pointer on the canvas or in the layers. */
1293
+ readonly hovered: Schema.OptionFromNullOr<Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">>;
1294
+ readonly panel: Schema.Literals<readonly ["insert", "layers", "properties"]>;
1295
+ readonly viewport: Schema.Literals<readonly ["wide", "medium", "narrow"]>;
1296
+ /** Why the last edit was refused, until the next one goes through. */
1297
+ readonly refused: Schema.OptionFromNullOr<Schema.Struct<{
1298
+ readonly code: Schema.String;
1299
+ readonly message: Schema.String;
1300
+ }>>;
1301
+ /** A pointer drag under way. */
1302
+ readonly drag: Schema.OptionFromNullOr<Schema.Struct<{
1303
+ readonly source: Schema.Union<readonly [Schema.TaggedStruct<"Existing", {
1304
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1305
+ }>, Schema.TaggedStruct<"New", {
1306
+ readonly block: Schema.String;
1307
+ }>]>;
1308
+ /**
1309
+ * The node it is over and the zone of it; none while it is over nothing, or
1310
+ * over the page's own space, which `at` then tells apart.
1311
+ */
1312
+ readonly over: Schema.OptionFromNullOr<Schema.Struct<{
1313
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1314
+ readonly zone: Schema.Literals<readonly ["before", "inside", "after"]>;
1315
+ /** The empty Region of the node it is over, which a drop goes into. */
1316
+ readonly region: Schema.OptionFromNullOr<Schema.String>;
1317
+ }>>;
1318
+ /**
1319
+ * Where a drop now puts it; none where a drop there would be refused.
1320
+ * `over.zone` is where it lands: `inside` a node that takes nothing is `after`.
1321
+ */
1322
+ readonly at: Schema.OptionFromNullOr<Schema.Union<readonly [Schema.TaggedStruct<"Root", {
1323
+ readonly index: import("effect/Schema").Int;
1324
+ }>, Schema.TaggedStruct<"Region", {
1325
+ readonly parent: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">;
1326
+ readonly region: import("effect/Schema").String;
1327
+ readonly index: import("effect/Schema").Int;
1328
+ }>]>>;
1329
+ }>>;
1330
+ /**
1331
+ * The context the page is drawn for in the editor, by the Catalog's context
1332
+ * keys: what an author previews it as. A node whose `when` fails here is
1333
+ * drawn marked, not left out.
1334
+ */
1335
+ readonly preview: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.Null]>>;
1336
+ /**
1337
+ * What the inspector's fields hold for the node they show: each form's Model
1338
+ * encoded to JSON, by the form's key (`props`, or `on:<event>:<action>`), so
1339
+ * text that does not decode yet stays here, not in the page. None until a
1340
+ * field is changed, and after the selection moves; a form it does not hold is
1341
+ * filled from the node. Stored only when some, so a Builder saved before
1342
+ * there was one still reads.
1343
+ */
1344
+ readonly inspector: Schema.OptionFromOptionalNullOr<Schema.Struct<{
1345
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1346
+ readonly forms: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1347
+ }>>;
1348
+ /**
1349
+ * The last node copied or cut, and all it holds: what a paste inserts when
1350
+ * the system clipboard cannot be read. Kept across pages, so a copy on one
1351
+ * pastes on another.
1352
+ */
1353
+ readonly clipboard: Schema.OptionFromOptionalNullOr<Schema.Struct<{
1354
+ readonly root: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">;
1355
+ readonly nodes: import("effect/Schema").$Record<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">, import("effect/Schema").Struct<{
1356
+ readonly block: import("effect/Schema").String;
1357
+ readonly props: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
1358
+ readonly regions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">>>;
1359
+ readonly when: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
1360
+ readonly appearance: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
1361
+ readonly actions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>>;
1362
+ }>>;
1363
+ }>>;
1364
+ /**
1365
+ * The text prop being edited in place on the canvas; its text when editing
1366
+ * began, which the canvas keeps the field at; and whether anything has been
1367
+ * typed, since only then does ending it write. Stored only when some.
1368
+ */
1369
+ readonly editing: Schema.OptionFromOptionalNullOr<Schema.Struct<{
1370
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1371
+ readonly key: Schema.String;
1372
+ readonly initial: Schema.String;
1373
+ readonly typed: Schema.Boolean;
1374
+ }>>;
1375
+ readonly announcer: Schema.Codec<{
1376
+ readonly polite: string;
1377
+ readonly assertive: string;
1378
+ readonly pending: {
1379
+ readonly message: string;
1380
+ readonly politeness: "polite" | "assertive";
1381
+ } | null;
1382
+ readonly generation: number;
1383
+ }, unknown, never, never>;
1384
+ readonly layers: Schema.Codec<{
1385
+ readonly current: string | null;
1386
+ readonly toggled: readonly string[];
1387
+ }, unknown, never, never>;
1388
+ }>;
1389
+ type Model$1 = typeof Model$1.Type;
1390
+ /** One form the inspector draws for the selected node, and its Model. */
1391
+ export interface InspectedForm {
1392
+ /** Which it is, as `Inspected` names it: `props`, or `on:<event>:<action>`. */
1393
+ readonly key: string;
1394
+ readonly settings: Settings;
1395
+ readonly model: Settings['form']['initial'];
1396
+ }
1397
+ /** The selected node as the inspector edits it: its Block and its forms. */
1398
+ export interface Inspecting {
1399
+ readonly id: NodeId;
1400
+ readonly block: AnyBlock;
1401
+ /** Its props. */
1402
+ readonly props: InspectedForm;
1403
+ /**
1404
+ * The input of the action each event runs, by event: none for an event that
1405
+ * runs nothing, or an action the Catalog lacks.
1406
+ */
1407
+ readonly on: Readonly<Record<string, InspectedForm>>;
1408
+ }
1409
+ declare const Message$1: import("foldkit/message").MessageUnion<{
1410
+ readonly Selected: {
1411
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1412
+ };
1413
+ /** Nothing is selected. */
1414
+ readonly Deselected: {};
1415
+ readonly Hovered: {
1416
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1417
+ };
1418
+ /** The pointer left every node. */
1419
+ readonly Unhovered: {};
1420
+ /** An Operation, from a button, a key, a drag, or an agent. */
1421
+ readonly Applied: {
1422
+ readonly op: Schema.Codec<Operation, unknown, never, never>;
1423
+ };
1424
+ /** A new node of a Block, with the Block's starting props, once an id is minted. */
1425
+ readonly InsertAsked: {
1426
+ readonly block: Schema.String;
1427
+ readonly at: Schema.Union<readonly [Schema.TaggedStruct<"Root", {
1428
+ readonly index: import("effect/Schema").Int;
1429
+ }>, Schema.TaggedStruct<"Region", {
1430
+ readonly parent: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">;
1431
+ readonly region: import("effect/Schema").String;
1432
+ readonly index: import("effect/Schema").Int;
1433
+ }>]>;
1434
+ };
1435
+ /** A copy of a node and everything it holds, once ids are minted. */
1436
+ readonly DuplicateAsked: {
1437
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1438
+ readonly at: Schema.Union<readonly [Schema.TaggedStruct<"Root", {
1439
+ readonly index: import("effect/Schema").Int;
1440
+ }>, Schema.TaggedStruct<"Region", {
1441
+ readonly parent: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">;
1442
+ readonly region: import("effect/Schema").String;
1443
+ readonly index: import("effect/Schema").Int;
1444
+ }>]>;
1445
+ };
1446
+ /** One of the Catalog's patterns, once ids are minted for its nodes. */
1447
+ readonly PatternAsked: {
1448
+ readonly pattern: Schema.String;
1449
+ readonly at: Schema.Union<readonly [Schema.TaggedStruct<"Root", {
1450
+ readonly index: import("effect/Schema").Int;
1451
+ }>, Schema.TaggedStruct<"Region", {
1452
+ readonly parent: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">;
1453
+ readonly region: import("effect/Schema").String;
1454
+ readonly index: import("effect/Schema").Int;
1455
+ }>]>;
1456
+ };
1457
+ /** The selected node and all it holds, copied. */
1458
+ readonly CopyAsked: {
1459
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1460
+ };
1461
+ /** The selected node and all it holds, copied and removed. */
1462
+ readonly CutAsked: {
1463
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1464
+ };
1465
+ /** A paste: the system clipboard is read, and what it holds goes in by the selection. */
1466
+ readonly PasteAsked: {};
1467
+ /** What the system clipboard held for a paste; none when it could not be read. */
1468
+ readonly ClipboardRead: {
1469
+ readonly text: Schema.OptionFromNullOr<Schema.String>;
1470
+ };
1471
+ /**
1472
+ * Text on the page is asked to be edited in place: a double-click on it, or
1473
+ * Enter on its node. Each of these names the field as the canvas marks it
1474
+ * (`data-composition-field`), which is checked here.
1475
+ */
1476
+ readonly EditingAsked: {
1477
+ readonly field: Schema.String;
1478
+ };
1479
+ /** What the field being edited holds now. */
1480
+ readonly FieldTyped: {
1481
+ readonly field: Schema.String;
1482
+ readonly text: Schema.String;
1483
+ };
1484
+ /** Editing ended with the text kept: Enter, or leaving the field. */
1485
+ readonly EditingCommitted: {
1486
+ readonly field: Schema.String;
1487
+ readonly text: Schema.String;
1488
+ };
1489
+ /** Editing ended with the text put back as it began: Escape. */
1490
+ readonly EditingCancelled: {
1491
+ readonly field: Schema.String;
1492
+ };
1493
+ /** The ids a request waited for. */
1494
+ readonly Minted: {
1495
+ readonly ids: Schema.$Array<Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">>;
1496
+ readonly request: Schema.Union<readonly [Schema.TaggedStruct<"Insert", {
1497
+ readonly block: Schema.String;
1498
+ readonly at: Schema.Union<readonly [Schema.TaggedStruct<"Root", {
1499
+ readonly index: import("effect/Schema").Int;
1500
+ }>, Schema.TaggedStruct<"Region", {
1501
+ readonly parent: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">;
1502
+ readonly region: import("effect/Schema").String;
1503
+ readonly index: import("effect/Schema").Int;
1504
+ }>]>;
1505
+ }>, Schema.TaggedStruct<"Duplicate", {
1506
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1507
+ readonly at: Schema.Union<readonly [Schema.TaggedStruct<"Root", {
1508
+ readonly index: import("effect/Schema").Int;
1509
+ }>, Schema.TaggedStruct<"Region", {
1510
+ readonly parent: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">;
1511
+ readonly region: import("effect/Schema").String;
1512
+ readonly index: import("effect/Schema").Int;
1513
+ }>]>;
1514
+ }>, Schema.TaggedStruct<"Paste", {
1515
+ readonly tree: Schema.Struct<{
1516
+ readonly root: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">;
1517
+ readonly nodes: import("effect/Schema").$Record<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">, import("effect/Schema").Struct<{
1518
+ readonly block: import("effect/Schema").String;
1519
+ readonly props: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
1520
+ readonly regions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">>>;
1521
+ readonly when: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
1522
+ readonly appearance: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
1523
+ readonly actions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>>;
1524
+ }>>;
1525
+ }>;
1526
+ readonly at: Schema.Union<readonly [Schema.TaggedStruct<"Root", {
1527
+ readonly index: import("effect/Schema").Int;
1528
+ }>, Schema.TaggedStruct<"Region", {
1529
+ readonly parent: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">;
1530
+ readonly region: import("effect/Schema").String;
1531
+ readonly index: import("effect/Schema").Int;
1532
+ }>]>;
1533
+ }>, Schema.TaggedStruct<"Pattern", {
1534
+ readonly pattern: Schema.String;
1535
+ readonly at: Schema.Union<readonly [Schema.TaggedStruct<"Root", {
1536
+ readonly index: import("effect/Schema").Int;
1537
+ }>, Schema.TaggedStruct<"Region", {
1538
+ readonly parent: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "@foldkit-composition/NodeId">;
1539
+ readonly region: import("effect/Schema").String;
1540
+ readonly index: import("effect/Schema").Int;
1541
+ }>]>;
1542
+ }>]>;
1543
+ };
1544
+ readonly Undid: {};
1545
+ readonly Redid: {};
1546
+ readonly PanelChosen: {
1547
+ readonly panel: Schema.Literals<readonly ["insert", "layers", "properties"]>;
1548
+ };
1549
+ readonly ViewportChosen: {
1550
+ readonly viewport: Schema.Literals<readonly ["wide", "medium", "narrow"]>;
1551
+ };
1552
+ /** A pointer drag of a node began: it is selected, and nothing moves until the drop. */
1553
+ readonly DragStarted: {
1554
+ readonly source: Schema.Union<readonly [Schema.TaggedStruct<"Existing", {
1555
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1556
+ }>, Schema.TaggedStruct<"New", {
1557
+ readonly block: Schema.String;
1558
+ }>]>;
1559
+ };
1560
+ /** The dragged node is over another, in a zone of it. */
1561
+ readonly DraggedOver: {
1562
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1563
+ readonly zone: Schema.Literals<readonly ["before", "inside", "after"]>;
1564
+ };
1565
+ /** The dragged node is over a node's empty Region, by name: a drop goes into it. */
1566
+ readonly DraggedOverRegion: {
1567
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1568
+ readonly region: Schema.String;
1569
+ };
1570
+ /** The dragged node is over nothing. */
1571
+ readonly DraggedOff: {};
1572
+ /**
1573
+ * A palette tile is over the page but over none of its nodes, as an empty
1574
+ * page or the space below the last node: it goes last where the page takes it.
1575
+ */
1576
+ readonly DraggedOverPage: {};
1577
+ /** The drag ended where it is: the node moves there, when it may. */
1578
+ readonly DragDropped: {};
1579
+ readonly DragCancelled: {};
1580
+ /** The author previews the page with one context key set. */
1581
+ readonly PreviewChosen: {
1582
+ readonly key: Schema.String;
1583
+ readonly value: Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.Null]>;
1584
+ };
1585
+ /** The author previews the page with one context key unset. */
1586
+ readonly PreviewCleared: {
1587
+ readonly key: Schema.String;
1588
+ };
1589
+ /**
1590
+ * A Message of one of a node's forms (`Inspecting`), encoded to JSON. One for
1591
+ * a node no longer selected, or a form it no longer draws, such as a form's
1592
+ * Command answering late, is ignored.
1593
+ */
1594
+ readonly Inspected: {
1595
+ readonly id: Schema.brand<Schema.NonEmptyString, "@foldkit-composition/NodeId">;
1596
+ readonly form: Schema.String;
1597
+ readonly message: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1598
+ };
1599
+ readonly GotAnnouncerMessage: {
1600
+ readonly message: Schema.Codec<{
1601
+ readonly _tag: "Read";
1602
+ readonly generation: number;
1603
+ } | {
1604
+ readonly _tag: "Cleared";
1605
+ readonly generation: number;
1606
+ } | {
1607
+ readonly _tag: "Announced";
1608
+ readonly message: string;
1609
+ readonly politeness: "polite" | "assertive";
1610
+ }, unknown, never, never>;
1611
+ };
1612
+ readonly GotLayersMessage: {
1613
+ readonly message: Schema.Codec<{
1614
+ readonly _tag: "Focused";
1615
+ readonly id: string;
1616
+ } | {
1617
+ readonly _tag: "Opened";
1618
+ readonly id: string;
1619
+ } | {
1620
+ readonly _tag: "Closed";
1621
+ readonly id: string;
1622
+ }, unknown, never, never>;
1623
+ };
1624
+ }>;
1625
+ type Message$1 = typeof Message$1.Type;
1626
+ /** What a new node of each Block starts with. A Block without starting props is not offered. */
1627
+ export type Starters<Blocks extends AnyBlock> = { readonly [B in Blocks as B['name']]?: PropsOf<B>; };
1628
+ /**
1629
+ * A key that runs a command, named as `KeyboardEvent.key` names it. `mod` is
1630
+ * Ctrl, or ⌘ on a Mac. `mod` and `alt` must be as given; `shift` must be as
1631
+ * given only where it is given, so a key that leaves it out takes either.
1632
+ */
1633
+ export interface CommandKey {
1634
+ readonly key: string;
1635
+ readonly mod?: boolean;
1636
+ readonly alt?: boolean;
1637
+ readonly shift?: boolean;
1638
+ }
1639
+ /** One thing the editor does, and every way to ask for it. */
1640
+ export interface BuilderCommand {
1641
+ readonly id: string;
1642
+ /** What it is called, on its button and in the list of shortcuts. */
1643
+ readonly label: string;
1644
+ /** The keys that run it; the first is the one shown. None for one run only by a button. */
1645
+ readonly keys: ReadonlyArray<CommandKey>;
1646
+ /** Where a drawn Builder offers it: with the selected node's actions, in the toolbar, or by key only. */
1647
+ readonly placement: ReadonlyArray<'node' | 'toolbar' | 'keyboard'>;
1648
+ /** The Message it sends now; none while it has nothing to do, which disables its button. */
1649
+ readonly run: (model: Pick<Model$1, 'page' | 'selected'>) => Option.Option<Message$1>;
1650
+ }
1651
+ export declare const Builder: {
1652
+ /**
1653
+ * Block metadata: the control the inspector draws a prop with, where its
1654
+ * Schema alone does not say, as
1655
+ * `Heading.pipe(Block.annotate(Builder.controls({ text: Input.multiline() })))`.
1656
+ * `Input.hidden()` leaves a prop out of the inspector.
1657
+ */
1658
+ controls: (given: Readonly<Record<string, import("foldkit-form").Control>>) => import("foldkit-metadata").Metadata;
1659
+ /**
1660
+ * A Builder for a Catalog: its Bundle, the form control that places it as a
1661
+ * key, and the helpers a view uses. `starters` gives the props a new node of
1662
+ * each Block starts with; the insert panel offers exactly those Blocks.
1663
+ */
1664
+ make: <const Name extends string, Blocks extends AnyBlock>(name: Name, config: {
1665
+ readonly catalog: Catalog<Blocks>;
1666
+ readonly renderer: Renderer<Blocks, never>;
1667
+ readonly starters: NoInfer<Starters<Blocks>>;
1668
+ /** Undo steps kept. Default 200. */
1669
+ readonly capacity?: number;
1670
+ /** The context the editor previews the page as at first, by the Catalog's context keys. */
1671
+ readonly preview?: Readonly<Record<string, ContextValue>>;
1672
+ /**
1673
+ * The editor's commands, given the built ones: another key for one, one
1674
+ * left out, another order. What runs a key, the node's actions and the
1675
+ * toolbar are all drawn from the table this returns.
1676
+ */
1677
+ readonly commands?: (built: ReadonlyArray<BuilderCommand>) => ReadonlyArray<BuilderCommand>;
1678
+ /** What it says of each edit, its commands' labels and its refusals, over the English ones. */
1679
+ readonly words?: Partial<EditWords>;
1680
+ }) => {
1681
+ name: Name;
1682
+ catalog: Catalog<Blocks, unknown>;
1683
+ renderer: Renderer<Blocks, never>;
1684
+ bundle: Bundle.Bundle<Name, void, {
1685
+ readonly page: {
1686
+ readonly past: readonly {
1687
+ readonly format: 1;
1688
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1689
+ readonly nodes: {
1690
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
1691
+ readonly block: string;
1692
+ readonly props: {
1693
+ readonly [x: string]: Schema.Json;
1694
+ };
1695
+ readonly regions: {
1696
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1697
+ };
1698
+ readonly when?: Schema.Json | undefined;
1699
+ readonly appearance?: Schema.Json | undefined;
1700
+ readonly actions?: {
1701
+ readonly [x: string]: Schema.Json;
1702
+ } | undefined;
1703
+ };
1704
+ };
1705
+ }[];
1706
+ readonly present: {
1707
+ readonly format: 1;
1708
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1709
+ readonly nodes: {
1710
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
1711
+ readonly block: string;
1712
+ readonly props: {
1713
+ readonly [x: string]: Schema.Json;
1714
+ };
1715
+ readonly regions: {
1716
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1717
+ };
1718
+ readonly when?: Schema.Json | undefined;
1719
+ readonly appearance?: Schema.Json | undefined;
1720
+ readonly actions?: {
1721
+ readonly [x: string]: Schema.Json;
1722
+ } | undefined;
1723
+ };
1724
+ };
1725
+ };
1726
+ readonly future: readonly {
1727
+ readonly format: 1;
1728
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1729
+ readonly nodes: {
1730
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
1731
+ readonly block: string;
1732
+ readonly props: {
1733
+ readonly [x: string]: Schema.Json;
1734
+ };
1735
+ readonly regions: {
1736
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1737
+ };
1738
+ readonly when?: Schema.Json | undefined;
1739
+ readonly appearance?: Schema.Json | undefined;
1740
+ readonly actions?: {
1741
+ readonly [x: string]: Schema.Json;
1742
+ } | undefined;
1743
+ };
1744
+ };
1745
+ }[];
1746
+ readonly group: string | null;
1747
+ };
1748
+ readonly selected: Option.Option<string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">>;
1749
+ readonly hovered: Option.Option<string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">>;
1750
+ readonly panel: "insert" | "layers" | "properties";
1751
+ readonly viewport: "wide" | "medium" | "narrow";
1752
+ readonly refused: Option.Option<{
1753
+ readonly code: string;
1754
+ readonly message: string;
1755
+ }>;
1756
+ readonly drag: Option.Option<{
1757
+ readonly source: {
1758
+ readonly _tag: "Existing";
1759
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1760
+ } | {
1761
+ readonly _tag: "New";
1762
+ readonly block: string;
1763
+ };
1764
+ readonly over: Option.Option<{
1765
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1766
+ readonly zone: "before" | "inside" | "after";
1767
+ readonly region: Option.Option<string>;
1768
+ }>;
1769
+ readonly at: Option.Option<{
1770
+ readonly _tag: "Root";
1771
+ readonly index: number;
1772
+ } | {
1773
+ readonly _tag: "Region";
1774
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1775
+ readonly region: string;
1776
+ readonly index: number;
1777
+ }>;
1778
+ }>;
1779
+ readonly preview: {
1780
+ readonly [x: string]: string | number | boolean | null;
1781
+ };
1782
+ readonly inspector: Option.Option<{
1783
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1784
+ readonly forms: {
1785
+ readonly [x: string]: Schema.Json;
1786
+ };
1787
+ }>;
1788
+ readonly clipboard: Option.Option<{
1789
+ readonly root: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1790
+ readonly nodes: {
1791
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
1792
+ readonly block: string;
1793
+ readonly props: {
1794
+ readonly [x: string]: Schema.Json;
1795
+ };
1796
+ readonly regions: {
1797
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1798
+ };
1799
+ readonly when?: Schema.Json | undefined;
1800
+ readonly appearance?: Schema.Json | undefined;
1801
+ readonly actions?: {
1802
+ readonly [x: string]: Schema.Json;
1803
+ } | undefined;
1804
+ };
1805
+ };
1806
+ }>;
1807
+ readonly editing: Option.Option<{
1808
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1809
+ readonly key: string;
1810
+ readonly initial: string;
1811
+ readonly typed: boolean;
1812
+ }>;
1813
+ readonly announcer: {
1814
+ readonly polite: string;
1815
+ readonly assertive: string;
1816
+ readonly pending: {
1817
+ readonly message: string;
1818
+ readonly politeness: "polite" | "assertive";
1819
+ } | null;
1820
+ readonly generation: number;
1821
+ };
1822
+ readonly layers: {
1823
+ readonly current: string | null;
1824
+ readonly toggled: readonly string[];
1825
+ };
1826
+ }, {
1827
+ readonly _tag: "GotLayersMessage";
1828
+ readonly message: {
1829
+ readonly _tag: "Focused";
1830
+ readonly id: string;
1831
+ } | {
1832
+ readonly _tag: "Opened";
1833
+ readonly id: string;
1834
+ } | {
1835
+ readonly _tag: "Closed";
1836
+ readonly id: string;
1837
+ };
1838
+ } | {
1839
+ readonly _tag: "GotAnnouncerMessage";
1840
+ readonly message: {
1841
+ readonly _tag: "Read";
1842
+ readonly generation: number;
1843
+ } | {
1844
+ readonly _tag: "Cleared";
1845
+ readonly generation: number;
1846
+ } | {
1847
+ readonly _tag: "Announced";
1848
+ readonly message: string;
1849
+ readonly politeness: "polite" | "assertive";
1850
+ };
1851
+ } | {
1852
+ readonly _tag: "Selected";
1853
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1854
+ } | {
1855
+ readonly _tag: "Deselected";
1856
+ } | {
1857
+ readonly _tag: "Hovered";
1858
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1859
+ } | {
1860
+ readonly _tag: "Unhovered";
1861
+ } | {
1862
+ readonly _tag: "Applied";
1863
+ readonly op: Operation;
1864
+ } | {
1865
+ readonly _tag: "InsertAsked";
1866
+ readonly block: string;
1867
+ readonly at: {
1868
+ readonly _tag: "Root";
1869
+ readonly index: number;
1870
+ } | {
1871
+ readonly _tag: "Region";
1872
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1873
+ readonly region: string;
1874
+ readonly index: number;
1875
+ };
1876
+ } | {
1877
+ readonly _tag: "DuplicateAsked";
1878
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1879
+ readonly at: {
1880
+ readonly _tag: "Root";
1881
+ readonly index: number;
1882
+ } | {
1883
+ readonly _tag: "Region";
1884
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1885
+ readonly region: string;
1886
+ readonly index: number;
1887
+ };
1888
+ } | {
1889
+ readonly _tag: "PatternAsked";
1890
+ readonly pattern: string;
1891
+ readonly at: {
1892
+ readonly _tag: "Root";
1893
+ readonly index: number;
1894
+ } | {
1895
+ readonly _tag: "Region";
1896
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1897
+ readonly region: string;
1898
+ readonly index: number;
1899
+ };
1900
+ } | {
1901
+ readonly _tag: "CopyAsked";
1902
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1903
+ } | {
1904
+ readonly _tag: "CutAsked";
1905
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1906
+ } | {
1907
+ readonly _tag: "PasteAsked";
1908
+ } | {
1909
+ readonly _tag: "ClipboardRead";
1910
+ readonly text: Option.Option<string>;
1911
+ } | {
1912
+ readonly _tag: "EditingAsked";
1913
+ readonly field: string;
1914
+ } | {
1915
+ readonly _tag: "FieldTyped";
1916
+ readonly field: string;
1917
+ readonly text: string;
1918
+ } | {
1919
+ readonly _tag: "EditingCommitted";
1920
+ readonly field: string;
1921
+ readonly text: string;
1922
+ } | {
1923
+ readonly _tag: "EditingCancelled";
1924
+ readonly field: string;
1925
+ } | {
1926
+ readonly _tag: "Minted";
1927
+ readonly ids: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1928
+ readonly request: {
1929
+ readonly _tag: "Insert";
1930
+ readonly block: string;
1931
+ readonly at: {
1932
+ readonly _tag: "Root";
1933
+ readonly index: number;
1934
+ } | {
1935
+ readonly _tag: "Region";
1936
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1937
+ readonly region: string;
1938
+ readonly index: number;
1939
+ };
1940
+ } | {
1941
+ readonly _tag: "Duplicate";
1942
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1943
+ readonly at: {
1944
+ readonly _tag: "Root";
1945
+ readonly index: number;
1946
+ } | {
1947
+ readonly _tag: "Region";
1948
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1949
+ readonly region: string;
1950
+ readonly index: number;
1951
+ };
1952
+ } | {
1953
+ readonly _tag: "Paste";
1954
+ readonly tree: {
1955
+ readonly root: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1956
+ readonly nodes: {
1957
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
1958
+ readonly block: string;
1959
+ readonly props: {
1960
+ readonly [x: string]: Schema.Json;
1961
+ };
1962
+ readonly regions: {
1963
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
1964
+ };
1965
+ readonly when?: Schema.Json | undefined;
1966
+ readonly appearance?: Schema.Json | undefined;
1967
+ readonly actions?: {
1968
+ readonly [x: string]: Schema.Json;
1969
+ } | undefined;
1970
+ };
1971
+ };
1972
+ };
1973
+ readonly at: {
1974
+ readonly _tag: "Root";
1975
+ readonly index: number;
1976
+ } | {
1977
+ readonly _tag: "Region";
1978
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1979
+ readonly region: string;
1980
+ readonly index: number;
1981
+ };
1982
+ } | {
1983
+ readonly _tag: "Pattern";
1984
+ readonly pattern: string;
1985
+ readonly at: {
1986
+ readonly _tag: "Root";
1987
+ readonly index: number;
1988
+ } | {
1989
+ readonly _tag: "Region";
1990
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
1991
+ readonly region: string;
1992
+ readonly index: number;
1993
+ };
1994
+ };
1995
+ } | {
1996
+ readonly _tag: "Undid";
1997
+ } | {
1998
+ readonly _tag: "Redid";
1999
+ } | {
2000
+ readonly _tag: "PanelChosen";
2001
+ readonly panel: "insert" | "layers" | "properties";
2002
+ } | {
2003
+ readonly _tag: "ViewportChosen";
2004
+ readonly viewport: "wide" | "medium" | "narrow";
2005
+ } | {
2006
+ readonly _tag: "DragStarted";
2007
+ readonly source: {
2008
+ readonly _tag: "Existing";
2009
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2010
+ } | {
2011
+ readonly _tag: "New";
2012
+ readonly block: string;
2013
+ };
2014
+ } | {
2015
+ readonly _tag: "DraggedOver";
2016
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2017
+ readonly zone: "before" | "inside" | "after";
2018
+ } | {
2019
+ readonly _tag: "DraggedOverRegion";
2020
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2021
+ readonly region: string;
2022
+ } | {
2023
+ readonly _tag: "DraggedOff";
2024
+ } | {
2025
+ readonly _tag: "DraggedOverPage";
2026
+ } | {
2027
+ readonly _tag: "DragDropped";
2028
+ } | {
2029
+ readonly _tag: "DragCancelled";
2030
+ } | {
2031
+ readonly _tag: "PreviewChosen";
2032
+ readonly key: string;
2033
+ readonly value: string | number | boolean | null;
2034
+ } | {
2035
+ readonly _tag: "PreviewCleared";
2036
+ readonly key: string;
2037
+ } | {
2038
+ readonly _tag: "Inspected";
2039
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2040
+ readonly form: string;
2041
+ readonly message: Schema.Json;
2042
+ }, never, never, never, void, {}, {}>;
2043
+ initial: {
2044
+ readonly page: {
2045
+ readonly past: readonly {
2046
+ readonly format: 1;
2047
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2048
+ readonly nodes: {
2049
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2050
+ readonly block: string;
2051
+ readonly props: {
2052
+ readonly [x: string]: Schema.Json;
2053
+ };
2054
+ readonly regions: {
2055
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2056
+ };
2057
+ readonly when?: Schema.Json | undefined;
2058
+ readonly appearance?: Schema.Json | undefined;
2059
+ readonly actions?: {
2060
+ readonly [x: string]: Schema.Json;
2061
+ } | undefined;
2062
+ };
2063
+ };
2064
+ }[];
2065
+ readonly present: {
2066
+ readonly format: 1;
2067
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2068
+ readonly nodes: {
2069
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2070
+ readonly block: string;
2071
+ readonly props: {
2072
+ readonly [x: string]: Schema.Json;
2073
+ };
2074
+ readonly regions: {
2075
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2076
+ };
2077
+ readonly when?: Schema.Json | undefined;
2078
+ readonly appearance?: Schema.Json | undefined;
2079
+ readonly actions?: {
2080
+ readonly [x: string]: Schema.Json;
2081
+ } | undefined;
2082
+ };
2083
+ };
2084
+ };
2085
+ readonly future: readonly {
2086
+ readonly format: 1;
2087
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2088
+ readonly nodes: {
2089
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2090
+ readonly block: string;
2091
+ readonly props: {
2092
+ readonly [x: string]: Schema.Json;
2093
+ };
2094
+ readonly regions: {
2095
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2096
+ };
2097
+ readonly when?: Schema.Json | undefined;
2098
+ readonly appearance?: Schema.Json | undefined;
2099
+ readonly actions?: {
2100
+ readonly [x: string]: Schema.Json;
2101
+ } | undefined;
2102
+ };
2103
+ };
2104
+ }[];
2105
+ readonly group: string | null;
2106
+ };
2107
+ readonly selected: Option.Option<string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">>;
2108
+ readonly hovered: Option.Option<string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">>;
2109
+ readonly panel: "insert" | "layers" | "properties";
2110
+ readonly viewport: "wide" | "medium" | "narrow";
2111
+ readonly refused: Option.Option<{
2112
+ readonly code: string;
2113
+ readonly message: string;
2114
+ }>;
2115
+ readonly drag: Option.Option<{
2116
+ readonly source: {
2117
+ readonly _tag: "Existing";
2118
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2119
+ } | {
2120
+ readonly _tag: "New";
2121
+ readonly block: string;
2122
+ };
2123
+ readonly over: Option.Option<{
2124
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2125
+ readonly zone: "before" | "inside" | "after";
2126
+ readonly region: Option.Option<string>;
2127
+ }>;
2128
+ readonly at: Option.Option<{
2129
+ readonly _tag: "Root";
2130
+ readonly index: number;
2131
+ } | {
2132
+ readonly _tag: "Region";
2133
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2134
+ readonly region: string;
2135
+ readonly index: number;
2136
+ }>;
2137
+ }>;
2138
+ readonly preview: {
2139
+ readonly [x: string]: string | number | boolean | null;
2140
+ };
2141
+ readonly inspector: Option.Option<{
2142
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2143
+ readonly forms: {
2144
+ readonly [x: string]: Schema.Json;
2145
+ };
2146
+ }>;
2147
+ readonly clipboard: Option.Option<{
2148
+ readonly root: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2149
+ readonly nodes: {
2150
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2151
+ readonly block: string;
2152
+ readonly props: {
2153
+ readonly [x: string]: Schema.Json;
2154
+ };
2155
+ readonly regions: {
2156
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2157
+ };
2158
+ readonly when?: Schema.Json | undefined;
2159
+ readonly appearance?: Schema.Json | undefined;
2160
+ readonly actions?: {
2161
+ readonly [x: string]: Schema.Json;
2162
+ } | undefined;
2163
+ };
2164
+ };
2165
+ }>;
2166
+ readonly editing: Option.Option<{
2167
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2168
+ readonly key: string;
2169
+ readonly initial: string;
2170
+ readonly typed: boolean;
2171
+ }>;
2172
+ readonly announcer: {
2173
+ readonly polite: string;
2174
+ readonly assertive: string;
2175
+ readonly pending: {
2176
+ readonly message: string;
2177
+ readonly politeness: "polite" | "assertive";
2178
+ } | null;
2179
+ readonly generation: number;
2180
+ };
2181
+ readonly layers: {
2182
+ readonly current: string | null;
2183
+ readonly toggled: readonly string[];
2184
+ };
2185
+ };
2186
+ /** The form control that places this Builder as a key: its value is the Document. */
2187
+ input: import("foldkit-form").BundleControl<{
2188
+ readonly page: {
2189
+ readonly past: readonly {
2190
+ readonly format: 1;
2191
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2192
+ readonly nodes: {
2193
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2194
+ readonly block: string;
2195
+ readonly props: {
2196
+ readonly [x: string]: Schema.Json;
2197
+ };
2198
+ readonly regions: {
2199
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2200
+ };
2201
+ readonly when?: Schema.Json | undefined;
2202
+ readonly appearance?: Schema.Json | undefined;
2203
+ readonly actions?: {
2204
+ readonly [x: string]: Schema.Json;
2205
+ } | undefined;
2206
+ };
2207
+ };
2208
+ }[];
2209
+ readonly present: {
2210
+ readonly format: 1;
2211
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2212
+ readonly nodes: {
2213
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2214
+ readonly block: string;
2215
+ readonly props: {
2216
+ readonly [x: string]: Schema.Json;
2217
+ };
2218
+ readonly regions: {
2219
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2220
+ };
2221
+ readonly when?: Schema.Json | undefined;
2222
+ readonly appearance?: Schema.Json | undefined;
2223
+ readonly actions?: {
2224
+ readonly [x: string]: Schema.Json;
2225
+ } | undefined;
2226
+ };
2227
+ };
2228
+ };
2229
+ readonly future: readonly {
2230
+ readonly format: 1;
2231
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2232
+ readonly nodes: {
2233
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2234
+ readonly block: string;
2235
+ readonly props: {
2236
+ readonly [x: string]: Schema.Json;
2237
+ };
2238
+ readonly regions: {
2239
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2240
+ };
2241
+ readonly when?: Schema.Json | undefined;
2242
+ readonly appearance?: Schema.Json | undefined;
2243
+ readonly actions?: {
2244
+ readonly [x: string]: Schema.Json;
2245
+ } | undefined;
2246
+ };
2247
+ };
2248
+ }[];
2249
+ readonly group: string | null;
2250
+ };
2251
+ readonly selected: Option.Option<string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">>;
2252
+ readonly hovered: Option.Option<string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">>;
2253
+ readonly panel: "insert" | "layers" | "properties";
2254
+ readonly viewport: "wide" | "medium" | "narrow";
2255
+ readonly refused: Option.Option<{
2256
+ readonly code: string;
2257
+ readonly message: string;
2258
+ }>;
2259
+ readonly drag: Option.Option<{
2260
+ readonly source: {
2261
+ readonly _tag: "Existing";
2262
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2263
+ } | {
2264
+ readonly _tag: "New";
2265
+ readonly block: string;
2266
+ };
2267
+ readonly over: Option.Option<{
2268
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2269
+ readonly zone: "before" | "inside" | "after";
2270
+ readonly region: Option.Option<string>;
2271
+ }>;
2272
+ readonly at: Option.Option<{
2273
+ readonly _tag: "Root";
2274
+ readonly index: number;
2275
+ } | {
2276
+ readonly _tag: "Region";
2277
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2278
+ readonly region: string;
2279
+ readonly index: number;
2280
+ }>;
2281
+ }>;
2282
+ readonly preview: {
2283
+ readonly [x: string]: string | number | boolean | null;
2284
+ };
2285
+ readonly inspector: Option.Option<{
2286
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2287
+ readonly forms: {
2288
+ readonly [x: string]: Schema.Json;
2289
+ };
2290
+ }>;
2291
+ readonly clipboard: Option.Option<{
2292
+ readonly root: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2293
+ readonly nodes: {
2294
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2295
+ readonly block: string;
2296
+ readonly props: {
2297
+ readonly [x: string]: Schema.Json;
2298
+ };
2299
+ readonly regions: {
2300
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2301
+ };
2302
+ readonly when?: Schema.Json | undefined;
2303
+ readonly appearance?: Schema.Json | undefined;
2304
+ readonly actions?: {
2305
+ readonly [x: string]: Schema.Json;
2306
+ } | undefined;
2307
+ };
2308
+ };
2309
+ }>;
2310
+ readonly editing: Option.Option<{
2311
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2312
+ readonly key: string;
2313
+ readonly initial: string;
2314
+ readonly typed: boolean;
2315
+ }>;
2316
+ readonly announcer: {
2317
+ readonly polite: string;
2318
+ readonly assertive: string;
2319
+ readonly pending: {
2320
+ readonly message: string;
2321
+ readonly politeness: "polite" | "assertive";
2322
+ } | null;
2323
+ readonly generation: number;
2324
+ };
2325
+ readonly layers: {
2326
+ readonly current: string | null;
2327
+ readonly toggled: readonly string[];
2328
+ };
2329
+ }, {
2330
+ readonly _tag: "GotLayersMessage";
2331
+ readonly message: {
2332
+ readonly _tag: "Focused";
2333
+ readonly id: string;
2334
+ } | {
2335
+ readonly _tag: "Opened";
2336
+ readonly id: string;
2337
+ } | {
2338
+ readonly _tag: "Closed";
2339
+ readonly id: string;
2340
+ };
2341
+ } | {
2342
+ readonly _tag: "GotAnnouncerMessage";
2343
+ readonly message: {
2344
+ readonly _tag: "Read";
2345
+ readonly generation: number;
2346
+ } | {
2347
+ readonly _tag: "Cleared";
2348
+ readonly generation: number;
2349
+ } | {
2350
+ readonly _tag: "Announced";
2351
+ readonly message: string;
2352
+ readonly politeness: "polite" | "assertive";
2353
+ };
2354
+ } | {
2355
+ readonly _tag: "Selected";
2356
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2357
+ } | {
2358
+ readonly _tag: "Deselected";
2359
+ } | {
2360
+ readonly _tag: "Hovered";
2361
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2362
+ } | {
2363
+ readonly _tag: "Unhovered";
2364
+ } | {
2365
+ readonly _tag: "Applied";
2366
+ readonly op: Operation;
2367
+ } | {
2368
+ readonly _tag: "InsertAsked";
2369
+ readonly block: string;
2370
+ readonly at: {
2371
+ readonly _tag: "Root";
2372
+ readonly index: number;
2373
+ } | {
2374
+ readonly _tag: "Region";
2375
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2376
+ readonly region: string;
2377
+ readonly index: number;
2378
+ };
2379
+ } | {
2380
+ readonly _tag: "DuplicateAsked";
2381
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2382
+ readonly at: {
2383
+ readonly _tag: "Root";
2384
+ readonly index: number;
2385
+ } | {
2386
+ readonly _tag: "Region";
2387
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2388
+ readonly region: string;
2389
+ readonly index: number;
2390
+ };
2391
+ } | {
2392
+ readonly _tag: "PatternAsked";
2393
+ readonly pattern: string;
2394
+ readonly at: {
2395
+ readonly _tag: "Root";
2396
+ readonly index: number;
2397
+ } | {
2398
+ readonly _tag: "Region";
2399
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2400
+ readonly region: string;
2401
+ readonly index: number;
2402
+ };
2403
+ } | {
2404
+ readonly _tag: "CopyAsked";
2405
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2406
+ } | {
2407
+ readonly _tag: "CutAsked";
2408
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2409
+ } | {
2410
+ readonly _tag: "PasteAsked";
2411
+ } | {
2412
+ readonly _tag: "ClipboardRead";
2413
+ readonly text: Option.Option<string>;
2414
+ } | {
2415
+ readonly _tag: "EditingAsked";
2416
+ readonly field: string;
2417
+ } | {
2418
+ readonly _tag: "FieldTyped";
2419
+ readonly field: string;
2420
+ readonly text: string;
2421
+ } | {
2422
+ readonly _tag: "EditingCommitted";
2423
+ readonly field: string;
2424
+ readonly text: string;
2425
+ } | {
2426
+ readonly _tag: "EditingCancelled";
2427
+ readonly field: string;
2428
+ } | {
2429
+ readonly _tag: "Minted";
2430
+ readonly ids: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2431
+ readonly request: {
2432
+ readonly _tag: "Insert";
2433
+ readonly block: string;
2434
+ readonly at: {
2435
+ readonly _tag: "Root";
2436
+ readonly index: number;
2437
+ } | {
2438
+ readonly _tag: "Region";
2439
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2440
+ readonly region: string;
2441
+ readonly index: number;
2442
+ };
2443
+ } | {
2444
+ readonly _tag: "Duplicate";
2445
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2446
+ readonly at: {
2447
+ readonly _tag: "Root";
2448
+ readonly index: number;
2449
+ } | {
2450
+ readonly _tag: "Region";
2451
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2452
+ readonly region: string;
2453
+ readonly index: number;
2454
+ };
2455
+ } | {
2456
+ readonly _tag: "Paste";
2457
+ readonly tree: {
2458
+ readonly root: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2459
+ readonly nodes: {
2460
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2461
+ readonly block: string;
2462
+ readonly props: {
2463
+ readonly [x: string]: Schema.Json;
2464
+ };
2465
+ readonly regions: {
2466
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2467
+ };
2468
+ readonly when?: Schema.Json | undefined;
2469
+ readonly appearance?: Schema.Json | undefined;
2470
+ readonly actions?: {
2471
+ readonly [x: string]: Schema.Json;
2472
+ } | undefined;
2473
+ };
2474
+ };
2475
+ };
2476
+ readonly at: {
2477
+ readonly _tag: "Root";
2478
+ readonly index: number;
2479
+ } | {
2480
+ readonly _tag: "Region";
2481
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2482
+ readonly region: string;
2483
+ readonly index: number;
2484
+ };
2485
+ } | {
2486
+ readonly _tag: "Pattern";
2487
+ readonly pattern: string;
2488
+ readonly at: {
2489
+ readonly _tag: "Root";
2490
+ readonly index: number;
2491
+ } | {
2492
+ readonly _tag: "Region";
2493
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2494
+ readonly region: string;
2495
+ readonly index: number;
2496
+ };
2497
+ };
2498
+ } | {
2499
+ readonly _tag: "Undid";
2500
+ } | {
2501
+ readonly _tag: "Redid";
2502
+ } | {
2503
+ readonly _tag: "PanelChosen";
2504
+ readonly panel: "insert" | "layers" | "properties";
2505
+ } | {
2506
+ readonly _tag: "ViewportChosen";
2507
+ readonly viewport: "wide" | "medium" | "narrow";
2508
+ } | {
2509
+ readonly _tag: "DragStarted";
2510
+ readonly source: {
2511
+ readonly _tag: "Existing";
2512
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2513
+ } | {
2514
+ readonly _tag: "New";
2515
+ readonly block: string;
2516
+ };
2517
+ } | {
2518
+ readonly _tag: "DraggedOver";
2519
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2520
+ readonly zone: "before" | "inside" | "after";
2521
+ } | {
2522
+ readonly _tag: "DraggedOverRegion";
2523
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2524
+ readonly region: string;
2525
+ } | {
2526
+ readonly _tag: "DraggedOff";
2527
+ } | {
2528
+ readonly _tag: "DraggedOverPage";
2529
+ } | {
2530
+ readonly _tag: "DragDropped";
2531
+ } | {
2532
+ readonly _tag: "DragCancelled";
2533
+ } | {
2534
+ readonly _tag: "PreviewChosen";
2535
+ readonly key: string;
2536
+ readonly value: string | number | boolean | null;
2537
+ } | {
2538
+ readonly _tag: "PreviewCleared";
2539
+ readonly key: string;
2540
+ } | {
2541
+ readonly _tag: "Inspected";
2542
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2543
+ readonly form: string;
2544
+ readonly message: Schema.Json;
2545
+ }, {
2546
+ readonly format: 1;
2547
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2548
+ readonly nodes: {
2549
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2550
+ readonly block: string;
2551
+ readonly props: {
2552
+ readonly [x: string]: Schema.Json;
2553
+ };
2554
+ readonly regions: {
2555
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2556
+ };
2557
+ readonly when?: Schema.Json | undefined;
2558
+ readonly appearance?: Schema.Json | undefined;
2559
+ readonly actions?: {
2560
+ readonly [x: string]: Schema.Json;
2561
+ } | undefined;
2562
+ };
2563
+ };
2564
+ }, {}>;
2565
+ /**
2566
+ * The same control, drawn by another view, such as
2567
+ * `BuilderView.submodel(view)` from `foldkit-mixins-builder`.
2568
+ */
2569
+ inputWith: <ViewInputs>(drawn: Submodel.View<Model$1, Message$1, ViewInputs>) => import("foldkit-form").BundleControl<{
2570
+ readonly page: {
2571
+ readonly past: readonly {
2572
+ readonly format: 1;
2573
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2574
+ readonly nodes: {
2575
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2576
+ readonly block: string;
2577
+ readonly props: {
2578
+ readonly [x: string]: Schema.Json;
2579
+ };
2580
+ readonly regions: {
2581
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2582
+ };
2583
+ readonly when?: Schema.Json | undefined;
2584
+ readonly appearance?: Schema.Json | undefined;
2585
+ readonly actions?: {
2586
+ readonly [x: string]: Schema.Json;
2587
+ } | undefined;
2588
+ };
2589
+ };
2590
+ }[];
2591
+ readonly present: {
2592
+ readonly format: 1;
2593
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2594
+ readonly nodes: {
2595
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2596
+ readonly block: string;
2597
+ readonly props: {
2598
+ readonly [x: string]: Schema.Json;
2599
+ };
2600
+ readonly regions: {
2601
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2602
+ };
2603
+ readonly when?: Schema.Json | undefined;
2604
+ readonly appearance?: Schema.Json | undefined;
2605
+ readonly actions?: {
2606
+ readonly [x: string]: Schema.Json;
2607
+ } | undefined;
2608
+ };
2609
+ };
2610
+ };
2611
+ readonly future: readonly {
2612
+ readonly format: 1;
2613
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2614
+ readonly nodes: {
2615
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2616
+ readonly block: string;
2617
+ readonly props: {
2618
+ readonly [x: string]: Schema.Json;
2619
+ };
2620
+ readonly regions: {
2621
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2622
+ };
2623
+ readonly when?: Schema.Json | undefined;
2624
+ readonly appearance?: Schema.Json | undefined;
2625
+ readonly actions?: {
2626
+ readonly [x: string]: Schema.Json;
2627
+ } | undefined;
2628
+ };
2629
+ };
2630
+ }[];
2631
+ readonly group: string | null;
2632
+ };
2633
+ readonly selected: Option.Option<string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">>;
2634
+ readonly hovered: Option.Option<string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">>;
2635
+ readonly panel: "insert" | "layers" | "properties";
2636
+ readonly viewport: "wide" | "medium" | "narrow";
2637
+ readonly refused: Option.Option<{
2638
+ readonly code: string;
2639
+ readonly message: string;
2640
+ }>;
2641
+ readonly drag: Option.Option<{
2642
+ readonly source: {
2643
+ readonly _tag: "Existing";
2644
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2645
+ } | {
2646
+ readonly _tag: "New";
2647
+ readonly block: string;
2648
+ };
2649
+ readonly over: Option.Option<{
2650
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2651
+ readonly zone: "before" | "inside" | "after";
2652
+ readonly region: Option.Option<string>;
2653
+ }>;
2654
+ readonly at: Option.Option<{
2655
+ readonly _tag: "Root";
2656
+ readonly index: number;
2657
+ } | {
2658
+ readonly _tag: "Region";
2659
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2660
+ readonly region: string;
2661
+ readonly index: number;
2662
+ }>;
2663
+ }>;
2664
+ readonly preview: {
2665
+ readonly [x: string]: string | number | boolean | null;
2666
+ };
2667
+ readonly inspector: Option.Option<{
2668
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2669
+ readonly forms: {
2670
+ readonly [x: string]: Schema.Json;
2671
+ };
2672
+ }>;
2673
+ readonly clipboard: Option.Option<{
2674
+ readonly root: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2675
+ readonly nodes: {
2676
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2677
+ readonly block: string;
2678
+ readonly props: {
2679
+ readonly [x: string]: Schema.Json;
2680
+ };
2681
+ readonly regions: {
2682
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2683
+ };
2684
+ readonly when?: Schema.Json | undefined;
2685
+ readonly appearance?: Schema.Json | undefined;
2686
+ readonly actions?: {
2687
+ readonly [x: string]: Schema.Json;
2688
+ } | undefined;
2689
+ };
2690
+ };
2691
+ }>;
2692
+ readonly editing: Option.Option<{
2693
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2694
+ readonly key: string;
2695
+ readonly initial: string;
2696
+ readonly typed: boolean;
2697
+ }>;
2698
+ readonly announcer: {
2699
+ readonly polite: string;
2700
+ readonly assertive: string;
2701
+ readonly pending: {
2702
+ readonly message: string;
2703
+ readonly politeness: "polite" | "assertive";
2704
+ } | null;
2705
+ readonly generation: number;
2706
+ };
2707
+ readonly layers: {
2708
+ readonly current: string | null;
2709
+ readonly toggled: readonly string[];
2710
+ };
2711
+ }, {
2712
+ readonly _tag: "GotLayersMessage";
2713
+ readonly message: {
2714
+ readonly _tag: "Focused";
2715
+ readonly id: string;
2716
+ } | {
2717
+ readonly _tag: "Opened";
2718
+ readonly id: string;
2719
+ } | {
2720
+ readonly _tag: "Closed";
2721
+ readonly id: string;
2722
+ };
2723
+ } | {
2724
+ readonly _tag: "GotAnnouncerMessage";
2725
+ readonly message: {
2726
+ readonly _tag: "Read";
2727
+ readonly generation: number;
2728
+ } | {
2729
+ readonly _tag: "Cleared";
2730
+ readonly generation: number;
2731
+ } | {
2732
+ readonly _tag: "Announced";
2733
+ readonly message: string;
2734
+ readonly politeness: "polite" | "assertive";
2735
+ };
2736
+ } | {
2737
+ readonly _tag: "Selected";
2738
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2739
+ } | {
2740
+ readonly _tag: "Deselected";
2741
+ } | {
2742
+ readonly _tag: "Hovered";
2743
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2744
+ } | {
2745
+ readonly _tag: "Unhovered";
2746
+ } | {
2747
+ readonly _tag: "Applied";
2748
+ readonly op: Operation;
2749
+ } | {
2750
+ readonly _tag: "InsertAsked";
2751
+ readonly block: string;
2752
+ readonly at: {
2753
+ readonly _tag: "Root";
2754
+ readonly index: number;
2755
+ } | {
2756
+ readonly _tag: "Region";
2757
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2758
+ readonly region: string;
2759
+ readonly index: number;
2760
+ };
2761
+ } | {
2762
+ readonly _tag: "DuplicateAsked";
2763
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2764
+ readonly at: {
2765
+ readonly _tag: "Root";
2766
+ readonly index: number;
2767
+ } | {
2768
+ readonly _tag: "Region";
2769
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2770
+ readonly region: string;
2771
+ readonly index: number;
2772
+ };
2773
+ } | {
2774
+ readonly _tag: "PatternAsked";
2775
+ readonly pattern: string;
2776
+ readonly at: {
2777
+ readonly _tag: "Root";
2778
+ readonly index: number;
2779
+ } | {
2780
+ readonly _tag: "Region";
2781
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2782
+ readonly region: string;
2783
+ readonly index: number;
2784
+ };
2785
+ } | {
2786
+ readonly _tag: "CopyAsked";
2787
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2788
+ } | {
2789
+ readonly _tag: "CutAsked";
2790
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2791
+ } | {
2792
+ readonly _tag: "PasteAsked";
2793
+ } | {
2794
+ readonly _tag: "ClipboardRead";
2795
+ readonly text: Option.Option<string>;
2796
+ } | {
2797
+ readonly _tag: "EditingAsked";
2798
+ readonly field: string;
2799
+ } | {
2800
+ readonly _tag: "FieldTyped";
2801
+ readonly field: string;
2802
+ readonly text: string;
2803
+ } | {
2804
+ readonly _tag: "EditingCommitted";
2805
+ readonly field: string;
2806
+ readonly text: string;
2807
+ } | {
2808
+ readonly _tag: "EditingCancelled";
2809
+ readonly field: string;
2810
+ } | {
2811
+ readonly _tag: "Minted";
2812
+ readonly ids: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2813
+ readonly request: {
2814
+ readonly _tag: "Insert";
2815
+ readonly block: string;
2816
+ readonly at: {
2817
+ readonly _tag: "Root";
2818
+ readonly index: number;
2819
+ } | {
2820
+ readonly _tag: "Region";
2821
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2822
+ readonly region: string;
2823
+ readonly index: number;
2824
+ };
2825
+ } | {
2826
+ readonly _tag: "Duplicate";
2827
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2828
+ readonly at: {
2829
+ readonly _tag: "Root";
2830
+ readonly index: number;
2831
+ } | {
2832
+ readonly _tag: "Region";
2833
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2834
+ readonly region: string;
2835
+ readonly index: number;
2836
+ };
2837
+ } | {
2838
+ readonly _tag: "Paste";
2839
+ readonly tree: {
2840
+ readonly root: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2841
+ readonly nodes: {
2842
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2843
+ readonly block: string;
2844
+ readonly props: {
2845
+ readonly [x: string]: Schema.Json;
2846
+ };
2847
+ readonly regions: {
2848
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2849
+ };
2850
+ readonly when?: Schema.Json | undefined;
2851
+ readonly appearance?: Schema.Json | undefined;
2852
+ readonly actions?: {
2853
+ readonly [x: string]: Schema.Json;
2854
+ } | undefined;
2855
+ };
2856
+ };
2857
+ };
2858
+ readonly at: {
2859
+ readonly _tag: "Root";
2860
+ readonly index: number;
2861
+ } | {
2862
+ readonly _tag: "Region";
2863
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2864
+ readonly region: string;
2865
+ readonly index: number;
2866
+ };
2867
+ } | {
2868
+ readonly _tag: "Pattern";
2869
+ readonly pattern: string;
2870
+ readonly at: {
2871
+ readonly _tag: "Root";
2872
+ readonly index: number;
2873
+ } | {
2874
+ readonly _tag: "Region";
2875
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2876
+ readonly region: string;
2877
+ readonly index: number;
2878
+ };
2879
+ };
2880
+ } | {
2881
+ readonly _tag: "Undid";
2882
+ } | {
2883
+ readonly _tag: "Redid";
2884
+ } | {
2885
+ readonly _tag: "PanelChosen";
2886
+ readonly panel: "insert" | "layers" | "properties";
2887
+ } | {
2888
+ readonly _tag: "ViewportChosen";
2889
+ readonly viewport: "wide" | "medium" | "narrow";
2890
+ } | {
2891
+ readonly _tag: "DragStarted";
2892
+ readonly source: {
2893
+ readonly _tag: "Existing";
2894
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2895
+ } | {
2896
+ readonly _tag: "New";
2897
+ readonly block: string;
2898
+ };
2899
+ } | {
2900
+ readonly _tag: "DraggedOver";
2901
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2902
+ readonly zone: "before" | "inside" | "after";
2903
+ } | {
2904
+ readonly _tag: "DraggedOverRegion";
2905
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2906
+ readonly region: string;
2907
+ } | {
2908
+ readonly _tag: "DraggedOff";
2909
+ } | {
2910
+ readonly _tag: "DraggedOverPage";
2911
+ } | {
2912
+ readonly _tag: "DragDropped";
2913
+ } | {
2914
+ readonly _tag: "DragCancelled";
2915
+ } | {
2916
+ readonly _tag: "PreviewChosen";
2917
+ readonly key: string;
2918
+ readonly value: string | number | boolean | null;
2919
+ } | {
2920
+ readonly _tag: "PreviewCleared";
2921
+ readonly key: string;
2922
+ } | {
2923
+ readonly _tag: "Inspected";
2924
+ readonly id: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2925
+ readonly form: string;
2926
+ readonly message: Schema.Json;
2927
+ }, {
2928
+ readonly format: 1;
2929
+ readonly roots: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2930
+ readonly nodes: {
2931
+ readonly [x: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">]: {
2932
+ readonly block: string;
2933
+ readonly props: {
2934
+ readonly [x: string]: Schema.Json;
2935
+ };
2936
+ readonly regions: {
2937
+ readonly [x: string]: readonly (string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">)[];
2938
+ };
2939
+ readonly when?: Schema.Json | undefined;
2940
+ readonly appearance?: Schema.Json | undefined;
2941
+ readonly actions?: {
2942
+ readonly [x: string]: Schema.Json;
2943
+ } | undefined;
2944
+ };
2945
+ };
2946
+ }, {}>;
2947
+ /** Where a new node of a Block goes, given the selection; none where it may not go. */
2948
+ placeFor: (document: Document, selected: Option.Option<NodeId>, block: Blocks["name"]) => Option.Option<{
2949
+ readonly _tag: "Root";
2950
+ readonly index: number;
2951
+ } | {
2952
+ readonly _tag: "Region";
2953
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2954
+ readonly region: string;
2955
+ readonly index: number;
2956
+ }>;
2957
+ /** Where a pattern goes, as a new node of its root's Block would; none where it may not. */
2958
+ patternAt: (document: Document, selected: Option.Option<NodeId>, pattern: string) => Option.Option<{
2959
+ readonly _tag: "Root";
2960
+ readonly index: number;
2961
+ } | {
2962
+ readonly _tag: "Region";
2963
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2964
+ readonly region: string;
2965
+ readonly index: number;
2966
+ }>;
2967
+ moveBy: (document: Document, id: NodeId, delta: number) => Option.Option<Operation>;
2968
+ /** Where what is dragged over `target`, in `zone`, would go; none where it may not. */
2969
+ dropAt: (document: Document, dragged: DragSource, target: NodeId, zone: DropZone) => Option.Option<{
2970
+ readonly _tag: "Root";
2971
+ readonly index: number;
2972
+ } | {
2973
+ readonly _tag: "Region";
2974
+ readonly parent: string & import("effect/Brand").Brand<"@foldkit-composition/NodeId">;
2975
+ readonly region: string;
2976
+ readonly index: number;
2977
+ }>;
2978
+ replace: (model: Model$1, document: Document) => Model$1;
2979
+ settle: (model: Model$1) => Model$1;
2980
+ /** The editor's commands: what a key, a node's action or the toolbar runs. */
2981
+ commands: readonly BuilderCommand[];
2982
+ keyCommand: (model: Pick<Model$1, "page" | "selected" | "editing">, key: string, modifiers: KeyboardModifiers) => Option.Option<Message$1>;
2983
+ /**
2984
+ * The selected node's settings form and its Model, for the inspector to
2985
+ * draw: the Model it holds for the node, else one filled from the props.
2986
+ */
2987
+ inspecting: (model: Pick<Model$1, "page" | "selected" | "inspector">) => Option.Option<Inspecting>;
2988
+ /** The Blocks a new node may be, in the Catalog's order: those with starting props. */
2989
+ offered: string[];
2990
+ /** The Document a Builder Model is editing: its history's present. */
2991
+ document: (model: Pick<Model$1, "page">) => Document;
2992
+ };
2993
+ };
2994
+ //#endregion
2995
+ export { type EditWords, Message$1 as Message, Model$1 as Model, type Settings };
2996
+ //# sourceMappingURL=index.d.mts.map