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
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { Array, Duration, Effect, Match as M, Number, Option, } from 'effect';
|
|
2
|
+
import * as Command from '../../command';
|
|
3
|
+
import { OptionExt } from '../../effectExtensions';
|
|
4
|
+
import { evo } from '../../struct';
|
|
5
|
+
import * as Task from '../../task';
|
|
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
|
+
/** Schedules an auto-dismiss timer for an entry. The result Message carries a
|
|
10
|
+
* version so stale timers (from hover or manual dismiss) are discarded in
|
|
11
|
+
* the update function. Static — the Command definition doesn't depend on
|
|
12
|
+
* payload. */
|
|
13
|
+
export const DismissAfter = Command.define('DismissAfter', ElapsedDuration);
|
|
14
|
+
const DEFAULT_VARIANT = 'Info';
|
|
15
|
+
/** Factory that binds Toast's runtime (update fn, helpers, commands) to a
|
|
16
|
+
* specific payload schema. Called by `make` in index.ts; inner helpers close
|
|
17
|
+
* over the payload-specific Entry / Model / Added types so generics don't
|
|
18
|
+
* have to propagate through every helper signature.
|
|
19
|
+
*
|
|
20
|
+
* @internal Consumers should use `Ui.Toast.make(PayloadSchema)`. This is
|
|
21
|
+
* only exported so `index.ts` can wire the view into the bound runtime. */
|
|
22
|
+
export const makeRuntime = (payloadSchema) => {
|
|
23
|
+
const EntrySchema = makeEntry(payloadSchema);
|
|
24
|
+
const ModelSchema = makeModel(payloadSchema);
|
|
25
|
+
const MessageSchema = makeMessage(payloadSchema);
|
|
26
|
+
const Added = makeAdded(payloadSchema);
|
|
27
|
+
const withUpdateReturn = M.withReturnType();
|
|
28
|
+
const updateEntry = (model, entryId, f) => evo(model, {
|
|
29
|
+
entries: Array.map(entry => (entry.id === entryId ? f(entry) : entry)),
|
|
30
|
+
});
|
|
31
|
+
const removeEntry = (model, entryId) => evo(model, {
|
|
32
|
+
entries: Array.filter(({ id }) => id !== entryId),
|
|
33
|
+
});
|
|
34
|
+
const isEntryLeaving = (entry) => {
|
|
35
|
+
const { transitionState } = entry.animation;
|
|
36
|
+
return (transitionState === 'LeaveStart' || transitionState === 'LeaveAnimating');
|
|
37
|
+
};
|
|
38
|
+
const scheduleDismiss = (entryId, version, duration) => DismissAfter(Task.delay(duration).pipe(Effect.as(ElapsedDuration({ entryId, version }))));
|
|
39
|
+
const rescheduleDismissCommands = (entry) => {
|
|
40
|
+
if (isEntryLeaving(entry) || entry.isHovered) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return Option.match(entry.maybeDuration, {
|
|
45
|
+
onNone: () => [],
|
|
46
|
+
onSome: duration => [
|
|
47
|
+
scheduleDismiss(entry.id, entry.pendingDismissVersion, duration),
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const delegateToEntryAnimation = (model, entryId, animationMessage) => {
|
|
53
|
+
const maybeEntry = Array.findFirst(model.entries, ({ id }) => id === entryId);
|
|
54
|
+
return Option.match(maybeEntry, {
|
|
55
|
+
onNone: () => [model, []],
|
|
56
|
+
onSome: entry => {
|
|
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
|
+
const nextEntry = evo(entry, {
|
|
61
|
+
animation: () => nextAnimation,
|
|
62
|
+
});
|
|
63
|
+
return Option.match(maybeOutMessage, {
|
|
64
|
+
onNone: () => [
|
|
65
|
+
updateEntry(model, entryId, () => nextEntry),
|
|
66
|
+
mappedCommands,
|
|
67
|
+
],
|
|
68
|
+
onSome: M.type().pipe(withUpdateReturn, M.tagsExhaustive({
|
|
69
|
+
StartedLeaveAnimating: () => [
|
|
70
|
+
updateEntry(model, entryId, () => nextEntry),
|
|
71
|
+
[
|
|
72
|
+
...mappedCommands,
|
|
73
|
+
Command.mapEffect(animationDefaultLeaveCommand(nextAnimation), Effect.map(toMessage)),
|
|
74
|
+
],
|
|
75
|
+
],
|
|
76
|
+
TransitionedOut: () => [
|
|
77
|
+
removeEntry(model, entryId),
|
|
78
|
+
mappedCommands,
|
|
79
|
+
],
|
|
80
|
+
})),
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const createEntry = (model, input) => {
|
|
86
|
+
const entryId = `${model.id}-entry-${model.nextEntryKey}`;
|
|
87
|
+
const duration = input.duration === undefined
|
|
88
|
+
? model.defaultDuration
|
|
89
|
+
: Duration.decode(input.duration);
|
|
90
|
+
const maybeDuration = OptionExt.when(!input.sticky, duration);
|
|
91
|
+
return {
|
|
92
|
+
id: entryId,
|
|
93
|
+
variant: input.variant ?? DEFAULT_VARIANT,
|
|
94
|
+
animation: animationInit({ id: entryId, isShowing: false }),
|
|
95
|
+
maybeDuration,
|
|
96
|
+
pendingDismissVersion: 0,
|
|
97
|
+
isHovered: false,
|
|
98
|
+
payload: input.payload,
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
/** Creates an initial toast container model from a config. Starts empty. */
|
|
102
|
+
const init = (config) => ({
|
|
103
|
+
id: config.id,
|
|
104
|
+
defaultDuration: config.defaultDuration === undefined
|
|
105
|
+
? DEFAULT_DURATION
|
|
106
|
+
: Duration.decode(config.defaultDuration),
|
|
107
|
+
entries: [],
|
|
108
|
+
nextEntryKey: 0,
|
|
109
|
+
});
|
|
110
|
+
/** Processes a toast message and returns the next model and commands. */
|
|
111
|
+
const update = (model, message) => M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
|
|
112
|
+
Added: ({ entry }) => {
|
|
113
|
+
const modelWithEntry = evo(model, {
|
|
114
|
+
entries: entries => Array.append(entries, entry),
|
|
115
|
+
nextEntryKey: Number.increment,
|
|
116
|
+
});
|
|
117
|
+
const [modelAfterShow, showCommands] = delegateToEntryAnimation(modelWithEntry, entry.id, AnimationShowed());
|
|
118
|
+
const postShowEntry = Array.findFirst(modelAfterShow.entries, ({ id }) => id === entry.id);
|
|
119
|
+
const dismissCommands = Option.match(postShowEntry, {
|
|
120
|
+
onNone: () => [],
|
|
121
|
+
onSome: rescheduleDismissCommands,
|
|
122
|
+
});
|
|
123
|
+
return [modelAfterShow, [...showCommands, ...dismissCommands]];
|
|
124
|
+
},
|
|
125
|
+
Dismissed: ({ entryId }) => {
|
|
126
|
+
const maybeEntry = Array.findFirst(model.entries, ({ id }) => id === entryId);
|
|
127
|
+
return Option.match(maybeEntry, {
|
|
128
|
+
onNone: () => [model, []],
|
|
129
|
+
onSome: entry => {
|
|
130
|
+
if (isEntryLeaving(entry)) {
|
|
131
|
+
return [model, []];
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
return delegateToEntryAnimation(model, entryId, AnimationHid());
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
DismissedAll: () => Array.reduce(model.entries, [model, []], ([currentModel, currentCommands], entry) => {
|
|
140
|
+
if (isEntryLeaving(entry)) {
|
|
141
|
+
return [currentModel, currentCommands];
|
|
142
|
+
}
|
|
143
|
+
const [nextModel, nextCommands] = delegateToEntryAnimation(currentModel, entry.id, AnimationHid());
|
|
144
|
+
return [nextModel, [...currentCommands, ...nextCommands]];
|
|
145
|
+
}),
|
|
146
|
+
ElapsedDuration: ({ entryId, version }) => {
|
|
147
|
+
const maybeEntry = Array.findFirst(model.entries, ({ id }) => id === entryId);
|
|
148
|
+
return Option.match(maybeEntry, {
|
|
149
|
+
onNone: () => [model, []],
|
|
150
|
+
onSome: entry => {
|
|
151
|
+
const isStale = version !== entry.pendingDismissVersion;
|
|
152
|
+
if (isStale || isEntryLeaving(entry)) {
|
|
153
|
+
return [model, []];
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
return delegateToEntryAnimation(model, entryId, AnimationHid());
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
HoveredEntry: ({ entryId }) => [
|
|
162
|
+
updateEntry(model, entryId, entry => evo(entry, {
|
|
163
|
+
isHovered: () => true,
|
|
164
|
+
pendingDismissVersion: Number.increment,
|
|
165
|
+
})),
|
|
166
|
+
[],
|
|
167
|
+
],
|
|
168
|
+
LeftEntry: ({ entryId }) => {
|
|
169
|
+
const maybeEntry = Array.findFirst(model.entries, ({ id }) => id === entryId);
|
|
170
|
+
return Option.match(maybeEntry, {
|
|
171
|
+
onNone: () => [model, []],
|
|
172
|
+
onSome: entry => {
|
|
173
|
+
const nextEntry = evo(entry, {
|
|
174
|
+
isHovered: () => false,
|
|
175
|
+
pendingDismissVersion: Number.increment,
|
|
176
|
+
});
|
|
177
|
+
return [
|
|
178
|
+
updateEntry(model, entryId, () => nextEntry),
|
|
179
|
+
rescheduleDismissCommands(nextEntry),
|
|
180
|
+
];
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
GotAnimationMessage: ({ entryId, message: animationMessage }) => delegateToEntryAnimation(model, entryId, animationMessage),
|
|
185
|
+
}));
|
|
186
|
+
/** Adds a new toast entry. */
|
|
187
|
+
const show = (model, input) => update(model, Added({ entry: createEntry(model, input) }));
|
|
188
|
+
/** Begins dismissing a specific entry. */
|
|
189
|
+
const dismiss = (model, entryId) => update(model, Dismissed({ entryId }));
|
|
190
|
+
/** Begins dismissing every currently-visible entry. */
|
|
191
|
+
const dismissAll = (model) => update(model, DismissedAll());
|
|
192
|
+
return {
|
|
193
|
+
Entry: EntrySchema,
|
|
194
|
+
Model: ModelSchema,
|
|
195
|
+
Message: MessageSchema,
|
|
196
|
+
Added,
|
|
197
|
+
init,
|
|
198
|
+
update,
|
|
199
|
+
show,
|
|
200
|
+
dismiss,
|
|
201
|
+
dismissAll,
|
|
202
|
+
};
|
|
203
|
+
};
|
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"
|
|
@@ -143,14 +147,14 @@
|
|
|
143
147
|
"types": "./dist/ui/tabs/public.d.ts",
|
|
144
148
|
"import": "./dist/ui/tabs/public.js"
|
|
145
149
|
},
|
|
150
|
+
"./ui/toast": {
|
|
151
|
+
"types": "./dist/ui/toast/public.d.ts",
|
|
152
|
+
"import": "./dist/ui/toast/public.js"
|
|
153
|
+
},
|
|
146
154
|
"./ui/tooltip": {
|
|
147
155
|
"types": "./dist/ui/tooltip/public.d.ts",
|
|
148
156
|
"import": "./dist/ui/tooltip/public.js"
|
|
149
157
|
},
|
|
150
|
-
"./ui/transition": {
|
|
151
|
-
"types": "./dist/ui/transition/public.d.ts",
|
|
152
|
-
"import": "./dist/ui/transition/public.js"
|
|
153
|
-
},
|
|
154
158
|
"./url": {
|
|
155
159
|
"types": "./dist/url/public.d.ts",
|
|
156
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/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAMpC,8GAA8G;AAC9G,eAAO,MAAM,eAAe,qFAM3B,CAAA;AACD,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAA;AAIzD,mHAAmH;AACnH,eAAO,MAAM,KAAK;;;;EAIhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,mGAAmG;AACnG,eAAO,MAAM,MAAM,2DAAc,CAAA;AACjC,kGAAkG;AAClG,eAAO,MAAM,GAAG,wDAAW,CAAA;AAC3B,oGAAoG;AACpG,eAAO,MAAM,uBAAuB,4EAA+B,CAAA;AACnE,yFAAyF;AACzF,eAAO,MAAM,eAAe,oEAAuB,CAAA;AAEnD,kEAAkE;AAClE,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,KAAK,CAC3B;IACE,OAAO,MAAM;IACb,OAAO,GAAG;IACV,OAAO,uBAAuB;IAC9B,OAAO,eAAe;CACvB,CAC+D,CAAA;AAClE,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAEzC,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AACvC,MAAM,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC,IAAI,CAAA;AAIjC,uRAAuR;AACvR,eAAO,MAAM,qBAAqB,0EAA6B,CAAA;AAC/D,iIAAiI;AACjI,eAAO,MAAM,eAAe,oEAAuB,CAAA;AAEnD,eAAO,MAAM,UAAU,yJAAkD,CAAA;AACzE,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAA;AAI/C,iEAAiE;AACjE,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAC,CAAA;AAEF,6EAA6E;AAC7E,eAAO,MAAM,IAAI,GAAI,QAAQ,UAAU,KAAG,KAIxC,CAAA"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Schema as S } from 'effect';
|
|
2
|
-
import { m } from '../../message';
|
|
3
|
-
// TRANSITION STATE
|
|
4
|
-
/** Schema for the transition animation state, tracking enter/leave phases for CSS transition coordination. */
|
|
5
|
-
export const TransitionState = S.Literal('Idle', 'EnterStart', 'EnterAnimating', 'LeaveStart', 'LeaveAnimating');
|
|
6
|
-
// MODEL
|
|
7
|
-
/** Schema for the transition component's state, tracking its unique ID, visibility intent, and animation phase. */
|
|
8
|
-
export const Model = S.Struct({
|
|
9
|
-
id: S.String,
|
|
10
|
-
isShowing: S.Boolean,
|
|
11
|
-
transitionState: TransitionState,
|
|
12
|
-
});
|
|
13
|
-
// MESSAGE
|
|
14
|
-
/** Sent when the transition should enter (become visible). Starts the enter animation sequence. */
|
|
15
|
-
export const Showed = m('Showed');
|
|
16
|
-
/** Sent when the transition should leave (become hidden). Starts the leave animation sequence. */
|
|
17
|
-
export const Hid = m('Hid');
|
|
18
|
-
/** Sent internally when a double-rAF completes, advancing the transition to its animating phase. */
|
|
19
|
-
export const AdvancedTransitionFrame = m('AdvancedTransitionFrame');
|
|
20
|
-
/** Sent internally when all CSS transitions on the transition element have completed. */
|
|
21
|
-
export const EndedTransition = m('EndedTransition');
|
|
22
|
-
/** Union of all messages the transition component can produce. */
|
|
23
|
-
export const Message = S.Union(Showed, Hid, AdvancedTransitionFrame, EndedTransition);
|
|
24
|
-
// OUT MESSAGE
|
|
25
|
-
/** Sent to the parent when the leave transition advances to LeaveAnimating. The parent is responsible for providing the command that detects when the leave animation completes (e.g. WaitForTransitions or a racing command). Use `defaultLeaveCommand` for the standard behavior. */
|
|
26
|
-
export const StartedLeaveAnimating = m('StartedLeaveAnimating');
|
|
27
|
-
/** Sent to the parent when the leave animation completes. The parent can use this to unmount content or update its own state. */
|
|
28
|
-
export const TransitionedOut = m('TransitionedOut');
|
|
29
|
-
export const OutMessage = S.Union(StartedLeaveAnimating, TransitionedOut);
|
|
30
|
-
/** Creates an initial transition model from a config. Defaults to hidden. */
|
|
31
|
-
export const init = (config) => ({
|
|
32
|
-
id: config.id,
|
|
33
|
-
isShowing: config.isShowing ?? false,
|
|
34
|
-
transitionState: 'Idle',
|
|
35
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/ui/transition/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEnD,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAGxC,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,UAAU,EAGhB,MAAM,UAAU,CAAA;AAMjB,KAAK,YAAY,GAAG,SAAS;IAC3B,KAAK;IACL,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;CAC1B,CAAA;AAGD,+EAA+E;AAC/E,eAAO,MAAM,YAAY;;EAGxB,CAAA;AACD,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB;;EAG9B,CAAA;AAED,oGAAoG;AACpG,eAAO,MAAM,MAAM,GAAI,OAAO,KAAK,EAAE,SAAS,OAAO,KAAG,YAiFvD,CAAA;AAED,6NAA6N;AAC7N,eAAO,MAAM,mBAAmB,GAAI,OAAO,KAAK,KAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAKvE,CAAA"}
|