@angular/aria 21.0.5 → 21.0.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"_combobox-tree-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/tree/tree.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/tree/combobox-tree.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 {SignalLike, computed, WritableSignalLike} from '../behaviors/signal-like/signal-like';\nimport {List, ListInputs, ListItem} from '../behaviors/list/list';\nimport {ExpansionItem, ListExpansion} from '../behaviors/expansion/expansion';\nimport {KeyboardEventManager, PointerEventManager, Modifier} from '../behaviors/event-manager';\n\n/** Represents the required inputs for a tree item. */\nexport interface TreeItemInputs<V>\n extends Omit<ListItem<V>, 'index'>, Omit<ExpansionItem, 'expandable'> {\n /** The parent item. */\n parent: SignalLike<TreeItemPattern<V> | TreePattern<V>>;\n\n /** Whether this item has children. Children can be lazily loaded. */\n hasChildren: SignalLike<boolean>;\n\n /** The children items. */\n children: SignalLike<TreeItemPattern<V>[]>;\n\n /** The tree pattern this item belongs to. */\n tree: SignalLike<TreePattern<V>>;\n}\n\n/**\n * Represents an item in a Tree.\n */\nexport class TreeItemPattern<V> implements ListItem<V>, ExpansionItem {\n /** A unique identifier for this item. */\n readonly id: SignalLike<string> = () => this.inputs.id();\n\n /** The value of this item. */\n readonly value: SignalLike<V> = () => this.inputs.value();\n\n /** A reference to the item element. */\n readonly element: SignalLike<HTMLElement> = () => this.inputs.element()!;\n\n /** Whether the item is disabled. */\n readonly disabled: SignalLike<boolean> = () => this.inputs.disabled();\n\n /** The text used by the typeahead search. */\n readonly searchTerm: SignalLike<string> = () => this.inputs.searchTerm();\n\n /** The tree pattern this item belongs to. */\n readonly tree: SignalLike<TreePattern<V>> = () => this.inputs.tree();\n\n /** The parent item. */\n readonly parent: SignalLike<TreeItemPattern<V> | TreePattern<V>> = () => this.inputs.parent();\n\n /** The children items. */\n readonly children: SignalLike<TreeItemPattern<V>[]> = () => this.inputs.children();\n\n /** The position of this item among its siblings. */\n readonly index = computed(() => this.tree().visibleItems().indexOf(this));\n\n /** Controls expansion for child items. */\n readonly expansionBehavior: ListExpansion;\n\n /** Whether the item is expandable. It's expandable if children item exist. */\n readonly expandable: SignalLike<boolean> = () => this.inputs.hasChildren();\n\n /** Whether the item is selectable. */\n readonly selectable: SignalLike<boolean> = () => this.inputs.selectable();\n\n /** Whether the item is expanded. */\n readonly expanded: WritableSignalLike<boolean>;\n\n /** The level of the current item in a tree. */\n readonly level: SignalLike<number> = computed(() => this.parent().level() + 1);\n\n /** Whether this item is visible. */\n readonly visible: SignalLike<boolean> = computed(\n () => this.parent().expanded() && this.parent().visible(),\n );\n\n /** The number of items under the same parent at the same level. */\n readonly setsize = computed(() => this.parent().children().length);\n\n /** The position of this item among its siblings (1-based). */\n readonly posinset = computed(() => this.parent().children().indexOf(this) + 1);\n\n /** Whether the item is active. */\n readonly active = computed(() => this.tree().activeItem() === this);\n\n /** The tab index of the item. */\n readonly tabIndex = computed(() => this.tree().listBehavior.getItemTabindex(this));\n\n /** Whether the item is selected. */\n readonly selected: SignalLike<boolean | undefined> = computed(() => {\n if (this.tree().nav()) {\n return undefined;\n }\n if (!this.selectable()) {\n return undefined;\n }\n return this.tree().values().includes(this.value());\n });\n\n /** The current type of this item. */\n readonly current: SignalLike<string | undefined> = computed(() => {\n if (!this.tree().nav()) {\n return undefined;\n }\n if (!this.selectable()) {\n return undefined;\n }\n return this.tree().values().includes(this.value()) ? this.tree().currentType() : undefined;\n });\n\n constructor(readonly inputs: TreeItemInputs<V>) {\n this.expanded = inputs.expanded;\n this.expansionBehavior = new ListExpansion({\n ...inputs,\n multiExpandable: () => true,\n items: this.children,\n disabled: computed(() => this.tree()?.disabled() ?? false),\n });\n }\n}\n\n/** The selection operations that the tree can perform. */\ninterface SelectOptions {\n toggle?: boolean;\n selectOne?: boolean;\n selectRange?: boolean;\n anchor?: boolean;\n}\n\n/** Represents the required inputs for a tree. */\nexport interface TreeInputs<V> extends Omit<ListInputs<TreeItemPattern<V>, V>, 'items'> {\n /** A unique identifier for the tree. */\n id: SignalLike<string>;\n\n /** All items in the tree, in document order (DFS-like, a flattened list). */\n allItems: SignalLike<TreeItemPattern<V>[]>;\n\n /** Whether the tree is in navigation mode. */\n nav: SignalLike<boolean>;\n\n /** The aria-current type. */\n currentType: SignalLike<'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false'>;\n}\n\n/** Controls the state and interactions of a tree view. */\nexport class TreePattern<V> implements TreeInputs<V> {\n /** The list behavior for the tree. */\n readonly listBehavior: List<TreeItemPattern<V>, V>;\n\n /** Controls expansion for direct children of the tree root (top-level items). */\n readonly expansionBehavior: ListExpansion;\n\n /** The root level is 0. */\n readonly level = () => 0;\n\n /** The root is always expanded. */\n readonly expanded = () => true;\n\n /** The root is always visible. */\n readonly visible = () => true;\n\n /** The tab index of the tree. */\n readonly tabIndex: SignalLike<-1 | 0> = computed(() => this.listBehavior.tabIndex());\n\n /** The id of the current active item. */\n readonly activeDescendant = computed(() => this.listBehavior.activeDescendant());\n\n /** The direct children of the root (top-level tree items). */\n readonly children = computed(() =>\n this.inputs.allItems().filter(item => item.level() === this.level() + 1),\n );\n\n /** All currently visible tree items. An item is visible if their parent is expanded. */\n readonly visibleItems = computed(() => this.inputs.allItems().filter(item => item.visible()));\n\n /** Whether the tree selection follows focus. */\n readonly followFocus = computed(() => this.inputs.selectionMode() === 'follow');\n\n /** Whether the tree direction is RTL. */\n readonly isRtl = computed(() => this.inputs.textDirection() === 'rtl');\n\n /** The key for navigating to the previous item. */\n readonly prevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.isRtl() ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key for navigating to the next item. */\n readonly nextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.isRtl() ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The key for collapsing an item or moving to its parent. */\n readonly collapseKey = computed(() => {\n if (this.inputs.orientation() === 'horizontal') {\n return 'ArrowUp';\n }\n return this.isRtl() ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key for expanding an item or moving to its first child. */\n readonly expandKey = computed(() => {\n if (this.inputs.orientation() === 'horizontal') {\n return 'ArrowDown';\n }\n return this.isRtl() ? 'ArrowLeft' : 'ArrowRight';\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 /** Regular expression to match characters for typeahead. */\n readonly typeaheadRegexp = /^.$/;\n\n /** The keydown event manager for the tree. */\n readonly keydown = computed(() => {\n const manager = new KeyboardEventManager();\n const list = this.listBehavior;\n\n manager\n .on(this.prevKey, () => list.prev({selectOne: this.followFocus()}))\n .on(this.nextKey, () => list.next({selectOne: this.followFocus()}))\n .on('Home', () => list.first({selectOne: this.followFocus()}))\n .on('End', () => list.last({selectOne: this.followFocus()}))\n .on(this.typeaheadRegexp, e => list.search(e.key, {selectOne: this.followFocus()}))\n .on(this.expandKey, () => this.expand({selectOne: this.followFocus()}))\n .on(this.collapseKey, () => this.collapse({selectOne: this.followFocus()}))\n .on(Modifier.Shift, '*', () => this.expandSiblings());\n\n if (this.inputs.multi()) {\n manager\n // TODO: Tracking the anchor by index can break if the\n // tree is expanded or collapsed causing the index to change.\n .on(Modifier.Any, 'Shift', () => list.anchor(this.listBehavior.activeIndex()))\n .on(Modifier.Shift, this.prevKey, () => list.prev({selectRange: true}))\n .on(Modifier.Shift, this.nextKey, () => list.next({selectRange: true}))\n .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'Home', () =>\n list.first({selectRange: true, anchor: false}),\n )\n .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'End', () =>\n list.last({selectRange: true, anchor: false}),\n )\n .on(Modifier.Shift, 'Enter', () => list.updateSelection({selectRange: true, anchor: false}))\n .on(Modifier.Shift, this.dynamicSpaceKey, () =>\n list.updateSelection({selectRange: true, anchor: false}),\n );\n }\n\n if (!this.followFocus() && this.inputs.multi()) {\n manager\n .on(this.dynamicSpaceKey, () => list.toggle())\n .on('Enter', () => list.toggle(), {preventDefault: !this.nav()})\n .on([Modifier.Ctrl, Modifier.Meta], 'A', () => list.toggleAll());\n }\n\n if (!this.followFocus() && !this.inputs.multi()) {\n manager.on(this.dynamicSpaceKey, () => list.selectOne());\n manager.on('Enter', () => list.selectOne(), {preventDefault: !this.nav()});\n }\n\n if (this.inputs.multi() && this.followFocus()) {\n manager\n .on([Modifier.Ctrl, Modifier.Meta], this.prevKey, () => list.prev())\n .on([Modifier.Ctrl, Modifier.Meta], this.nextKey, () => list.next())\n .on([Modifier.Ctrl, Modifier.Meta], this.expandKey, () => this.expand())\n .on([Modifier.Ctrl, Modifier.Meta], this.collapseKey, () => this.collapse())\n .on([Modifier.Ctrl, Modifier.Meta], ' ', () => list.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'Enter', () => list.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'Home', () => list.first())\n .on([Modifier.Ctrl, Modifier.Meta], 'End', () => list.last())\n .on([Modifier.Ctrl, Modifier.Meta], 'A', () => {\n list.toggleAll();\n list.select(); // Ensure the currect item remains selected.\n });\n }\n\n return manager;\n });\n\n /** The pointerdown event manager for the tree. */\n pointerdown = computed(() => {\n const manager = new PointerEventManager();\n\n if (this.multi()) {\n manager.on(Modifier.Shift, e => this.goto(e, {selectRange: true}));\n }\n\n if (!this.multi()) {\n return manager.on(e => this.goto(e, {selectOne: true}));\n }\n\n if (this.multi() && this.followFocus()) {\n return manager\n .on(e => this.goto(e, {selectOne: true}))\n .on(Modifier.Ctrl, e => this.goto(e, {toggle: true}));\n }\n\n if (this.multi() && !this.followFocus()) {\n return manager.on(e => this.goto(e, {toggle: true}));\n }\n\n return manager;\n });\n\n /** A unique identifier for the tree. */\n readonly id: SignalLike<string> = () => this.inputs.id();\n\n /** The host native element. */\n readonly element: SignalLike<HTMLElement> = () => this.inputs.element()!;\n\n /** Whether the tree is in navigation mode. */\n readonly nav: SignalLike<boolean> = () => this.inputs.nav();\n\n /** The aria-current type. */\n readonly currentType: SignalLike<\n 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false'\n > = () => this.inputs.currentType();\n\n /** All items in the tree, in document order (DFS-like, a flattened list). */\n readonly allItems: SignalLike<TreeItemPattern<V>[]> = () => this.inputs.allItems();\n\n /** The focus strategy used by the tree. */\n readonly focusMode: SignalLike<'roving' | 'activedescendant'> = () => this.inputs.focusMode();\n\n /** Whether the tree is disabled. */\n readonly disabled: SignalLike<boolean> = () => this.inputs.disabled();\n\n /** The currently active item in the tree. */\n readonly activeItem: WritableSignalLike<TreeItemPattern<V> | undefined>;\n\n /** Whether disabled items should be focusable. */\n readonly softDisabled: SignalLike<boolean> = () => this.inputs.softDisabled();\n\n /** Whether the focus should wrap when navigating past the first or last item. */\n readonly wrap: SignalLike<boolean> = () => this.inputs.wrap();\n\n /** The orientation of the tree. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'> = () => this.inputs.orientation();\n\n /** The text direction of the tree. */\n readonly textDirection: SignalLike<'ltr' | 'rtl'> = () => this.textDirection();\n\n /** Whether multiple items can be selected at the same time. */\n readonly multi: SignalLike<boolean> = computed(() => (this.nav() ? false : this.inputs.multi()));\n\n /** The selection mode of the tree. */\n readonly selectionMode: SignalLike<'follow' | 'explicit'> = () => this.inputs.selectionMode();\n\n /** The delay in milliseconds to wait before clearing the typeahead buffer. */\n readonly typeaheadDelay: SignalLike<number> = () => this.inputs.typeaheadDelay();\n\n /** The current selected items of the tree. */\n readonly values: WritableSignalLike<V[]>;\n\n constructor(readonly inputs: TreeInputs<V>) {\n this.activeItem = inputs.activeItem;\n this.values = inputs.values;\n\n this.listBehavior = new List({\n ...inputs,\n items: this.visibleItems,\n multi: this.multi,\n });\n\n this.expansionBehavior = new ListExpansion({\n multiExpandable: () => true,\n items: this.children,\n disabled: this.disabled,\n });\n }\n\n /**\n * Sets the tree to it's default initial state.\n *\n * Sets the active index of the tree to the first focusable selected tree item if one exists.\n * Otherwise, sets focus to the first focusable tree item.\n */\n setDefaultState() {\n let firstItem: TreeItemPattern<V> | undefined;\n\n for (const item of this.allItems()) {\n if (!item.visible()) continue;\n if (!this.listBehavior.isFocusable(item)) continue;\n\n if (firstItem === undefined) {\n firstItem = item;\n }\n\n if (item.selected()) {\n this.activeItem.set(item);\n return;\n }\n }\n\n if (firstItem !== undefined) {\n this.activeItem.set(firstItem);\n }\n }\n\n /** Handles keydown events on the tree. */\n onKeydown(event: KeyboardEvent) {\n if (!this.disabled()) {\n this.keydown().handle(event);\n }\n }\n\n /** Handles pointerdown events on the tree. */\n onPointerdown(event: PointerEvent) {\n if (!this.disabled()) {\n this.pointerdown().handle(event);\n }\n }\n\n /** Navigates to the given tree item in the tree. */\n goto(e: PointerEvent, opts?: SelectOptions) {\n const item = this._getItem(e);\n if (!item) return;\n\n this.listBehavior.goto(item, opts);\n this.toggleExpansion(item);\n }\n\n /** Toggles to expand or collapse a tree item. */\n toggleExpansion(item?: TreeItemPattern<V>) {\n item ??= this.activeItem();\n if (!item || !this.listBehavior.isFocusable(item)) return;\n\n if (!item.expandable()) return;\n if (item.expanded()) {\n this.collapse();\n } else {\n this.expansionBehavior.open(item);\n }\n }\n\n /** Expands a tree item. */\n expand(opts?: SelectOptions) {\n const item = this.activeItem();\n if (!item || !this.listBehavior.isFocusable(item)) return;\n\n if (item.expandable() && !item.expanded()) {\n this.expansionBehavior.open(item);\n } else if (\n item.expanded() &&\n item.children().some(item => this.listBehavior.isFocusable(item))\n ) {\n this.listBehavior.next(opts);\n }\n }\n\n /** Expands all sibling tree items including itself. */\n expandSiblings(item?: TreeItemPattern<V>) {\n item ??= this.activeItem();\n const siblings = item?.parent()?.children();\n siblings?.forEach(item => this.expansionBehavior.open(item));\n }\n\n /** Collapses a tree item. */\n collapse(opts?: SelectOptions) {\n const item = this.activeItem();\n if (!item || !this.listBehavior.isFocusable(item)) return;\n\n if (item.expandable() && item.expanded()) {\n this.expansionBehavior.close(item);\n } else if (item.parent() && item.parent() !== this) {\n const parentItem = item.parent();\n if (parentItem instanceof TreeItemPattern && this.listBehavior.isFocusable(parentItem)) {\n this.listBehavior.goto(parentItem, opts);\n }\n }\n }\n\n /** Retrieves the TreeItemPattern associated with a DOM event, if any. */\n protected _getItem(event: Event): TreeItemPattern<V> | undefined {\n if (!(event.target instanceof HTMLElement)) {\n return;\n }\n const element = event.target.closest('[role=\"treeitem\"]');\n return this.inputs.allItems().find(i => i.element() === element);\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 {TreeInputs, TreePattern, TreeItemPattern} from './tree';\nimport {computed, SignalLike} from '../behaviors/signal-like/signal-like';\nimport {ComboboxPattern, ComboboxTreeControls} from '../combobox/combobox';\n\nexport type ComboboxTreeInputs<V> = TreeInputs<V> & {\n /** The combobox controlling the tree. */\n combobox: SignalLike<ComboboxPattern<TreeItemPattern<V>, V> | undefined>;\n};\n\nexport class ComboboxTreePattern<V>\n extends TreePattern<V>\n implements ComboboxTreeControls<TreeItemPattern<V>, V>\n{\n /** Whether the currently focused item is collapsible. */\n isItemCollapsible = () => this.inputs.activeItem()?.parent() instanceof TreeItemPattern;\n\n /** The ARIA role for the tree. */\n role = () => 'tree' as const;\n\n /* The id of the active (focused) item in the tree. */\n activeId = computed(() => this.listBehavior.activeDescendant());\n\n /** Returns the currently active (focused) item in the tree. */\n getActiveItem = () => this.inputs.activeItem();\n\n /** The list of items in the tree. */\n items = computed(() => this.inputs.allItems());\n\n /** The tab index for the tree. Always -1 because the combobox handles focus. */\n override tabIndex: SignalLike<-1 | 0> = () => -1;\n\n constructor(override readonly inputs: ComboboxTreeInputs<V>) {\n if (inputs.combobox()) {\n inputs.multi = () => false;\n inputs.focusMode = () => 'activedescendant';\n inputs.element = inputs.combobox()!.inputs.inputEl;\n }\n\n super(inputs);\n }\n\n /** Noop. The combobox handles keydown events. */\n override onKeydown(_: KeyboardEvent): void {}\n\n /** Noop. The combobox handles pointerdown events. */\n override onPointerdown(_: PointerEvent): void {}\n\n /** Noop. The combobox controls the open state. */\n override setDefaultState(): void {}\n\n /** Navigates to the specified item in the tree. */\n focus = (item: TreeItemPattern<V>) => this.listBehavior.goto(item);\n\n /** Navigates to the next focusable item in the tree. */\n next = () => this.listBehavior.next();\n\n /** Navigates to the previous focusable item in the tree. */\n prev = () => this.listBehavior.prev();\n\n /** Navigates to the last focusable item in the tree. */\n last = () => this.listBehavior.last();\n\n /** Navigates to the first focusable item in the tree. */\n first = () => this.listBehavior.first();\n\n /** Unfocuses the currently focused item in the tree. */\n unfocus = () => this.listBehavior.unfocus();\n\n // TODO: handle non-selectable parent nodes.\n /** Selects the specified item in the tree or the current active item if not provided. */\n select = (item?: TreeItemPattern<V>) => this.listBehavior.select(item);\n\n /** Toggles the selection state of the given item in the tree or the current active item if not provided. */\n toggle = (item?: TreeItemPattern<V>) => this.listBehavior.toggle(item);\n\n /** Clears the selection in the tree. */\n clearSelection = () => this.listBehavior.deselectAll();\n\n /** Retrieves the TreeItemPattern associated with a pointer event. */\n getItem = (e: PointerEvent) => this._getItem(e);\n\n /** Retrieves the currently selected items in the tree */\n getSelectedItems = () => this.inputs.allItems().filter(item => item.selected());\n\n /** Sets the value of the combobox tree. */\n setValue = (value: V | undefined) => this.inputs.values.set(value ? [value] : []);\n\n /** Expands the currently focused item if it is expandable. */\n expandItem = () => this.expand();\n\n /** Collapses the currently focused item if it is expandable. */\n collapseItem = () => this.collapse();\n\n /** Whether the specified item or the currently active item is expandable. */\n isItemExpandable(item: TreeItemPattern<V> | undefined = this.inputs.activeItem()) {\n return item ? item.expandable() : false;\n }\n\n /** Expands all of the tree items. */\n expandAll = () => this.items().forEach(item => this.expansionBehavior.open(item));\n\n /** Collapses all of the tree items. */\n collapseAll = () => this.items().forEach(item => item.expansionBehavior.close(item));\n\n /** Whether the currently active item is selectable. */\n isItemSelectable = (item: TreeItemPattern<V> | undefined = this.inputs.activeItem()) => {\n return item ? item.selectable() : false;\n };\n}\n"],"names":["TreeItemPattern","inputs","id","value","element","disabled","searchTerm","tree","parent","children","index","computed","visibleItems","indexOf","expansionBehavior","expandable","hasChildren","selectable","expanded","level","visible","setsize","length","posinset","active","activeItem","tabIndex","listBehavior","getItemTabindex","selected","nav","undefined","values","includes","current","currentType","constructor","ListExpansion","multiExpandable","items","TreePattern","activeDescendant","allItems","filter","item","followFocus","selectionMode","isRtl","textDirection","prevKey","orientation","nextKey","collapseKey","expandKey","dynamicSpaceKey","isTyping","typeaheadRegexp","keydown","manager","KeyboardEventManager","list","on","prev","selectOne","next","first","last","e","search","key","expand","collapse","Modifier","Shift","expandSiblings","multi","Any","anchor","activeIndex","selectRange","Ctrl","Meta","updateSelection","toggle","preventDefault","toggleAll","select","pointerdown","PointerEventManager","goto","focusMode","softDisabled","wrap","typeaheadDelay","List","setDefaultState","firstItem","isFocusable","set","onKeydown","event","handle","onPointerdown","opts","_getItem","toggleExpansion","open","some","siblings","forEach","close","parentItem","target","HTMLElement","closest","find","i","ComboboxTreePattern","isItemCollapsible","role","activeId","getActiveItem","combobox","inputEl","_","focus","unfocus","clearSelection","deselectAll","getItem","getSelectedItems","setValue","expandItem","collapseItem","isItemExpandable","expandAll","collapseAll","isItemSelectable"],"mappings":";;;;;MAgCaA,eAAe,CAAA;EAkFLC,MAAA;EAhFZC,EAAE,GAAuBA,MAAM,IAAI,CAACD,MAAM,CAACC,EAAE,EAAE;EAG/CC,KAAK,GAAkBA,MAAM,IAAI,CAACF,MAAM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E,IAAI,IAAIA,IAAI,CAAC9B,iBAAiB,CAACgG,KAAK,CAAClE,IAAI,CAAC,CAAC;EAGpF6F,gBAAgB,GAAGA,CAAC7F,IAAA,GAAuC,IAAI,CAAC3C,MAAM,CAACwB,UAAU,EAAE,KAAI;IACrF,OAAOmB,IAAI,GAAGA,IAAI,CAAC3B,UAAU,EAAE,GAAG,KAAK;GACxC;AACF;;;;"}
1
+ {"version":3,"file":"_combobox-tree-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/behaviors/tree/tree.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/tree/tree.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/tree/combobox-tree.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} from '../signal-like/signal-like';\nimport {ExpansionItem, ListExpansion, ListExpansionInputs} from '../expansion/expansion';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../list-focus/list-focus';\nimport {\n ListNavigation,\n ListNavigationInputs,\n ListNavigationItem,\n} from '../list-navigation/list-navigation';\nimport {\n ListSelection,\n ListSelectionInputs,\n ListSelectionItem,\n} from '../list-selection/list-selection';\nimport {\n ListTypeahead,\n ListTypeaheadInputs,\n ListTypeaheadItem,\n} from '../list-typeahead/list-typeahead';\nimport {NavOptions} from '../list/list';\n\n/** Represents an item in the tree. */\nexport interface TreeItem<V, T extends TreeItem<V, T>>\n extends\n ListTypeaheadItem,\n ListNavigationItem,\n ListSelectionItem<V>,\n ListFocusItem,\n ExpansionItem {\n /** The children of this item. */\n children: SignalLike<T[] | undefined>;\n\n /** The parent of this item. */\n parent: SignalLike<T | undefined>;\n\n /** Whether this item is visible. */\n visible: SignalLike<boolean>;\n}\n\n/** The necessary inputs for the tree behavior. */\nexport type TreeInputs<T extends TreeItem<V, T>, V> = ListFocusInputs<T> &\n ListNavigationInputs<T> &\n ListSelectionInputs<T, V> &\n ListTypeaheadInputs<T> &\n ListExpansionInputs;\n\n/** Controls focus for a tree, ensuring that only visible items are focusable. */\nclass TreeListFocus<T extends TreeItem<V, T>, V> extends ListFocus<T> {\n override isFocusable(item: T): boolean {\n return super.isFocusable(item) && item.visible();\n }\n}\n\n/** Controls the state of a tree. */\nexport class Tree<T extends TreeItem<V, T>, V> {\n /** Controls navigation for the tree. */\n navigationBehavior: ListNavigation<T>;\n\n /** Controls selection for the tree. */\n selectionBehavior: ListSelection<T, V>;\n\n /** Controls typeahead for the tree. */\n typeaheadBehavior: ListTypeahead<T>;\n\n /** Controls focus for the tree. */\n focusBehavior: ListFocus<T>;\n\n /** Controls expansion for the tree. */\n expansionBehavior: ListExpansion;\n\n /** Whether the tree is disabled. */\n disabled = computed(() => this.focusBehavior.isListDisabled());\n\n /** The id of the current active item. */\n activeDescendant = computed(() => this.focusBehavior.getActiveDescendant());\n\n /** The tab index of the tree. */\n tabIndex = computed(() => this.focusBehavior.getListTabIndex());\n\n /** The index of the currently active item in the tree (within the flattened list). */\n activeIndex = computed(() => this.focusBehavior.activeIndex());\n\n /** The uncommitted index for selecting a range of options. */\n private _anchorIndex = signal(0);\n\n /** Whether the list should wrap. */\n private _wrap = signal(true);\n\n constructor(readonly inputs: TreeInputs<T, V>) {\n this.focusBehavior = new TreeListFocus<T, V>(inputs);\n this.selectionBehavior = new ListSelection<T, V>({...inputs, focusManager: this.focusBehavior});\n this.typeaheadBehavior = new ListTypeahead<T>({...inputs, focusManager: this.focusBehavior});\n this.expansionBehavior = new ListExpansion(inputs);\n this.navigationBehavior = new ListNavigation<T>({\n ...inputs,\n focusManager: this.focusBehavior,\n wrap: computed(() => this._wrap() && this.inputs.wrap()),\n });\n }\n\n /** Returns the tab index for the given item. */\n getItemTabindex(item: T) {\n return this.focusBehavior.getItemTabIndex(item);\n }\n\n /** Navigates to the first option in the tree. */\n first(opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.first(opts));\n }\n\n /** Navigates to the last option in the tree. */\n last(opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.last(opts));\n }\n\n /** Navigates to the next option in the tree. */\n next(opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.next(opts));\n }\n\n /** Navigates to the previous option in the tree. */\n prev(opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.prev(opts));\n }\n\n /** Navigates to the first child of the current active item. */\n firstChild(opts?: NavOptions<T>) {\n this._navigate(opts, () => {\n const item = this.inputs.activeItem();\n const items = item?.children?.() ?? [];\n return this.navigationBehavior.first({items, ...opts});\n });\n }\n\n /** Navigates to the last child of the current active item. */\n lastChild(opts?: NavOptions<T>) {\n this._navigate(opts, () => {\n const item = this.inputs.activeItem();\n const items = item?.children?.() ?? [];\n return this.navigationBehavior.last({items, ...opts});\n });\n }\n\n /** Navigates to the next sibling of the current active item. */\n nextSibling(opts?: NavOptions<T>) {\n this._navigate(opts, () => {\n const item = this.inputs.activeItem();\n const items = item?.parent?.()?.children?.() ?? [];\n return this.navigationBehavior.next({items, ...opts});\n });\n }\n\n /** Navigates to the previous sibling of the current active item. */\n prevSibling(opts?: NavOptions<T>) {\n this._navigate(opts, () => {\n const item = this.inputs.activeItem();\n const items = item?.parent?.()?.children?.() ?? [];\n return this.navigationBehavior.prev({items, ...opts});\n });\n }\n\n /** Navigates to the parent of the current active item. */\n parent(opts?: NavOptions<T>) {\n this._navigate(opts, () =>\n this.navigationBehavior.goto(this.inputs.activeItem()?.parent?.(), opts),\n );\n }\n\n /** Navigates to the given item in the tree. */\n goto(item: T, opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.goto(item, opts));\n }\n\n /** Removes focus from the tree. */\n unfocus() {\n this.inputs.activeItem.set(undefined);\n }\n\n /** Marks the given index as the potential start of a range selection. */\n anchor(index: number) {\n this._anchorIndex.set(index);\n }\n\n /** Handles typeahead search navigation for the tree. */\n search(char: string, opts?: NavOptions<T>) {\n this._navigate(opts, () => this.typeaheadBehavior.search(char));\n }\n\n /** Checks if the tree is currently typing for typeahead search. */\n isTyping() {\n return this.typeaheadBehavior.isTyping();\n }\n\n /** Selects the currently active item in the tree. */\n select(item?: T) {\n this.selectionBehavior.select(item);\n }\n\n /** Sets the selection to only the current active item. */\n selectOne() {\n this.selectionBehavior.selectOne();\n }\n\n /** Deselects the currently active item in the tree. */\n deselect(item?: T) {\n this.selectionBehavior.deselect(item);\n }\n\n /** Deselects all items in the tree. */\n deselectAll() {\n this.selectionBehavior.deselectAll();\n }\n\n /** Toggles the currently active item in the tree. */\n toggle(item?: T) {\n this.selectionBehavior.toggle(item);\n }\n\n /** Toggles the currently active item in the tree, deselecting all other items. */\n toggleOne() {\n this.selectionBehavior.toggleOne();\n }\n\n /** Toggles the selection of all items in the tree. */\n toggleAll() {\n this.selectionBehavior.toggleAll();\n }\n\n /** Toggles the expansion of the given item. */\n toggleExpansion(item?: T) {\n item ??= this.inputs.activeItem();\n if (!item || !this.isFocusable(item)) return;\n\n if (this.isExpandable(item)) {\n this.expansionBehavior.toggle(item);\n }\n }\n\n /** Expands the given item. */\n expand(item: T) {\n if (this.isExpandable(item)) {\n this.expansionBehavior.open(item);\n }\n }\n\n /** Collapses the given item. */\n collapse(item: T) {\n this.expansionBehavior.close(item);\n }\n\n /** Expands all sibling items of the given item (or active item). */\n expandSiblings(item?: T) {\n item ??= this.inputs.activeItem();\n if (!item) return;\n\n const parent = item.parent?.();\n // TODO: This assumes that items without a parent are root items.\n const siblings = parent ? parent.children?.() : this.inputs.items().filter(i => !i.parent?.());\n siblings?.forEach(s => this.expand(s));\n }\n\n /** Expands all items in the tree. */\n expandAll() {\n this.expansionBehavior.openAll();\n }\n\n /** Collapses all items in the tree. */\n collapseAll() {\n this.expansionBehavior.closeAll();\n }\n\n /** Checks if the given item is able to receive focus. */\n isFocusable(item: T) {\n return this.focusBehavior.isFocusable(item);\n }\n\n /** Checks if the given item is expandable. */\n isExpandable(item: T) {\n return this.expansionBehavior.isExpandable(item);\n }\n\n /** Handles updating selection for the tree. */\n updateSelection(opts: NavOptions<T> = {anchor: true}) {\n if (opts.toggle) {\n this.selectionBehavior.toggle();\n }\n if (opts.select) {\n this.selectionBehavior.select();\n }\n if (opts.selectOne) {\n this.selectionBehavior.selectOne();\n }\n if (opts.selectRange) {\n this.selectionBehavior.selectRange();\n }\n if (!opts.anchor) {\n this.anchor(this.selectionBehavior.rangeStartIndex());\n }\n }\n\n /**\n * Safely performs a navigation operation.\n */\n private _navigate(opts: NavOptions<T> = {}, operation: () => boolean) {\n if (opts?.selectRange) {\n this._wrap.set(false);\n this.selectionBehavior.rangeStartIndex.set(this._anchorIndex());\n }\n\n const moved = operation();\n\n if (moved) {\n this.updateSelection(opts);\n }\n\n this._wrap.set(true);\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, WritableSignalLike} from '../behaviors/signal-like/signal-like';\nimport {Tree, TreeItem, TreeInputs as TreeBehaviorInputs} from '../behaviors/tree/tree';\nimport {KeyboardEventManager, PointerEventManager, Modifier} from '../behaviors/event-manager';\n\n/** Represents the required inputs for a tree item. */\nexport interface TreeItemInputs<V> extends Omit<\n TreeItem<V, TreeItemPattern<V>>,\n 'index' | 'parent' | 'visible' | 'expandable'\n> {\n /** The parent item. */\n parent: SignalLike<TreeItemPattern<V> | TreePattern<V>>;\n\n /** Whether this item has children. Children can be lazily loaded. */\n hasChildren: SignalLike<boolean>;\n\n /** The tree pattern this item belongs to. */\n tree: SignalLike<TreePattern<V>>;\n}\n\n/**\n * Represents an item in a Tree.\n */\nexport class TreeItemPattern<V> implements TreeItem<V, TreeItemPattern<V>> {\n /** A unique identifier for this item. */\n readonly id: SignalLike<string> = () => this.inputs.id();\n\n /** The value of this item. */\n readonly value: SignalLike<V> = () => this.inputs.value();\n\n /** A reference to the item element. */\n readonly element: SignalLike<HTMLElement> = () => this.inputs.element()!;\n\n /** Whether the item is disabled. */\n readonly disabled: SignalLike<boolean> = () => this.inputs.disabled();\n\n /** The text used by the typeahead search. */\n readonly searchTerm: SignalLike<string> = () => this.inputs.searchTerm();\n\n /** The tree pattern this item belongs to. */\n readonly tree: SignalLike<TreePattern<V>> = () => this.inputs.tree();\n\n /** The parent item. */\n readonly parent: SignalLike<TreeItemPattern<V> | undefined> = computed(() => {\n const parent = this.inputs.parent();\n return parent instanceof TreeItemPattern ? parent : undefined;\n });\n\n /** The children items. */\n readonly children: SignalLike<TreeItemPattern<V>[]> = () => this.inputs.children() ?? [];\n\n /** The position of this item among its siblings. */\n readonly index = computed(() => this.tree().inputs.items().indexOf(this));\n\n /** Whether the item is expandable. It's expandable if children item exist. */\n readonly expandable: SignalLike<boolean> = () => this.inputs.hasChildren();\n\n /** Whether the item is selectable. */\n readonly selectable: SignalLike<boolean> = () => this.inputs.selectable();\n\n /** Whether the item is expanded. */\n readonly expanded: WritableSignalLike<boolean>;\n\n /** The level of the current item in a tree. */\n readonly level: SignalLike<number> = computed(() => this.inputs.parent().level() + 1);\n\n /** Whether this item is visible. */\n readonly visible: SignalLike<boolean> = computed(\n () => this.inputs.parent().expanded() && this.inputs.parent().visible(),\n );\n\n /** The number of items under the same parent at the same level. */\n readonly setsize = computed(() => this.inputs.parent().children().length);\n\n /** The position of this item among its siblings (1-based). */\n readonly posinset = computed(() => this.inputs.parent().children().indexOf(this) + 1);\n\n /** Whether the item is active. */\n readonly active = computed(() => this.tree().activeItem() === this);\n\n /** The tab index of the item. */\n readonly tabIndex = computed(() => this.tree().treeBehavior.getItemTabindex(this));\n\n /** Whether the item is selected. */\n readonly selected: SignalLike<boolean | undefined> = computed(() => {\n if (this.tree().nav()) {\n return undefined;\n }\n if (!this.selectable()) {\n return undefined;\n }\n return this.tree().values().includes(this.value());\n });\n\n /** The current type of this item. */\n readonly current: SignalLike<string | undefined> = computed(() => {\n if (!this.tree().nav()) {\n return undefined;\n }\n if (!this.selectable()) {\n return undefined;\n }\n return this.tree().values().includes(this.value()) ? this.tree().currentType() : undefined;\n });\n\n constructor(readonly inputs: TreeItemInputs<V>) {\n this.expanded = inputs.expanded;\n }\n}\n\n/** The selection operations that the tree can perform. */\ninterface SelectOptions {\n toggle?: boolean;\n selectOne?: boolean;\n selectRange?: boolean;\n anchor?: boolean;\n}\n\n/** Represents the required inputs for a tree. */\nexport interface TreeInputs<V> extends Omit<\n TreeBehaviorInputs<TreeItemPattern<V>, V>,\n 'multiExpandable'\n> {\n /** A unique identifier for the tree. */\n id: SignalLike<string>;\n\n /** Whether the tree is in navigation mode. */\n nav: SignalLike<boolean>;\n\n /** The aria-current type. */\n currentType: SignalLike<'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false'>;\n}\n\n/** Controls the state and interactions of a tree view. */\nexport class TreePattern<V> implements TreeInputs<V> {\n /** The tree behavior for the tree. */\n readonly treeBehavior: Tree<TreeItemPattern<V>, V>;\n\n /** The root level is 0. */\n readonly level = () => 0;\n\n /** The root is always expanded. */\n readonly expanded = () => true;\n\n /** The root is always visible. */\n readonly visible = () => true;\n\n /** The tab index of the tree. */\n readonly tabIndex: SignalLike<-1 | 0> = computed(() => this.treeBehavior.tabIndex());\n\n /** The id of the current active item. */\n readonly activeDescendant = computed(() => this.treeBehavior.activeDescendant());\n\n /** The direct children of the root (top-level tree items). */\n readonly children = computed(() =>\n this.inputs.items().filter(item => item.level() === this.level() + 1),\n );\n\n /** Whether the tree selection follows focus. */\n readonly followFocus = computed(() => this.inputs.selectionMode() === 'follow');\n\n /** Whether the tree direction is RTL. */\n readonly isRtl = computed(() => this.inputs.textDirection() === 'rtl');\n\n /** The key for navigating to the previous item. */\n readonly prevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.isRtl() ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key for navigating to the next item. */\n readonly nextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.isRtl() ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The key for collapsing an item or moving to its parent. */\n readonly collapseKey = computed(() => {\n if (this.inputs.orientation() === 'horizontal') {\n return 'ArrowUp';\n }\n return this.isRtl() ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key for expanding an item or moving to its first child. */\n readonly expandKey = computed(() => {\n if (this.inputs.orientation() === 'horizontal') {\n return 'ArrowDown';\n }\n return this.isRtl() ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** Represents the space key. Does nothing when the user is actively using typeahead. */\n readonly dynamicSpaceKey = computed(() => (this.treeBehavior.isTyping() ? '' : ' '));\n\n /** Regular expression to match characters for typeahead. */\n readonly typeaheadRegexp = /^.$/;\n\n /** The keydown event manager for the tree. */\n readonly keydown = computed(() => {\n const manager = new KeyboardEventManager();\n const tree = this.treeBehavior;\n\n manager\n .on(this.prevKey, () => tree.prev({selectOne: this.followFocus()}))\n .on(this.nextKey, () => tree.next({selectOne: this.followFocus()}))\n .on('Home', () => tree.first({selectOne: this.followFocus()}))\n .on('End', () => tree.last({selectOne: this.followFocus()}))\n .on(this.typeaheadRegexp, e => tree.search(e.key, {selectOne: this.followFocus()}))\n .on(Modifier.Shift, '*', () => tree.expandSiblings())\n .on(this.expandKey, () => this._expandOrFirstChild({selectOne: this.followFocus()}))\n .on(this.collapseKey, () => this._collapseOrParent({selectOne: this.followFocus()}));\n\n if (this.inputs.multi()) {\n manager\n // TODO: Tracking the anchor by index can break if the\n // tree is expanded or collapsed causing the index to change.\n .on(Modifier.Any, 'Shift', () => tree.anchor(this.treeBehavior.activeIndex()))\n .on(Modifier.Shift, this.prevKey, () => tree.prev({selectRange: true}))\n .on(Modifier.Shift, this.nextKey, () => tree.next({selectRange: true}))\n .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'Home', () =>\n tree.first({selectRange: true, anchor: false}),\n )\n .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'End', () =>\n tree.last({selectRange: true, anchor: false}),\n )\n .on(Modifier.Shift, 'Enter', () => tree.updateSelection({selectRange: true, anchor: false}))\n .on(Modifier.Shift, this.dynamicSpaceKey, () =>\n tree.updateSelection({selectRange: true, anchor: false}),\n );\n }\n\n if (!this.followFocus() && this.inputs.multi()) {\n manager\n .on(this.dynamicSpaceKey, () => tree.toggle())\n .on('Enter', () => tree.toggle(), {preventDefault: !this.nav()})\n .on([Modifier.Ctrl, Modifier.Meta], 'A', () => tree.toggleAll());\n }\n\n if (!this.followFocus() && !this.inputs.multi()) {\n manager.on(this.dynamicSpaceKey, () => tree.selectOne());\n manager.on('Enter', () => tree.selectOne(), {preventDefault: !this.nav()});\n }\n\n if (this.inputs.multi() && this.followFocus()) {\n manager\n .on([Modifier.Ctrl, Modifier.Meta], this.prevKey, () => tree.prev())\n .on([Modifier.Ctrl, Modifier.Meta], this.nextKey, () => tree.next())\n .on([Modifier.Ctrl, Modifier.Meta], this.expandKey, () => this._expandOrFirstChild())\n .on([Modifier.Ctrl, Modifier.Meta], this.collapseKey, () => this._collapseOrParent())\n .on([Modifier.Ctrl, Modifier.Meta], ' ', () => tree.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'Enter', () => tree.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'Home', () => tree.first())\n .on([Modifier.Ctrl, Modifier.Meta], 'End', () => tree.last())\n .on([Modifier.Ctrl, Modifier.Meta], 'A', () => {\n tree.toggleAll();\n tree.select(); // Ensure the currect item remains selected.\n });\n }\n\n return manager;\n });\n\n /** The pointerdown event manager for the tree. */\n pointerdown = computed(() => {\n const manager = new PointerEventManager();\n\n if (this.multi()) {\n manager.on(Modifier.Shift, e => this.goto(e, {selectRange: true}));\n }\n\n if (!this.multi()) {\n return manager.on(e => this.goto(e, {selectOne: true}));\n }\n\n if (this.multi() && this.followFocus()) {\n return manager\n .on(e => this.goto(e, {selectOne: true}))\n .on(Modifier.Ctrl, e => this.goto(e, {toggle: true}));\n }\n\n if (this.multi() && !this.followFocus()) {\n return manager.on(e => this.goto(e, {toggle: true}));\n }\n\n return manager;\n });\n\n /** A unique identifier for the tree. */\n readonly id: SignalLike<string> = () => this.inputs.id();\n\n /** The host native element. */\n readonly element: SignalLike<HTMLElement> = () => this.inputs.element()!;\n\n /** Whether the tree is in navigation mode. */\n readonly nav: SignalLike<boolean> = () => this.inputs.nav();\n\n /** The aria-current type. */\n readonly currentType: SignalLike<\n 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false'\n > = () => this.inputs.currentType();\n\n /** All items in the tree, in document order (DFS-like, a flattened list). */\n readonly items: SignalLike<TreeItemPattern<V>[]> = () => this.inputs.items();\n\n /** The focus strategy used by the tree. */\n readonly focusMode: SignalLike<'roving' | 'activedescendant'> = () => this.inputs.focusMode();\n\n /** Whether the tree is disabled. */\n readonly disabled: SignalLike<boolean> = () => this.inputs.disabled();\n\n /** The currently active item in the tree. */\n readonly activeItem: WritableSignalLike<TreeItemPattern<V> | undefined>;\n\n /** Whether disabled items should be focusable. */\n readonly softDisabled: SignalLike<boolean> = () => this.inputs.softDisabled();\n\n /** Whether the focus should wrap when navigating past the first or last item. */\n readonly wrap: SignalLike<boolean> = () => this.inputs.wrap();\n\n /** The orientation of the tree. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'> = () => this.inputs.orientation();\n\n /** The text direction of the tree. */\n readonly textDirection: SignalLike<'ltr' | 'rtl'> = () => this.textDirection();\n\n /** Whether multiple items can be selected at the same time. */\n readonly multi: SignalLike<boolean> = computed(() => (this.nav() ? false : this.inputs.multi()));\n\n /** The selection mode of the tree. */\n readonly selectionMode: SignalLike<'follow' | 'explicit'> = () => this.inputs.selectionMode();\n\n /** The delay in milliseconds to wait before clearing the typeahead buffer. */\n readonly typeaheadDelay: SignalLike<number> = () => this.inputs.typeaheadDelay();\n\n /** The current selected items of the tree. */\n readonly values: WritableSignalLike<V[]>;\n\n constructor(readonly inputs: TreeInputs<V>) {\n this.activeItem = inputs.activeItem;\n this.values = inputs.values;\n\n this.treeBehavior = new Tree<TreeItemPattern<V>, V>({\n ...inputs,\n multi: this.multi,\n multiExpandable: () => true,\n });\n }\n\n /**\n * Sets the tree to it's default initial state.\n *\n * Sets the active index of the tree to the first focusable selected tree item if one exists.\n * Otherwise, sets focus to the first focusable tree item.\n */\n setDefaultState() {\n let firstItem: TreeItemPattern<V> | undefined;\n\n for (const item of this.inputs.items()) {\n if (!item.visible()) continue;\n if (!this.treeBehavior.isFocusable(item)) continue;\n\n if (firstItem === undefined) {\n firstItem = item;\n }\n\n if (item.selected()) {\n this.activeItem.set(item);\n return;\n }\n }\n\n if (firstItem !== undefined) {\n this.activeItem.set(firstItem);\n }\n }\n\n /** Handles keydown events on the tree. */\n onKeydown(event: KeyboardEvent) {\n if (!this.disabled()) {\n this.keydown().handle(event);\n }\n }\n\n /** Handles pointerdown events on the tree. */\n onPointerdown(event: PointerEvent) {\n if (!this.disabled()) {\n this.pointerdown().handle(event);\n }\n }\n\n /** Navigates to the given tree item in the tree. */\n goto(e: PointerEvent, opts?: SelectOptions) {\n const item = this._getItem(e);\n if (!item) return;\n\n this.treeBehavior.goto(item, opts);\n this.treeBehavior.toggleExpansion(item);\n }\n\n /** Expands the active item if possible, otherwise navigates to the first child. */\n _expandOrFirstChild(opts?: SelectOptions) {\n const item = this.treeBehavior.inputs.activeItem();\n if (item && this.treeBehavior.isExpandable(item) && !item.expanded()) {\n this.treeBehavior.expand(item);\n } else {\n this.treeBehavior.firstChild(opts);\n }\n }\n\n /** Collapses the active item if possible, otherwise navigates to the parent. */\n _collapseOrParent(opts?: SelectOptions) {\n const item = this.treeBehavior.inputs.activeItem();\n if (item && this.treeBehavior.isExpandable(item) && item.expanded()) {\n this.treeBehavior.collapse(item);\n } else {\n this.treeBehavior.parent(opts);\n }\n }\n\n /** Retrieves the TreeItemPattern associated with a DOM event, if any. */\n protected _getItem(event: Event): TreeItemPattern<V> | undefined {\n if (!(event.target instanceof HTMLElement)) {\n return;\n }\n const element = event.target.closest('[role=\"treeitem\"]');\n return this.inputs.items().find(i => i.element() === element);\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 {TreeInputs, TreePattern, TreeItemPattern} from './tree';\nimport {computed, SignalLike} from '../behaviors/signal-like/signal-like';\nimport {ComboboxPattern, ComboboxTreeControls} from '../combobox/combobox';\n\nexport type ComboboxTreeInputs<V> = TreeInputs<V> & {\n /** The combobox controlling the tree. */\n combobox: SignalLike<ComboboxPattern<TreeItemPattern<V>, V> | undefined>;\n};\n\nexport class ComboboxTreePattern<V>\n extends TreePattern<V>\n implements ComboboxTreeControls<TreeItemPattern<V>, V>\n{\n /** Toggles to expand or collapse a tree item. */\n toggleExpansion = (item?: TreeItemPattern<V>) => this.treeBehavior.toggleExpansion(item);\n\n /** Whether the currently focused item is collapsible. */\n isItemCollapsible = () => this.inputs.activeItem()?.parent() instanceof TreeItemPattern;\n\n /** The ARIA role for the tree. */\n role = () => 'tree' as const;\n\n /* The id of the active (focused) item in the tree. */\n activeId = computed(() => this.treeBehavior.activeDescendant());\n\n /** Returns the currently active (focused) item in the tree. */\n getActiveItem = () => this.inputs.activeItem();\n\n /** The list of items in the tree. */\n override items = computed(() => this.inputs.items());\n\n /** The tab index for the tree. Always -1 because the combobox handles focus. */\n override tabIndex: SignalLike<-1 | 0> = () => -1;\n\n constructor(override readonly inputs: ComboboxTreeInputs<V>) {\n if (inputs.combobox()) {\n inputs.multi = () => false;\n inputs.focusMode = () => 'activedescendant';\n inputs.element = inputs.combobox()!.inputs.inputEl;\n }\n\n super(inputs);\n }\n\n /** Noop. The combobox handles keydown events. */\n override onKeydown(_: KeyboardEvent): void {}\n\n /** Noop. The combobox handles pointerdown events. */\n override onPointerdown(_: PointerEvent): void {}\n\n /** Noop. The combobox controls the open state. */\n override setDefaultState(): void {}\n\n /** Navigates to the specified item in the tree. */\n focus = (item: TreeItemPattern<V>) => this.treeBehavior.goto(item);\n\n /** Navigates to the next focusable item in the tree. */\n next = () => this.treeBehavior.next();\n\n /** Navigates to the previous focusable item in the tree. */\n prev = () => this.treeBehavior.prev();\n\n /** Navigates to the last focusable item in the tree. */\n last = () => this.treeBehavior.last();\n\n /** Navigates to the first focusable item in the tree. */\n first = () => this.treeBehavior.first();\n\n /** Unfocuses the currently focused item in the tree. */\n unfocus = () => this.treeBehavior.unfocus();\n\n // TODO: handle non-selectable parent nodes.\n /** Selects the specified item in the tree or the current active item if not provided. */\n select = (item?: TreeItemPattern<V>) => this.treeBehavior.select(item);\n\n /** Toggles the selection state of the given item in the tree or the current active item if not provided. */\n toggle = (item?: TreeItemPattern<V>) => this.treeBehavior.toggle(item);\n\n /** Clears the selection in the tree. */\n clearSelection = () => this.treeBehavior.deselectAll();\n\n /** Retrieves the TreeItemPattern associated with a pointer event. */\n getItem = (e: PointerEvent) => this._getItem(e);\n\n /** Retrieves the currently selected items in the tree */\n getSelectedItems = () => this.inputs.items().filter(item => item.selected());\n\n /** Sets the value of the combobox tree. */\n setValue = (value: V | undefined) => this.inputs.values.set(value ? [value] : []);\n\n /** Expands the currently focused item if it is expandable, or navigates to the first child. */\n expandItem = () => this._expandOrFirstChild();\n\n /** Collapses the currently focused item if it is expandable, or navigates to the parent. */\n collapseItem = () => this._collapseOrParent();\n\n /** Whether the specified item or the currently active item is expandable. */\n isItemExpandable(item: TreeItemPattern<V> | undefined = this.inputs.activeItem()) {\n return item ? item.expandable() : false;\n }\n\n /** Expands all of the tree items. */\n expandAll = () => this.treeBehavior.expandAll();\n\n /** Collapses all of the tree items. */\n collapseAll = () => this.treeBehavior.collapseAll();\n\n /** Whether the currently active item is selectable. */\n isItemSelectable = (item: TreeItemPattern<V> | undefined = this.inputs.activeItem()) => {\n return item ? item.selectable() : false;\n };\n}\n"],"names":["TreeListFocus","ListFocus","isFocusable","item","visible","Tree","inputs","navigationBehavior","selectionBehavior","typeaheadBehavior","focusBehavior","expansionBehavior","disabled","computed","isListDisabled","activeDescendant","getActiveDescendant","tabIndex","getListTabIndex","activeIndex","_anchorIndex","signal","_wrap","constructor","ListSelection","focusManager","ListTypeahead","ListExpansion","ListNavigation","wrap","getItemTabindex","getItemTabIndex","first","opts","_navigate","last","next","prev","firstChild","activeItem","items","children","lastChild","nextSibling","parent","prevSibling","goto","unfocus","set","undefined","anchor","index","search","char","isTyping","select","selectOne","deselect","deselectAll","toggle","toggleOne","toggleAll","toggleExpansion","isExpandable","expand","open","collapse","close","expandSiblings","siblings","filter","i","forEach","s","expandAll","openAll","collapseAll","closeAll","updateSelection","selectRange","rangeStartIndex","operation","moved","TreeItemPattern","id","value","element","searchTerm","tree","indexOf","expandable","hasChildren","selectable","expanded","level","setsize","length","posinset","active","treeBehavior","selected","nav","values","includes","current","currentType","TreePattern","followFocus","selectionMode","isRtl","textDirection","prevKey","orientation","nextKey","collapseKey","expandKey","dynamicSpaceKey","typeaheadRegexp","keydown","manager","KeyboardEventManager","on","e","key","Modifier","Shift","_expandOrFirstChild","_collapseOrParent","multi","Any","Ctrl","Meta","preventDefault","pointerdown","PointerEventManager","focusMode","softDisabled","typeaheadDelay","multiExpandable","setDefaultState","firstItem","onKeydown","event","handle","onPointerdown","_getItem","target","HTMLElement","closest","find","ComboboxTreePattern","isItemCollapsible","role","activeId","getActiveItem","combobox","inputEl","_","focus","clearSelection","getItem","getSelectedItems","setValue","expandItem","collapseItem","isItemExpandable","isItemSelectable"],"mappings":";;;;;;AAsDA,MAAMA,aAA2C,SAAQC,SAAY,CAAA;EAC1DC,WAAWA,CAACC,IAAO,EAAA;IAC1B,OAAO,KAAK,CAACD,WAAW,CAACC,IAAI,CAAC,IAAIA,IAAI,CAACC,OAAO,EAAE;AAClD;AACD;MAGYC,IAAI,CAAA;EAkCMC,MAAA;EAhCrBC,kBAAkB;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AAW,GAAGA,MAAM,IAAI,CAACuB,YAAY,CAACvB,WAAW,EAAE;EAGnD0F,gBAAgB,GAAGA,CAACnK,IAAA,GAAuC,IAAI,CAACG,MAAM,CAACiC,UAAU,EAAE,KAAI;IACrF,OAAOpC,IAAI,GAAGA,IAAI,CAACyF,UAAU,EAAE,GAAG,KAAK;GACxC;AACF;;;;"}
@@ -1,172 +1,6 @@
1
- import { signal, computed } from './_signal-like-chunk.mjs';
1
+ import { computed, signal } from './_signal-like-chunk.mjs';
2
2
  import { ListFocus, ListNavigation } from './_list-navigation-chunk.mjs';
