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 +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,QA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CAAC,CAAC,CACK,CAAA;AAEhE;wFACwF;AACxF,eAAO,MAAM,KAAK,GAChB,OAAO,KAAK,KACX,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,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/ui/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EAIV,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAchD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAM7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAIvD,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,oCAAmC,CAAA;AACjE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAQ7D,iIAAiI;AACjI,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;EAehB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,mJAAmJ;AACnJ,eAAO,MAAM,MAAM;;EAEjB,CAAA;AACF,kEAAkE;AAClE,eAAO,MAAM,MAAM,oEAAc,CAAA;AACjC,sDAAsD;AACtD,eAAO,MAAM,YAAY,0EAAoB,CAAA;AAC7C,mGAAmG;AACnG,eAAO,MAAM,aAAa;;;EAGxB,CAAA;AACF,kDAAkD;AAClD,eAAO,MAAM,eAAe,6EAAuB,CAAA;AACnD,gEAAgE;AAChE,eAAO,MAAM,YAAY;;EAAyC,CAAA;AAClE,kHAAkH;AAClH,eAAO,MAAM,kBAAkB;;EAE7B,CAAA;AACF,qEAAqE;AACrE,eAAO,MAAM,QAAQ;;;EAGnB,CAAA;AACF,4EAA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CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACvD,MAAM,CAAC,EAAE,YAAY,CAAA;CACtB,CAAC,CAAA;AAEF,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,CAAA;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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE9E,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE9E,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EAIV,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAiBhD,qGAAqG;AACrG,eAAO,MAAM,KAAK;;;;;;;;;;;;EAQhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,2EAA2E;AAC3E,eAAO,MAAM,MAAM,oEAAc,CAAA;AACjC,kGAAkG;AAClG,eAAO,MAAM,MAAM,oEAAc,CAAA;AACjC,oFAAoF;AACpF,eAAO,MAAM,YAAY,0EAAoB,CAAA;AAC7C,qHAAqH;AACrH,eAAO,MAAM,sBAAsB;;;EAGjC,CAAA;AACF,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,iFAA2B,CAAA;AAC3D,kEAAkE;AAClE,eAAO,MAAM,oBAAoB,kFAA4B,CAAA;AAC7D,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,i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E,UAAU,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,KACpD,IAAI,CAgBR,CAAA"}
|
package/dist/ui/popover/index.js
CHANGED
|
@@ -3,9 +3,10 @@ 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 → popover → animation.
|
|
11
12
|
// The barrel (../animation) imports from html, which starts the cycle.
|
|
@@ -27,8 +28,8 @@ export const Model = S.Struct({
|
|
|
27
28
|
export const Opened = m('Opened');
|
|
28
29
|
/** Sent when the popover closes via Escape key or backdrop click. Returns focus to the button. */
|
|
29
30
|
export const Closed = m('Closed');
|
|
30
|
-
/** Sent when
|
|
31
|
-
export const
|
|
31
|
+
/** Sent when the popover panel loses focus. Does NOT return focus to the button. */
|
|
32
|
+
export const BlurredPanel = m('BlurredPanel');
|
|
32
33
|
/** Sent when the user presses a pointer device on the popover button. Records pointer type and toggles for mouse. */
|
|
33
34
|
export const PressedPointerOnButton = m('PressedPointerOnButton', {
|
|
34
35
|
pointerType: S.String,
|
|
@@ -50,12 +51,14 @@ export const CompletedTeardownInert = m('CompletedTeardownInert');
|
|
|
50
51
|
export const IgnoredMouseClick = m('IgnoredMouseClick');
|
|
51
52
|
/** Sent when a Space key-up is captured to prevent page scrolling. */
|
|
52
53
|
export const SuppressedSpaceScroll = m('SuppressedSpaceScroll');
|
|
54
|
+
/** 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. */
|
|
55
|
+
export const CompletedAnchorMount = m('CompletedAnchorMount');
|
|
53
56
|
/** Wraps an Animation submodel message for delegation. */
|
|
54
57
|
export const GotAnimationMessage = m('GotAnimationMessage', {
|
|
55
58
|
message: AnimationMessage,
|
|
56
59
|
});
|
|
57
60
|
/** Union of all messages the popover component can produce. */
|
|
58
|
-
export const Message = S.Union(Opened, Closed,
|
|
61
|
+
export const Message = S.Union(Opened, Closed, BlurredPanel, PressedPointerOnButton, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, IgnoredMouseClick, SuppressedSpaceScroll, CompletedAnchorMount, GotAnimationMessage);
|
|
59
62
|
// INIT
|
|
60
63
|
const LEFT_MOUSE_BUTTON = 0;
|
|
61
64
|
/** Creates an initial popover model from a config. Defaults to closed. */
|
|
@@ -151,7 +154,7 @@ export const update = (model, message) => {
|
|
|
151
154
|
return M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
|
|
152
155
|
Opened: () => openPopover(model),
|
|
153
156
|
Closed: () => closePopover(model, closeWithFocusCommands),
|
|
154
|
-
|
|
157
|
+
BlurredPanel: () => {
|
|
155
158
|
if (Option.exists(model.maybeLastButtonPointerType, Equal.equals('mouse'))) {
|
|
156
159
|
return [model, []];
|
|
157
160
|
}
|
|
@@ -187,8 +190,10 @@ export const update = (model, message) => {
|
|
|
187
190
|
[],
|
|
188
191
|
],
|
|
189
192
|
SuppressedSpaceScroll: () => [model, []],
|
|
193
|
+
CompletedAnchorMount: () => [model, []],
|
|
190
194
|
}));
|
|
191
195
|
};
|
|
196
|
+
const PopoverAnchor = Mount.define('PopoverAnchor', CompletedAnchorMount);
|
|
192
197
|
/** Programmatically opens the popover, updating the model and returning
|
|
193
198
|
* focus and modal commands. Use this in domain-event handlers when the popover uses `onOpened`. */
|
|
194
199
|
export const open = (model) => update(model, Opened());
|
|
@@ -197,7 +202,7 @@ export const open = (model) => update(model, Opened());
|
|
|
197
202
|
export const close = (model) => update(model, Closed());
|
|
198
203
|
/** Renders a headless popover with a trigger button and a floating panel. Uses the disclosure ARIA pattern (aria-expanded + aria-controls) with no role on the panel. */
|
|
199
204
|
export const view = (config) => {
|
|
200
|
-
const { div, AriaControls, AriaDisabled, AriaExpanded, Class, DataAttribute, Id, OnBlur, OnClick,
|
|
205
|
+
const { div, AriaControls, AriaDisabled, AriaExpanded, Class, DataAttribute, Id, OnBlur, OnClick, OnKeyDownPreventDefault, OnKeyUpPreventDefault, OnMount, OnPointerDown, Style, Tabindex, Type, keyed, } = html();
|
|
201
206
|
const { model: { id, isOpen, contentFocus, animation: { transitionState }, maybeLastButtonPointerType, }, toParentMessage, onOpened, onClosed, anchor, buttonContent, buttonClassName, buttonAttributes = [], panelContent, panelClassName, panelAttributes = [], backdropClassName, backdropAttributes = [], isDisabled, focusSelector, className, attributes = [], } = config;
|
|
202
207
|
const dispatchOpened = () => onOpened ? onOpened() : toParentMessage(Opened());
|
|
203
208
|
const dispatchClosed = () => onClosed ? onClosed() : toParentMessage(Closed());
|
|
@@ -259,17 +264,19 @@ export const view = (config) => {
|
|
|
259
264
|
...(buttonClassName ? [Class(buttonClassName)] : []),
|
|
260
265
|
...buttonAttributes,
|
|
261
266
|
];
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
const anchorAction = Mount.mapMessage(PopoverAnchor((items) => Effect.sync(() => ({
|
|
268
|
+
message: CompletedAnchorMount(),
|
|
269
|
+
cleanup: anchorSetup({
|
|
270
|
+
buttonId: `${id}-button`,
|
|
271
|
+
anchor,
|
|
272
|
+
interceptTab: false,
|
|
273
|
+
focusAfterPosition: true,
|
|
274
|
+
...(focusSelector !== undefined && { focusSelector }),
|
|
275
|
+
})(items),
|
|
276
|
+
}))), toParentMessage);
|
|
269
277
|
const anchorAttributes = [
|
|
270
278
|
Style({ position: 'absolute', margin: '0', visibility: 'hidden' }),
|
|
271
|
-
|
|
272
|
-
OnDestroy(hooks.onDestroy),
|
|
279
|
+
OnMount(anchorAction),
|
|
273
280
|
];
|
|
274
281
|
const resolvedPanelAttributes = [
|
|
275
282
|
Id(`${id}-panel`),
|
|
@@ -280,7 +287,7 @@ export const view = (config) => {
|
|
|
280
287
|
? []
|
|
281
288
|
: [
|
|
282
289
|
OnKeyDownPreventDefault(handlePanelKeyDown),
|
|
283
|
-
...(contentFocus ? [] : [OnBlur(toParentMessage(
|
|
290
|
+
...(contentFocus ? [] : [OnBlur(toParentMessage(BlurredPanel()))]),
|
|
284
291
|
]),
|
|
285
292
|
...(panelClassName ? [Class(panelClassName)] : []),
|
|
286
293
|
...panelAttributes,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { init, update, open, close, view, lazy, Model, Message, Opened, Closed, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, } from './index.js';
|
|
2
|
-
export type {
|
|
1
|
+
export { init, update, open, close, view, lazy, Model, Message, Opened, Closed, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedAnchorMount, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, } from './index.js';
|
|
2
|
+
export type { BlurredPanel, PressedPointerOnButton, IgnoredMouseClick, SuppressedSpaceScroll, InitConfig, ViewConfig, } 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/popover/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,4BAA4B,GAC7B,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/popover/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,4BAA4B,GAC7B,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,UAAU,GACX,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, open, close, view, lazy, Model, Message, Opened, Closed, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, } from './index.js';
|
|
1
|
+
export { init, update, open, close, view, lazy, Model, Message, Opened, Closed, CompletedFocusPanel, CompletedFocusButton, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedAnchorMount, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusPanel, FocusButton, DetectMovementOrAnimationEnd, } from './index.js';
|
|
@@ -37,6 +37,8 @@ export declare const ElapsedShowDelay: import("../../schema/index.js").CallableT
|
|
|
37
37
|
export declare const ChangedShowDelay: import("../../schema/index.js").CallableTaggedStruct<"ChangedShowDelay", {
|
|
38
38
|
showDelay: typeof S.DurationFromMillis;
|
|
39
39
|
}>;
|
|
40
|
+
/** Sent when the tooltip panel mounts and Floating UI has positioned it. Update no-ops; the side effect is the act of positioning, surfaced for DevTools observability. */
|
|
41
|
+
export declare const CompletedAnchorMount: import("../../schema/index.js").CallableTaggedStruct<"CompletedAnchorMount", {}>;
|
|
40
42
|
/** Union of all messages the tooltip component can produce. */
|
|
41
43
|
export declare const Message: S.Union<[
|
|
42
44
|
typeof EnteredTrigger,
|
|
@@ -46,7 +48,8 @@ export declare const Message: S.Union<[
|
|
|
46
48
|
typeof PressedEscape,
|
|
47
49
|
typeof PressedPointerOnTrigger,
|
|
48
50
|
typeof ElapsedShowDelay,
|
|
49
|
-
typeof ChangedShowDelay
|
|
51
|
+
typeof ChangedShowDelay,
|
|
52
|
+
typeof CompletedAnchorMount
|
|
50
53
|
]>;
|
|
51
54
|
export type EnteredTrigger = typeof EnteredTrigger.Type;
|
|
52
55
|
export type LeftTrigger = typeof LeftTrigger.Type;
|
|
@@ -75,7 +78,7 @@ export declare const setShowDelay: (model: Model, showDelay: Duration.DurationIn
|
|
|
75
78
|
/** Configuration for rendering a tooltip with `view`. */
|
|
76
79
|
export type ViewConfig<Message> = Readonly<{
|
|
77
80
|
model: Model;
|
|
78
|
-
toParentMessage: (message: EnteredTrigger | LeftTrigger | FocusedTrigger | BlurredTrigger | PressedEscape | PressedPointerOnTrigger) => Message;
|
|
81
|
+
toParentMessage: (message: EnteredTrigger | LeftTrigger | FocusedTrigger | BlurredTrigger | PressedEscape | PressedPointerOnTrigger | typeof CompletedAnchorMount.Type) => Message;
|
|
79
82
|
anchor: AnchorConfig;
|
|
80
83
|
triggerContent: Html;
|
|
81
84
|
triggerClassName?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAMR,MAAM,IAAI,CAAC,EACZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAMR,MAAM,IAAI,CAAC,EACZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EAIV,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAIhD,wqBAAwqB;AACxqB,eAAO,MAAM,KAAK;;;;;;;;;EAShB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,qFAAqF;AACrF,eAAO,MAAM,cAAc,4EAAsB,CAAA;AACjD,qIAAqI;AACrI,eAAO,MAAM,WAAW,yEAAmB,CAAA;AAC3C,6KAA6K;AAC7K,eAAO,MAAM,cAAc,4EAAsB,CAAA;AACjD,oFAAoF;AACpF,eAAO,MAAM,cAAc,4EAAsB,CAAA;AACjD,wMAAwM;AACxM,eAAO,MAAM,aAAa,2EAAqB,CAAA;AAC/C,oRAAoR;AACpR,eAAO,MAAM,uBAAuB;;;EAGlC,CAAA;AACF,sJAAsJ;AACtJ,eAAO,MAAM,gBAAgB;;EAE3B,CAAA;AACF,mRAAmR;AACnR,eAAO,MAAM,gBAAg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AU,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,KACpD,IAAI,CAgBR,CAAA"}
|
package/dist/ui/tooltip/index.js
CHANGED
|
@@ -3,9 +3,10 @@ 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
|
// MODEL
|
|
10
11
|
/** Schema for the tooltip component's state. `isOpen` is visibility; `isHovered` tracks pointer on trigger; `isFocused` tracks tooltip-affirming focus on the trigger (focus arriving without a preceding mouse press — keyboard, touch, or pen; mouse-click-induced focus is excluded since it doesn't affirm the user wants the tooltip visible); `isDismissed` suppresses re-opening after the user dismissed the tooltip (via Escape or left-click) until they disengage (leave or blur). `showDelay` is the hover-to-show duration. `maybeLastPointerType` records the most recent pointer type that pressed the trigger, so a mouse-click-induced focus can be distinguished from other focus. */
|
|
11
12
|
export const Model = S.Struct({
|
|
@@ -42,8 +43,10 @@ export const ElapsedShowDelay = m('ElapsedShowDelay', {
|
|
|
42
43
|
export const ChangedShowDelay = m('ChangedShowDelay', {
|
|
43
44
|
showDelay: S.DurationFromMillis,
|
|
44
45
|
});
|
|
46
|
+
/** Sent when the tooltip panel mounts and Floating UI has positioned it. Update no-ops; the side effect is the act of positioning, surfaced for DevTools observability. */
|
|
47
|
+
export const CompletedAnchorMount = m('CompletedAnchorMount');
|
|
45
48
|
/** Union of all messages the tooltip component can produce. */
|
|
46
|
-
export const Message = S.Union(EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ChangedShowDelay);
|
|
49
|
+
export const Message = S.Union(EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ChangedShowDelay, CompletedAnchorMount);
|
|
47
50
|
// INIT
|
|
48
51
|
const DEFAULT_SHOW_DELAY = Duration.millis(500);
|
|
49
52
|
const LEFT_MOUSE_BUTTON = 0;
|
|
@@ -63,6 +66,7 @@ export const init = (config) => ({
|
|
|
63
66
|
const withUpdateReturn = M.withReturnType();
|
|
64
67
|
/** Waits for the tooltip's show delay before emitting `ElapsedShowDelay`. The version is echoed back so a stale timer is ignored when the user leaves before the delay fires. */
|
|
65
68
|
export const ShowAfterDelay = Command.define('ShowAfterDelay', ElapsedShowDelay);
|
|
69
|
+
const TooltipAnchor = Mount.define('TooltipAnchor', CompletedAnchorMount);
|
|
66
70
|
/** Processes a tooltip message and returns the next model and commands. */
|
|
67
71
|
export const update = (model, message) => M.value(message).pipe(withUpdateReturn, M.tagsExhaustive({
|
|
68
72
|
EnteredTrigger: () => {
|
|
@@ -169,12 +173,13 @@ export const update = (model, message) => M.value(message).pipe(withUpdateReturn
|
|
|
169
173
|
evo(model, { showDelay: () => showDelay }),
|
|
170
174
|
[],
|
|
171
175
|
],
|
|
176
|
+
CompletedAnchorMount: () => [model, []],
|
|
172
177
|
}));
|
|
173
178
|
/** Programmatically updates the tooltip's hover show-delay. Use this in response to user preference changes, input-method switches, or reduced-motion settings. The new delay applies to the next hover; any pending timer is unaffected (its stale version will discard harmlessly when it fires). */
|
|
174
179
|
export const setShowDelay = (model, showDelay) => update(model, ChangedShowDelay({ showDelay: Duration.decode(showDelay) }));
|
|
175
180
|
/** Renders a headless tooltip with an anchored non-interactive panel. Shows on hover (after delay) or focus (from keyboard, touch, or pen; mouse-click focus is excluded); hides on leave, blur, Escape, or left-click of the trigger. Uses `role="tooltip"` and links the trigger via `aria-describedby`. */
|
|
176
181
|
export const view = (config) => {
|
|
177
|
-
const { div, AriaDescribedBy, AriaDisabled, Class, DataAttribute, Id, OnBlur,
|
|
182
|
+
const { div, AriaDescribedBy, AriaDisabled, Class, DataAttribute, Id, OnBlur, OnFocus, OnKeyDownPreventDefault, OnMount, OnMouseEnter, OnMouseLeave, OnPointerDown, Role, Style, Type, keyed, } = html();
|
|
178
183
|
const { model: { id, isOpen }, toParentMessage, anchor, triggerContent, triggerClassName, triggerAttributes = [], content, panelClassName, panelAttributes = [], isDisabled, className, attributes = [], } = config;
|
|
179
184
|
const handleTriggerKeyDown = (key) => M.value(key).pipe(M.when('Escape', () => OptionExt.when(isOpen, toParentMessage(PressedEscape()))), M.orElse(() => Option.none()));
|
|
180
185
|
const handleTriggerPointerDown = (pointerType, button) => Option.some(toParentMessage(PressedPointerOnTrigger({ pointerType, button })));
|
|
@@ -196,11 +201,14 @@ export const view = (config) => {
|
|
|
196
201
|
...(triggerClassName ? [Class(triggerClassName)] : []),
|
|
197
202
|
...triggerAttributes,
|
|
198
203
|
];
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
+
const anchorAction = Mount.mapMessage(TooltipAnchor((items) => Effect.sync(() => ({
|
|
205
|
+
message: CompletedAnchorMount(),
|
|
206
|
+
cleanup: anchorSetup({
|
|
207
|
+
buttonId: `${id}-trigger`,
|
|
208
|
+
anchor,
|
|
209
|
+
interceptTab: false,
|
|
210
|
+
})(items),
|
|
211
|
+
}))), toParentMessage);
|
|
204
212
|
const anchorAttributes = [
|
|
205
213
|
Style({
|
|
206
214
|
position: 'absolute',
|
|
@@ -208,8 +216,7 @@ export const view = (config) => {
|
|
|
208
216
|
visibility: 'hidden',
|
|
209
217
|
pointerEvents: 'none',
|
|
210
218
|
}),
|
|
211
|
-
|
|
212
|
-
OnDestroy(hooks.onDestroy),
|
|
219
|
+
OnMount(anchorAction),
|
|
213
220
|
];
|
|
214
221
|
const resolvedPanelAttributes = [
|
|
215
222
|
Id(`${id}-panel`),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { init, update, view, lazy, setShowDelay, Model, Message, EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ChangedShowDelay, ShowAfterDelay, } from './index.js';
|
|
1
|
+
export { init, update, view, lazy, setShowDelay, Model, Message, EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ChangedShowDelay, ShowAfterDelay, CompletedAnchorMount, } from './index.js';
|
|
2
2
|
export type { InitConfig, ViewConfig } 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/tooltip/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,OAAO,EACP,cAAc,EACd,WAAW,EACX,cAAc,EACd,cAAc,EACd,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/tooltip/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,OAAO,EACP,cAAc,EACd,WAAW,EACX,cAAc,EACd,cAAc,EACd,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,GACrB,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAExD,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, view, lazy, setShowDelay, Model, Message, EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ChangedShowDelay, ShowAfterDelay, } from './index.js';
|
|
1
|
+
export { init, update, view, lazy, setShowDelay, Model, Message, EnteredTrigger, LeftTrigger, FocusedTrigger, BlurredTrigger, PressedEscape, PressedPointerOnTrigger, ElapsedShowDelay, ChangedShowDelay, ShowAfterDelay, CompletedAnchorMount, } from './index.js';
|