foldkit 0.56.0 → 0.58.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 +21 -11
- package/dist/devtools/overlay-styles.d.ts +1 -1
- package/dist/devtools/overlay-styles.d.ts.map +1 -1
- package/dist/devtools/overlay-styles.js +5 -1
- package/dist/devtools/overlay.d.ts.map +1 -1
- package/dist/devtools/overlay.js +52 -19
- package/dist/file/error.d.ts +10 -0
- package/dist/file/error.d.ts.map +1 -0
- package/dist/file/error.js +4 -0
- package/dist/file/file.d.ts +24 -0
- package/dist/file/file.d.ts.map +1 -0
- package/dist/file/file.js +16 -0
- package/dist/file/index.d.ts +5 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/file/index.js +4 -0
- package/dist/file/public.d.ts +2 -0
- package/dist/file/public.d.ts.map +1 -0
- package/dist/file/public.js +1 -0
- package/dist/file/reader.d.ts +56 -0
- package/dist/file/reader.d.ts.map +1 -0
- package/dist/file/reader.js +92 -0
- package/dist/file/select.d.ts +36 -0
- package/dist/file/select.d.ts.map +1 -0
- package/dist/file/select.js +60 -0
- package/dist/html/index.d.ts +34 -3
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +40 -1
- package/dist/html/lazy.d.ts +7 -5
- package/dist/html/lazy.d.ts.map +1 -1
- package/dist/html/lazy.js +12 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +2 -4
- package/dist/test/apps/disabledButton.d.ts +11 -3
- package/dist/test/apps/disabledButton.d.ts.map +1 -1
- package/dist/test/apps/fileUpload.d.ts +17 -0
- package/dist/test/apps/fileUpload.d.ts.map +1 -0
- package/dist/test/apps/fileUpload.js +29 -0
- package/dist/test/apps/resumeUpload.d.ts +43 -0
- package/dist/test/apps/resumeUpload.d.ts.map +1 -0
- package/dist/test/apps/resumeUpload.js +85 -0
- package/dist/test/query.d.ts +2 -1
- package/dist/test/query.d.ts.map +1 -1
- package/dist/test/query.js +15 -2
- package/dist/test/scene.d.ts +18 -0
- package/dist/test/scene.d.ts.map +1 -1
- package/dist/test/scene.js +46 -0
- package/dist/ui/combobox/multi.d.ts +31 -10
- package/dist/ui/combobox/multi.d.ts.map +1 -1
- package/dist/ui/combobox/public.d.ts +1 -2
- package/dist/ui/combobox/public.d.ts.map +1 -1
- package/dist/ui/combobox/public.js +1 -2
- package/dist/ui/combobox/shared.d.ts +33 -33
- package/dist/ui/combobox/shared.d.ts.map +1 -1
- package/dist/ui/combobox/shared.js +89 -112
- package/dist/ui/combobox/single.d.ts +31 -10
- package/dist/ui/combobox/single.d.ts.map +1 -1
- package/dist/ui/combobox/single.js +1 -5
- package/dist/ui/dialog/index.d.ts +10 -15
- package/dist/ui/dialog/index.d.ts.map +1 -1
- package/dist/ui/dialog/index.js +68 -73
- package/dist/ui/dialog/public.d.ts +1 -1
- package/dist/ui/dialog/public.d.ts.map +1 -1
- package/dist/ui/dialog/public.js +1 -1
- package/dist/ui/listbox/multi.d.ts +30 -9
- package/dist/ui/listbox/multi.d.ts.map +1 -1
- package/dist/ui/listbox/public.d.ts +1 -2
- package/dist/ui/listbox/public.d.ts.map +1 -1
- package/dist/ui/listbox/public.js +1 -2
- package/dist/ui/listbox/shared.d.ts +35 -36
- package/dist/ui/listbox/shared.d.ts.map +1 -1
- package/dist/ui/listbox/shared.js +106 -104
- package/dist/ui/listbox/single.d.ts +30 -9
- package/dist/ui/listbox/single.d.ts.map +1 -1
- package/dist/ui/listbox/single.js +9 -12
- package/dist/ui/menu/index.d.ts +22 -26
- package/dist/ui/menu/index.d.ts.map +1 -1
- package/dist/ui/menu/index.js +103 -91
- package/dist/ui/menu/public.d.ts +1 -2
- package/dist/ui/menu/public.d.ts.map +1 -1
- package/dist/ui/menu/public.js +1 -2
- package/dist/ui/popover/index.d.ts +21 -22
- package/dist/ui/popover/index.d.ts.map +1 -1
- package/dist/ui/popover/index.js +92 -75
- package/dist/ui/popover/public.d.ts +1 -2
- package/dist/ui/popover/public.d.ts.map +1 -1
- package/dist/ui/popover/public.js +1 -2
- package/dist/ui/transition/index.d.ts +8 -58
- package/dist/ui/transition/index.d.ts.map +1 -1
- package/dist/ui/transition/index.js +21 -111
- package/dist/ui/transition/public.d.ts +1 -1
- package/dist/ui/transition/public.d.ts.map +1 -1
- package/dist/ui/transition/public.js +1 -1
- package/dist/ui/transition/schema.d.ts +43 -0
- package/dist/ui/transition/schema.d.ts.map +1 -0
- package/dist/ui/transition/schema.js +35 -0
- package/dist/ui/transition/update.d.ts +22 -0
- package/dist/ui/transition/update.d.ts.map +1 -0
- package/dist/ui/transition/update.js +68 -0
- package/package.json +5 -1
- package/dist/ui/transition.d.ts +0 -5
- package/dist/ui/transition.d.ts.map +0 -1
- package/dist/ui/transition.js +0 -3
|
@@ -6,7 +6,11 @@ export declare const Model: S.Struct<{
|
|
|
6
6
|
id: typeof S.String;
|
|
7
7
|
isOpen: typeof S.Boolean;
|
|
8
8
|
isAnimated: typeof S.Boolean;
|
|
9
|
-
|
|
9
|
+
transition: S.Struct<{
|
|
10
|
+
id: typeof S.String;
|
|
11
|
+
isShowing: typeof S.Boolean;
|
|
12
|
+
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
13
|
+
}>;
|
|
10
14
|
maybeFocusSelector: S.OptionFromSelf<typeof S.String>;
|
|
11
15
|
}>;
|
|
12
16
|
export type Model = typeof Model.Type;
|
|
@@ -18,18 +22,17 @@ export declare const Closed: import("../../schema").CallableTaggedStruct<"Closed
|
|
|
18
22
|
export declare const CompletedShowDialog: import("../../schema").CallableTaggedStruct<"CompletedShowDialog", {}>;
|
|
19
23
|
/** Sent when the close-dialog command completes (closeModal + scroll unlock). */
|
|
20
24
|
export declare const CompletedCloseDialog: import("../../schema").CallableTaggedStruct<"CompletedCloseDialog", {}>;
|
|
21
|
-
/**
|
|
22
|
-
export declare const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
/** Wraps a Transition submodel message for delegation. */
|
|
26
|
+
export declare const GotTransitionMessage: import("../../schema").CallableTaggedStruct<"GotTransitionMessage", {
|
|
27
|
+
message: S.Union<[import("../../schema").CallableTaggedStruct<"Showed", {}>, import("../../schema").CallableTaggedStruct<"Hidden", {}>, import("../../schema").CallableTaggedStruct<"AdvancedTransitionFrame", {}>, import("../../schema").CallableTaggedStruct<"EndedTransition", {}>]>;
|
|
28
|
+
}>;
|
|
25
29
|
/** Union of all messages the dialog component can produce. */
|
|
26
30
|
export declare const Message: S.Union<[
|
|
27
31
|
typeof Opened,
|
|
28
32
|
typeof Closed,
|
|
29
33
|
typeof CompletedShowDialog,
|
|
30
34
|
typeof CompletedCloseDialog,
|
|
31
|
-
typeof
|
|
32
|
-
typeof EndedTransition
|
|
35
|
+
typeof GotTransitionMessage
|
|
33
36
|
]>;
|
|
34
37
|
export type Opened = typeof Opened.Type;
|
|
35
38
|
export type Closed = typeof Closed.Type;
|
|
@@ -46,10 +49,6 @@ export type InitConfig = Readonly<{
|
|
|
46
49
|
/** Creates an initial dialog model from a config. Defaults to closed and non-animated. */
|
|
47
50
|
export declare const init: (config: InitConfig) => Model;
|
|
48
51
|
type UpdateReturn = readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
49
|
-
/** Advances the dialog's enter/leave transition by waiting a double-rAF. */
|
|
50
|
-
export declare const RequestFrame: Command.CommandDefinition<"RequestFrame", {
|
|
51
|
-
readonly _tag: "AdvancedTransitionFrame";
|
|
52
|
-
}>;
|
|
53
52
|
/** Locks page scroll and calls `showModal()` on the native dialog element. */
|
|
54
53
|
export declare const ShowDialog: Command.CommandDefinition<"ShowDialog", {
|
|
55
54
|
readonly _tag: "CompletedShowDialog";
|
|
@@ -58,10 +57,6 @@ export declare const ShowDialog: Command.CommandDefinition<"ShowDialog", {
|
|
|
58
57
|
export declare const CloseDialog: Command.CommandDefinition<"CloseDialog", {
|
|
59
58
|
readonly _tag: "CompletedCloseDialog";
|
|
60
59
|
}>;
|
|
61
|
-
/** Waits for all CSS transitions on the dialog panel to complete. */
|
|
62
|
-
export declare const WaitForTransitions: Command.CommandDefinition<"WaitForTransitions", {
|
|
63
|
-
readonly _tag: "EndedTransition";
|
|
64
|
-
}>;
|
|
65
60
|
/** Processes a dialog message and returns the next model and commands. */
|
|
66
61
|
export declare const update: (model: Model, message: Message) => UpdateReturn;
|
|
67
62
|
/** Returns the ID used for `aria-labelledby` on the dialog. Apply this to your title element. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEhE,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAoB,MAAM,YAAY,CAAA;AAsBxE,oIAAoI;AACpI,eAAO,MAAM,KAAK;;;;;;;;;;EAMhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,wEAAwE;AACxE,eAAO,MAAM,MAAM,2DAAc,CAAA;AACjC,wHAAwH;AACxH,eAAO,MAAM,MAAM,2DAAc,CAAA;AACjC,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,wEAA2B,CAAA;AAC3D,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,yEAA4B,CAAA;AAC7D,0DAA0D;AAC1D,eAAO,MAAM,oBAAoB;;EAE/B,CAAA;AAEF,8DAA8D;AAC9D,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,KAAK,CAC3B;IACE,OAAO,MAAM;IACb,OAAO,MAAM;IACb,OAA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,EAAE,KAAK,CAAA;IACZ,eAAe,EAAE,CACf,OAAO,EAAE,MAAM,GAAG,mBAAmB,GAAG,oBAAoB,KACzD,OAAO,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAA;IACxB,YAAY,EAAE,IAAI,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACnD,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kBAAkB,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF;yFACyF;AACzF,eAAO,MAAM,KAAK,GAChB,OAAO,KAAK,KACX,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAClC,CAAA;AAEzB,sGAAsG;AACtG,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IA8G3D,CAAA;AAED;;;;oDAIoD;AACpD,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,cAAc,IAAI,CAChB,UAAU,CAAC,OAAO,CAAC,EACnB,OAAO,GAAG,iBAAiB,GAAG,UAAU,GAAG,cAAc,CAC1D,KACA,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,EACvD,YAAY,EAAE,IAAI,KACf,IAAI,CAkBR,CAAA"}
|
package/dist/ui/dialog/index.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Effect, Match as M, Option, Schema as S } from 'effect';
|
|
2
2
|
import * as Command from '../../command';
|
|
3
|
-
import { OptionExt } from '../../effectExtensions';
|
|
4
3
|
import { createLazy, html } from '../../html';
|
|
5
4
|
import { m } from '../../message';
|
|
6
5
|
import { evo } from '../../struct';
|
|
7
6
|
import * as Task from '../../task';
|
|
8
|
-
|
|
7
|
+
// NOTE: Transition imports are split across schema + update to avoid a circular
|
|
8
|
+
// dependency: transition → html → runtime → devtools → dialog → transition.
|
|
9
|
+
// The barrel (../transition) imports from html, which starts the cycle.
|
|
10
|
+
import { Hidden as TransitionHidden, Message as TransitionMessage, Model as TransitionModel, Showed as TransitionShowed, init as transitionInit, } from '../transition/schema';
|
|
11
|
+
import { defaultLeaveCommand as transitionDefaultLeaveCommand, update as transitionUpdate, } from '../transition/update';
|
|
9
12
|
// MODEL
|
|
10
13
|
/** Schema for the dialog component's state, tracking its unique ID, open/closed status, animation support, and transition phase. */
|
|
11
14
|
export const Model = S.Struct({
|
|
12
15
|
id: S.String,
|
|
13
16
|
isOpen: S.Boolean,
|
|
14
17
|
isAnimated: S.Boolean,
|
|
15
|
-
|
|
18
|
+
transition: TransitionModel,
|
|
16
19
|
maybeFocusSelector: S.OptionFromSelf(S.String),
|
|
17
20
|
});
|
|
18
21
|
// MESSAGE
|
|
@@ -24,92 +27,84 @@ export const Closed = m('Closed');
|
|
|
24
27
|
export const CompletedShowDialog = m('CompletedShowDialog');
|
|
25
28
|
/** Sent when the close-dialog command completes (closeModal + scroll unlock). */
|
|
26
29
|
export const CompletedCloseDialog = m('CompletedCloseDialog');
|
|
27
|
-
/**
|
|
28
|
-
export const
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
/** Wraps a Transition submodel message for delegation. */
|
|
31
|
+
export const GotTransitionMessage = m('GotTransitionMessage', {
|
|
32
|
+
message: TransitionMessage,
|
|
33
|
+
});
|
|
31
34
|
/** Union of all messages the dialog component can produce. */
|
|
32
|
-
export const Message = S.Union(Opened, Closed, CompletedShowDialog, CompletedCloseDialog,
|
|
35
|
+
export const Message = S.Union(Opened, Closed, CompletedShowDialog, CompletedCloseDialog, GotTransitionMessage);
|
|
33
36
|
/** Creates an initial dialog model from a config. Defaults to closed and non-animated. */
|
|
34
37
|
export const init = (config) => ({
|
|
35
38
|
id: config.id,
|
|
36
39
|
isOpen: config.isOpen ?? false,
|
|
37
40
|
isAnimated: config.isAnimated ?? false,
|
|
38
|
-
|
|
41
|
+
transition: transitionInit({
|
|
42
|
+
id: `${config.id}-panel`,
|
|
43
|
+
...(config.isOpen !== undefined ? { isShowing: config.isOpen } : {}),
|
|
44
|
+
}),
|
|
39
45
|
maybeFocusSelector: Option.fromNullable(config.focusSelector),
|
|
40
46
|
});
|
|
41
47
|
// UPDATE
|
|
42
48
|
const dialogSelector = (id) => `#${id}`;
|
|
43
|
-
const panelSelector = (id) => `#${id}-panel`;
|
|
44
49
|
const withUpdateReturn = M.withReturnType();
|
|
45
|
-
/** Advances the dialog's enter/leave transition by waiting a double-rAF. */
|
|
46
|
-
export const RequestFrame = Command.define('RequestFrame', AdvancedTransitionFrame);
|
|
47
50
|
/** Locks page scroll and calls `showModal()` on the native dialog element. */
|
|
48
51
|
export const ShowDialog = Command.define('ShowDialog', CompletedShowDialog);
|
|
49
52
|
/** Calls `close()` on the native dialog element and unlocks page scroll. */
|
|
50
53
|
export const CloseDialog = Command.define('CloseDialog', CompletedCloseDialog);
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
const closeDialog = (id) => CloseDialog(Task.closeModal(dialogSelector(id)).pipe(Effect.andThen(() => Task.unlockScroll), Effect.ignore, Effect.as(CompletedCloseDialog())));
|
|
55
|
+
const toParentMessage = (message) => GotTransitionMessage({ message });
|
|
56
|
+
const delegateToTransition = (model, transitionMessage) => {
|
|
57
|
+
const [nextTransition, transitionCommands, maybeOutMessage] = transitionUpdate(model.transition, transitionMessage);
|
|
58
|
+
const mappedCommands = transitionCommands.map(Command.mapEffect(Effect.map(toParentMessage)));
|
|
59
|
+
const additionalCommands = Option.match(maybeOutMessage, {
|
|
60
|
+
onNone: () => [],
|
|
61
|
+
onSome: M.type().pipe(M.tagsExhaustive({
|
|
62
|
+
StartedLeaveAnimating: () => [
|
|
63
|
+
Command.mapEffect(transitionDefaultLeaveCommand(nextTransition), Effect.map(toParentMessage)),
|
|
64
|
+
],
|
|
65
|
+
TransitionedOut: () => [closeDialog(model.id)],
|
|
66
|
+
})),
|
|
67
|
+
});
|
|
68
|
+
return [
|
|
69
|
+
evo(model, { transition: () => nextTransition }),
|
|
70
|
+
[...mappedCommands, ...additionalCommands],
|
|
71
|
+
];
|
|
72
|
+
};
|
|
53
73
|
/** Processes a dialog message and returns the next model and commands. */
|
|
54
|
-
export const update = (model, message) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
74
|
+
export const update = (model, message) => M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
|
|
75
|
+
Opened: () => {
|
|
76
|
+
const focusOptions = Option.match(model.maybeFocusSelector, {
|
|
77
|
+
onNone: () => undefined,
|
|
78
|
+
onSome: focusSelector => ({ focusSelector }),
|
|
79
|
+
});
|
|
80
|
+
const maybeShow = Option.liftPredicate(ShowDialog(Task.lockScroll.pipe(Effect.andThen(() => Task.showModal(dialogSelector(model.id), focusOptions)), Effect.ignore, Effect.as(CompletedShowDialog()))), () => !model.isOpen);
|
|
81
|
+
if (model.isAnimated) {
|
|
82
|
+
const [nextModel, transitionCommands] = delegateToTransition(model, TransitionShowed());
|
|
63
83
|
return [
|
|
64
|
-
evo(
|
|
65
|
-
|
|
66
|
-
transitionState: () => (model.isAnimated ? 'EnterStart' : 'Idle'),
|
|
67
|
-
}),
|
|
68
|
-
Array.getSomes([maybeShow, maybeNextFrame]),
|
|
84
|
+
evo(nextModel, { isOpen: () => true }),
|
|
85
|
+
[...Option.toArray(maybeShow), ...transitionCommands],
|
|
69
86
|
];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
[
|
|
92
|
-
WaitForTransitions(Task.waitForTransitions(panelSelector(model.id)).pipe(Effect.as(EndedTransition()))),
|
|
93
|
-
],
|
|
94
|
-
]), M.when('LeaveStart', () => [
|
|
95
|
-
evo(model, { transitionState: () => 'LeaveAnimating' }),
|
|
96
|
-
[
|
|
97
|
-
WaitForTransitions(Task.waitForTransitions(panelSelector(model.id)).pipe(Effect.as(EndedTransition()))),
|
|
98
|
-
],
|
|
99
|
-
]), M.orElse(() => [model, []])),
|
|
100
|
-
EndedTransition: () => M.value(model.transitionState).pipe(withUpdateReturn, M.when('EnterAnimating', () => [
|
|
101
|
-
evo(model, { transitionState: () => 'Idle' }),
|
|
102
|
-
[],
|
|
103
|
-
]), M.when('LeaveAnimating', () => [
|
|
104
|
-
evo(model, { transitionState: () => 'Idle' }),
|
|
105
|
-
[
|
|
106
|
-
CloseDialog(Task.closeModal(dialogSelector(model.id)).pipe(Effect.andThen(() => Task.unlockScroll), Effect.ignore, Effect.as(CompletedCloseDialog()))),
|
|
107
|
-
],
|
|
108
|
-
]), M.orElse(() => [model, []])),
|
|
109
|
-
CompletedShowDialog: () => [model, []],
|
|
110
|
-
CompletedCloseDialog: () => [model, []],
|
|
111
|
-
}));
|
|
112
|
-
};
|
|
87
|
+
}
|
|
88
|
+
return [evo(model, { isOpen: () => true }), Option.toArray(maybeShow)];
|
|
89
|
+
},
|
|
90
|
+
Closed: () => {
|
|
91
|
+
const { transitionState } = model.transition;
|
|
92
|
+
const isLeaving = transitionState === 'LeaveStart' ||
|
|
93
|
+
transitionState === 'LeaveAnimating';
|
|
94
|
+
if (isLeaving) {
|
|
95
|
+
return [model, []];
|
|
96
|
+
}
|
|
97
|
+
if (model.isAnimated) {
|
|
98
|
+
const [nextModel, transitionCommands] = delegateToTransition(evo(model, { isOpen: () => false }), TransitionHidden());
|
|
99
|
+
return [nextModel, transitionCommands];
|
|
100
|
+
}
|
|
101
|
+
const maybeClose = Option.liftPredicate(closeDialog(model.id), () => model.isOpen);
|
|
102
|
+
return [evo(model, { isOpen: () => false }), Option.toArray(maybeClose)];
|
|
103
|
+
},
|
|
104
|
+
GotTransitionMessage: ({ message: transitionMessage }) => delegateToTransition(model, transitionMessage),
|
|
105
|
+
CompletedShowDialog: () => [model, []],
|
|
106
|
+
CompletedCloseDialog: () => [model, []],
|
|
107
|
+
}));
|
|
113
108
|
// VIEW
|
|
114
109
|
/** Returns the ID used for `aria-labelledby` on the dialog. Apply this to your title element. */
|
|
115
110
|
export const titleId = (model) => `${model.id}-title`;
|
|
@@ -121,7 +116,7 @@ export const close = (model) => update(model, Closed());
|
|
|
121
116
|
/** Renders a headless dialog component backed by the native `<dialog>` element with `showModal()`. */
|
|
122
117
|
export const view = (config) => {
|
|
123
118
|
const { AriaDescribedBy, AriaLabelledBy, Class, DataAttribute, Id, OnCancel, OnClick, Open, Style, keyed, } = html();
|
|
124
|
-
const { model: { id, isOpen, transitionState }, toParentMessage, onClosed, panelContent, panelClassName, panelAttributes = [], backdropClassName, backdropAttributes = [], className, attributes = [], } = config;
|
|
119
|
+
const { model: { id, isOpen, transition: { transitionState }, }, toParentMessage, onClosed, panelContent, panelClassName, panelAttributes = [], backdropClassName, backdropAttributes = [], className, attributes = [], } = config;
|
|
125
120
|
const dispatchClosed = () => onClosed ? onClosed() : toParentMessage(Closed());
|
|
126
121
|
const isLeaving = transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating';
|
|
127
122
|
const isVisible = isOpen || isLeaving;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { init, update, close, view, lazy, titleId, descriptionId, Model, Message, Opened, Closed, CompletedShowDialog, CompletedCloseDialog,
|
|
1
|
+
export { init, update, close, view, lazy, titleId, descriptionId, Model, Message, Opened, Closed, CompletedShowDialog, CompletedCloseDialog, GotTransitionMessage, ShowDialog, CloseDialog, } from './index';
|
|
2
2
|
export type { InitConfig, ViewConfig } from './index';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/dialog/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/dialog/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,aAAa,EACb,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,WAAW,GACZ,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/ui/dialog/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, close, view, lazy, titleId, descriptionId, Model, Message, Opened, Closed, CompletedShowDialog, CompletedCloseDialog,
|
|
1
|
+
export { init, update, close, view, lazy, titleId, descriptionId, Model, Message, Opened, Closed, CompletedShowDialog, CompletedCloseDialog, GotTransitionMessage, ShowDialog, CloseDialog, } from './index';
|
|
@@ -8,7 +8,11 @@ export declare const Model: S.extend<S.Struct<{
|
|
|
8
8
|
isAnimated: typeof S.Boolean;
|
|
9
9
|
isModal: typeof S.Boolean;
|
|
10
10
|
orientation: S.Literal<["Vertical", "Horizontal"]>;
|
|
11
|
-
|
|
11
|
+
transition: S.Struct<{
|
|
12
|
+
id: typeof S.String;
|
|
13
|
+
isShowing: typeof S.Boolean;
|
|
14
|
+
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
15
|
+
}>;
|
|
12
16
|
maybeActiveItemIndex: S.OptionFromSelf<typeof S.Number>;
|
|
13
17
|
activationTrigger: S.Literal<["Pointer", "Keyboard"]>;
|
|
14
18
|
searchQuery: typeof S.String;
|
|
@@ -35,7 +39,11 @@ export declare const update: (model: {
|
|
|
35
39
|
readonly isAnimated: boolean;
|
|
36
40
|
readonly isModal: boolean;
|
|
37
41
|
readonly orientation: "Vertical" | "Horizontal";
|
|
38
|
-
readonly
|
|
42
|
+
readonly transition: {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly isShowing: boolean;
|
|
45
|
+
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
46
|
+
};
|
|
39
47
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
40
48
|
readonly activationTrigger: "Pointer" | "Keyboard";
|
|
41
49
|
readonly searchQuery: string;
|
|
@@ -53,7 +61,11 @@ export declare const update: (model: {
|
|
|
53
61
|
readonly isAnimated: boolean;
|
|
54
62
|
readonly isModal: boolean;
|
|
55
63
|
readonly orientation: "Vertical" | "Horizontal";
|
|
56
|
-
readonly
|
|
64
|
+
readonly transition: {
|
|
65
|
+
readonly id: string;
|
|
66
|
+
readonly isShowing: boolean;
|
|
67
|
+
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
68
|
+
};
|
|
57
69
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
58
70
|
readonly activationTrigger: "Pointer" | "Keyboard";
|
|
59
71
|
readonly searchQuery: string;
|
|
@@ -119,11 +131,16 @@ export declare const update: (model: {
|
|
|
119
131
|
} | {
|
|
120
132
|
readonly _tag: "SuppressedSpaceScroll";
|
|
121
133
|
} | {
|
|
122
|
-
readonly _tag: "
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
134
|
+
readonly _tag: "GotTransitionMessage";
|
|
135
|
+
readonly message: {
|
|
136
|
+
readonly _tag: "Showed";
|
|
137
|
+
} | {
|
|
138
|
+
readonly _tag: "Hidden";
|
|
139
|
+
} | {
|
|
140
|
+
readonly _tag: "AdvancedTransitionFrame";
|
|
141
|
+
} | {
|
|
142
|
+
readonly _tag: "EndedTransition";
|
|
143
|
+
};
|
|
127
144
|
} | {
|
|
128
145
|
readonly _tag: "PressedPointerOnButton";
|
|
129
146
|
readonly button: number;
|
|
@@ -140,7 +157,11 @@ export declare const view: <Message, Item>(config: Readonly<{
|
|
|
140
157
|
readonly isAnimated: boolean;
|
|
141
158
|
readonly isModal: boolean;
|
|
142
159
|
readonly orientation: "Vertical" | "Horizontal";
|
|
143
|
-
readonly
|
|
160
|
+
readonly transition: {
|
|
161
|
+
readonly id: string;
|
|
162
|
+
readonly isShowing: boolean;
|
|
163
|
+
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
164
|
+
};
|
|
144
165
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
145
166
|
readonly activationTrigger: "Pointer" | "Keyboard";
|
|
146
167
|
readonly searchQuery: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/multi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,IAAI,CAAC,EAAQ,MAAM,QAAQ,CAAA;AAEzD,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,YAAY,CAAA;AAElD,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,EAIpB,MAAM,UAAU,CAAA;AAIjB,iKAAiK;AACjK,eAAO,MAAM,KAAK
|
|
1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AAiB,GAAG,gBAAgB,CAC/C,KACA,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,iBAAiB,CAAC,KACrE,IAAI,CAoBR,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { init, update, selectItem, view, lazy, Model } from './single';
|
|
2
|
-
export { Message, Orientation, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusButton, CompletedFocusItems, CompletedScrollIntoView, CompletedClickItem, ClearedSearch,
|
|
3
|
-
export { TransitionState } from '../transition';
|
|
2
|
+
export { Message, Orientation, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusButton, CompletedFocusItems, CompletedScrollIntoView, CompletedClickItem, ClearedSearch, GotTransitionMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusButton, FocusItems, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrTransitionEnd, } from './shared';
|
|
4
3
|
export type { ActivationTrigger, Opened, Closed, ClosedByTab, ActivatedItem, DeactivatedItem, MovedPointerOverItem, RequestedItemClick, Searched, PressedPointerOnButton, IgnoredMouseClick, SuppressedSpaceScroll, ItemConfig, GroupHeading, } from './shared';
|
|
5
4
|
export type { InitConfig, ViewConfig } from './single';
|
|
6
5
|
export type { AnchorConfig } from '../anchor';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEtE,OAAO,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEtE,OAAO,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,6BAA6B,GAC9B,MAAM,UAAU,CAAA;AAEjB,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,WAAW,EACX,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,EACR,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,YAAY,GACb,MAAM,UAAU,CAAA;AAEjB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEtD,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { init, update, selectItem, view, lazy, Model } from './single';
|
|
2
|
-
export { Message, Orientation, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusButton, CompletedFocusItems, CompletedScrollIntoView, CompletedClickItem, ClearedSearch,
|
|
3
|
-
export { TransitionState } from '../transition';
|
|
2
|
+
export { Message, Orientation, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusButton, CompletedFocusItems, CompletedScrollIntoView, CompletedClickItem, ClearedSearch, GotTransitionMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusButton, FocusItems, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrTransitionEnd, } from './shared';
|
|
4
3
|
export * as Multi from './multiPublic';
|
|
@@ -17,7 +17,11 @@ export declare const BaseModel: S.Struct<{
|
|
|
17
17
|
isAnimated: typeof S.Boolean;
|
|
18
18
|
isModal: typeof S.Boolean;
|
|
19
19
|
orientation: S.Literal<["Vertical", "Horizontal"]>;
|
|
20
|
-
|
|
20
|
+
transition: S.Struct<{
|
|
21
|
+
id: typeof S.String;
|
|
22
|
+
isShowing: typeof S.Boolean;
|
|
23
|
+
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
24
|
+
}>;
|
|
21
25
|
maybeActiveItemIndex: S.OptionFromSelf<typeof S.Number>;
|
|
22
26
|
activationTrigger: S.Literal<["Pointer", "Keyboard"]>;
|
|
23
27
|
searchQuery: typeof S.String;
|
|
@@ -96,12 +100,10 @@ export declare const CompletedClickItem: import("../../schema").CallableTaggedSt
|
|
|
96
100
|
export declare const IgnoredMouseClick: import("../../schema").CallableTaggedStruct<"IgnoredMouseClick", {}>;
|
|
97
101
|
/** Sent when a Space key-up is captured to prevent page scrolling. */
|
|
98
102
|
export declare const SuppressedSpaceScroll: import("../../schema").CallableTaggedStruct<"SuppressedSpaceScroll", {}>;
|
|
99
|
-
/**
|
|
100
|
-
export declare const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
/** Sent internally when the listbox button moves in the viewport during a leave transition, cancelling the animation. */
|
|
104
|
-
export declare const DetectedButtonMovement: import("../../schema").CallableTaggedStruct<"DetectedButtonMovement", {}>;
|
|
103
|
+
/** Wraps a Transition submodel message for delegation. */
|
|
104
|
+
export declare const GotTransitionMessage: import("../../schema").CallableTaggedStruct<"GotTransitionMessage", {
|
|
105
|
+
message: S.Union<[import("../../schema").CallableTaggedStruct<"Showed", {}>, import("../../schema").CallableTaggedStruct<"Hidden", {}>, import("../../schema").CallableTaggedStruct<"AdvancedTransitionFrame", {}>, import("../../schema").CallableTaggedStruct<"EndedTransition", {}>]>;
|
|
106
|
+
}>;
|
|
105
107
|
/** Sent when the user presses a pointer device on the listbox button. Records pointer type for click handling. */
|
|
106
108
|
export declare const PressedPointerOnButton: import("../../schema").CallableTaggedStruct<"PressedPointerOnButton", {
|
|
107
109
|
pointerType: typeof S.String;
|
|
@@ -129,9 +131,7 @@ export declare const Message: S.Union<[
|
|
|
129
131
|
typeof CompletedClickItem,
|
|
130
132
|
typeof IgnoredMouseClick,
|
|
131
133
|
typeof SuppressedSpaceScroll,
|
|
132
|
-
typeof
|
|
133
|
-
typeof EndedTransition,
|
|
134
|
-
typeof DetectedButtonMovement,
|
|
134
|
+
typeof GotTransitionMessage,
|
|
135
135
|
typeof PressedPointerOnButton
|
|
136
136
|
]>;
|
|
137
137
|
export type Opened = typeof Opened.Type;
|
|
@@ -146,9 +146,6 @@ export type Searched = typeof Searched.Type;
|
|
|
146
146
|
export type ClearedSearch = typeof ClearedSearch.Type;
|
|
147
147
|
export type IgnoredMouseClick = typeof IgnoredMouseClick.Type;
|
|
148
148
|
export type SuppressedSpaceScroll = typeof SuppressedSpaceScroll.Type;
|
|
149
|
-
export type AdvancedTransitionFrame = typeof AdvancedTransitionFrame.Type;
|
|
150
|
-
export type EndedTransition = typeof EndedTransition.Type;
|
|
151
|
-
export type DetectedButtonMovement = typeof DetectedButtonMovement.Type;
|
|
152
149
|
export type PressedPointerOnButton = typeof PressedPointerOnButton.Type;
|
|
153
150
|
export type Message = typeof Message.Type;
|
|
154
151
|
export declare const SEARCH_DEBOUNCE_MILLISECONDS = 350;
|
|
@@ -158,15 +155,9 @@ export declare const itemsSelector: (id: string) => string;
|
|
|
158
155
|
export declare const itemSelector: (id: string, index: number) => string;
|
|
159
156
|
export declare const itemId: (id: string, index: number) => string;
|
|
160
157
|
export declare const closedModel: <Model extends BaseModel>(model: Model) => Model;
|
|
161
|
-
type SelectedItemContext = Readonly<{
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
maybeUnlockScroll: Option.Option<Command.Command<Message>>;
|
|
165
|
-
maybeRestoreInert: Option.Option<Command.Command<Message>>;
|
|
166
|
-
}>;
|
|
167
|
-
/** Advances the listbox's enter/leave transition by waiting a double-rAF. */
|
|
168
|
-
export declare const RequestFrame: Command.CommandDefinition<"RequestFrame", {
|
|
169
|
-
readonly _tag: "AdvancedTransitionFrame";
|
|
158
|
+
type SelectedItemContext<Model extends BaseModel> = Readonly<{
|
|
159
|
+
closeWithFocus: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
160
|
+
closeWithoutFocus: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
170
161
|
}>;
|
|
171
162
|
/** Prevents page scrolling while the listbox is open in modal mode. */
|
|
172
163
|
export declare const LockScroll: Command.CommandDefinition<"LockScroll", {
|
|
@@ -205,17 +196,20 @@ export declare const DelayClearSearch: Command.CommandDefinition<"DelayClearSear
|
|
|
205
196
|
readonly _tag: "ClearedSearch";
|
|
206
197
|
readonly version: number;
|
|
207
198
|
}>;
|
|
208
|
-
/**
|
|
209
|
-
export declare const WaitForTransitions: Command.CommandDefinition<"WaitForTransitions", {
|
|
210
|
-
readonly _tag: "EndedTransition";
|
|
211
|
-
}>;
|
|
212
|
-
/** Detects whether the listbox button moved or the leave transition ended — whichever comes first. */
|
|
199
|
+
/** Detects whether the listbox button moved or the leave transition ended — whichever comes first. Both outcomes signal the Transition submodel that leave is complete. */
|
|
213
200
|
export declare const DetectMovementOrTransitionEnd: Command.CommandDefinition<"DetectMovementOrTransitionEnd", {
|
|
214
|
-
readonly _tag: "
|
|
215
|
-
|
|
216
|
-
|
|
201
|
+
readonly _tag: "GotTransitionMessage";
|
|
202
|
+
readonly message: {
|
|
203
|
+
readonly _tag: "Showed";
|
|
204
|
+
} | {
|
|
205
|
+
readonly _tag: "Hidden";
|
|
206
|
+
} | {
|
|
207
|
+
readonly _tag: "AdvancedTransitionFrame";
|
|
208
|
+
} | {
|
|
209
|
+
readonly _tag: "EndedTransition";
|
|
210
|
+
};
|
|
217
211
|
}>;
|
|
218
|
-
export declare const makeUpdate: <Model extends BaseModel>(handleSelectedItem: (model: Model, item: string, context: SelectedItemContext) => [Model, ReadonlyArray<Command.Command<Message>>]) => (model: Model, message: Message) => readonly [Model, readonly Readonly<{
|
|
212
|
+
export declare const makeUpdate: <Model extends BaseModel>(handleSelectedItem: (model: Model, item: string, context: SelectedItemContext<Model>) => [Model, ReadonlyArray<Command.Command<Message>>]) => (model: Model, message: Message) => readonly [Model, readonly Readonly<{
|
|
219
213
|
name: string;
|
|
220
214
|
effect: Effect.Effect<{
|
|
221
215
|
readonly _tag: "Opened";
|
|
@@ -269,11 +263,16 @@ export declare const makeUpdate: <Model extends BaseModel>(handleSelectedItem: (
|
|
|
269
263
|
} | {
|
|
270
264
|
readonly _tag: "SuppressedSpaceScroll";
|
|
271
265
|
} | {
|
|
272
|
-
readonly _tag: "
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
266
|
+
readonly _tag: "GotTransitionMessage";
|
|
267
|
+
readonly message: {
|
|
268
|
+
readonly _tag: "Showed";
|
|
269
|
+
} | {
|
|
270
|
+
readonly _tag: "Hidden";
|
|
271
|
+
} | {
|
|
272
|
+
readonly _tag: "AdvancedTransitionFrame";
|
|
273
|
+
} | {
|
|
274
|
+
readonly _tag: "EndedTransition";
|
|
275
|
+
};
|
|
277
276
|
} | {
|
|
278
277
|
readonly _tag: "PressedPointerOnButton";
|
|
279
278
|
readonly button: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/shared.ts"],"names":[],"mappings":"A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