3
-
4
- class ListSelection {
5
- inputs;
6
- rangeStartIndex = signal(0);
7
- rangeEndIndex = signal(0);
8
- selectedItems = computed(() => this.inputs.items().filter(item => this.inputs.values().includes(item.value())));
9
- constructor(inputs) {
10
- this.inputs = inputs;
11
- }
12
- select(item, opts = {
13
- anchor: true
14
- }) {
15
- item = item ?? this.inputs.focusManager.inputs.activeItem();
16
- if (!item || item.disabled() || !item.selectable() || this.inputs.values().includes(item.value())) {
17
- return;
18
- }
19
- if (!this.inputs.multi()) {
20
- this.deselectAll();
21
- }
22
- const index = this.inputs.items().findIndex(i => i === item);
23
- if (opts.anchor) {
24
- this.beginRangeSelection(index);
25
- }
26
- this.inputs.values.update(values => values.concat(item.value()));
27
- }
28
- deselect(item) {
29
- item = item ?? this.inputs.focusManager.inputs.activeItem();
30
- if (item && !item.disabled() && item.selectable()) {
31
- this.inputs.values.update(values => values.filter(value => value !== item.value()));
32
- }
33
- }
34
- toggle(item) {
35
- item = item ?? this.inputs.focusManager.inputs.activeItem();
36
- if (item) {
37
- this.inputs.values().includes(item.value()) ? this.deselect(item) : this.select(item);
38
- }
39
- }
40
- toggleOne() {
41
- const item = this.inputs.focusManager.inputs.activeItem();
42
- if (item) {
43
- this.inputs.values().includes(item.value()) ? this.deselect() : this.selectOne();
44
- }
45
- }
46
- selectAll() {
47
- if (!this.inputs.multi()) {
48
- return;
49
- }
50
- for (const item of this.inputs.items()) {
51
- this.select(item, {
52
- anchor: false
53
- });
54
- }
55
- this.beginRangeSelection();
56
- }
57
- deselectAll() {
58
- for (const value of this.inputs.values()) {
59
- const item = this.inputs.items().find(i => i.value() === value);
60
- item ? this.deselect(item) : this.inputs.values.update(values => values.filter(v => v !== value));
61
- }
62
- }
63
- toggleAll() {
64
- const selectableValues = this.inputs.items().filter(i => !i.disabled() && i.selectable()).map(i => i.value());
65
- selectableValues.every(i => this.inputs.values().includes(i)) ? this.deselectAll() : this.selectAll();
66
- }
67
- selectOne() {
68
- const item = this.inputs.focusManager.inputs.activeItem();
69
- if (item && (item.disabled() || !item.selectable())) {
70
- return;
71
- }
72
- this.deselectAll();
73
- if (this.inputs.values().length > 0 && !this.inputs.multi()) {
74
- return;
75
- }
76
- this.select();
77
- }
78
- selectRange(opts = {
79
- anchor: true
80
- }) {
81
- const isStartOfRange = this.inputs.focusManager.prevActiveIndex() === this.rangeStartIndex();
82
- if (isStartOfRange && opts.anchor) {
83
- this.beginRangeSelection(this.inputs.focusManager.prevActiveIndex());
84
- }
85
- const itemsInRange = this._getItemsFromIndex(this.rangeStartIndex());
86
- const itemsOutOfRange = this._getItemsFromIndex(this.rangeEndIndex()).filter(i => !itemsInRange.includes(i));
87
- for (const item of itemsOutOfRange) {
88
- this.deselect(item);
89
- }
90
- for (const item of itemsInRange) {
91
- this.select(item, {
92
- anchor: false
93
- });
94
- }
95
- if (itemsInRange.length) {
96
- const item = itemsInRange.pop();
97
- const index = this.inputs.items().findIndex(i => i === item);
98
- this.rangeEndIndex.set(index);
99
- }
100
- }
101
- beginRangeSelection(index = this.inputs.focusManager.activeIndex()) {
102
- this.rangeStartIndex.set(index);
103
- this.rangeEndIndex.set(index);
104
- }
105
- _getItemsFromIndex(index) {
106
- if (index === -1) {
107
- return [];
108
- }
109
- const upper = Math.max(this.inputs.focusManager.activeIndex(), index);
110
- const lower = Math.min(this.inputs.focusManager.activeIndex(), index);
111
- const items = [];
112
- for (let i = lower; i <= upper; i++) {
113
- items.push(this.inputs.items()[i]);
114
- }
115
- if (this.inputs.focusManager.activeIndex() < index) {
116
- return items.reverse();
117
- }
118
- return items;
119
- }
120
- }
121
-
122
- class ListTypeahead {
123
- inputs;
124
- timeout;
125
- focusManager;
126
- isTyping = computed(() => this._query().length > 0);
127
- _query = signal('');
128
- _startIndex = signal(undefined);
129
- constructor(inputs) {
130
- this.inputs = inputs;
131
- this.focusManager = inputs.focusManager;
132
- }
133
- search(char) {
134
- if (char.length !== 1) {
135
- return false;
136
- }
137
- if (!this.isTyping() && char === ' ') {
138
- return false;
139
- }
140
- if (this._startIndex() === undefined) {
141
- this._startIndex.set(this.focusManager.activeIndex());
142
- }
143
- clearTimeout(this.timeout);
144
- this._query.update(q => q + char.toLowerCase());
145
- const item = this._getItem();
146
- if (item) {
147
- this.focusManager.focus(item);
148
- }
149
- this.timeout = setTimeout(() => {
150
- this._query.set('');
151
- this._startIndex.set(undefined);
152
- }, this.inputs.typeaheadDelay());
153
- return true;
154
- }
155
- _getItem() {
156
- let items = this.focusManager.inputs.items();
157
- const after = items.slice(this._startIndex() + 1);
158
- const before = items.slice(0, this._startIndex());
159
- items = after.concat(before);
160
- items.push(this.inputs.items()[this._startIndex()]);
161
- const focusableItems = [];
162
- for (const item of items) {
163
- if (this.focusManager.isFocusable(item)) {
164
- focusableItems.push(item);
165
- }
166
- }
167
- return focusableItems.find(i => i.searchTerm().toLowerCase().startsWith(this._query()));
168
- }
169
- }
3
+ import { ListSelection, ListTypeahead } from './_list-typeahead-chunk.mjs';
170
4
 
