foldkit 0.38.0 → 0.40.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 +4 -2
- package/dist/command/index.d.ts +15 -9
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +16 -4
- package/dist/command/public.d.ts +2 -2
- package/dist/command/public.d.ts.map +1 -1
- package/dist/command/public.js +1 -1
- package/dist/devtools/overlay.d.ts +34 -1
- package/dist/devtools/overlay.d.ts.map +1 -1
- package/dist/devtools/overlay.js +24 -16
- package/dist/fieldValidation/index.d.ts +45 -37
- package/dist/fieldValidation/index.d.ts.map +1 -1
- package/dist/fieldValidation/public.d.ts +1 -1
- package/dist/fieldValidation/public.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/runtime/managedResource.d.ts +1 -1
- package/dist/runtime/managedResource.js +1 -1
- package/dist/runtime/runtime.d.ts +10 -10
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +2 -2
- package/dist/runtime/subscription.d.ts +3 -3
- package/dist/runtime/subscription.d.ts.map +1 -1
- package/dist/runtime/subscription.js +2 -2
- package/dist/task/dom.d.ts +6 -6
- package/dist/task/dom.js +6 -6
- package/dist/task/inert.d.ts +2 -2
- package/dist/task/inert.js +2 -2
- package/dist/task/scrollLock.d.ts +2 -2
- package/dist/task/scrollLock.js +2 -2
- package/dist/task/time.d.ts +1 -1
- package/dist/task/time.js +1 -1
- package/dist/test/index.d.ts +40 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +138 -0
- package/dist/test/public.d.ts +3 -0
- package/dist/test/public.d.ts.map +1 -0
- package/dist/test/public.js +1 -0
- package/dist/ui/checkbox/index.d.ts +1 -1
- package/dist/ui/checkbox/index.d.ts.map +1 -1
- package/dist/ui/combobox/multi.d.ts +8 -8
- package/dist/ui/combobox/public.d.ts +1 -1
- package/dist/ui/combobox/shared.d.ts +58 -26
- package/dist/ui/combobox/shared.d.ts.map +1 -1
- package/dist/ui/combobox/shared.js +34 -24
- package/dist/ui/combobox/single.d.ts +8 -8
- package/dist/ui/dialog/index.d.ts +20 -8
- package/dist/ui/dialog/index.d.ts.map +1 -1
- package/dist/ui/dialog/index.js +15 -11
- package/dist/ui/dialog/public.d.ts +1 -1
- package/dist/ui/dialog/public.js +1 -1
- package/dist/ui/disclosure/index.d.ts +8 -5
- package/dist/ui/disclosure/index.d.ts.map +1 -1
- package/dist/ui/disclosure/index.js +6 -5
- package/dist/ui/disclosure/public.d.ts +1 -1
- package/dist/ui/listbox/multi.d.ts +8 -8
- package/dist/ui/listbox/public.d.ts +1 -1
- package/dist/ui/listbox/shared.d.ts +61 -22
- package/dist/ui/listbox/shared.d.ts.map +1 -1
- package/dist/ui/listbox/shared.js +41 -29
- package/dist/ui/listbox/single.d.ts +8 -8
- package/dist/ui/menu/index.d.ts +56 -17
- package/dist/ui/menu/index.d.ts.map +1 -1
- package/dist/ui/menu/index.js +46 -34
- package/dist/ui/popover/index.d.ts +42 -13
- package/dist/ui/popover/index.d.ts.map +1 -1
- package/dist/ui/popover/index.js +34 -25
- package/dist/ui/radioGroup/index.d.ts +8 -5
- package/dist/ui/radioGroup/index.d.ts.map +1 -1
- package/dist/ui/radioGroup/index.js +5 -4
- package/dist/ui/switch/index.d.ts +1 -1
- package/dist/ui/switch/index.d.ts.map +1 -1
- package/dist/ui/tabs/index.d.ts +6 -3
- package/dist/ui/tabs/index.d.ts.map +1 -1
- package/dist/ui/tabs/index.js +6 -5
- package/package.json +5 -1
package/dist/task/dom.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ElementNotFound } from './error';
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
|
-
* Task.focus('#email-input').pipe(Effect.ignore, Effect.as(
|
|
9
|
+
* Task.focus('#email-input').pipe(Effect.ignore, Effect.as(CompletedFocusInput()))
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
12
|
export declare const focus: (selector: string) => Effect.Effect<void, ElementNotFound>;
|
|
@@ -21,8 +21,8 @@ export declare const focus: (selector: string) => Effect.Effect<void, ElementNot
|
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```typescript
|
|
24
|
-
* Task.showModal('#my-dialog').pipe(Effect.ignore, Effect.as(
|
|
25
|
-
* Task.showModal('#my-dialog', { focusSelector: '#search-input' }).pipe(Effect.ignore, Effect.as(
|
|
24
|
+
* Task.showModal('#my-dialog').pipe(Effect.ignore, Effect.as(CompletedShowDialog()))
|
|
25
|
+
* Task.showModal('#my-dialog', { focusSelector: '#search-input' }).pipe(Effect.ignore, Effect.as(CompletedShowDialog()))
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
export declare const showModal: (selector: string, options?: Readonly<{
|
|
@@ -35,7 +35,7 @@ export declare const showModal: (selector: string, options?: Readonly<{
|
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
37
|
* ```typescript
|
|
38
|
-
* Task.closeModal('#my-dialog').pipe(Effect.ignore, Effect.as(
|
|
38
|
+
* Task.closeModal('#my-dialog').pipe(Effect.ignore, Effect.as(CompletedCloseDialog()))
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
41
|
export declare const closeModal: (selector: string) => Effect.Effect<void, ElementNotFound>;
|
|
@@ -45,7 +45,7 @@ export declare const closeModal: (selector: string) => Effect.Effect<void, Eleme
|
|
|
45
45
|
*
|
|
46
46
|
* @example
|
|
47
47
|
* ```typescript
|
|
48
|
-
* Task.clickElement('#menu-item-2').pipe(Effect.ignore, Effect.as(
|
|
48
|
+
* Task.clickElement('#menu-item-2').pipe(Effect.ignore, Effect.as(CompletedClickItem()))
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
51
|
export declare const clickElement: (selector: string) => Effect.Effect<void, ElementNotFound>;
|
|
@@ -67,7 +67,7 @@ export type FocusDirection = 'Next' | 'Previous';
|
|
|
67
67
|
*
|
|
68
68
|
* @example
|
|
69
69
|
* ```typescript
|
|
70
|
-
* Task.advanceFocus('#menu-button', 'Next').pipe(Effect.ignore, Effect.as(
|
|
70
|
+
* Task.advanceFocus('#menu-button', 'Next').pipe(Effect.ignore, Effect.as(CompletedAdvanceFocus()))
|
|
71
71
|
* ```
|
|
72
72
|
*/
|
|
73
73
|
export declare const advanceFocus: (selector: string, direction: FocusDirection) => Effect.Effect<void, ElementNotFound>;
|
package/dist/task/dom.js
CHANGED
|
@@ -17,7 +17,7 @@ const FOCUSABLE_SELECTOR = Array.join([
|
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```typescript
|
|
20
|
-
* Task.focus('#email-input').pipe(Effect.ignore, Effect.as(
|
|
20
|
+
* Task.focus('#email-input').pipe(Effect.ignore, Effect.as(CompletedFocusInput()))
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export const focus = (selector) => Effect.suspend(() => {
|
|
@@ -39,8 +39,8 @@ export const focus = (selector) => Effect.suspend(() => {
|
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
41
|
* ```typescript
|
|
42
|
-
* Task.showModal('#my-dialog').pipe(Effect.ignore, Effect.as(
|
|
43
|
-
* Task.showModal('#my-dialog', { focusSelector: '#search-input' }).pipe(Effect.ignore, Effect.as(
|
|
42
|
+
* Task.showModal('#my-dialog').pipe(Effect.ignore, Effect.as(CompletedShowDialog()))
|
|
43
|
+
* Task.showModal('#my-dialog', { focusSelector: '#search-input' }).pipe(Effect.ignore, Effect.as(CompletedShowDialog()))
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
export const showModal = (selector, options) => Effect.suspend(() => {
|
|
@@ -99,7 +99,7 @@ const trapFocusWithinDialog = (event, dialog) => {
|
|
|
99
99
|
*
|
|
100
100
|
* @example
|
|
101
101
|
* ```typescript
|
|
102
|
-
* Task.closeModal('#my-dialog').pipe(Effect.ignore, Effect.as(
|
|
102
|
+
* Task.closeModal('#my-dialog').pipe(Effect.ignore, Effect.as(CompletedCloseDialog()))
|
|
103
103
|
* ```
|
|
104
104
|
*/
|
|
105
105
|
export const closeModal = (selector) => Effect.suspend(() => {
|
|
@@ -122,7 +122,7 @@ export const closeModal = (selector) => Effect.suspend(() => {
|
|
|
122
122
|
*
|
|
123
123
|
* @example
|
|
124
124
|
* ```typescript
|
|
125
|
-
* Task.clickElement('#menu-item-2').pipe(Effect.ignore, Effect.as(
|
|
125
|
+
* Task.clickElement('#menu-item-2').pipe(Effect.ignore, Effect.as(CompletedClickItem()))
|
|
126
126
|
* ```
|
|
127
127
|
*/
|
|
128
128
|
export const clickElement = (selector) => Effect.suspend(() => {
|
|
@@ -156,7 +156,7 @@ export const scrollIntoView = (selector) => Effect.suspend(() => {
|
|
|
156
156
|
*
|
|
157
157
|
* @example
|
|
158
158
|
* ```typescript
|
|
159
|
-
* Task.advanceFocus('#menu-button', 'Next').pipe(Effect.ignore, Effect.as(
|
|
159
|
+
* Task.advanceFocus('#menu-button', 'Next').pipe(Effect.ignore, Effect.as(CompletedAdvanceFocus()))
|
|
160
160
|
* ```
|
|
161
161
|
*/
|
|
162
162
|
export const advanceFocus = (selector, direction) => Effect.suspend(() => {
|
package/dist/task/inert.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { Effect } from 'effect';
|
|
|
8
8
|
* @example
|
|
9
9
|
* ```typescript
|
|
10
10
|
* Task.inertOthers('my-menu', ['#menu-button', '#menu-items']).pipe(
|
|
11
|
-
* Effect.as(
|
|
11
|
+
* Effect.as(CompletedSetupInert()),
|
|
12
12
|
* )
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
@@ -19,7 +19,7 @@ export declare const inertOthers: (id: string, allowedSelectors: ReadonlyArray<s
|
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
21
|
* ```typescript
|
|
22
|
-
* Task.restoreInert('my-menu').pipe(Effect.as(
|
|
22
|
+
* Task.restoreInert('my-menu').pipe(Effect.as(CompletedTeardownInert()))
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
export declare const restoreInert: (id: string) => Effect.Effect<void>;
|
package/dist/task/inert.js
CHANGED
|
@@ -60,7 +60,7 @@ const inertableSiblings = (parent, allowedElements) => pipe(parent.children, Arr
|
|
|
60
60
|
* @example
|
|
61
61
|
* ```typescript
|
|
62
62
|
* Task.inertOthers('my-menu', ['#menu-button', '#menu-items']).pipe(
|
|
63
|
-
* Effect.as(
|
|
63
|
+
* Effect.as(CompletedSetupInert()),
|
|
64
64
|
* )
|
|
65
65
|
* ```
|
|
66
66
|
*/
|
|
@@ -75,7 +75,7 @@ export const inertOthers = (id, allowedSelectors) => Effect.sync(() => {
|
|
|
75
75
|
*
|
|
76
76
|
* @example
|
|
77
77
|
* ```typescript
|
|
78
|
-
* Task.restoreInert('my-menu').pipe(Effect.as(
|
|
78
|
+
* Task.restoreInert('my-menu').pipe(Effect.as(CompletedTeardownInert()))
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
81
|
export const restoreInert = (id) => Effect.sync(() => {
|
|
@@ -9,7 +9,7 @@ import { Effect } from 'effect';
|
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```typescript
|
|
12
|
-
* Task.lockScroll.pipe(Effect.as(
|
|
12
|
+
* Task.lockScroll.pipe(Effect.as(CompletedLockScroll()))
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
15
|
export declare const lockScroll: Effect.Effect<void>;
|
|
@@ -20,7 +20,7 @@ export declare const lockScroll: Effect.Effect<void>;
|
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
22
|
* ```typescript
|
|
23
|
-
* Task.unlockScroll.pipe(Effect.as(
|
|
23
|
+
* Task.unlockScroll.pipe(Effect.as(CompletedUnlockScroll()))
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
export declare const unlockScroll: Effect.Effect<void>;
|
package/dist/task/scrollLock.js
CHANGED
|
@@ -46,7 +46,7 @@ const handleTouchMove = (event) => {
|
|
|
46
46
|
*
|
|
47
47
|
* @example
|
|
48
48
|
* ```typescript
|
|
49
|
-
* Task.lockScroll.pipe(Effect.as(
|
|
49
|
+
* Task.lockScroll.pipe(Effect.as(CompletedLockScroll()))
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
52
|
export const lockScroll = Effect.sync(() => {
|
|
@@ -73,7 +73,7 @@ export const lockScroll = Effect.sync(() => {
|
|
|
73
73
|
*
|
|
74
74
|
* @example
|
|
75
75
|
* ```typescript
|
|
76
|
-
* Task.unlockScroll.pipe(Effect.as(
|
|
76
|
+
* Task.unlockScroll.pipe(Effect.as(CompletedUnlockScroll()))
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
79
|
export const unlockScroll = Effect.sync(() => {
|
package/dist/task/time.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare const getZonedTime: Effect.Effect<DateTime.Zoned>;
|
|
|
35
35
|
* ```typescript
|
|
36
36
|
* Task.getZonedTimeIn('America/New_York').pipe(
|
|
37
37
|
* Effect.map(zoned => GotNYTime({ zoned })),
|
|
38
|
-
* Effect.catchAll(() => Effect.succeed(
|
|
38
|
+
* Effect.catchAll(() => Effect.succeed(FailedGetTimeZone())),
|
|
39
39
|
* )
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
package/dist/task/time.js
CHANGED
|
@@ -39,7 +39,7 @@ export const getZonedTime = Effect.gen(function* () {
|
|
|
39
39
|
* ```typescript
|
|
40
40
|
* Task.getZonedTimeIn('America/New_York').pipe(
|
|
41
41
|
* Effect.map(zoned => GotNYTime({ zoned })),
|
|
42
|
-
* Effect.catchAll(() => Effect.succeed(
|
|
42
|
+
* Effect.catchAll(() => Effect.succeed(FailedGetTimeZone())),
|
|
43
43
|
* )
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { CommandDefinition } from '../command';
|
|
2
|
+
/** A Command in a test simulation, identified by name. */
|
|
3
|
+
export type AnyCommand = Readonly<{
|
|
4
|
+
name: string;
|
|
5
|
+
}>;
|
|
6
|
+
/** An immutable test simulation of a Foldkit program. */
|
|
7
|
+
export type Simulation<Model, Message, OutMessage = undefined> = Readonly<{
|
|
8
|
+
model: Model;
|
|
9
|
+
message: Message | undefined;
|
|
10
|
+
commands: ReadonlyArray<AnyCommand>;
|
|
11
|
+
outMessage: OutMessage;
|
|
12
|
+
}>;
|
|
13
|
+
/** A callable step that sets the initial Model. Carries phantom type for compile-time validation. */
|
|
14
|
+
export type WithStep<Model> = Readonly<{
|
|
15
|
+
_phantomModel: Model;
|
|
16
|
+
}> & (<M, Message, OutMessage = undefined>(simulation: Simulation<M, Message, OutMessage>) => Simulation<M, Message, OutMessage>);
|
|
17
|
+
/** Sets the initial Model for a test story. */
|
|
18
|
+
export { with_ as with };
|
|
19
|
+
declare const with_: <Model>(model: Model) => WithStep<Model>;
|
|
20
|
+
/** Sends a Message through update. Commands stay pending until resolve or resolveAll. */
|
|
21
|
+
export declare const message: <Message>(message_: NoInfer<Message>) => <Model, OutMessage = undefined>(simulation: Simulation<Model, Message, OutMessage>) => Simulation<Model, Message, OutMessage>;
|
|
22
|
+
/** Resolves a specific pending Command with the given result Message. */
|
|
23
|
+
export declare const resolve: {
|
|
24
|
+
<Name extends string, ResultMessage>(definition: CommandDefinition<Name, ResultMessage>, resultMessage: ResultMessage): <Model, Message, OutMessage = undefined>(simulation: Simulation<Model, Message, OutMessage>) => Simulation<Model, Message, OutMessage>;
|
|
25
|
+
<Name extends string, ResultMessage, ParentMessage>(definition: CommandDefinition<Name, ResultMessage>, resultMessage: ResultMessage, toParentMessage: (message: ResultMessage) => ParentMessage): <Model, Message, OutMessage = undefined>(simulation: Simulation<Model, Message, OutMessage>) => Simulation<Model, Message, OutMessage>;
|
|
26
|
+
};
|
|
27
|
+
/** A Command definition paired with the result Message to resolve it with. */
|
|
28
|
+
export type ResolverPair<Name extends string = string, ResultMessage = unknown> = readonly [CommandDefinition<Name, ResultMessage>, ResultMessage];
|
|
29
|
+
/** Resolves all listed Commands with their result Messages. Handles cascading resolution. */
|
|
30
|
+
export declare const resolveAll: (pairs: ReadonlyArray<ResolverPair>) => <Model, Message, OutMessage = undefined>(simulation: Simulation<Model, Message, OutMessage>) => Simulation<Model, Message, OutMessage>;
|
|
31
|
+
/** Runs a function for side effects (e.g. assertions) without breaking the pipe chain. */
|
|
32
|
+
export declare const tap: <Model, Message, OutMessage = undefined>(f: (simulation: Simulation<Model, Message, OutMessage>) => void) => (simulation: Simulation<Model, Message, OutMessage>) => Simulation<Model, Message, OutMessage>;
|
|
33
|
+
/** A single step in a test story — either a {@link WithStep} or a simulation transform. */
|
|
34
|
+
export type StoryStep<Model, Message, OutMessage> = WithStep<NoInfer<Model>> | ((simulation: Simulation<Model, Message, OutMessage>) => Simulation<Model, Message, OutMessage>);
|
|
35
|
+
/** Executes a test story. Throws if any Commands remain unresolved. */
|
|
36
|
+
export declare const story: {
|
|
37
|
+
<Model, Message, OutMessage>(updateFn: (model: Model, message: Message) => readonly [Model, ReadonlyArray<AnyCommand>, OutMessage], ...steps: ReadonlyArray<StoryStep<Model, Message, OutMessage>>): void;
|
|
38
|
+
<Model, Message>(updateFn: (model: Model, message: Message) => readonly [Model, ReadonlyArray<AnyCommand>], ...steps: ReadonlyArray<StoryStep<Model, Message, undefined>>): void;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAEnD,yDAAyD;AACzD,MAAM,MAAM,UAAU,CAAC,KAAK,EAAE,O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AAE,UAAU,IAC5C,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GACxB,CAAC,CACC,UAAU,EAAE,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,KAC/C,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAA;AAEhD,uEAAuE;AACvE,eAAO,MAAM,KAAK,EAAE;IAClB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EACzB,QAAQ,EAAE,CACR,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,KACb,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,EAC5D,GAAG,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,GAC7D,IAAI,CAAA;IACP,CAAC,KAAK,EAAE,OAAO,EACb,QAAQ,EAAE,CACR,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,KACb,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC,EAChD,GAAG,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,GAC5D,IAAI,CAAA;CAyCR,CAAA"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { Array, Predicate, pipe } from 'effect';
|
|
2
|
+
const toInternal = (simulation) =>
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
4
|
+
simulation;
|
|
5
|
+
const resolveByName = (internal, commandName, resolverMessage) => {
|
|
6
|
+
const commandIndex = internal.commands.findIndex(({ name }) => name === commandName);
|
|
7
|
+
if (commandIndex === -1) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
const remainingCommands = Array.remove(internal.commands, commandIndex);
|
|
11
|
+
const result = internal.updateFn(internal.model, resolverMessage);
|
|
12
|
+
const nextModel = result[0];
|
|
13
|
+
const newCommands = result[1];
|
|
14
|
+
const outMessage = result.length === 3 ? result[2] : internal.outMessage;
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
16
|
+
return {
|
|
17
|
+
...internal,
|
|
18
|
+
model: nextModel,
|
|
19
|
+
message: resolverMessage,
|
|
20
|
+
commands: Array.appendAll(remainingCommands, newCommands),
|
|
21
|
+
outMessage,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/** Sets the initial Model for a test story. */
|
|
25
|
+
export { with_ as with };
|
|
26
|
+
const with_ = (model) => {
|
|
27
|
+
const step = (simulation) => {
|
|
28
|
+
const internal = toInternal(simulation);
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
30
|
+
return { ...internal, model };
|
|
31
|
+
};
|
|
32
|
+
/* eslint-disable @typescript-eslint/consistent-type-assertions */
|
|
33
|
+
return Object.assign(step, {
|
|
34
|
+
_phantomModel: undefined,
|
|
35
|
+
});
|
|
36
|
+
/* eslint-enable @typescript-eslint/consistent-type-assertions */
|
|
37
|
+
};
|
|
38
|
+
/** Sends a Message through update. Commands stay pending until resolve or resolveAll. */
|
|
39
|
+
export const message = (message_) => (simulation) => {
|
|
40
|
+
const internal = toInternal(simulation);
|
|
41
|
+
if (Array.isNonEmptyReadonlyArray(internal.commands)) {
|
|
42
|
+
const names = pipe(internal.commands, Array.map(({ name }) => ` ${name}`), Array.join('\n'));
|
|
43
|
+
throw new Error(`I found unresolved Commands when you sent a new Message:\n\n${names}\n\n` +
|
|
44
|
+
'Resolve all Commands before sending the next Message.\n' +
|
|
45
|
+
'Use Test.resolve(Definition, ResultMessage) for each one,\n' +
|
|
46
|
+
'or Test.resolveAll([...pairs]) to resolve them all at once.');
|
|
47
|
+
}
|
|
48
|
+
const result = internal.updateFn(internal.model, message_);
|
|
49
|
+
const nextModel = result[0];
|
|
50
|
+
const commands = result[1];
|
|
51
|
+
const outMessage = result.length === 3 ? result[2] : internal.outMessage;
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
53
|
+
return {
|
|
54
|
+
...internal,
|
|
55
|
+
model: nextModel,
|
|
56
|
+
message: message_,
|
|
57
|
+
commands: Array.appendAll(internal.commands, commands),
|
|
58
|
+
outMessage,
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
/** Resolves a specific pending Command with the given result Message. */
|
|
62
|
+
export const resolve = (definition, resultMessage, toParentMessage) => (simulation) => {
|
|
63
|
+
/* eslint-disable @typescript-eslint/consistent-type-assertions */
|
|
64
|
+
const internal = toInternal(simulation);
|
|
65
|
+
const messageForUpdate = (Predicate.isUndefined(toParentMessage)
|
|
66
|
+
? resultMessage
|
|
67
|
+
: toParentMessage(resultMessage));
|
|
68
|
+
const next = resolveByName(internal, definition.name, messageForUpdate);
|
|
69
|
+
if (Predicate.isUndefined(next)) {
|
|
70
|
+
const pending = Array.isNonEmptyReadonlyArray(internal.commands)
|
|
71
|
+
? pipe(internal.commands, Array.map(({ name }) => ` ${name}`), Array.join('\n'))
|
|
72
|
+
: ' (none)';
|
|
73
|
+
throw new Error(`I tried to resolve "${definition.name}" but it wasn't in the pending Commands.\n\n` +
|
|
74
|
+
`Pending Commands:\n${pending}\n\n` +
|
|
75
|
+
'Make sure the previous Message produced this Command.');
|
|
76
|
+
}
|
|
77
|
+
return next;
|
|
78
|
+
/* eslint-enable @typescript-eslint/consistent-type-assertions */
|
|
79
|
+
};
|
|
80
|
+
/** Resolves all listed Commands with their result Messages. Handles cascading resolution. */
|
|
81
|
+
export const resolveAll = (pairs) => (simulation) => {
|
|
82
|
+
const internal = toInternal(simulation);
|
|
83
|
+
const resolvers = {};
|
|
84
|
+
for (const [definition, resultMessage] of pairs) {
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
86
|
+
resolvers[definition.name] = resultMessage;
|
|
87
|
+
}
|
|
88
|
+
let current = {
|
|
89
|
+
...internal,
|
|
90
|
+
resolvers: { ...internal.resolvers, ...resolvers },
|
|
91
|
+
};
|
|
92
|
+
const MAX_CASCADE_DEPTH = 100;
|
|
93
|
+
for (let depth = 0; depth < MAX_CASCADE_DEPTH; depth++) {
|
|
94
|
+
const resolvable = current.commands.find(({ name }) => name in current.resolvers);
|
|
95
|
+
if (Predicate.isUndefined(resolvable)) {
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
const next = resolveByName(current, resolvable.name, current.resolvers[resolvable.name]);
|
|
99
|
+
if (Predicate.isUndefined(next)) {
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
103
|
+
current = next;
|
|
104
|
+
if (depth === MAX_CASCADE_DEPTH - 1) {
|
|
105
|
+
throw new Error('resolveAll hit the maximum cascade depth (100). ' +
|
|
106
|
+
'This usually means Commands are producing Commands in an infinite cycle.');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
110
|
+
return current;
|
|
111
|
+
};
|
|
112
|
+
/** Runs a function for side effects (e.g. assertions) without breaking the pipe chain. */
|
|
113
|
+
export const tap = (f) => (simulation) => {
|
|
114
|
+
f(simulation);
|
|
115
|
+
return simulation;
|
|
116
|
+
};
|
|
117
|
+
/** Executes a test story. Throws if any Commands remain unresolved. */
|
|
118
|
+
export const story = (updateFn, ...steps) => {
|
|
119
|
+
/* eslint-disable @typescript-eslint/consistent-type-assertions */
|
|
120
|
+
const seed = {
|
|
121
|
+
model: undefined,
|
|
122
|
+
message: undefined,
|
|
123
|
+
commands: [],
|
|
124
|
+
outMessage: undefined,
|
|
125
|
+
updateFn,
|
|
126
|
+
resolvers: {},
|
|
127
|
+
};
|
|
128
|
+
const result = steps.reduce((current, step) => step(current), seed);
|
|
129
|
+
/* eslint-enable @typescript-eslint/consistent-type-assertions */
|
|
130
|
+
const internal = toInternal(result);
|
|
131
|
+
if (Array.isNonEmptyReadonlyArray(internal.commands)) {
|
|
132
|
+
const names = pipe(internal.commands, Array.map(({ name }) => ` ${name}`), Array.join('\n'));
|
|
133
|
+
throw new Error(`I found Commands without resolvers:\n\n${names}\n\n` +
|
|
134
|
+
'Every Command produced by update needs to be resolved.\n' +
|
|
135
|
+
'Use Test.resolve(Definition, ResultMessage) for each one,\n' +
|
|
136
|
+
'or Test.resolveAll([...pairs]) to resolve them all at once.');
|
|
137
|
+
}
|
|
138
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/test/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,SAAS,EACT,QAAQ,GACT,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { message, resolve, resolveAll, story, tap, with } from './index';
|
|
@@ -21,7 +21,7 @@ export type InitConfig = Readonly<{
|
|
|
21
21
|
/** Creates an initial checkbox model from a config. Defaults to unchecked. */
|
|
22
22
|
export declare const init: (config: InitConfig) => Model;
|
|
23
23
|
/** Processes a checkbox message and returns the next model and commands. */
|
|
24
|
-
export declare const update: (model: Model, _message: Message) => [Model, ReadonlyArray<Command<Message>>];
|
|
24
|
+
export declare const update: (model: Model, _message: Message) => readonly [Model, ReadonlyArray<Command<Message>>];
|
|
25
25
|
/** Attribute groups the checkbox component provides to the consumer's `toView` callback. */
|
|
26
26
|
export type CheckboxAttributes<Message> = Readonly<{
|
|
27
27
|
checkbox: ReadonlyArray<Attribute<Message>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/checkbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,IAAI,CA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I,CAAA;IACzD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC,CAAA;AAKF,kIAAkI;AAClI,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IAwE3D,CAAA;AAED;6EAC6E;AAC7E,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,cAAc,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC,KAC7D,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAgBtE,CAAA"}
|
|
@@ -47,7 +47,7 @@ export declare const update: (model: {
|
|
|
47
47
|
}>;
|
|
48
48
|
} & {
|
|
49
49
|
readonly selectedItems: readonly string[];
|
|
50
|
-
}, message: import("./shared").Message) => [{
|
|
50
|
+
}, message: import("./shared").Message) => readonly [{
|
|
51
51
|
readonly id: string;
|
|
52
52
|
readonly isOpen: boolean;
|
|
53
53
|
readonly isAnimated: boolean;
|
|
@@ -97,19 +97,19 @@ export declare const update: (model: {
|
|
|
97
97
|
readonly _tag: "RequestedItemClick";
|
|
98
98
|
readonly index: number;
|
|
99
99
|
} | {
|
|
100
|
-
readonly _tag: "
|
|
100
|
+
readonly _tag: "CompletedLockScroll";
|
|
101
101
|
} | {
|
|
102
|
-
readonly _tag: "
|
|
102
|
+
readonly _tag: "CompletedUnlockScroll";
|
|
103
103
|
} | {
|
|
104
|
-
readonly _tag: "
|
|
104
|
+
readonly _tag: "CompletedSetupInert";
|
|
105
105
|
} | {
|
|
106
|
-
readonly _tag: "
|
|
106
|
+
readonly _tag: "CompletedTeardownInert";
|
|
107
107
|
} | {
|
|
108
|
-
readonly _tag: "
|
|
108
|
+
readonly _tag: "CompletedFocusInput";
|
|
109
109
|
} | {
|
|
110
110
|
readonly _tag: "CompletedScrollIntoView";
|
|
111
111
|
} | {
|
|
112
|
-
readonly _tag: "
|
|
112
|
+
readonly _tag: "CompletedClickItem";
|
|
113
113
|
} | {
|
|
114
114
|
readonly _tag: "AdvancedTransitionFrame";
|
|
115
115
|
} | {
|
|
@@ -146,7 +146,7 @@ export declare const view: <Message, Item extends string>(config: Readonly<{
|
|
|
146
146
|
} & {
|
|
147
147
|
readonly selectedItems: readonly string[];
|
|
148
148
|
};
|
|
149
|
-
toMessage: (message: import("./shared").Opened | import("./shared").Closed | import("./shared").ClosedByTab | import("./shared").ActivatedItem | import("./shared").DeactivatedItem | import("./shared").SelectedItem | import("./shared").MovedPointerOverItem | import("./shared").RequestedItemClick | import("./shared").UpdatedInputValue | import("./shared").PressedToggleButton | import("./shared").
|
|
149
|
+
toMessage: (message: import("./shared").Opened | import("./shared").Closed | import("./shared").ClosedByTab | import("./shared").ActivatedItem | import("./shared").DeactivatedItem | import("./shared").SelectedItem | import("./shared").MovedPointerOverItem | import("./shared").RequestedItemClick | import("./shared").UpdatedInputValue | import("./shared").PressedToggleButton | import("./shared").CompletedLockScroll | import("./shared").CompletedUnlockScroll | import("./shared").CompletedSetupInert | import("./shared").CompletedTeardownInert | import("./shared").CompletedFocusInput | import("./shared").CompletedScrollIntoView | import("./shared").CompletedClickItem) => Message;
|
|
150
150
|
items: readonly Item[];
|
|
151
151
|
itemToConfig: (item: Item, context: Readonly<{
|
|
152
152
|
isActive: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { init, update, view, lazy, Model } from './single';
|
|
2
2
|
export { Message } from './shared';
|
|
3
3
|
export { TransitionState } from '../transition';
|
|
4
|
-
export type { ActivationTrigger, Opened, Closed, ClosedByTab, ActivatedItem, DeactivatedItem, SelectedItem, MovedPointerOverItem, RequestedItemClick, UpdatedInputValue, PressedToggleButton,
|
|
4
|
+
export type { ActivationTrigger, Opened, Closed, ClosedByTab, ActivatedItem, DeactivatedItem, SelectedItem, MovedPointerOverItem, RequestedItemClick, UpdatedInputValue, PressedToggleButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem, AdvancedTransitionFrame, EndedTransition, DetectedInputMovement, ItemConfig, GroupHeading, } from './shared';
|
|
5
5
|
export type { InitConfig, ViewConfig } from './single';
|
|
6
6
|
export type { AnchorConfig } from '../anchor';
|
|
7
7
|
export * as Multi from './multiPublic';
|
|
@@ -72,19 +72,19 @@ export declare const RequestedItemClick: import("../../schema").CallableTaggedSt
|
|
|
72
72
|
index: typeof S.Number;
|
|
73
73
|
}>;
|
|
74
74
|
/** Sent when the scroll lock command completes. */
|
|
75
|
-
export declare const
|
|
75
|
+
export declare const CompletedLockScroll: import("../../schema").CallableTaggedStruct<"CompletedLockScroll", {}>;
|
|
76
76
|
/** Sent when the scroll unlock command completes. */
|
|
77
|
-
export declare const
|
|
77
|
+
export declare const CompletedUnlockScroll: import("../../schema").CallableTaggedStruct<"CompletedUnlockScroll", {}>;
|
|
78
78
|
/** Sent when the inert-others command completes. */
|
|
79
|
-
export declare const
|
|
79
|
+
export declare const CompletedSetupInert: import("../../schema").CallableTaggedStruct<"CompletedSetupInert", {}>;
|
|
80
80
|
/** Sent when the restore-inert command completes. */
|
|
81
|
-
export declare const
|
|
81
|
+
export declare const CompletedTeardownInert: import("../../schema").CallableTaggedStruct<"CompletedTeardownInert", {}>;
|
|
82
82
|
/** Sent when the focus-input command completes. */
|
|
83
|
-
export declare const
|
|
83
|
+
export declare const CompletedFocusInput: import("../../schema").CallableTaggedStruct<"CompletedFocusInput", {}>;
|
|
84
84
|
/** Sent when the scroll-into-view command completes after keyboard activation. */
|
|
85
85
|
export declare const CompletedScrollIntoView: import("../../schema").CallableTaggedStruct<"CompletedScrollIntoView", {}>;
|
|
86
86
|
/** Sent when the programmatic item click command completes. */
|
|
87
|
-
export declare const
|
|
87
|
+
export declare const CompletedClickItem: import("../../schema").CallableTaggedStruct<"CompletedClickItem", {}>;
|
|
88
88
|
/** Sent internally when a double-rAF completes, advancing the transition to its animating phase. */
|
|
89
89
|
export declare const AdvancedTransitionFrame: import("../../schema").CallableTaggedStruct<"AdvancedTransitionFrame", {}>;
|
|
90
90
|
/** Sent internally when all CSS transitions on the items container have completed. */
|
|
@@ -107,13 +107,13 @@ export declare const Message: S.Union<[
|
|
|
107
107
|
typeof SelectedItem,
|
|
108
108
|
typeof MovedPointerOverItem,
|
|
109
109
|
typeof RequestedItemClick,
|
|
110
|
-
typeof
|
|
111
|
-
typeof
|
|
112
|
-
typeof
|
|
113
|
-
typeof
|
|
114
|
-
typeof
|
|
110
|
+
typeof CompletedLockScroll,
|
|
111
|
+
typeof CompletedUnlockScroll,
|
|
112
|
+
typeof CompletedSetupInert,
|
|
113
|
+
typeof CompletedTeardownInert,
|
|
114
|
+
typeof CompletedFocusInput,
|
|
115
115
|
typeof CompletedScrollIntoView,
|
|
116
|
-
typeof
|
|
116
|
+
typeof CompletedClickItem,
|
|
117
117
|
typeof AdvancedTransitionFrame,
|
|
118
118
|
typeof EndedTransition,
|
|
119
119
|
typeof DetectedInputMovement,
|
|
@@ -128,13 +128,13 @@ export type DeactivatedItem = typeof DeactivatedItem.Type;
|
|
|
128
128
|
export type SelectedItem = typeof SelectedItem.Type;
|
|
129
129
|
export type MovedPointerOverItem = typeof MovedPointerOverItem.Type;
|
|
130
130
|
export type RequestedItemClick = typeof RequestedItemClick.Type;
|
|
131
|
-
export type
|
|
132
|
-
export type
|
|
133
|
-
export type
|
|
134
|
-
export type
|
|
135
|
-
export type
|
|
131
|
+
export type CompletedLockScroll = typeof CompletedLockScroll.Type;
|
|
132
|
+
export type CompletedUnlockScroll = typeof CompletedUnlockScroll.Type;
|
|
133
|
+
export type CompletedSetupInert = typeof CompletedSetupInert.Type;
|
|
134
|
+
export type CompletedTeardownInert = typeof CompletedTeardownInert.Type;
|
|
135
|
+
export type CompletedFocusInput = typeof CompletedFocusInput.Type;
|
|
136
136
|
export type CompletedScrollIntoView = typeof CompletedScrollIntoView.Type;
|
|
137
|
-
export type
|
|
137
|
+
export type CompletedClickItem = typeof CompletedClickItem.Type;
|
|
138
138
|
export type AdvancedTransitionFrame = typeof AdvancedTransitionFrame.Type;
|
|
139
139
|
export type EndedTransition = typeof EndedTransition.Type;
|
|
140
140
|
export type DetectedInputMovement = typeof DetectedInputMovement.Type;
|
|
@@ -156,11 +156,43 @@ export type SelectedItemContext = Readonly<{
|
|
|
156
156
|
maybeRestoreInert: Option.Option<Command.Command<Message>>;
|
|
157
157
|
}>;
|
|
158
158
|
/** Creates a combobox update function from variant-specific handlers. Shared logic (open, close, activate, transition) is handled internally; only close, selection, and immediate-activation behavior varies by variant. */
|
|
159
|
+
export declare const RequestFrame: Command.CommandDefinition<"RequestFrame", {
|
|
160
|
+
readonly _tag: "AdvancedTransitionFrame";
|
|
161
|
+
}>;
|
|
162
|
+
export declare const LockScroll: Command.CommandDefinition<"LockScroll", {
|
|
163
|
+
readonly _tag: "CompletedLockScroll";
|
|
164
|
+
}>;
|
|
165
|
+
export declare const UnlockScroll: Command.CommandDefinition<"UnlockScroll", {
|
|
166
|
+
readonly _tag: "CompletedUnlockScroll";
|
|
167
|
+
}>;
|
|
168
|
+
export declare const InertOthers: Command.CommandDefinition<"InertOthers", {
|
|
169
|
+
readonly _tag: "CompletedSetupInert";
|
|
170
|
+
}>;
|
|
171
|
+
export declare const RestoreInert: Command.CommandDefinition<"RestoreInert", {
|
|
172
|
+
readonly _tag: "CompletedTeardownInert";
|
|
173
|
+
}>;
|
|
174
|
+
export declare const FocusInput: Command.CommandDefinition<"FocusInput", {
|
|
175
|
+
readonly _tag: "CompletedFocusInput";
|
|
176
|
+
}>;
|
|
177
|
+
export declare const ScrollIntoView: Command.CommandDefinition<"ScrollIntoView", {
|
|
178
|
+
readonly _tag: "CompletedScrollIntoView";
|
|
179
|
+
}>;
|
|
180
|
+
export declare const ClickItem: Command.CommandDefinition<"ClickItem", {
|
|
181
|
+
readonly _tag: "CompletedClickItem";
|
|
182
|
+
}>;
|
|
183
|
+
export declare const WaitForTransitions: Command.CommandDefinition<"WaitForTransitions", {
|
|
184
|
+
readonly _tag: "EndedTransition";
|
|
185
|
+
}>;
|
|
186
|
+
export declare const DetectMovementOrTransitionEnd: Command.CommandDefinition<"DetectMovementOrTransitionEnd", {
|
|
187
|
+
readonly _tag: "EndedTransition";
|
|
188
|
+
} | {
|
|
189
|
+
readonly _tag: "DetectedInputMovement";
|
|
190
|
+
}>;
|
|
159
191
|
export declare const makeUpdate: <Model extends BaseModel>(handlers: Readonly<{
|
|
160
192
|
handleClose: (model: Model) => Model;
|
|
161
193
|
handleSelectedItem: (model: Model, item: string, displayText: string, context: SelectedItemContext) => [Model, ReadonlyArray<Command.Command<Message>>];
|
|
162
194
|
handleImmediateActivation: (model: Model, item: string, displayText: string) => Model;
|
|
163
|
-
}>) => (model: Model, message: Message) => [Model, readonly Readonly<{
|
|
195
|
+
}>) => (model: Model, message: Message) => readonly [Model, readonly Readonly<{
|
|
164
196
|
name: string;
|
|
165
197
|
effect: Effect.Effect<{
|
|
166
198
|
readonly _tag: "Opened";
|
|
@@ -192,19 +224,19 @@ export declare const makeUpdate: <Model extends BaseModel>(handlers: Readonly<{
|
|
|
192
224
|
readonly _tag: "RequestedItemClick";
|
|
193
225
|
readonly index: number;
|
|
194
226
|
} | {
|
|
195
|
-
readonly _tag: "
|
|
227
|
+
readonly _tag: "CompletedLockScroll";
|
|
196
228
|
} | {
|
|
197
|
-
readonly _tag: "
|
|
229
|
+
readonly _tag: "CompletedUnlockScroll";
|
|
198
230
|
} | {
|
|
199
|
-
readonly _tag: "
|
|
231
|
+
readonly _tag: "CompletedSetupInert";
|
|
200
232
|
} | {
|
|
201
|
-
readonly _tag: "
|
|
233
|
+
readonly _tag: "CompletedTeardownInert";
|
|
202
234
|
} | {
|
|
203
|
-
readonly _tag: "
|
|
235
|
+
readonly _tag: "CompletedFocusInput";
|
|
204
236
|
} | {
|
|
205
237
|
readonly _tag: "CompletedScrollIntoView";
|
|
206
238
|
} | {
|
|
207
|
-
readonly _tag: "
|
|
239
|
+
readonly _tag: "CompletedClickItem";
|
|
208
240
|
} | {
|
|
209
241
|
readonly _tag: "AdvancedTransitionFrame";
|
|
210
242
|
} | {
|
|
@@ -231,7 +263,7 @@ export type GroupHeading = Readonly<{
|
|
|
231
263
|
/** Configuration for rendering a combobox with `view`. */
|
|
232
264
|
export type BaseViewConfig<Message, Item extends string, Model extends BaseModel> = Readonly<{
|
|
233
265
|
model: Model;
|
|
234
|
-
toMessage: (message: Opened | Closed | ClosedByTab | ActivatedItem | DeactivatedItem | SelectedItem | MovedPointerOverItem | RequestedItemClick | UpdatedInputValue | PressedToggleButton |
|
|
266
|
+
toMessage: (message: Opened | Closed | ClosedByTab | ActivatedItem | DeactivatedItem | SelectedItem | MovedPointerOverItem | RequestedItemClick | UpdatedInputValue | PressedToggleButton | CompletedLockScroll | CompletedUnlockScroll | CompletedSetupInert | CompletedTeardownInert | CompletedFocusInput | CompletedScrollIntoView | CompletedClickItem) => Message;
|
|
235
267
|
items: ReadonlyArray<Item>;
|
|
236
268
|
itemToConfig: (item: Item, context: Readonly<{
|
|
237
269
|
isActive: boolean;
|