foldkit 0.79.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/README.md +1 -0
- 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/calendar/index.d.ts +117 -28
- package/dist/ui/calendar/index.d.ts.map +1 -1
- package/dist/ui/calendar/index.js +393 -105
- package/dist/ui/calendar/public.d.ts +2 -2
- package/dist/ui/calendar/public.d.ts.map +1 -1
- package/dist/ui/calendar/public.js +1 -1
- 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 +7 -4
- package/dist/ui/datePicker/index.d.ts.map +1 -1
- package/dist/ui/datePicker/index.js +8 -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 +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,EAIN,MAAM,EAEN,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EAGV,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAoBhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAEvD,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAIhC,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,oCAAmC,CAAA;AACjE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAE7D,0FAA0F;AAC1F,eAAO,MAAM,WAAW,uCAAsC,CAAA;AAC9D,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD,mKAAmK;AACnK,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;EAepB,CAAA;AACF,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAA;AAE7C,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,CAAC,EAAE,OAAO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,IAAI,CAAC,EAC1B,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,KAChC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC1B,mBAAmB,EAAE,OAAO,CAAA;CAC7B,CAAC,CAAA;AAEF,eAAO,MAAM,QAAQ,GAClB,KAAK,SAAS,SAAS,EAAE,UAAU,YAAY,CAAC,KAAK,CAAC,MACtD,OAAO,EAAE,IAAI,EAAE,QAAQ,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,KAAG,IAyiB9D,CAAA"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Array, 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<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/single.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEnD,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,mJAAmJ;AACnJ,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,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAC,CAAA;AAEJ,6HAA6H;AAC7H,eAAO,MAAM,IAAI,GAAI,QAAQ,UAAU,KAAG,KAGxC,CAAA;AAIF,qIAAqI;AACrI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CAClC,CAAA;AAEzB;gGACgG;AAChG,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,uEAAuE;AACvE,MAAM,MAAM,UAAU,CAAC,OAAO,EAAE,IAAI,IAAI,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;AAE5E,2JAA2J;AAC3J,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAWf,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"}
|
package/dist/ui/menu/index.d.ts
CHANGED
|
@@ -40,8 +40,8 @@ export declare const Opened: import("../../schema/index.js").CallableTaggedStruc
|
|
|
40
40
|
}>;
|
|
41
41
|
/** Sent when the menu closes via Escape key or backdrop click. */
|
|
42
42
|
export declare const Closed: import("../../schema/index.js").CallableTaggedStruct<"Closed", {}>;
|
|
43
|
-
/** Sent when
|
|
44
|
-
export declare const
|
|
43
|
+
/** Sent when the menu items container loses focus. */
|
|
44
|
+
export declare const BlurredItems: import("../../schema/index.js").CallableTaggedStruct<"BlurredItems", {}>;
|
|
45
45
|
/** Sent when an item is highlighted via arrow keys or mouse hover. Includes activation trigger. */
|
|
46
46
|
export declare const ActivatedItem: import("../../schema/index.js").CallableTaggedStruct<"ActivatedItem", {
|
|
47
47
|
index: typeof S.Number;
|
|
@@ -94,6 +94,10 @@ export declare const CompletedAdvanceFocus: import("../../schema/index.js").Call
|
|
|
94
94
|
export declare const IgnoredMouseClick: import("../../schema/index.js").CallableTaggedStruct<"IgnoredMouseClick", {}>;
|
|
95
95
|
/** Sent when a Space key-up is captured to prevent page scrolling. */
|
|
96
96
|
export declare const SuppressedSpaceScroll: import("../../schema/index.js").CallableTaggedStruct<"SuppressedSpaceScroll", {}>;
|
|
97
|
+
/** Sent when the menu items panel mounts and Floating UI has positioned it. Update no-ops; the side effect is the act of positioning, surfaced for DevTools observability. */
|
|
98
|
+
export declare const CompletedAnchorMount: import("../../schema/index.js").CallableTaggedStruct<"CompletedAnchorMount", {}>;
|
|
99
|
+
/** Sent when the menu items panel mounts and the no-anchor focus fallback runs. Update no-ops; the side effect is the focus call, surfaced for DevTools observability. */
|
|
100
|
+
export declare const CompletedFocusItemsOnMount: import("../../schema/index.js").CallableTaggedStruct<"CompletedFocusItemsOnMount", {}>;
|
|
97
101
|
/** Wraps an Animation submodel message for delegation. */
|
|
98
102
|
export declare const GotAnimationMessage: import("../../schema/index.js").CallableTaggedStruct<"GotAnimationMessage", {
|
|
99
103
|
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", {}>]>;
|
|
@@ -116,7 +120,7 @@ export declare const ReleasedPointerOnItems: import("../../schema/index.js").Cal
|
|
|
116
120
|
export declare const Message: S.Union<[
|
|
117
121
|
typeof Opened,
|
|
118
122
|
typeof Closed,
|
|
119
|
-
typeof
|
|
123
|
+
typeof BlurredItems,
|
|
120
124
|
typeof ActivatedItem,
|
|
121
125
|
typeof DeactivatedItem,
|
|
122
126
|
typeof SelectedItem,
|
|
@@ -135,6 +139,8 @@ export declare const Message: S.Union<[
|
|
|
135
139
|
typeof CompletedAdvanceFocus,
|
|
136
140
|
typeof IgnoredMouseClick,
|
|
137
141
|
typeof SuppressedSpaceScroll,
|
|
142
|
+
typeof CompletedAnchorMount,
|
|
143
|
+
typeof CompletedFocusItemsOnMount,
|
|
138
144
|
typeof GotAnimationMessage,
|
|
139
145
|
typeof PressedPointerOnButton,
|
|
140
146
|
typeof ReleasedPointerOnItems
|
|
@@ -142,7 +148,7 @@ export declare const Message: S.Union<[
|
|
|
142
148
|
export type Message = typeof Message.Type;
|
|
143
149
|
export type Opened = typeof Opened.Type;
|
|
144
150
|
export type Closed = typeof Closed.Type;
|
|
145
|
-
export type
|
|
151
|
+
export type BlurredItems = typeof BlurredItems.Type;
|
|
146
152
|
export type ActivatedItem = typeof ActivatedItem.Type;
|
|
147
153
|
export type DeactivatedItem = typeof DeactivatedItem.Type;
|
|
148
154
|
export type SelectedItem = typeof SelectedItem.Type;
|
|
@@ -237,7 +243,7 @@ export type GroupHeading = Readonly<{
|
|
|
237
243
|
/** Configuration for rendering a menu with `view`. */
|
|
238
244
|
export type ViewConfig<Message, Item extends string> = Readonly<{
|
|
239
245
|
model: Model;
|
|
240
|
-
toParentMessage: (message: Opened | Closed |
|
|
246
|
+
toParentMessage: (message: Opened | Closed | BlurredItems | ActivatedItem | DeactivatedItem | SelectedItem | MovedPointerOverItem | RequestedItemClick | Searched | PressedPointerOnButton | ReleasedPointerOnItems | IgnoredMouseClick | SuppressedSpaceScroll | typeof CompletedAnchorMount.Type | typeof CompletedFocusItemsOnMount.Type) => Message;
|
|
241
247
|
onSelectedItem?: (index: number) => Message;
|
|
242
248
|
items: ReadonlyArray<Item>;
|
|
243
249
|
itemToConfig: (item: Item, context: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src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A;AAIjD,sHAAsH;AACtH,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,IAAI,SAAS,MAAM,EAC/C,QAAQ,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,KAChC,IAueF,CAAA;AAED;mFACmF;AACnF,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,IAAI,SAAS,MAAM,EAC/C,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,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,iBAAiB,CAAC,KAC1D,IAAI,CAgBR,CAAA"}
|
package/dist/ui/menu/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Array, 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
4
|
import { createLazy, html, } from '../../html/index.js';
|
|
5
5
|
import { m } from '../../message/index.js';
|
|
6
|
+
import * as Mount from '../../mount/index.js';
|
|
6
7
|
import { evo } 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 → menu → animation.
|
|
11
12
|
// The barrel (../animation) imports from html, which starts the cycle.
|
|
@@ -44,8 +45,8 @@ export const Opened = m('Opened', {
|
|
|
44
45
|
});
|
|
45
46
|
/** Sent when the menu closes via Escape key or backdrop click. */
|
|
46
47
|
export const Closed = m('Closed');
|
|
47
|
-
/** Sent when
|
|
48
|
-
export const
|
|
48
|
+
/** Sent when the menu items container loses focus. */
|
|
49
|
+
export const BlurredItems = m('BlurredItems');
|
|
49
50
|
/** Sent when an item is highlighted via arrow keys or mouse hover. Includes activation trigger. */
|
|
50
51
|
export const ActivatedItem = m('ActivatedItem', {
|
|
51
52
|
index: S.Number,
|
|
@@ -94,6 +95,10 @@ export const CompletedAdvanceFocus = m('CompletedAdvanceFocus');
|
|
|
94
95
|
export const IgnoredMouseClick = m('IgnoredMouseClick');
|
|
95
96
|
/** Sent when a Space key-up is captured to prevent page scrolling. */
|
|
96
97
|
export const SuppressedSpaceScroll = m('SuppressedSpaceScroll');
|
|
98
|
+
/** Sent when the menu items panel mounts and Floating UI has positioned it. Update no-ops; the side effect is the act of positioning, surfaced for DevTools observability. */
|
|
99
|
+
export const CompletedAnchorMount = m('CompletedAnchorMount');
|
|
100
|
+
/** Sent when the menu items panel mounts and the no-anchor focus fallback runs. Update no-ops; the side effect is the focus call, surfaced for DevTools observability. */
|
|
101
|
+
export const CompletedFocusItemsOnMount = m('CompletedFocusItemsOnMount');
|
|
97
102
|
/** Wraps an Animation submodel message for delegation. */
|
|
98
103
|
export const GotAnimationMessage = m('GotAnimationMessage', {
|
|
99
104
|
message: AnimationMessage,
|
|
@@ -113,7 +118,7 @@ export const ReleasedPointerOnItems = m('ReleasedPointerOnItems', {
|
|
|
113
118
|
timeStamp: S.Number,
|
|
114
119
|
});
|
|
115
120
|
/** Union of all messages the menu component can produce. */
|
|
116
|
-
export const Message = S.Union(Opened, Closed,
|
|
121
|
+
export const Message = S.Union(Opened, Closed, BlurredItems, ActivatedItem, DeactivatedItem, SelectedItem, MovedPointerOverItem, RequestedItemClick, Searched, ClearedSearch, CompletedFocusItems, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedScrollIntoView, CompletedClickItem, CompletedAdvanceFocus, IgnoredMouseClick, SuppressedSpaceScroll, CompletedAnchorMount, CompletedFocusItemsOnMount, GotAnimationMessage, PressedPointerOnButton, ReleasedPointerOnItems);
|
|
117
122
|
// INIT
|
|
118
123
|
const SEARCH_DEBOUNCE_MILLISECONDS = 350;
|
|
119
124
|
const LEFT_MOUSE_BUTTON = 0;
|
|
@@ -238,7 +243,7 @@ export const update = (model, message) => {
|
|
|
238
243
|
maybeLastPointerPosition: () => Option.none(),
|
|
239
244
|
})),
|
|
240
245
|
Closed: () => closeMenu(model, closeWithFocusCommands),
|
|
241
|
-
|
|
246
|
+
BlurredItems: () => {
|
|
242
247
|
if (Option.exists(model.maybeLastButtonPointerType, Equal.equals('mouse'))) {
|
|
243
248
|
return [model, []];
|
|
244
249
|
}
|
|
@@ -360,8 +365,21 @@ export const update = (model, message) => {
|
|
|
360
365
|
[],
|
|
361
366
|
],
|
|
362
367
|
SuppressedSpaceScroll: () => [model, []],
|
|
368
|
+
CompletedAnchorMount: () => [model, []],
|
|
369
|
+
CompletedFocusItemsOnMount: () => [model, []],
|
|
363
370
|
}));
|
|
364
371
|
};
|
|
372
|
+
const MenuAnchor = Mount.define('MenuAnchor', CompletedAnchorMount);
|
|
373
|
+
const MenuFocusItemsOnMount = Mount.define('MenuFocusItemsOnMount', CompletedFocusItemsOnMount);
|
|
374
|
+
const focusItemsOnMount = MenuFocusItemsOnMount((element) => Effect.sync(() => {
|
|
375
|
+
if (element instanceof HTMLElement) {
|
|
376
|
+
element.focus();
|
|
377
|
+
}
|
|
378
|
+
return {
|
|
379
|
+
message: CompletedFocusItemsOnMount(),
|
|
380
|
+
cleanup: Function.constVoid,
|
|
381
|
+
};
|
|
382
|
+
}));
|
|
365
383
|
/** Programmatically opens the menu, updating the model and returning
|
|
366
384
|
* focus and modal commands. Use this in domain-event handlers to open the menu. */
|
|
367
385
|
export const open = (model) => update(model, Opened({ maybeActiveItemIndex: Option.none() }));
|
|
@@ -375,7 +393,7 @@ export { groupContiguous, resolveTypeaheadMatch };
|
|
|
375
393
|
const itemId = (id, index) => `${id}-item-${index}`;
|
|
376
394
|
/** Renders a headless menu with typeahead search, keyboard navigation, and aria-activedescendant focus management. */
|
|
377
395
|
export const view = (config) => {
|
|
378
|
-
const { div, AriaActiveDescendant, AriaControls, AriaDisabled, AriaExpanded, AriaHasPopup, AriaLabelledBy, Class, DataAttribute, Id, OnBlur, OnClick,
|
|
396
|
+
const { div, AriaActiveDescendant, AriaControls, AriaDisabled, AriaExpanded, AriaHasPopup, AriaLabelledBy, Class, DataAttribute, Id, OnBlur, OnClick, OnKeyDownPreventDefault, OnKeyUpPreventDefault, OnMount, OnPointerDown, OnPointerLeave, OnPointerMove, OnPointerUp, Role, Style, Tabindex, Type, keyed, } = html();
|
|
379
397
|
const { model: { id, isOpen, animation: { transitionState }, maybeActiveItemIndex, searchQuery, maybeLastButtonPointerType, }, toParentMessage, onSelectedItem, items, itemToConfig, isItemDisabled, itemToSearchText = (item) => item, isButtonDisabled, buttonContent, buttonClassName, buttonAttributes = [], itemsClassName, itemsAttributes = [], itemsScrollClassName, itemsScrollAttributes = [], backdropClassName, backdropAttributes = [], className, attributes = [], itemGroupKey, groupToHeading, groupClassName, groupAttributes = [], separatorClassName, separatorAttributes = [], anchor, } = config;
|
|
380
398
|
const dispatchSelectedItem = (index) => onSelectedItem
|
|
381
399
|
? onSelectedItem(index)
|
|
@@ -471,25 +489,19 @@ export const view = (config) => {
|
|
|
471
489
|
onNone: () => [],
|
|
472
490
|
onSome: index => [AriaActiveDescendant(itemId(id, index))],
|
|
473
491
|
});
|
|
474
|
-
const
|
|
475
|
-
? anchorHooks({
|
|
476
|
-
buttonId: `${id}-button`,
|
|
477
|
-
anchor,
|
|
478
|
-
focusAfterPosition: true,
|
|
479
|
-
})
|
|
480
|
-
: undefined;
|
|
481
|
-
const focusOnInsert = (element) => {
|
|
482
|
-
if (element instanceof HTMLElement) {
|
|
483
|
-
element.focus();
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
const anchorAttributes = hooks
|
|
492
|
+
const anchorAttributes = anchor
|
|
487
493
|
? [
|
|
488
494
|
Style({ position: 'absolute', margin: '0', visibility: 'hidden' }),
|
|
489
|
-
|
|
490
|
-
|
|
495
|
+
OnMount(Mount.mapMessage(MenuAnchor((items) => Effect.sync(() => ({
|
|
496
|
+
message: CompletedAnchorMount(),
|
|
497
|
+
cleanup: anchorSetup({
|
|
498
|
+
buttonId: `${id}-button`,
|
|
499
|
+
anchor,
|
|
500
|
+
focusAfterPosition: true,
|
|
501
|
+
})(items),
|
|
502
|
+
}))), toParentMessage)),
|
|
491
503
|
]
|
|
492
|
-
: [
|
|
504
|
+
: [OnMount(Mount.mapMessage(focusItemsOnMount, toParentMessage))];
|
|
493
505
|
const itemsContainerAttributes = [
|
|
494
506
|
Id(`${id}-items`),
|
|
495
507
|
Role('menu'),
|
|
@@ -504,7 +516,7 @@ export const view = (config) => {
|
|
|
504
516
|
OnKeyDownPreventDefault(handleItemsKeyDown),
|
|
505
517
|
OnKeyUpPreventDefault(handleSpaceKeyUp),
|
|
506
518
|
OnPointerUp(handleItemsPointerUp),
|
|
507
|
-
OnBlur(toParentMessage(
|
|
519
|
+
OnBlur(toParentMessage(BlurredItems())),
|
|
508
520
|
]),
|
|
509
521
|
...(itemsClassName ? [Class(itemsClassName)] : []),
|
|
510
522
|
...itemsAttributes,
|
package/dist/ui/menu/public.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { init, update, open, close, selectItem, view, lazy, Model, Message, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusItems, CompletedFocusButton, CompletedScrollIntoView, CompletedClickItem, ClearedSearch, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusItems, FocusButton, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, } from './index.js';
|
|
2
|
-
export type { ActivationTrigger, Opened, Closed,
|
|
1
|
+
export { init, update, open, close, selectItem, view, lazy, Model, Message, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusItems, CompletedFocusButton, CompletedScrollIntoView, CompletedClickItem, CompletedAnchorMount, CompletedFocusItemsOnMount, ClearedSearch, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusItems, FocusButton, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, } from './index.js';
|
|
2
|
+
export type { ActivationTrigger, Opened, Closed, BlurredItems, ActivatedItem, DeactivatedItem, MovedPointerOverItem, RequestedItemClick, Searched, PressedPointerOnButton, ReleasedPointerOnItems, IgnoredMouseClick, SuppressedSpaceScroll, InitConfig, ViewConfig, ItemConfig, GroupHeading, } from './index.js';
|
|
3
3
|
export type { AnchorConfig } from '../anchor.js';
|
|
4
4
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/menu/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/menu/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,YAAY,EACZ,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,EACR,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/ui/menu/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, open, close, selectItem, view, lazy, Model, Message, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusItems, CompletedFocusButton, CompletedScrollIntoView, CompletedClickItem, ClearedSearch, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusItems, FocusButton, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, } from './index.js';
|
|
1
|
+
export { init, update, open, close, selectItem, view, lazy, Model, Message, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusItems, CompletedFocusButton, CompletedScrollIntoView, CompletedClickItem, CompletedAnchorMount, CompletedFocusItemsOnMount, ClearedSearch, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusItems, FocusButton, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, } from './index.js';
|
|
@@ -21,8 +21,8 @@ export type Model = typeof Model.Type;
|
|
|
21
21
|
export declare const Opened: import("../../schema/index.js").CallableTaggedStruct<"Opened", {}>;
|
|
22
22
|
/** Sent when the popover closes via Escape key or backdrop click. Returns focus to the button. */
|
|
23
23
|
export declare const Closed: import("../../schema/index.js").CallableTaggedStruct<"Closed", {}>;
|
|
24
|
-
/** Sent when
|
|
25
|
-
export declare const
|
|
24
|
+
/** Sent when the popover panel loses focus. Does NOT return focus to the button. */
|
|
25
|
+
export declare const BlurredPanel: import("../../schema/index.js").CallableTaggedStruct<"BlurredPanel", {}>;
|
|
26
26
|
/** Sent when the user presses a pointer device on the popover button. Records pointer type and toggles for mouse. */
|
|
27
27
|
export declare const PressedPointerOnButton: import("../../schema/index.js").CallableTaggedStruct<"PressedPointerOnButton", {
|
|
28
28
|
pointerType: typeof S.String;
|
|
@@ -44,6 +44,8 @@ export declare const CompletedTeardownInert: import("../../schema/index.js").Cal
|
|
|
44
44
|
export declare const IgnoredMouseClick: import("../../schema/index.js").CallableTaggedStruct<"IgnoredMouseClick", {}>;
|
|
45
45
|
/** Sent when a Space key-up is captured to prevent page scrolling. */
|
|
46
46
|
export declare const SuppressedSpaceScroll: import("../../schema/index.js").CallableTaggedStruct<"SuppressedSpaceScroll", {}>;
|
|
47
|
+
/** Sent when the popover panel mounts and Floating UI has positioned it. Update no-ops; the side effect is the act of positioning, surfaced for DevTools observability. */
|
|
48
|
+
export declare const CompletedAnchorMount: import("../../schema/index.js").CallableTaggedStruct<"CompletedAnchorMount", {}>;
|
|
47
49
|
/** Wraps an Animation submodel message for delegation. */
|
|
48
50
|
export declare const GotAnimationMessage: import("../../schema/index.js").CallableTaggedStruct<"GotAnimationMessage", {
|
|
49
51
|
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", {}>]>;
|
|
@@ -52,7 +54,7 @@ export declare const GotAnimationMessage: import("../../schema/index.js").Callab
|
|
|
52
54
|
export declare const Message: S.Union<[
|
|
53
55
|
typeof Opened,
|
|
54
56
|
typeof Closed,
|
|
55
|
-
typeof
|
|
57
|
+
typeof BlurredPanel,
|
|
56
58
|
typeof PressedPointerOnButton,
|
|
57
59
|
typeof CompletedFocusPanel,
|
|
58
60
|
typeof CompletedFocusButton,
|
|
@@ -62,11 +64,12 @@ export declare const Message: S.Union<[
|
|
|
62
64
|
typeof CompletedTeardownInert,
|
|
63
65
|
typeof IgnoredMouseClick,
|
|
64
66
|
typeof SuppressedSpaceScroll,
|
|
67
|
+
typeof CompletedAnchorMount,
|
|
65
68
|
typeof GotAnimationMessage
|
|
66
69
|
]>;
|
|
67
70
|
export type Opened = typeof Opened.Type;
|
|
68
71
|
export type Closed = typeof Closed.Type;
|
|
69
|
-
export type
|
|
72
|
+
export type BlurredPanel = typeof BlurredPanel.Type;
|
|
70
73
|
export type PressedPointerOnButton = typeof PressedPointerOnButton.Type;
|
|
71
74
|
export type IgnoredMouseClick = typeof IgnoredMouseClick.Type;
|
|
72
75
|
export type SuppressedSpaceScroll = typeof SuppressedSpaceScroll.Type;
|
|
@@ -129,7 +132,7 @@ export declare const close: (model: Model) => readonly [Model, ReadonlyArray<Com
|
|
|
129
132
|
/** Configuration for rendering a popover with `view`. */
|
|
130
133
|
export type ViewConfig<Message> = Readonly<{
|
|
131
134
|
model: Model;
|
|
132
|
-
toParentMessage: (message: Opened | Closed |
|
|
135
|
+
toParentMessage: (message: Opened | Closed | BlurredPanel | PressedPointerOnButton | IgnoredMouseClick | SuppressedSpaceScroll | typeof CompletedAnchorMount.Type) => Message;
|
|
133
136
|
onOpened?: () => Message;
|
|
134
137
|
onClosed?: () => Message;
|
|
135
138
|
anchor: AnchorConfig;
|