foldkit-builder 0.3.13 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,823 +1,12 @@
1
1
  import { Option, Schema } from "effect";
2
2
  import { Bundle } from "foldkit-bundle";
3
- import { AnyBlock, Catalog, CatalogAction, Document, NodeId, Operation, PropsOf } from "foldkit-composition";
3
+ import { AnyBlock, Catalog, Document, NodeId, Operation, PropsOf } from "foldkit-composition";
4
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";
5
+ import { Settings, Settings as Settings$1, controlOf, controls, inputOf, settingsOf } from "./settings.js";
6
+ import { EditWords, EditWords as EditWords$1, editWords } from "./words.js";
8
7
  import { TreeNavigation } from "foldkit-primitives/interaction";
9
8
  import { KeyboardModifiers } from "foldkit/html";
10
9
  import * as Submodel from "foldkit/submodel";
11
- /**
12
- * Block metadata: the control the inspector draws a prop with, where its
13
- * Schema alone does not say, as
14
- * `Heading.pipe(Block.annotate(Builder.controls({ text: Input.multiline() })))`.
15
- * `Input.hidden()` leaves a prop out of the inspector.
16
- */
17
- declare const controls: (given: Readonly<Record<string, Control>>) => Metadata;
18
- /** A form over `fields`, named `name`, with the controls `hints` asks for. */
19
- declare const make: (name: string, fields: Readonly<Record<string, Schema.Top>>, hints: Readonly<Record<string, Control>>) => {
20
- form: {
21
- pipe<A>(this: A): A;
22
- pipe<A, B = never>(this: A, ab: (_: A) => B): B;
23
- pipe<A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C;
24
- pipe<A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D;
25
- pipe<A, B = never, C = never, D = never, E_1 = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1): E_1;
26
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F): F;
27
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G): G;
28
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H): H;
29
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I): I;
30
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never, J = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J): J;
31
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never, J = never, K = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K): K;
32
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L): L;
33
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M): M;
34
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N): N;
35
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O): O;
36
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P): P;
37
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q): Q;
38
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R_1 = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R_1): R_1;
39
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R_1 = never, S = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R_1, rs: (_: R_1) => S): S;
40
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R_1 = never, S = never, T = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R_1, rs: (_: R_1) => S, st: (_: S) => T): T;
41
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R_1 = never, S = never, T = never, U = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R_1, rs: (_: R_1) => S, st: (_: S) => T, tu: (_: T) => U): U;
42
- pipe<A, B = never, C = never, D = never, E_1 = never, F = never, G = never, H = never, I = never, J = never, K = never, L = never, M = never, N = never, O = never, P = never, Q = never, R_1 = never, S = never, T = never, U = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D, de: (_: D) => E_1, ef: (_: E_1) => F, fg: (_: F) => G, gh: (_: G) => H, hi: (_: H) => I, ij: (_: I) => J, jk: (_: J) => K, kl: (_: K) => L, lm: (_: L) => M, mn: (_: M) => N, no: (_: N) => O, op: (_: O) => P, pq: (_: P) => Q, qr: (_: Q) => R_1, rs: (_: R_1) => S, st: (_: S) => T, tu: (_: T) => U): U;
43
- name: string;
44
- options: import("foldkit-form").FormOptions<Readonly<Record<string, Schema.Top>>, {
45
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
46
- }, never, {}, Readonly<Record<string, Control<unknown>>>>;
47
- types: {
48
- readonly Name: string;
49
- readonly E: Entity<string, Readonly<Record<string, Schema.Top>>, {}, {}>;
50
- readonly Fields: Readonly<Record<string, Schema.Top>>;
51
- readonly Members: {
52
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
53
- };
54
- readonly R: never;
55
- readonly Nest: {};
56
- readonly Inputs: Readonly<Record<string, Control<unknown>>>;
57
- };
58
- bundle: import("foldkit-bundle").BundleShape<string, void, import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
59
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
60
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, {
61
- readonly _tag: "About";
62
- readonly subject: {
63
- readonly [x: string]: string;
64
- };
65
- } | {
66
- readonly _tag: "AskedForMore";
67
- readonly key: string;
68
- } | {
69
- readonly _tag: "Blurred";
70
- readonly key: string;
71
- } | {
72
- readonly _tag: "Changed";
73
- readonly key: string;
74
- readonly value: string | boolean | readonly string[];
75
- } | {
76
- readonly _tag: "Checked";
77
- readonly key: string;
78
- readonly draft: string | boolean | readonly string[];
79
- readonly error: string | null;
80
- } | {
81
- readonly _tag: "Control";
82
- readonly key: never;
83
- readonly message: unknown;
84
- } | {
85
- readonly _tag: "FollowedIssue";
86
- readonly id: string;
87
- } | {
88
- readonly _tag: "Nested";
89
- readonly key: string;
90
- readonly row: string;
91
- readonly message: unknown;
92
- } | {
93
- readonly _tag: "Refused";
94
- readonly key: string;
95
- readonly error: string;
96
- } | {
97
- readonly _tag: "Reset";
98
- } | {
99
- readonly _tag: "RowAdded";
100
- readonly key: string;
101
- } | {
102
- readonly _tag: "RowRemoved";
103
- readonly key: string;
104
- readonly row: string;
105
- } | {
106
- readonly _tag: "Searched";
107
- readonly key: string;
108
- readonly text: string;
109
- } | {
110
- readonly _tag: "Submitted";
111
- } | {
112
- readonly _tag: "Toggled";
113
- readonly key: string;
114
- readonly choice?: string | undefined;
115
- } | {
116
- readonly _tag: "ValidatedAll";
117
- }, import("foldkit-form").Submitted<{
118
- readonly [x: string]: unknown;
119
- }>, never, never, void, {}, {
120
- fill: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
121
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
122
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, values: Partial<{
123
- readonly [x: string]: unknown;
124
- }>) => {
125
- readonly model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
126
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
127
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
128
- };
129
- }>;
130
- Message: import("foldkit/message").MessageUnion<{
131
- Changed: {
132
- key: Schema.Literals<readonly [string, ...string[]]>;
133
- value: Schema.Union<readonly [Schema.String, Schema.Boolean, Schema.$Array<Schema.String>]>;
134
- };
135
- Blurred: {
136
- key: Schema.Literals<readonly [string, ...string[]]>;
137
- };
138
- ValidatedAll: {};
139
- Submitted: {};
140
- Reset: {};
141
- Checked: {
142
- key: Schema.Literals<readonly [string, ...string[]]>;
143
- draft: Schema.Union<readonly [Schema.String, Schema.Boolean, Schema.$Array<Schema.String>]>;
144
- error: Schema.NullOr<Schema.String>;
145
- };
146
- Refused: {
147
- key: Schema.Literals<readonly [string, ...string[]]>;
148
- error: Schema.String;
149
- };
150
- About: {
151
- subject: Schema.$Record<Schema.String, Schema.String>;
152
- };
153
- Searched: {
154
- key: Schema.Literals<readonly [string, ...string[]]>;
155
- text: Schema.String;
156
- };
157
- Toggled: {
158
- key: Schema.Literals<readonly [string, ...string[]]>;
159
- choice: Schema.optional<Schema.String>;
160
- };
161
- Nested: {
162
- key: Schema.String;
163
- row: Schema.String;
164
- message: Schema.Unknown;
165
- };
166
- Control: {
167
- key: Schema.Literals<readonly [never, ...never[]]>;
168
- message: Schema.Unknown;
169
- };
170
- RowAdded: {
171
- key: Schema.String;
172
- };
173
- RowRemoved: {
174
- key: Schema.String;
175
- row: Schema.String;
176
- };
177
- FollowedIssue: {
178
- id: Schema.String;
179
- };
180
- AskedForMore: {
181
- key: Schema.Literals<readonly [string, ...string[]]>;
182
- };
183
- }>;
184
- Check: import("foldkit/command").CommandDefinitionWithArgs<`${string}.check`, {
185
- key: Schema.Literals<readonly [string, ...string[]]>;
186
- draft: Schema.Union<readonly [Schema.String, Schema.Boolean, Schema.$Array<Schema.String>]>;
187
- values: Schema.Unknown;
188
- subject: Schema.$Record<Schema.String, Schema.String>;
189
- }, import("effect/Effect").Effect<{
190
- readonly _tag: "Checked";
191
- readonly key: string;
192
- readonly draft: string | boolean | readonly string[];
193
- readonly error: string | null;
194
- }, never, never>>;
195
- input: import("foldkit-entity").EntityInput<Entity<string, Readonly<Record<string, Schema.Top>>, {}, {}>, Readonly<Record<string, Schema.Top>>, {
196
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
197
- }>;
198
- authoredChanged: (before: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
199
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
200
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, after: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
201
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
202
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => boolean;
203
- fill: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
204
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
205
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, values: Partial<{
206
- readonly [x: string]: unknown;
207
- }>) => {
208
- readonly model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
209
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
210
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
211
- };
212
- initial: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
213
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
214
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
215
- controls: import("foldkit-form").FormControl<string>[];
216
- field: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
217
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
218
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, key: string) => import("foldkit/fieldValidation").Field<import("foldkit-form").Draft>;
219
- control: <K extends keyof import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>> & Exclude<string & string, import("foldkit-form").NestedKey<{
220
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
221
- }>>>(key: K) => {
222
- readonly field: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
223
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
224
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => import("foldkit/fieldValidation").Field<string>;
225
- readonly send: (message: never) => {
226
- readonly _tag: "About";
227
- readonly subject: {
228
- readonly [x: string]: string;
229
- };
230
- } | {
231
- readonly _tag: "AskedForMore";
232
- readonly key: string;
233
- } | {
234
- readonly _tag: "Blurred";
235
- readonly key: string;
236
- } | {
237
- readonly _tag: "Changed";
238
- readonly key: string;
239
- readonly value: string | boolean | readonly string[];
240
- } | {
241
- readonly _tag: "Checked";
242
- readonly key: string;
243
- readonly draft: string | boolean | readonly string[];
244
- readonly error: string | null;
245
- } | {
246
- readonly _tag: "Control";
247
- readonly key: never;
248
- readonly message: unknown;
249
- } | {
250
- readonly _tag: "FollowedIssue";
251
- readonly id: string;
252
- } | {
253
- readonly _tag: "Nested";
254
- readonly key: string;
255
- readonly row: string;
256
- readonly message: unknown;
257
- } | {
258
- readonly _tag: "Refused";
259
- readonly key: string;
260
- readonly error: string;
261
- } | {
262
- readonly _tag: "Reset";
263
- } | {
264
- readonly _tag: "RowAdded";
265
- readonly key: string;
266
- } | {
267
- readonly _tag: "RowRemoved";
268
- readonly key: string;
269
- readonly row: string;
270
- } | {
271
- readonly _tag: "Searched";
272
- readonly key: string;
273
- readonly text: string;
274
- } | {
275
- readonly _tag: "Submitted";
276
- } | {
277
- readonly _tag: "Toggled";
278
- readonly key: string;
279
- readonly choice?: string | undefined;
280
- } | {
281
- readonly _tag: "ValidatedAll";
282
- };
283
- };
284
- search: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
285
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
286
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, key: string) => string;
287
- subject: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
288
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
289
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => Readonly<Record<string, string>>;
290
- nested: {};
291
- row: <K extends Extract<string & string, import("foldkit-form").NestedKey<{
292
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
293
- }>>>(key: K, row: string) => import("foldkit-form").RowHandle<K extends never ? NonNullable<{}[K]> : import("foldkit-form").NestedForm, {
294
- readonly _tag: "About";
295
- readonly subject: {
296
- readonly [x: string]: string;
297
- };
298
- } | {
299
- readonly _tag: "AskedForMore";
300
- readonly key: string;
301
- } | {
302
- readonly _tag: "Blurred";
303
- readonly key: string;
304
- } | {
305
- readonly _tag: "Changed";
306
- readonly key: string;
307
- readonly value: string | boolean | readonly string[];
308
- } | {
309
- readonly _tag: "Checked";
310
- readonly key: string;
311
- readonly draft: string | boolean | readonly string[];
312
- readonly error: string | null;
313
- } | {
314
- readonly _tag: "Control";
315
- readonly key: never;
316
- readonly message: unknown;
317
- } | {
318
- readonly _tag: "FollowedIssue";
319
- readonly id: string;
320
- } | {
321
- readonly _tag: "Nested";
322
- readonly key: string;
323
- readonly row: string;
324
- readonly message: unknown;
325
- } | {
326
- readonly _tag: "Refused";
327
- readonly key: string;
328
- readonly error: string;
329
- } | {
330
- readonly _tag: "Reset";
331
- } | {
332
- readonly _tag: "RowAdded";
333
- readonly key: string;
334
- } | {
335
- readonly _tag: "RowRemoved";
336
- readonly key: string;
337
- readonly row: string;
338
- } | {
339
- readonly _tag: "Searched";
340
- readonly key: string;
341
- readonly text: string;
342
- } | {
343
- readonly _tag: "Submitted";
344
- } | {
345
- readonly _tag: "Toggled";
346
- readonly key: string;
347
- readonly choice?: string | undefined;
348
- } | {
349
- readonly _tag: "ValidatedAll";
350
- }>;
351
- isFollowing: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
352
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
353
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, key: string) => boolean;
354
- rows: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
355
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
356
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, key: never) => never;
357
- canSubmit: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
358
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
359
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => boolean;
360
- isValid: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
361
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
362
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => boolean;
363
- value: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
364
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
365
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => Option.Option<{
366
- readonly [x: string]: unknown;
367
- }>;
368
- settled: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
369
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
370
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
371
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
372
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
373
- partial: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
374
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
375
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => Partial<{
376
- readonly [x: string]: unknown;
377
- }>;
378
- engine: {
379
- submit: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
380
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
381
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => {
382
- model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
383
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
384
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
385
- commands: readonly Readonly<{
386
- name: string;
387
- args?: Record<string, unknown>;
388
- key?: string;
389
- effect: import("effect/Effect").Effect<{
390
- readonly _tag: "About";
391
- readonly subject: {
392
- readonly [x: string]: string;
393
- };
394
- } | {
395
- readonly _tag: "AskedForMore";
396
- readonly key: string;
397
- } | {
398
- readonly _tag: "Blurred";
399
- readonly key: string;
400
- } | {
401
- readonly _tag: "Changed";
402
- readonly key: string;
403
- readonly value: string | boolean | readonly string[];
404
- } | {
405
- readonly _tag: "Checked";
406
- readonly key: string;
407
- readonly draft: string | boolean | readonly string[];
408
- readonly error: string | null;
409
- } | {
410
- readonly _tag: "Control";
411
- readonly key: never;
412
- readonly message: unknown;
413
- } | {
414
- readonly _tag: "FollowedIssue";
415
- readonly id: string;
416
- } | {
417
- readonly _tag: "Nested";
418
- readonly key: string;
419
- readonly row: string;
420
- readonly message: unknown;
421
- } | {
422
- readonly _tag: "Refused";
423
- readonly key: string;
424
- readonly error: string;
425
- } | {
426
- readonly _tag: "Reset";
427
- } | {
428
- readonly _tag: "RowAdded";
429
- readonly key: string;
430
- } | {
431
- readonly _tag: "RowRemoved";
432
- readonly key: string;
433
- readonly row: string;
434
- } | {
435
- readonly _tag: "Searched";
436
- readonly key: string;
437
- readonly text: string;
438
- } | {
439
- readonly _tag: "Submitted";
440
- } | {
441
- readonly _tag: "Toggled";
442
- readonly key: string;
443
- readonly choice?: string | undefined;
444
- } | {
445
- readonly _tag: "ValidatedAll";
446
- }, never, never>;
447
- }>[];
448
- };
449
- validateAll: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
450
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
451
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => {
452
- readonly model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
453
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
454
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
455
- readonly commands: readonly Readonly<{
456
- name: string;
457
- args?: Record<string, unknown>;
458
- key?: string;
459
- effect: import("effect/Effect").Effect<{
460
- readonly _tag: "About";
461
- readonly subject: {
462
- readonly [x: string]: string;
463
- };
464
- } | {
465
- readonly _tag: "AskedForMore";
466
- readonly key: string;
467
- } | {
468
- readonly _tag: "Blurred";
469
- readonly key: string;
470
- } | {
471
- readonly _tag: "Changed";
472
- readonly key: string;
473
- readonly value: string | boolean | readonly string[];
474
- } | {
475
- readonly _tag: "Checked";
476
- readonly key: string;
477
- readonly draft: string | boolean | readonly string[];
478
- readonly error: string | null;
479
- } | {
480
- readonly _tag: "Control";
481
- readonly key: never;
482
- readonly message: unknown;
483
- } | {
484
- readonly _tag: "FollowedIssue";
485
- readonly id: string;
486
- } | {
487
- readonly _tag: "Nested";
488
- readonly key: string;
489
- readonly row: string;
490
- readonly message: unknown;
491
- } | {
492
- readonly _tag: "Refused";
493
- readonly key: string;
494
- readonly error: string;
495
- } | {
496
- readonly _tag: "Reset";
497
- } | {
498
- readonly _tag: "RowAdded";
499
- readonly key: string;
500
- } | {
501
- readonly _tag: "RowRemoved";
502
- readonly key: string;
503
- readonly row: string;
504
- } | {
505
- readonly _tag: "Searched";
506
- readonly key: string;
507
- readonly text: string;
508
- } | {
509
- readonly _tag: "Submitted";
510
- } | {
511
- readonly _tag: "Toggled";
512
- readonly key: string;
513
- readonly choice?: string | undefined;
514
- } | {
515
- readonly _tag: "ValidatedAll";
516
- }, never, never>;
517
- }>[];
518
- };
519
- isValidating: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
520
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
521
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => boolean;
522
- authoredChanged: (before: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
523
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
524
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>, after: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
525
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
526
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => boolean;
527
- value: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
528
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
529
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>) => {
530
- readonly [x: string]: unknown;
531
- } | undefined;
532
- };
533
- };
534
- /** Every key the form's Schema names, edited or shown. */
535
- keys: string[];
536
- /** The props the form does not edit, labelled as its fields are, and as stored: shown, not changed. */
537
- shown: (stored: Readonly<Record<string, unknown>>) => ReadonlyArray<{
538
- readonly key: string;
539
- readonly label: string;
540
- readonly value: unknown;
541
- }>;
542
- /**
543
- * `model` with the fields `keep` spares filled from a node's stored props.
544
- * A stored prop that does not decode is shown as it is, with its error.
545
- */
546
- fill: (model: import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
547
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
548
- }, 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>>, {
549
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
550
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>;
551
- /** The form's Model as the Builder's Model holds it: JSON. */
552
- encode: (model: 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>>>>>) => Schema.Json;
555
- /** A held form Model read back; none if it no longer fits, which a refill then replaces. */
556
- decode: (held: Schema.Json) => Option.Option<import("foldkit-form").FormModel<Readonly<Record<string, Schema.Top>>, {
557
- readonly [x: string]: import("foldkit-entity").EntityField<string, string, Schema.Top>;
558
- }, import("foldkit-form").ControlsOf<Readonly<Record<string, Control<unknown>>>>>>;
559
- encodeMessage: (message: {
560
- readonly _tag: "About";
561
- readonly subject: {
562
- readonly [x: string]: string;
563
- };
564
- } | {
565
- readonly _tag: "AskedForMore";
566
- readonly key: string;
567
- } | {
568
- readonly _tag: "Blurred";
569
- readonly key: string;
570
- } | {
571
- readonly _tag: "Changed";
572
- readonly key: string;
573
- readonly value: string | boolean | readonly string[];
574
- } | {
575
- readonly _tag: "Checked";
576
- readonly key: string;
577
- readonly draft: string | boolean | readonly string[];
578
- readonly error: string | null;
579
- } | {
580
- readonly _tag: "Control";
581
- readonly key: never;
582
- readonly message: unknown;
583
- } | {
584
- readonly _tag: "FollowedIssue";
585
- readonly id: string;
586
- } | {
587
- readonly _tag: "Nested";
588
- readonly key: string;
589
- readonly row: string;
590
- readonly message: unknown;
591
- } | {
592
- readonly _tag: "Refused";
593
- readonly key: string;
594
- readonly error: string;
595
- } | {
596
- readonly _tag: "Reset";
597
- } | {
598
- readonly _tag: "RowAdded";
599
- readonly key: string;
600
- } | {
601
- readonly _tag: "RowRemoved";
602
- readonly key: string;
603
- readonly row: string;
604
- } | {
605
- readonly _tag: "Searched";
606
- readonly key: string;
607
- readonly text: string;
608
- } | {
609
- readonly _tag: "Submitted";
610
- } | {
611
- readonly _tag: "Toggled";
612
- readonly key: string;
613
- readonly choice?: string | undefined;
614
- } | {
615
- readonly _tag: "ValidatedAll";
616
- }) => Schema.Json;
617
- decodeMessage: (held: Schema.Json) => Option.Option<{
618
- readonly _tag: "About";
619
- readonly subject: {
620
- readonly [x: string]: string;
621
- };
622
- } | {
623
- readonly _tag: "AskedForMore";
624
- readonly key: string;
625
- } | {
626
- readonly _tag: "Blurred";
627
- readonly key: string;
628
- } | {
629
- readonly _tag: "Changed";
630
- readonly key: string;
631
- readonly value: string | boolean | readonly string[];
632
- } | {
633
- readonly _tag: "Checked";
634
- readonly key: string;
635
- readonly draft: string | boolean | readonly string[];
636
- readonly error: string | null;
637
- } | {
638
- readonly _tag: "Control";
639
- readonly key: never;
640
- readonly message: unknown;
641
- } | {
642
- readonly _tag: "FollowedIssue";
643
- readonly id: string;
644
- } | {
645
- readonly _tag: "Nested";
646
- readonly key: string;
647
- readonly row: string;
648
- readonly message: unknown;
649
- } | {
650
- readonly _tag: "Refused";
651
- readonly key: string;
652
- readonly error: string;
653
- } | {
654
- readonly _tag: "Reset";
655
- } | {
656
- readonly _tag: "RowAdded";
657
- readonly key: string;
658
- } | {
659
- readonly _tag: "RowRemoved";
660
- readonly key: string;
661
- readonly row: string;
662
- } | {
663
- readonly _tag: "Searched";
664
- readonly key: string;
665
- readonly text: string;
666
- } | {
667
- readonly _tag: "Submitted";
668
- } | {
669
- readonly _tag: "Toggled";
670
- readonly key: string;
671
- readonly choice?: string | undefined;
672
- } | {
673
- readonly _tag: "ValidatedAll";
674
- }>;
675
- /**
676
- * A Message of the Bundle behind `key`'s control (an `Input.bundle`), as the
677
- * form's own. Built from runtime fields, the form's type names no such key,
678
- * so it is checked here: a key not edited by one throws.
679
- */
680
- control: (key: string, message: unknown) => {
681
- readonly _tag: "About";
682
- readonly subject: {
683
- readonly [x: string]: string;
684
- };
685
- } | {
686
- readonly _tag: "AskedForMore";
687
- readonly key: string;
688
- } | {
689
- readonly _tag: "Blurred";
690
- readonly key: string;
691
- } | {
692
- readonly _tag: "Changed";
693
- readonly key: string;
694
- readonly value: string | boolean | readonly string[];
695
- } | {
696
- readonly _tag: "Checked";
697
- readonly key: string;
698
- readonly draft: string | boolean | readonly string[];
699
- readonly error: string | null;
700
- } | {
701
- readonly _tag: "Control";
702
- readonly key: never;
703
- readonly message: unknown;
704
- } | {
705
- readonly _tag: "FollowedIssue";
706
- readonly id: string;
707
- } | {
708
- readonly _tag: "Nested";
709
- readonly key: string;
710
- readonly row: string;
711
- readonly message: unknown;
712
- } | {
713
- readonly _tag: "Refused";
714
- readonly key: string;
715
- readonly error: string;
716
- } | {
717
- readonly _tag: "Reset";
718
- } | {
719
- readonly _tag: "RowAdded";
720
- readonly key: string;
721
- } | {
722
- readonly _tag: "RowRemoved";
723
- readonly key: string;
724
- readonly row: string;
725
- } | {
726
- readonly _tag: "Searched";
727
- readonly key: string;
728
- readonly text: string;
729
- } | {
730
- readonly _tag: "Submitted";
731
- } | {
732
- readonly _tag: "Toggled";
733
- readonly key: string;
734
- readonly choice?: string | undefined;
735
- } | {
736
- readonly _tag: "ValidatedAll";
737
- };
738
- /**
739
- * What a new value starts from, as the Document stores it: each field's
740
- * empty value where it decodes (`''`, `null`, `false`), else a number's
741
- * zero or a select's first choice; a field with neither is left out. It is
742
- * not checked: a zero a number's check refuses, or a field left out, makes
743
- * a value the Document refuses when it is set.
744
- */
745
- seed: () => Readonly<Record<string, Schema.Json>>;
746
- /** A value from the form, as the Document stores it; none for a prop the form does not edit. */
747
- stored: (key: string, value: unknown) => Option.Option<Schema.Json>;
748
- };
749
- /** A form over a node's values and the codecs the Builder holds it with. */
750
- type Settings = ReturnType<typeof make>;
751
- /** A Block's props as a form, made at the first use and kept: one per Block. */
752
- export declare const settingsOf: (block: AnyBlock) => Settings;
753
- /**
754
- * The input an event of a Block runs an action with, as a form, made at the
755
- * first use and kept. One per Block, event and action, so two events of one
756
- * node that run the same action draw their fields under ids of their own.
757
- */
758
- export declare const inputOf: (block: AnyBlock, event: string, action: CatalogAction) => Settings;
759
- /** The control a prop is drawn with: the Block's hint, else what its Schema says. */
760
- export declare const controlOf: (block: AnyBlock, key: string, schema: Schema.Top) => Control | undefined;
761
- /**
762
- * The Builder's own words: what it says to assistive technology of each edit,
763
- * its commands' labels, and the refusals it makes itself. Words are text; a
764
- * word that takes a value names it as a blank (`'Moved {label}{at}'`), as a
765
- * form's and a view's words do, so one object can hold them all. A Block is
766
- * named by its label (`Block.words`), the Catalog's word.
767
- */
768
- interface EditWords {
769
- /** Where a node is after an edit, after its name: ", 2 of 3 in Section body". Blanks `{position}`, `{count}`, `{container}`. */
770
- readonly at: string;
771
- /** The container of a root. */
772
- readonly thePage: string;
773
- /** The container of a node in a Region: the holder's `{label}` and the `{region}`. */
774
- readonly inRegion: string;
775
- /** An edit, said: its node's `{label}` and where it is now, `{at}`. */
776
- readonly moved: string;
777
- readonly added: string;
778
- readonly duplicated: string;
779
- /** A removal, said: the node's `{label}`. */
780
- readonly removed: string;
781
- readonly editedPage: string;
782
- readonly undone: string;
783
- readonly redone: string;
784
- /** A drag that ended with nothing done: a node, or a new one from the palette. */
785
- readonly notMoved: string;
786
- readonly notAdded: string;
787
- /** A copy and a cut, said: the node's `{label}`. */
788
- readonly copied: string;
789
- readonly cut: string;
790
- /** The refusals the Builder makes itself: nothing to paste, as nothing copied or not a page. */
791
- readonly nothingCopied: string;
792
- readonly notAPage: string;
793
- /** A Block that cannot be inserted: `{block}`. */
794
- readonly noStartingProps: string;
795
- readonly startingPropsFail: string;
796
- /** A node the page does not hold, or one changed while its copy was made: `{id}`. */
797
- readonly notANode: string;
798
- readonly copyChanged: string;
799
- /** A pattern the Catalog lacks: `{name}`. */
800
- readonly unknownPattern: string;
801
- /** A paste the page has no place for: its root's Block, `{label}`. */
802
- readonly noPlace: string;
803
- /** A refusal `apply` made: blanks `{code}` and `{message}`, by default its own message. */
804
- readonly refusal: string;
805
- /** The commands' labels. */
806
- readonly moveUp: string;
807
- readonly moveDown: string;
808
- readonly moveOut: string;
809
- readonly moveIn: string;
810
- readonly duplicate: string;
811
- readonly copy: string;
812
- readonly cutCommand: string;
813
- readonly delete: string;
814
- readonly undo: string;
815
- readonly redo: string;
816
- readonly paste: string;
817
- readonly editText: string;
818
- readonly deselect: string;
819
- }
820
- export declare const editWords: EditWords;
821
10
  export declare const Panel: Schema.Literals<readonly ["insert", "layers", "properties"]>;
