foldkit 0.71.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 +1 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -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 +44 -44
- package/dist/ui/toast/index.d.ts.map +1 -1
- package/dist/ui/toast/index.js +7 -7
- package/dist/ui/toast/public.d.ts +1 -1
- package/dist/ui/toast/public.d.ts.map +1 -1
- package/dist/ui/toast/public.js +1 -1
- package/dist/ui/toast/schema.d.ts +11 -11
- package/dist/ui/toast/schema.d.ts.map +1 -1
- package/dist/ui/toast/schema.js +7 -7
- package/dist/ui/toast/update.d.ts +35 -35
- package/dist/ui/toast/update.d.ts.map +1 -1
- package/dist/ui/toast/update.js +16 -16
- package/package.json +5 -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
package/dist/ui/toast/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Match as M } from 'effect';
|
|
2
2
|
import { createLazy, html } from '../../html';
|
|
3
|
-
import { Dismissed, DismissedAll, ElapsedDuration,
|
|
3
|
+
import { Dismissed, DismissedAll, ElapsedDuration, GotAnimationMessage, HoveredEntry, LeftEntry, Position, Variant, } from './schema';
|
|
4
4
|
import { DismissAfter, makeRuntime } from './update';
|
|
5
|
-
export { Variant, Position, Dismissed, DismissedAll, ElapsedDuration, HoveredEntry, LeftEntry,
|
|
5
|
+
export { Variant, Position, Dismissed, DismissedAll, ElapsedDuration, HoveredEntry, LeftEntry, GotAnimationMessage, DismissAfter, };
|
|
6
6
|
const variantToRole = (variant) => M.value(variant).pipe(M.withReturnType(), M.when('Info', () => 'status'), M.when('Success', () => 'status'), M.when('Warning', () => 'alert'), M.when('Error', () => 'alert'), M.exhaustive);
|
|
7
7
|
const positionToContainerStyle = (position) => {
|
|
8
8
|
const base = {
|
|
@@ -58,7 +58,7 @@ const DEFAULT_ARIA_LABEL = 'Notifications';
|
|
|
58
58
|
* The payload is whatever content shape the consumer supplies via Schema.
|
|
59
59
|
* The component never reads it — it flows through to `renderEntry`. The
|
|
60
60
|
* component itself owns only lifecycle and a11y fields (id, variant,
|
|
61
|
-
*
|
|
61
|
+
* animation, dismiss timer, hover state).
|
|
62
62
|
*
|
|
63
63
|
* Consume the bound module's exports everywhere — `Toast.Model` in your app
|
|
64
64
|
* Model, `Toast.Message` in your parent Message union, `Toast.show` /
|
|
@@ -84,7 +84,7 @@ export const make = (payloadSchema) => {
|
|
|
84
84
|
/** Renders a headless toast stack. The `<ol>` container is always present
|
|
85
85
|
* in the DOM so screen readers can observe its `aria-live` region from
|
|
86
86
|
* page load. Each entry becomes an `<li>` keyed by its id, with
|
|
87
|
-
*
|
|
87
|
+
* animation data attributes (`data-enter`, `data-leave`,
|
|
88
88
|
* `data-transition`, `data-closed`) and `data-variant` reflecting the
|
|
89
89
|
* entry's variant. */
|
|
90
90
|
const view = (config) => {
|
|
@@ -100,8 +100,8 @@ export const make = (payloadSchema) => {
|
|
|
100
100
|
...attributes,
|
|
101
101
|
];
|
|
102
102
|
const renderEntryItem = (entry) => {
|
|
103
|
-
const { transitionState } = entry.
|
|
104
|
-
const
|
|
103
|
+
const { transitionState } = entry.animation;
|
|
104
|
+
const animationAttributes = M.value(transitionState).pipe(M.when('EnterStart', () => [
|
|
105
105
|
DataAttribute('closed', ''),
|
|
106
106
|
DataAttribute('enter', ''),
|
|
107
107
|
DataAttribute('transition', ''),
|
|
@@ -127,7 +127,7 @@ export const make = (payloadSchema) => {
|
|
|
127
127
|
Style({ pointerEvents: 'auto' }),
|
|
128
128
|
OnMouseEnter(toParentMessage(HoveredEntry({ entryId: entry.id }))),
|
|
129
129
|
OnMouseLeave(toParentMessage(LeftEntry({ entryId: entry.id }))),
|
|
130
|
-
...
|
|
130
|
+
...animationAttributes,
|
|
131
131
|
...(entryClassName ? [Class(entryClassName)] : []),
|
|
132
132
|
...entryAttributes,
|
|
133
133
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { make, Variant, Position, Dismissed, DismissedAll, ElapsedDuration, HoveredEntry, LeftEntry,
|
|
1
|
+
export { make, Variant, Position, Dismissed, DismissedAll, ElapsedDuration, HoveredEntry, LeftEntry, GotAnimationMessage, DismissAfter, } from './index';
|
|
2
2
|
export type { EntryHandlers } from './index';
|
|
3
3
|
export type { InitConfig, ShowInput } from './index';
|
|
4
4
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/toast/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/toast/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,SAAS,EACT,mBAAmB,EACnB,YAAY,GACb,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/ui/toast/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { make, Variant, Position, Dismissed, DismissedAll, ElapsedDuration, HoveredEntry, LeftEntry,
|
|
1
|
+
export { make, Variant, Position, Dismissed, DismissedAll, ElapsedDuration, HoveredEntry, LeftEntry, GotAnimationMessage, DismissAfter, } from './index';
|
|
@@ -12,13 +12,13 @@ export type Position = typeof Position.Type;
|
|
|
12
12
|
/** Schema factory for a single toast entry. `payloadSchema` is user-provided
|
|
13
13
|
* and defines the shape of per-entry content — whatever the consumer wants
|
|
14
14
|
* to encode. The component itself owns only lifecycle + a11y fields: `id`,
|
|
15
|
-
* `variant` (for ARIA role), `
|
|
15
|
+
* `variant` (for ARIA role), `animation`, `maybeDuration`,
|
|
16
16
|
* `pendingDismissVersion` (for cancellable auto-dismiss), and `isHovered`
|
|
17
17
|
* (for pause-on-hover). */
|
|
18
18
|
export declare const makeEntry: <A, I>(payloadSchema: S.Schema<A, I>) => S.Struct<{
|
|
19
19
|
id: typeof S.String;
|
|
20
20
|
variant: S.Literal<["Info", "Success", "Warning", "Error"]>;
|
|
21
|
-
|
|
21
|
+
animation: S.Struct<{
|
|
22
22
|
id: typeof S.String;
|
|
23
23
|
isShowing: typeof S.Boolean;
|
|
24
24
|
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
@@ -39,7 +39,7 @@ export declare const makeModel: <A, I>(payloadSchema: S.Schema<A, I>) => S.Struc
|
|
|
39
39
|
entries: S.Array$<S.Struct<{
|
|
40
40
|
id: typeof S.String;
|
|
41
41
|
variant: S.Literal<["Info", "Success", "Warning", "Error"]>;
|
|
42
|
-
|
|
42
|
+
animation: S.Struct<{
|
|
43
43
|
id: typeof S.String;
|
|
44
44
|
isShowing: typeof S.Boolean;
|
|
45
45
|
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
@@ -75,24 +75,24 @@ export declare const HoveredEntry: import("../../schema").CallableTaggedStruct<"
|
|
|
75
75
|
export declare const LeftEntry: import("../../schema").CallableTaggedStruct<"LeftEntry", {
|
|
76
76
|
entryId: typeof S.String;
|
|
77
77
|
}>;
|
|
78
|
-
/** Wraps a single entry's
|
|
79
|
-
export declare const
|
|
78
|
+
/** Wraps a single entry's Animation submodel message for delegation. */
|
|
79
|
+
export declare const GotAnimationMessage: import("../../schema").CallableTaggedStruct<"GotAnimationMessage", {
|
|
80
80
|
entryId: typeof S.String;
|
|
81
|
-
message: S.Union<[import("../../schema").CallableTaggedStruct<"Showed", {}>, import("../../schema").CallableTaggedStruct<"Hid", {}>, import("../../schema").CallableTaggedStruct<"
|
|
81
|
+
message: S.Union<[import("../../schema").CallableTaggedStruct<"Showed", {}>, import("../../schema").CallableTaggedStruct<"Hid", {}>, import("../../schema").CallableTaggedStruct<"AdvancedAnimationFrame", {}>, import("../../schema").CallableTaggedStruct<"EndedAnimation", {}>]>;
|
|
82
82
|
}>;
|
|
83
83
|
export type Dismissed = typeof Dismissed.Type;
|
|
84
84
|
export type DismissedAll = typeof DismissedAll.Type;
|
|
85
85
|
export type ElapsedDuration = typeof ElapsedDuration.Type;
|
|
86
86
|
export type HoveredEntry = typeof HoveredEntry.Type;
|
|
87
87
|
export type LeftEntry = typeof LeftEntry.Type;
|
|
88
|
-
export type
|
|
88
|
+
export type GotAnimationMessage = typeof GotAnimationMessage.Type;
|
|
89
89
|
/** Factory for the `Added` message, which carries a fully-constructed entry
|
|
90
90
|
* whose shape depends on the user-provided payload. */
|
|
91
91
|
export declare const makeAdded: <A, I>(payloadSchema: S.Schema<A, I>) => import("../../schema").CallableTaggedStruct<"Added", {
|
|
92
92
|
entry: S.Struct<{
|
|
93
93
|
id: typeof S.String;
|
|
94
94
|
variant: S.Literal<["Info", "Success", "Warning", "Error"]>;
|
|
95
|
-
|
|
95
|
+
animation: S.Struct<{
|
|
96
96
|
id: typeof S.String;
|
|
97
97
|
isShowing: typeof S.Boolean;
|
|
98
98
|
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
@@ -108,7 +108,7 @@ export declare const makeMessage: <A, I>(payloadSchema: S.Schema<A, I>) => S.Uni
|
|
|
108
108
|
entry: S.Struct<{
|
|
109
109
|
id: typeof S.String;
|
|
110
110
|
variant: S.Literal<["Info", "Success", "Warning", "Error"]>;
|
|
111
|
-
|
|
111
|
+
animation: S.Struct<{
|
|
112
112
|
id: typeof S.String;
|
|
113
113
|
isShowing: typeof S.Boolean;
|
|
114
114
|
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
@@ -127,9 +127,9 @@ export declare const makeMessage: <A, I>(payloadSchema: S.Schema<A, I>) => S.Uni
|
|
|
127
127
|
entryId: typeof S.String;
|
|
128
128
|
}>, import("../../schema").CallableTaggedStruct<"LeftEntry", {
|
|
129
129
|
entryId: typeof S.String;
|
|
130
|
-
}>, import("../../schema").CallableTaggedStruct<"
|
|
130
|
+
}>, import("../../schema").CallableTaggedStruct<"GotAnimationMessage", {
|
|
131
131
|
entryId: typeof S.String;
|
|
132
|
-
message: S.Union<[import("../../schema").CallableTaggedStruct<"Showed", {}>, import("../../schema").CallableTaggedStruct<"Hid", {}>, import("../../schema").CallableTaggedStruct<"
|
|
132
|
+
message: S.Union<[import("../../schema").CallableTaggedStruct<"Showed", {}>, import("../../schema").CallableTaggedStruct<"Hid", {}>, import("../../schema").CallableTaggedStruct<"AdvancedAnimationFrame", {}>, import("../../schema").CallableTaggedStruct<"EndedAnimation", {}>]>;
|
|
133
133
|
}>]>;
|
|
134
134
|
/** Configuration for creating a toast container model. `defaultDuration` is
|
|
135
135
|
* applied to any `show()` call that doesn't provide its own `duration` or
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/ui/toast/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAU9C;;;;kDAIkD;AAClD,eAAO,MAAM,OAAO,oDAAmD,CAAA;AACvE,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC,gFAAgF;AAChF,eAAO,MAAM,QAAQ,8FAOpB,CAAA;AACD,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAA;AAI3C;;;;;4BAK4B;AAC5B,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;;;;;;;;;;;;EASzD,CAAA;AAIJ;;;;wCAIwC;AACxC,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;EAMzD,CAAA;AAIJ;wEACwE;AACxE,eAAO,MAAM,SAAS;;EAAwC,CAAA;AAC9D,uEAAuE;AACvE,eAAO,MAAM,YAAY,iEAAoB,CAAA;AAC7C;;qBAEqB;AACrB,eAAO,MAAM,eAAe;;;EAG1B,CAAA;AACF;qCACqC;AACrC,eAAO,MAAM,YAAY;;EAA2C,CAAA;AACpE;sCACsC;AACtC,eAAO,MAAM,SAAS;;EAAwC,CAAA;AAC9D,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/ui/toast/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM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,mBAAmB,GAAG,OAAO,mBAAmB,CAAC,IAAI,CAAA;AAEjE;wDACwD;AACxD,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;;;;;;;;;;;;;;EACZ,CAAA;AAEjD,6EAA6E;AAC7E,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;IAS5D,CAAA;AAIH;;;mCAGmC;AACnC,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,eAAe,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAA;CACzC,CAAC,CAAA;AAEF,eAAO,MAAM,gBAAgB,mBAAsB,CAAA"}
|
package/dist/ui/toast/schema.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Duration, Schema as S } from 'effect';
|
|
2
2
|
import { m } from '../../message';
|
|
3
|
-
import { Message as
|
|
3
|
+
import { Message as AnimationMessage, Model as AnimationModel, } from '../animation/schema';
|
|
4
4
|
// VARIANT
|
|
5
5
|
/** Semantic category of a toast. Drives the default ARIA role: `status` for
|
|
6
6
|
* `Info` / `Success`, `alert` for `Warning` / `Error`. Also surfaced as
|
|
@@ -15,13 +15,13 @@ export const Position = S.Literal('TopLeft', 'TopCenter', 'TopRight', 'BottomLef
|
|
|
15
15
|
/** Schema factory for a single toast entry. `payloadSchema` is user-provided
|
|
16
16
|
* and defines the shape of per-entry content — whatever the consumer wants
|
|
17
17
|
* to encode. The component itself owns only lifecycle + a11y fields: `id`,
|
|
18
|
-
* `variant` (for ARIA role), `
|
|
18
|
+
* `variant` (for ARIA role), `animation`, `maybeDuration`,
|
|
19
19
|
* `pendingDismissVersion` (for cancellable auto-dismiss), and `isHovered`
|
|
20
20
|
* (for pause-on-hover). */
|
|
21
21
|
export const makeEntry = (payloadSchema) => S.Struct({
|
|
22
22
|
id: S.String,
|
|
23
23
|
variant: Variant,
|
|
24
|
-
|
|
24
|
+
animation: AnimationModel,
|
|
25
25
|
maybeDuration: S.OptionFromSelf(S.DurationFromMillis),
|
|
26
26
|
pendingDismissVersion: S.Number,
|
|
27
27
|
isHovered: S.Boolean,
|
|
@@ -58,14 +58,14 @@ export const HoveredEntry = m('HoveredEntry', { entryId: S.String });
|
|
|
58
58
|
/** Sent when the pointer leaves an entry. Restarts the auto-dismiss timer
|
|
59
59
|
* with the entry's full duration. */
|
|
60
60
|
export const LeftEntry = m('LeftEntry', { entryId: S.String });
|
|
61
|
-
/** Wraps a single entry's
|
|
62
|
-
export const
|
|
61
|
+
/** Wraps a single entry's Animation submodel message for delegation. */
|
|
62
|
+
export const GotAnimationMessage = m('GotAnimationMessage', {
|
|
63
63
|
entryId: S.String,
|
|
64
|
-
message:
|
|
64
|
+
message: AnimationMessage,
|
|
65
65
|
});
|
|
66
66
|
/** Factory for the `Added` message, which carries a fully-constructed entry
|
|
67
67
|
* whose shape depends on the user-provided payload. */
|
|
68
68
|
export const makeAdded = (payloadSchema) => m('Added', { entry: makeEntry(payloadSchema) });
|
|
69
69
|
/** Factory for the union of all messages the toast component can produce. */
|
|
70
|
-
export const makeMessage = (payloadSchema) => S.Union(makeAdded(payloadSchema), Dismissed, DismissedAll, ElapsedDuration, HoveredEntry, LeftEntry,
|
|
70
|
+
export const makeMessage = (payloadSchema) => S.Union(makeAdded(payloadSchema), Dismissed, DismissedAll, ElapsedDuration, HoveredEntry, LeftEntry, GotAnimationMessage);
|
|
71
71
|
export const DEFAULT_DURATION = Duration.seconds(4);
|
|
@@ -30,7 +30,7 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
30
30
|
readonly Entry: S.Struct<{
|
|
31
31
|
id: typeof S.String;
|
|
32
32
|
variant: S.Literal<["Info", "Success", "Warning", "Error"]>;
|
|
33
|
-
|
|
33
|
+
animation: S.Struct<{
|
|
34
34
|
id: typeof S.String;
|
|
35
35
|
isShowing: typeof S.Boolean;
|
|
36
36
|
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
@@ -46,7 +46,7 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
46
46
|
entries: S.Array$<S.Struct<{
|
|
47
47
|
id: typeof S.String;
|
|
48
48
|
variant: S.Literal<["Info", "Success", "Warning", "Error"]>;
|
|
49
|
-
|
|
49
|
+
animation: S.Struct<{
|
|
50
50
|
id: typeof S.String;
|
|
51
51
|
isShowing: typeof S.Boolean;
|
|
52
52
|
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
@@ -62,7 +62,7 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
62
62
|
entry: S.Struct<{
|
|
63
63
|
id: typeof S.String;
|
|
64
64
|
variant: S.Literal<["Info", "Success", "Warning", "Error"]>;
|
|
65
|
-
|
|
65
|
+
animation: S.Struct<{
|
|
66
66
|
id: typeof S.String;
|
|
67
67
|
isShowing: typeof S.Boolean;
|
|
68
68
|
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
@@ -81,15 +81,15 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
81
81
|
entryId: typeof S.String;
|
|
82
82
|
}>, import("../../schema").CallableTaggedStruct<"LeftEntry", {
|
|
83
83
|
entryId: typeof S.String;
|
|
84
|
-
}>, import("../../schema").CallableTaggedStruct<"
|
|
84
|
+
}>, import("../../schema").CallableTaggedStruct<"GotAnimationMessage", {
|
|
85
85
|
entryId: typeof S.String;
|
|
86
|
-
message: S.Union<[import("../../schema").CallableTaggedStruct<"Showed", {}>, import("../../schema").CallableTaggedStruct<"Hid", {}>, import("../../schema").CallableTaggedStruct<"
|
|
86
|
+
message: S.Union<[import("../../schema").CallableTaggedStruct<"Showed", {}>, import("../../schema").CallableTaggedStruct<"Hid", {}>, import("../../schema").CallableTaggedStruct<"AdvancedAnimationFrame", {}>, import("../../schema").CallableTaggedStruct<"EndedAnimation", {}>]>;
|
|
87
87
|
}>]>;
|
|
88
88
|
readonly Added: import("../../schema").CallableTaggedStruct<"Added", {
|
|
89
89
|
entry: S.Struct<{
|
|
90
90
|
id: typeof S.String;
|
|
91
91
|
variant: S.Literal<["Info", "Success", "Warning", "Error"]>;
|
|
92
|
-
|
|
92
|
+
animation: S.Struct<{
|
|
93
93
|
id: typeof S.String;
|
|
94
94
|
isShowing: typeof S.Boolean;
|
|
95
95
|
transitionState: S.Literal<["Idle", "EnterStart", "EnterAnimating", "LeaveStart", "LeaveAnimating"]>;
|
|
@@ -103,7 +103,7 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
103
103
|
readonly init: (config: InitConfig) => {
|
|
104
104
|
readonly entries: readonly {
|
|
105
105
|
readonly id: string;
|
|
106
|
-
readonly
|
|
106
|
+
readonly animation: {
|
|
107
107
|
readonly id: string;
|
|
108
108
|
readonly isShowing: boolean;
|
|
109
109
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -121,7 +121,7 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
121
121
|
readonly update: (model: {
|
|
122
122
|
readonly entries: readonly {
|
|
123
123
|
readonly id: string;
|
|
124
|
-
readonly
|
|
124
|
+
readonly animation: {
|
|
125
125
|
readonly id: string;
|
|
126
126
|
readonly isShowing: boolean;
|
|
127
127
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -151,22 +151,22 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
151
151
|
readonly _tag: "LeftEntry";
|
|
152
152
|
readonly entryId: string;
|
|
153
153
|
} | {
|
|
154
|
-
readonly _tag: "
|
|
154
|
+
readonly _tag: "GotAnimationMessage";
|
|
155
155
|
readonly message: {
|
|
156
156
|
readonly _tag: "Showed";
|
|
157
157
|
} | {
|
|
158
158
|
readonly _tag: "Hid";
|
|
159
159
|
} | {
|
|
160
|
-
readonly _tag: "
|
|
160
|
+
readonly _tag: "AdvancedAnimationFrame";
|
|
161
161
|
} | {
|
|
162
|
-
readonly _tag: "
|
|
162
|
+
readonly _tag: "EndedAnimation";
|
|
163
163
|
};
|
|
164
164
|
readonly entryId: string;
|
|
165
165
|
} | {
|
|
166
166
|
readonly _tag: "Added";
|
|
167
167
|
readonly entry: {
|
|
168
168
|
readonly id: string;
|
|
169
|
-
readonly
|
|
169
|
+
readonly animation: {
|
|
170
170
|
readonly id: string;
|
|
171
171
|
readonly isShowing: boolean;
|
|
172
172
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -180,7 +180,7 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
180
180
|
}) => readonly [{
|
|
181
181
|
readonly entries: readonly {
|
|
182
182
|
readonly id: string;
|
|
183
|
-
readonly
|
|
183
|
+
readonly animation: {
|
|
184
184
|
readonly id: string;
|
|
185
185
|
readonly isShowing: boolean;
|
|
186
186
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -212,22 +212,22 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
212
212
|
readonly _tag: "LeftEntry";
|
|
213
213
|
readonly entryId: string;
|
|
214
214
|
} | {
|
|
215
|
-
readonly _tag: "
|
|
215
|
+
readonly _tag: "GotAnimationMessage";
|
|
216
216
|
readonly message: {
|
|
217
217
|
readonly _tag: "Showed";
|
|
218
218
|
} | {
|
|
219
219
|
readonly _tag: "Hid";
|
|
220
220
|
} | {
|
|
221
|
-
readonly _tag: "
|
|
221
|
+
readonly _tag: "AdvancedAnimationFrame";
|
|
222
222
|
} | {
|
|
223
|
-
readonly _tag: "
|
|
223
|
+
readonly _tag: "EndedAnimation";
|
|
224
224
|
};
|
|
225
225
|
readonly entryId: string;
|
|
226
226
|
} | {
|
|
227
227
|
readonly _tag: "Added";
|
|
228
228
|
readonly entry: {
|
|
229
229
|
readonly id: string;
|
|
230
|
-
readonly
|
|
230
|
+
readonly animation: {
|
|
231
231
|
readonly id: string;
|
|
232
232
|
readonly isShowing: boolean;
|
|
233
233
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -243,7 +243,7 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
243
243
|
readonly show: (model: {
|
|
244
244
|
readonly entries: readonly {
|
|
245
245
|
readonly id: string;
|
|
246
|
-
readonly
|
|
246
|
+
readonly animation: {
|
|
247
247
|
readonly id: string;
|
|
248
248
|
readonly isShowing: boolean;
|
|
249
249
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -260,7 +260,7 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
260
260
|
}, input: ShowInput<A>) => readonly [{
|
|
261
261
|
readonly entries: readonly {
|
|
262
262
|
readonly id: string;
|
|
263
|
-
readonly
|
|
263
|
+
readonly animation: {
|
|
264
264
|
readonly id: string;
|
|
265
265
|
readonly isShowing: boolean;
|
|
266
266
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -292,22 +292,22 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
292
292
|
readonly _tag: "LeftEntry";
|
|
293
293
|
readonly entryId: string;
|
|
294
294
|
} | {
|
|
295
|
-
readonly _tag: "
|
|
295
|
+
readonly _tag: "GotAnimationMessage";
|
|
296
296
|
readonly message: {
|
|
297
297
|
readonly _tag: "Showed";
|
|
298
298
|
} | {
|
|
299
299
|
readonly _tag: "Hid";
|
|
300
300
|
} | {
|
|
301
|
-
readonly _tag: "
|
|
301
|
+
readonly _tag: "AdvancedAnimationFrame";
|
|
302
302
|
} | {
|
|
303
|
-
readonly _tag: "
|
|
303
|
+
readonly _tag: "EndedAnimation";
|
|
304
304
|
};
|
|
305
305
|
readonly entryId: string;
|
|
306
306
|
} | {
|
|
307
307
|
readonly _tag: "Added";
|
|
308
308
|
readonly entry: {
|
|
309
309
|
readonly id: string;
|
|
310
|
-
readonly
|
|
310
|
+
readonly animation: {
|
|
311
311
|
readonly id: string;
|
|
312
312
|
readonly isShowing: boolean;
|
|
313
313
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -323,7 +323,7 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
323
323
|
readonly dismiss: (model: {
|
|
324
324
|
readonly entries: readonly {
|
|
325
325
|
readonly id: string;
|
|
326
|
-
readonly
|
|
326
|
+
readonly animation: {
|
|
327
327
|
readonly id: string;
|
|
328
328
|
readonly isShowing: boolean;
|
|
329
329
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -340,7 +340,7 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
340
340
|
}, entryId: string) => readonly [{
|
|
341
341
|
readonly entries: readonly {
|
|
342
342
|
readonly id: string;
|
|
343
|
-
readonly
|
|
343
|
+
readonly animation: {
|
|
344
344
|
readonly id: string;
|
|
345
345
|
readonly isShowing: boolean;
|
|
346
346
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -372,22 +372,22 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
372
372
|
readonly _tag: "LeftEntry";
|
|
373
373
|
readonly entryId: string;
|
|
374
374
|
} | {
|
|
375
|
-
readonly _tag: "
|
|
375
|
+
readonly _tag: "GotAnimationMessage";
|
|
376
376
|
readonly message: {
|
|
377
377
|
readonly _tag: "Showed";
|
|
378
378
|
} | {
|
|
379
379
|
readonly _tag: "Hid";
|
|
380
380
|
} | {
|
|
381
|
-
readonly _tag: "
|
|
381
|
+
readonly _tag: "AdvancedAnimationFrame";
|
|
382
382
|
} | {
|
|
383
|
-
readonly _tag: "
|
|
383
|
+
readonly _tag: "EndedAnimation";
|
|
384
384
|
};
|
|
385
385
|
readonly entryId: string;
|
|
386
386
|
} | {
|
|
387
387
|
readonly _tag: "Added";
|
|
388
388
|
readonly entry: {
|
|
389
389
|
readonly id: string;
|
|
390
|
-
readonly
|
|
390
|
+
readonly animation: {
|
|
391
391
|
readonly id: string;
|
|
392
392
|
readonly isShowing: boolean;
|
|
393
393
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -403,7 +403,7 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
403
403
|
readonly dismissAll: (model: {
|
|
404
404
|
readonly entries: readonly {
|
|
405
405
|
readonly id: string;
|
|
406
|
-
readonly
|
|
406
|
+
readonly animation: {
|
|
407
407
|
readonly id: string;
|
|
408
408
|
readonly isShowing: boolean;
|
|
409
409
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -420,7 +420,7 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
420
420
|
}) => readonly [{
|
|
421
421
|
readonly entries: readonly {
|
|
422
422
|
readonly id: string;
|
|
423
|
-
readonly
|
|
423
|
+
readonly animation: {
|
|
424
424
|
readonly id: string;
|
|
425
425
|
readonly isShowing: boolean;
|
|
426
426
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -452,22 +452,22 @@ export declare const makeRuntime: <A, I>(payloadSchema: S.Schema<A, I>) => {
|
|
|
452
452
|
readonly _tag: "LeftEntry";
|
|
453
453
|
readonly entryId: string;
|
|
454
454
|
} | {
|
|
455
|
-
readonly _tag: "
|
|
455
|
+
readonly _tag: "GotAnimationMessage";
|
|
456
456
|
readonly message: {
|
|
457
457
|
readonly _tag: "Showed";
|
|
458
458
|
} | {
|
|
459
459
|
readonly _tag: "Hid";
|
|
460
460
|
} | {
|
|
461
|
-
readonly _tag: "
|
|
461
|
+
readonly _tag: "AdvancedAnimationFrame";
|
|
462
462
|
} | {
|
|
463
|
-
readonly _tag: "
|
|
463
|
+
readonly _tag: "EndedAnimation";
|
|
464
464
|
};
|
|
465
465
|
readonly entryId: string;
|
|
466
466
|
} | {
|
|
467
467
|
readonly _tag: "Added";
|
|
468
468
|
readonly entry: {
|
|
469
469
|
readonly id: string;
|
|
470
|
-
readonly
|
|
470
|
+
readonly animation: {
|
|
471
471
|
readonly id: string;
|
|
472
472
|
readonly isShowing: boolean;
|
|
473
473
|
readonly transitionState: "Idle" | "EnterStart" | "EnterAnimating" | "LeaveStart" | "LeaveAnimating";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/ui/toast/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,MAAM,EAGN,MAAM,EACN,MAAM,IAAI,CAAC,EACZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAexC,OAAO,EAML,KAAK,UAAU,EACf,KAAK,OAAO,EAKb,MAAM,UAAU,CAAA;AAIjB;;oDAEoD;AACpD,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,QAAQ,CAAC;IAClC,OAAO,EAAE,CAAC,CAAA;I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AAO,MAAM,WAAW,GAAI,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA0IvC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmIG,SAAS,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAIP,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkB/C,CAAA"}
|
package/dist/ui/toast/update.js
CHANGED
|
@@ -3,9 +3,9 @@ import * as Command from '../../command';
|
|
|
3
3
|
import { OptionExt } from '../../effectExtensions';
|
|
4
4
|
import { evo } from '../../struct';
|
|
5
5
|
import * as Task from '../../task';
|
|
6
|
-
import { Hid as
|
|
7
|
-
import { defaultLeaveCommand as
|
|
8
|
-
import { DEFAULT_DURATION, Dismissed, DismissedAll, ElapsedDuration,
|
|
6
|
+
import { Hid as AnimationHid, Showed as AnimationShowed, init as animationInit, } from '../animation/schema';
|
|
7
|
+
import { defaultLeaveCommand as animationDefaultLeaveCommand, update as animationUpdate, } from '../animation/update';
|
|
8
|
+
import { DEFAULT_DURATION, Dismissed, DismissedAll, ElapsedDuration, GotAnimationMessage, makeAdded, makeEntry, makeMessage, makeModel, } from './schema';
|
|
9
9
|
/** Schedules an auto-dismiss timer for an entry. The result Message carries a
|
|
10
10
|
* version so stale timers (from hover or manual dismiss) are discarded in
|
|
11
11
|
* the update function. Static — the Command definition doesn't depend on
|
|
@@ -32,7 +32,7 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
32
32
|
entries: Array.filter(({ id }) => id !== entryId),
|
|
33
33
|
});
|
|
34
34
|
const isEntryLeaving = (entry) => {
|
|
35
|
-
const { transitionState } = entry.
|
|
35
|
+
const { transitionState } = entry.animation;
|
|
36
36
|
return (transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating');
|
|
37
37
|
};
|
|
38
38
|
const scheduleDismiss = (entryId, version, duration) => DismissAfter(Task.delay(duration).pipe(Effect.as(ElapsedDuration({ entryId, version }))));
|
|
@@ -49,16 +49,16 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
const
|
|
52
|
+
const delegateToEntryAnimation = (model, entryId, animationMessage) => {
|
|
53
53
|
const maybeEntry = Array.findFirst(model.entries, ({ id }) => id === entryId);
|
|
54
54
|
return Option.match(maybeEntry, {
|
|
55
55
|
onNone: () => [model, []],
|
|
56
56
|
onSome: entry => {
|
|
57
|
-
const [
|
|
58
|
-
const toMessage = (message) =>
|
|
59
|
-
const mappedCommands =
|
|
57
|
+
const [nextAnimation, animationCommands, maybeOutMessage] = animationUpdate(entry.animation, animationMessage);
|
|
58
|
+
const toMessage = (message) => GotAnimationMessage({ entryId, message });
|
|
59
|
+
const mappedCommands = animationCommands.map(Command.mapEffect(Effect.map(toMessage)));
|
|
60
60
|
const nextEntry = evo(entry, {
|
|
61
|
-
|
|
61
|
+
animation: () => nextAnimation,
|
|
62
62
|
});
|
|
63
63
|
return Option.match(maybeOutMessage, {
|
|
64
64
|
onNone: () => [
|
|
@@ -70,7 +70,7 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
70
70
|
updateEntry(model, entryId, () => nextEntry),
|
|
71
71
|
[
|
|
72
72
|
...mappedCommands,
|
|
73
|
-
Command.mapEffect(
|
|
73
|
+
Command.mapEffect(animationDefaultLeaveCommand(nextAnimation), Effect.map(toMessage)),
|
|
74
74
|
],
|
|
75
75
|
],
|
|
76
76
|
TransitionedOut: () => [
|
|
@@ -91,7 +91,7 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
91
91
|
return {
|
|
92
92
|
id: entryId,
|
|
93
93
|
variant: input.variant ?? DEFAULT_VARIANT,
|
|
94
|
-
|
|
94
|
+
animation: animationInit({ id: entryId, isShowing: false }),
|
|
95
95
|
maybeDuration,
|
|
96
96
|
pendingDismissVersion: 0,
|
|
97
97
|
isHovered: false,
|
|
@@ -114,7 +114,7 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
114
114
|
entries: entries => Array.append(entries, entry),
|
|
115
115
|
nextEntryKey: Number.increment,
|
|
116
116
|
});
|
|
117
|
-
const [modelAfterShow, showCommands] =
|
|
117
|
+
const [modelAfterShow, showCommands] = delegateToEntryAnimation(modelWithEntry, entry.id, AnimationShowed());
|
|
118
118
|
const postShowEntry = Array.findFirst(modelAfterShow.entries, ({ id }) => id === entry.id);
|
|
119
119
|
const dismissCommands = Option.match(postShowEntry, {
|
|
120
120
|
onNone: () => [],
|
|
@@ -131,7 +131,7 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
131
131
|
return [model, []];
|
|
132
132
|
}
|
|
133
133
|
else {
|
|
134
|
-
return
|
|
134
|
+
return delegateToEntryAnimation(model, entryId, AnimationHid());
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
137
|
});
|
|
@@ -140,7 +140,7 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
140
140
|
if (isEntryLeaving(entry)) {
|
|
141
141
|
return [currentModel, currentCommands];
|
|
142
142
|
}
|
|
143
|
-
const [nextModel, nextCommands] =
|
|
143
|
+
const [nextModel, nextCommands] = delegateToEntryAnimation(currentModel, entry.id, AnimationHid());
|
|
144
144
|
return [nextModel, [...currentCommands, ...nextCommands]];
|
|
145
145
|
}),
|
|
146
146
|
ElapsedDuration: ({ entryId, version }) => {
|
|
@@ -153,7 +153,7 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
153
153
|
return [model, []];
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
156
|
-
return
|
|
156
|
+
return delegateToEntryAnimation(model, entryId, AnimationHid());
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
159
|
});
|
|
@@ -181,7 +181,7 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
181
181
|
},
|
|
182
182
|
});
|
|
183
183
|
},
|
|
184
|
-
|
|
184
|
+
GotAnimationMessage: ({ entryId, message: animationMessage }) => delegateToEntryAnimation(model, entryId, animationMessage),
|
|
185
185
|
}));
|
|
186
186
|
/** Adds a new toast entry. */
|
|
187
187
|
const show = (model, input) => update(model, Added({ entry: createEntry(model, input) }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.72.0",
|
|
4
4
|
"description": "A frontend framework for TypeScript, built on Effect, using The Elm Architecture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -79,6 +79,10 @@
|
|
|
79
79
|
"types": "./dist/ui/index.d.ts",
|
|
80
80
|
"import": "./dist/ui/index.js"
|
|
81
81
|
},
|
|
82
|
+
"./ui/animation": {
|
|
83
|
+
"types": "./dist/ui/animation/public.d.ts",
|
|
84
|
+
"import": "./dist/ui/animation/public.js"
|
|
85
|
+
},
|
|
82
86
|
"./ui/button": {
|
|
83
87
|
"types": "./dist/ui/button/public.d.ts",
|
|
84
88
|
"import": "./dist/ui/button/public.js"
|
|
@@ -151,10 +155,6 @@
|
|
|
151
155
|
"types": "./dist/ui/tooltip/public.d.ts",
|
|
152
156
|
"import": "./dist/ui/tooltip/public.js"
|
|
153
157
|
},
|
|
154
|
-
"./ui/transition": {
|
|
155
|
-
"types": "./dist/ui/transition/public.d.ts",
|
|
156
|
-
"import": "./dist/ui/transition/public.js"
|
|
157
|
-
},
|
|
158
158
|
"./url": {
|
|
159
159
|
"types": "./dist/url/public.d.ts",
|
|
160
160
|
"import": "./dist/url/public.js"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/transition/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,OAAO,EAGb,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,GAAG,EACH,OAAO,EACP,KAAK,EACL,UAAU,EACV,MAAM,EACN,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,IAAI,EACL,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,EACP,MAAM,UAAU,CAAA;AAEjB,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,GAAG,EACH,IAAI,EACJ,OAAO,EACP,KAAK,EACL,UAAU,EACV,MAAM,EACN,qBAAqB,EACrB,eAAe,EACf,eAAe,GAChB,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,EAAE,CAAA;AAIxE,4DAA4D;AAC5D,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,KAAK,EAAE,KAAK,CAAA;IACZ,OAAO,EAAE,IAAI,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;2EAEuE;IACvE,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAC,CAAA;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IA+F3D,CAAA;AAED;;yDAEyD;AACzD,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,cAAc,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC,KAC3D,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,KAAK,IAAI,CAaxC,CAAA"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { init, update, view, lazy, defaultLeaveCommand, Model, Message, OutMessage, Showed, Hid, AdvancedTransitionFrame, EndedTransition, StartedLeaveAnimating, TransitionedOut, TransitionState, RequestFrame, WaitForTransitions, } from './index';
|
|
2
|
-
export type { InitConfig, ViewConfig } from './index';
|
|
3
|
-
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/transition/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,mBAAmB,EACnB,KAAK,EACL,OAAO,EACP,UAAU,EACV,MAAM,EACN,GAAG,EACH,uBAAuB,EACvB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,kBAAkB,GACnB,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { init, update, view, lazy, defaultLeaveCommand, Model, Message, OutMessage, Showed, Hid, AdvancedTransitionFrame, EndedTransition, StartedLeaveAnimating, TransitionedOut, TransitionState, RequestFrame, WaitForTransitions, } from './index';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/ui/transition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