foldkit 0.80.0 → 0.81.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/html/index.d.ts +34 -27
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +31 -26
- package/dist/html/public.d.ts +1 -1
- package/dist/html/public.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/mount/index.d.ts +42 -0
- package/dist/mount/index.d.ts.map +1 -0
- package/dist/mount/index.js +38 -0
- package/dist/mount/public.d.ts +3 -0
- package/dist/mount/public.d.ts.map +1 -0
- package/dist/mount/public.js +1 -0
- package/dist/runtime/public.d.ts +1 -1
- package/dist/runtime/public.d.ts.map +1 -1
- package/dist/runtime/runtime.d.ts +1 -23
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +1 -2
- package/dist/ui/anchor.d.ts +13 -6
- package/dist/ui/anchor.d.ts.map +1 -1
- package/dist/ui/anchor.js +91 -86
- package/dist/ui/combobox/multi.d.ts +15 -3
- package/dist/ui/combobox/multi.d.ts.map +1 -1
- package/dist/ui/combobox/public.d.ts +2 -2
- 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 +22 -7
- package/dist/ui/combobox/shared.d.ts.map +1 -1
- package/dist/ui/combobox/shared.js +73 -37
- package/dist/ui/combobox/single.d.ts +15 -3
- package/dist/ui/combobox/single.d.ts.map +1 -1
- package/dist/ui/datePicker/index.d.ts +2 -2
- package/dist/ui/listbox/multi.d.ts +10 -2
- package/dist/ui/listbox/multi.d.ts.map +1 -1
- package/dist/ui/listbox/public.d.ts +2 -2
- 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 +16 -6
- package/dist/ui/listbox/shared.d.ts.map +1 -1
- package/dist/ui/listbox/shared.js +37 -25
- package/dist/ui/listbox/single.d.ts +10 -2
- package/dist/ui/listbox/single.d.ts.map +1 -1
- package/dist/ui/menu/index.d.ts +11 -5
- package/dist/ui/menu/index.d.ts.map +1 -1
- package/dist/ui/menu/index.js +36 -24
- package/dist/ui/menu/public.d.ts +2 -2
- 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 +8 -5
- package/dist/ui/popover/index.d.ts.map +1 -1
- package/dist/ui/popover/index.js +23 -16
- package/dist/ui/popover/public.d.ts +2 -2
- package/dist/ui/popover/public.d.ts.map +1 -1
- package/dist/ui/popover/public.js +1 -1
- package/dist/ui/tooltip/index.d.ts +5 -2
- package/dist/ui/tooltip/index.d.ts.map +1 -1
- package/dist/ui/tooltip/index.js +17 -10
- package/dist/ui/tooltip/public.d.ts +1 -1
- package/dist/ui/tooltip/public.d.ts.map +1 -1
- package/dist/ui/tooltip/public.js +1 -1
- package/package.json +5 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Array, Effect, Match as M, Option, Predicate, Schema as S, pipe, } from 'effect';
|
|
2
2
|
import * as Command from '../../command/index.js';
|
|
3
3
|
import { OptionExt } from '../../effectExtensions/index.js';
|
|
4
|
-
import { html } from '../../html/index.js';
|
|
4
|
+
import { html, } from '../../html/index.js';
|
|
5
5
|
import { m } from '../../message/index.js';
|
|
6
|
+
import * as Mount from '../../mount/index.js';
|
|
6
7
|
import { makeConstrainedEvo } from '../../struct/index.js';
|
|
7
8
|
import * as Task from '../../task/index.js';
|
|
8
|
-
import {
|
|
9
|
+
import { anchorSetup } from '../anchor.js';
|
|
9
10
|
// NOTE: Animation imports are split across schema + update to avoid a circular
|
|
10
11
|
// dependency: animation → html → runtime → devtools → combobox → animation.
|
|
11
12
|
// The barrel (../animation) imports from html, which starts the cycle.
|
|
@@ -54,8 +55,8 @@ export const Opened = m('Opened', {
|
|
|
54
55
|
});
|
|
55
56
|
/** Sent when the combobox closes via Escape key or backdrop click. */
|
|
56
57
|
export const Closed = m('Closed');
|
|
57
|
-
/** Sent when
|
|
58
|
-
export const
|
|
58
|
+
/** Sent when the combobox input loses focus. */
|
|
59
|
+
export const BlurredInput = m('BlurredInput');
|
|
59
60
|
/** Sent when an item is highlighted via arrow keys or mouse hover. Includes activation trigger and optional immediate selection info. */
|
|
60
61
|
export const ActivatedItem = m('ActivatedItem', {
|
|
61
62
|
index: S.Number,
|
|
@@ -93,6 +94,12 @@ export const CompletedFocusInput = m('CompletedFocusInput');
|
|
|
93
94
|
export const CompletedScrollIntoView = m('CompletedScrollIntoView');
|
|
94
95
|
/** Sent when the programmatic item click command completes. */
|
|
95
96
|
export const CompletedClickItem = m('CompletedClickItem');
|
|
97
|
+
/** Sent when the items panel mounts and Floating UI has positioned it. Update no-ops; surfaces the positioning side effect for DevTools. */
|
|
98
|
+
export const CompletedAnchorMount = m('CompletedAnchorMount');
|
|
99
|
+
/** Sent when the items panel mounts and the capture-phase pointerdown listener is attached (with or without anchor). Update no-ops; surfaces the listener-attach side effect for DevTools. */
|
|
100
|
+
export const CompletedAttachPreventBlur = m('CompletedAttachPreventBlur');
|
|
101
|
+
/** Sent when the input mounts and the focus listener that auto-selects on focus is attached. Update no-ops; surfaces the listener-attach side effect for DevTools. */
|
|
102
|
+
export const CompletedAttachSelectOnFocus = m('CompletedAttachSelectOnFocus');
|
|
96
103
|
/** Wraps an Animation submodel message for delegation. */
|
|
97
104
|
export const GotAnimationMessage = m('GotAnimationMessage', {
|
|
98
105
|
message: AnimationMessage,
|
|
@@ -104,7 +111,7 @@ export const UpdatedInputValue = m('UpdatedInputValue', {
|
|
|
104
111
|
/** Sent when the optional toggle button is clicked. */
|
|
105
112
|
export const PressedToggleButton = m('PressedToggleButton');
|
|
106
113
|
/** Union of all messages the combobox component can produce. */
|
|
107
|
-
export const Message = S.Union(Opened, Closed,
|
|
114
|
+
export const Message = S.Union(Opened, Closed, BlurredInput, ActivatedItem, DeactivatedItem, SelectedItem, MovedPointerOverItem, RequestedItemClick, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem, CompletedAnchorMount, CompletedAttachPreventBlur, CompletedAttachSelectOnFocus, GotAnimationMessage, UpdatedInputValue, PressedToggleButton);
|
|
108
115
|
// SELECTORS
|
|
109
116
|
export const inputSelector = (id) => `#${id}-input`;
|
|
110
117
|
export const inputWrapperSelector = (id) => `#${id}-input-wrapper`;
|
|
@@ -203,7 +210,7 @@ export const makeUpdate = (handlers) => {
|
|
|
203
210
|
maybeLastPointerPosition: () => Option.none(),
|
|
204
211
|
})),
|
|
205
212
|
Closed: () => closeCombobox(model, [focusInput]),
|
|
206
|
-
|
|
213
|
+
BlurredInput: () => closeCombobox(model, []),
|
|
207
214
|
ActivatedItem: ({ index, activationTrigger, maybeImmediateSelection, }) => {
|
|
208
215
|
const highlightedModel = constrainedEvo(model, {
|
|
209
216
|
maybeActiveItemIndex: () => Option.some(index),
|
|
@@ -299,12 +306,42 @@ export const makeUpdate = (handlers) => {
|
|
|
299
306
|
CompletedFocusInput: () => [model, []],
|
|
300
307
|
CompletedScrollIntoView: () => [model, []],
|
|
301
308
|
CompletedClickItem: () => [model, []],
|
|
309
|
+
CompletedAnchorMount: () => [model, []],
|
|
310
|
+
CompletedAttachPreventBlur: () => [model, []],
|
|
311
|
+
CompletedAttachSelectOnFocus: () => [model, []],
|
|
302
312
|
}));
|
|
303
313
|
};
|
|
304
314
|
};
|
|
315
|
+
const ComboboxAnchor = Mount.define('ComboboxAnchor', CompletedAnchorMount);
|
|
316
|
+
const ComboboxAttachPreventBlur = Mount.define('ComboboxAttachPreventBlur', CompletedAttachPreventBlur);
|
|
317
|
+
const ComboboxAttachSelectOnFocus = Mount.define('ComboboxAttachSelectOnFocus', CompletedAttachSelectOnFocus);
|
|
318
|
+
const attachPreventBlurOnPointerDown = ComboboxAttachPreventBlur((element) => Effect.sync(() => {
|
|
319
|
+
const handler = (event) => {
|
|
320
|
+
event.preventDefault();
|
|
321
|
+
};
|
|
322
|
+
element.addEventListener('pointerdown', handler, { capture: true });
|
|
323
|
+
return {
|
|
324
|
+
message: CompletedAttachPreventBlur(),
|
|
325
|
+
cleanup: () => element.removeEventListener('pointerdown', handler, {
|
|
326
|
+
capture: true,
|
|
327
|
+
}),
|
|
328
|
+
};
|
|
329
|
+
}));
|
|
330
|
+
const attachSelectOnFocus = ComboboxAttachSelectOnFocus((element) => Effect.sync(() => {
|
|
331
|
+
const handler = () => {
|
|
332
|
+
if (element instanceof HTMLInputElement) {
|
|
333
|
+
element.select();
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
element.addEventListener('focus', handler);
|
|
337
|
+
return {
|
|
338
|
+
message: CompletedAttachSelectOnFocus(),
|
|
339
|
+
cleanup: () => element.removeEventListener('focus', handler),
|
|
340
|
+
};
|
|
341
|
+
}));
|
|
305
342
|
/** Creates a combobox view function from variant-specific behavior. Shared rendering logic (input, items, transitions, keyboard navigation) is handled internally; only selection display varies by variant. */
|
|
306
343
|
export const makeView = (behavior) => (config) => {
|
|
307
|
-
const { div, input, AriaActiveDescendant, AriaControls, AriaDisabled, AriaExpanded, AriaInvalid, AriaLabelledBy, AriaMultiSelectable, AriaSelected, Attribute, Autocomplete, Class, DataAttribute, Id, Name, OnBlur, OnClick,
|
|
344
|
+
const { div, input, AriaActiveDescendant, AriaControls, AriaDisabled, AriaExpanded, AriaInvalid, AriaLabelledBy, AriaMultiSelectable, AriaSelected, Attribute, Autocomplete, Class, DataAttribute, Id, Name, OnBlur, OnClick, OnFocus, OnInput, OnKeyDownPreventDefault, OnMount, OnPointerLeave, OnPointerMove, Placeholder, Role, Style, Tabindex, Type, Value, keyed, } = html();
|
|
308
345
|
const { model: { id, isOpen, immediate, animation: { transitionState }, maybeActiveItemIndex, }, toParentMessage, onSelectedItem, items, itemToConfig, itemToValue, itemToDisplayText, isItemDisabled, inputClassName, inputAttributes = [], inputPlaceholder, inputWrapperClassName, inputWrapperAttributes = [], itemsClassName, itemsAttributes = [], itemsScrollClassName, itemsScrollAttributes = [], backdropClassName, backdropAttributes = [], className, attributes = [], buttonContent, buttonClassName, buttonAttributes = [], formName, isDisabled, isInvalid, openOnFocus, itemGroupKey, groupToHeading, groupClassName, groupAttributes = [], separatorClassName, separatorAttributes = [], anchor, } = config;
|
|
309
346
|
const dispatchSelectedItem = (item, index) => onSelectedItem
|
|
310
347
|
? onSelectedItem(itemToValue(item, index))
|
|
@@ -386,11 +423,6 @@ export const makeView = (behavior) => (config) => {
|
|
|
386
423
|
maybeImmediateSelection: resolveImmediateSelection(targetIndex),
|
|
387
424
|
})));
|
|
388
425
|
}), M.orElse(() => Option.none()));
|
|
389
|
-
const preventBlurOnPointerDown = (element) => {
|
|
390
|
-
element.addEventListener('pointerdown', (event) => {
|
|
391
|
-
event.preventDefault();
|
|
392
|
-
}, { capture: true });
|
|
393
|
-
};
|
|
394
426
|
const maybeActiveDescendant = Option.match(maybeActiveItemIndex, {
|
|
395
427
|
onNone: () => [],
|
|
396
428
|
onSome: index => [AriaActiveDescendant(itemId(id, index))],
|
|
@@ -411,7 +443,7 @@ export const makeView = (behavior) => (config) => {
|
|
|
411
443
|
: [
|
|
412
444
|
OnInput(value => toParentMessage(UpdatedInputValue({ value }))),
|
|
413
445
|
OnKeyDownPreventDefault(handleInputKeyDown),
|
|
414
|
-
OnBlur(toParentMessage(
|
|
446
|
+
OnBlur(toParentMessage(BlurredInput())),
|
|
415
447
|
...(openOnFocus
|
|
416
448
|
? [
|
|
417
449
|
OnFocus(toParentMessage(Opened({ maybeActiveItemIndex: Option.none() }))),
|
|
@@ -421,36 +453,40 @@ export const makeView = (behavior) => (config) => {
|
|
|
421
453
|
...(isInvalid ? [AriaInvalid(true), DataAttribute('invalid', '')] : []),
|
|
422
454
|
...(isVisible ? [DataAttribute('open', '')] : []),
|
|
423
455
|
...(config.model.selectInputOnFocus
|
|
424
|
-
? [
|
|
425
|
-
OnInsert((element) => {
|
|
426
|
-
element.addEventListener('focus', () => {
|
|
427
|
-
if (element instanceof HTMLInputElement) {
|
|
428
|
-
element.select();
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
}),
|
|
432
|
-
]
|
|
456
|
+
? [OnMount(Mount.mapMessage(attachSelectOnFocus, toParentMessage))]
|
|
433
457
|
: []),
|
|
434
458
|
...(inputClassName ? [Class(inputClassName)] : []),
|
|
435
459
|
...inputAttributes,
|
|
436
460
|
];
|
|
437
|
-
const
|
|
438
|
-
? anchorHooks({
|
|
439
|
-
buttonId: `${id}-input-wrapper`,
|
|
440
|
-
anchor,
|
|
441
|
-
interceptTab: false,
|
|
442
|
-
})
|
|
443
|
-
: undefined;
|
|
444
|
-
const anchorAttributes = hooks
|
|
461
|
+
const anchorAttributes = anchor
|
|
445
462
|
? [
|
|
446
463
|
Style({ position: 'absolute', margin: '0', visibility: 'hidden' }),
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
464
|
+
OnMount(Mount.mapMessage(ComboboxAnchor((items) => Effect.sync(() => {
|
|
465
|
+
const preventBlur = (event) => {
|
|
466
|
+
event.preventDefault();
|
|
467
|
+
};
|
|
468
|
+
items.addEventListener('pointerdown', preventBlur, {
|
|
469
|
+
capture: true,
|
|
470
|
+
});
|
|
471
|
+
const teardownAnchor = anchorSetup({
|
|
472
|
+
buttonId: `${id}-input-wrapper`,
|
|
473
|
+
anchor,
|
|
474
|
+
interceptTab: false,
|
|
475
|
+
})(items);
|
|
476
|
+
return {
|
|
477
|
+
message: CompletedAnchorMount(),
|
|
478
|
+
cleanup: () => {
|
|
479
|
+
items.removeEventListener('pointerdown', preventBlur, {
|
|
480
|
+
capture: true,
|
|
481
|
+
});
|
|
482
|
+
teardownAnchor();
|
|
483
|
+
},
|
|
484
|
+
};
|
|
485
|
+
})), toParentMessage)),
|
|
452
486
|
]
|
|
453
|
-
: [
|
|
487
|
+
: [
|
|
488
|
+
OnMount(Mount.mapMessage(attachPreventBlurOnPointerDown, toParentMessage)),
|
|
489
|
+
];
|
|
454
490
|
const itemsContainerAttributes = [
|
|
455
491
|
Id(`${id}-items`),
|
|
456
492
|
Role('listbox'),
|
|
@@ -573,7 +609,7 @@ export const makeView = (behavior) => (config) => {
|
|
|
573
609
|
...(isDisabled
|
|
574
610
|
? [AriaDisabled(true), DataAttribute('disabled', '')]
|
|
575
611
|
: [OnClick(toParentMessage(PressedToggleButton()))]),
|
|
576
|
-
|
|
612
|
+
OnMount(Mount.mapMessage(attachPreventBlurOnPointerDown, toParentMessage)),
|
|
577
613
|
...(buttonClassName ? [Class(buttonClassName)] : []),
|
|
578
614
|
...buttonAttributes,
|
|
579
615
|
], [buttonContent]),
|
|
@@ -86,8 +86,6 @@ export declare const update: (model: {
|
|
|
86
86
|
name: string;
|
|
87
87
|
effect: import("effect/Effect").Effect<{
|
|
88
88
|
readonly _tag: "Closed";
|
|
89
|
-
} | {
|
|
90
|
-
readonly _tag: "ClosedByTab";
|
|
91
89
|
} | {
|
|
92
90
|
readonly _tag: "DeactivatedItem";
|
|
93
91
|
} | {
|
|
@@ -102,9 +100,13 @@ export declare const update: (model: {
|
|
|
102
100
|
readonly _tag: "CompletedScrollIntoView";
|
|
103
101
|
} | {
|
|
104
102
|
readonly _tag: "CompletedClickItem";
|
|
103
|
+
} | {
|
|
104
|
+
readonly _tag: "CompletedAnchorMount";
|
|
105
105
|
} | {
|
|
106
106
|
readonly _tag: "Opened";
|
|
107
107
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
108
|
+
} | {
|
|
109
|
+
readonly _tag: "BlurredInput";
|
|
108
110
|
} | {
|
|
109
111
|
readonly _tag: "ActivatedItem";
|
|
110
112
|
readonly activationTrigger: "Pointer" | "Keyboard";
|
|
@@ -127,6 +129,10 @@ export declare const update: (model: {
|
|
|
127
129
|
readonly index: number;
|
|
128
130
|
} | {
|
|
129
131
|
readonly _tag: "CompletedFocusInput";
|
|
132
|
+
} | {
|
|
133
|
+
readonly _tag: "CompletedAttachPreventBlur";
|
|
134
|
+
} | {
|
|
135
|
+
readonly _tag: "CompletedAttachSelectOnFocus";
|
|
130
136
|
} | {
|
|
131
137
|
readonly _tag: "GotAnimationMessage";
|
|
132
138
|
readonly message: {
|
|
@@ -182,7 +188,13 @@ export declare const view: <Message, Item extends string>(config: Readonly<{
|
|
|
182
188
|
readonly maybeSelectedItem: Option.Option<string>;
|
|
183
189
|
readonly maybeSelectedDisplayText: Option.Option<string>;
|
|
184
190
|
};
|
|
185
|
-
toParentMessage: (message: Opened | Closed | import("./shared.js").
|
|
191
|
+
toParentMessage: (message: Opened | Closed | import("./shared.js").BlurredInput | import("./shared.js").ActivatedItem | import("./shared.js").DeactivatedItem | SelectedItem | import("./shared.js").MovedPointerOverItem | import("./shared.js").RequestedItemClick | import("./shared.js").UpdatedInputValue | import("./shared.js").PressedToggleButton | {
|
|
192
|
+
readonly _tag: "CompletedAnchorMount";
|
|
193
|
+
} | {
|
|
194
|
+
readonly _tag: "CompletedAttachPreventBlur";
|
|
195
|
+
} | {
|
|
196
|
+
readonly _tag: "CompletedAttachSelectOnFocus";
|
|
197
|
+
}) => Message;
|
|
186
198
|
onSelectedItem?: (value: string) => Message;
|
|
187
199
|
items: readonly Item[];
|
|
188
200
|
itemToConfig: (item: Item, context: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single.d.ts","sourceRoot":"","sources":["../../../src/ui/combobox/single.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,IAAI,CAAC,EAAQ,MAAM,QAAQ,CAAA;AAEzD,OAAO,KAAK,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,qBAAqB,CAAA;AAE3D,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,EACnB,MAAM,EACN,KAAK,OAAO,EACZ,MAAM,EACN,YAAY,EAKb,MAAM,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,CAAC,KACrE,IAAI,CAoBR,CAAA"}
|
|
@@ -102,10 +102,10 @@ export declare const GotCalendarMessage: import("../../schema/index.js").Callabl
|
|
|
102
102
|
}>;
|
|
103
103
|
/** Wraps a Popover submodel message for delegation. */
|
|
104
104
|
export declare const GotPopoverMessage: import("../../schema/index.js").CallableTaggedStruct<"GotPopoverMessage", {
|
|
105
|
-
message: S.Union<[import("../../schema/index.js").CallableTaggedStruct<"Opened", {}>, import("../../schema/index.js").CallableTaggedStruct<"Closed", {}>, import("../../schema/index.js").CallableTaggedStruct<"
|
|
105
|
+
message: S.Union<[import("../../schema/index.js").CallableTaggedStruct<"Opened", {}>, import("../../schema/index.js").CallableTaggedStruct<"Closed", {}>, import("../../schema/index.js").CallableTaggedStruct<"BlurredPanel", {}>, import("../../schema/index.js").CallableTaggedStruct<"PressedPointerOnButton", {
|
|
106
106
|
pointerType: typeof S.String;
|
|
107
107
|
button: typeof S.Number;
|
|
108
|
-
}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedFocusPanel", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedFocusButton", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedLockScroll", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedUnlockScroll", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedSetupInert", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedTeardownInert", {}>, import("../../schema/index.js").CallableTaggedStruct<"IgnoredMouseClick", {}>, import("../../schema/index.js").CallableTaggedStruct<"SuppressedSpaceScroll", {}>, import("../../schema/index.js").CallableTaggedStruct<"GotAnimationMessage", {
|
|
108
|
+
}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedFocusPanel", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedFocusButton", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedLockScroll", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedUnlockScroll", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedSetupInert", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedTeardownInert", {}>, import("../../schema/index.js").CallableTaggedStruct<"IgnoredMouseClick", {}>, import("../../schema/index.js").CallableTaggedStruct<"SuppressedSpaceScroll", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedAnchorMount", {}>, import("../../schema/index.js").CallableTaggedStruct<"GotAnimationMessage", {
|
|
109
109
|
message: S.Union<[import("../../schema/index.js").CallableTaggedStruct<"Showed", {}>, import("../../schema/index.js").CallableTaggedStruct<"Hid", {}>, import("../../schema/index.js").CallableTaggedStruct<"AdvancedAnimationFrame", {}>, import("../../schema/index.js").CallableTaggedStruct<"EndedAnimation", {}>]>;
|
|
110
110
|
}>]>;
|
|
111
111
|
}>;
|
|
@@ -86,7 +86,7 @@ export declare const update: (model: {
|
|
|
86
86
|
} | {
|
|
87
87
|
readonly _tag: "Closed";
|
|
88
88
|
} | {
|
|
89
|
-
readonly _tag: "
|
|
89
|
+
readonly _tag: "BlurredItems";
|
|
90
90
|
} | {
|
|
91
91
|
readonly _tag: "ActivatedItem";
|
|
92
92
|
readonly activationTrigger: "Pointer" | "Keyboard";
|
|
@@ -131,6 +131,10 @@ export declare const update: (model: {
|
|
|
131
131
|
readonly _tag: "IgnoredMouseClick";
|
|
132
132
|
} | {
|
|
133
133
|
readonly _tag: "SuppressedSpaceScroll";
|
|
134
|
+
} | {
|
|
135
|
+
readonly _tag: "CompletedAnchorMount";
|
|
136
|
+
} | {
|
|
137
|
+
readonly _tag: "CompletedFocusItemsOnMount";
|
|
134
138
|
} | {
|
|
135
139
|
readonly _tag: "GotAnimationMessage";
|
|
136
140
|
readonly message: {
|
|
@@ -183,7 +187,11 @@ export declare const view: <Message, Item>(config: Readonly<{
|
|
|
183
187
|
} & {
|
|
184
188
|
readonly selectedItems: readonly string[];
|
|
185
189
|
};
|
|
186
|
-
toParentMessage: (message: Opened | Closed | import("./shared.js").
|
|
190
|
+
toParentMessage: (message: Opened | Closed | import("./shared.js").BlurredItems | import("./shared.js").ActivatedItem | import("./shared.js").DeactivatedItem | SelectedItem | import("./shared.js").MovedPointerOverItem | import("./shared.js").RequestedItemClick | import("./shared.js").Searched | import("./shared.js").PressedPointerOnButton | import("./shared.js").IgnoredMouseClick | import("./shared.js").SuppressedSpaceScroll | {
|
|
191
|
+
readonly _tag: "CompletedAnchorMount";
|
|
192
|
+
} | {
|
|
193
|
+
readonly _tag: "CompletedFocusItemsOnMount";
|
|
194
|
+
}) => Message;
|
|
187
195
|
onSelectedItem?: (value: string) => Message;
|
|
188
196
|
items: readonly Item[];
|
|
189
197
|
itemToConfig: (item: Item, context: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/multi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,IAAI,CAAC,EAAQ,MAAM,QAAQ,CAAA;AAEzD,OAAO,KAAK,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,qBAAqB,CAAA;AAE3D,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,EACnB,MAAM,EACN,KAAK,OAAO,EACZ,MAAM,EACN,YAAY,EAIb,MAAM,aAAa,CAAA;AAIpB,iKAAiK;AACjK,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;GAEjB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,6RAA6R;AAC7R,MAAM,MAAM,UAAU,GAAG,cAAc,GACrC,QAAQ,CAAC;IACP,aAAa,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CACtC,CAAC,CAAA;AAEJ,4HAA4H;AAC5H,eAAO,MAAM,IAAI,GAAI,QAAQ,UAAU,KAAG,KAGxC,CAAA;AAIF,wJAAwJ;AACxJ,eAAO,MAAM,MAAM
|
|
1
|
+
{"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AAEzB,8IAA8I;AAC9I,eAAO,MAAM,UAAU,GACrB,OAAO,KAAK,EACZ,MAAM,MAAM,KACX,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CACpB,CAAA;AAIvC,sEAAsE;AACtE,MAAM,MAAM,UAAU,CAAC,OAAO,EAAE,IAAI,IAAI,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;AAE5E,0JAA0J;AAC1J,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAYf,CAAA;AAEF;mFACmF;AACnF,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,IAAI,EAChC,cAAc,IAAI,CAChB,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,EACzB,OAAO,GAAG,iBAAiB,GAAG,gBAAgB,CAC/C,KACA,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,iBAAiB,CAAC,KACrE,IAAI,CAoBR,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { init, update, open, close, selectItem, view, lazy, Model, } from './single.js';
|
|
2
|
-
export { Message, Orientation, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusButton, CompletedFocusItems, CompletedScrollIntoView, CompletedClickItem, ClearedSearch, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusButton, FocusItems, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, } from './shared.js';
|
|
3
|
-
export type { ActivationTrigger, Opened, Closed,
|
|
2
|
+
export { Message, Orientation, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusButton, CompletedFocusItems, CompletedScrollIntoView, CompletedClickItem, CompletedAnchorMount, CompletedFocusItemsOnMount, ClearedSearch, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusButton, FocusItems, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, } from './shared.js';
|
|
3
|
+
export type { ActivationTrigger, Opened, Closed, BlurredItems, ActivatedItem, DeactivatedItem, MovedPointerOverItem, RequestedItemClick, Searched, PressedPointerOnButton, IgnoredMouseClick, SuppressedSpaceScroll, ItemConfig, GroupHeading, } from './shared.js';
|
|
4
4
|
export type { InitConfig, ViewConfig } from './single.js';
|
|
5
5
|
export type { AnchorConfig } from '../anchor.js';
|
|
6
6
|
export * as Multi from './multiPublic.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,KAAK,GACN,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,KAAK,GACN,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,YAAY,EACZ,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,EACR,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,YAAY,GACb,MAAM,aAAa,CAAA;AAEpB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEzD,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAEhD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { init, update, open, close, selectItem, view, lazy, Model, } from './single.js';
|
|
2
|
-
export { Message, Orientation, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusButton, CompletedFocusItems, CompletedScrollIntoView, CompletedClickItem, ClearedSearch, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusButton, FocusItems, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, } from './shared.js';
|
|
2
|
+
export { Message, Orientation, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusButton, CompletedFocusItems, CompletedScrollIntoView, CompletedClickItem, CompletedAnchorMount, CompletedFocusItemsOnMount, ClearedSearch, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusButton, FocusItems, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, } from './shared.js';
|
|
3
3
|
export * as Multi from './multiPublic.js';
|
|
@@ -48,8 +48,8 @@ export declare const Opened: import("../../schema/index.js").CallableTaggedStruc
|
|
|
48
48
|
}>;
|
|
49
49
|
/** Sent when the listbox closes via Escape key or backdrop click. */
|
|
50
50
|
export declare const Closed: import("../../schema/index.js").CallableTaggedStruct<"Closed", {}>;
|
|
51
|
-
/** Sent when
|
|
52
|
-
export declare const
|
|
51
|
+
/** Sent when the listbox items container loses focus. */
|
|
52
|
+
export declare const BlurredItems: import("../../schema/index.js").CallableTaggedStruct<"BlurredItems", {}>;
|
|
53
53
|
/** Sent when an item is highlighted via arrow keys or mouse hover. Includes activation trigger. */
|
|
54
54
|
export declare const ActivatedItem: import("../../schema/index.js").CallableTaggedStruct<"ActivatedItem", {
|
|
55
55
|
index: typeof S.Number;
|
|
@@ -100,6 +100,10 @@ export declare const CompletedClickItem: import("../../schema/index.js").Callabl
|
|
|
100
100
|
export declare const IgnoredMouseClick: import("../../schema/index.js").CallableTaggedStruct<"IgnoredMouseClick", {}>;
|
|
101
101
|
/** Sent when a Space key-up is captured to prevent page scrolling. */
|
|
102
102
|
export declare const SuppressedSpaceScroll: import("../../schema/index.js").CallableTaggedStruct<"SuppressedSpaceScroll", {}>;
|
|
103
|
+
/** Sent when the listbox items panel mounts and Floating UI has positioned it. Update no-ops; surfaces the positioning side effect for DevTools. */
|
|
104
|
+
export declare const CompletedAnchorMount: import("../../schema/index.js").CallableTaggedStruct<"CompletedAnchorMount", {}>;
|
|
105
|
+
/** Sent when the listbox items panel mounts and the no-anchor focus fallback runs. Update no-ops; surfaces the focus side effect for DevTools. */
|
|
106
|
+
export declare const CompletedFocusItemsOnMount: import("../../schema/index.js").CallableTaggedStruct<"CompletedFocusItemsOnMount", {}>;
|
|
103
107
|
/** Wraps an Animation submodel message for delegation. */
|
|
104
108
|
export declare const GotAnimationMessage: import("../../schema/index.js").CallableTaggedStruct<"GotAnimationMessage", {
|
|
105
109
|
message: S.Union<[import("../../schema/index.js").CallableTaggedStruct<"Showed", {}>, import("../../schema/index.js").CallableTaggedStruct<"Hid", {}>, import("../../schema/index.js").CallableTaggedStruct<"AdvancedAnimationFrame", {}>, import("../../schema/index.js").CallableTaggedStruct<"EndedAnimation", {}>]>;
|
|
@@ -113,7 +117,7 @@ export declare const PressedPointerOnButton: import("../../schema/index.js").Cal
|
|
|
113
117
|
export declare const Message: S.Union<[
|
|
114
118
|
typeof Opened,
|
|
115
119
|
typeof Closed,
|
|
116
|
-
typeof
|
|
120
|
+
typeof BlurredItems,
|
|
117
121
|
typeof ActivatedItem,
|
|
118
122
|
typeof DeactivatedItem,
|
|
119
123
|
typeof SelectedItem,
|
|
@@ -131,12 +135,14 @@ export declare const Message: S.Union<[
|
|
|
131
135
|
typeof CompletedClickItem,
|
|
132
136
|
typeof IgnoredMouseClick,
|
|
133
137
|
typeof SuppressedSpaceScroll,
|
|
138
|
+
typeof CompletedAnchorMount,
|
|
139
|
+
typeof CompletedFocusItemsOnMount,
|
|
134
140
|
typeof GotAnimationMessage,
|
|
135
141
|
typeof PressedPointerOnButton
|
|
136
142
|
]>;
|
|
137
143
|
export type Opened = typeof Opened.Type;
|
|
138
144
|
export type Closed = typeof Closed.Type;
|
|
139
|
-
export type
|
|
145
|
+
export type BlurredItems = typeof BlurredItems.Type;
|
|
140
146
|
export type ActivatedItem = typeof ActivatedItem.Type;
|
|
141
147
|
export type DeactivatedItem = typeof DeactivatedItem.Type;
|
|
142
148
|
export type SelectedItem = typeof SelectedItem.Type;
|
|
@@ -217,7 +223,7 @@ export declare const makeUpdate: <Model extends BaseModel>(handleSelectedItem: (
|
|
|
217
223
|
} | {
|
|
218
224
|
readonly _tag: "Closed";
|
|
219
225
|
} | {
|
|
220
|
-
readonly _tag: "
|
|
226
|
+
readonly _tag: "BlurredItems";
|
|
221
227
|
} | {
|
|
222
228
|
readonly _tag: "ActivatedItem";
|
|
223
229
|
readonly activationTrigger: "Pointer" | "Keyboard";
|
|
@@ -262,6 +268,10 @@ export declare const makeUpdate: <Model extends BaseModel>(handleSelectedItem: (
|
|
|
262
268
|
readonly _tag: "IgnoredMouseClick";
|
|
263
269
|
} | {
|
|
264
270
|
readonly _tag: "SuppressedSpaceScroll";
|
|
271
|
+
} | {
|
|
272
|
+
readonly _tag: "CompletedAnchorMount";
|
|
273
|
+
} | {
|
|
274
|
+
readonly _tag: "CompletedFocusItemsOnMount";
|
|
265
275
|
} | {
|
|
266
276
|
readonly _tag: "GotAnimationMessage";
|
|
267
277
|
readonly message: {
|
|
@@ -292,7 +302,7 @@ export type GroupHeading = Readonly<{
|
|
|
292
302
|
/** Configuration for rendering a listbox with `view`. */
|
|
293
303
|
export type BaseViewConfig<Message, Item, Model extends BaseModel> = Readonly<{
|
|
294
304
|
model: Model;
|
|
295
|
-
toParentMessage: (message: Opened | Closed |
|
|
305
|
+
toParentMessage: (message: Opened | Closed | BlurredItems | ActivatedItem | DeactivatedItem | SelectedItem | MovedPointerOverItem | RequestedItemClick | Searched | PressedPointerOnButton | IgnoredMouseClick | SuppressedSpaceScroll | typeof CompletedAnchorMount.Type | typeof CompletedFocusItemsOnMount.Type) => Message;
|
|
296
306
|
onSelectedItem?: (value: string) => Message;
|
|
297
307
|
items: ReadonlyArray<Item>;
|
|
298
308
|
itemToConfig: (item: Item, context: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,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effect, Equal, Match as M, Option, Predicate, Schema as S, String as Str, pipe, } from 'effect';
|
|
1
|
+
import { Array, Effect, Equal, Function, Match as M, Option, Predicate, Schema as S, String as Str, pipe, } from 'effect';
|
|
2
2
|
import * as Command from '../../command/index.js';
|
|
3
3
|
import { OptionExt } from '../../effectExtensions/index.js';
|
|
4
|
-
import { html } from '../../html/index.js';
|
|
4
|
+
import { html, } from '../../html/index.js';
|
|
5
5
|
import { m } from '../../message/index.js';
|
|
6
|
+
import * as Mount from '../../mount/index.js';
|
|
6
7
|
import { makeConstrainedEvo } from '../../struct/index.js';
|
|
7
8
|
import * as Task from '../../task/index.js';
|
|
8
|
-
import {
|
|
9
|
+
import { anchorSetup } from '../anchor.js';
|
|
9
10
|
// NOTE: Animation imports are split across schema + update to avoid a circular
|
|
10
11
|
// dependency: animation → html → runtime → devtools → listbox → animation.
|
|
11
12
|
// The barrel (../animation) imports from html, which starts the cycle.
|
|
@@ -57,8 +58,8 @@ export const Opened = m('Opened', {
|
|
|
57
58
|
});
|
|
58
59
|
/** Sent when the listbox closes via Escape key or backdrop click. */
|
|
59
60
|
export const Closed = m('Closed');
|
|
60
|
-
/** Sent when
|
|
61
|
-
export const
|
|
61
|
+
/** Sent when the listbox items container loses focus. */
|
|
62
|
+
export const BlurredItems = m('BlurredItems');
|
|
62
63
|
/** Sent when an item is highlighted via arrow keys or mouse hover. Includes activation trigger. */
|
|
63
64
|
export const ActivatedItem = m('ActivatedItem', {
|
|
64
65
|
index: S.Number,
|
|
@@ -105,6 +106,10 @@ export const CompletedClickItem = m('CompletedClickItem');
|
|
|
105
106
|
export const IgnoredMouseClick = m('IgnoredMouseClick');
|
|
106
107
|
/** Sent when a Space key-up is captured to prevent page scrolling. */
|
|
107
108
|
export const SuppressedSpaceScroll = m('SuppressedSpaceScroll');
|
|
109
|
+
/** Sent when the listbox items panel mounts and Floating UI has positioned it. Update no-ops; surfaces the positioning side effect for DevTools. */
|
|
110
|
+
export const CompletedAnchorMount = m('CompletedAnchorMount');
|
|
111
|
+
/** Sent when the listbox items panel mounts and the no-anchor focus fallback runs. Update no-ops; surfaces the focus side effect for DevTools. */
|
|
112
|
+
export const CompletedFocusItemsOnMount = m('CompletedFocusItemsOnMount');
|
|
108
113
|
/** Wraps an Animation submodel message for delegation. */
|
|
109
114
|
export const GotAnimationMessage = m('GotAnimationMessage', {
|
|
110
115
|
message: AnimationMessage,
|
|
@@ -115,7 +120,7 @@ export const PressedPointerOnButton = m('PressedPointerOnButton', {
|
|
|
115
120
|
button: S.Number,
|
|
116
121
|
});
|
|
117
122
|
/** Union of all messages the listbox component can produce. */
|
|
118
|
-
export const Message = S.Union(Opened, Closed,
|
|
123
|
+
export const Message = S.Union(Opened, Closed, BlurredItems, ActivatedItem, DeactivatedItem, SelectedItem, MovedPointerOverItem, RequestedItemClick, Searched, ClearedSearch, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusButton, CompletedFocusItems, CompletedScrollIntoView, CompletedClickItem, IgnoredMouseClick, SuppressedSpaceScroll, CompletedAnchorMount, CompletedFocusItemsOnMount, GotAnimationMessage, PressedPointerOnButton);
|
|
119
124
|
// CONSTANTS
|
|
120
125
|
export const SEARCH_DEBOUNCE_MILLISECONDS = 350;
|
|
121
126
|
export const LEFT_MOUSE_BUTTON = 0;
|
|
@@ -229,7 +234,7 @@ export const makeUpdate = (handleSelectedItem) => {
|
|
|
229
234
|
maybeLastPointerPosition: () => Option.none(),
|
|
230
235
|
}), openCommands),
|
|
231
236
|
Closed: () => closeListbox(model, closeWithFocusCommands),
|
|
232
|
-
|
|
237
|
+
BlurredItems: () => {
|
|
233
238
|
if (Option.exists(model.maybeLastButtonPointerType, Equal.equals('mouse'))) {
|
|
234
239
|
return [model, []];
|
|
235
240
|
}
|
|
@@ -338,11 +343,24 @@ export const makeUpdate = (handleSelectedItem) => {
|
|
|
338
343
|
[],
|
|
339
344
|
],
|
|
340
345
|
SuppressedSpaceScroll: () => [model, []],
|
|
346
|
+
CompletedAnchorMount: () => [model, []],
|
|
347
|
+
CompletedFocusItemsOnMount: () => [model, []],
|
|
341
348
|
}));
|
|
342
349
|
};
|
|
343
350
|
};
|
|
351
|
+
const ListboxAnchor = Mount.define('ListboxAnchor', CompletedAnchorMount);
|
|
352
|
+
const ListboxFocusItemsOnMount = Mount.define('ListboxFocusItemsOnMount', CompletedFocusItemsOnMount);
|
|
353
|
+
const focusItemsOnMount = ListboxFocusItemsOnMount((element) => Effect.sync(() => {
|
|
354
|
+
if (element instanceof HTMLElement) {
|
|
355
|
+
element.focus();
|
|
356
|
+
}
|
|
357
|
+
return {
|
|
358
|
+
message: CompletedFocusItemsOnMount(),
|
|
359
|
+
cleanup: Function.constVoid,
|
|
360
|
+
};
|
|
361
|
+
}));
|
|
344
362
|
export const makeView = (behavior) => (config) => {
|
|
345
|
-
const { div, input, AriaActiveDescendant, AriaControls, AriaDisabled, AriaExpanded, AriaHasPopup, AriaLabelledBy, AriaMultiSelectable, AriaOrientation, AriaSelected, Attribute, Class, DataAttribute, Id, Name, OnBlur, OnClick,
|
|
363
|
+
const { div, input, AriaActiveDescendant, AriaControls, AriaDisabled, AriaExpanded, AriaHasPopup, AriaLabelledBy, AriaMultiSelectable, AriaOrientation, AriaSelected, Attribute, Class, DataAttribute, Id, Name, OnBlur, OnClick, OnKeyDownPreventDefault, OnKeyUpPreventDefault, OnMount, OnPointerDown, OnPointerLeave, OnPointerMove, Role, Style, Tabindex, Type, Value, keyed, } = html();
|
|
346
364
|
const { model: { id, isOpen, orientation, animation: { transitionState }, maybeActiveItemIndex, searchQuery, maybeLastButtonPointerType, }, toParentMessage, onSelectedItem, items, itemToConfig, isItemDisabled, isButtonDisabled, buttonContent, buttonClassName, buttonAttributes = [], itemsClassName, itemsAttributes = [], itemsScrollClassName, itemsScrollAttributes = [], backdropClassName, backdropAttributes = [], className, attributes = [], itemGroupKey, groupToHeading, groupClassName, groupAttributes = [], separatorClassName, separatorAttributes = [], anchor, name, form, isDisabled, isInvalid, } = config;
|
|
347
365
|
const itemToValue = config.itemToValue ?? (item => String(item));
|
|
348
366
|
const itemToSearchText = config.itemToSearchText ?? (item => itemToValue(item));
|
|
@@ -453,25 +471,19 @@ export const makeView = (behavior) => (config) => {
|
|
|
453
471
|
onNone: () => [],
|
|
454
472
|
onSome: index => [AriaActiveDescendant(itemId(id, index))],
|
|
455
473
|
});
|
|
456
|
-
const
|
|
457
|
-
? anchorHooks({
|
|
458
|
-
buttonId: `${id}-button`,
|
|
459
|
-
anchor,
|
|
460
|
-
focusAfterPosition: true,
|
|
461
|
-
})
|
|
462
|
-
: undefined;
|
|
463
|
-
const focusOnInsert = (element) => {
|
|
464
|
-
if (element instanceof HTMLElement) {
|
|
465
|
-
element.focus();
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
const anchorAttributes = hooks
|
|
474
|
+
const anchorAttributes = anchor
|
|
469
475
|
? [
|
|
470
476
|
Style({ position: 'absolute', margin: '0', visibility: 'hidden' }),
|
|
471
|
-
|
|
472
|
-
|
|
477
|
+
OnMount(Mount.mapMessage(ListboxAnchor((items) => Effect.sync(() => ({
|
|
478
|
+
message: CompletedAnchorMount(),
|
|
479
|
+
cleanup: anchorSetup({
|
|
480
|
+
buttonId: `${id}-button`,
|
|
481
|
+
anchor,
|
|
482
|
+
focusAfterPosition: true,
|
|
483
|
+
})(items),
|
|
484
|
+
}))), toParentMessage)),
|
|
473
485
|
]
|
|
474
|
-
: [
|
|
486
|
+
: [OnMount(Mount.mapMessage(focusItemsOnMount, toParentMessage))];
|
|
475
487
|
const itemsContainerAttributes = [
|
|
476
488
|
Id(`${id}-items`),
|
|
477
489
|
Role('listbox'),
|
|
@@ -487,7 +499,7 @@ export const makeView = (behavior) => (config) => {
|
|
|
487
499
|
: [
|
|
488
500
|
OnKeyDownPreventDefault(handleItemsKeyDown),
|
|
489
501
|
OnKeyUpPreventDefault(handleSpaceKeyUp),
|
|
490
|
-
OnBlur(toParentMessage(
|
|
502
|
+
OnBlur(toParentMessage(BlurredItems())),
|
|
491
503
|
]),
|
|
492
504
|
...(itemsClassName ? [Class(itemsClassName)] : []),
|
|
493
505
|
...itemsAttributes,
|
|
@@ -86,7 +86,7 @@ export declare const update: (model: {
|
|
|
86
86
|
} | {
|
|
87
87
|
readonly _tag: "Closed";
|
|
88
88
|
} | {
|
|
89
|
-
readonly _tag: "
|
|
89
|
+
readonly _tag: "BlurredItems";
|
|
90
90
|
} | {
|
|
91
91
|
readonly _tag: "ActivatedItem";
|
|
92
92
|
readonly activationTrigger: "Pointer" | "Keyboard";
|
|
@@ -131,6 +131,10 @@ export declare const update: (model: {
|
|
|
131
131
|
readonly _tag: "IgnoredMouseClick";
|
|
132
132
|
} | {
|
|
133
133
|
readonly _tag: "SuppressedSpaceScroll";
|
|
134
|
+
} | {
|
|
135
|
+
readonly _tag: "CompletedAnchorMount";
|
|
136
|
+
} | {
|
|
137
|
+
readonly _tag: "CompletedFocusItemsOnMount";
|
|
134
138
|
} | {
|
|
135
139
|
readonly _tag: "GotAnimationMessage";
|
|
136
140
|
readonly message: {
|
|
@@ -184,7 +188,11 @@ export declare const view: <Message, Item>(config: Readonly<{
|
|
|
184
188
|
} & {
|
|
185
189
|
readonly maybeSelectedItem: Option.Option<string>;
|
|
186
190
|
};
|
|
187
|
-
toParentMessage: (message: Opened | Closed | import("./shared.js").
|
|
191
|
+
toParentMessage: (message: Opened | Closed | import("./shared.js").BlurredItems | import("./shared.js").ActivatedItem | import("./shared.js").DeactivatedItem | SelectedItem | import("./shared.js").MovedPointerOverItem | import("./shared.js").RequestedItemClick | import("./shared.js").Searched | import("./shared.js").PressedPointerOnButton | import("./shared.js").IgnoredMouseClick | import("./shared.js").SuppressedSpaceScroll | {
|
|
192
|
+
readonly _tag: "CompletedAnchorMount";
|
|
193
|
+
} | {
|
|
194
|
+
readonly _tag: "CompletedFocusItemsOnMount";
|
|
195
|
+
}) => Message;
|
|
188
196
|
onSelectedItem?: (value: string) => Message;
|
|
189
197
|
items: readonly Item[];
|
|
190
198
|
itemToConfig: (item: Item, context: Readonly<{
|