822
11
  export declare const Viewport: Schema.Literals<readonly ["wide", "medium", "narrow"]>;
823
12
  /** The layers panel's keyboard focus and which rows are open: a tree that starts open. */
@@ -1072,8 +261,8 @@ export type Model = typeof Model.Type;
1072
261
  export interface InspectedForm {
1073
262
  /** Which it is, as `Inspected` names it: `props`, or `on:<event>:<action>`. */
1074
263
  readonly key: string;
1075
- readonly settings: Settings;
1076
- readonly model: Settings['form']['initial'];
264
+ readonly settings: Settings$1;
265
+ readonly model: Settings$1['form']['initial'];
1077
266
  }
1078
267
  /** The selected node as the inspector edits it: its Block and its forms. */
1079
268
  export interface Inspecting {
@@ -1378,7 +567,7 @@ export declare const Builder: {
1378
567
  */
1379
568
  readonly commands?: (built: ReadonlyArray<BuilderCommand>) => ReadonlyArray<BuilderCommand>;
1380
569
  /** What it says of each edit, its commands' labels and its refusals, over the English ones. */
1381
- readonly words?: Partial<EditWords>;
570
+ readonly words?: Partial<EditWords$1>;
1382
571
  }) => {
1383
572
  name: Name;
1384
573
  catalog: Catalog<Blocks, unknown>;
@@ -2721,5 +1910,5 @@ export declare const Builder: {
2721
1910
  document: typeof documentOf;
2722
1911
  };
2723
1912
  };
2724
- export type { EditWords, Settings };
2725
- //# sourceMappingURL=index.d.mts.map
1913
+ export { type EditWords, type Settings, controlOf, editWords, inputOf, settingsOf };
1914
+ //# sourceMappingURL=index.d.ts.map