@angular/aria 22.2.0-next.2 → 22.2.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/fesm2022/_deferred-content-chunk.mjs +6 -6
- package/fesm2022/_menu-chunk.mjs +6 -4
- package/fesm2022/_menu-chunk.mjs.map +1 -1
- package/fesm2022/_toolbar-widget-group-chunk.mjs +34 -53
- package/fesm2022/_toolbar-widget-group-chunk.mjs.map +1 -1
- package/fesm2022/accordion.mjs +12 -12
- package/fesm2022/aria.mjs +1 -1
- package/fesm2022/aria.mjs.map +1 -1
- package/fesm2022/combobox.mjs +11 -10
- package/fesm2022/combobox.mjs.map +1 -1
- package/fesm2022/grid.mjs +12 -12
- package/fesm2022/listbox.mjs +6 -6
- package/fesm2022/menu.mjs +18 -18
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/private.mjs +6 -1
- package/fesm2022/private.mjs.map +1 -1
- package/fesm2022/tabs.mjs +15 -15
- package/fesm2022/toolbar.mjs +11 -86
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tree.mjs +9 -9
- package/package.json +2 -2
- package/types/_accordion-chunk.d.ts +2 -2
- package/types/_collection-chunk.d.ts +1 -1
- package/types/_grid-chunk.d.ts +4 -4
- package/types/_list-chunk.d.ts +2 -2
- package/types/_listbox-chunk.d.ts +3 -3
- package/types/_menu-chunk.d.ts +19 -15
- package/types/_tabs-chunk.d.ts +4 -4
- package/types/_toolbar-chunk.d.ts +54 -50
- package/types/_tree-chunk.d.ts +7 -7
- package/types/combobox.d.ts +1 -1
- package/types/grid.d.ts +6 -6
- package/types/listbox.d.ts +3 -3
- package/types/menu.d.ts +7 -7
- package/types/private.d.ts +9 -3
- package/types/tabs.d.ts +3 -3
- package/types/toolbar.d.ts +27 -36
- package/types/tree.d.ts +5 -5
|
@@ -10,7 +10,7 @@ class DeferredContentAware {
|
|
|
10
10
|
}] : []));
|
|
11
11
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
12
12
|
minVersion: "12.0.0",
|
|
13
|
-
version: "22.2.0-next.
|
|
13
|
+
version: "22.2.0-next.4",
|
|
14
14
|
ngImport: i0,
|
|
15
15
|
type: DeferredContentAware,
|
|
16
16
|
deps: [],
|
|
@@ -18,7 +18,7 @@ class DeferredContentAware {
|
|
|
18
18
|
});
|
|
19
19
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
20
20
|
minVersion: "17.1.0",
|
|
21
|
-
version: "22.2.0-next.
|
|
21
|
+
version: "22.2.0-next.4",
|
|
22
22
|
type: DeferredContentAware,
|
|
23
23
|
isStandalone: true,
|
|
24
24
|
inputs: {
|
|
@@ -38,7 +38,7 @@ class DeferredContentAware {
|
|
|
38
38
|
}
|
|
39
39
|
i0.ɵɵngDeclareClassMetadata({
|
|
40
40
|
minVersion: "12.0.0",
|
|
41
|
-
version: "22.2.0-next.
|
|
41
|
+
version: "22.2.0-next.4",
|
|
42
42
|
ngImport: i0,
|
|
43
43
|
type: DeferredContentAware,
|
|
44
44
|
decorators: [{
|
|
@@ -97,7 +97,7 @@ class DeferredContent {
|
|
|
97
97
|
}
|
|
98
98
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
99
99
|
minVersion: "12.0.0",
|
|
100
|
-
version: "22.2.0-next.
|
|
100
|
+
version: "22.2.0-next.4",
|
|
101
101
|
ngImport: i0,
|
|
102
102
|
type: DeferredContent,
|
|
103
103
|
deps: [],
|
|
@@ -105,7 +105,7 @@ class DeferredContent {
|
|
|
105
105
|
});
|
|
106
106
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
107
107
|
minVersion: "14.0.0",
|
|
108
|
-
version: "22.2.0-next.
|
|
108
|
+
version: "22.2.0-next.4",
|
|
109
109
|
type: DeferredContent,
|
|
110
110
|
isStandalone: true,
|
|
111
111
|
ngImport: i0
|
|
@@ -113,7 +113,7 @@ class DeferredContent {
|
|
|
113
113
|
}
|
|
114
114
|
i0.ɵɵngDeclareClassMetadata({
|
|
115
115
|
minVersion: "12.0.0",
|
|
116
|
-
version: "22.2.0-next.
|
|
116
|
+
version: "22.2.0-next.4",
|
|
117
117
|
ngImport: i0,
|
|
118
118
|
type: DeferredContent,
|
|
119
119
|
decorators: [{
|
package/fesm2022/_menu-chunk.mjs
CHANGED
|
@@ -12,6 +12,7 @@ class MenuPattern {
|
|
|
12
12
|
isFocused = signal(false);
|
|
13
13
|
hasBeenInteracted = signal(false);
|
|
14
14
|
hasBeenHovered = signal(false);
|
|
15
|
+
items = () => this.inputs.items();
|
|
15
16
|
_openTimeout;
|
|
16
17
|
_closeTimeout;
|
|
17
18
|
tabIndex = () => this.listBehavior.tabIndex();
|
|
@@ -64,7 +65,7 @@ class MenuPattern {
|
|
|
64
65
|
}
|
|
65
66
|
validate() {
|
|
66
67
|
const violations = [];
|
|
67
|
-
const values = this.inputs.items().map(i => i.value());
|
|
68
|
+
const values = this.inputs.items().map(i => i.value()).filter(val => val !== undefined);
|
|
68
69
|
const duplicates = values.filter((val, idx) => values.indexOf(val) !== idx);
|
|
69
70
|
if (duplicates.length > 0) {
|
|
70
71
|
violations.push(`Duplicate value '${duplicates[0]}' detected inside ngMenu.`);
|
|
@@ -101,7 +102,7 @@ class MenuPattern {
|
|
|
101
102
|
return;
|
|
102
103
|
}
|
|
103
104
|
const parent = this.inputs.parent();
|
|
104
|
-
const activeItem = this
|
|
105
|
+
const activeItem = this.inputs.activeItem();
|
|
105
106
|
if (parent instanceof MenuItemPattern) {
|
|
106
107
|
const grandparent = parent.inputs.parent();
|
|
107
108
|
if (grandparent instanceof MenuPattern) {
|
|
@@ -439,7 +440,8 @@ class MenuTriggerPattern {
|
|
|
439
440
|
pendingFocusEffect() {
|
|
440
441
|
const menu = this.inputs.menu();
|
|
441
442
|
const intent = this.pendingFocus();
|
|
442
|
-
|
|
443
|
+
const items = menu?.items();
|
|
444
|
+
if (menu && intent && items?.length) {
|
|
443
445
|
if (intent === 'first') {
|
|
444
446
|
menu.first();
|
|
445
447
|
} else if (intent === 'last') {
|
|
@@ -521,7 +523,7 @@ class MenuItemPattern {
|
|
|
521
523
|
constructor(inputs) {
|
|
522
524
|
this.inputs = inputs;
|
|
523
525
|
this.id = inputs.id;
|
|
524
|
-
this.value = inputs.value;
|
|
526
|
+
this.value = inputs.value ?? signal(undefined);
|
|
525
527
|
this.element = inputs.element;
|
|
526
528
|
this.submenu = this.inputs.submenu;
|
|
527
529
|
this.searchTerm = inputs.searchTerm;
|
|
@@ -1 +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 {_getEventTarget} from '@angular/cdk/platform';\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 itemSelected?: (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>, 'value'> {\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 itemSelected?: (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 /** The role of the menu item. */\n role: SignalLike<'menuitem' | 'menuitemradio' | 'menuitemcheckbox'>;\n}\n\n/** The menu ui pattern class. */\nexport class MenuPattern<V> {\n /** The unique ID of the menu. */\n readonly id: SignalLike<string>;\n\n /** The role of the menu. */\n readonly role = () => 'menu';\n\n /** Whether the menu is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** Whether the menu is visible. */\n readonly visible = computed(() =>\n this.inputs.parent() ? !!this.inputs.parent()?.expanded() : true,\n );\n\n /** Controls list behavior for the menu items. */\n readonly listBehavior: List<MenuItemPattern<V>, V>;\n\n /** Whether the menu or any of its child elements are currently focused. */\n readonly isFocused = signal(false);\n\n /** Whether the menu has received interaction. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the menu trigger has been hovered. */\n readonly 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 readonly tabIndex = () => this.listBehavior.tabIndex();\n\n /** Whether the menu should be focused on mouse over. */\n readonly 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 readonly _expandKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The key used to collapse sub-menus. */\n private readonly _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 readonly dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));\n\n /** The regexp used to decide if a key should trigger typeahead. */\n readonly typeaheadRegexp = /^.$/;\n\n /** The root of the menu. */\n readonly root: SignalLike<\n 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 readonly keydownManager = computed(() => {\n return new KeyboardEventManager()\n .on('ArrowDown', () => this.next(), {ignoreRepeat: false})\n .on('ArrowUp', () => this.prev(), {ignoreRepeat: false})\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 value: signal([]),\n });\n }\n\n /** Returns a set of violations */\n validate(): string[] {\n const violations: string[] = [];\n\n const values = this.inputs.items().map(i => i.value());\n const duplicates = values.filter((val, idx) => values.indexOf(val) !== idx);\n if (duplicates.length > 0) {\n violations.push(`Duplicate value '${duplicates[0]}' detected inside ngMenu.`);\n }\n\n return violations;\n }\n\n /** Sets the default state for the menu. */\n setDefaultState() {\n if (!this.inputs.parent()) {\n const firstFocusable = this.listBehavior.navigationBehavior.peekFirst();\n if (firstFocusable) {\n this.listBehavior.goto(firstFocusable, {focusElement: false});\n }\n }\n }\n\n /** Sets the default active state of the menu before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted() || this.hasBeenHovered()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\n }\n\n /** Handles keyboard events for the menu. */\n onKeydown(event: KeyboardEvent) {\n this.hasBeenInteracted.set(true);\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(_getEventTarget(event)));\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 = _getEventTarget<Node>(event);\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.hasBeenInteracted.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 if (!item || item.disabled() || item.submenu()) {\n return;\n }\n\n const root = this.root();\n\n if (root instanceof MenuTriggerPattern) {\n root.close({refocus: true});\n root?.inputs.menu()?.inputs.itemSelected?.(item.value());\n } else if (root instanceof MenuBarPattern) {\n root.close();\n root?.inputs.itemSelected?.(item.value());\n } else if (root instanceof MenuPattern) {\n root.inputs.activeItem()?.close({refocus: true});\n root?.inputs.itemSelected?.(item.value());\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 readonly listBehavior: List<MenuItemPattern<V>, V>;\n\n /** The tab index of the menu. */\n readonly tabIndex = () => this.listBehavior.tabIndex();\n\n /** The key used to navigate to the next item. */\n private readonly _nextKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The key used to navigate to the previous item. */\n private readonly _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 readonly dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));\n\n /** The regexp used to decide if a key should trigger typeahead. */\n readonly typeaheadRegexp = /^.$/;\n\n /** Whether the menubar or any of its children are currently focused. */\n readonly isFocused = signal(false);\n\n /** Whether the menubar has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the menubar is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** Handles keyboard events for the menu. */\n readonly keydownManager = computed(() => {\n return new KeyboardEventManager()\n .on(this._nextKey, () => this.next(), {ignoreRepeat: false})\n .on(this._previousKey, () => this.prev(), {ignoreRepeat: false})\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 const firstFocusable = this.listBehavior.navigationBehavior.peekFirst();\n if (firstFocusable) {\n this.inputs.activeItem.set(firstFocusable);\n }\n }\n\n /** Sets the default active state of the menubar before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\n }\n\n /** Handles keyboard events for the menu. */\n onKeydown(event: KeyboardEvent) {\n this.hasBeenInteracted.set(true);\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(_getEventTarget(event)));\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(_getEventTarget(event)));\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.hasBeenInteracted.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 trigger is expanded. */\n readonly expanded = signal(false);\n\n /** Whether the menu trigger has received interaction. */\n readonly hasBeenInteracted = signal(false);\n\n /** The pending focus target when the menu is opened before the menu instance is available. */\n readonly pendingFocus = signal<'first' | 'last' | undefined>(undefined);\n\n /** The role of the menu trigger. */\n readonly role = () => 'button';\n\n /** Whether the menu trigger has a popup. */\n readonly hasPopup = () => true;\n\n /** The menu associated with the trigger. */\n readonly menu: SignalLike<MenuPattern<V> | undefined>;\n\n /** The tab index of the menu trigger. */\n readonly tabIndex = computed(() =>\n this.expanded() && this.menu()?.inputs.activeItem() ? -1 : 0,\n );\n\n /** Whether the menu trigger is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** Handles keyboard events for the menu trigger. */\n readonly 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 /** Flushes any pending focus when the menu instance becomes available. */\n pendingFocusEffect(): void {\n const menu = this.inputs.menu();\n const intent = this.pendingFocus();\n if (menu && intent) {\n if (intent === 'first') {\n menu.first();\n } else if (intent === 'last') {\n menu.last();\n }\n this.pendingFocus.set(undefined);\n }\n }\n\n /** Handles keyboard events for the menu trigger. */\n onKeydown(event: KeyboardEvent) {\n if (!this.inputs.disabled()) {\n this.hasBeenInteracted.set(true);\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.hasBeenInteracted.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.pendingFocus.set('first');\n } else if (opts?.last) {\n this.pendingFocus.set('last');\n }\n }\n\n /** Closes the menu. */\n close(opts: {refocus?: boolean} = {}) {\n this.expanded.set(false);\n this.pendingFocus.set(undefined);\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 readonly value: SignalLike<V>;\n\n /** The unique ID of the menu item. */\n readonly id: SignalLike<string>;\n\n /** Whether the menu item is disabled. */\n readonly disabled = () => this.inputs.parent()?.disabled() || this.inputs.disabled();\n\n /** The search term for the menu item. */\n readonly searchTerm: SignalLike<string>;\n\n /** The element of the menu item. */\n readonly element: SignalLike<HTMLElement | undefined>;\n\n /** Whether the menu item is active. */\n readonly active = computed(() => this.inputs.parent()?.inputs.activeItem() === this);\n\n /** Whether the menu item has received interaction. */\n readonly hasBeenInteracted = signal(false);\n\n /** The tab index of the menu item. */\n readonly 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 readonly index = computed(() => this.inputs.parent()?.inputs.items().indexOf(this) ?? -1);\n\n /** Whether the menu item is expanded. */\n readonly expanded = computed(() => (this.submenu() ? this._expanded() : null));\n\n /** Whether the menu item is expanded. */\n readonly _expanded = signal(false);\n\n /** The ID of the menu that the menu item controls. */\n readonly controls = signal<string | undefined>(undefined);\n\n /** The role of the menu item. */\n readonly role = () => this.inputs.role();\n\n /** Whether the menu item has a popup. */\n readonly hasPopup = computed(() => !!this.submenu());\n\n /** The submenu associated with the menu item. */\n readonly submenu: SignalLike<MenuPattern<V> | undefined>;\n\n /** Whether the menu item is selectable. */\n readonly 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._clearTim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C,MAAM,CAAC,MAAM,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;AAC/C,IAAA;AAEA,IAAA,IAAI,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE;IAE3D,OAAO,SAAS,CAAC,MAAM,EAAE;AACvB,MAAA,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,EAAE;AAChC,MAAA,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;MAC9B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,YAAY,CAAC,OAAO,EAAE;AACjD,MAAA,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;MAEvE,MAAM,MAAM,GAAG,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;MAExC,IAAI,MAAM,YAAY,WAAW,EAAE;QACjC,MAAM,CAAC,cAAc,EAAE;AACzB,MAAA;AACF,IAAA;AACF,EAAA;AAGA,EAAA,SAAS,GAAA;AACP,IAAA,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC;AAClC,EAAA;AACD;;;;"}
|
|
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 {_getEventTarget} from '@angular/cdk/platform';\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 | undefined> {\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 itemSelected?: (value: V | undefined) => 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<\n ListInputs<MenuItemPattern<V>, V | undefined>,\n 'value'\n> {\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 itemSelected?: (value: V | undefined) => 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' | 'value'> {\n /** The value of the menu item. */\n value?: SignalLike<V | undefined>;\n\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 /** The role of the menu item. */\n role: SignalLike<'menuitem' | 'menuitemradio' | 'menuitemcheckbox'>;\n}\n\n/** The menu ui pattern class. */\nexport class MenuPattern<V> {\n /** The unique ID of the menu. */\n readonly id: SignalLike<string>;\n\n /** The role of the menu. */\n readonly role = () => 'menu';\n\n /** Whether the menu is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** Whether the menu is visible. */\n readonly visible = computed(() =>\n this.inputs.parent() ? !!this.inputs.parent()?.expanded() : true,\n );\n\n /** Controls list behavior for the menu items. */\n readonly listBehavior: List<MenuItemPattern<V>, V | undefined>;\n\n /** Whether the menu or any of its child elements are currently focused. */\n readonly isFocused = signal(false);\n\n /** Whether the menu has received interaction. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the menu trigger has been hovered. */\n readonly hasBeenHovered = signal(false);\n\n /** Items currently inside the menu. */\n readonly items = () => this.inputs.items();\n\n /** Timeout used to open sub-menus on hover. */\n private _openTimeout: ReturnType<typeof setTimeout> | undefined;\n\n /** Timeout used to close sub-menus on hover out. */\n private _closeTimeout: ReturnType<typeof setTimeout> | undefined;\n\n /** The tab index of the menu. */\n readonly tabIndex = () => this.listBehavior.tabIndex();\n\n /** Whether the menu should be focused on mouse over. */\n readonly 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 readonly _expandKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The key used to collapse sub-menus. */\n private readonly _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 readonly dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));\n\n /** The regexp used to decide if a key should trigger typeahead. */\n readonly typeaheadRegexp = /^.$/;\n\n /** The root of the menu. */\n readonly root: SignalLike<\n 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 readonly keydownManager = computed(() => {\n return new KeyboardEventManager()\n .on('ArrowDown', () => this.next(), {ignoreRepeat: false})\n .on('ArrowUp', () => this.prev(), {ignoreRepeat: false})\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 | undefined>({\n ...inputs,\n value: signal([]),\n });\n }\n\n /** Returns a set of violations */\n validate(): string[] {\n const violations: string[] = [];\n\n const values = this.inputs\n .items()\n .map(i => i.value())\n .filter((val): val is V => val !== undefined);\n const duplicates = values.filter((val, idx) => values.indexOf(val) !== idx);\n if (duplicates.length > 0) {\n violations.push(`Duplicate value '${duplicates[0]}' detected inside ngMenu.`);\n }\n\n return violations;\n }\n\n /** Sets the default state for the menu. */\n setDefaultState() {\n if (!this.inputs.parent()) {\n const firstFocusable = this.listBehavior.navigationBehavior.peekFirst();\n if (firstFocusable) {\n this.listBehavior.goto(firstFocusable, {focusElement: false});\n }\n }\n }\n\n /** Sets the default active state of the menu before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted() || this.hasBeenHovered()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\n }\n\n /** Handles keyboard events for the menu. */\n onKeydown(event: KeyboardEvent) {\n this.hasBeenInteracted.set(true);\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(_getEventTarget(event)));\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 = _getEventTarget<Node>(event);\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.hasBeenInteracted.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 if (!item || item.disabled() || item.submenu()) {\n return;\n }\n\n const root = this.root();\n\n if (root instanceof MenuTriggerPattern) {\n root.close({refocus: true});\n root?.inputs.menu()?.inputs.itemSelected?.(item.value());\n } else if (root instanceof MenuBarPattern) {\n root.close();\n root?.inputs.itemSelected?.(item.value());\n } else if (root instanceof MenuPattern) {\n root.inputs.activeItem()?.close({refocus: true});\n root?.inputs.itemSelected?.(item.value());\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 readonly listBehavior: List<MenuItemPattern<V>, V | undefined>;\n\n /** The tab index of the menu. */\n readonly tabIndex = () => this.listBehavior.tabIndex();\n\n /** The key used to navigate to the next item. */\n private readonly _nextKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The key used to navigate to the previous item. */\n private readonly _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 readonly dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));\n\n /** The regexp used to decide if a key should trigger typeahead. */\n readonly typeaheadRegexp = /^.$/;\n\n /** Whether the menubar or any of its children are currently focused. */\n readonly isFocused = signal(false);\n\n /** Whether the menubar has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the menubar is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** Handles keyboard events for the menu. */\n readonly keydownManager = computed(() => {\n return new KeyboardEventManager()\n .on(this._nextKey, () => this.next(), {ignoreRepeat: false})\n .on(this._previousKey, () => this.prev(), {ignoreRepeat: false})\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 | undefined>(inputs);\n }\n\n /** Sets the default state for the menubar. */\n setDefaultState() {\n const firstFocusable = this.listBehavior.navigationBehavior.peekFirst();\n if (firstFocusable) {\n this.inputs.activeItem.set(firstFocusable);\n }\n }\n\n /** Sets the default active state of the menubar before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\n }\n\n /** Handles keyboard events for the menu. */\n onKeydown(event: KeyboardEvent) {\n this.hasBeenInteracted.set(true);\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(_getEventTarget(event)));\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(_getEventTarget(event)));\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.hasBeenInteracted.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 trigger is expanded. */\n readonly expanded = signal(false);\n\n /** Whether the menu trigger has received interaction. */\n readonly hasBeenInteracted = signal(false);\n\n /** The pending focus target when the menu is opened before the menu instance is available. */\n readonly pendingFocus = signal<'first' | 'last' | undefined>(undefined);\n\n /** The role of the menu trigger. */\n readonly role = () => 'button';\n\n /** Whether the menu trigger has a popup. */\n readonly hasPopup = () => true;\n\n /** The menu associated with the trigger. */\n readonly menu: SignalLike<MenuPattern<V> | undefined>;\n\n /** The tab index of the menu trigger. */\n readonly tabIndex = computed(() =>\n this.expanded() && this.menu()?.inputs.activeItem() ? -1 : 0,\n );\n\n /** Whether the menu trigger is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** Handles keyboard events for the menu trigger. */\n readonly 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 /** Flushes any pending focus when the menu instance becomes available. */\n pendingFocusEffect(): void {\n const menu = this.inputs.menu();\n const intent = this.pendingFocus();\n const items = menu?.items();\n\n // We check the items so that we don't try calling into\n // `first/last` until the items are actually available.\n if (menu && intent && items?.length) {\n if (intent === 'first') {\n menu.first();\n } else if (intent === 'last') {\n menu.last();\n }\n this.pendingFocus.set(undefined);\n }\n }\n\n /** Handles keyboard events for the menu trigger. */\n onKeydown(event: KeyboardEvent) {\n if (!this.inputs.disabled()) {\n this.hasBeenInteracted.set(true);\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.hasBeenInteracted.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.pendingFocus.set('first');\n } else if (opts?.last) {\n this.pendingFocus.set('last');\n }\n }\n\n /** Closes the menu. */\n close(opts: {refocus?: boolean} = {}) {\n this.expanded.set(false);\n this.pendingFocus.set(undefined);\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 | undefined> {\n /** The value of the menu item. */\n readonly value: SignalLike<V | undefined>;\n\n /** The unique ID of the menu item. */\n readonly id: SignalLike<string>;\n\n /** Whether the menu item is disabled. */\n readonly disabled = () => this.inputs.parent()?.disabled() || this.inputs.disabled();\n\n /** The search term for the menu item. */\n readonly searchTerm: SignalLike<string>;\n\n /** The element of the menu item. */\n readonly element: SignalLike<HTMLElement | undefined>;\n\n /** Whether the menu item is active. */\n readonly active = computed(() => this.inputs.parent()?.inputs.activeItem() === this);\n\n /** Whether the menu item has received interaction. */\n readonly hasBeenInteracted = signal(false);\n\n /** The tab index of the menu item. */\n readonly 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 readonly index = computed(() => this.inputs.parent()?.inputs.items().indexOf(this) ?? -1);\n\n /** Whether the menu item is expanded. */\n readonly expanded = computed(() => (this.submenu() ? this._expanded() : null));\n\n /** Whether the menu item is expanded. */\n readonly _expanded = signal(false);\n\n /** The ID of the menu that the menu item controls. */\n readonly controls = signal<string | undefined>(undefined);\n\n /** The role of the menu item. */\n readonly role = () => this.inputs.role();\n\n /** Whether the menu item has a popup. */\n readonly hasPopup = computed(() => !!this.submenu());\n\n /** The submenu associated with the menu item. */\n readonly submenu: SignalLike<MenuPattern<V> | undefined>;\n\n /** Whether the menu item is selectable. */\n readonly selectable: SignalLike<boolean>;\n\n constructor(readonly inputs: MenuItemInputs<V>) {\n this.id = inputs.id;\n this.value = inputs.value ?? signal(undefined);\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.hasBeenInteracted.set(true);\n }\n}\n"],"names":[],"mappings":";;;;MAgFa,WAAW,CAAA;EA4GD,MAAA;EA1GZ,EAAE;EAGF,IAAI,GAAG,MAAM,MAAM;EAGnB,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;EAGvC,OAAO,GAAG,QAAQ,CAAC,MAC1B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,GAAG,IAAI,CACjE;EAGQ,YAAY;AAGZ,EAAA,SAAS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AAM,EAAE;AACvB,MAAA,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,EAAE;AAChC,MAAA,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;MAC9B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,YAAY,CAAC,OAAO,EAAE;AACjD,MAAA,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;MAEvE,MAAM,MAAM,GAAG,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;MAExC,IAAI,MAAM,YAAY,WAAW,EAAE;QACjC,MAAM,CAAC,cAAc,EAAE;AACzB,MAAA;AACF,IAAA;AACF,EAAA;AAGA,EAAA,SAAS,GAAA;AACP,IAAA,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC;AAClC,EAAA;AACD;;;;"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { _getEventTarget } from '@angular/cdk/platform';
|
|
2
2
|
import { signal, computed, KeyboardEventManager } from './_violations-chunk.mjs';
|
|
3
|
-
import {
|
|
3
|
+
import { ListFocus, ListNavigation } from './_list-navigation-chunk.mjs';
|
|
4
4
|
|
|
5
5
|
class ToolbarPattern {
|
|
6
6
|
inputs;
|
|
7
|
-
|
|
7
|
+
focusManager;
|
|
8
|
+
navigationBehavior;
|
|
8
9
|
hasBeenInteracted = signal(false);
|
|
9
10
|
orientation;
|
|
10
11
|
softDisabled;
|
|
11
|
-
disabled = computed(() => this.
|
|
12
|
-
tabIndex = computed(() => this.
|
|
13
|
-
activeDescendant = computed(() => this.
|
|
14
|
-
activeItem = () => this.
|
|
12
|
+
disabled = computed(() => this.focusManager.isListDisabled());
|
|
13
|
+
tabIndex = computed(() => this.focusManager.getListTabIndex());
|
|
14
|
+
activeDescendant = computed(() => this.focusManager.getActiveDescendant());
|
|
15
|
+
activeItem = () => this.inputs.activeItem();
|
|
15
16
|
_prevKey = computed(() => {
|
|
16
17
|
if (this.inputs.orientation() === 'vertical') {
|
|
17
18
|
return 'ArrowUp';
|
|
@@ -38,79 +39,69 @@ class ToolbarPattern {
|
|
|
38
39
|
});
|
|
39
40
|
_keydown = computed(() => {
|
|
40
41
|
const manager = new KeyboardEventManager();
|
|
41
|
-
|
|
42
|
+
const activeItem = this.inputs.activeItem();
|
|
43
|
+
manager.on(this._nextKey, () => this.navigationBehavior.next(), {
|
|
42
44
|
ignoreRepeat: false
|
|
43
|
-
}).on(this._prevKey, () => this.
|
|
45
|
+
}).on(this._prevKey, () => this.navigationBehavior.prev(), {
|
|
44
46
|
ignoreRepeat: false
|
|
45
|
-
}).on(this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
}).on('Home', () => this.navigationBehavior.first()).on('End', () => this.navigationBehavior.last());
|
|
48
|
+
if (activeItem?.group()) {
|
|
49
|
+
manager.on(this._altNextKey, () => this._groupNext(), {
|
|
50
|
+
ignoreRepeat: false
|
|
51
|
+
}).on(this._altPrevKey, () => this._groupPrev(), {
|
|
52
|
+
ignoreRepeat: false
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return manager;
|
|
50
56
|
});
|
|
51
57
|
_groupNext() {
|
|
52
58
|
const currGroup = this.inputs.activeItem()?.group();
|
|
53
|
-
const nextGroup = this.
|
|
59
|
+
const nextGroup = this.navigationBehavior.peekNext()?.group();
|
|
54
60
|
if (!currGroup) {
|
|
55
61
|
return;
|
|
56
62
|
}
|
|
57
63
|
if (currGroup !== nextGroup) {
|
|
58
|
-
this.
|
|
64
|
+
this.navigationBehavior.goto(this.navigationBehavior.peekFirst({
|
|
59
65
|
items: currGroup.inputs.items()
|
|
60
66
|
}));
|
|
61
67
|
return;
|
|
62
68
|
}
|
|
63
|
-
this.
|
|
69
|
+
this.navigationBehavior.next();
|
|
64
70
|
}
|
|
65
71
|
_groupPrev() {
|
|
66
72
|
const currGroup = this.inputs.activeItem()?.group();
|
|
67
|
-
const nextGroup = this.
|
|
73
|
+
const nextGroup = this.navigationBehavior.peekPrev()?.group();
|
|
68
74
|
if (!currGroup) {
|
|
69
75
|
return;
|
|
70
76
|
}
|
|
71
77
|
if (currGroup !== nextGroup) {
|
|
72
|
-
this.
|
|
78
|
+
this.navigationBehavior.goto(this.navigationBehavior.peekLast({
|
|
73
79
|
items: currGroup.inputs.items()
|
|
74
80
|
}));
|
|
75
81
|
return;
|
|
76
82
|
}
|
|
77
|
-
this.
|
|
83
|
+
this.navigationBehavior.prev();
|
|
78
84
|
}
|
|
79
85
|
_goto(e) {
|
|
80
86
|
const item = this.inputs.getItem(_getEventTarget(e));
|
|
81
87
|
if (item) {
|
|
82
|
-
this.
|
|
83
|
-
this.select();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
select() {
|
|
87
|
-
const group = this.inputs.activeItem()?.group();
|
|
88
|
-
if (!group?.multi()) {
|
|
89
|
-
group?.inputs.items().forEach(i => this.listBehavior.deselect(i));
|
|
88
|
+
this.navigationBehavior.goto(item);
|
|
90
89
|
}
|
|
91
|
-
this.listBehavior.toggle();
|
|
92
90
|
}
|
|
93
91
|
constructor(inputs) {
|
|
94
92
|
this.inputs = inputs;
|
|
95
93
|
this.orientation = inputs.orientation;
|
|
96
94
|
this.softDisabled = inputs.softDisabled;
|
|
97
|
-
this.
|
|
95
|
+
this.focusManager = new ListFocus({
|
|
96
|
+
...inputs,
|
|
97
|
+
focusMode: () => 'roving'
|
|
98
|
+
});
|
|
99
|
+
this.navigationBehavior = new ListNavigation({
|
|
98
100
|
...inputs,
|
|
99
|
-
multi: () => true,
|
|
100
101
|
focusMode: () => 'roving',
|
|
101
|
-
|
|
102
|
-
typeaheadDelay: () => 0
|
|
102
|
+
focusManager: this.focusManager
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
validate() {
|
|
106
|
-
const violations = [];
|
|
107
|
-
const values = this.inputs.items().map(w => w.value());
|
|
108
|
-
const duplicates = values.filter((val, idx) => values.indexOf(val) !== idx);
|
|
109
|
-
if (duplicates.length > 0) {
|
|
110
|
-
violations.push(`Duplicate value '${duplicates[0]}' detected inside ngToolbar.`);
|
|
111
|
-
}
|
|
112
|
-
return violations;
|
|
113
|
-
}
|
|
114
105
|
onKeydown(event) {
|
|
115
106
|
if (this.disabled()) return;
|
|
116
107
|
this.hasBeenInteracted.set(true);
|
|
@@ -118,7 +109,6 @@ class ToolbarPattern {
|
|
|
118
109
|
}
|
|
119
110
|
onPointerdown(event) {
|
|
120
111
|
this.hasBeenInteracted.set(true);
|
|
121
|
-
event.preventDefault();
|
|
122
112
|
}
|
|
123
113
|
onFocusIn() {
|
|
124
114
|
this.hasBeenInteracted.set(true);
|
|
@@ -128,7 +118,7 @@ class ToolbarPattern {
|
|
|
128
118
|
this._goto(event);
|
|
129
119
|
}
|
|
130
120
|
setDefaultState() {
|
|
131
|
-
const firstItem = this.
|
|
121
|
+
const firstItem = this.navigationBehavior.peekFirst({
|
|
132
122
|
items: this.inputs.items()
|
|
133
123
|
});
|
|
134
124
|
if (firstItem) {
|
|
@@ -150,12 +140,8 @@ class ToolbarWidgetPattern {
|
|
|
150
140
|
disabled = () => this.inputs.disabled() || this.group()?.disabled() || false;
|
|
151
141
|
group = () => this.inputs.group();
|
|
152
142
|
toolbar = () => this.inputs.toolbar();
|
|
153
|
-
tabIndex = computed(() => this.toolbar().
|
|
154
|
-
searchTerm = () => '';
|
|
155
|
-
value = () => this.inputs.value();
|
|
156
|
-
selectable = () => true;
|
|
143
|
+
tabIndex = computed(() => this.toolbar().focusManager.getItemTabIndex(this));
|
|
157
144
|
index = computed(() => this.toolbar().inputs.items().indexOf(this) ?? -1);
|
|
158
|
-
selected = computed(() => this.toolbar().listBehavior.inputs.value().includes(this.value()));
|
|
159
145
|
active = computed(() => this.toolbar().activeItem() === this);
|
|
160
146
|
constructor(inputs) {
|
|
161
147
|
this.inputs = inputs;
|
|
@@ -166,11 +152,6 @@ class ToolbarWidgetGroupPattern {
|
|
|
166
152
|
inputs;
|
|
167
153
|
disabled = () => this.inputs.disabled();
|
|
168
154
|
toolbar = () => this.inputs.toolbar();
|
|
169
|
-
multi = () => this.inputs.multi();
|
|
170
|
-
searchTerm = () => '';
|
|
171
|
-
value = () => '';
|
|
172
|
-
selectable = () => true;
|
|
173
|
-
element = () => undefined;
|
|
174
155
|
constructor(inputs) {
|
|
175
156
|
this.inputs = inputs;
|
|
176
157
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_toolbar-widget-group-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar-widget.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar-widget-group.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 {_getEventTarget} from '@angular/cdk/platform';\nimport {computed, signal, SignalLike} from '../behaviors/signal-like/signal-like';\nimport {KeyboardEventManager} from '../behaviors/event-manager';\nimport {List, ListInputs} from '../behaviors/list/list';\nimport {ToolbarWidgetPattern} from './toolbar-widget';\n\n/** Represents the required inputs for a toolbar. */\nexport type ToolbarInputs<V> = Omit<\n ListInputs<ToolbarWidgetPattern<V>, V>,\n 'multi' | 'typeaheadDelay' | 'selectionMode' | 'focusMode'\n> & {\n /** A function that returns the toolbar item associated with a given element. */\n getItem: (e: Element) => ToolbarWidgetPattern<V> | undefined;\n};\n\n/** Controls the state of a toolbar. */\nexport class ToolbarPattern<V> {\n /** The list behavior for the toolbar. */\n readonly listBehavior: List<ToolbarWidgetPattern<V>, V>;\n\n /** Whether the toolbar has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the tablist is vertically or horizontally oriented. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** Whether disabled items in the group should be focusable. */\n readonly softDisabled: SignalLike<boolean>;\n\n /** Whether the toolbar is disabled. */\n readonly disabled = computed(() => this.listBehavior.disabled());\n\n /** The tab index of the toolbar (if using activedescendant). */\n readonly tabIndex = computed(() => this.listBehavior.tabIndex());\n\n /** The id of the current active widget (if using activedescendant). */\n readonly activeDescendant = computed(() => this.listBehavior.activeDescendant());\n\n /** The currently active item in the toolbar. */\n readonly activeItem = () => this.listBehavior.inputs.activeItem();\n\n /** The key used to navigate to the previous widget. */\n private readonly _prevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key used to navigate to the next widget. */\n private readonly _nextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The alternate key used to navigate to the previous widget. */\n private readonly _altPrevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n }\n return 'ArrowUp';\n });\n\n /** The alternate key used to navigate to the next widget. */\n private readonly _altNextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n }\n return 'ArrowDown';\n });\n\n /** The keydown event manager for the toolbar. */\n private readonly _keydown = computed(() => {\n const manager = new KeyboardEventManager();\n\n return manager\n .on(this._nextKey, () => this.listBehavior.next(), {ignoreRepeat: false})\n .on(this._prevKey, () => this.listBehavior.prev(), {ignoreRepeat: false})\n .on(this._altNextKey, () => this._groupNext(), {ignoreRepeat: false})\n .on(this._altPrevKey, () => this._groupPrev(), {ignoreRepeat: false})\n .on(' ', () => this.select())\n .on('Enter', () => this.select())\n .on('Home', () => this.listBehavior.first())\n .on('End', () => this.listBehavior.last());\n });\n\n /** Navigates to the next widget in a widget group. */\n private _groupNext() {\n const currGroup = this.inputs.activeItem()?.group();\n const nextGroup = this.listBehavior.navigationBehavior.peekNext()?.group();\n\n if (!currGroup) {\n return;\n }\n\n if (currGroup !== nextGroup) {\n this.listBehavior.goto(\n this.listBehavior.navigationBehavior.peekFirst({\n items: currGroup.inputs.items(),\n })!,\n );\n\n return;\n }\n\n this.listBehavior.next();\n }\n\n /** Navigates to the previous widget in a widget group. */\n private _groupPrev() {\n const currGroup = this.inputs.activeItem()?.group();\n const nextGroup = this.listBehavior.navigationBehavior.peekPrev()?.group();\n\n if (!currGroup) {\n return;\n }\n\n if (currGroup !== nextGroup) {\n this.listBehavior.goto(\n this.listBehavior.navigationBehavior.peekLast({\n items: currGroup.inputs.items(),\n })!,\n );\n\n return;\n }\n\n this.listBehavior.prev();\n }\n\n /** Navigates to the widget targeted by a pointer event. */\n private _goto(e: MouseEvent) {\n const item = this.inputs.getItem(_getEventTarget(e) as Element);\n\n if (item) {\n this.listBehavior.goto(item);\n this.select();\n }\n }\n\n select() {\n const group = this.inputs.activeItem()?.group();\n\n if (!group?.multi()) {\n group?.inputs.items().forEach(i => this.listBehavior.deselect(i));\n }\n\n this.listBehavior.toggle();\n }\n\n constructor(readonly inputs: ToolbarInputs<V>) {\n this.orientation = inputs.orientation;\n this.softDisabled = inputs.softDisabled;\n\n this.listBehavior = new List({\n ...inputs,\n multi: () => true,\n focusMode: () => 'roving',\n selectionMode: () => 'explicit',\n typeaheadDelay: () => 0, // Toolbar widgets do not support typeahead.\n });\n }\n\n /** Returns a set of violations */\n validate(): string[] {\n const violations: string[] = [];\n\n const values = this.inputs.items().map(w => w.value());\n const duplicates = values.filter((val, idx) => values.indexOf(val) !== idx);\n if (duplicates.length > 0) {\n violations.push(`Duplicate value '${duplicates[0]}' detected inside ngToolbar.`);\n }\n\n return violations;\n }\n\n /** Handles keydown events for the toolbar. */\n onKeydown(event: KeyboardEvent) {\n if (this.disabled()) return;\n this.hasBeenInteracted.set(true);\n this._keydown().handle(event);\n }\n\n onPointerdown(event: PointerEvent) {\n this.hasBeenInteracted.set(true);\n event.preventDefault();\n }\n\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n\n /** Handles click events for the toolbar. */\n onClick(event: MouseEvent) {\n if (this.disabled() || (event as PointerEvent).pointerType === '') return;\n this._goto(event);\n }\n\n /**\n * Sets the toolbar to its default initial state.\n *\n * Sets the active index to the selected widget if one exists and is focusable.\n * Otherwise, sets the active index to the first focusable widget.\n */\n setDefaultState() {\n const firstItem = this.listBehavior.navigationBehavior.peekFirst({\n items: this.inputs.items(),\n });\n\n if (firstItem) {\n this.inputs.activeItem.set(firstItem);\n }\n }\n\n /** Sets the default active state of the toolbar before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\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 {SignalLike, computed} from '../behaviors/signal-like/signal-like';\nimport {ListItem} from '../behaviors/list/list';\nimport type {ToolbarPattern} from './toolbar';\nimport {ToolbarWidgetGroupPattern} from './toolbar-widget-group';\n\n/** Represents the required inputs for a toolbar widget in a toolbar. */\nexport interface ToolbarWidgetInputs<V> extends Omit<\n ListItem<V>,\n 'searchTerm' | 'index' | 'selectable'\n> {\n /** A reference to the parent toolbar. */\n toolbar: SignalLike<ToolbarPattern<V>>;\n\n /** A reference to the parent widget group. */\n group: SignalLike<ToolbarWidgetGroupPattern<ToolbarWidgetPattern<V>, V> | undefined>;\n}\n\nexport class ToolbarWidgetPattern<V> implements ListItem<V> {\n /** A unique identifier for the widget. */\n readonly id = () => this.inputs.id();\n\n /** The html element that should receive focus. */\n readonly element = () => this.inputs.element();\n\n /** Whether the widget is disabled. */\n readonly disabled = () => this.inputs.disabled() || this.group()?.disabled() || false;\n\n /** A reference to the parent toolbar. */\n readonly group = () => this.inputs.group();\n\n /** A reference to the toolbar containing the widget. */\n readonly toolbar = () => this.inputs.toolbar();\n\n /** The tabindex of the widget. */\n readonly tabIndex = computed(() => this.toolbar().listBehavior.getItemTabindex(this));\n\n /** The text used by the typeahead search. */\n readonly searchTerm = () => ''; // Unused because toolbar does not support typeahead.\n\n /** The value associated with the widget. */\n readonly value = () => this.inputs.value();\n\n /** Whether the widget is selectable. */\n readonly selectable = () => true; // Unused because toolbar does not support selection.\n\n /** The position of the widget within the toolbar. */\n readonly index = computed(() => this.toolbar().inputs.items().indexOf(this) ?? -1);\n\n /** Whether the widget is selected (only relevant in a selection group). */\n readonly selected = computed(() =>\n this.toolbar().listBehavior.inputs.value().includes(this.value()),\n );\n\n /** Whether the widget is currently the active one (focused). */\n readonly active: SignalLike<boolean> = computed(() => this.toolbar().activeItem() === this);\n\n constructor(readonly inputs: ToolbarWidgetInputs<V>) {}\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 {ListItem} from '../behaviors/list/list';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport type {ToolbarPattern} from './toolbar';\n\n/** Represents the required inputs for a toolbar widget group. */\nexport interface ToolbarWidgetGroupInputs<T extends ListItem<V>, V> {\n /** A reference to the parent toolbar. */\n toolbar: SignalLike<ToolbarPattern<V> | undefined>;\n\n /** Whether the widget group is disabled. */\n disabled: SignalLike<boolean>;\n\n /** The list of items within the widget group. */\n items: SignalLike<T[]>;\n\n /** Whether the group allows multiple widgets to be selected. */\n multi: SignalLike<boolean>;\n}\n\n/** A group of widgets within a toolbar that provides nested navigation. */\nexport class ToolbarWidgetGroupPattern<T extends ListItem<V>, V> {\n /** Whether the widget is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** A reference to the parent toolbar. */\n readonly toolbar = () => this.inputs.toolbar();\n\n /** Whether the group allows multiple widgets to be selected. */\n readonly multi = () => this.inputs.multi();\n\n readonly searchTerm = () => ''; // Unused because toolbar does not support typeahead.\n readonly value = () => '' as V; // Unused because toolbar does not support selection.\n readonly selectable = () => true; // Unused because toolbar does not support selection.\n readonly element = () => undefined; // Unused because toolbar does not focus the group element.\n\n constructor(readonly inputs: ToolbarWidgetGroupInputs<T, V>) {}\n}\n"],"names":[],"mappings":";;;;MAwBa,cAAc,CAAA;EAwIJ,MAAA;EAtIZ,YAAY;AAGZ,EAAA,iBAAiB,GAAG,MAAM,CAAC,KAAK,CAAC;EAGjC,WAAW;EAGX,YAAY;EAGZ,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;EAGvD,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;EAGvD,gBAAgB,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,CAAC;EAGvE,UAAU,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE;EAGhD,QAAQ,GAAG,QAAQ,CAAC,MAAK;IACxC,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,UAAU,EAAE;AAC5C,MAAA,OAAO,SAAS;AAClB,IAAA;AACA,IAAA,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,KAAK,GAAG,YAAY,GAAG,WAAW;AAC3E,EAAA,CAAC,CAAC;EAGe,QAAQ,GAAG,QAAQ,CAAC,MAAK;IACxC,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,UAAU,EAAE;AAC5C,MAAA,OAAO,WAAW;AACpB,IAAA;AACA,IAAA,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,KAAK,GAAG,WAAW,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CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAClE;AAGQ,EAAA,MAAM,GAAwB,QAAQ,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE,KAAK,IAAI,CAAC;EAE3F,WAAA,CAAqB,MAA8B,EAAA;IAA9B,IAAA,CAAA,MAAM,GAAN,MAAM;AAA2B,EAAA;AACvD;;MCrCY,yBAAyB,CAAA;EAef,MAAA;EAbZ,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;EAGvC,OAAO,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;EAGrC,KAAK,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;EAEjC,UAAU,GAAG,MAAM,EAAE;EACrB,KAAK,GAAG,MAAM,EAAO;EACrB,UAAU,GAAG,MAAM,IAAI;EACvB,OAAO,GAAG,MAAM,SAAS;EAElC,WAAA,CAAqB,MAAsC,EAAA;IAAtC,IAAA,CAAA,MAAM,GAAN,MAAM;AAAmC,EAAA;AAC/D;;;;"}
|
|
1
|
+
{"version":3,"file":"_toolbar-widget-group-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar-widget.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar-widget-group.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 {_getEventTarget} from '@angular/cdk/platform';\nimport {\n computed,\n signal,\n SignalLike,\n WritableSignalLike,\n} from '../behaviors/signal-like/signal-like';\nimport {KeyboardEventManager} from '../behaviors/event-manager';\nimport {ListFocus} from '../behaviors/list-focus/list-focus';\nimport {ListNavigation} from '../behaviors/list-navigation/list-navigation';\nimport {ToolbarWidgetPattern} from './toolbar-widget';\n\n/** Represents the required inputs for a toolbar. */\nexport type ToolbarInputs = {\n /** The html element that should receive focus. */\n element: SignalLike<HTMLElement | undefined>;\n\n /** The active item. */\n activeItem: WritableSignalLike<ToolbarWidgetPattern | undefined>;\n\n /** The items in the toolbar. */\n items: SignalLike<ToolbarWidgetPattern[]>;\n\n /** Whether disabled items in the toolbar should be focusable. */\n softDisabled: SignalLike<boolean>;\n\n /** Whether the toolbar is disabled. */\n disabled: SignalLike<boolean>;\n\n /** Whether the toolbar is vertically or horizontally oriented. */\n orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** The direction that text is read based on the users locale. */\n textDirection: SignalLike<'rtl' | 'ltr'>;\n\n /** Whether focus should wrap when navigating. */\n wrap: SignalLike<boolean>;\n\n /** A function that returns the toolbar item associated with a given element. */\n getItem: (e: Element) => ToolbarWidgetPattern | undefined;\n};\n\n/** Controls the state of a toolbar. */\nexport class ToolbarPattern {\n /** Controls focus for the toolbar. */\n readonly focusManager: ListFocus<ToolbarWidgetPattern>;\n\n /** Controls navigation for the toolbar. */\n readonly navigationBehavior: ListNavigation<ToolbarWidgetPattern>;\n\n /** Whether the toolbar has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the toolbar is vertically or horizontally oriented. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** Whether disabled items in the group should be focusable. */\n readonly softDisabled: SignalLike<boolean>;\n\n /** Whether the toolbar is disabled. */\n readonly disabled = computed(() => this.focusManager.isListDisabled());\n\n /** The tab index of the toolbar. */\n readonly tabIndex = computed(() => this.focusManager.getListTabIndex());\n\n /** The id of the current active widget. */\n readonly activeDescendant = computed(() => this.focusManager.getActiveDescendant());\n\n /** The currently active item in the toolbar. */\n readonly activeItem = () => this.inputs.activeItem();\n\n /** The key used to navigate to the previous widget. */\n private readonly _prevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key used to navigate to the next widget. */\n private readonly _nextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The alternate key used to navigate to the previous widget. */\n private readonly _altPrevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n }\n return 'ArrowUp';\n });\n\n /** The alternate key used to navigate to the next widget. */\n private readonly _altNextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n }\n return 'ArrowDown';\n });\n\n /** The keydown event manager for the toolbar. */\n private readonly _keydown = computed(() => {\n const manager = new KeyboardEventManager();\n const activeItem = this.inputs.activeItem();\n\n manager\n .on(this._nextKey, () => this.navigationBehavior.next(), {ignoreRepeat: false})\n .on(this._prevKey, () => this.navigationBehavior.prev(), {ignoreRepeat: false})\n .on('Home', () => this.navigationBehavior.first())\n .on('End', () => this.navigationBehavior.last());\n\n if (activeItem?.group()) {\n manager\n .on(this._altNextKey, () => this._groupNext(), {ignoreRepeat: false})\n .on(this._altPrevKey, () => this._groupPrev(), {ignoreRepeat: false});\n }\n\n return manager;\n });\n\n /** Navigates to the next widget in a widget group. */\n private _groupNext() {\n const currGroup = this.inputs.activeItem()?.group();\n const nextGroup = this.navigationBehavior.peekNext()?.group();\n\n if (!currGroup) {\n return;\n }\n\n if (currGroup !== nextGroup) {\n this.navigationBehavior.goto(\n this.navigationBehavior.peekFirst({\n items: currGroup.inputs.items(),\n })!,\n );\n\n return;\n }\n\n this.navigationBehavior.next();\n }\n\n /** Navigates to the previous widget in a widget group. */\n private _groupPrev() {\n const currGroup = this.inputs.activeItem()?.group();\n const nextGroup = this.navigationBehavior.peekPrev()?.group();\n\n if (!currGroup) {\n return;\n }\n\n if (currGroup !== nextGroup) {\n this.navigationBehavior.goto(\n this.navigationBehavior.peekLast({\n items: currGroup.inputs.items(),\n })!,\n );\n\n return;\n }\n\n this.navigationBehavior.prev();\n }\n\n /** Navigates to the widget targeted by a pointer event. */\n private _goto(e: MouseEvent) {\n const item = this.inputs.getItem(_getEventTarget(e) as Element);\n\n if (item) {\n this.navigationBehavior.goto(item);\n }\n }\n\n constructor(readonly inputs: ToolbarInputs) {\n this.orientation = inputs.orientation;\n this.softDisabled = inputs.softDisabled;\n\n this.focusManager = new ListFocus({\n ...inputs,\n focusMode: () => 'roving',\n });\n\n this.navigationBehavior = new ListNavigation({\n ...inputs,\n focusMode: () => 'roving',\n focusManager: this.focusManager,\n });\n }\n\n /** Handles keydown events for the toolbar. */\n onKeydown(event: KeyboardEvent) {\n if (this.disabled()) return;\n this.hasBeenInteracted.set(true);\n this._keydown().handle(event);\n }\n\n onPointerdown(event: PointerEvent) {\n this.hasBeenInteracted.set(true);\n }\n\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n\n /** Handles click events for the toolbar. */\n onClick(event: MouseEvent) {\n if (this.disabled() || (event as PointerEvent).pointerType === '') return;\n this._goto(event);\n }\n\n /**\n * Sets the toolbar to its default initial state.\n *\n * Sets the active index to the first focusable widget.\n */\n setDefaultState() {\n const firstItem = this.navigationBehavior.peekFirst({\n items: this.inputs.items(),\n });\n\n if (firstItem) {\n this.inputs.activeItem.set(firstItem);\n }\n }\n\n /** Sets the default active state of the toolbar before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\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 {SignalLike, computed} from '../behaviors/signal-like/signal-like';\nimport {ListFocusItem} from '../behaviors/list-focus/list-focus';\nimport {ListNavigationItem} from '../behaviors/list-navigation/list-navigation';\nimport type {ToolbarPattern} from './toolbar';\nimport {ToolbarWidgetGroupPattern} from './toolbar-widget-group';\n\n/** Represents the required inputs for a toolbar widget in a toolbar. */\nexport interface ToolbarWidgetInputs {\n /** A unique identifier for the widget. */\n id: SignalLike<string>;\n\n /** The html element that should receive focus. */\n element: SignalLike<HTMLElement | undefined>;\n\n /** Whether the widget is disabled. */\n disabled: SignalLike<boolean>;\n\n /** A reference to the parent toolbar. */\n toolbar: SignalLike<ToolbarPattern>;\n\n /** A reference to the parent widget group. */\n group: SignalLike<ToolbarWidgetGroupPattern | undefined>;\n}\n\nexport class ToolbarWidgetPattern implements ListFocusItem, ListNavigationItem {\n /** A unique identifier for the widget. */\n readonly id = () => this.inputs.id();\n\n /** The html element that should receive focus. */\n readonly element = () => this.inputs.element();\n\n /** Whether the widget is disabled. */\n readonly disabled = () => this.inputs.disabled() || this.group()?.disabled() || false;\n\n /** A reference to the parent toolbar. */\n readonly group = () => this.inputs.group();\n\n /** A reference to the toolbar containing the widget. */\n readonly toolbar = () => this.inputs.toolbar();\n\n /** The tabindex of the widget. */\n readonly tabIndex = computed(() => this.toolbar().focusManager.getItemTabIndex(this));\n\n /** The position of the widget within the toolbar. */\n readonly index = computed(() => this.toolbar().inputs.items().indexOf(this) ?? -1);\n\n /** Whether the widget is currently the active one (focused). */\n readonly active: SignalLike<boolean> = computed(() => this.toolbar().activeItem() === this);\n\n constructor(readonly inputs: ToolbarWidgetInputs) {}\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 {SignalLike} from '../behaviors/signal-like/signal-like';\nimport type {ToolbarPattern} from './toolbar';\nimport type {ToolbarWidgetPattern} from './toolbar-widget';\n\n/** Represents the required inputs for a toolbar widget group. */\nexport interface ToolbarWidgetGroupInputs {\n /** A reference to the parent toolbar. */\n toolbar: SignalLike<ToolbarPattern | undefined>;\n\n /** Whether the widget group is disabled. */\n disabled: SignalLike<boolean>;\n\n /** The list of items within the widget group. */\n items: SignalLike<ToolbarWidgetPattern[]>;\n}\n\n/** A group of widgets within a toolbar that provides nested navigation. */\nexport class ToolbarWidgetGroupPattern {\n /** Whether the widget is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** A reference to the parent toolbar. */\n readonly toolbar = () => this.inputs.toolbar();\n\n constructor(readonly inputs: ToolbarWidgetGroupInputs) {}\n}\n"],"names":[],"mappings":";;;;MAmDa,cAAc,CAAA;EAqIJ,MAAA;EAnIZ,YAAY;EAGZ,kBAAkB;AAGlB,EAAA,iBAAiB,GAAG,MAAM,CAAC,KAAK,CAAC;EAGjC,WAAW;EAGX,YAAY;EAGZ,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC;EAG7D,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,CAAC;EAG9D,gBAAgB,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;EAG1E,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;EAGnC,QAAQ,GAAG,QAAQ,CAAC,MAAK;IACxC,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,UAAU,EAAE;AAC5C,MAAA,OAAO,SAAS;AAClB,IAAA;AACA,IAAA,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,KAAK,GAAG,YAAY,GAAG,WAAW;AAC3E,EAAA,CAAC,CAAC;EAGe,QAAQ,GAAG,QAAQ,CAAC,MAAK;IACxC,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,UAAU,EAAE;AAC5C,MAAA,OAAO,WAAW;AACpB,IAAA;AAC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