@foldkit/ui 0.141.2 → 0.142.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 +2 -2
- package/dist/checkbox/index.d.ts +4 -0
- package/dist/checkbox/index.d.ts.map +1 -1
- package/dist/combobox/shared.d.ts.map +1 -1
- package/dist/combobox/shared.js +71 -73
- package/dist/datePicker/index.d.ts.map +1 -1
- package/dist/datePicker/index.js +76 -89
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +27 -29
- package/dist/listbox/multi.d.ts +2 -0
- package/dist/listbox/multi.d.ts.map +1 -1
- package/dist/listbox/public.d.ts +1 -1
- package/dist/listbox/public.d.ts.map +1 -1
- package/dist/listbox/public.js +1 -1
- package/dist/listbox/shared.d.ts +20 -0
- package/dist/listbox/shared.d.ts.map +1 -1
- package/dist/listbox/shared.js +83 -64
- package/dist/listbox/single.d.ts +2 -0
- package/dist/listbox/single.d.ts.map +1 -1
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +53 -55
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +33 -35
- package/dist/radioGroup/index.d.ts +137 -51
- package/dist/radioGroup/index.d.ts.map +1 -1
- package/dist/radioGroup/index.js +149 -60
- package/dist/radioGroup/public.d.ts +2 -2
- package/dist/radioGroup/public.d.ts.map +1 -1
- package/dist/radioGroup/public.js +1 -1
- package/dist/slider/index.d.ts +28 -0
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +11 -8
- package/dist/switch/index.d.ts +4 -0
- package/dist/switch/index.d.ts.map +1 -1
- package/dist/test/apps/disabledButton.d.ts.map +1 -1
- package/dist/test/apps/disabledButton.js +16 -10
- package/dist/toast/update.d.ts.map +1 -1
- package/dist/toast/update.js +44 -50
- package/package.json +2 -2
package/dist/slider/index.js
CHANGED
|
@@ -244,7 +244,7 @@ const percentString = (fraction) => __foldkitBrandViewResult((`${Math.round(frac
|
|
|
244
244
|
* aria-valuemax / aria-valuenow, keyboard navigation by step / page / home /
|
|
245
245
|
* end. Pointer drag is handled by the component's drag subscriptions. */
|
|
246
246
|
export const view = defineView((model, viewInputs, h) => {
|
|
247
|
-
const { value, formatValue, isDisabled = false, name, getTrackRoot = () => __foldkitBrandViewResult((document), "@foldkit/ui/slider/index.js#anonymous~43"), } = viewInputs;
|
|
247
|
+
const { value, formatValue, isDisabled = false, isReadOnly = false, name, getTrackRoot = () => __foldkitBrandViewResult((document), "@foldkit/ui/slider/index.js#anonymous~43"), } = viewInputs;
|
|
248
248
|
const { id, min, max } = model;
|
|
249
249
|
const isDragging = model.dragState._tag === 'Dragging';
|
|
250
250
|
const fraction = fractionOfValue(value, min, max);
|
|
@@ -258,15 +258,17 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
258
258
|
const stateAttributes = [
|
|
259
259
|
...(isDragging ? [h.DataAttribute('dragging', '')] : []),
|
|
260
260
|
...(isDisabled ? [h.DataAttribute('disabled', '')] : []),
|
|
261
|
+
...(isReadOnly ? [h.DataAttribute('readonly', '')] : []),
|
|
261
262
|
];
|
|
262
263
|
const rootAttributes = [
|
|
263
264
|
h.DataAttribute('slider-id', id),
|
|
264
265
|
h.DataAttribute('orientation', 'horizontal'),
|
|
265
266
|
...stateAttributes,
|
|
266
267
|
];
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
const isInteractive = !isDisabled && !isReadOnly;
|
|
269
|
+
const trackInteractionAttributes = isInteractive
|
|
270
|
+
? [h.OnPointerDown(trackPointerHandler)]
|
|
271
|
+
: [];
|
|
270
272
|
const trackAttributes = [
|
|
271
273
|
h.DataAttribute('slider-track-id', id),
|
|
272
274
|
h.Style({ position: 'relative', 'touch-action': 'none' }),
|
|
@@ -297,12 +299,12 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
297
299
|
};
|
|
298
300
|
const thumbLabelAttributes = resolveThumbLabel();
|
|
299
301
|
const maybeAriaValuetext = formatValue !== undefined ? [h.AriaValuetext(formatValue(value))] : [];
|
|
300
|
-
const thumbInteractionAttributes =
|
|
301
|
-
? [
|
|
302
|
-
: [
|
|
302
|
+
const thumbInteractionAttributes = isInteractive
|
|
303
|
+
? [
|
|
303
304
|
h.OnPointerDown(thumbPointerHandler),
|
|
304
305
|
h.OnKeyDownPreventDefault(handleKeyDown),
|
|
305
|
-
]
|
|
306
|
+
]
|
|
307
|
+
: [];
|
|
306
308
|
const thumbAttributes = [
|
|
307
309
|
h.Id(`${id}-thumb`),
|
|
308
310
|
h.Role('slider'),
|
|
@@ -314,6 +316,7 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
314
316
|
...maybeAriaValuetext,
|
|
315
317
|
...thumbLabelAttributes,
|
|
316
318
|
...(isDisabled ? [h.AriaDisabled(true)] : []),
|
|
319
|
+
...(isReadOnly ? [h.AriaReadonly(true)] : []),
|
|
317
320
|
h.Style({
|
|
318
321
|
position: 'absolute',
|
|
319
322
|
left: percentString(fraction),
|
package/dist/switch/index.d.ts
CHANGED
|
@@ -26,6 +26,10 @@ export type SwitchAttributes<Message> = Readonly<{
|
|
|
26
26
|
* `update` by storing the value.
|
|
27
27
|
* - `toView`: receives the {@link SwitchAttributes} and lays out the
|
|
28
28
|
* switch.
|
|
29
|
+
* - `isDisabled`: marks the switch unavailable with `aria-disabled="true"`
|
|
30
|
+
* and `data-disabled`, keeping it focusable. Use it when the control does
|
|
31
|
+
* not apply; use `isReadOnly` when its state is still information the user
|
|
32
|
+
* needs.
|
|
29
33
|
* - `isReadOnly`: prevents toggling while exposing read-only semantics with
|
|
30
34
|
* `aria-readonly="true"` and `data-readonly`. The switch remains
|
|
31
35
|
* focusable. Independent of `isDisabled`: setting both emits both
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/switch/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAIhE;;;;;;;;;;sEAUsE;AACtE,MAAM,MAAM,gBAAgB,CAAC,OAAO,IAAI,QAAQ,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACzC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9C,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/switch/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAIhE;;;;;;;;;;sEAUsE;AACtE,MAAM,MAAM,gBAAgB,CAAC,OAAO,IAAI,QAAQ,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACzC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9C,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/C,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;;yEAiByE;AACzE,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CAAA;IACzC,MAAM,EAAE,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IACvD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC,CAAA;AAEF,uEAAuE;AACvE,eAAO,MAAM,OAAO,GAAI,IAAI,MAAM,KAAG,MAAuB,CAAA;AAE5D,6EAA6E;AAC7E,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,MAA6B,CAAA;AAExE;;;;;;;;;;;;;;;;;;;;;UAqBU;AACV,eAAO,MAAM,IAAI,GAAI,OAAO,EAC1B,QAAQ,UAAU,CAAC,OAAO,CAAC,EAC3B,GAAG,WAAW,CAAC,OAAO,CAAC,KACtB,IAgEF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disabledButton.d.ts","sourceRoot":"","sources":["../../../src/test/apps/disabledButton.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"disabledButton.d.ts","sourceRoot":"","sources":["../../../src/test/apps/disabledButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AACxD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AASrD,eAAO,MAAM,KAAK;;;;;;;;;;;;;EAGhB,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,eAAO,MAAM,aAAa,oEAAqB,CAAA;AAC/C,eAAO,MAAM,aAAa,oEAAqB,CAAA;AAC/C,eAAO,MAAM,gBAAgB;;;;EAE3B,CAAA;AAEF,eAAO,MAAM,OAAO;;;;IAA4D,CAAA;AAChF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC,eAAO,MAAM,YAAY,EAAE,KAG1B,CAAA;AAoBD,eAAO,MAAM,MAAM,GACjB,OAAO,KAAK,EACZ,SAAS,OAAO,KACf,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAWxD,CAAA;AAaH,qCAAqC;AACrC,eAAO,MAAM,IAAI,GAAI,OAAO,KAAK,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,KAAG,IAQ5D,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,cAAc,GAAI,OAAO,KAAK,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,KAAG,IAyBtE,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Match as M, Schema as S } from 'effect';
|
|
3
|
-
import * as Command from 'foldkit/command';
|
|
2
|
+
import { Match as M, Option, Schema as S } from 'effect';
|
|
4
3
|
import { m } from 'foldkit/message';
|
|
4
|
+
import { evo } from 'foldkit/struct';
|
|
5
|
+
import * as Update from 'foldkit/update';
|
|
5
6
|
import * as Dialog from '../../dialog/index.js';
|
|
6
7
|
// MODEL
|
|
7
8
|
export const Model = S.Struct({
|
|
@@ -21,16 +22,21 @@ export const initialModel = {
|
|
|
21
22
|
dialog: Dialog.init({ id: 'test-dialog', isOpen: true }),
|
|
22
23
|
};
|
|
23
24
|
// UPDATE
|
|
25
|
+
const foldDialogOutMessage = M.type().pipe(M.withReturnType(), M.tagsExhaustive({
|
|
26
|
+
Opened: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult(([model, []]), "@foldkit/ui/test/apps/disabledButton.js#anonymous")), "@foldkit/ui/test/apps/disabledButton.js#Opened"),
|
|
27
|
+
Closed: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult(([model, []]), "@foldkit/ui/test/apps/disabledButton.js#anonymous~2")), "@foldkit/ui/test/apps/disabledButton.js#Closed"),
|
|
28
|
+
}));
|
|
29
|
+
const foldDialog = Update.foldChild({
|
|
30
|
+
update: Dialog.update,
|
|
31
|
+
read: (model) => __foldkitBrandViewResult((Option.some(model.dialog)), "@foldkit/ui/test/apps/disabledButton.js#read"),
|
|
32
|
+
write: (model, nextDialog) => __foldkitBrandViewResult((evo(model, { dialog: () => __foldkitBrandViewResult((nextDialog), "@foldkit/ui/test/apps/disabledButton.js#dialog") })), "@foldkit/ui/test/apps/disabledButton.js#write"),
|
|
33
|
+
toParentMessage: message => __foldkitBrandViewResult((GotDialogMessage({ message })), "@foldkit/ui/test/apps/disabledButton.js#toParentMessage"),
|
|
34
|
+
foldOutMessage: foldDialogOutMessage,
|
|
35
|
+
});
|
|
24
36
|
export const update = (model, message) => __foldkitBrandViewResult((M.value(message).pipe(M.withReturnType(), M.tagsExhaustive({
|
|
25
37
|
ClickedToggle: () => __foldkitBrandViewResult(([{ ...model, isEnabled: !model.isEnabled }, []]), "@foldkit/ui/test/apps/disabledButton.js#ClickedToggle"),
|
|
26
38
|
ClickedSubmit: () => __foldkitBrandViewResult(([model, []]), "@foldkit/ui/test/apps/disabledButton.js#ClickedSubmit"),
|
|
27
|
-
GotDialogMessage: ({ message: dialogMessage }) =>
|
|
28
|
-
const [nextDialog, commands] = Dialog.update(model.dialog, dialogMessage);
|
|
29
|
-
return __foldkitBrandViewResult(([
|
|
30
|
-
{ ...model, dialog: nextDialog },
|
|
31
|
-
Command.mapMessages(commands, dialogMessage => __foldkitBrandViewResult((GotDialogMessage({ message: dialogMessage })), "@foldkit/ui/test/apps/disabledButton.js#anonymous")),
|
|
32
|
-
]), "@foldkit/ui/test/apps/disabledButton.js#GotDialogMessage");
|
|
33
|
-
},
|
|
39
|
+
GotDialogMessage: ({ message: dialogMessage }) => __foldkitBrandViewResult((foldDialog(model, dialogMessage)), "@foldkit/ui/test/apps/disabledButton.js#GotDialogMessage"),
|
|
34
40
|
}))), "@foldkit/ui/test/apps/disabledButton.js#update");
|
|
35
41
|
// VIEW
|
|
36
42
|
const submitButton = (isEnabled, h) => __foldkitBrandViewResult((h.button([
|
|
@@ -60,7 +66,7 @@ export const viewWithDialog = (model, h) => {
|
|
|
60
66
|
]
|
|
61
67
|
: [])), "@foldkit/ui/test/apps/disabledButton.js#toView"),
|
|
62
68
|
},
|
|
63
|
-
toParentMessage: message => __foldkitBrandViewResult((GotDialogMessage({ message })), "@foldkit/ui/test/apps/disabledButton.js#toParentMessage"),
|
|
69
|
+
toParentMessage: message => __foldkitBrandViewResult((GotDialogMessage({ message })), "@foldkit/ui/test/apps/disabledButton.js#toParentMessage~2"),
|
|
64
70
|
}),
|
|
65
71
|
])), "@foldkit/ui/test/apps/disabledButton.js#viewWithDialog");
|
|
66
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/toast/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,MAAM,EAGN,MAAM,EACN,MAAM,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/toast/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,MAAM,EAGN,MAAM,EACN,MAAM,IAAI,CAAC,EAEZ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAgB1C,OAAO,EAML,KAAK,UAAU,EACf,KAAK,OAAO,EAOb,MAAM,aAAa,CAAA;AAIpB;;oDAEoD;AACpD,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,QAAQ,CAAC;IAClC,OAAO,EAAE,CAAC,CAAA;IACV,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAA;IACzB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC,CAAA;AAEF;;;eAGe;AACf,eAAO,MAAM,mBAAmB;;;;;;;;iBAW9B,CAAA;AAIF;;;;;;4EAM4E;AAC5E,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAoKtC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+IG,SAAS,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAIP,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoB/C,CAAA"}
|
package/dist/toast/update.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
|
-
import { Array, Duration, Effect, Match as M, Number, Option, Schema as S, } from 'effect';
|
|
2
|
+
import { Array, Duration, Effect, Match as M, Number, Option, Schema as S, pipe, } from 'effect';
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import { evo } from 'foldkit/struct';
|
|
5
|
+
import * as Update from 'foldkit/update';
|
|
5
6
|
import { Hid as AnimationHid, Showed as AnimationShowed, init as animationInit, } from '../animation/schema.js';
|
|
6
7
|
import { defaultLeaveCommand as animationDefaultLeaveCommand, update as animationUpdate, } from '../animation/update.js';
|
|
7
8
|
import * as OptionExt from '../internal/optionExtensions.js';
|
|
@@ -59,42 +60,35 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
59
60
|
})), "@foldkit/ui/toast/update.js#rescheduleDismissCommands");
|
|
60
61
|
}
|
|
61
62
|
};
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
Option.some(DismissedToast({ payload: entry.payload })),
|
|
92
|
-
]), "@foldkit/ui/toast/update.js#TransitionedOut"),
|
|
93
|
-
})),
|
|
94
|
-
})), "@foldkit/ui/toast/update.js#onSome~2");
|
|
95
|
-
},
|
|
96
|
-
})), "@foldkit/ui/toast/update.js#delegateToEntryAnimation");
|
|
97
|
-
};
|
|
63
|
+
const readEntryAnimation = (entryId) => __foldkitBrandViewResult(((model) => __foldkitBrandViewResult((pipe(Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~4")), Option.map(({ animation }) => __foldkitBrandViewResult((animation), "@foldkit/ui/toast/update.js#anonymous~5")))), "@foldkit/ui/toast/update.js#anonymous~3")), "@foldkit/ui/toast/update.js#readEntryAnimation");
|
|
64
|
+
const writeEntryAnimation = (entryId) => __foldkitBrandViewResult(((model, nextAnimation) => __foldkitBrandViewResult((updateEntry(model, entryId, entry => __foldkitBrandViewResult((evo(entry, { animation: () => __foldkitBrandViewResult((nextAnimation), "@foldkit/ui/toast/update.js#animation") })), "@foldkit/ui/toast/update.js#anonymous~7"))), "@foldkit/ui/toast/update.js#anonymous~6")), "@foldkit/ui/toast/update.js#writeEntryAnimation");
|
|
65
|
+
const toGotAnimationMessage = (entryId) => __foldkitBrandViewResult(((message) => __foldkitBrandViewResult((GotAnimationMessage({ entryId, message })), "@foldkit/ui/toast/update.js#anonymous~8")), "@foldkit/ui/toast/update.js#toGotAnimationMessage");
|
|
66
|
+
const toDismissedToastOutMessage = payload => __foldkitBrandViewResult((M.type().pipe(M.withReturnType(), M.tagsExhaustive({
|
|
67
|
+
StartedLeaveAnimating: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/toast/update.js#StartedLeaveAnimating"),
|
|
68
|
+
TransitionedOut: () => __foldkitBrandViewResult((Option.some(DismissedToast({ payload }))), "@foldkit/ui/toast/update.js#TransitionedOut"),
|
|
69
|
+
}))), "@foldkit/ui/toast/update.js#toDismissedToastOutMessage");
|
|
70
|
+
const foldEntryAnimationOutMessage = entryId => __foldkitBrandViewResult(((outMessage, { liftCommand }) => __foldkitBrandViewResult((M.value(outMessage).pipe(M.withReturnType(), M.tagsExhaustive({
|
|
71
|
+
StartedLeaveAnimating: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult((Option.match(readEntryAnimation(entryId)(model), {
|
|
72
|
+
onNone: () => __foldkitBrandViewResult(([model, []]), "@foldkit/ui/toast/update.js#onNone~2"),
|
|
73
|
+
onSome: animation => __foldkitBrandViewResult(([
|
|
74
|
+
model,
|
|
75
|
+
[liftCommand(animationDefaultLeaveCommand(animation))],
|
|
76
|
+
]), "@foldkit/ui/toast/update.js#onSome~2"),
|
|
77
|
+
})), "@foldkit/ui/toast/update.js#anonymous~10")), "@foldkit/ui/toast/update.js#StartedLeaveAnimating~2"),
|
|
78
|
+
TransitionedOut: () => __foldkitBrandViewResult((model => __foldkitBrandViewResult(([removeEntry(model, entryId), []]), "@foldkit/ui/toast/update.js#anonymous~11")), "@foldkit/ui/toast/update.js#TransitionedOut~2"),
|
|
79
|
+
}))), "@foldkit/ui/toast/update.js#anonymous~9")), "@foldkit/ui/toast/update.js#foldEntryAnimationOutMessage");
|
|
80
|
+
const foldEntryAnimation = (entry) => __foldkitBrandViewResult((Update.foldChild({
|
|
81
|
+
update: animationUpdate,
|
|
82
|
+
read: readEntryAnimation(entry.id),
|
|
83
|
+
write: writeEntryAnimation(entry.id),
|
|
84
|
+
toParentMessage: toGotAnimationMessage(entry.id),
|
|
85
|
+
toParentOutMessage: toDismissedToastOutMessage(entry.payload),
|
|
86
|
+
foldOutMessage: foldEntryAnimationOutMessage(entry.id),
|
|
87
|
+
})), "@foldkit/ui/toast/update.js#foldEntryAnimation");
|
|
88
|
+
const delegateToEntryAnimation = (model, entryId, animationMessage) => __foldkitBrandViewResult((Option.match(Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~12")), {
|
|
89
|
+
onNone: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/toast/update.js#onNone~3"),
|
|
90
|
+
onSome: entry => __foldkitBrandViewResult((foldEntryAnimation(entry)(model, animationMessage)), "@foldkit/ui/toast/update.js#onSome~3"),
|
|
91
|
+
})), "@foldkit/ui/toast/update.js#delegateToEntryAnimation");
|
|
98
92
|
const createEntry = (model, input) => {
|
|
99
93
|
const entryId = `${model.id}-entry-${model.nextEntryKey}`;
|
|
100
94
|
const duration = input.duration === undefined
|
|
@@ -130,7 +124,7 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
130
124
|
nextEntryKey: Number.increment,
|
|
131
125
|
});
|
|
132
126
|
const [modelAfterShow, showCommands] = delegateToEntryAnimation(modelWithEntry, entry.id, AnimationShowed());
|
|
133
|
-
const postShowEntry = Array.findFirst(modelAfterShow.entries, ({ id }) => __foldkitBrandViewResult((id === entry.id), "@foldkit/ui/toast/update.js#anonymous~
|
|
127
|
+
const postShowEntry = Array.findFirst(modelAfterShow.entries, ({ id }) => __foldkitBrandViewResult((id === entry.id), "@foldkit/ui/toast/update.js#anonymous~13"));
|
|
134
128
|
const dismissCommands = Option.match(postShowEntry, {
|
|
135
129
|
onNone: () => __foldkitBrandViewResult(([]), "@foldkit/ui/toast/update.js#onNone~4"),
|
|
136
130
|
onSome: rescheduleDismissCommands,
|
|
@@ -142,41 +136,41 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
142
136
|
]), "@foldkit/ui/toast/update.js#Added");
|
|
143
137
|
},
|
|
144
138
|
Dismissed: ({ entryId }) => {
|
|
145
|
-
const maybeEntry = Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~
|
|
139
|
+
const maybeEntry = Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~14"));
|
|
146
140
|
return __foldkitBrandViewResult((Option.match(maybeEntry, {
|
|
147
141
|
onNone: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/toast/update.js#onNone~5"),
|
|
148
142
|
onSome: entry => {
|
|
149
143
|
if (isEntryLeaving(entry)) {
|
|
150
|
-
return __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/toast/update.js#onSome~
|
|
144
|
+
return __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/toast/update.js#onSome~4");
|
|
151
145
|
}
|
|
152
146
|
else {
|
|
153
|
-
return __foldkitBrandViewResult((delegateToEntryAnimation(model, entryId, AnimationHid())), "@foldkit/ui/toast/update.js#onSome~
|
|
147
|
+
return __foldkitBrandViewResult((delegateToEntryAnimation(model, entryId, AnimationHid())), "@foldkit/ui/toast/update.js#onSome~4");
|
|
154
148
|
}
|
|
155
149
|
},
|
|
156
150
|
})), "@foldkit/ui/toast/update.js#Dismissed");
|
|
157
151
|
},
|
|
158
152
|
DismissedAll: () => __foldkitBrandViewResult((Array.reduce(model.entries, [model, [], Option.none()], ([currentModel, currentCommands, currentOut], entry) => {
|
|
159
153
|
if (isEntryLeaving(entry)) {
|
|
160
|
-
return __foldkitBrandViewResult(([currentModel, currentCommands, currentOut]), "@foldkit/ui/toast/update.js#anonymous~
|
|
154
|
+
return __foldkitBrandViewResult(([currentModel, currentCommands, currentOut]), "@foldkit/ui/toast/update.js#anonymous~15");
|
|
161
155
|
}
|
|
162
156
|
const [nextModel, nextCommands] = delegateToEntryAnimation(currentModel, entry.id, AnimationHid());
|
|
163
157
|
return __foldkitBrandViewResult(([
|
|
164
158
|
nextModel,
|
|
165
159
|
[...currentCommands, ...nextCommands],
|
|
166
160
|
currentOut,
|
|
167
|
-
]), "@foldkit/ui/toast/update.js#anonymous~
|
|
161
|
+
]), "@foldkit/ui/toast/update.js#anonymous~15");
|
|
168
162
|
})), "@foldkit/ui/toast/update.js#DismissedAll"),
|
|
169
163
|
CompletedWaitBeforeDismissal: ({ entryId, version }) => {
|
|
170
|
-
const maybeEntry = Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~
|
|
164
|
+
const maybeEntry = Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~16"));
|
|
171
165
|
return __foldkitBrandViewResult((Option.match(maybeEntry, {
|
|
172
166
|
onNone: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/toast/update.js#onNone~6"),
|
|
173
167
|
onSome: entry => {
|
|
174
168
|
const isStale = version !== entry.pendingDismissVersion;
|
|
175
169
|
if (isStale || isEntryLeaving(entry)) {
|
|
176
|
-
return __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/toast/update.js#onSome~
|
|
170
|
+
return __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/toast/update.js#onSome~5");
|
|
177
171
|
}
|
|
178
172
|
else {
|
|
179
|
-
return __foldkitBrandViewResult((delegateToEntryAnimation(model, entryId, AnimationHid())), "@foldkit/ui/toast/update.js#onSome~
|
|
173
|
+
return __foldkitBrandViewResult((delegateToEntryAnimation(model, entryId, AnimationHid())), "@foldkit/ui/toast/update.js#onSome~5");
|
|
180
174
|
}
|
|
181
175
|
},
|
|
182
176
|
})), "@foldkit/ui/toast/update.js#CompletedWaitBeforeDismissal");
|
|
@@ -185,12 +179,12 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
185
179
|
updateEntry(model, entryId, entry => __foldkitBrandViewResult((evo(entry, {
|
|
186
180
|
isHovered: () => __foldkitBrandViewResult((true), "@foldkit/ui/toast/update.js#isHovered"),
|
|
187
181
|
pendingDismissVersion: Number.increment,
|
|
188
|
-
})), "@foldkit/ui/toast/update.js#anonymous~
|
|
182
|
+
})), "@foldkit/ui/toast/update.js#anonymous~17")),
|
|
189
183
|
[],
|
|
190
184
|
Option.none(),
|
|
191
185
|
]), "@foldkit/ui/toast/update.js#HoveredEntry"),
|
|
192
186
|
LeftEntry: ({ entryId }) => {
|
|
193
|
-
const maybeEntry = Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~
|
|
187
|
+
const maybeEntry = Array.findFirst(model.entries, ({ id }) => __foldkitBrandViewResult((id === entryId), "@foldkit/ui/toast/update.js#anonymous~18"));
|
|
194
188
|
return __foldkitBrandViewResult((Option.match(maybeEntry, {
|
|
195
189
|
onNone: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/toast/update.js#onNone~7"),
|
|
196
190
|
onSome: entry => {
|
|
@@ -199,10 +193,10 @@ export const makeRuntime = (payloadSchema) => {
|
|
|
199
193
|
pendingDismissVersion: Number.increment,
|
|
200
194
|
});
|
|
201
195
|
return __foldkitBrandViewResult(([
|
|
202
|
-
updateEntry(model, entryId, () => __foldkitBrandViewResult((nextEntry), "@foldkit/ui/toast/update.js#anonymous~
|
|
196
|
+
updateEntry(model, entryId, () => __foldkitBrandViewResult((nextEntry), "@foldkit/ui/toast/update.js#anonymous~19")),
|
|
203
197
|
rescheduleDismissCommands(nextEntry),
|
|
204
198
|
Option.none(),
|
|
205
|
-
]), "@foldkit/ui/toast/update.js#onSome~
|
|
199
|
+
]), "@foldkit/ui/toast/update.js#onSome~6");
|
|
206
200
|
},
|
|
207
201
|
})), "@foldkit/ui/toast/update.js#LeftEntry");
|
|
208
202
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foldkit/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.142.0",
|
|
4
4
|
"description": "Headless, accessible UI components for Foldkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"typescript": "^6.0.3",
|
|
129
129
|
"vitest": "^4.1.9",
|
|
130
130
|
"@foldkit/vite-plugin": "0.12.2",
|
|
131
|
-
"foldkit": "0.
|
|
131
|
+
"foldkit": "0.142.0"
|
|
132
132
|
},
|
|
133
133
|
"keywords": [
|
|
134
134
|
"foldkit",
|