foldkit-form 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -3
- package/dist/index.d.mts +225 -12
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +184 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -91,7 +91,13 @@ const RenameForm = Page.children.rename
|
|
|
91
91
|
never dropped by omission.
|
|
92
92
|
- `Rename.Message` builds the form's Messages for your view to dispatch:
|
|
93
93
|
`Changed({ key, value })`, `Blurred({ key })`, `Submitted()`, `Reset()`,
|
|
94
|
-
and `ValidatedAll()` (see [Validation](#validation)).
|
|
94
|
+
and `ValidatedAll()` (see [Validation](#validation)). `Toggled({ key })`
|
|
95
|
+
flips a flag and `Toggled({ key, choice })` lets go of or adds one choice of a
|
|
96
|
+
list, both to the draft as it stands when the Message lands, so a view sends
|
|
97
|
+
them for a press: two presses before the next draw both count. `FollowedIssue({ id })`
|
|
98
|
+
says a view's link to a field was followed, and `AskedForMore({ key })` that a
|
|
99
|
+
relation picker's reader wants more choices; the form changes nothing for
|
|
100
|
+
either, and the page that owns the list answers the second.
|
|
95
101
|
- `Rename.controls` lists the keys in the input's order, each with its
|
|
96
102
|
`control`, `label`, `description`, `required`, and the Entity `member`.
|
|
97
103
|
- `Rename.field(model.rename, key)` reads one key's state as `Field<Draft>`, for
|
|
@@ -136,6 +142,7 @@ included.
|
|
|
136
142
|
| `Number` | `string` | the schema is a number |
|
|
137
143
|
| `Toggle` | `boolean` | the schema is a boolean |
|
|
138
144
|
| `Select` | `string` | the schema is a union of string or number literals; carries `options`, and gives the chosen option itself, so `3` is `3` |
|
|
145
|
+
| `Choices` | `string[]` | the schema is an array of string or number literals; carries `options`, and gives the options themselves, so `3` is `3` |
|
|
139
146
|
| `RelationOne` | `string` (an id, `""` for none) | the key is `Relation.input` of a `one` |
|
|
140
147
|
| `RelationMany` | `string[]` | the key is `Relation.input` of a `many` |
|
|
141
148
|
|
|
@@ -158,7 +165,8 @@ Form.make('Rename', Entity.input(Cms, RenameInput), { inputs: { id: Input.text()
|
|
|
158
165
|
|
|
159
166
|
A key that holds an id without being a relation asks for a picker with
|
|
160
167
|
`Input.relationOne(Author)` or `Input.relationMany(Tag)`, as the page Builder's
|
|
161
|
-
Block props do.
|
|
168
|
+
Block props do. A key the schema cannot spell — `Schema.Array(Schema.Number)` —
|
|
169
|
+
takes the choices it may hold from `Input.choices([1, 2])`.
|
|
162
170
|
|
|
163
171
|
### Your own kind of control
|
|
164
172
|
|
|
@@ -170,6 +178,9 @@ const Cents = Input.kind<{ readonly currency: string }>('Cents', {
|
|
|
170
178
|
draft: 'text', // what the Model holds while it is edited
|
|
171
179
|
// The value the schema is given, when that is not the text itself.
|
|
172
180
|
parse: draft => (/^\d+(\.\d{1,2})?$/.test(draft) ? Math.round(Number(draft) * 100) : undefined),
|
|
181
|
+
// The text a value is shown as when the form is filled with it, the inverse
|
|
182
|
+
// of `parse`. Without it, a filled value shows as `String(value)`.
|
|
183
|
+
format: (value, data) => (Number(value) / 100).toFixed(2),
|
|
173
184
|
unparsed: 'Enter an amount',
|
|
174
185
|
})
|
|
175
186
|
|
|
@@ -178,10 +189,20 @@ Form.make('Price', input, { inputs: { cents: Cents.of({ currency: 'USD' }) } })
|
|
|
178
189
|
Cents.is(control) && control.data.currency // 'USD'
|
|
179
190
|
```
|
|
180
191
|
|
|
181
|
-
- `draft` is `'text'`, `'flag'` (a boolean) or `'list'` (
|
|
192
|
+
- `draft` is `'text'`, `'flag'` (a boolean) or `'list'` (each chosen value as
|
|
193
|
+
text, as a group of checkboxes holds them).
|
|
182
194
|
- `parse` reads text as something else before the key's schema sees it, as
|
|
183
195
|
`Number` does; `undefined` means it does not read, and `unparsed` is what to
|
|
184
196
|
say. Text that is only spaces is nothing entered, not a failure to parse.
|
|
197
|
+
- `parseList` is the same for a `'list'` draft, given every chosen value as
|
|
198
|
+
text; `undefined` means one of them is not allowed.
|
|
199
|
+
- `format` is the other direction: the text a value is shown as when the form is
|
|
200
|
+
filled with it, so a stored `1234` reads as `'12.34'`. It is called by `fill`
|
|
201
|
+
only, never while someone types, so a caret and a composition are never
|
|
202
|
+
disturbed. A `format` that throws fails the fill, naming the key.
|
|
203
|
+
- A hook a draft can never reach is a type error, not a hook that is silently
|
|
204
|
+
never called: `parse` and `format` are a `'text'` draft's, `parseList` a
|
|
205
|
+
`'list'` draft's.
|
|
185
206
|
- `shown: false` makes a kind that is carried and not drawn, as `Hidden` is.
|
|
186
207
|
- Nothing else in the form treats a shipped kind differently. A view draws your
|
|
187
208
|
kind once it has a renderer for it; see
|
|
@@ -224,6 +245,15 @@ What the form does with it:
|
|
|
224
245
|
and `init` starts the control's init Commands.
|
|
225
246
|
- **`fill`, `partial`, `settled`, submit and `Reset`** all go through `value`,
|
|
226
247
|
`fill` and `settled`. `Reset` returns the Bundle's initial Model.
|
|
248
|
+
- **Work the value waits on** (an upload, a lookup the Bundle runs) is `busy`:
|
|
249
|
+
`busy: model => model.sending`. A submit made while it is true waits, as it
|
|
250
|
+
waits for a check: the key reads `Validating` rather than missing, the
|
|
251
|
+
submit goes out when the work lands with a value, and when the work ends
|
|
252
|
+
without one the key is validated (a required key then says `Required`) and
|
|
253
|
+
nothing is submitted. A control in a row holds the submit the same way. Give
|
|
254
|
+
a busy control `settled` too, which says whether a stored value shown again
|
|
255
|
+
needs work: `Input.bundle` throws without it, since such a form would wait
|
|
256
|
+
for good.
|
|
227
257
|
- **Nothing entered** is `value` giving `undefined` or `null`, which a required
|
|
228
258
|
key refuses as it would an empty text box.
|
|
229
259
|
- **Types follow the control.** `model.fields.color.value` is the picker's
|
|
@@ -313,6 +343,15 @@ Entity's: the operation decides what is valid, and may be stricter.
|
|
|
313
343
|
input is decoded; a rule that spans keys fails there and lands in
|
|
314
344
|
`model.errors`, since it belongs to no one control. The next edit clears
|
|
315
345
|
them.
|
|
346
|
+
- **An invariant** of the Entity (`Entity.invariant`) is judged on submit over
|
|
347
|
+
the row the decoded value describes (`Entity.judgeInput`), as the server will
|
|
348
|
+
judge it: a row that breaks one does not go out, and its message shows beside
|
|
349
|
+
each key its path names, or in `model.errors` when the form sets none of
|
|
350
|
+
them. One reading a field the form does not set is not judged here; the
|
|
351
|
+
server decides it, and the form never calls the input valid on its account.
|
|
352
|
+
The same holds for one calling a primitive operator the form's table does
|
|
353
|
+
not run: give the table as `operators` (`Form.make(name, input, { operators
|
|
354
|
+
})`, `Operators.kernel` by default), and a nested form given none uses it.
|
|
316
355
|
- **`ValidatedAll`** checks every key a submit would, rows too, and submits
|
|
317
356
|
nothing: for a page that sends several forms at once. A rule that spans keys
|
|
318
357
|
is said only by a submit.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Duration, Effect, Option, Schema } from "effect";
|
|
2
2
|
import { Bundle } from "foldkit-bundle";
|
|
3
|
-
import { AnyEntity, Entity, EntityInput, InputMember, NestedInput } from "foldkit-entity";
|
|
3
|
+
import { AnyEntity, Entity, EntityInput, InputMember, MemoryOperators, NestedInput } from "foldkit-entity";
|
|
4
4
|
import { Metadata } from "foldkit-metadata";
|
|
5
5
|
import { Command } from "foldkit/command";
|
|
6
6
|
import * as FieldValidation from "foldkit/fieldValidation";
|
|
7
|
-
//#region src/input.d.ts
|
|
8
7
|
/**
|
|
9
8
|
* What a control holds while it is edited, which is not the value it submits: a
|
|
10
9
|
* number being typed is text, and an unchosen relation is the empty string.
|
|
@@ -36,6 +35,17 @@ interface Control<Data = unknown> {
|
|
|
36
35
|
* means the text does not read as one.
|
|
37
36
|
*/
|
|
38
37
|
parse?(draft: string, data: Data): unknown;
|
|
38
|
+
/**
|
|
39
|
+
* For a `list` draft: the value the key's schema is given, read with the
|
|
40
|
+
* control's `data` (a choice group's options). `undefined` means one of the
|
|
41
|
+
* chosen values is not one of them.
|
|
42
|
+
*/
|
|
43
|
+
parseList?(draft: ReadonlyArray<string>, data: Data): unknown;
|
|
44
|
+
/**
|
|
45
|
+
* For a `text` draft: the text a value is shown as when the form is filled
|
|
46
|
+
* with it, the inverse of `parse`. Default `String(value)`.
|
|
47
|
+
*/
|
|
48
|
+
format?(value: unknown, data: Data): string;
|
|
39
49
|
/** What to say when `parse` gives `undefined`. */
|
|
40
50
|
readonly unparsed?: string | undefined;
|
|
41
51
|
/**
|
|
@@ -89,20 +99,48 @@ interface NestedForm {
|
|
|
89
99
|
readonly Control: (payload: never) => unknown;
|
|
90
100
|
readonly Blurred: (payload: never) => unknown;
|
|
91
101
|
readonly Searched: (payload: never) => unknown;
|
|
102
|
+
readonly Toggled: (payload: never) => unknown;
|
|
92
103
|
readonly Nested: (payload: never) => unknown;
|
|
93
104
|
readonly RowAdded: (payload: never) => unknown;
|
|
94
105
|
readonly RowRemoved: (payload: never) => unknown;
|
|
95
106
|
};
|
|
96
107
|
}
|
|
97
|
-
/**
|
|
98
|
-
|
|
99
|
-
|
|
108
|
+
/**
|
|
109
|
+
* What every kind's spec says, whatever its draft holds. The draft decides which
|
|
110
|
+
* hooks a spec may carry, so a hook that draft can never reach is a type error
|
|
111
|
+
* rather than a hook that is silently never called.
|
|
112
|
+
*/
|
|
113
|
+
interface ControlSpec<Data, Draft extends DraftKind> {
|
|
114
|
+
readonly draft: Draft;
|
|
100
115
|
readonly shown?: boolean;
|
|
101
116
|
readonly searches?: boolean | ((data: Data) => boolean);
|
|
102
|
-
/** The value a text draft stands for, given the control's data; `undefined` when it stands for none. */
|
|
103
|
-
readonly parse?: (draft: string, data: Data) => unknown;
|
|
104
117
|
readonly unparsed?: string;
|
|
105
|
-
}
|
|
118
|
+
}
|
|
119
|
+
/** A text draft: read by `parse`, shown by `format`. */
|
|
120
|
+
interface TextSpec<Data> extends ControlSpec<Data, 'text'> {
|
|
121
|
+
/** The value the text stands for, given the control's data; `undefined` when it stands for none. */
|
|
122
|
+
readonly parse?: (draft: string, data: Data) => unknown;
|
|
123
|
+
/** The text a value is shown as when the form is filled with it. */
|
|
124
|
+
readonly format?: (value: unknown, data: Data) => string;
|
|
125
|
+
readonly parseList?: never;
|
|
126
|
+
}
|
|
127
|
+
/** A list draft: each chosen value as text, read by `parseList`. */
|
|
128
|
+
interface ListSpec<Data> extends ControlSpec<Data, 'list'> {
|
|
129
|
+
/** The value the chosen values stand for, given the control's data; `undefined` when one is not allowed. */
|
|
130
|
+
readonly parseList?: (draft: ReadonlyArray<string>, data: Data) => unknown;
|
|
131
|
+
readonly parse?: never;
|
|
132
|
+
readonly format?: never;
|
|
133
|
+
}
|
|
134
|
+
/** A draft with nothing to read or show: a flag, rows, or a Bundle's Model. */
|
|
135
|
+
interface PlainSpec<Data> extends ControlSpec<Data, 'flag' | 'rows' | 'model'> {
|
|
136
|
+
readonly parse?: never;
|
|
137
|
+
readonly parseList?: never;
|
|
138
|
+
readonly format?: never;
|
|
139
|
+
}
|
|
140
|
+
/** What `Input.kind` takes. */
|
|
141
|
+
type Spec<Data> = TextSpec<Data> | ListSpec<Data> | PlainSpec<Data>;
|
|
142
|
+
/** A kind of control. The kinds below are made with it, and so is an application's. */
|
|
143
|
+
declare const kind: <Data = Record<string, never>>(name: string, spec: Spec<Data>) => ControlKind<Data>;
|
|
106
144
|
/**
|
|
107
145
|
* What a control backed by a Bundle carries: the Bundle, its args, and how the
|
|
108
146
|
* key's value is read from its Model and written into it.
|
|
@@ -116,6 +154,8 @@ interface BundleData<Model = any, Value = any> {
|
|
|
116
154
|
readonly fill: (model: Model, value: Value) => Model;
|
|
117
155
|
/** The Model with nothing in flight, for a stored form shown again. */
|
|
118
156
|
readonly settled: (model: Model) => Model;
|
|
157
|
+
/** Whether work the key's value waits on is in flight: a submit waits for it, as for a check. */
|
|
158
|
+
readonly busy: (model: Model) => boolean;
|
|
119
159
|
}
|
|
120
160
|
/**
|
|
121
161
|
* A control backed by a Bundle. Its draft is the Bundle's Model, its Messages
|
|
@@ -145,6 +185,14 @@ type BundleControlSpec<Args, Model, Message extends {
|
|
|
145
185
|
readonly fill: (model: Model, value: Value) => Model;
|
|
146
186
|
/** The Model with nothing in flight, for a stored form shown again. Default: as it is. */
|
|
147
187
|
readonly settled?: (model: Model) => Model;
|
|
188
|
+
/**
|
|
189
|
+
* Whether work the key's value waits on is in flight, such as an upload. A
|
|
190
|
+
* submit made meanwhile waits, as it waits for a check, and goes when the work
|
|
191
|
+
* lands or ends. Default: never. Give `settled` beside it: a stored form shown
|
|
192
|
+
* again has no work in flight, and one left busy would hold every submit back,
|
|
193
|
+
* so `Input.bundle` refuses `busy` without it.
|
|
194
|
+
*/
|
|
195
|
+
readonly busy?: (model: Model) => boolean;
|
|
148
196
|
} & ([Args] extends [void] ? {
|
|
149
197
|
readonly args?: undefined;
|
|
150
198
|
} : {
|
|
@@ -177,6 +225,9 @@ export declare const Input: {
|
|
|
177
225
|
Select: ControlKind<{
|
|
178
226
|
readonly options: ReadonlyArray<string | number>;
|
|
179
227
|
}>;
|
|
228
|
+
Choices: ControlKind<{
|
|
229
|
+
readonly options: ReadonlyArray<string | number>;
|
|
230
|
+
}>;
|
|
180
231
|
RelationOne: ControlKind<RelationData>;
|
|
181
232
|
RelationMany: ControlKind<RelationData>;
|
|
182
233
|
Nested: ControlKind<NestedData>;
|
|
@@ -200,6 +251,12 @@ export declare const Input: {
|
|
|
200
251
|
number: () => Control;
|
|
201
252
|
toggle: () => Control;
|
|
202
253
|
select: (options: ReadonlyArray<string | number>) => Control;
|
|
254
|
+
/**
|
|
255
|
+
* Any number of a fixed set, text or numbers. A key typed
|
|
256
|
+
* `Schema.Array(Schema.Literals([...]))` resolves to one without asking; name
|
|
257
|
+
* it here for a set the schema cannot spell.
|
|
258
|
+
*/
|
|
259
|
+
choices: (options: ReadonlyArray<string | number>) => Control;
|
|
203
260
|
/**
|
|
204
261
|
* A picker of one of `target`, for a value that is not a relation of the
|
|
205
262
|
* form's Entity: a page Builder's Block prop that holds an id. A relation key
|
|
@@ -235,8 +292,6 @@ export declare const Input: {
|
|
|
235
292
|
*/
|
|
236
293
|
resolve: (member: InputMember, schema: Schema.Top) => Control | undefined;
|
|
237
294
|
};
|
|
238
|
-
//#endregion
|
|
239
|
-
//#region src/index.d.ts
|
|
240
295
|
/** The draft a key holds, as far as the input's type says: a flag, a list of ids, or text. */
|
|
241
296
|
export type DraftOf<Value> = [Exclude<Value, null | undefined>] extends [boolean] ? boolean : [Exclude<Value, null | undefined>] extends [ReadonlyArray<unknown>] ? ReadonlyArray<string> : string;
|
|
242
297
|
/** The keys of an input that hold a nested input (`Relation.nested`): rows of a form, not a draft. */
|
|
@@ -384,7 +439,7 @@ export interface FormFor<Fields extends Schema.Struct.Fields, Members, R = never
|
|
|
384
439
|
/** The forms a form may be given for its nested keys: each one made from that key's nested input. */
|
|
385
440
|
export type NestedForms<Fields extends Schema.Struct.Fields, Members, R> = { readonly [K in NestedKey<Members> & keyof Fields]?: Members[K] extends NestedInput<any, EntityInput<any, infer NestedFields, infer NestedMembers>> ? NestedFields extends Schema.Struct.Fields ? FormFor<NestedFields, NestedMembers, R> : never : never; };
|
|
386
441
|
/** The constructors of a form's Messages that a row's handle offers, wrapped for the row. */
|
|
387
|
-
type RowConstructor = 'Changed' | 'Blurred' | 'ValidatedAll' | 'Searched' | 'Submitted' | 'Reset' | 'RowAdded' | 'RowRemoved';
|
|
442
|
+
type RowConstructor = 'Changed' | 'Blurred' | 'ValidatedAll' | 'Searched' | 'Toggled' | 'Submitted' | 'Reset' | 'RowAdded' | 'RowRemoved';
|
|
388
443
|
/**
|
|
389
444
|
* One row of a nested key, addressed: the nested form's own Message constructors,
|
|
390
445
|
* each giving the Message of the form the row is in. `send` wraps a Message
|
|
@@ -416,6 +471,13 @@ export interface FormOptions<Fields extends Schema.Struct.Fields, Members, R, Ne
|
|
|
416
471
|
* form's `messages` and `debounce`.
|
|
417
472
|
*/
|
|
418
473
|
readonly nested?: Nest;
|
|
474
|
+
/**
|
|
475
|
+
* How the Entity's invariants' primitive operators are run while the form
|
|
476
|
+
* judges them (`Operators`): the kernel's when not given. An invariant calling
|
|
477
|
+
* one this table lacks is left to the server, as one over a field the form
|
|
478
|
+
* does not set is. A nested form given none uses this.
|
|
479
|
+
*/
|
|
480
|
+
readonly operators?: MemoryOperators | undefined;
|
|
419
481
|
}
|
|
420
482
|
/**
|
|
421
483
|
* The checks a form may be given by key, with what they need left open. Effect's
|
|
@@ -481,6 +543,9 @@ declare const Core: {
|
|
|
481
543
|
readonly subject: {
|
|
482
544
|
readonly [x: string]: string;
|
|
483
545
|
};
|
|
546
|
+
} | {
|
|
547
|
+
readonly _tag: "AskedForMore";
|
|
548
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
484
549
|
} | {
|
|
485
550
|
readonly _tag: "Blurred";
|
|
486
551
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -497,6 +562,9 @@ declare const Core: {
|
|
|
497
562
|
readonly _tag: "Control";
|
|
498
563
|
readonly key: keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
499
564
|
readonly message: unknown;
|
|
565
|
+
} | {
|
|
566
|
+
readonly _tag: "FollowedIssue";
|
|
567
|
+
readonly id: string;
|
|
500
568
|
} | {
|
|
501
569
|
readonly _tag: "Nested";
|
|
502
570
|
readonly key: string;
|
|
@@ -521,6 +589,10 @@ declare const Core: {
|
|
|
521
589
|
readonly text: string;
|
|
522
590
|
} | {
|
|
523
591
|
readonly _tag: "Submitted";
|
|
592
|
+
} | {
|
|
593
|
+
readonly _tag: "Toggled";
|
|
594
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
595
|
+
readonly choice?: string | undefined;
|
|
524
596
|
} | {
|
|
525
597
|
readonly _tag: "ValidatedAll";
|
|
526
598
|
}, Submitted<Schema.Struct.View<Fields, "Type", Schema.Struct.TypeOptionalKeys<Fields>, Schema.Struct.TypeMutableKeys<Fields>>>, R, never, void, ControlResourcesOf<Inputs>, {
|
|
@@ -575,6 +647,16 @@ declare const Core: {
|
|
|
575
647
|
key: Schema.Literals<readonly [Exclude<keyof Fields & string, NestedKey<Members>>, ...Exclude<keyof Fields & string, NestedKey<Members>>[]]>;
|
|
576
648
|
text: Schema.String;
|
|
577
649
|
};
|
|
650
|
+
/**
|
|
651
|
+
* A press on a flag (no `choice`), or on one choice of a list: the key's
|
|
652
|
+
* draft as it stands now, flipped, or with `choice` let go if held and added
|
|
653
|
+
* if not. A view sends this rather than `Changed`, so two presses before the
|
|
654
|
+
* next draw both land.
|
|
655
|
+
*/
|
|
656
|
+
Toggled: {
|
|
657
|
+
key: Schema.Literals<readonly [Exclude<keyof Fields & string, NestedKey<Members>>, ...Exclude<keyof Fields & string, NestedKey<Members>>[]]>;
|
|
658
|
+
choice: Schema.optional<Schema.String>;
|
|
659
|
+
};
|
|
578
660
|
/** A Message of the nested form in one row of a nested key. One that row does not take is dropped. */
|
|
579
661
|
Nested: {
|
|
580
662
|
key: Schema.String;
|
|
@@ -599,6 +681,22 @@ declare const Core: {
|
|
|
599
681
|
key: Schema.String;
|
|
600
682
|
row: Schema.String;
|
|
601
683
|
};
|
|
684
|
+
/**
|
|
685
|
+
* A link to the field drawn with this id was followed, such as one in a
|
|
686
|
+
* view's list of fields to fix. The view moves focus there itself, in the
|
|
687
|
+
* press; the form changes nothing.
|
|
688
|
+
*/
|
|
689
|
+
FollowedIssue: {
|
|
690
|
+
id: Schema.String;
|
|
691
|
+
};
|
|
692
|
+
/**
|
|
693
|
+
* A relation picker's reader asked for more choices than the list shows. The
|
|
694
|
+
* list is the page's, so the page answers (`Crud.screen` does, given
|
|
695
|
+
* `Crud.options`); the form changes nothing.
|
|
696
|
+
*/
|
|
697
|
+
AskedForMore: {
|
|
698
|
+
key: Schema.Literals<readonly [Exclude<keyof Fields & string, NestedKey<Members>>, ...Exclude<keyof Fields & string, NestedKey<Members>>[]]>;
|
|
699
|
+
};
|
|
602
700
|
}>;
|
|
603
701
|
/** The Command a key's check runs as, for a test to resolve (`Command.resolve(form.Check, …)`). */
|
|
604
702
|
Check: import("foldkit/command").CommandDefinitionWithArgs<`${Name}.check`, {
|
|
@@ -642,6 +740,9 @@ declare const Core: {
|
|
|
642
740
|
readonly subject: {
|
|
643
741
|
readonly [x: string]: string;
|
|
644
742
|
};
|
|
743
|
+
} | {
|
|
744
|
+
readonly _tag: "AskedForMore";
|
|
745
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
645
746
|
} | {
|
|
646
747
|
readonly _tag: "Blurred";
|
|
647
748
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -658,6 +759,9 @@ declare const Core: {
|
|
|
658
759
|
readonly _tag: "Control";
|
|
659
760
|
readonly key: keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
660
761
|
readonly message: unknown;
|
|
762
|
+
} | {
|
|
763
|
+
readonly _tag: "FollowedIssue";
|
|
764
|
+
readonly id: string;
|
|
661
765
|
} | {
|
|
662
766
|
readonly _tag: "Nested";
|
|
663
767
|
readonly key: string;
|
|
@@ -682,6 +786,10 @@ declare const Core: {
|
|
|
682
786
|
readonly text: string;
|
|
683
787
|
} | {
|
|
684
788
|
readonly _tag: "Submitted";
|
|
789
|
+
} | {
|
|
790
|
+
readonly _tag: "Toggled";
|
|
791
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
792
|
+
readonly choice?: string | undefined;
|
|
685
793
|
} | {
|
|
686
794
|
readonly _tag: "ValidatedAll";
|
|
687
795
|
};
|
|
@@ -704,6 +812,9 @@ declare const Core: {
|
|
|
704
812
|
readonly subject: {
|
|
705
813
|
readonly [x: string]: string;
|
|
706
814
|
};
|
|
815
|
+
} | {
|
|
816
|
+
readonly _tag: "AskedForMore";
|
|
817
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
707
818
|
} | {
|
|
708
819
|
readonly _tag: "Blurred";
|
|
709
820
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -720,6 +831,9 @@ declare const Core: {
|
|
|
720
831
|
readonly _tag: "Control";
|
|
721
832
|
readonly key: keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
722
833
|
readonly message: unknown;
|
|
834
|
+
} | {
|
|
835
|
+
readonly _tag: "FollowedIssue";
|
|
836
|
+
readonly id: string;
|
|
723
837
|
} | {
|
|
724
838
|
readonly _tag: "Nested";
|
|
725
839
|
readonly key: string;
|
|
@@ -744,6 +858,10 @@ declare const Core: {
|
|
|
744
858
|
readonly text: string;
|
|
745
859
|
} | {
|
|
746
860
|
readonly _tag: "Submitted";
|
|
861
|
+
} | {
|
|
862
|
+
readonly _tag: "Toggled";
|
|
863
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
864
|
+
readonly choice?: string | undefined;
|
|
747
865
|
} | {
|
|
748
866
|
readonly _tag: "ValidatedAll";
|
|
749
867
|
}>;
|
|
@@ -798,6 +916,9 @@ declare const Core: {
|
|
|
798
916
|
readonly subject: {
|
|
799
917
|
readonly [x: string]: string;
|
|
800
918
|
};
|
|
919
|
+
} | {
|
|
920
|
+
readonly _tag: "AskedForMore";
|
|
921
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
801
922
|
} | {
|
|
802
923
|
readonly _tag: "Blurred";
|
|
803
924
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -814,6 +935,9 @@ declare const Core: {
|
|
|
814
935
|
readonly _tag: "Control";
|
|
815
936
|
readonly key: keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
816
937
|
readonly message: unknown;
|
|
938
|
+
} | {
|
|
939
|
+
readonly _tag: "FollowedIssue";
|
|
940
|
+
readonly id: string;
|
|
817
941
|
} | {
|
|
818
942
|
readonly _tag: "Nested";
|
|
819
943
|
readonly key: string;
|
|
@@ -838,6 +962,10 @@ declare const Core: {
|
|
|
838
962
|
readonly text: string;
|
|
839
963
|
} | {
|
|
840
964
|
readonly _tag: "Submitted";
|
|
965
|
+
} | {
|
|
966
|
+
readonly _tag: "Toggled";
|
|
967
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
968
|
+
readonly choice?: string | undefined;
|
|
841
969
|
} | {
|
|
842
970
|
readonly _tag: "ValidatedAll";
|
|
843
971
|
}, never, R>;
|
|
@@ -854,6 +982,9 @@ declare const Core: {
|
|
|
854
982
|
readonly subject: {
|
|
855
983
|
readonly [x: string]: string;
|
|
856
984
|
};
|
|
985
|
+
} | {
|
|
986
|
+
readonly _tag: "AskedForMore";
|
|
987
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
857
988
|
} | {
|
|
858
989
|
readonly _tag: "Blurred";
|
|
859
990
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -870,6 +1001,9 @@ declare const Core: {
|
|
|
870
1001
|
readonly _tag: "Control";
|
|
871
1002
|
readonly key: keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
872
1003
|
readonly message: unknown;
|
|
1004
|
+
} | {
|
|
1005
|
+
readonly _tag: "FollowedIssue";
|
|
1006
|
+
readonly id: string;
|
|
873
1007
|
} | {
|
|
874
1008
|
readonly _tag: "Nested";
|
|
875
1009
|
readonly key: string;
|
|
@@ -894,6 +1028,10 @@ declare const Core: {
|
|
|
894
1028
|
readonly text: string;
|
|
895
1029
|
} | {
|
|
896
1030
|
readonly _tag: "Submitted";
|
|
1031
|
+
} | {
|
|
1032
|
+
readonly _tag: "Toggled";
|
|
1033
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1034
|
+
readonly choice?: string | undefined;
|
|
897
1035
|
} | {
|
|
898
1036
|
readonly _tag: "ValidatedAll";
|
|
899
1037
|
}, never, R>;
|
|
@@ -994,6 +1132,9 @@ export declare const Form: {
|
|
|
994
1132
|
readonly subject: {
|
|
995
1133
|
readonly [x: string]: string;
|
|
996
1134
|
};
|
|
1135
|
+
} | {
|
|
1136
|
+
readonly _tag: "AskedForMore";
|
|
1137
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
997
1138
|
} | {
|
|
998
1139
|
readonly _tag: "Blurred";
|
|
999
1140
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -1010,6 +1151,9 @@ export declare const Form: {
|
|
|
1010
1151
|
readonly _tag: "Control";
|
|
1011
1152
|
readonly key: keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1012
1153
|
readonly message: unknown;
|
|
1154
|
+
} | {
|
|
1155
|
+
readonly _tag: "FollowedIssue";
|
|
1156
|
+
readonly id: string;
|
|
1013
1157
|
} | {
|
|
1014
1158
|
readonly _tag: "Nested";
|
|
1015
1159
|
readonly key: string;
|
|
@@ -1034,6 +1178,10 @@ export declare const Form: {
|
|
|
1034
1178
|
readonly text: string;
|
|
1035
1179
|
} | {
|
|
1036
1180
|
readonly _tag: "Submitted";
|
|
1181
|
+
} | {
|
|
1182
|
+
readonly _tag: "Toggled";
|
|
1183
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1184
|
+
readonly choice?: string | undefined;
|
|
1037
1185
|
} | {
|
|
1038
1186
|
readonly _tag: "ValidatedAll";
|
|
1039
1187
|
}, Submitted<Schema.Struct.View<Fields, "Type", Schema.Struct.TypeOptionalKeys<Fields>, Schema.Struct.TypeMutableKeys<Fields>>>, R, never, void, ControlResourcesOf<Inputs>, {
|
|
@@ -1088,6 +1236,16 @@ export declare const Form: {
|
|
|
1088
1236
|
key: Schema.Literals<readonly [Exclude<keyof Fields & string, NestedKey<Members>>, ...Exclude<keyof Fields & string, NestedKey<Members>>[]]>;
|
|
1089
1237
|
text: Schema.String;
|
|
1090
1238
|
};
|
|
1239
|
+
/**
|
|
1240
|
+
* A press on a flag (no `choice`), or on one choice of a list: the key's
|
|
1241
|
+
* draft as it stands now, flipped, or with `choice` let go if held and added
|
|
1242
|
+
* if not. A view sends this rather than `Changed`, so two presses before the
|
|
1243
|
+
* next draw both land.
|
|
1244
|
+
*/
|
|
1245
|
+
Toggled: {
|
|
1246
|
+
key: Schema.Literals<readonly [Exclude<keyof Fields & string, NestedKey<Members>>, ...Exclude<keyof Fields & string, NestedKey<Members>>[]]>;
|
|
1247
|
+
choice: Schema.optional<Schema.String>;
|
|
1248
|
+
};
|
|
1091
1249
|
/** A Message of the nested form in one row of a nested key. One that row does not take is dropped. */
|
|
1092
1250
|
Nested: {
|
|
1093
1251
|
key: Schema.String;
|
|
@@ -1112,6 +1270,22 @@ export declare const Form: {
|
|
|
1112
1270
|
key: Schema.String;
|
|
1113
1271
|
row: Schema.String;
|
|
1114
1272
|
};
|
|
1273
|
+
/**
|
|
1274
|
+
* A link to the field drawn with this id was followed, such as one in a
|
|
1275
|
+
* view's list of fields to fix. The view moves focus there itself, in the
|
|
1276
|
+
* press; the form changes nothing.
|
|
1277
|
+
*/
|
|
1278
|
+
FollowedIssue: {
|
|
1279
|
+
id: Schema.String;
|
|
1280
|
+
};
|
|
1281
|
+
/**
|
|
1282
|
+
* A relation picker's reader asked for more choices than the list shows. The
|
|
1283
|
+
* list is the page's, so the page answers (`Crud.screen` does, given
|
|
1284
|
+
* `Crud.options`); the form changes nothing.
|
|
1285
|
+
*/
|
|
1286
|
+
AskedForMore: {
|
|
1287
|
+
key: Schema.Literals<readonly [Exclude<keyof Fields & string, NestedKey<Members>>, ...Exclude<keyof Fields & string, NestedKey<Members>>[]]>;
|
|
1288
|
+
};
|
|
1115
1289
|
}>;
|
|
1116
1290
|
/** The Command a key's check runs as, for a test to resolve (`Command.resolve(form.Check, …)`). */
|
|
1117
1291
|
Check: import("foldkit/command").CommandDefinitionWithArgs<`${Name}.check`, {
|
|
@@ -1155,6 +1329,9 @@ export declare const Form: {
|
|
|
1155
1329
|
readonly subject: {
|
|
1156
1330
|
readonly [x: string]: string;
|
|
1157
1331
|
};
|
|
1332
|
+
} | {
|
|
1333
|
+
readonly _tag: "AskedForMore";
|
|
1334
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1158
1335
|
} | {
|
|
1159
1336
|
readonly _tag: "Blurred";
|
|
1160
1337
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -1171,6 +1348,9 @@ export declare const Form: {
|
|
|
1171
1348
|
readonly _tag: "Control";
|
|
1172
1349
|
readonly key: keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1173
1350
|
readonly message: unknown;
|
|
1351
|
+
} | {
|
|
1352
|
+
readonly _tag: "FollowedIssue";
|
|
1353
|
+
readonly id: string;
|
|
1174
1354
|
} | {
|
|
1175
1355
|
readonly _tag: "Nested";
|
|
1176
1356
|
readonly key: string;
|
|
@@ -1195,6 +1375,10 @@ export declare const Form: {
|
|
|
1195
1375
|
readonly text: string;
|
|
1196
1376
|
} | {
|
|
1197
1377
|
readonly _tag: "Submitted";
|
|
1378
|
+
} | {
|
|
1379
|
+
readonly _tag: "Toggled";
|
|
1380
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1381
|
+
readonly choice?: string | undefined;
|
|
1198
1382
|
} | {
|
|
1199
1383
|
readonly _tag: "ValidatedAll";
|
|
1200
1384
|
};
|
|
@@ -1217,6 +1401,9 @@ export declare const Form: {
|
|
|
1217
1401
|
readonly subject: {
|
|
1218
1402
|
readonly [x: string]: string;
|
|
1219
1403
|
};
|
|
1404
|
+
} | {
|
|
1405
|
+
readonly _tag: "AskedForMore";
|
|
1406
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1220
1407
|
} | {
|
|
1221
1408
|
readonly _tag: "Blurred";
|
|
1222
1409
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -1233,6 +1420,9 @@ export declare const Form: {
|
|
|
1233
1420
|
readonly _tag: "Control";
|
|
1234
1421
|
readonly key: keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1235
1422
|
readonly message: unknown;
|
|
1423
|
+
} | {
|
|
1424
|
+
readonly _tag: "FollowedIssue";
|
|
1425
|
+
readonly id: string;
|
|
1236
1426
|
} | {
|
|
1237
1427
|
readonly _tag: "Nested";
|
|
1238
1428
|
readonly key: string;
|
|
@@ -1257,6 +1447,10 @@ export declare const Form: {
|
|
|
1257
1447
|
readonly text: string;
|
|
1258
1448
|
} | {
|
|
1259
1449
|
readonly _tag: "Submitted";
|
|
1450
|
+
} | {
|
|
1451
|
+
readonly _tag: "Toggled";
|
|
1452
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1453
|
+
readonly choice?: string | undefined;
|
|
1260
1454
|
} | {
|
|
1261
1455
|
readonly _tag: "ValidatedAll";
|
|
1262
1456
|
}>;
|
|
@@ -1311,6 +1505,9 @@ export declare const Form: {
|
|
|
1311
1505
|
readonly subject: {
|
|
1312
1506
|
readonly [x: string]: string;
|
|
1313
1507
|
};
|
|
1508
|
+
} | {
|
|
1509
|
+
readonly _tag: "AskedForMore";
|
|
1510
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1314
1511
|
} | {
|
|
1315
1512
|
readonly _tag: "Blurred";
|
|
1316
1513
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -1327,6 +1524,9 @@ export declare const Form: {
|
|
|
1327
1524
|
readonly _tag: "Control";
|
|
1328
1525
|
readonly key: keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1329
1526
|
readonly message: unknown;
|
|
1527
|
+
} | {
|
|
1528
|
+
readonly _tag: "FollowedIssue";
|
|
1529
|
+
readonly id: string;
|
|
1330
1530
|
} | {
|
|
1331
1531
|
readonly _tag: "Nested";
|
|
1332
1532
|
readonly key: string;
|
|
@@ -1351,6 +1551,10 @@ export declare const Form: {
|
|
|
1351
1551
|
readonly text: string;
|
|
1352
1552
|
} | {
|
|
1353
1553
|
readonly _tag: "Submitted";
|
|
1554
|
+
} | {
|
|
1555
|
+
readonly _tag: "Toggled";
|
|
1556
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1557
|
+
readonly choice?: string | undefined;
|
|
1354
1558
|
} | {
|
|
1355
1559
|
readonly _tag: "ValidatedAll";
|
|
1356
1560
|
}, never, R>;
|
|
@@ -1367,6 +1571,9 @@ export declare const Form: {
|
|
|
1367
1571
|
readonly subject: {
|
|
1368
1572
|
readonly [x: string]: string;
|
|
1369
1573
|
};
|
|
1574
|
+
} | {
|
|
1575
|
+
readonly _tag: "AskedForMore";
|
|
1576
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1370
1577
|
} | {
|
|
1371
1578
|
readonly _tag: "Blurred";
|
|
1372
1579
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -1383,6 +1590,9 @@ export declare const Form: {
|
|
|
1383
1590
|
readonly _tag: "Control";
|
|
1384
1591
|
readonly key: keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1385
1592
|
readonly message: unknown;
|
|
1593
|
+
} | {
|
|
1594
|
+
readonly _tag: "FollowedIssue";
|
|
1595
|
+
readonly id: string;
|
|
1386
1596
|
} | {
|
|
1387
1597
|
readonly _tag: "Nested";
|
|
1388
1598
|
readonly key: string;
|
|
@@ -1407,6 +1617,10 @@ export declare const Form: {
|
|
|
1407
1617
|
readonly text: string;
|
|
1408
1618
|
} | {
|
|
1409
1619
|
readonly _tag: "Submitted";
|
|
1620
|
+
} | {
|
|
1621
|
+
readonly _tag: "Toggled";
|
|
1622
|
+
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
1623
|
+
readonly choice?: string | undefined;
|
|
1410
1624
|
} | {
|
|
1411
1625
|
readonly _tag: "ValidatedAll";
|
|
1412
1626
|
}, never, R>;
|
|
@@ -1470,6 +1684,5 @@ export declare const Form: {
|
|
|
1470
1684
|
readonly Inputs: F['types']['Inputs'];
|
|
1471
1685
|
}>;
|
|
1472
1686
|
};
|
|
1473
|
-
//#endregion
|
|
1474
1687
|
export type { BundleControl, BundleControlSpec, BundleData, Control, ControlChange, ControlKind, Draft, DraftKind, Follows, FormRow, NestedData, NestedForm, RelationData };
|
|
1475
1688
|
//# sourceMappingURL=index.d.mts.map
|