@foldkit/ui 0.148.2 → 0.149.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/animation/index.d.ts +3 -3
- package/dist/animation/index.d.ts.map +1 -1
- package/dist/animation/index.js +2 -2
- package/dist/animation/public.d.ts +1 -1
- package/dist/animation/public.d.ts.map +1 -1
- package/dist/animation/public.js +1 -1
- package/dist/animation/schema.d.ts +12 -21
- package/dist/animation/schema.d.ts.map +1 -1
- package/dist/animation/schema.js +11 -15
- package/dist/animation/update.d.ts +1 -1
- package/dist/animation/update.d.ts.map +1 -1
- package/dist/animation/update.js +9 -9
- package/dist/calendar/index.d.ts +50 -105
- package/dist/calendar/index.d.ts.map +1 -1
- package/dist/calendar/index.js +61 -98
- package/dist/calendar/public.d.ts +1 -1
- package/dist/calendar/public.d.ts.map +1 -1
- package/dist/calendar/public.js +1 -1
- package/dist/combobox/multi.d.ts +9 -9
- package/dist/combobox/multi.d.ts.map +1 -1
- package/dist/combobox/multi.js +9 -9
- package/dist/combobox/public.d.ts +1 -1
- package/dist/combobox/public.d.ts.map +1 -1
- package/dist/combobox/public.js +1 -1
- package/dist/combobox/shared.d.ts +93 -137
- package/dist/combobox/shared.d.ts.map +1 -1
- package/dist/combobox/shared.js +108 -153
- package/dist/combobox/single.d.ts +9 -9
- package/dist/combobox/single.d.ts.map +1 -1
- package/dist/combobox/single.js +10 -10
- package/dist/datePicker/index.d.ts +88 -84
- package/dist/datePicker/index.d.ts.map +1 -1
- package/dist/datePicker/index.js +33 -63
- package/dist/datePicker/public.d.ts +1 -1
- package/dist/datePicker/public.d.ts.map +1 -1
- package/dist/datePicker/public.js +1 -1
- package/dist/dialog/index.d.ts +28 -49
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +39 -67
- package/dist/dialog/public.d.ts +1 -1
- package/dist/dialog/public.d.ts.map +1 -1
- package/dist/dialog/public.js +1 -1
- package/dist/dragAndDrop/index.d.ts +45 -72
- package/dist/dragAndDrop/index.d.ts.map +1 -1
- package/dist/dragAndDrop/index.js +72 -93
- package/dist/dragAndDrop/public.d.ts +1 -1
- package/dist/dragAndDrop/public.d.ts.map +1 -1
- package/dist/dragAndDrop/public.js +1 -1
- package/dist/fileDrop/index.d.ts +14 -35
- package/dist/fileDrop/index.d.ts.map +1 -1
- package/dist/fileDrop/index.js +20 -46
- package/dist/fileDrop/public.d.ts +1 -1
- package/dist/fileDrop/public.d.ts.map +1 -1
- package/dist/fileDrop/public.js +1 -1
- package/dist/listbox/multi.d.ts +7 -7
- package/dist/listbox/multi.d.ts.map +1 -1
- package/dist/listbox/multi.js +8 -8
- 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 +80 -127
- package/dist/listbox/shared.d.ts.map +1 -1
- package/dist/listbox/shared.js +92 -149
- package/dist/listbox/single.d.ts +7 -7
- package/dist/listbox/single.d.ts.map +1 -1
- package/dist/listbox/single.js +8 -8
- package/dist/menu/index.d.ts +86 -134
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +141 -189
- package/dist/menu/public.d.ts +1 -1
- package/dist/menu/public.d.ts.map +1 -1
- package/dist/menu/public.js +1 -1
- package/dist/popover/index.d.ts +39 -65
- package/dist/popover/index.d.ts.map +1 -1
- package/dist/popover/index.js +68 -98
- package/dist/popover/public.d.ts +1 -1
- package/dist/popover/public.d.ts.map +1 -1
- package/dist/popover/public.js +1 -1
- package/dist/radioGroup/index.d.ts +18 -29
- package/dist/radioGroup/index.d.ts.map +1 -1
- package/dist/radioGroup/index.js +22 -27
- package/dist/radioGroup/public.d.ts +1 -1
- package/dist/radioGroup/public.d.ts.map +1 -1
- package/dist/radioGroup/public.js +1 -1
- package/dist/slider/index.d.ts +29 -51
- package/dist/slider/index.d.ts.map +1 -1
- package/dist/slider/index.js +36 -56
- package/dist/slider/public.d.ts +1 -1
- package/dist/slider/public.d.ts.map +1 -1
- package/dist/slider/public.js +1 -1
- package/dist/tabs/index.d.ts +18 -28
- package/dist/tabs/index.d.ts.map +1 -1
- package/dist/tabs/index.js +22 -26
- package/dist/tabs/public.d.ts +1 -1
- package/dist/tabs/public.d.ts.map +1 -1
- package/dist/tabs/public.js +1 -1
- package/dist/test/apps/disabledButton.d.ts +71 -14
- package/dist/test/apps/disabledButton.d.ts.map +1 -1
- package/dist/test/apps/disabledButton.js +14 -13
- package/dist/toast/index.d.ts +124 -109
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +5 -5
- package/dist/toast/public.d.ts +1 -1
- package/dist/toast/public.d.ts.map +1 -1
- package/dist/toast/public.js +1 -1
- package/dist/toast/schema.d.ts +72 -84
- package/dist/toast/schema.d.ts.map +1 -1
- package/dist/toast/schema.js +31 -41
- package/dist/toast/test.d.ts.map +1 -1
- package/dist/toast/test.js +6 -3
- package/dist/toast/update.d.ts +104 -89
- package/dist/toast/update.d.ts.map +1 -1
- package/dist/toast/update.js +19 -20
- package/dist/tooltip/message.d.ts +26 -47
- package/dist/tooltip/message.d.ts.map +1 -1
- package/dist/tooltip/message.js +15 -40
- package/dist/tooltip/public.d.ts +1 -1
- package/dist/tooltip/public.d.ts.map +1 -1
- package/dist/tooltip/public.js +1 -1
- package/dist/tooltip/tooltip.d.ts +1 -1
- package/dist/tooltip/tooltip.d.ts.map +1 -1
- package/dist/tooltip/tooltip.js +15 -16
- package/dist/virtualList/index.d.ts +46 -23
- package/dist/virtualList/index.d.ts.map +1 -1
- package/dist/virtualList/index.js +12 -23
- package/dist/virtualList/public.d.ts +1 -1
- package/dist/virtualList/public.d.ts.map +1 -1
- package/dist/virtualList/public.js +1 -1
- package/package.json +3 -3
package/dist/radioGroup/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Array, Effect, Match as M, Option, Predicate, Schema as S, String, pipe
|
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import * as Dom from 'foldkit/dom';
|
|
5
5
|
import { childAttributes } from 'foldkit/html';
|
|
6
|
-
import {
|
|
6
|
+
import { defineMessageUnion } from 'foldkit/message';
|
|
7
7
|
import { evo } from 'foldkit/struct';
|
|
8
8
|
import { defineView } from 'foldkit/submodel';
|
|
9
9
|
import { idSelector } from '../internal/selectors.js';
|
|
@@ -21,27 +21,22 @@ export const Model = S.Struct({
|
|
|
21
21
|
maybeFocusedIndex: S.Option(S.Number),
|
|
22
22
|
});
|
|
23
23
|
// MESSAGE
|
|
24
|
-
/** Sent when an option is committed via click or keyboard. Commits the option
|
|
25
|
-
* as the new selection and moves focus onto it. */
|
|
26
|
-
export const SelectedOption = m('SelectedOption', {
|
|
27
|
-
index: S.Number,
|
|
28
|
-
value: S.String,
|
|
29
|
-
});
|
|
30
|
-
/** Sent when an option receives keyboard focus without being committed, which
|
|
31
|
-
* is how a read-only group navigates. */
|
|
32
|
-
export const FocusedOption = m('FocusedOption', { index: S.Number });
|
|
33
|
-
/** Sent when the focus-option command completes. */
|
|
34
|
-
export const CompletedFocusOption = m('CompletedFocusOption');
|
|
35
24
|
/** Union of all messages the radio group can produce. */
|
|
36
|
-
export const Message =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
index: S.Number,
|
|
25
|
+
export const Message = defineMessageUnion({
|
|
26
|
+
SelectedOption: {
|
|
27
|
+
index: S.Number,
|
|
28
|
+
value: S.String,
|
|
29
|
+
},
|
|
30
|
+
FocusedOption: { index: S.Number },
|
|
31
|
+
CompletedFocusOption: {},
|
|
42
32
|
});
|
|
43
33
|
/** Union of out-messages the radio group can produce. Surfaced as the third element of `update`'s return tuple and pattern-matched by the parent. */
|
|
44
|
-
export const OutMessage =
|
|
34
|
+
export const OutMessage = defineMessageUnion({
|
|
35
|
+
Selected: {
|
|
36
|
+
value: S.String,
|
|
37
|
+
index: S.Number,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
45
40
|
/** Creates an initial radio group model from a config. Focus follows the
|
|
46
41
|
* selected option until the user navigates a read-only group, so
|
|
47
42
|
* `maybeFocusedIndex` starts `None`. */
|
|
@@ -56,18 +51,18 @@ const descriptionId = (id, index) => __foldkitBrandViewResult((`${id}-option-${i
|
|
|
56
51
|
/** Moves focus to the option at the given index. */
|
|
57
52
|
export const FocusOption = Command.define('FocusOption', {
|
|
58
53
|
args: { id: S.String, index: S.Number },
|
|
59
|
-
messages: [CompletedFocusOption],
|
|
60
|
-
execute: ({ id, index }) => __foldkitBrandViewResult((Dom.focus(idSelector(optionId(id, index))).pipe(Effect.ignore, Effect.as(CompletedFocusOption()))), "@foldkit/ui/radioGroup/index.js#execute"),
|
|
54
|
+
messages: [Message.CompletedFocusOption],
|
|
55
|
+
execute: ({ id, index }) => __foldkitBrandViewResult((Dom.focus(idSelector(optionId(id, index))).pipe(Effect.ignore, Effect.as(Message.CompletedFocusOption()))), "@foldkit/ui/radioGroup/index.js#execute"),
|
|
61
56
|
});
|
|
62
57
|
/** Processes a radio group message and returns the next model, commands, and
|
|
63
58
|
* an optional OutMessage. `Selected` fires when an option is committed via
|
|
64
59
|
* click or keyboard; the parent stores the new value and passes it back in as
|
|
65
60
|
* `selectedValue`. */
|
|
66
|
-
export const update = (model, message) => __foldkitBrandViewResult((
|
|
61
|
+
export const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
|
|
67
62
|
SelectedOption: ({ index, value }) => __foldkitBrandViewResult(([
|
|
68
63
|
evo(model, { maybeFocusedIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/radioGroup/index.js#maybeFocusedIndex") }),
|
|
69
64
|
[FocusOption({ id: model.id, index })],
|
|
70
|
-
Option.some(Selected({ value, index })),
|
|
65
|
+
Option.some(OutMessage.Selected({ value, index })),
|
|
71
66
|
]), "@foldkit/ui/radioGroup/index.js#SelectedOption"),
|
|
72
67
|
FocusedOption: ({ index }) => __foldkitBrandViewResult(([
|
|
73
68
|
evo(model, { maybeFocusedIndex: () => __foldkitBrandViewResult((Option.some(index)), "@foldkit/ui/radioGroup/index.js#maybeFocusedIndex~2") }),
|
|
@@ -75,7 +70,7 @@ export const update = (model, message) => __foldkitBrandViewResult((M.value(mess
|
|
|
75
70
|
Option.none(),
|
|
76
71
|
]), "@foldkit/ui/radioGroup/index.js#FocusedOption"),
|
|
77
72
|
CompletedFocusOption: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/radioGroup/index.js#CompletedFocusOption"),
|
|
78
|
-
}))
|
|
73
|
+
})), "@foldkit/ui/radioGroup/index.js#update");
|
|
79
74
|
const internalView = defineView((model, viewInputs, h) => {
|
|
80
75
|
const { id, maybeFocusedIndex } = model;
|
|
81
76
|
const { options, selectedValue, ariaLabel, toView, orientation = 'Vertical', isOptionDisabled: isOptionDisabledFn, isDisabled: isGroupDisabled = false, isReadOnly = false, name, } = viewInputs;
|
|
@@ -104,9 +99,9 @@ const internalView = defineView((model, viewInputs, h) => {
|
|
|
104
99
|
previousKey: 'ArrowUp',
|
|
105
100
|
}), "@foldkit/ui/radioGroup/index.js#anonymous~10"))), M.exhaustive);
|
|
106
101
|
const resolveKeyIndex = keyToIndex(nextKey, previousKey, options.length, focusedIndex, isDisabled);
|
|
107
|
-
const optionSelectedAt = (index) => __foldkitBrandViewResult((pipe(options, Array.get(index), Option.map(value => __foldkitBrandViewResult((SelectedOption({ index, value })), "@foldkit/ui/radioGroup/index.js#anonymous~11")))), "@foldkit/ui/radioGroup/index.js#optionSelectedAt");
|
|
102
|
+
const optionSelectedAt = (index) => __foldkitBrandViewResult((pipe(options, Array.get(index), Option.map(value => __foldkitBrandViewResult((Message.SelectedOption({ index, value })), "@foldkit/ui/radioGroup/index.js#anonymous~11")))), "@foldkit/ui/radioGroup/index.js#optionSelectedAt");
|
|
108
103
|
const handleSelectingKeyDown = (currentIndex, key) => __foldkitBrandViewResult((M.value(key).pipe(M.whenOr(nextKey, previousKey, 'Home', 'End', 'PageUp', 'PageDown', () => __foldkitBrandViewResult((optionSelectedAt(resolveKeyIndex(key))), "@foldkit/ui/radioGroup/index.js#anonymous~12")), M.when(' ', () => __foldkitBrandViewResult((optionSelectedAt(currentIndex)), "@foldkit/ui/radioGroup/index.js#anonymous~13")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/radioGroup/index.js#anonymous~14")))), "@foldkit/ui/radioGroup/index.js#handleSelectingKeyDown");
|
|
109
|
-
const handleReadOnlyKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.whenOr(nextKey, previousKey, 'Home', 'End', 'PageUp', 'PageDown', () => __foldkitBrandViewResult((Option.some(FocusedOption({ index: resolveKeyIndex(key) }))), "@foldkit/ui/radioGroup/index.js#anonymous~15")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/radioGroup/index.js#anonymous~16")))), "@foldkit/ui/radioGroup/index.js#handleReadOnlyKeyDown");
|
|
104
|
+
const handleReadOnlyKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.whenOr(nextKey, previousKey, 'Home', 'End', 'PageUp', 'PageDown', () => __foldkitBrandViewResult((Option.some(Message.FocusedOption({ index: resolveKeyIndex(key) }))), "@foldkit/ui/radioGroup/index.js#anonymous~15")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/radioGroup/index.js#anonymous~16")))), "@foldkit/ui/radioGroup/index.js#handleReadOnlyKeyDown");
|
|
110
105
|
const handleKeyDown = (currentIndex) => __foldkitBrandViewResult(((key) => {
|
|
111
106
|
if (isReadOnly) {
|
|
112
107
|
return __foldkitBrandViewResult((handleReadOnlyKeyDown(key)), "@foldkit/ui/radioGroup/index.js#anonymous~17");
|
|
@@ -131,7 +126,7 @@ const internalView = defineView((model, viewInputs, h) => {
|
|
|
131
126
|
: [];
|
|
132
127
|
const clickAttributes = isOptionDisabledNow || isReadOnly
|
|
133
128
|
? []
|
|
134
|
-
: [h.OnClick(SelectedOption({ index, value }))];
|
|
129
|
+
: [h.OnClick(Message.SelectedOption({ index, value }))];
|
|
135
130
|
const keyDownAttributes = isOptionDisabledNow
|
|
136
131
|
? []
|
|
137
132
|
: [h.OnKeyDownPreventDefault(handleKeyDown(index))];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { init, create, Model, Message, OutMessage, Selected, SelectedOption, FocusedOption,
|
|
1
|
+
export { init, create, Model, Message, OutMessage, type Selected, type SelectedOption, type FocusedOption, FocusOption, Orientation, } from './index.js';
|
|
2
2
|
export type { InitConfig, ViewInputs, RenderInfo, OptionInfo, Bundle, } from './index.js';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/radioGroup/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,KAAK,EACL,OAAO,EACP,UAAU,EACV,QAAQ,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/radioGroup/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,WAAW,EACX,WAAW,GACZ,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,MAAM,GACP,MAAM,YAAY,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, create, Model, Message, OutMessage,
|
|
1
|
+
export { init, create, Model, Message, OutMessage, FocusOption, Orientation, } from './index.js';
|
package/dist/slider/index.d.ts
CHANGED
|
@@ -18,60 +18,38 @@ export declare const Model: S.Struct<{
|
|
|
18
18
|
}>]>;
|
|
19
19
|
}>;
|
|
20
20
|
export type Model = typeof Model.Type;
|
|
21
|
-
/** The user pressed the thumb. Starts a drag without changing the value. The
|
|
22
|
-
* view supplies `originValue`, the current value, so Escape can restore it. */
|
|
23
|
-
export declare const PressedThumb: import("foldkit/schema").CallableTaggedStruct<"PressedThumb", {
|
|
24
|
-
originValue: S.Number;
|
|
25
|
-
}>;
|
|
26
|
-
/** The user pressed the track. Starts a drag and snaps the value to the
|
|
27
|
-
* cursor position. Ignored while already dragging, which absorbs the bubble
|
|
28
|
-
* from a thumb press so the value is not shifted. `originValue` is the current
|
|
29
|
-
* value the drag restores to on Escape. */
|
|
30
|
-
export declare const PressedPointer: import("foldkit/schema").CallableTaggedStruct<"PressedPointer", {
|
|
31
|
-
value: S.Number;
|
|
32
|
-
originValue: S.Number;
|
|
33
|
-
}>;
|
|
34
|
-
/** The pointer moved during a drag, producing a new snapped value from the
|
|
35
|
-
* cursor position within the track. */
|
|
36
|
-
export declare const MovedDragPointer: import("foldkit/schema").CallableTaggedStruct<"MovedDragPointer", {
|
|
37
|
-
value: S.Number;
|
|
38
|
-
}>;
|
|
39
|
-
/** The pointer was released during a drag. Commits the current value. */
|
|
40
|
-
export declare const ReleasedDragPointer: import("foldkit/schema").CallableTaggedStruct<"ReleasedDragPointer", {}>;
|
|
41
|
-
/** Escape was pressed during a drag. Restores the value from the drag origin. */
|
|
42
|
-
export declare const CancelledDrag: import("foldkit/schema").CallableTaggedStruct<"CancelledDrag", {}>;
|
|
43
|
-
/** The user pressed a keyboard navigation key on the focused thumb. The view
|
|
44
|
-
* supplies `value`, the current value, to compute the next one from. */
|
|
45
|
-
export declare const PressedKeyboardNavigation: import("foldkit/schema").CallableTaggedStruct<"PressedKeyboardNavigation", {
|
|
46
|
-
direction: S.Literals<readonly ["StepDecrement", "StepIncrement", "PageDecrement", "PageIncrement", "Min", "Max"]>;
|
|
47
|
-
value: S.Number;
|
|
48
|
-
}>;
|
|
49
21
|
/** Union of all messages the slider component can produce. */
|
|
50
|
-
export declare const Message:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
* validation or trigger a downstream Command. */
|
|
68
|
-
export declare const ChangedValue: import("foldkit/schema").CallableTaggedStruct<"ChangedValue", {
|
|
69
|
-
value: S.Number;
|
|
22
|
+
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
23
|
+
readonly PressedThumb: {
|
|
24
|
+
readonly originValue: S.Number;
|
|
25
|
+
};
|
|
26
|
+
readonly PressedPointer: {
|
|
27
|
+
readonly value: S.Number;
|
|
28
|
+
readonly originValue: S.Number;
|
|
29
|
+
};
|
|
30
|
+
readonly MovedDragPointer: {
|
|
31
|
+
readonly value: S.Number;
|
|
32
|
+
};
|
|
33
|
+
readonly ReleasedDragPointer: {};
|
|
34
|
+
readonly CancelledDrag: {};
|
|
35
|
+
readonly PressedKeyboardNavigation: {
|
|
36
|
+
readonly direction: S.Literals<readonly ["StepDecrement", "StepIncrement", "PageDecrement", "PageIncrement", "Min", "Max"]>;
|
|
37
|
+
readonly value: S.Number;
|
|
38
|
+
};
|
|
70
39
|
}>;
|
|
40
|
+
export type Message = typeof Message.Type;
|
|
41
|
+
export type PressedThumb = typeof Message.PressedThumb.Type;
|
|
42
|
+
export type PressedPointer = typeof Message.PressedPointer.Type;
|
|
43
|
+
export type MovedDragPointer = typeof Message.MovedDragPointer.Type;
|
|
44
|
+
export type ReleasedDragPointer = typeof Message.ReleasedDragPointer.Type;
|
|
45
|
+
export type CancelledDrag = typeof Message.CancelledDrag.Type;
|
|
46
|
+
export type PressedKeyboardNavigation = typeof Message.PressedKeyboardNavigation.Type;
|
|
71
47
|
/** Union of all out-messages the slider component can emit to its parent. */
|
|
72
|
-
export declare const OutMessage:
|
|
73
|
-
|
|
74
|
-
|
|
48
|
+
export declare const OutMessage: import("foldkit/message").MessageUnion<{
|
|
49
|
+
readonly ChangedValue: {
|
|
50
|
+
readonly value: S.Number;
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
75
53
|
export type OutMessage = typeof OutMessage.Type;
|
|
76
54
|
/** Configuration for creating a slider model with `init`. */
|
|
77
55
|
export type InitConfig = Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/slider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,MAAM,EACN,MAAM,IAAI,CAAC,EAIZ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAI9E,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,kBAAkB,CAAA;AAC3D,OAAO,KAAK,YAAY,MAAM,sBAAsB,CAAA;AAWpD;;;;2EAI2E;AAC3E,eAAO,MAAM,KAAK;;;;;;;;EAMhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/slider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,MAAM,EACN,MAAM,IAAI,CAAC,EAIZ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAI9E,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,kBAAkB,CAAA;AAC3D,OAAO,KAAK,YAAY,MAAM,sBAAsB,CAAA;AAWpD;;;;2EAI2E;AAC3E,eAAO,MAAM,KAAK;;;;;;;;EAMhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,8DAA8D;AAC9D,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;EAoBlB,CAAA;AAEF,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CAAA;IACvB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACvC;;;gCAG4B;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;;;;eAQW;IACX,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;4DAGwD;IACxD,YAAY,CAAC,EAAE,MAAM,QAAQ,GAAG,UAAU,CAAA;CAC3C,CAAC,CAAA;AAEF;;;;0EAI0E;AAC1E,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAnCf;8EAC0E;WACnE,MAAM;YACL,CAAC,UAAU,EAAE,gBAAgB,KAAK,IAAI;gBAClC,MAAM;qBACD,MAAM;kBACT,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM;IACvC;;;gCAG4B;iBACf,OAAO;IACpB;;;;;;;;eAQW;iBACE,OAAO;WACb,MAAM;IACb;;;4DAGwD;mBACzC,MAAM,QAAQ,GAAG,UAAU;GA2J3C,CAAA"}
|
package/dist/slider/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
|
|
2
2
|
import { Effect, Equal, Function, Match as M, Option, Schema as S, Stream, String as String_, pipe, } from 'effect';
|
|
3
3
|
import { childAttributes } from 'foldkit/html';
|
|
4
|
-
import {
|
|
4
|
+
import { defineMessageUnion } from 'foldkit/message';
|
|
5
5
|
import { ts } from 'foldkit/schema';
|
|
6
6
|
import { evo } from 'foldkit/struct';
|
|
7
7
|
import { defineView } from 'foldkit/submodel';
|
|
@@ -24,53 +24,33 @@ export const Model = S.Struct({
|
|
|
24
24
|
dragState: DragState,
|
|
25
25
|
});
|
|
26
26
|
// MESSAGE
|
|
27
|
-
/** The user pressed the thumb. Starts a drag without changing the value. The
|
|
28
|
-
* view supplies `originValue`, the current value, so Escape can restore it. */
|
|
29
|
-
export const PressedThumb = m('PressedThumb', { originValue: S.Number });
|
|
30
|
-
/** The user pressed the track. Starts a drag and snaps the value to the
|
|
31
|
-
* cursor position. Ignored while already dragging, which absorbs the bubble
|
|
32
|
-
* from a thumb press so the value is not shifted. `originValue` is the current
|
|
33
|
-
* value the drag restores to on Escape. */
|
|
34
|
-
export const PressedPointer = m('PressedPointer', {
|
|
35
|
-
value: S.Number,
|
|
36
|
-
originValue: S.Number,
|
|
37
|
-
});
|
|
38
|
-
/** The pointer moved during a drag, producing a new snapped value from the
|
|
39
|
-
* cursor position within the track. */
|
|
40
|
-
export const MovedDragPointer = m('MovedDragPointer', { value: S.Number });
|
|
41
|
-
/** The pointer was released during a drag. Commits the current value. */
|
|
42
|
-
export const ReleasedDragPointer = m('ReleasedDragPointer');
|
|
43
|
-
/** Escape was pressed during a drag. Restores the value from the drag origin. */
|
|
44
|
-
export const CancelledDrag = m('CancelledDrag');
|
|
45
|
-
/** The user pressed a keyboard navigation key on the focused thumb. The view
|
|
46
|
-
* supplies `value`, the current value, to compute the next one from. */
|
|
47
|
-
export const PressedKeyboardNavigation = m('PressedKeyboardNavigation', {
|
|
48
|
-
direction: S.Literals([
|
|
49
|
-
'StepDecrement',
|
|
50
|
-
'StepIncrement',
|
|
51
|
-
'PageDecrement',
|
|
52
|
-
'PageIncrement',
|
|
53
|
-
'Min',
|
|
54
|
-
'Max',
|
|
55
|
-
]),
|
|
56
|
-
value: S.Number,
|
|
57
|
-
});
|
|
58
27
|
/** Union of all messages the slider component can produce. */
|
|
59
|
-
export const Message =
|
|
60
|
-
PressedThumb,
|
|
61
|
-
PressedPointer
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
28
|
+
export const Message = defineMessageUnion({
|
|
29
|
+
PressedThumb: { originValue: S.Number },
|
|
30
|
+
PressedPointer: {
|
|
31
|
+
value: S.Number,
|
|
32
|
+
originValue: S.Number,
|
|
33
|
+
},
|
|
34
|
+
MovedDragPointer: { value: S.Number },
|
|
35
|
+
ReleasedDragPointer: {},
|
|
36
|
+
CancelledDrag: {},
|
|
37
|
+
PressedKeyboardNavigation: {
|
|
38
|
+
direction: S.Literals([
|
|
39
|
+
'StepDecrement',
|
|
40
|
+
'StepIncrement',
|
|
41
|
+
'PageDecrement',
|
|
42
|
+
'PageIncrement',
|
|
43
|
+
'Min',
|
|
44
|
+
'Max',
|
|
45
|
+
]),
|
|
46
|
+
value: S.Number,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
67
49
|
// OUT MESSAGE
|
|
68
|
-
/** Emitted when the slider value changes. The parent can handle this to
|
|
69
|
-
* update its own state or dispatch its own Commands, for example to run
|
|
70
|
-
* validation or trigger a downstream Command. */
|
|
71
|
-
export const ChangedValue = m('ChangedValue', { value: S.Number });
|
|
72
50
|
/** Union of all out-messages the slider component can emit to its parent. */
|
|
73
|
-
export const OutMessage =
|
|
51
|
+
export const OutMessage = defineMessageUnion({
|
|
52
|
+
ChangedValue: { value: S.Number },
|
|
53
|
+
});
|
|
74
54
|
/** Creates an initial slider model from a config. The value lives in the
|
|
75
55
|
* parent Model; initialize it there and snap it with {@link snapAndClamp}. */
|
|
76
56
|
export const init = (config) => (__foldkitBrandViewResult(({
|
|
@@ -116,12 +96,12 @@ const nextValueForDirection = (value, min, max, step, direction) => __foldkitBra
|
|
|
116
96
|
const withUpdateReturn = M.withReturnType();
|
|
117
97
|
const changedValueOption = (currentValue, nextValue) => __foldkitBrandViewResult((nextValue === currentValue
|
|
118
98
|
? Option.none()
|
|
119
|
-
: Option.some(ChangedValue({ value: nextValue }))), "@foldkit/ui/slider/index.js#changedValueOption");
|
|
99
|
+
: Option.some(OutMessage.ChangedValue({ value: nextValue }))), "@foldkit/ui/slider/index.js#changedValueOption");
|
|
120
100
|
/** Processes a slider message and returns the next model, commands, and an
|
|
121
101
|
* optional out-message for the parent. The value lives in the parent Model:
|
|
122
102
|
* the view supplies the current value on the messages that need it, and value
|
|
123
103
|
* changes surface as `ChangedValue` rather than mutating this Model. */
|
|
124
|
-
export const update = (model, message) => __foldkitBrandViewResult((
|
|
104
|
+
export const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
|
|
125
105
|
PressedThumb: ({ originValue }) => __foldkitBrandViewResult((M.value(model.dragState).pipe(withUpdateReturn, M.tag('Dragging', () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/slider/index.js#anonymous~7")), M.orElse(() => __foldkitBrandViewResult(([
|
|
126
106
|
evo(model, { dragState: () => __foldkitBrandViewResult((Dragging({ originValue })), "@foldkit/ui/slider/index.js#dragState") }),
|
|
127
107
|
[],
|
|
@@ -144,7 +124,7 @@ export const update = (model, message) => __foldkitBrandViewResult((M.value(mess
|
|
|
144
124
|
MovedDragPointer: ({ value }) => __foldkitBrandViewResult((M.value(model.dragState).pipe(withUpdateReturn, M.tag('Dragging', () => __foldkitBrandViewResult(([
|
|
145
125
|
model,
|
|
146
126
|
[],
|
|
147
|
-
Option.some(ChangedValue({
|
|
127
|
+
Option.some(OutMessage.ChangedValue({
|
|
148
128
|
value: snapAndClamp(value, model.min, model.max, model.step),
|
|
149
129
|
})),
|
|
150
130
|
]), "@foldkit/ui/slider/index.js#anonymous~11")), M.orElse(() => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/slider/index.js#anonymous~12")))), "@foldkit/ui/slider/index.js#MovedDragPointer"),
|
|
@@ -156,14 +136,14 @@ export const update = (model, message) => __foldkitBrandViewResult((M.value(mess
|
|
|
156
136
|
CancelledDrag: () => __foldkitBrandViewResult((M.value(model.dragState).pipe(withUpdateReturn, M.tag('Dragging', ({ originValue }) => __foldkitBrandViewResult(([
|
|
157
137
|
evo(model, { dragState: () => __foldkitBrandViewResult((Idle()), "@foldkit/ui/slider/index.js#dragState~4") }),
|
|
158
138
|
[],
|
|
159
|
-
Option.some(ChangedValue({ value: originValue })),
|
|
139
|
+
Option.some(OutMessage.ChangedValue({ value: originValue })),
|
|
160
140
|
]), "@foldkit/ui/slider/index.js#anonymous~15")), M.orElse(() => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/slider/index.js#anonymous~16")))), "@foldkit/ui/slider/index.js#CancelledDrag"),
|
|
161
141
|
PressedKeyboardNavigation: ({ direction, value }) => __foldkitBrandViewResult(([
|
|
162
142
|
model,
|
|
163
143
|
[],
|
|
164
144
|
changedValueOption(value, nextValueForDirection(value, model.min, model.max, model.step, direction)),
|
|
165
145
|
]), "@foldkit/ui/slider/index.js#PressedKeyboardNavigation"),
|
|
166
|
-
}))
|
|
146
|
+
})), "@foldkit/ui/slider/index.js#update");
|
|
167
147
|
/** Reflects an externally-driven range onto the slider. Use this when min/max
|
|
168
148
|
* derive from external state (e.g. a bounded buffer whose first/last index
|
|
169
149
|
* shifts over time). The parent owns the value, so conform it to the new range
|
|
@@ -204,9 +184,9 @@ export const subscriptionsForRoot = (getTrackRoot) => __foldkitBrandViewResult((
|
|
|
204
184
|
max: model.max,
|
|
205
185
|
}), "@foldkit/ui/slider/index.js#modelToDependencies")),
|
|
206
186
|
dependenciesToStream: ({ dragActivity, id, min, max }) => {
|
|
207
|
-
const pointerEvents = Stream.merge(Stream.fromEventListener(document, 'pointermove').pipe(Stream.mapEffect(event => __foldkitBrandViewResult((Effect.sync(() => __foldkitBrandViewResult((Option.map(trackElement(id, getTrackRoot()), element => __foldkitBrandViewResult((MovedDragPointer({
|
|
187
|
+
const pointerEvents = Stream.merge(Stream.fromEventListener(document, 'pointermove').pipe(Stream.mapEffect(event => __foldkitBrandViewResult((Effect.sync(() => __foldkitBrandViewResult((Option.map(trackElement(id, getTrackRoot()), element => __foldkitBrandViewResult((Message.MovedDragPointer({
|
|
208
188
|
value: valueFromClientX(event.clientX, element, min, max),
|
|
209
|
-
})), "@foldkit/ui/slider/index.js#anonymous~23"))), "@foldkit/ui/slider/index.js#anonymous~22"))), "@foldkit/ui/slider/index.js#anonymous~21")), Stream.filter(Option.isSome), Stream.map(option => __foldkitBrandViewResult((option.value), "@foldkit/ui/slider/index.js#anonymous~24"))), Stream.fromEventListener(document, 'pointerup').pipe(Stream.map(() => __foldkitBrandViewResult((ReleasedDragPointer()), "@foldkit/ui/slider/index.js#anonymous~25"))));
|
|
189
|
+
})), "@foldkit/ui/slider/index.js#anonymous~23"))), "@foldkit/ui/slider/index.js#anonymous~22"))), "@foldkit/ui/slider/index.js#anonymous~21")), Stream.filter(Option.isSome), Stream.map(option => __foldkitBrandViewResult((option.value), "@foldkit/ui/slider/index.js#anonymous~24"))), Stream.fromEventListener(document, 'pointerup').pipe(Stream.map(() => __foldkitBrandViewResult((Message.ReleasedDragPointer()), "@foldkit/ui/slider/index.js#anonymous~25"))));
|
|
210
190
|
// NOTE: prevents text selection and locks cursor to grabbing while the
|
|
211
191
|
// user drags the thumb. Matches the approach used in drag-and-drop.
|
|
212
192
|
const documentDragStyles = Stream.callback(() => __foldkitBrandViewResult((Effect.acquireRelease(Effect.sync(() => {
|
|
@@ -228,7 +208,7 @@ export const subscriptionsForRoot = (getTrackRoot) => __foldkitBrandViewResult((
|
|
|
228
208
|
modelToDependencies: model => (__foldkitBrandViewResult(({
|
|
229
209
|
dragActivity: dragActivityFromModel(model),
|
|
230
210
|
}), "@foldkit/ui/slider/index.js#modelToDependencies~2")),
|
|
231
|
-
dependenciesToStream: ({ dragActivity }) => __foldkitBrandViewResult((Stream.when(Stream.fromEventListener(document, 'keydown').pipe(Stream.filter(({ key }) => __foldkitBrandViewResult((key === 'Escape'), "@foldkit/ui/slider/index.js#anonymous~32")), Stream.map(() => __foldkitBrandViewResult((CancelledDrag()), "@foldkit/ui/slider/index.js#anonymous~33"))), Effect.sync(() => __foldkitBrandViewResult((dragActivity === 'Active'), "@foldkit/ui/slider/index.js#anonymous~34")))), "@foldkit/ui/slider/index.js#dependenciesToStream~2"),
|
|
211
|
+
dependenciesToStream: ({ dragActivity }) => __foldkitBrandViewResult((Stream.when(Stream.fromEventListener(document, 'keydown').pipe(Stream.filter(({ key }) => __foldkitBrandViewResult((key === 'Escape'), "@foldkit/ui/slider/index.js#anonymous~32")), Stream.map(() => __foldkitBrandViewResult((Message.CancelledDrag()), "@foldkit/ui/slider/index.js#anonymous~33"))), Effect.sync(() => __foldkitBrandViewResult((dragActivity === 'Active'), "@foldkit/ui/slider/index.js#anonymous~34")))), "@foldkit/ui/slider/index.js#dependenciesToStream~2"),
|
|
232
212
|
}),
|
|
233
213
|
}), "@foldkit/ui/slider/index.js#anonymous~20")))), "@foldkit/ui/slider/index.js#subscriptionsForRoot");
|
|
234
214
|
/** Default drag subscriptions, with the track looked up via `document`. */
|
|
@@ -248,13 +228,13 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
248
228
|
const { id, min, max } = model;
|
|
249
229
|
const isDragging = model.dragState._tag === 'Dragging';
|
|
250
230
|
const fraction = fractionOfValue(value, min, max);
|
|
251
|
-
const handleKeyDown = (key) => __foldkitBrandViewResult((Option.map(keyToDirection(key), direction => __foldkitBrandViewResult((PressedKeyboardNavigation({ direction, value })), "@foldkit/ui/slider/index.js#anonymous~44"))), "@foldkit/ui/slider/index.js#handleKeyDown");
|
|
252
|
-
const pointerAtClientX = (clientX) => __foldkitBrandViewResult((Option.map(trackElement(id, getTrackRoot()), element => __foldkitBrandViewResult((PressedPointer({
|
|
231
|
+
const handleKeyDown = (key) => __foldkitBrandViewResult((Option.map(keyToDirection(key), direction => __foldkitBrandViewResult((Message.PressedKeyboardNavigation({ direction, value })), "@foldkit/ui/slider/index.js#anonymous~44"))), "@foldkit/ui/slider/index.js#handleKeyDown");
|
|
232
|
+
const pointerAtClientX = (clientX) => __foldkitBrandViewResult((Option.map(trackElement(id, getTrackRoot()), element => __foldkitBrandViewResult((Message.PressedPointer({
|
|
253
233
|
value: valueFromClientX(clientX, element, min, max),
|
|
254
234
|
originValue: value,
|
|
255
235
|
})), "@foldkit/ui/slider/index.js#anonymous~45"))), "@foldkit/ui/slider/index.js#pointerAtClientX");
|
|
256
236
|
const trackPointerHandler = (_pointerType, button, _screenX, _screenY, _timeStamp, clientX) => __foldkitBrandViewResult((pipe(button, Option.liftPredicate(Equal.equals(LEFT_MOUSE_BUTTON)), Option.flatMap(() => __foldkitBrandViewResult((pointerAtClientX(clientX)), "@foldkit/ui/slider/index.js#anonymous~46")))), "@foldkit/ui/slider/index.js#trackPointerHandler");
|
|
257
|
-
const thumbPointerHandler = (_pointerType, button) => __foldkitBrandViewResult((pipe(button, Option.liftPredicate(Equal.equals(LEFT_MOUSE_BUTTON)), Option.map(() => __foldkitBrandViewResult((PressedThumb({ originValue: value })), "@foldkit/ui/slider/index.js#anonymous~47")))), "@foldkit/ui/slider/index.js#thumbPointerHandler");
|
|
237
|
+
const thumbPointerHandler = (_pointerType, button) => __foldkitBrandViewResult((pipe(button, Option.liftPredicate(Equal.equals(LEFT_MOUSE_BUTTON)), Option.map(() => __foldkitBrandViewResult((Message.PressedThumb({ originValue: value })), "@foldkit/ui/slider/index.js#anonymous~47")))), "@foldkit/ui/slider/index.js#thumbPointerHandler");
|
|
258
238
|
const stateAttributes = [
|
|
259
239
|
...(isDragging ? [h.DataAttribute('dragging', '')] : []),
|
|
260
240
|
...(isDisabled ? [h.DataAttribute('disabled', '')] : []),
|
package/dist/slider/public.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { init, update, reflectRange, view, subscriptions, subscriptionsForRoot, fractionOfValue, snapAndClamp, Model, Message, OutMessage, PressedThumb, PressedPointer, MovedDragPointer, ReleasedDragPointer, CancelledDrag, PressedKeyboardNavigation, } from './index.js';
|
|
1
|
+
export { init, update, reflectRange, view, subscriptions, subscriptionsForRoot, fractionOfValue, snapAndClamp, Model, Message, OutMessage, type PressedThumb, type PressedPointer, type MovedDragPointer, type ReleasedDragPointer, type CancelledDrag, type PressedKeyboardNavigation, } from './index.js';
|
|
2
2
|
export type { InitConfig, ViewInputs, SliderAttributes } from './index.js';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/slider/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,KAAK,EACL,OAAO,EACP,UAAU,EACV,YAAY,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/slider/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,KAAK,EACL,OAAO,EACP,UAAU,EACV,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,yBAAyB,GAC/B,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/slider/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, reflectRange, view, subscriptions, subscriptionsForRoot, fractionOfValue, snapAndClamp, Model, Message, OutMessage,
|
|
1
|
+
export { init, update, reflectRange, view, subscriptions, subscriptionsForRoot, fractionOfValue, snapAndClamp, Model, Message, OutMessage, } from './index.js';
|
package/dist/tabs/index.d.ts
CHANGED
|
@@ -20,42 +20,32 @@ export declare const Model: S.Struct<{
|
|
|
20
20
|
readonly activationMode: S.Literals<readonly ["Automatic", "Manual"]>;
|
|
21
21
|
}>;
|
|
22
22
|
export type Model = typeof Model.Type;
|
|
23
|
-
/** Sent when a tab is selected via click or keyboard. Commits the tab as the
|
|
24
|
-
* new selection and moves focus onto it. */
|
|
25
|
-
export declare const SelectedTab: import("foldkit/schema").CallableTaggedStruct<"SelectedTab", {
|
|
26
|
-
index: S.Number;
|
|
27
|
-
value: S.String;
|
|
28
|
-
}>;
|
|
29
|
-
/** Sent when a tab receives keyboard focus in `Manual` mode without being activated. */
|
|
30
|
-
export declare const FocusedTab: import("foldkit/schema").CallableTaggedStruct<"FocusedTab", {
|
|
31
|
-
index: S.Number;
|
|
32
|
-
}>;
|
|
33
|
-
/** Sent when the focus-tab command completes. */
|
|
34
|
-
export declare const CompletedFocusTab: import("foldkit/schema").CallableTaggedStruct<"CompletedFocusTab", {}>;
|
|
35
23
|
/** Union of all messages the tabs component can produce. */
|
|
36
|
-
export declare const Message:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export declare const Selected: import("foldkit/schema").CallableTaggedStruct<"Selected", {
|
|
46
|
-
value: S.String;
|
|
47
|
-
index: S.Number;
|
|
24
|
+
export declare const Message: import("foldkit/message").MessageUnion<{
|
|
25
|
+
readonly SelectedTab: {
|
|
26
|
+
readonly index: S.Number;
|
|
27
|
+
readonly value: S.String;
|
|
28
|
+
};
|
|
29
|
+
readonly FocusedTab: {
|
|
30
|
+
readonly index: S.Number;
|
|
31
|
+
};
|
|
32
|
+
readonly CompletedFocusTab: {};
|
|
48
33
|
}>;
|
|
34
|
+
export type SelectedTab = typeof Message.SelectedTab.Type;
|
|
35
|
+
export type FocusedTab = typeof Message.FocusedTab.Type;
|
|
36
|
+
export type Message = typeof Message.Type;
|
|
49
37
|
export type Selected<Value extends string = string> = Readonly<{
|
|
50
38
|
readonly _tag: 'Selected';
|
|
51
39
|
readonly value: Value;
|
|
52
40
|
readonly index: number;
|
|
53
41
|
}>;
|
|
54
42
|
/** Union of out-messages the tabs component can produce. Surfaced as the third element of `update`'s return tuple and pattern-matched by the parent. */
|
|
55
|
-
export declare const OutMessage:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
43
|
+
export declare const OutMessage: import("foldkit/message").MessageUnion<{
|
|
44
|
+
readonly Selected: {
|
|
45
|
+
readonly value: S.String;
|
|
46
|
+
readonly index: S.Number;
|
|
47
|
+
};
|
|
48
|
+
}>;
|
|
59
49
|
/** Generic over `Value extends string` so consumers using
|
|
60
50
|
* `Tabs.create<MyUnion>()` receive `value: MyUnion` in the
|
|
61
51
|
* `Selected` OutMessage. Defaults to `string`. */
|
package/dist/tabs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,MAAM,EACN,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAG9E,OAAO,EAAE,KAAK,IAAI,IAAI,YAAY,EAAc,MAAM,kBAAkB,CAAA;AAKxE,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAI7E,yFAAyF;AACzF,eAAO,MAAM,WAAW,iDAAyC,CAAA;AACjE,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD,yGAAyG;AACzG,eAAO,MAAM,cAAc,8CAAsC,CAAA;AACjE,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AAEvD;;;;+EAI+E;AAC/E,eAAO,MAAM,KAAK;;;;EAIhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tabs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,MAAM,EACN,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,KAAK,c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AAQ,CAAC;IAC/D,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,CAAA;IAC1B,aAAa,EAAE,KAAK,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,IAAI,CAAA;IAC3C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAA;IACxD,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAC,CAAA;AA+JF;;;sDAGsD;AACtD,MAAM,MAAM,MAAM,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI,QAAQ,CAAC;IAC3D,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;IACrD,MAAM,EAAE,CACN,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,KACb,SAAS;QACZ,KAAK;QACL,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;KACjC,CAAA;CACF,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;;mDAiBmD;AACnD,eAAO,MAAM,MAAM,GAAI,KAAK,SAAS,MAAM,GAAG,MAAM,OAAK,MAAM,CAAC,KAAK,CAmBpE,CAAA"}
|
package/dist/tabs/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Array, Effect, Match as M, Option, Schema as S, String, pipe, } from 'e
|
|
|
3
3
|
import * as Command from 'foldkit/command';
|
|
4
4
|
import * as Dom from 'foldkit/dom';
|
|
5
5
|
import { childAttributes } from 'foldkit/html';
|
|
6
|
-
import {
|
|
6
|
+
import { defineMessageUnion } from 'foldkit/message';
|
|
7
7
|
import { evo } from 'foldkit/struct';
|
|
8
8
|
import { defineView } from 'foldkit/submodel';
|
|
9
9
|
import { idSelector } from '../internal/selectors.js';
|
|
@@ -25,26 +25,22 @@ export const Model = S.Struct({
|
|
|
25
25
|
activationMode: ActivationMode,
|
|
26
26
|
});
|
|
27
27
|
// MESSAGE
|
|
28
|
-
/** Sent when a tab is selected via click or keyboard. Commits the tab as the
|
|
29
|
-
* new selection and moves focus onto it. */
|
|
30
|
-
export const SelectedTab = m('SelectedTab', {
|
|
31
|
-
index: S.Number,
|
|
32
|
-
value: S.String,
|
|
33
|
-
});
|
|
34
|
-
/** Sent when a tab receives keyboard focus in `Manual` mode without being activated. */
|
|
35
|
-
export const FocusedTab = m('FocusedTab', { index: S.Number });
|
|
36
|
-
/** Sent when the focus-tab command completes. */
|
|
37
|
-
export const CompletedFocusTab = m('CompletedFocusTab');
|
|
38
28
|
/** Union of all messages the tabs component can produce. */
|
|
39
|
-
export const Message =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
index: S.Number,
|
|
29
|
+
export const Message = defineMessageUnion({
|
|
30
|
+
SelectedTab: {
|
|
31
|
+
index: S.Number,
|
|
32
|
+
value: S.String,
|
|
33
|
+
},
|
|
34
|
+
FocusedTab: { index: S.Number },
|
|
35
|
+
CompletedFocusTab: {},
|
|
45
36
|
});
|
|
46
37
|
/** Union of out-messages the tabs component can produce. Surfaced as the third element of `update`'s return tuple and pattern-matched by the parent. */
|
|
47
|
-
export const OutMessage =
|
|
38
|
+
export const OutMessage = defineMessageUnion({
|
|
39
|
+
Selected: {
|
|
40
|
+
value: S.String,
|
|
41
|
+
index: S.Number,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
48
44
|
/** Creates an initial tabs model from a config. Focus follows the selected
|
|
49
45
|
* tab until the user navigates in `Manual` mode, so `maybeFocusedIndex`
|
|
50
46
|
* starts `None`. Defaults to automatic activation. */
|
|
@@ -59,18 +55,18 @@ const tabPanelId = (id, index) => __foldkitBrandViewResult((`${id}-panel-${index
|
|
|
59
55
|
/** Moves focus to the tab at the given index. */
|
|
60
56
|
export const FocusTab = Command.define('FocusTab', {
|
|
61
57
|
args: { id: S.String, index: S.Number },
|
|
62
|
-
messages: [CompletedFocusTab],
|
|
63
|
-
execute: ({ id, index }) => __foldkitBrandViewResult((Dom.focus(idSelector(tabId(id, index))).pipe(Effect.ignore, Effect.as(CompletedFocusTab()))), "@foldkit/ui/tabs/index.js#execute"),
|
|
58
|
+
messages: [Message.CompletedFocusTab],
|
|
59
|
+
execute: ({ id, index }) => __foldkitBrandViewResult((Dom.focus(idSelector(tabId(id, index))).pipe(Effect.ignore, Effect.as(Message.CompletedFocusTab()))), "@foldkit/ui/tabs/index.js#execute"),
|
|
64
60
|
});
|
|
65
61
|
/** Processes a tabs message and returns the next model, commands, and an
|
|
66
62
|
* optional OutMessage. `Selected` fires when a tab is committed via click or
|
|
67
63
|
* keyboard; the parent stores the new value and passes it back in as
|
|
68
64
|
* `selectedValue`. */
|
|
69
|
-
export const update = (model, message) => __foldkitBrandViewResult((
|
|
65
|
+
export const update = (model, message) => __foldkitBrandViewResult((Message.match(message, {
|
|
70
66
|
SelectedTab: ({ index, value }) => __foldkitBrandViewResult(([
|
|
71
67
|
evo(model, { maybeFocusedIndex: () => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tabs/index.js#maybeFocusedIndex") }),
|
|
72
68
|
[FocusTab({ id: model.id, index })],
|
|
73
|
-
Option.some(Selected({ value, index })),
|
|
69
|
+
Option.some(OutMessage.Selected({ value, index })),
|
|
74
70
|
]), "@foldkit/ui/tabs/index.js#SelectedTab"),
|
|
75
71
|
FocusedTab: ({ index }) => __foldkitBrandViewResult(([
|
|
76
72
|
evo(model, { maybeFocusedIndex: () => __foldkitBrandViewResult((Option.some(index)), "@foldkit/ui/tabs/index.js#maybeFocusedIndex~2") }),
|
|
@@ -78,7 +74,7 @@ export const update = (model, message) => __foldkitBrandViewResult((M.value(mess
|
|
|
78
74
|
Option.none(),
|
|
79
75
|
]), "@foldkit/ui/tabs/index.js#FocusedTab"),
|
|
80
76
|
CompletedFocusTab: () => __foldkitBrandViewResult(([model, [], Option.none()]), "@foldkit/ui/tabs/index.js#CompletedFocusTab"),
|
|
81
|
-
}))
|
|
77
|
+
})), "@foldkit/ui/tabs/index.js#update");
|
|
82
78
|
const internalView = defineView((model, viewInputs, h) => {
|
|
83
79
|
const { id, activationMode, maybeFocusedIndex } = model;
|
|
84
80
|
const { tabs, selectedValue, ariaLabel, toView, isTabDisabled, orientation = 'Horizontal', } = viewInputs;
|
|
@@ -94,9 +90,9 @@ const internalView = defineView((model, viewInputs, h) => {
|
|
|
94
90
|
previousKey: 'ArrowUp',
|
|
95
91
|
}), "@foldkit/ui/tabs/index.js#anonymous~8"))), M.exhaustive);
|
|
96
92
|
const resolveKeyIndex = keyToIndex(nextKey, previousKey, tabs.length, focusedIndex, isDisabled);
|
|
97
|
-
const tabSelectedAt = (index) => __foldkitBrandViewResult((pipe(tabs, Array.get(index), Option.map(value => __foldkitBrandViewResult((SelectedTab({ index, value })), "@foldkit/ui/tabs/index.js#anonymous~9")))), "@foldkit/ui/tabs/index.js#tabSelectedAt");
|
|
93
|
+
const tabSelectedAt = (index) => __foldkitBrandViewResult((pipe(tabs, Array.get(index), Option.map(value => __foldkitBrandViewResult((Message.SelectedTab({ index, value })), "@foldkit/ui/tabs/index.js#anonymous~9")))), "@foldkit/ui/tabs/index.js#tabSelectedAt");
|
|
98
94
|
const handleAutomaticKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.whenOr(nextKey, previousKey, 'Home', 'End', 'PageUp', 'PageDown', () => __foldkitBrandViewResult((tabSelectedAt(resolveKeyIndex(key))), "@foldkit/ui/tabs/index.js#anonymous~10")), M.whenOr('Enter', ' ', () => __foldkitBrandViewResult((tabSelectedAt(focusedIndex)), "@foldkit/ui/tabs/index.js#anonymous~11")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tabs/index.js#anonymous~12")))), "@foldkit/ui/tabs/index.js#handleAutomaticKeyDown");
|
|
99
|
-
const handleManualKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.whenOr(nextKey, previousKey, 'Home', 'End', 'PageUp', 'PageDown', () => __foldkitBrandViewResult((Option.some(FocusedTab({ index: resolveKeyIndex(key) }))), "@foldkit/ui/tabs/index.js#anonymous~13")), M.whenOr('Enter', ' ', () => __foldkitBrandViewResult((tabSelectedAt(focusedIndex)), "@foldkit/ui/tabs/index.js#anonymous~14")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tabs/index.js#anonymous~15")))), "@foldkit/ui/tabs/index.js#handleManualKeyDown");
|
|
95
|
+
const handleManualKeyDown = (key) => __foldkitBrandViewResult((M.value(key).pipe(M.whenOr(nextKey, previousKey, 'Home', 'End', 'PageUp', 'PageDown', () => __foldkitBrandViewResult((Option.some(Message.FocusedTab({ index: resolveKeyIndex(key) }))), "@foldkit/ui/tabs/index.js#anonymous~13")), M.whenOr('Enter', ' ', () => __foldkitBrandViewResult((tabSelectedAt(focusedIndex)), "@foldkit/ui/tabs/index.js#anonymous~14")), M.orElse(() => __foldkitBrandViewResult((Option.none()), "@foldkit/ui/tabs/index.js#anonymous~15")))), "@foldkit/ui/tabs/index.js#handleManualKeyDown");
|
|
100
96
|
const handleKeyDown = (key) => __foldkitBrandViewResult((M.value(activationMode).pipe(M.when('Automatic', () => __foldkitBrandViewResult((handleAutomaticKeyDown(key)), "@foldkit/ui/tabs/index.js#anonymous~16")), M.when('Manual', () => __foldkitBrandViewResult((handleManualKeyDown(key)), "@foldkit/ui/tabs/index.js#anonymous~17")), M.exhaustive)), "@foldkit/ui/tabs/index.js#handleKeyDown");
|
|
101
97
|
const tabInfos = Array.map(tabs, (value, index) => {
|
|
102
98
|
const isActive = index === activeIndex;
|
|
@@ -116,7 +112,7 @@ const internalView = defineView((model, viewInputs, h) => {
|
|
|
116
112
|
h.AriaDisabled(true),
|
|
117
113
|
h.DataAttribute('disabled', ''),
|
|
118
114
|
]
|
|
119
|
-
: [h.OnClick(SelectedTab({ index, value }))]),
|
|
115
|
+
: [h.OnClick(Message.SelectedTab({ index, value }))]),
|
|
120
116
|
h.OnKeyDownPreventDefault(handleKeyDown),
|
|
121
117
|
];
|
|
122
118
|
const panelAttributes = [
|
package/dist/tabs/public.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { init, create, Model, Message, OutMessage, Selected, SelectedTab, FocusedTab,
|
|
1
|
+
export { init, create, Model, Message, OutMessage, type Selected, type SelectedTab, type FocusedTab, FocusTab, Orientation, } from './index.js';
|
|
2
2
|
export type { ActivationMode, InitConfig, ViewInputs, RenderInfo, TabInfo, Bundle, } from './index.js';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|