171
5
  class List {
172
6
  inputs;
@@ -1 +1 @@
1
- {"version":3,"file":"_list-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","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/behaviors/list/list.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.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())\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 let items = this.focusManager.inputs.items();\n const after = items.slice(this._startIndex()! + 1);\n const before = items.slice(0, this._startIndex()!);\n items = after.concat(before);\n items.push(this.inputs.items()[this._startIndex()!]);\n\n const focusableItems = [];\n for (const item of items) {\n if (this.focusManager.isFocusable(item)) {\n focusableItems.push(item);\n }\n }\n\n return focusableItems.find(i => i.searchTerm().toLowerCase().startsWith(this._query()));\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} from '../signal-like/signal-like';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../list-focus/list-focus';\nimport {\n ListNavigation,\n ListNavigationInputs,\n ListNavigationItem,\n} from '../list-navigation/list-navigation';\nimport {\n ListSelection,\n ListSelectionInputs,\n ListSelectionItem,\n} from '../list-selection/list-selection';\nimport {\n ListTypeahead,\n ListTypeaheadInputs,\n ListTypeaheadItem,\n} from '../list-typeahead/list-typeahead';\n\n/** The operations that the list can perform after navigation. */\ninterface NavOptions {\n toggle?: boolean;\n select?: boolean;\n selectOne?: boolean;\n selectRange?: boolean;\n anchor?: boolean;\n focusElement?: boolean;\n}\n\n/** Represents an item in the list. */\nexport type ListItem<V> = ListTypeaheadItem &\n ListNavigationItem &\n ListSelectionItem<V> &\n ListFocusItem;\n\n/** The necessary inputs for the list behavior. */\nexport type ListInputs<T extends ListItem<V>, V> = ListFocusInputs<T> &\n ListNavigationInputs<T> &\n ListSelectionInputs<T, V> &\n ListTypeaheadInputs<T>;\n\n/** Controls the state of a list. */\nexport class List<T extends ListItem<V>, V> {\n /** Controls navigation for the list. */\n navigationBehavior: ListNavigation<T>;\n\n /** Controls selection for the list. */\n selectionBehavior: ListSelection<T, V>;\n\n /** Controls typeahead for the list. */\n typeaheadBehavior: ListTypeahead<T>;\n\n /** Controls focus for the list. */\n focusBehavior: ListFocus<T>;\n\n /** Whether the list is disabled. */\n disabled = computed(() => this.focusBehavior.isListDisabled());\n\n /** The id of the current active item. */\n activeDescendant = computed(() => this.focusBehavior.getActiveDescendant());\n\n /** The tab index of the list. */\n tabIndex = computed(() => this.focusBehavior.getListTabIndex());\n\n /** The index of the currently active item in the list. */\n activeIndex = computed(() => this.focusBehavior.activeIndex());\n\n /**\n * The uncommitted index for selecting a range of options.\n *\n * NOTE: This is subtly distinct from the \"rangeStartIndex\" in the ListSelection behavior.\n * The anchorIndex does not necessarily represent the start of a range, but represents the most\n * recent index where the user showed intent to begin a range selection. Usually, this is wherever\n * the user most recently pressed the \"Shift\" key, but if the user presses shift + space to select\n * from the anchor, the user is not intending to start a new range from this index.\n *\n * In other words, \"rangeStartIndex\" is only set when a user commits to starting a range selection\n * while \"anchorIndex\" is set whenever a user indicates they may be starting a range selection.\n */\n private _anchorIndex = signal(0);\n\n /** Whether the list should wrap. Used to disable wrapping while range selecting. */\n private _wrap = signal(true);\n\n constructor(readonly inputs: ListInputs<T, V>) {\n this.focusBehavior = new ListFocus(inputs);\n this.selectionBehavior = new ListSelection({...inputs, focusManager: this.focusBehavior});\n this.typeaheadBehavior = new ListTypeahead({...inputs, focusManager: this.focusBehavior});\n this.navigationBehavior = new ListNavigation({\n ...inputs,\n focusManager: this.focusBehavior,\n wrap: computed(() => this._wrap() && this.inputs.wrap()),\n });\n }\n\n /** Returns the tab index for the given item. */\n getItemTabindex(item: T) {\n return this.focusBehavior.getItemTabIndex(item);\n }\n\n /** Navigates to the first option in the list. */\n first(opts?: NavOptions) {\n this._navigate(opts, () => this.navigationBehavior.first(opts));\n }\n\n /** Navigates to the last option in the list. */\n last(opts?: NavOptions) {\n this._navigate(opts, () => this.navigationBehavior.last(opts));\n }\n\n /** Navigates to the next option in the list. */\n next(opts?: NavOptions) {\n this._navigate(opts, () => this.navigationBehavior.next(opts));\n }\n\n /** Navigates to the previous option in the list. */\n prev(opts?: NavOptions) {\n this._navigate(opts, () => this.navigationBehavior.prev(opts));\n }\n\n /** Navigates to the given item in the list. */\n goto(item: T, opts?: NavOptions) {\n this._navigate(opts, () => this.navigationBehavior.goto(item, opts));\n }\n\n /** Removes focus from the list. */\n unfocus() {\n this.inputs.activeItem.set(undefined);\n }\n\n /** Marks the given index as the potential start of a range selection. */\n anchor(index: number) {\n this._anchorIndex.set(index);\n }\n\n /** Handles typeahead search navigation for the list. */\n search(char: string, opts?: NavOptions) {\n this._navigate(opts, () => this.typeaheadBehavior.search(char));\n }\n\n /** Checks if the list is currently typing for typeahead search. */\n isTyping() {\n return this.typeaheadBehavior.isTyping();\n }\n\n /** Selects the currently active item in the list. */\n select(item?: T) {\n this.selectionBehavior.select(item);\n }\n\n /** Sets the selection to only the current active item. */\n selectOne() {\n this.selectionBehavior.selectOne();\n }\n\n /** Deselects the currently active item in the list. */\n deselect(item?: T) {\n this.selectionBehavior.deselect(item);\n }\n\n /** Deselects all items in the list. */\n deselectAll() {\n this.selectionBehavior.deselectAll();\n }\n\n /** Toggles the currently active item in the list. */\n toggle(item?: T) {\n this.selectionBehavior.toggle(item);\n }\n\n /** Toggles the currently active item in the list, deselecting all other items. */\n toggleOne() {\n this.selectionBehavior.toggleOne();\n }\n\n /** Toggles the selection of all items in the list. */\n toggleAll() {\n this.selectionBehavior.toggleAll();\n }\n\n /** Checks if the given item is able to receive focus. */\n isFocusable(item: T) {\n return this.focusBehavior.isFocusable(item);\n }\n\n /** Handles updating selection for the list. */\n updateSelection(opts: NavOptions = {anchor: true}) {\n if (opts.toggle) {\n this.selectionBehavior.toggle();\n }\n if (opts.select) {\n this.selectionBehavior.select();\n }\n if (opts.selectOne) {\n this.selectionBehavior.selectOne();\n }\n if (opts.selectRange) {\n this.selectionBehavior.selectRange();\n }\n if (!opts.anchor) {\n this.anchor(this.selectionBehavior.rangeStartIndex());\n }\n }\n\n /**\n * Safely performs a navigation operation.\n *\n * Handles conditionally disabling wrapping for when a navigation\n * operation is occurring while the user is selecting a range of options.\n *\n * Handles boilerplate calling of focus & selection operations. Also ensures these\n * additional operations are only called if the navigation operation moved focus to a new option.\n */\n private _navigate(opts: NavOptions = {}, operation: () => boolean) {\n if (opts?.selectRange) {\n this._wrap.set(false);\n this.selectionBehavior.rangeStartIndex.set(this._anchorIndex());\n }\n\n const moved = operation();\n\n if (moved) {\n this.updateSelection(opts);\n }\n\n this._wrap.set(true);\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","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","after","slice","before","focusableItems","isFocusable","searchTerm","startsWith","List","navigationBehavior","selectionBehavior","typeaheadBehavior","focusBehavior","isListDisabled","activeDescendant","getActiveDescendant","tabIndex","getListTabIndex","_anchorIndex","_wrap","ListFocus","ListNavigation","wrap","getItemTabindex","getItemTabIndex","first","_navigate","last","next","prev","goto","unfocus","updateSelection","operation","moved"],"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;AAAK,GAAA,EAAA;AACvDP,IAAAA,IAAI,GAAGA,IAAI,IAAK,IAAI,CAACR,MAAM,CAACgB,YAAY,CAAChB,MAAM,CAACiB,UAAU,EAA2B;AAErF,IAAA,IACE,CAAC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AAS,EAAE;AAEzB,IAAA,IAAIC,KAAK,EAAE;AACT,MAAA,IAAI,CAACF,eAAe,CAACxF,IAAI,CAAC;AAC5B;AAEA,IAAA,IAAI,CAAC2E,KAAK,CAAC1C,GAAG,CAAC,IAAI,CAAC;AACtB;AACD;;;;"}
1
+ {"version":3,"file":"_list-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/behaviors/list/list.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} from '../signal-like/signal-like';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../list-focus/list-focus';\nimport {\n ListNavigation,\n ListNavigationInputs,\n ListNavigationItem,\n} from '../list-navigation/list-navigation';\nimport {\n ListSelection,\n ListSelectionInputs,\n ListSelectionItem,\n} from '../list-selection/list-selection';\nimport {\n ListTypeahead,\n ListTypeaheadInputs,\n ListTypeaheadItem,\n} from '../list-typeahead/list-typeahead';\n\n/** The operations that the list can perform after navigation. */\nexport interface NavOptions<T = any> {\n toggle?: boolean;\n select?: boolean;\n selectOne?: boolean;\n selectRange?: boolean;\n anchor?: boolean;\n focusElement?: boolean;\n items?: T[];\n}\n\n/** Represents an item in the list. */\nexport type ListItem<V> = ListTypeaheadItem &\n ListNavigationItem &\n ListSelectionItem<V> &\n ListFocusItem;\n\n/** The necessary inputs for the list behavior. */\nexport type ListInputs<T extends ListItem<V>, V> = ListFocusInputs<T> &\n ListNavigationInputs<T> &\n ListSelectionInputs<T, V> &\n ListTypeaheadInputs<T>;\n\n/** Controls the state of a list. */\nexport class List<T extends ListItem<V>, V> {\n /** Controls navigation for the list. */\n navigationBehavior: ListNavigation<T>;\n\n /** Controls selection for the list. */\n selectionBehavior: ListSelection<T, V>;\n\n /** Controls typeahead for the list. */\n typeaheadBehavior: ListTypeahead<T>;\n\n /** Controls focus for the list. */\n focusBehavior: ListFocus<T>;\n\n /** Whether the list is disabled. */\n disabled = computed(() => this.focusBehavior.isListDisabled());\n\n /** The id of the current active item. */\n activeDescendant = computed(() => this.focusBehavior.getActiveDescendant());\n\n /** The tab index of the list. */\n tabIndex = computed(() => this.focusBehavior.getListTabIndex());\n\n /** The index of the currently active item in the list. */\n activeIndex = computed(() => this.focusBehavior.activeIndex());\n\n /**\n * The uncommitted index for selecting a range of options.\n *\n * NOTE: This is subtly distinct from the \"rangeStartIndex\" in the ListSelection behavior.\n * The anchorIndex does not necessarily represent the start of a range, but represents the most\n * recent index where the user showed intent to begin a range selection. Usually, this is wherever\n * the user most recently pressed the \"Shift\" key, but if the user presses shift + space to select\n * from the anchor, the user is not intending to start a new range from this index.\n *\n * In other words, \"rangeStartIndex\" is only set when a user commits to starting a range selection\n * while \"anchorIndex\" is set whenever a user indicates they may be starting a range selection.\n */\n private _anchorIndex = signal(0);\n\n /** Whether the list should wrap. Used to disable wrapping while range selecting. */\n private _wrap = signal(true);\n\n constructor(readonly inputs: ListInputs<T, V>) {\n this.focusBehavior = new ListFocus(inputs);\n this.selectionBehavior = new ListSelection({...inputs, focusManager: this.focusBehavior});\n this.typeaheadBehavior = new ListTypeahead({...inputs, focusManager: this.focusBehavior});\n this.navigationBehavior = new ListNavigation({\n ...inputs,\n focusManager: this.focusBehavior,\n wrap: computed(() => this._wrap() && this.inputs.wrap()),\n });\n }\n\n /** Returns the tab index for the given item. */\n getItemTabindex(item: T) {\n return this.focusBehavior.getItemTabIndex(item);\n }\n\n /** Navigates to the first option in the list. */\n first(opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.first(opts));\n }\n\n /** Navigates to the last option in the list. */\n last(opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.last(opts));\n }\n\n /** Navigates to the next option in the list. */\n next(opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.next(opts));\n }\n\n /** Navigates to the previous option in the list. */\n prev(opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.prev(opts));\n }\n\n /** Navigates to the given item in the list. */\n goto(item: T, opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.goto(item, opts));\n }\n\n /** Removes focus from the list. */\n unfocus() {\n this.inputs.activeItem.set(undefined);\n }\n\n /** Marks the given index as the potential start of a range selection. */\n anchor(index: number) {\n this._anchorIndex.set(index);\n }\n\n /** Handles typeahead search navigation for the list. */\n search(char: string, opts?: NavOptions) {\n this._navigate(opts, () => this.typeaheadBehavior.search(char));\n }\n\n /** Checks if the list is currently typing for typeahead search. */\n isTyping() {\n return this.typeaheadBehavior.isTyping();\n }\n\n /** Selects the currently active item in the list. */\n select(item?: T) {\n this.selectionBehavior.select(item);\n }\n\n /** Sets the selection to only the current active item. */\n selectOne() {\n this.selectionBehavior.selectOne();\n }\n\n /** Deselects the currently active item in the list. */\n deselect(item?: T) {\n this.selectionBehavior.deselect(item);\n }\n\n /** Deselects all items in the list. */\n deselectAll() {\n this.selectionBehavior.deselectAll();\n }\n\n /** Toggles the currently active item in the list. */\n toggle(item?: T) {\n this.selectionBehavior.toggle(item);\n }\n\n /** Toggles the currently active item in the list, deselecting all other items. */\n toggleOne() {\n this.selectionBehavior.toggleOne();\n }\n\n /** Toggles the selection of all items in the list. */\n toggleAll() {\n this.selectionBehavior.toggleAll();\n }\n\n /** Checks if the given item is able to receive focus. */\n isFocusable(item: T) {\n return this.focusBehavior.isFocusable(item);\n }\n\n /** Handles updating selection for the list. */\n updateSelection(opts: NavOptions = {anchor: true}) {\n if (opts.toggle) {\n this.selectionBehavior.toggle();\n }\n if (opts.select) {\n this.selectionBehavior.select();\n }\n if (opts.selectOne) {\n this.selectionBehavior.selectOne();\n }\n if (opts.selectRange) {\n this.selectionBehavior.selectRange();\n }\n if (!opts.anchor) {\n this.anchor(this.selectionBehavior.rangeStartIndex());\n }\n }\n\n /**\n * Safely performs a navigation operation.\n *\n * Handles conditionally disabling wrapping for when a navigation\n * operation is occurring while the user is selecting a range of options.\n *\n * Handles boilerplate calling of focus & selection operations. Also ensures these\n * additional operations are only called if the navigation operation moved focus to a new option.\n */\n private _navigate(opts: NavOptions = {}, operation: () => boolean) {\n if (opts?.selectRange) {\n this._wrap.set(false);\n this.selectionBehavior.rangeStartIndex.set(this._anchorIndex());\n }\n\n const moved = operation();\n\n if (moved) {\n this.updateSelection(opts);\n }\n\n this._wrap.set(true);\n }\n}\n"],"names":["List","inputs","navigationBehavior","selectionBehavior","typeaheadBehavior","focusBehavior","disabled","computed","isListDisabled","activeDescendant","getActiveDescendant","tabIndex","getListTabIndex","activeIndex","_anchorIndex","signal","_wrap","constructor","ListFocus","ListSelection","focusManager","ListTypeahead","ListNavigation","wrap","getItemTabindex","item","getItemTabIndex","first","opts","_navigate","last","next","prev","goto","unfocus","activeItem","set","undefined","anchor","index","search","char","isTyping","select","selectOne","deselect","deselectAll","toggle","toggleOne","toggleAll","isFocusable","updateSelection","selectRange","rangeStartIndex","operation","moved"],"mappings":";;;;MAkDaA,IAAI,CAAA;EA0CMC,MAAA;EAxCrBC,kBAAkB;EAGlBC,iBAAiB;EAGjBC,iBAAiB;EAGjBC,aAAa;EAGbC,QAAQ,GAAGC,QAAQ,CAAC,MAAM,IAAI,CAACF,aAAa,CAACG,cAAc,EAAE,CAAC;EAG9DC,gBAAgB,GAAGF,QAAQ,CAAC,MAAM,IAAI,CAACF,aAAa,CAACK,mBAAmB,EAAE,CAAC;EAG3EC,QAAQ,GAAGJ,QAAQ,CAAC,MAAM,IAAI,CAACF,aAAa,CAACO,eAAe,EAAE,CAAC;EAG/DC,WAAW,GAAGN,QAAQ,CAAC,MAAM,IAAI,CAACF,aAAa,CAACQ,WAAW,EAAE,CAAC;AActDC,EAAAA,YAAY,GAAGC,MAAM,CAAC,CAAC,CAAC;AAGxBC,EAAAA,KAAK,GAAGD,MAAM,CAAC,IAAI,CAAC;EAE5BE,WAAAA,CAAqBhB,MAAwB,EAAA;IAAxB,IAAM,CAAAA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KAAK,GAAGD,SAAS,EAAE;AAEzB,IAAA,IAAIC,KAAK,EAAE;AACT,MAAA,IAAI,CAACJ,eAAe,CAACvB,IAAI,CAAC;AAC5B;AAEA,IAAA,IAAI,CAACZ,KAAK,CAACoB,GAAG,CAAC,IAAI,CAAC;AACtB;AACD;;;;"}
@@ -66,27 +66,29 @@ class ListNavigation {
66
66
  next(opts) {
67
67
  return this._advance(1, opts);
68
68
  }
69
- peekNext() {
70
- return this._peek(1);
69
+ peekNext(opts) {
70
+ return this._peek(1, opts);
71
71
  }
72
72
  prev(opts) {
73
73
  return this._advance(-1, opts);
74
74
  }
75
- peekPrev() {
76
- return this._peek(-1);
75
+ peekPrev(opts) {
76
+ return this._peek(-1, opts);
77
77
  }
78
78
  first(opts) {
79
- const item = this.peekFirst();
79
+ const item = this.peekFirst(opts);
80
80
  return item ? this.goto(item, opts) : false;
81
81
  }
82
82
  last(opts) {
83
- const item = this.peekLast();
83
+ const item = this.peekLast(opts);
84
84
  return item ? this.goto(item, opts) : false;
85
85
  }
86
- peekFirst(items = this.inputs.items()) {
86
+ peekFirst(opts) {
87
+ const items = opts?.items ?? this.inputs.items();
87
88
  return items.find(i => this.inputs.focusManager.isFocusable(i));
88
89
  }
89
- peekLast(items = this.inputs.items()) {
90
+ peekLast(opts) {
91
+ const items = opts?.items ?? this.inputs.items();
90
92
  for (let i = items.length - 1; i >= 0; i--) {
91
93
  if (this.inputs.focusManager.isFocusable(items[i])) {
92
94
  return items[i];
@@ -95,13 +97,14 @@ class ListNavigation {
95
97
  return;
96
98
  }
97
99
  _advance(delta, opts) {
98
- const item = this._peek(delta);
100
+ const item = this._peek(delta, opts);
99
101
  return item ? this.goto(item, opts) : false;
100
102
  }
101
- _peek(delta) {
102
- const items = this.inputs.items();
103
+ _peek(delta, opts) {
104
+ const items = opts?.items ?? this.inputs.items();
103
105
  const itemCount = items.length;
104
- const startIndex = this.inputs.focusManager.activeIndex();
106
+ const activeItem = this.inputs.focusManager.inputs.activeItem();
107
+ const startIndex = opts?.items && activeItem ? items.indexOf(activeItem) : this.inputs.focusManager.activeIndex();
105
108
  const step = i => this.inputs.wrap() ? (i + delta + itemCount) % itemCount : i + delta;
106
109
  for (let i = step(startIndex); i !== startIndex && i < itemCount && i >= 0; i = step(i)) {
107
110
  if (this.inputs.focusManager.isFocusable(items[i])) {