@angular/aria 21.1.0-next.2 → 21.1.0-next.4
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/LICENSE +1 -1
- package/fesm2022/_accordion-chunk.mjs +108 -0
- package/fesm2022/_accordion-chunk.mjs.map +1 -0
- package/fesm2022/_combobox-chunk.mjs +2 -2
- package/fesm2022/_combobox-chunk.mjs.map +1 -1
- package/fesm2022/_combobox-listbox-chunk.mjs +4 -286
- package/fesm2022/_combobox-listbox-chunk.mjs.map +1 -1
- package/fesm2022/_combobox-tree-chunk.mjs +498 -0
- package/fesm2022/_combobox-tree-chunk.mjs.map +1 -0
- package/fesm2022/_deferred-content-chunk.mjs +124 -0
- package/fesm2022/_deferred-content-chunk.mjs.map +1 -0
- package/fesm2022/_expansion-chunk.mjs +41 -0
- package/fesm2022/_expansion-chunk.mjs.map +1 -0
- package/fesm2022/_list-chunk.mjs +121 -0
- package/fesm2022/_list-chunk.mjs.map +1 -0
- package/fesm2022/_list-navigation-chunk.mjs +16 -13
- package/fesm2022/_list-navigation-chunk.mjs.map +1 -1
- package/fesm2022/_list-typeahead-chunk.mjs +170 -0
- package/fesm2022/_list-typeahead-chunk.mjs.map +1 -0
- package/fesm2022/_menu-chunk.mjs +515 -0
- package/fesm2022/_menu-chunk.mjs.map +1 -0
- package/fesm2022/_pointer-event-manager-chunk.mjs +2 -82
- package/fesm2022/_pointer-event-manager-chunk.mjs.map +1 -1
- package/fesm2022/_signal-like-chunk.mjs +118 -0
- package/fesm2022/_signal-like-chunk.mjs.map +1 -0
- package/fesm2022/_tabs-chunk.mjs +159 -0
- package/fesm2022/_tabs-chunk.mjs.map +1 -0
- package/fesm2022/_toolbar-widget-group-chunk.mjs +154 -0
- package/fesm2022/_toolbar-widget-group-chunk.mjs.map +1 -0
- package/fesm2022/_widget-chunk.mjs +3 -2
- package/fesm2022/_widget-chunk.mjs.map +1 -1
- package/fesm2022/accordion.mjs +10 -5
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/aria.mjs +1 -1
- package/fesm2022/aria.mjs.map +1 -1
- package/fesm2022/combobox.mjs +50 -13
- package/fesm2022/combobox.mjs.map +1 -1
- package/fesm2022/grid.mjs +3 -1
- package/fesm2022/grid.mjs.map +1 -1
- package/fesm2022/listbox.mjs +10 -7
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/menu.mjs +12 -7
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/private.mjs +14 -1402
- package/fesm2022/private.mjs.map +1 -1
- package/fesm2022/tabs.mjs +14 -6
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +6 -1
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tree.mjs +18 -10
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +2 -2
- package/types/_accordion-chunk.d.ts +100 -0
- package/types/_combobox-chunk.d.ts +187 -91
- package/types/_deferred-content-chunk.d.ts +42 -0
- package/types/_expansion-chunk.d.ts +40 -0
- package/types/_grid-chunk.d.ts +41 -41
- package/types/_keyboard-event-manager-chunk.d.ts +68 -0
- package/types/_list-chunk.d.ts +17 -17
- package/types/_list-navigation-chunk.d.ts +31 -120
- package/types/_listbox-chunk.d.ts +17 -16
- package/types/_menu-chunk.d.ts +267 -0
- package/types/_pointer-event-manager-chunk.d.ts +34 -0
- package/types/_tabs-chunk.d.ts +153 -0
- package/types/_toolbar-chunk.d.ts +124 -0
- package/types/_tree-chunk.d.ts +276 -0
- package/types/accordion.d.ts +13 -5
- package/types/aria.d.ts +1 -1
- package/types/combobox.d.ts +122 -6
- package/types/grid.d.ts +10 -0
- package/types/listbox.d.ts +17 -5
- package/types/menu.d.ts +24 -6
- package/types/private.d.ts +29 -887
- package/types/tabs.d.ts +24 -8
- package/types/toolbar.d.ts +12 -4
- package/types/tree.d.ts +16 -5
- package/fesm2022/_combobox-popup-chunk.mjs +0 -46
- package/fesm2022/_combobox-popup-chunk.mjs.map +0 -1
- package/types/_combobox-chunk.d2.ts +0 -193
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_list-typeahead-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/behaviors/list-selection/list-selection.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/behaviors/list-typeahead/list-typeahead.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, signal, SignalLike, WritableSignalLike} from '../signal-like/signal-like';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../list-focus/list-focus';\n\n/** Represents an item in a collection, such as a listbox option, that can be selected. */\nexport interface ListSelectionItem<V> extends ListFocusItem {\n /** The value of the item. */\n value: SignalLike<V>;\n\n /** Whether the item is selectable. */\n selectable: SignalLike<boolean>;\n}\n\n/** Represents the required inputs for a collection that contains selectable items. */\nexport interface ListSelectionInputs<T extends ListSelectionItem<V>, V> extends ListFocusInputs<T> {\n /** Whether multiple items in the list can be selected at once. */\n multi: SignalLike<boolean>;\n\n /** The current value of the list selection. */\n values: WritableSignalLike<V[]>;\n\n /** The selection strategy used by the list. */\n selectionMode: SignalLike<'follow' | 'explicit'>;\n}\n\n/** Controls selection for a list of items. */\nexport class ListSelection<T extends ListSelectionItem<V>, V> {\n /** The start index to use for range selection. */\n rangeStartIndex = signal<number>(0);\n\n /** The end index to use for range selection. */\n rangeEndIndex = signal<number>(0);\n\n /** The currently selected items. */\n selectedItems = computed(() =>\n this.inputs.items().filter(item => this.inputs.values().includes(item.value())),\n );\n\n constructor(readonly inputs: ListSelectionInputs<T, V> & {focusManager: ListFocus<T>}) {}\n\n /** Selects the item at the current active index. */\n select(item?: ListSelectionItem<V>, opts = {anchor: true}) {\n item = item ?? (this.inputs.focusManager.inputs.activeItem() as ListSelectionItem<V>);\n\n if (\n !item ||\n item.disabled() ||\n !item.selectable() ||\n !this.inputs.focusManager.isFocusable(item as T) ||\n this.inputs.values().includes(item.value())\n ) {\n return;\n }\n\n if (!this.inputs.multi()) {\n this.deselectAll();\n }\n\n const index = this.inputs.items().findIndex(i => i === item);\n if (opts.anchor) {\n this.beginRangeSelection(index);\n }\n this.inputs.values.update(values => values.concat(item.value()));\n }\n\n /** Deselects the item at the current active index. */\n deselect(item?: ListSelectionItem<V>) {\n item = item ?? this.inputs.focusManager.inputs.activeItem();\n\n if (item && !item.disabled() && item.selectable()) {\n this.inputs.values.update(values => values.filter(value => value !== item.value()));\n }\n }\n\n /** Toggles the item at the current active index. */\n toggle(item?: ListSelectionItem<V>) {\n item = item ?? this.inputs.focusManager.inputs.activeItem();\n if (item) {\n this.inputs.values().includes(item.value()) ? this.deselect(item) : this.select(item);\n }\n }\n\n /** Toggles only the item at the current active index. */\n toggleOne() {\n const item = this.inputs.focusManager.inputs.activeItem();\n if (item) {\n this.inputs.values().includes(item.value()) ? this.deselect() : this.selectOne();\n }\n }\n\n /** Selects all items in the list. */\n selectAll() {\n if (!this.inputs.multi()) {\n return; // Should we log a warning?\n }\n\n for (const item of this.inputs.items()) {\n this.select(item, {anchor: false});\n }\n\n this.beginRangeSelection();\n }\n\n /** Deselects all items in the list. */\n deselectAll() {\n // If an item is not in the list, it forcefully gets deselected.\n // This actually creates a bug for the following edge case:\n //\n // Setup: An item is not in the list (maybe it's lazily loaded), and it is disabled & selected.\n // Expected: If deselectAll() is called, it should NOT get deselected (because it is disabled).\n // Actual: Calling deselectAll() will still deselect the item.\n //\n // Why? Because we can't check if the item is disabled if it's not in the list.\n //\n // Alternatively, we could NOT deselect items that are not in the list, but this has the\n // inverse (and more common) effect of keeping enabled items selected when they aren't in the\n // list.\n\n for (const value of this.inputs.values()) {\n const item = this.inputs.items().find(i => i.value() === value);\n\n item\n ? this.deselect(item)\n : this.inputs.values.update(values => values.filter(v => v !== value));\n }\n }\n\n /**\n * Selects all items in the list or deselects all\n * items in the list if all items are already selected.\n */\n toggleAll() {\n const selectableValues = this.inputs\n .items()\n .filter(i => !i.disabled() && i.selectable() && this.inputs.focusManager.isFocusable(i))\n .map(i => i.value());\n\n selectableValues.every(i => this.inputs.values().includes(i))\n ? this.deselectAll()\n : this.selectAll();\n }\n\n /** Sets the selection to only the current active item. */\n selectOne() {\n const item = this.inputs.focusManager.inputs.activeItem();\n if (item && (item.disabled() || !item.selectable())) {\n return;\n }\n\n this.deselectAll();\n\n if (this.inputs.values().length > 0 && !this.inputs.multi()) {\n return;\n }\n\n this.select();\n }\n\n /**\n * Selects all items in the list up to the anchor item.\n *\n * Deselects all items that were previously within the\n * selected range that are now outside of the selected range\n */\n selectRange(opts = {anchor: true}) {\n const isStartOfRange = this.inputs.focusManager.prevActiveIndex() === this.rangeStartIndex();\n\n if (isStartOfRange && opts.anchor) {\n this.beginRangeSelection(this.inputs.focusManager.prevActiveIndex());\n }\n\n const itemsInRange = this._getItemsFromIndex(this.rangeStartIndex());\n const itemsOutOfRange = this._getItemsFromIndex(this.rangeEndIndex()).filter(\n i => !itemsInRange.includes(i),\n );\n\n for (const item of itemsOutOfRange) {\n this.deselect(item);\n }\n\n for (const item of itemsInRange) {\n this.select(item, {anchor: false});\n }\n\n if (itemsInRange.length) {\n const item = itemsInRange.pop();\n const index = this.inputs.items().findIndex(i => i === item);\n this.rangeEndIndex.set(index);\n }\n }\n\n /** Marks the given index as the start of a range selection. */\n beginRangeSelection(index: number = this.inputs.focusManager.activeIndex()) {\n this.rangeStartIndex.set(index);\n this.rangeEndIndex.set(index);\n }\n\n /** Returns the items in the list starting from the given index. */\n private _getItemsFromIndex(index: number) {\n if (index === -1) {\n return [];\n }\n\n const upper = Math.max(this.inputs.focusManager.activeIndex(), index);\n const lower = Math.min(this.inputs.focusManager.activeIndex(), index);\n\n const items = [];\n for (let i = lower; i <= upper; i++) {\n items.push(this.inputs.items()[i]);\n }\n\n if (this.inputs.focusManager.activeIndex() < index) {\n return items.reverse();\n }\n\n return items;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, signal, SignalLike} from '../signal-like/signal-like';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../list-focus/list-focus';\n\n/**\n * Represents an item in a collection, such as a listbox option, than can be navigated to by\n * typeahead.\n */\nexport interface ListTypeaheadItem extends ListFocusItem {\n /** The text used by the typeahead search. */\n searchTerm: SignalLike<string>;\n}\n\n/**\n * Represents the required inputs for a collection that contains items that can be navigated to by\n * typeahead.\n */\nexport interface ListTypeaheadInputs<T extends ListTypeaheadItem> extends ListFocusInputs<T> {\n /** The amount of time before the typeahead search is reset. */\n typeaheadDelay: SignalLike<number>;\n}\n\n/** Controls typeahead for a list of items. */\nexport class ListTypeahead<T extends ListTypeaheadItem> {\n /** A reference to the timeout for resetting the typeahead search. */\n timeout?: ReturnType<typeof setTimeout> | undefined;\n\n /** The focus controller of the parent list. */\n focusManager: ListFocus<T>;\n\n /** Whether the user is actively typing a typeahead search query. */\n isTyping = computed(() => this._query().length > 0);\n\n /** Keeps track of the characters that typeahead search is being called with. */\n private _query = signal('');\n\n /** The index where that the typeahead search was initiated from. */\n private _startIndex = signal<number | undefined>(undefined);\n\n constructor(readonly inputs: ListTypeaheadInputs<T> & {focusManager: ListFocus<T>}) {\n this.focusManager = inputs.focusManager;\n }\n\n /** Performs a typeahead search, appending the given character to the search string. */\n search(char: string): boolean {\n if (char.length !== 1) {\n return false;\n }\n\n if (!this.isTyping() && char === ' ') {\n return false;\n }\n\n if (this._startIndex() === undefined) {\n this._startIndex.set(this.focusManager.activeIndex());\n }\n\n clearTimeout(this.timeout);\n this._query.update(q => q + char.toLowerCase());\n const item = this._getItem();\n\n if (item) {\n this.focusManager.focus(item);\n }\n\n this.timeout = setTimeout(() => {\n this._query.set('');\n this._startIndex.set(undefined);\n }, this.inputs.typeaheadDelay());\n\n return true;\n }\n\n /**\n * Returns the first item whose search term matches the\n * current query starting from the the current anchor index.\n */\n private _getItem() {\n const items = this.focusManager.inputs.items();\n const itemCount = items.length;\n const startIndex = this._startIndex()!;\n\n for (let i = 0; i < itemCount; i++) {\n const index = (startIndex + 1 + i) % itemCount;\n const item = items[index];\n\n if (\n this.focusManager.isFocusable(item) &&\n item.searchTerm().toLowerCase().startsWith(this._query())\n ) {\n return item;\n }\n }\n\n return undefined;\n }\n}\n"],"names":["ListSelection","inputs","rangeStartIndex","signal","rangeEndIndex","selectedItems","computed","items","filter","item","values","includes","value","constructor","select","opts","anchor","focusManager","activeItem","disabled","selectable","isFocusable","multi","deselectAll","index","findIndex","i","beginRangeSelection","update","concat","deselect","toggle","toggleOne","selectOne","selectAll","find","v","toggleAll","selectableValues","map","every","length","selectRange","isStartOfRange","prevActiveIndex","itemsInRange","_getItemsFromIndex","itemsOutOfRange","pop","set","activeIndex","upper","Math","max","lower","min","push","reverse","ListTypeahead","timeout","isTyping","_query","_startIndex","undefined","search","char","clearTimeout","q","toLowerCase","_getItem","focus","setTimeout","typeaheadDelay","itemCount","startIndex","searchTerm","startsWith"],"mappings":";;MAiCaA,aAAa,CAAA;EAYHC,MAAA;AAVrBC,EAAAA,eAAe,GAAGC,MAAM,CAAS,CAAC,CAAC;AAGnCC,EAAAA,aAAa,GAAGD,MAAM,CAAS,CAAC,CAAC;AAGjCE,EAAAA,aAAa,GAAGC,QAAQ,CAAC,MACvB,IAAI,CAACL,MAAM,CAACM,KAAK,EAAE,CAACC,MAAM,CAACC,IAAI,IAAI,IAAI,CAACR,MAAM,CAACS,MAAM,EAAE,CAACC,QAAQ,CAACF,IAAI,CAACG,KAAK,EAAE,CAAC,CAAC,CAChF;EAEDC,WAAAA,CAAqBZ,MAAgE,EAAA;IAAhE,IAAM,CAAAA,MAAA,GAANA,MAAM;AAA6D;AAGxFa,EAAAA,MAAMA,CAACL,IAA2B,EAAEM,IAAI,GAAG;AAACC,IAAAA,MAAM,EAAE;AA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,YAAY,CAAChB,MAAM,CAACM,KAAK,EAAE;AAC9C,IAAA,MAAMkE,SAAS,GAAGlE,KAAK,CAACkC,MAAM;AAC9B,IAAA,MAAMiC,UAAU,GAAG,IAAI,CAACZ,WAAW,EAAG;IAEtC,KAAK,IAAIpC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG+C,SAAS,EAAE/C,CAAC,EAAE,EAAE;MAClC,MAAMF,KAAK,GAAG,CAACkD,UAAU,GAAG,CAAC,GAAGhD,CAAC,IAAI+C,SAAS;AAC9C,MAAA,MAAMhE,IAAI,GAAGF,KAAK,CAACiB,KAAK,CAAC;MAEzB,IACE,IAAI,CAACP,YAAY,CAACI,WAAW,CAACZ,IAAI,CAAC,IACnCA,IAAI,CAACkE,UAAU,EAAE,CAACP,WAAW,EAAE,CAACQ,UAAU,CAAC,IAAI,CAACf,MAAM,EAAE,CAAC,EACzD;AACA,QAAA,OAAOpD,IAAI;AACb;AACF;AAEA,IAAA,OAAOsD,SAAS;AAClB;AACD;;;;"}
|
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import { computed, signal, KeyboardEventManager } from './_signal-like-chunk.mjs';
|
|
2
|
+
import { List } from './_list-chunk.mjs';
|
|
3
|
+
|
|
4
|
+
class MenuPattern {
|
|
5
|
+
inputs;
|
|
6
|
+
id;
|
|
7
|
+
role = () => 'menu';
|
|
8
|
+
disabled = () => this.inputs.disabled();
|
|
9
|
+
visible = computed(() => this.inputs.parent() ? !!this.inputs.parent()?.expanded() : true);
|
|
10
|
+
listBehavior;
|
|
11
|
+
isFocused = signal(false);
|
|
12
|
+
hasBeenFocused = signal(false);
|
|
13
|
+
hasBeenHovered = signal(false);
|
|
14
|
+
_openTimeout;
|
|
15
|
+
_closeTimeout;
|
|
16
|
+
tabIndex = () => this.listBehavior.tabIndex();
|
|
17
|
+
shouldFocus = computed(() => {
|
|
18
|
+
const root = this.root();
|
|
19
|
+
if (root instanceof MenuTriggerPattern) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (root instanceof MenuBarPattern || root instanceof MenuPattern) {
|
|
23
|
+
return root.isFocused();
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
});
|
|
27
|
+
_expandKey = computed(() => {
|
|
28
|
+
return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
|
|
29
|
+
});
|
|
30
|
+
_collapseKey = computed(() => {
|
|
31
|
+
return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
|
|
32
|
+
});
|
|
33
|
+
dynamicSpaceKey = computed(() => this.listBehavior.isTyping() ? '' : ' ');
|
|
34
|
+
typeaheadRegexp = /^.$/;
|
|
35
|
+
root = computed(() => {
|
|
36
|
+
const parent = this.inputs.parent();
|
|
37
|
+
if (!parent) {
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
if (parent instanceof MenuTriggerPattern) {
|
|
41
|
+
return parent;
|
|
42
|
+
}
|
|
43
|
+
const grandparent = parent.inputs.parent();
|
|
44
|
+
if (grandparent instanceof MenuBarPattern) {
|
|
45
|
+
return grandparent;
|
|
46
|
+
}
|
|
47
|
+
return grandparent?.root();
|
|
48
|
+
});
|
|
49
|
+
keydownManager = computed(() => {
|
|
50
|
+
return new KeyboardEventManager().on('ArrowDown', () => this.next()).on('ArrowUp', () => this.prev()).on('Home', () => this.first()).on('End', () => this.last()).on('Enter', () => this.trigger()).on('Escape', () => this.closeAll()).on(this._expandKey, () => this.expand()).on(this._collapseKey, () => this.collapse()).on(this.dynamicSpaceKey, () => this.trigger()).on(this.typeaheadRegexp, e => this.listBehavior.search(e.key));
|
|
51
|
+
});
|
|
52
|
+
constructor(inputs) {
|
|
53
|
+
this.inputs = inputs;
|
|
54
|
+
this.id = inputs.id;
|
|
55
|
+
this.listBehavior = new List({
|
|
56
|
+
...inputs,
|
|
57
|
+
values: signal([])
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
setDefaultState() {
|
|
61
|
+
if (!this.inputs.parent()) {
|
|
62
|
+
this.listBehavior.goto(this.inputs.items()[0], {
|
|
63
|
+
focusElement: false
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
onKeydown(event) {
|
|
68
|
+
this.keydownManager().handle(event);
|
|
69
|
+
}
|
|
70
|
+
onMouseOver(event) {
|
|
71
|
+
if (!this.visible()) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this.hasBeenHovered.set(true);
|
|
75
|
+
const item = this.inputs.items().find(i => i.element()?.contains(event.target));
|
|
76
|
+
if (!item) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const parent = this.inputs.parent();
|
|
80
|
+
const activeItem = this?.inputs.activeItem();
|
|
81
|
+
if (parent instanceof MenuItemPattern) {
|
|
82
|
+
const grandparent = parent.inputs.parent();
|
|
83
|
+
if (grandparent instanceof MenuPattern) {
|
|
84
|
+
grandparent._clearTimeouts();
|
|
85
|
+
grandparent.listBehavior.goto(parent, {
|
|
86
|
+
focusElement: false
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (activeItem && activeItem !== item) {
|
|
91
|
+
this._closeItem(activeItem);
|
|
92
|
+
}
|
|
93
|
+
if (item.expanded()) {
|
|
94
|
+
this._clearCloseTimeout();
|
|
95
|
+
}
|
|
96
|
+
this._openItem(item);
|
|
97
|
+
this.listBehavior.goto(item, {
|
|
98
|
+
focusElement: this.shouldFocus()
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
_closeItem(item) {
|
|
102
|
+
this._clearOpenTimeout();
|
|
103
|
+
if (!this._closeTimeout) {
|
|
104
|
+
this._closeTimeout = setTimeout(() => {
|
|
105
|
+
item.close();
|
|
106
|
+
this._closeTimeout = undefined;
|
|
107
|
+
}, this.inputs.expansionDelay());
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
_openItem(item) {
|
|
111
|
+
this._clearOpenTimeout();
|
|
112
|
+
this._openTimeout = setTimeout(() => {
|
|
113
|
+
item.open();
|
|
114
|
+
this._openTimeout = undefined;
|
|
115
|
+
}, this.inputs.expansionDelay());
|
|
116
|
+
}
|
|
117
|
+
onMouseOut(event) {
|
|
118
|
+
this._clearOpenTimeout();
|
|
119
|
+
if (this.isFocused()) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const root = this.root();
|
|
123
|
+
const parent = this.inputs.parent();
|
|
124
|
+
const relatedTarget = event.relatedTarget;
|
|
125
|
+
if (!root || !parent || parent instanceof MenuTriggerPattern) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const grandparent = parent.inputs.parent();
|
|
129
|
+
if (!grandparent || grandparent instanceof MenuBarPattern) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (!grandparent.inputs.element()?.contains(relatedTarget)) {
|
|
133
|
+
parent.close();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
onClick(event) {
|
|
137
|
+
const relatedTarget = event.target;
|
|
138
|
+
const item = this.inputs.items().find(i => i.element()?.contains(relatedTarget));
|
|
139
|
+
if (item) {
|
|
140
|
+
item.open();
|
|
141
|
+
this.listBehavior.goto(item);
|
|
142
|
+
this.submit(item);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
onFocusIn() {
|
|
146
|
+
this.isFocused.set(true);
|
|
147
|
+
this.hasBeenFocused.set(true);
|
|
148
|
+
}
|
|
149
|
+
onFocusOut(event) {
|
|
150
|
+
const parent = this.inputs.parent();
|
|
151
|
+
const parentEl = parent?.inputs.element();
|
|
152
|
+
const relatedTarget = event.relatedTarget;
|
|
153
|
+
if (!relatedTarget) {
|
|
154
|
+
this.isFocused.set(false);
|
|
155
|
+
this.inputs.parent()?.close({
|
|
156
|
+
refocus: true
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (parent instanceof MenuItemPattern) {
|
|
160
|
+
const grandparent = parent.inputs.parent();
|
|
161
|
+
const siblings = grandparent?.inputs.items().filter(i => i !== parent);
|
|
162
|
+
const item = siblings?.find(i => i.element()?.contains(relatedTarget));
|
|
163
|
+
if (item) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (this.visible() && !parentEl?.contains(relatedTarget) && !this.inputs.element()?.contains(relatedTarget)) {
|
|
168
|
+
this.isFocused.set(false);
|
|
169
|
+
this.inputs.parent()?.close();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
prev() {
|
|
173
|
+
this.inputs.activeItem()?.close();
|
|
174
|
+
this.listBehavior.prev();
|
|
175
|
+
}
|
|
176
|
+
next() {
|
|
177
|
+
this.inputs.activeItem()?.close();
|
|
178
|
+
this.listBehavior.next();
|
|
179
|
+
}
|
|
180
|
+
first() {
|
|
181
|
+
this.inputs.activeItem()?.close();
|
|
182
|
+
this.listBehavior.first();
|
|
183
|
+
}
|
|
184
|
+
last() {
|
|
185
|
+
this.inputs.activeItem()?.close();
|
|
186
|
+
this.listBehavior.last();
|
|
187
|
+
}
|
|
188
|
+
trigger() {
|
|
189
|
+
this.inputs.activeItem()?.hasPopup() ? this.inputs.activeItem()?.open({
|
|
190
|
+
first: true
|
|
191
|
+
}) : this.submit();
|
|
192
|
+
}
|
|
193
|
+
submit(item = this.inputs.activeItem()) {
|
|
194
|
+
const root = this.root();
|
|
195
|
+
if (item && !item.disabled()) {
|
|
196
|
+
const isMenu = root instanceof MenuPattern;
|
|
197
|
+
const isMenuBar = root instanceof MenuBarPattern;
|
|
198
|
+
const isMenuTrigger = root instanceof MenuTriggerPattern;
|
|
199
|
+
if (!item.submenu() && isMenuTrigger) {
|
|
200
|
+
root.close({
|
|
201
|
+
refocus: true
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
if (!item.submenu() && isMenuBar) {
|
|
205
|
+
root.close();
|
|
206
|
+
root?.inputs.onSelect?.(item.value());
|
|
207
|
+
}
|
|
208
|
+
if (!item.submenu() && isMenu) {
|
|
209
|
+
root.inputs.activeItem()?.close({
|
|
210
|
+
refocus: true
|
|
211
|
+
});
|
|
212
|
+
root?.inputs.onSelect?.(item.value());
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
collapse() {
|
|
217
|
+
const root = this.root();
|
|
218
|
+
const parent = this.inputs.parent();
|
|
219
|
+
if (parent instanceof MenuItemPattern && !(parent.inputs.parent() instanceof MenuBarPattern)) {
|
|
220
|
+
parent.close({
|
|
221
|
+
refocus: true
|
|
222
|
+
});
|
|
223
|
+
} else if (root instanceof MenuBarPattern) {
|
|
224
|
+
root.prev();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
expand() {
|
|
228
|
+
const root = this.root();
|
|
229
|
+
const activeItem = this.inputs.activeItem();
|
|
230
|
+
if (activeItem?.submenu()) {
|
|
231
|
+
activeItem.open({
|
|
232
|
+
first: true
|
|
233
|
+
});
|
|
234
|
+
} else if (root instanceof MenuBarPattern) {
|
|
235
|
+
root.next();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
close() {
|
|
239
|
+
this.inputs.parent()?.close();
|
|
240
|
+
}
|
|
241
|
+
closeAll() {
|
|
242
|
+
const root = this.root();
|
|
243
|
+
if (root instanceof MenuTriggerPattern) {
|
|
244
|
+
root.close({
|
|
245
|
+
refocus: true
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
if (root instanceof MenuBarPattern) {
|
|
249
|
+
root.close();
|
|
250
|
+
}
|
|
251
|
+
if (root instanceof MenuPattern) {
|
|
252
|
+
root.inputs.activeItem()?.close({
|
|
253
|
+
refocus: true
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
_clearTimeouts() {
|
|
258
|
+
this._clearOpenTimeout();
|
|
259
|
+
this._clearCloseTimeout();
|
|
260
|
+
}
|
|
261
|
+
_clearOpenTimeout() {
|
|
262
|
+
if (this._openTimeout) {
|
|
263
|
+
clearTimeout(this._openTimeout);
|
|
264
|
+
this._openTimeout = undefined;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
_clearCloseTimeout() {
|
|
268
|
+
if (this._closeTimeout) {
|
|
269
|
+
clearTimeout(this._closeTimeout);
|
|
270
|
+
this._closeTimeout = undefined;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
class MenuBarPattern {
|
|
275
|
+
inputs;
|
|
276
|
+
listBehavior;
|
|
277
|
+
tabIndex = () => this.listBehavior.tabIndex();
|
|
278
|
+
_nextKey = computed(() => {
|
|
279
|
+
return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
|
|
280
|
+
});
|
|
281
|
+
_previousKey = computed(() => {
|
|
282
|
+
return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
|
|
283
|
+
});
|
|
284
|
+
dynamicSpaceKey = computed(() => this.listBehavior.isTyping() ? '' : ' ');
|
|
285
|
+
typeaheadRegexp = /^.$/;
|
|
286
|
+
isFocused = signal(false);
|
|
287
|
+
hasBeenFocused = signal(false);
|
|
288
|
+
disabled = () => this.inputs.disabled();
|
|
289
|
+
keydownManager = computed(() => {
|
|
290
|
+
return new KeyboardEventManager().on(this._nextKey, () => this.next()).on(this._previousKey, () => this.prev()).on('End', () => this.listBehavior.last()).on('Home', () => this.listBehavior.first()).on('Enter', () => this.inputs.activeItem()?.open({
|
|
291
|
+
first: true
|
|
292
|
+
})).on('ArrowUp', () => this.inputs.activeItem()?.open({
|
|
293
|
+
last: true
|
|
294
|
+
})).on('ArrowDown', () => this.inputs.activeItem()?.open({
|
|
295
|
+
first: true
|
|
296
|
+
})).on(this.dynamicSpaceKey, () => this.inputs.activeItem()?.open({
|
|
297
|
+
first: true
|
|
298
|
+
})).on(this.typeaheadRegexp, e => this.listBehavior.search(e.key));
|
|
299
|
+
});
|
|
300
|
+
constructor(inputs) {
|
|
301
|
+
this.inputs = inputs;
|
|
302
|
+
this.listBehavior = new List(inputs);
|
|
303
|
+
}
|
|
304
|
+
setDefaultState() {
|
|
305
|
+
this.inputs.activeItem.set(this.inputs.items()[0]);
|
|
306
|
+
}
|
|
307
|
+
onKeydown(event) {
|
|
308
|
+
this.keydownManager().handle(event);
|
|
309
|
+
}
|
|
310
|
+
onClick(event) {
|
|
311
|
+
const item = this.inputs.items().find(i => i.element()?.contains(event.target));
|
|
312
|
+
if (!item) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
this.goto(item);
|
|
316
|
+
item.expanded() ? item.close() : item.open();
|
|
317
|
+
}
|
|
318
|
+
onMouseOver(event) {
|
|
319
|
+
const item = this.inputs.items().find(i => i.element()?.contains(event.target));
|
|
320
|
+
if (item) {
|
|
321
|
+
this.goto(item, {
|
|
322
|
+
focusElement: this.isFocused()
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
onFocusIn() {
|
|
327
|
+
this.isFocused.set(true);
|
|
328
|
+
this.hasBeenFocused.set(true);
|
|
329
|
+
}
|
|
330
|
+
onFocusOut(event) {
|
|
331
|
+
const relatedTarget = event.relatedTarget;
|
|
332
|
+
if (!this.inputs.element()?.contains(relatedTarget)) {
|
|
333
|
+
this.isFocused.set(false);
|
|
334
|
+
this.close();
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
goto(item, opts) {
|
|
338
|
+
const prevItem = this.inputs.activeItem();
|
|
339
|
+
this.listBehavior.goto(item, opts);
|
|
340
|
+
if (prevItem?.expanded()) {
|
|
341
|
+
prevItem?.close();
|
|
342
|
+
this.inputs.activeItem()?.open();
|
|
343
|
+
}
|
|
344
|
+
if (item === prevItem) {
|
|
345
|
+
if (item.expanded() && item.submenu()?.inputs.activeItem()) {
|
|
346
|
+
item.submenu()?.inputs.activeItem()?.close();
|
|
347
|
+
item.submenu()?.listBehavior.unfocus();
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
next() {
|
|
352
|
+
const prevItem = this.inputs.activeItem();
|
|
353
|
+
this.listBehavior.next();
|
|
354
|
+
if (prevItem?.expanded()) {
|
|
355
|
+
prevItem?.close();
|
|
356
|
+
this.inputs.activeItem()?.open({
|
|
357
|
+
first: true
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
prev() {
|
|
362
|
+
const prevItem = this.inputs.activeItem();
|
|
363
|
+
this.listBehavior.prev();
|
|
364
|
+
if (prevItem?.expanded()) {
|
|
365
|
+
prevItem?.close();
|
|
366
|
+
this.inputs.activeItem()?.open({
|
|
367
|
+
first: true
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
close() {
|
|
372
|
+
this.inputs.activeItem()?.close({
|
|
373
|
+
refocus: this.isFocused()
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
class MenuTriggerPattern {
|
|
378
|
+
inputs;
|
|
379
|
+
expanded = signal(false);
|
|
380
|
+
hasBeenFocused = signal(false);
|
|
381
|
+
role = () => 'button';
|
|
382
|
+
hasPopup = () => true;
|
|
383
|
+
menu;
|
|
384
|
+
tabIndex = computed(() => this.expanded() && this.menu()?.inputs.activeItem() ? -1 : 0);
|
|
385
|
+
disabled = () => this.inputs.disabled();
|
|
386
|
+
keydownManager = computed(() => {
|
|
387
|
+
return new KeyboardEventManager().on(' ', () => this.open({
|
|
388
|
+
first: true
|
|
389
|
+
})).on('Enter', () => this.open({
|
|
390
|
+
first: true
|
|
391
|
+
})).on('ArrowDown', () => this.open({
|
|
392
|
+
first: true
|
|
393
|
+
})).on('ArrowUp', () => this.open({
|
|
394
|
+
last: true
|
|
395
|
+
})).on('Escape', () => this.close({
|
|
396
|
+
refocus: true
|
|
397
|
+
}));
|
|
398
|
+
});
|
|
399
|
+
constructor(inputs) {
|
|
400
|
+
this.inputs = inputs;
|
|
401
|
+
this.menu = this.inputs.menu;
|
|
402
|
+
}
|
|
403
|
+
onKeydown(event) {
|
|
404
|
+
if (!this.inputs.disabled()) {
|
|
405
|
+
this.keydownManager().handle(event);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
onClick() {
|
|
409
|
+
if (!this.inputs.disabled()) {
|
|
410
|
+
this.expanded() ? this.close() : this.open({
|
|
411
|
+
first: true
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
onFocusIn() {
|
|
416
|
+
this.hasBeenFocused.set(true);
|
|
417
|
+
}
|
|
418
|
+
onFocusOut(event) {
|
|
419
|
+
const element = this.inputs.element();
|
|
420
|
+
const relatedTarget = event.relatedTarget;
|
|
421
|
+
if (this.expanded() && !element?.contains(relatedTarget) && !this.inputs.menu()?.inputs.element()?.contains(relatedTarget)) {
|
|
422
|
+
this.close();
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
open(opts) {
|
|
426
|
+
this.expanded.set(true);
|
|
427
|
+
if (opts?.first) {
|
|
428
|
+
this.inputs.menu()?.first();
|
|
429
|
+
} else if (opts?.last) {
|
|
430
|
+
this.inputs.menu()?.last();
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
close(opts = {}) {
|
|
434
|
+
this.expanded.set(false);
|
|
435
|
+
this.menu()?.listBehavior.unfocus();
|
|
436
|
+
if (opts.refocus) {
|
|
437
|
+
this.inputs.element()?.focus();
|
|
438
|
+
}
|
|
439
|
+
let menuitems = this.inputs.menu()?.inputs.items() ?? [];
|
|
440
|
+
while (menuitems.length) {
|
|
441
|
+
const menuitem = menuitems.pop();
|
|
442
|
+
menuitem?._expanded.set(false);
|
|
443
|
+
menuitem?.inputs.parent()?.listBehavior.unfocus();
|
|
444
|
+
menuitems = menuitems.concat(menuitem?.submenu()?.inputs.items() ?? []);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
class MenuItemPattern {
|
|
449
|
+
inputs;
|
|
450
|
+
value;
|
|
451
|
+
id;
|
|
452
|
+
disabled = () => this.inputs.parent()?.disabled() || this.inputs.disabled();
|
|
453
|
+
searchTerm;
|
|
454
|
+
element;
|
|
455
|
+
active = computed(() => this.inputs.parent()?.inputs.activeItem() === this);
|
|
456
|
+
hasBeenFocused = signal(false);
|
|
457
|
+
tabIndex = computed(() => {
|
|
458
|
+
if (this.submenu() && this.submenu()?.inputs.activeItem()) {
|
|
459
|
+
return -1;
|
|
460
|
+
}
|
|
461
|
+
return this.inputs.parent()?.listBehavior.getItemTabindex(this) ?? -1;
|
|
462
|
+
});
|
|
463
|
+
index = computed(() => this.inputs.parent()?.inputs.items().indexOf(this) ?? -1);
|
|
464
|
+
expanded = computed(() => this.submenu() ? this._expanded() : null);
|
|
465
|
+
_expanded = signal(false);
|
|
466
|
+
controls = signal(undefined);
|
|
467
|
+
role = () => 'menuitem';
|
|
468
|
+
hasPopup = computed(() => !!this.submenu());
|
|
469
|
+
submenu;
|
|
470
|
+
selectable;
|
|
471
|
+
constructor(inputs) {
|
|
472
|
+
this.inputs = inputs;
|
|
473
|
+
this.id = inputs.id;
|
|
474
|
+
this.value = inputs.value;
|
|
475
|
+
this.element = inputs.element;
|
|
476
|
+
this.submenu = this.inputs.submenu;
|
|
477
|
+
this.searchTerm = inputs.searchTerm;
|
|
478
|
+
this.selectable = computed(() => !this.submenu());
|
|
479
|
+
}
|
|
480
|
+
open(opts) {
|
|
481
|
+
if (this.disabled()) {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
this._expanded.set(true);
|
|
485
|
+
if (opts?.first) {
|
|
486
|
+
this.submenu()?.first();
|
|
487
|
+
}
|
|
488
|
+
if (opts?.last) {
|
|
489
|
+
this.submenu()?.last();
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
close(opts = {}) {
|
|
493
|
+
this._expanded.set(false);
|
|
494
|
+
if (opts.refocus) {
|
|
495
|
+
this.inputs.parent()?.listBehavior.goto(this);
|
|
496
|
+
}
|
|
497
|
+
let menuitems = this.inputs.submenu()?.inputs.items() ?? [];
|
|
498
|
+
while (menuitems.length) {
|
|
499
|
+
const menuitem = menuitems.pop();
|
|
500
|
+
menuitem?._expanded.set(false);
|
|
501
|
+
menuitem?.inputs.parent()?.listBehavior.unfocus();
|
|
502
|
+
menuitems = menuitems.concat(menuitem?.submenu()?.inputs.items() ?? []);
|
|
503
|
+
const parent = menuitem?.inputs.parent();
|
|
504
|
+
if (parent instanceof MenuPattern) {
|
|
505
|
+
parent._clearTimeouts();
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
onFocusIn() {
|
|
510
|
+
this.hasBeenFocused.set(true);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
export { MenuBarPattern, MenuItemPattern, MenuPattern, MenuTriggerPattern };
|
|
515
|
+
//# sourceMappingURL=_menu-chunk.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_menu-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/menu/menu.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {KeyboardEventManager} from '../behaviors/event-manager';\nimport {computed, signal, SignalLike} from '../behaviors/signal-like/signal-like';\nimport {List, ListInputs, ListItem} from '../behaviors/list/list';\n\n/** The inputs for the MenuBarPattern class. */\nexport interface MenuBarInputs<V> extends ListInputs<MenuItemPattern<V>, V> {\n /** The menu items contained in the menu. */\n items: SignalLike<MenuItemPattern<V>[]>;\n\n /** Callback function triggered when a menu item is selected. */\n onSelect?: (value: V) => void;\n\n /** The text direction of the menu bar. */\n textDirection: SignalLike<'ltr' | 'rtl'>;\n}\n\n/** The inputs for the MenuPattern class. */\nexport interface MenuInputs<V> extends Omit<ListInputs<MenuItemPattern<V>, V>, 'values'> {\n /** The unique ID of the menu. */\n id: SignalLike<string>;\n\n /** The menu items contained in the menu. */\n items: SignalLike<MenuItemPattern<V>[]>;\n\n /** A reference to the parent menu or menu trigger. */\n parent: SignalLike<MenuTriggerPattern<V> | MenuItemPattern<V> | undefined>;\n\n /** Callback function triggered when a menu item is selected. */\n onSelect?: (value: V) => void;\n\n /** The text direction of the menu bar. */\n textDirection: SignalLike<'ltr' | 'rtl'>;\n\n /** The delay in milliseconds before expanding sub-menus on hover. */\n expansionDelay: SignalLike<number>;\n}\n\n/** The inputs for the MenuTriggerPattern class. */\nexport interface MenuTriggerInputs<V> {\n /** A reference to the menu trigger element. */\n element: SignalLike<HTMLElement | undefined>;\n\n /** A reference to the menu associated with the trigger. */\n menu: SignalLike<MenuPattern<V> | undefined>;\n\n /** The text direction of the menu bar. */\n textDirection: SignalLike<'ltr' | 'rtl'>;\n\n /** Whether the menu trigger is disabled. */\n disabled: SignalLike<boolean>;\n}\n\n/** The inputs for the MenuItemPattern class. */\nexport interface MenuItemInputs<V> extends Omit<ListItem<V>, 'index' | 'selectable'> {\n /** A reference to the parent menu or menu trigger. */\n parent: SignalLike<MenuPattern<V> | MenuBarPattern<V> | undefined>;\n\n /** A reference to the submenu associated with the menu item. */\n submenu: SignalLike<MenuPattern<V> | undefined>;\n}\n\n/** The menu ui pattern class. */\nexport class MenuPattern<V> {\n /** The unique ID of the menu. */\n id: SignalLike<string>;\n\n /** The role of the menu. */\n role = () => 'menu';\n\n /** Whether the menu is disabled. */\n disabled = () => this.inputs.disabled();\n\n /** Whether the menu is visible. */\n visible = computed(() => (this.inputs.parent() ? !!this.inputs.parent()?.expanded() : true));\n\n /** Controls list behavior for the menu items. */\n listBehavior: List<MenuItemPattern<V>, V>;\n\n /** Whether the menu or any of its child elements are currently focused. */\n isFocused = signal(false);\n\n /** Whether the menu has received focus. */\n hasBeenFocused = signal(false);\n\n /** Whether the menu trigger has been hovered. */\n hasBeenHovered = signal(false);\n\n /** Timeout used to open sub-menus on hover. */\n _openTimeout: any;\n\n /** Timeout used to close sub-menus on hover out. */\n _closeTimeout: any;\n\n /** The tab index of the menu. */\n tabIndex = () => this.listBehavior.tabIndex();\n\n /** Whether the menu should be focused on mouse over. */\n shouldFocus = computed(() => {\n const root = this.root();\n\n if (root instanceof MenuTriggerPattern) {\n return true;\n }\n\n if (root instanceof MenuBarPattern || root instanceof MenuPattern) {\n return root.isFocused();\n }\n\n return false;\n });\n\n /** The key used to expand sub-menus. */\n private _expandKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The key used to collapse sub-menus. */\n private _collapseKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** Represents the space key. Does nothing when the user is actively using typeahead. */\n dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));\n\n /** The regexp used to decide if a key should trigger typeahead. */\n typeaheadRegexp = /^.$/;\n\n /** The root of the menu. */\n root: SignalLike<MenuTriggerPattern<V> | MenuBarPattern<V> | MenuPattern<V> | undefined> =\n computed(() => {\n const parent = this.inputs.parent();\n\n if (!parent) {\n return this;\n }\n\n if (parent instanceof MenuTriggerPattern) {\n return parent;\n }\n\n const grandparent = parent.inputs.parent();\n\n if (grandparent instanceof MenuBarPattern) {\n return grandparent;\n }\n\n return grandparent?.root();\n });\n\n /** Handles keyboard events for the menu. */\n keydownManager = computed(() => {\n return new KeyboardEventManager()\n .on('ArrowDown', () => this.next())\n .on('ArrowUp', () => this.prev())\n .on('Home', () => this.first())\n .on('End', () => this.last())\n .on('Enter', () => this.trigger())\n .on('Escape', () => this.closeAll())\n .on(this._expandKey, () => this.expand())\n .on(this._collapseKey, () => this.collapse())\n .on(this.dynamicSpaceKey, () => this.trigger())\n .on(this.typeaheadRegexp, e => this.listBehavior.search(e.key));\n });\n\n constructor(readonly inputs: MenuInputs<V>) {\n this.id = inputs.id;\n this.listBehavior = new List<MenuItemPattern<V>, V>({\n ...inputs,\n values: signal([]),\n });\n }\n\n /** Sets the default state for the menu. */\n setDefaultState() {\n if (!this.inputs.parent()) {\n this.listBehavior.goto(this.inputs.items()[0], {focusElement: false});\n }\n }\n\n /** Handles keyboard events for the menu. */\n onKeydown(event: KeyboardEvent) {\n this.keydownManager().handle(event);\n }\n\n /** Handles mouseover events for the menu. */\n onMouseOver(event: MouseEvent) {\n if (!this.visible()) {\n return;\n }\n\n this.hasBeenHovered.set(true);\n const item = this.inputs.items().find(i => i.element()?.contains(event.target as Node));\n\n if (!item) {\n return;\n }\n\n const parent = this.inputs.parent();\n const activeItem = this?.inputs.activeItem();\n\n if (parent instanceof MenuItemPattern) {\n const grandparent = parent.inputs.parent();\n if (grandparent instanceof MenuPattern) {\n grandparent._clearTimeouts();\n grandparent.listBehavior.goto(parent, {focusElement: false});\n }\n }\n\n if (activeItem && activeItem !== item) {\n this._closeItem(activeItem);\n }\n\n if (item.expanded()) {\n this._clearCloseTimeout();\n }\n\n this._openItem(item);\n this.listBehavior.goto(item, {focusElement: this.shouldFocus()});\n }\n\n /** Closes the specified menu item after a delay. */\n private _closeItem(item: MenuItemPattern<V>) {\n this._clearOpenTimeout();\n\n if (!this._closeTimeout) {\n this._closeTimeout = setTimeout(() => {\n item.close();\n this._closeTimeout = undefined;\n }, this.inputs.expansionDelay());\n }\n }\n\n /** Opens the specified menu item after a delay. */\n private _openItem(item: MenuItemPattern<V>) {\n this._clearOpenTimeout();\n\n this._openTimeout = setTimeout(() => {\n item.open();\n this._openTimeout = undefined;\n }, this.inputs.expansionDelay());\n }\n\n /** Handles mouseout events for the menu. */\n onMouseOut(event: MouseEvent) {\n this._clearOpenTimeout();\n\n if (this.isFocused()) {\n return;\n }\n\n const root = this.root();\n const parent = this.inputs.parent();\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!root || !parent || parent instanceof MenuTriggerPattern) {\n return;\n }\n\n const grandparent = parent.inputs.parent();\n\n if (!grandparent || grandparent instanceof MenuBarPattern) {\n return;\n }\n\n if (!grandparent.inputs.element()?.contains(relatedTarget)) {\n parent.close();\n }\n }\n\n /** Handles click events for the menu. */\n onClick(event: MouseEvent) {\n const relatedTarget = event.target as Node | null;\n const item = this.inputs.items().find(i => i.element()?.contains(relatedTarget));\n\n if (item) {\n item.open();\n this.listBehavior.goto(item);\n this.submit(item);\n }\n }\n\n /** Handles focusin events for the menu. */\n onFocusIn() {\n this.isFocused.set(true);\n this.hasBeenFocused.set(true);\n }\n\n /** Handles the focusout event for the menu. */\n onFocusOut(event: FocusEvent) {\n const parent = this.inputs.parent();\n const parentEl = parent?.inputs.element();\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!relatedTarget) {\n this.isFocused.set(false);\n this.inputs.parent()?.close({refocus: true});\n }\n\n if (parent instanceof MenuItemPattern) {\n const grandparent = parent.inputs.parent();\n const siblings = grandparent?.inputs.items().filter(i => i !== parent);\n const item = siblings?.find(i => i.element()?.contains(relatedTarget));\n\n if (item) {\n return;\n }\n }\n\n if (\n this.visible() &&\n !parentEl?.contains(relatedTarget) &&\n !this.inputs.element()?.contains(relatedTarget)\n ) {\n this.isFocused.set(false);\n this.inputs.parent()?.close();\n }\n }\n\n /** Focuses the previous menu item. */\n prev() {\n this.inputs.activeItem()?.close();\n this.listBehavior.prev();\n }\n\n /** Focuses the next menu item. */\n next() {\n this.inputs.activeItem()?.close();\n this.listBehavior.next();\n }\n\n /** Focuses the first menu item. */\n first() {\n this.inputs.activeItem()?.close();\n this.listBehavior.first();\n }\n\n /** Focuses the last menu item. */\n last() {\n this.inputs.activeItem()?.close();\n this.listBehavior.last();\n }\n\n /** Triggers the active menu item. */\n trigger() {\n this.inputs.activeItem()?.hasPopup()\n ? this.inputs.activeItem()?.open({first: true})\n : this.submit();\n }\n\n /** Submits the menu. */\n submit(item = this.inputs.activeItem()) {\n const root = this.root();\n\n if (item && !item.disabled()) {\n const isMenu = root instanceof MenuPattern;\n const isMenuBar = root instanceof MenuBarPattern;\n const isMenuTrigger = root instanceof MenuTriggerPattern;\n\n if (!item.submenu() && isMenuTrigger) {\n root.close({refocus: true});\n }\n\n if (!item.submenu() && isMenuBar) {\n root.close();\n root?.inputs.onSelect?.(item.value());\n }\n\n if (!item.submenu() && isMenu) {\n root.inputs.activeItem()?.close({refocus: true});\n root?.inputs.onSelect?.(item.value());\n }\n }\n }\n\n /** Collapses the current menu or focuses the previous item in the menubar. */\n collapse() {\n const root = this.root();\n const parent = this.inputs.parent();\n\n if (parent instanceof MenuItemPattern && !(parent.inputs.parent() instanceof MenuBarPattern)) {\n parent.close({refocus: true});\n } else if (root instanceof MenuBarPattern) {\n root.prev();\n }\n }\n\n /** Expands the current menu or focuses the next item in the menubar. */\n expand() {\n const root = this.root();\n const activeItem = this.inputs.activeItem();\n\n if (activeItem?.submenu()) {\n activeItem.open({first: true});\n } else if (root instanceof MenuBarPattern) {\n root.next();\n }\n }\n\n /** Closes the menu. */\n close() {\n this.inputs.parent()?.close();\n }\n\n /** Closes the menu and all parent menus. */\n closeAll() {\n const root = this.root();\n\n if (root instanceof MenuTriggerPattern) {\n root.close({refocus: true});\n }\n\n if (root instanceof MenuBarPattern) {\n root.close();\n }\n\n if (root instanceof MenuPattern) {\n root.inputs.activeItem()?.close({refocus: true});\n }\n }\n\n /** Clears any open or close timeouts for sub-menus. */\n _clearTimeouts() {\n this._clearOpenTimeout();\n this._clearCloseTimeout();\n }\n\n /** Clears the open timeout. */\n _clearOpenTimeout() {\n if (this._openTimeout) {\n clearTimeout(this._openTimeout);\n this._openTimeout = undefined;\n }\n }\n\n /** Clears the close timeout. */\n _clearCloseTimeout() {\n if (this._closeTimeout) {\n clearTimeout(this._closeTimeout);\n this._closeTimeout = undefined;\n }\n }\n}\n\n/** The menubar ui pattern class. */\nexport class MenuBarPattern<V> {\n /** Controls list behavior for the menu items. */\n listBehavior: List<MenuItemPattern<V>, V>;\n\n /** The tab index of the menu. */\n tabIndex = () => this.listBehavior.tabIndex();\n\n /** The key used to navigate to the next item. */\n private _nextKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The key used to navigate to the previous item. */\n private _previousKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** Represents the space key. Does nothing when the user is actively using typeahead. */\n dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));\n\n /** The regexp used to decide if a key should trigger typeahead. */\n typeaheadRegexp = /^.$/;\n\n /** Whether the menubar or any of its children are currently focused. */\n isFocused = signal(false);\n\n /** Whether the menubar has been focused. */\n hasBeenFocused = signal(false);\n\n /** Whether the menubar is disabled. */\n disabled = () => this.inputs.disabled();\n\n /** Handles keyboard events for the menu. */\n keydownManager = computed(() => {\n return new KeyboardEventManager()\n .on(this._nextKey, () => this.next())\n .on(this._previousKey, () => this.prev())\n .on('End', () => this.listBehavior.last())\n .on('Home', () => this.listBehavior.first())\n .on('Enter', () => this.inputs.activeItem()?.open({first: true}))\n .on('ArrowUp', () => this.inputs.activeItem()?.open({last: true}))\n .on('ArrowDown', () => this.inputs.activeItem()?.open({first: true}))\n .on(this.dynamicSpaceKey, () => this.inputs.activeItem()?.open({first: true}))\n .on(this.typeaheadRegexp, e => this.listBehavior.search(e.key));\n });\n\n constructor(readonly inputs: MenuBarInputs<V>) {\n this.listBehavior = new List<MenuItemPattern<V>, V>(inputs);\n }\n\n /** Sets the default state for the menubar. */\n setDefaultState() {\n this.inputs.activeItem.set(this.inputs.items()[0]);\n }\n\n /** Handles keyboard events for the menu. */\n onKeydown(event: KeyboardEvent) {\n this.keydownManager().handle(event);\n }\n\n /** Handles click events for the menu bar. */\n onClick(event: MouseEvent) {\n const item = this.inputs.items().find(i => i.element()?.contains(event.target as Node));\n\n if (!item) {\n return;\n }\n\n this.goto(item);\n item.expanded() ? item.close() : item.open();\n }\n\n /** Handles mouseover events for the menu bar. */\n onMouseOver(event: MouseEvent) {\n const item = this.inputs.items().find(i => i.element()?.contains(event.target as Node));\n\n if (item) {\n this.goto(item, {focusElement: this.isFocused()});\n }\n }\n\n /** Handles focusin events for the menu bar. */\n onFocusIn() {\n this.isFocused.set(true);\n this.hasBeenFocused.set(true);\n }\n\n /** Handles focusout events for the menu bar. */\n onFocusOut(event: FocusEvent) {\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!this.inputs.element()?.contains(relatedTarget)) {\n this.isFocused.set(false);\n this.close();\n }\n }\n\n /** Goes to and optionally focuses the specified menu item. */\n goto(item: MenuItemPattern<V>, opts?: {focusElement?: boolean}) {\n const prevItem = this.inputs.activeItem();\n this.listBehavior.goto(item, opts);\n\n if (prevItem?.expanded()) {\n prevItem?.close();\n this.inputs.activeItem()?.open();\n }\n\n if (item === prevItem) {\n if (item.expanded() && item.submenu()?.inputs.activeItem()) {\n item.submenu()?.inputs.activeItem()?.close();\n item.submenu()?.listBehavior.unfocus();\n }\n }\n }\n\n /** Focuses the next menu item. */\n next() {\n const prevItem = this.inputs.activeItem();\n this.listBehavior.next();\n\n if (prevItem?.expanded()) {\n prevItem?.close();\n this.inputs.activeItem()?.open({first: true});\n }\n }\n\n /** Focuses the previous menu item. */\n prev() {\n const prevItem = this.inputs.activeItem();\n this.listBehavior.prev();\n\n if (prevItem?.expanded()) {\n prevItem?.close();\n this.inputs.activeItem()?.open({first: true});\n }\n }\n\n /** Closes the menubar and refocuses the root menu bar item. */\n close() {\n this.inputs.activeItem()?.close({refocus: this.isFocused()});\n }\n}\n\n/** The menu trigger ui pattern class. */\nexport class MenuTriggerPattern<V> {\n /** Whether the menu is expanded. */\n expanded = signal(false);\n\n /** Whether the menu trigger has received focus. */\n hasBeenFocused = signal(false);\n\n /** The role of the menu trigger. */\n role = () => 'button';\n\n /** Whether the menu trigger has a popup. */\n hasPopup = () => true;\n\n /** The menu associated with the trigger. */\n menu: SignalLike<MenuPattern<V> | undefined>;\n\n /** The tab index of the menu trigger. */\n tabIndex = computed(() => (this.expanded() && this.menu()?.inputs.activeItem() ? -1 : 0));\n\n /** Whether the menu trigger is disabled. */\n disabled = () => this.inputs.disabled();\n\n /** Handles keyboard events for the menu trigger. */\n keydownManager = computed(() => {\n return new KeyboardEventManager()\n .on(' ', () => this.open({first: true}))\n .on('Enter', () => this.open({first: true}))\n .on('ArrowDown', () => this.open({first: true}))\n .on('ArrowUp', () => this.open({last: true}))\n .on('Escape', () => this.close({refocus: true}));\n });\n\n constructor(readonly inputs: MenuTriggerInputs<V>) {\n this.menu = this.inputs.menu;\n }\n\n /** Handles keyboard events for the menu trigger. */\n onKeydown(event: KeyboardEvent) {\n if (!this.inputs.disabled()) {\n this.keydownManager().handle(event);\n }\n }\n\n /** Handles click events for the menu trigger. */\n onClick() {\n if (!this.inputs.disabled()) {\n this.expanded() ? this.close() : this.open({first: true});\n }\n }\n\n /** Handles focusin events for the menu trigger. */\n onFocusIn() {\n this.hasBeenFocused.set(true);\n }\n\n /** Handles focusout events for the menu trigger. */\n onFocusOut(event: FocusEvent) {\n const element = this.inputs.element();\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (\n this.expanded() &&\n !element?.contains(relatedTarget) &&\n !this.inputs.menu()?.inputs.element()?.contains(relatedTarget)\n ) {\n this.close();\n }\n }\n\n /** Opens the menu. */\n open(opts?: {first?: boolean; last?: boolean}) {\n this.expanded.set(true);\n\n if (opts?.first) {\n this.inputs.menu()?.first();\n } else if (opts?.last) {\n this.inputs.menu()?.last();\n }\n }\n\n /** Closes the menu. */\n close(opts: {refocus?: boolean} = {}) {\n this.expanded.set(false);\n this.menu()?.listBehavior.unfocus();\n\n if (opts.refocus) {\n this.inputs.element()?.focus();\n }\n\n let menuitems = this.inputs.menu()?.inputs.items() ?? [];\n\n while (menuitems.length) {\n const menuitem = menuitems.pop();\n menuitem?._expanded.set(false);\n menuitem?.inputs.parent()?.listBehavior.unfocus();\n menuitems = menuitems.concat(menuitem?.submenu()?.inputs.items() ?? []);\n }\n }\n}\n\n/** The menu item ui pattern class. */\nexport class MenuItemPattern<V> implements ListItem<V> {\n /** The value of the menu item. */\n value: SignalLike<V>;\n\n /** The unique ID of the menu item. */\n id: SignalLike<string>;\n\n /** Whether the menu item is disabled. */\n disabled = () => this.inputs.parent()?.disabled() || this.inputs.disabled();\n\n /** The search term for the menu item. */\n searchTerm: SignalLike<string>;\n\n /** The element of the menu item. */\n element: SignalLike<HTMLElement | undefined>;\n\n /** Whether the menu item is active. */\n active = computed(() => this.inputs.parent()?.inputs.activeItem() === this);\n\n /** Whether the menu item has received focus. */\n hasBeenFocused = signal(false);\n\n /** The tab index of the menu item. */\n tabIndex = computed(() => {\n if (this.submenu() && this.submenu()?.inputs.activeItem()) {\n return -1;\n }\n return this.inputs.parent()?.listBehavior.getItemTabindex(this) ?? -1;\n });\n\n /** The position of the menu item in the menu. */\n index = computed(() => this.inputs.parent()?.inputs.items().indexOf(this) ?? -1);\n\n /** Whether the menu item is expanded. */\n expanded = computed(() => (this.submenu() ? this._expanded() : null));\n\n /** Whether the menu item is expanded. */\n _expanded = signal(false);\n\n /** The ID of the menu that the menu item controls. */\n controls = signal<string | undefined>(undefined);\n\n /** The role of the menu item. */\n role = () => 'menuitem';\n\n /** Whether the menu item has a popup. */\n hasPopup = computed(() => !!this.submenu());\n\n /** The submenu associated with the menu item. */\n submenu: SignalLike<MenuPattern<V> | undefined>;\n\n /** Whether the menu item is selectable. */\n selectable: SignalLike<boolean>;\n\n constructor(readonly inputs: MenuItemInputs<V>) {\n this.id = inputs.id;\n this.value = inputs.value;\n this.element = inputs.element;\n this.submenu = this.inputs.submenu;\n this.searchTerm = inputs.searchTerm;\n this.selectable = computed(() => !this.submenu());\n }\n\n /** Opens the submenu. */\n open(opts?: {first?: boolean; last?: boolean}) {\n if (this.disabled()) {\n return;\n }\n\n this._expanded.set(true);\n\n if (opts?.first) {\n this.submenu()?.first();\n }\n if (opts?.last) {\n this.submenu()?.last();\n }\n }\n\n /** Closes the submenu. */\n close(opts: {refocus?: boolean} = {}) {\n this._expanded.set(false);\n\n if (opts.refocus) {\n this.inputs.parent()?.listBehavior.goto(this);\n }\n\n let menuitems = this.inputs.submenu()?.inputs.items() ?? [];\n\n while (menuitems.length) {\n const menuitem = menuitems.pop();\n menuitem?._expanded.set(false);\n menuitem?.inputs.parent()?.listBehavior.unfocus();\n menuitems = menuitems.concat(menuitem?.submenu()?.inputs.items() ?? []);\n\n const parent = menuitem?.inputs.parent();\n\n if (parent instanceof MenuPattern) {\n parent._clearTimeouts();\n }\n }\n }\n\n /** Handles focusin events for the menu item. */\n onFocusIn() {\n this.hasBeenFocused.set(true);\n }\n}\n"],"names":["MenuPattern","inputs","id","role","disabled","visible","computed","parent","expanded","listBehavior","isFocused","signal","hasBeenFocused","hasBeenHovered","_openTimeout","_closeTimeout","tabIndex","shouldFocus","root","MenuTriggerPattern","MenuBarPattern","_expandKey","textDirection","_collapseKey","dynamicSpaceKey","isTyping","typeaheadRegexp","grandparent","keydownManager","KeyboardEventManager","on","next","prev","first","last","trigger","closeAll","expand","collapse","e","search","key","constructor","List","values","setDefaultState","goto","items","focusElement","onKeydown","event","handle","onMouseOver","set","item","find","i","element","contains","target","activeItem","MenuItemPattern","_clearTimeouts","_closeItem","_clearCloseTimeout","_openItem","_clearOpenTimeout","setTimeout","close","undefined","expansionDelay","open","onMouseOut","relatedTarget","onClick","submit","onFocusIn","onFocusOut","parentEl","refocus","siblings","filter","hasPopup","isMenu","isMenuBar","isMenuTrigger","submenu","onSelect","value","clearTimeout","_nextKey","_previousKey","opts","prevItem","unfocus","menu","focus","menuitems","length","menuitem","pop","_expanded","concat","searchTerm","active","getItemTabindex","index","indexOf","controls","selectable"],"mappings":";;;MAsEaA,WAAW,CAAA;EAsGDC,MAAA;EApGrBC,EAAE;EAGFC,IAAI,GAAGA,MAAM,MAAM;EAGnBC,QAAQ,GAAGA,MAAM,IAAI,CAACH,MAAM,CAACG,QAAQ,EAAE;EAGvCC,OAAO,GAAGC,QAAQ,CAAC,MAAO,IAAI,CAACL,MAAM,CAACM,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,CAACN,MAAM,CAACM,MAAM,EAAE,EAAEC,QAAQ,EAAE,GAAG,IAAK,CA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