foldkit 0.70.0 → 0.72.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/dist/task/index.d.ts +1 -1
- package/dist/task/index.d.ts.map +1 -1
- package/dist/task/index.js +1 -1
- package/dist/task/public.d.ts +1 -1
- package/dist/task/public.d.ts.map +1 -1
- package/dist/task/public.js +1 -1
- package/dist/task/timing.d.ts +9 -5
- package/dist/task/timing.d.ts.map +1 -1
- package/dist/task/timing.js +11 -11
- package/dist/test/apps/disabledButton.d.ts +5 -5
- package/dist/ui/{transition → animation}/index.d.ts +9 -8
- package/dist/ui/animation/index.d.ts.map +1 -0
- package/dist/ui/{transition → animation}/index.js +8 -7
- package/dist/ui/animation/public.d.ts +3 -0
- package/dist/ui/animation/public.d.ts.map +1 -0
- package/dist/ui/animation/public.js +1 -0
- package/dist/ui/{transition → animation}/schema.d.ts +14 -14
- package/dist/ui/animation/schema.d.ts.map +1 -0
- package/dist/ui/animation/schema.js +35 -0
- package/dist/ui/{transition → animation}/update.d.ts +7 -7
- package/dist/ui/animation/update.d.ts.map +1 -0
- package/dist/ui/{transition → animation}/update.js +12 -12
- package/dist/ui/combobox/multi.d.ts +7 -7
- package/dist/ui/combobox/public.d.ts +1 -1
- package/dist/ui/combobox/public.d.ts.map +1 -1
- package/dist/ui/combobox/public.js +1 -1
- package/dist/ui/combobox/shared.d.ts +13 -13
- package/dist/ui/combobox/shared.d.ts.map +1 -1
- package/dist/ui/combobox/shared.js +31 -31
- package/dist/ui/combobox/single.d.ts +7 -7
- package/dist/ui/datePicker/index.d.ts +3 -3
- package/dist/ui/dialog/index.d.ts +7 -7
- package/dist/ui/dialog/index.d.ts.map +1 -1
- package/dist/ui/dialog/index.js +28 -28
- 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/index.d.ts +2 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +2 -1
- package/dist/ui/listbox/multi.d.ts +7 -7
- package/dist/ui/listbox/public.d.ts +1 -1
- package/dist/ui/listbox/public.d.ts.map +1 -1
- package/dist/ui/listbox/public.js +1 -1
- package/dist/ui/listbox/shared.d.ts +13 -13
- package/dist/ui/listbox/shared.d.ts.map +1 -1
- package/dist/ui/listbox/shared.js +29 -29
- package/dist/ui/listbox/single.d.ts +7 -7
- package/dist/ui/menu/index.d.ts +11 -11
- package/dist/ui/menu/index.d.ts.map +1 -1
- package/dist/ui/menu/index.js +29 -29
- package/dist/ui/menu/public.d.ts +1 -1
- package/dist/ui/menu/public.d.ts.map +1 -1
- package/dist/ui/menu/public.js +1 -1
- package/dist/ui/popover/index.d.ts +12 -12
- package/dist/ui/popover/index.d.ts.map +1 -1
- package/dist/ui/popover/index.js +30 -30
- package/dist/ui/popover/public.d.ts +1 -1
- package/dist/ui/popover/public.d.ts.map +1 -1
- package/dist/ui/popover/public.js +1 -1
- package/dist/ui/toast/index.d.ts +620 -0
- package/dist/ui/toast/index.d.ts.map +1 -0
- package/dist/ui/toast/index.js +158 -0
- package/dist/ui/toast/public.d.ts +4 -0
- package/dist/ui/toast/public.d.ts.map +1 -0
- package/dist/ui/toast/public.js +1 -0
- package/dist/ui/toast/schema.d.ts +143 -0
- package/dist/ui/toast/schema.d.ts.map +1 -0
- package/dist/ui/toast/schema.js +71 -0
- package/dist/ui/toast/update.d.ts +484 -0
- package/dist/ui/toast/update.d.ts.map +1 -0
- package/dist/ui/toast/update.js +203 -0
- package/package.json +9 -5
- package/dist/ui/transition/index.d.ts.map +0 -1
- package/dist/ui/transition/public.d.ts +0 -3
- package/dist/ui/transition/public.d.ts.map +0 -1
- package/dist/ui/transition/public.js +0 -1
- package/dist/ui/transition/schema.d.ts.map +0 -1
- package/dist/ui/transition/schema.js +0 -35
- package/dist/ui/transition/update.d.ts.map +0 -1
|
@@ -2,14 +2,14 @@ import { Schema as S } from 'effect';
|
|
|
2
2
|
import * as Command from '../../command';
|
|
3
3
|
import { type Attribute, type Html } from '../../html';
|
|
4
4
|
import type { AnchorConfig } from '../anchor';
|
|
5
|
-
/** Schema for the popover component's state, tracking open/closed status and
|
|
5
|
+
/** Schema for the popover component's state, tracking open/closed status and animation lifecycle. */
|
|
6
6
|
export declare const Model: S.Struct<{
|
|
7
7
|
id: typeof S.String;
|
|
8
8
|
isOpen: typeof S.Boolean;
|
|
9
9
|
isAnimated: typeof S.Boolean;
|
|
10
10
|
isModal: typeof S.Boolean;
|
|
11
11
|
contentFocus: typeof S.Boolean;
|
|
12
|
-
|
|
12
|
+
animation: S.Struct<{
|
|
13
13
|
id: typeof S.String;
|
|
14
14
|
isShowing: typeof S.Boolean;
|
|
15
15
|
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
@@ -44,9 +44,9 @@ export declare const CompletedTeardownInert: import("../../schema").CallableTagg
|
|
|
44
44
|
export declare const IgnoredMouseClick: import("../../schema").CallableTaggedStruct<"IgnoredMouseClick", {}>;
|
|
45
45
|
/** Sent when a Space key-up is captured to prevent page scrolling. */
|
|
46
46
|
export declare const SuppressedSpaceScroll: import("../../schema").CallableTaggedStruct<"SuppressedSpaceScroll", {}>;
|
|
47
|
-
/** Wraps
|
|
48
|
-
export declare const
|
|
49
|
-
message: S.Union<[import("../../schema").CallableTaggedStruct<"Showed", {}>, import("../../schema").CallableTaggedStruct<"Hid", {}>, import("../../schema").CallableTaggedStruct<"
|
|
47
|
+
/** Wraps an Animation submodel message for delegation. */
|
|
48
|
+
export declare const GotAnimationMessage: import("../../schema").CallableTaggedStruct<"GotAnimationMessage", {
|
|
49
|
+
message: S.Union<[import("../../schema").CallableTaggedStruct<"Showed", {}>, import("../../schema").CallableTaggedStruct<"Hid", {}>, import("../../schema").CallableTaggedStruct<"AdvancedAnimationFrame", {}>, import("../../schema").CallableTaggedStruct<"EndedAnimation", {}>]>;
|
|
50
50
|
}>;
|
|
51
51
|
/** Union of all messages the popover component can produce. */
|
|
52
52
|
export declare const Message: S.Union<[
|
|
@@ -62,7 +62,7 @@ export declare const Message: S.Union<[
|
|
|
62
62
|
typeof CompletedTeardownInert,
|
|
63
63
|
typeof IgnoredMouseClick,
|
|
64
64
|
typeof SuppressedSpaceScroll,
|
|
65
|
-
typeof
|
|
65
|
+
typeof GotAnimationMessage
|
|
66
66
|
]>;
|
|
67
67
|
export type Opened = typeof Opened.Type;
|
|
68
68
|
export type Closed = typeof Closed.Type;
|
|
@@ -71,7 +71,7 @@ export type PressedPointerOnButton = typeof PressedPointerOnButton.Type;
|
|
|
71
71
|
export type IgnoredMouseClick = typeof IgnoredMouseClick.Type;
|
|
72
72
|
export type SuppressedSpaceScroll = typeof SuppressedSpaceScroll.Type;
|
|
73
73
|
export type Message = typeof Message.Type;
|
|
74
|
-
/** Configuration for creating a popover model with `init`. `isAnimated` enables
|
|
74
|
+
/** Configuration for creating a popover model with `init`. `isAnimated` enables animation coordination (default `false`). `isModal` locks page scroll and inerts other elements when open (default `false`). `contentFocus` hands focus ownership to the consumer — the panel is not focusable and does not close on blur, so the consumer must focus a descendant on open and close the popover on its own blur rules (default `false`). */
|
|
75
75
|
export type InitConfig = Readonly<{
|
|
76
76
|
id: string;
|
|
77
77
|
isAnimated?: boolean;
|
|
@@ -105,17 +105,17 @@ export declare const FocusPanel: Command.CommandDefinition<"FocusPanel", {
|
|
|
105
105
|
export declare const FocusButton: Command.CommandDefinition<"FocusButton", {
|
|
106
106
|
readonly _tag: "CompletedFocusButton";
|
|
107
107
|
}>;
|
|
108
|
-
/** Detects whether the popover button moved or the leave
|
|
109
|
-
export declare const
|
|
110
|
-
readonly _tag: "
|
|
108
|
+
/** Detects whether the popover button moved or the leave animation ended — whichever comes first. Both outcomes signal the Animation submodel that leave is complete. */
|
|
109
|
+
export declare const DetectMovementOrAnimationEnd: Command.CommandDefinition<"DetectMovementOrAnimationEnd", {
|
|
110
|
+
readonly _tag: "GotAnimationMessage";
|
|
111
111
|
readonly message: {
|
|
112
112
|
readonly _tag: "Showed";
|
|
113
113
|
} | {
|
|
114
114
|
readonly _tag: "Hid";
|
|
115
115
|
} | {
|
|
116
|
-
readonly _tag: "
|
|
116
|
+
readonly _tag: "AdvancedAnimationFrame";
|
|
117
117
|
} | {
|
|
118
|
-
readonly _tag: "
|
|
118
|
+
readonly _tag: "EndedAnimation";
|
|
119
119
|
};
|
|
120
120
|
}>;
|
|
121
121
|
/** Processes a popover message and returns the next model and commands. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE9E,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAoB,MAAM,YAAY,CAAA;AAKxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAiB7C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE9E,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAoB,MAAM,YAAY,CAAA;AAKxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAiB7C,qGAAqG;AACrG,eAAO,MAAM,KAAK;;;;;;;;;;;;EAQhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,2EAA2E;AAC3E,eAAO,MAAM,MAAM,2DAAc,CAAA;AACjC,kGAAkG;AAClG,eAAO,MAAM,MAAM,2DAAc,CAAA;AACjC,iGAAiG;AACjG,eAAO,MAA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AC,OAAO,CAAC,EACnB,OAAO,GAAG,iBAAiB,GAAG,UAAU,GAAG,UAAU,CACtD,KACA,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,KACpD,IAAI,CAgBR,CAAA"}
|
package/dist/ui/popover/index.js
CHANGED
|
@@ -6,20 +6,20 @@ import { m } from '../../message';
|
|
|
6
6
|
import { evo } from '../../struct';
|
|
7
7
|
import * as Task from '../../task';
|
|
8
8
|
import { anchorHooks } from '../anchor';
|
|
9
|
-
// NOTE:
|
|
10
|
-
// dependency:
|
|
11
|
-
// The barrel (../
|
|
12
|
-
import {
|
|
13
|
-
import { update as
|
|
9
|
+
// NOTE: Animation imports are split across schema + update to avoid a circular
|
|
10
|
+
// dependency: animation → html → runtime → devtools → popover → animation.
|
|
11
|
+
// The barrel (../animation) imports from html, which starts the cycle.
|
|
12
|
+
import { EndedAnimation as AnimationEndedAnimation, Hid as AnimationHid, Message as AnimationMessage, Model as AnimationModel, Showed as AnimationShowed, init as animationInit, } from '../animation/schema';
|
|
13
|
+
import { update as animationUpdate } from '../animation/update';
|
|
14
14
|
// MODEL
|
|
15
|
-
/** Schema for the popover component's state, tracking open/closed status and
|
|
15
|
+
/** Schema for the popover component's state, tracking open/closed status and animation lifecycle. */
|
|
16
16
|
export const Model = S.Struct({
|
|
17
17
|
id: S.String,
|
|
18
18
|
isOpen: S.Boolean,
|
|
19
19
|
isAnimated: S.Boolean,
|
|
20
20
|
isModal: S.Boolean,
|
|
21
21
|
contentFocus: S.Boolean,
|
|
22
|
-
|
|
22
|
+
animation: AnimationModel,
|
|
23
23
|
maybeLastButtonPointerType: S.OptionFromSelf(S.String),
|
|
24
24
|
});
|
|
25
25
|
// MESSAGE
|
|
@@ -50,12 +50,12 @@ export const CompletedTeardownInert = m('CompletedTeardownInert');
|
|
|
50
50
|
export const IgnoredMouseClick = m('IgnoredMouseClick');
|
|
51
51
|
/** Sent when a Space key-up is captured to prevent page scrolling. */
|
|
52
52
|
export const SuppressedSpaceScroll = m('SuppressedSpaceScroll');
|
|
53
|
-
/** Wraps
|
|
54
|
-
export const
|
|
55
|
-
message:
|
|
53
|
+
/** Wraps an Animation submodel message for delegation. */
|
|
54
|
+
export const GotAnimationMessage = m('GotAnimationMessage', {
|
|
55
|
+
message: AnimationMessage,
|
|
56
56
|
});
|
|
57
57
|
/** Union of all messages the popover component can produce. */
|
|
58
|
-
export const Message = S.Union(Opened, Closed, ClosedByTab, PressedPointerOnButton, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, IgnoredMouseClick, SuppressedSpaceScroll,
|
|
58
|
+
export const Message = S.Union(Opened, Closed, ClosedByTab, PressedPointerOnButton, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, IgnoredMouseClick, SuppressedSpaceScroll, GotAnimationMessage);
|
|
59
59
|
// INIT
|
|
60
60
|
const LEFT_MOUSE_BUTTON = 0;
|
|
61
61
|
/** Creates an initial popover model from a config. Defaults to closed. */
|
|
@@ -65,7 +65,7 @@ export const init = (config) => ({
|
|
|
65
65
|
isAnimated: config.isAnimated ?? false,
|
|
66
66
|
isModal: config.isModal ?? false,
|
|
67
67
|
contentFocus: config.contentFocus ?? false,
|
|
68
|
-
|
|
68
|
+
animation: animationInit({ id: `${config.id}-panel` }),
|
|
69
69
|
maybeLastButtonPointerType: Option.none(),
|
|
70
70
|
});
|
|
71
71
|
// UPDATE
|
|
@@ -88,26 +88,26 @@ export const RestoreInert = Command.define('RestoreInert', CompletedTeardownIner
|
|
|
88
88
|
export const FocusPanel = Command.define('FocusPanel', CompletedFocusPanel);
|
|
89
89
|
/** Moves focus back to the popover button after closing. */
|
|
90
90
|
export const FocusButton = Command.define('FocusButton', CompletedFocusButton);
|
|
91
|
-
/** Detects whether the popover button moved or the leave
|
|
92
|
-
export const
|
|
93
|
-
const
|
|
94
|
-
const [
|
|
95
|
-
const mappedCommands =
|
|
91
|
+
/** Detects whether the popover button moved or the leave animation ended — whichever comes first. Both outcomes signal the Animation submodel that leave is complete. */
|
|
92
|
+
export const DetectMovementOrAnimationEnd = Command.define('DetectMovementOrAnimationEnd', GotAnimationMessage);
|
|
93
|
+
const delegateToAnimation = (model, animationMessage) => {
|
|
94
|
+
const [nextAnimation, animationCommands, maybeOutMessage] = animationUpdate(model.animation, animationMessage);
|
|
95
|
+
const mappedCommands = animationCommands.map(Command.mapEffect(Effect.map(message => GotAnimationMessage({ message }))));
|
|
96
96
|
const additionalCommands = Option.match(maybeOutMessage, {
|
|
97
97
|
onNone: () => [],
|
|
98
98
|
onSome: M.type().pipe(M.tagsExhaustive({
|
|
99
99
|
StartedLeaveAnimating: () => [
|
|
100
|
-
|
|
101
|
-
message:
|
|
102
|
-
}))), Task.
|
|
103
|
-
message:
|
|
100
|
+
DetectMovementOrAnimationEnd(Effect.raceFirst(Task.detectElementMovement(buttonSelector(model.id)).pipe(Effect.as(GotAnimationMessage({
|
|
101
|
+
message: AnimationEndedAnimation(),
|
|
102
|
+
}))), Task.waitForAnimationSettled(panelSelector(model.id)).pipe(Effect.as(GotAnimationMessage({
|
|
103
|
+
message: AnimationEndedAnimation(),
|
|
104
104
|
}))))),
|
|
105
105
|
],
|
|
106
106
|
TransitionedOut: () => [],
|
|
107
107
|
})),
|
|
108
108
|
});
|
|
109
109
|
return [
|
|
110
|
-
evo(model, {
|
|
110
|
+
evo(model, { animation: () => nextAnimation }),
|
|
111
111
|
[...mappedCommands, ...additionalCommands],
|
|
112
112
|
];
|
|
113
113
|
};
|
|
@@ -132,10 +132,10 @@ export const update = (model, message) => {
|
|
|
132
132
|
]);
|
|
133
133
|
const openPopover = (baseModel) => {
|
|
134
134
|
if (model.isAnimated) {
|
|
135
|
-
const [nextModel,
|
|
135
|
+
const [nextModel, animationCommands] = delegateToAnimation(baseModel, AnimationShowed());
|
|
136
136
|
return [
|
|
137
137
|
evo(nextModel, { isOpen: () => true }),
|
|
138
|
-
[...openCommands, ...
|
|
138
|
+
[...openCommands, ...animationCommands],
|
|
139
139
|
];
|
|
140
140
|
}
|
|
141
141
|
return [evo(baseModel, { isOpen: () => true }), openCommands];
|
|
@@ -143,8 +143,8 @@ export const update = (model, message) => {
|
|
|
143
143
|
const closePopover = (baseModel, commands) => {
|
|
144
144
|
const closed = closedModel(baseModel);
|
|
145
145
|
if (model.isAnimated) {
|
|
146
|
-
const [nextModel,
|
|
147
|
-
return [nextModel, [...commands, ...
|
|
146
|
+
const [nextModel, animationCommands] = delegateToAnimation(closed, AnimationHid());
|
|
147
|
+
return [nextModel, [...commands, ...animationCommands]];
|
|
148
148
|
}
|
|
149
149
|
return [closed, commands];
|
|
150
150
|
};
|
|
@@ -175,7 +175,7 @@ export const update = (model, message) => {
|
|
|
175
175
|
}
|
|
176
176
|
return openPopover(withPointerType);
|
|
177
177
|
},
|
|
178
|
-
|
|
178
|
+
GotAnimationMessage: ({ message: animationMessage }) => delegateToAnimation(model, animationMessage),
|
|
179
179
|
CompletedFocusPanel: () => [model, []],
|
|
180
180
|
CompletedFocusButton: () => [model, []],
|
|
181
181
|
CompletedLockScroll: () => [model, []],
|
|
@@ -198,12 +198,12 @@ export const close = (model) => update(model, Closed());
|
|
|
198
198
|
/** Renders a headless popover with a trigger button and a floating panel. Uses the disclosure ARIA pattern (aria-expanded + aria-controls) with no role on the panel. */
|
|
199
199
|
export const view = (config) => {
|
|
200
200
|
const { div, AriaControls, AriaDisabled, AriaExpanded, Class, DataAttribute, Id, OnBlur, OnClick, OnDestroy, OnInsert, OnKeyDownPreventDefault, OnKeyUpPreventDefault, OnPointerDown, Style, Tabindex, Type, keyed, } = html();
|
|
201
|
-
const { model: { id, isOpen, contentFocus,
|
|
201
|
+
const { model: { id, isOpen, contentFocus, animation: { transitionState }, maybeLastButtonPointerType, }, toParentMessage, onOpened, onClosed, anchor, buttonContent, buttonClassName, buttonAttributes = [], panelContent, panelClassName, panelAttributes = [], backdropClassName, backdropAttributes = [], isDisabled, focusSelector, className, attributes = [], } = config;
|
|
202
202
|
const dispatchOpened = () => onOpened ? onOpened() : toParentMessage(Opened());
|
|
203
203
|
const dispatchClosed = () => onClosed ? onClosed() : toParentMessage(Closed());
|
|
204
204
|
const isLeaving = transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating';
|
|
205
205
|
const isVisible = isOpen || isLeaving;
|
|
206
|
-
const
|
|
206
|
+
const animationAttributes = M.value(transitionState).pipe(M.when('EnterStart', () => [
|
|
207
207
|
DataAttribute('closed', ''),
|
|
208
208
|
DataAttribute('enter', ''),
|
|
209
209
|
DataAttribute('transition', ''),
|
|
@@ -275,7 +275,7 @@ export const view = (config) => {
|
|
|
275
275
|
Id(`${id}-panel`),
|
|
276
276
|
...(contentFocus ? [] : [Tabindex(0)]),
|
|
277
277
|
...anchorAttributes,
|
|
278
|
-
...
|
|
278
|
+
...animationAttributes,
|
|
279
279
|
...(isLeaving
|
|
280
280
|
? []
|
|
281
281
|
: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { init, update, open, close, view, lazy, Model, Message, Opened, Closed, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert,
|
|
1
|
+
export { init, update, open, close, view, lazy, Model, Message, Opened, Closed, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, } from './index';
|
|
2
2
|
export type { ClosedByTab, PressedPointerOnButton, IgnoredMouseClick, SuppressedSpaceScroll, InitConfig, ViewConfig, } from './index';
|
|
3
3
|
export type { AnchorConfig } from '../anchor';
|
|
4
4
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/popover/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/popover/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,4BAA4B,GAC7B,MAAM,SAAS,CAAA;AAEhB,YAAY,EACV,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,UAAU,GACX,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, open, close, view, lazy, Model, Message, Opened, Closed, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert,
|
|
1
|
+
export { init, update, open, close, view, lazy, Model, Message, Opened, Closed, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, } from './index';
|