@angular/aria 22.0.0-next.6 → 22.0.0-next.8

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.
Files changed (105) hide show
  1. package/fesm2022/_accordion-chunk.mjs +1 -1
  2. package/fesm2022/_accordion-chunk.mjs.map +1 -1
  3. package/fesm2022/_click-event-manager-chunk.mjs +1 -1
  4. package/fesm2022/_click-event-manager-chunk.mjs.map +1 -1
  5. package/fesm2022/{_signal-like-chunk.mjs → _collection-chunk.mjs} +51 -3
  6. package/fesm2022/_collection-chunk.mjs.map +1 -0
  7. package/fesm2022/_deferred-content-chunk.mjs +16 -14
  8. package/fesm2022/_deferred-content-chunk.mjs.map +1 -1
  9. package/fesm2022/_expansion-chunk.mjs.map +1 -1
  10. package/fesm2022/_list-chunk.mjs +4 -1
  11. package/fesm2022/_list-chunk.mjs.map +1 -1
  12. package/fesm2022/_list-navigation-chunk.mjs +4 -2
  13. package/fesm2022/_list-navigation-chunk.mjs.map +1 -1
  14. package/fesm2022/_list-typeahead-chunk.mjs +1 -1
  15. package/fesm2022/_list-typeahead-chunk.mjs.map +1 -1
  16. package/fesm2022/_menu-chunk.mjs +1 -1
  17. package/fesm2022/_menu-chunk.mjs.map +1 -1
  18. package/fesm2022/{_combobox-listbox-chunk.mjs → _option-chunk.mjs} +6 -50
  19. package/fesm2022/_option-chunk.mjs.map +1 -0
  20. package/fesm2022/_tabs-chunk.mjs +22 -47
  21. package/fesm2022/_tabs-chunk.mjs.map +1 -1
  22. package/fesm2022/_toolbar-widget-group-chunk.mjs +1 -1
  23. package/fesm2022/_toolbar-widget-group-chunk.mjs.map +1 -1
  24. package/fesm2022/_transforms-chunk.mjs +8 -0
  25. package/fesm2022/_transforms-chunk.mjs.map +1 -0
  26. package/fesm2022/{_combobox-tree-chunk.mjs → _tree-chunk.mjs} +3 -48
  27. package/fesm2022/_tree-chunk.mjs.map +1 -0
  28. package/fesm2022/_widget-chunk.mjs +84 -21
  29. package/fesm2022/_widget-chunk.mjs.map +1 -1
  30. package/fesm2022/accordion-testing.mjs.map +1 -1
  31. package/fesm2022/accordion.mjs +32 -57
  32. package/fesm2022/accordion.mjs.map +1 -1
  33. package/fesm2022/aria.mjs +1 -1
  34. package/fesm2022/aria.mjs.map +1 -1
  35. package/fesm2022/combobox-testing.mjs +79 -0
  36. package/fesm2022/combobox-testing.mjs.map +1 -0
  37. package/fesm2022/combobox.mjs +287 -296
  38. package/fesm2022/combobox.mjs.map +1 -1
  39. package/fesm2022/grid-testing.mjs +80 -0
  40. package/fesm2022/grid-testing.mjs.map +1 -0
  41. package/fesm2022/grid.mjs +113 -86
  42. package/fesm2022/grid.mjs.map +1 -1
  43. package/fesm2022/listbox-testing.mjs +4 -0
  44. package/fesm2022/listbox-testing.mjs.map +1 -1
  45. package/fesm2022/listbox.mjs +231 -225
  46. package/fesm2022/listbox.mjs.map +1 -1
  47. package/fesm2022/menu-testing.mjs +11 -0
  48. package/fesm2022/menu-testing.mjs.map +1 -1
  49. package/fesm2022/menu.mjs +66 -84
  50. package/fesm2022/menu.mjs.map +1 -1
  51. package/fesm2022/private.mjs +166 -9
  52. package/fesm2022/private.mjs.map +1 -1
  53. package/fesm2022/tabs-testing.mjs.map +1 -1
  54. package/fesm2022/tabs.mjs +241 -222
  55. package/fesm2022/tabs.mjs.map +1 -1
  56. package/fesm2022/toolbar-testing.mjs +5 -1
  57. package/fesm2022/toolbar-testing.mjs.map +1 -1
  58. package/fesm2022/toolbar.mjs +23 -33
  59. package/fesm2022/toolbar.mjs.map +1 -1
  60. package/fesm2022/tree-testing.mjs +12 -0
  61. package/fesm2022/tree-testing.mjs.map +1 -1
  62. package/fesm2022/tree.mjs +160 -156
  63. package/fesm2022/tree.mjs.map +1 -1
  64. package/package.json +10 -2
  65. package/types/_accordion-chunk.d.ts +2 -2
  66. package/types/_collection-chunk.d.ts +42 -0
  67. package/types/_expansion-chunk.d.ts +1 -1
  68. package/types/_grid-chunk.d.ts +23 -9
  69. package/types/_keyboard-event-manager-chunk.d.ts +1 -1
  70. package/types/_list-chunk.d.ts +1 -1
  71. package/types/_list-navigation-chunk.d.ts +1 -1
  72. package/types/_listbox-chunk.d.ts +1 -1
  73. package/types/_menu-chunk.d.ts +1 -1
  74. package/types/_tabs-chunk.d.ts +8 -43
  75. package/types/_toolbar-chunk.d.ts +1 -1
  76. package/types/_tree-chunk.d.ts +1 -1
  77. package/types/accordion.d.ts +7 -13
  78. package/types/combobox-testing.d.ts +63 -0
  79. package/types/combobox.d.ts +96 -192
  80. package/types/grid-testing.d.ts +83 -0
  81. package/types/grid.d.ts +102 -90
  82. package/types/listbox-testing.d.ts +25 -0
  83. package/types/listbox.d.ts +60 -63
  84. package/types/menu-testing.d.ts +6 -0
  85. package/types/menu.d.ts +24 -17
  86. package/types/private.d.ts +115 -133
  87. package/types/tabs.d.ts +26 -24
  88. package/types/toolbar-testing.d.ts +4 -0
  89. package/types/toolbar.d.ts +5 -6
  90. package/types/tree-testing.d.ts +8 -0
  91. package/types/tree.d.ts +11 -15
  92. package/fesm2022/_combobox-chunk.mjs +0 -429
  93. package/fesm2022/_combobox-chunk.mjs.map +0 -1
  94. package/fesm2022/_combobox-listbox-chunk.mjs.map +0 -1
  95. package/fesm2022/_combobox-tree-chunk.mjs.map +0 -1
  96. package/fesm2022/_element-chunk.mjs +0 -6
  97. package/fesm2022/_element-chunk.mjs.map +0 -1
  98. package/fesm2022/_pointer-event-manager-chunk.mjs +0 -54
  99. package/fesm2022/_pointer-event-manager-chunk.mjs.map +0 -1
  100. package/fesm2022/_signal-like-chunk.mjs.map +0 -1
  101. package/resources/code-examples.db +0 -0
  102. package/types/_combobox-chunk.d.ts +0 -194
  103. package/types/_element-chunk.d.ts +0 -10
  104. package/types/_pointer-event-manager-chunk.d.ts +0 -34
  105. package/types/_signal-like-chunk.d.ts +0 -14
@@ -1 +1 @@
1
- {"version":3,"file":"_list-typeahead-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/behaviors/list-selection/list-selection.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/behaviors/list-typeahead/list-typeahead.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, signal, SignalLike, WritableSignalLike} from '../signal-like/signal-like';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../list-focus/list-focus';\n\n/** Represents an item in a collection, such as a listbox option, that can be selected. */\nexport interface ListSelectionItem<V> extends ListFocusItem {\n /** The value of the item. */\n value: SignalLike<V>;\n\n /** Whether the item is selectable. */\n selectable: SignalLike<boolean>;\n}\n\n/** Represents the required inputs for a collection that contains selectable items. */\nexport interface ListSelectionInputs<T extends ListSelectionItem<V>, V> extends ListFocusInputs<T> {\n /** Whether multiple items in the list can be selected at once. */\n multi: SignalLike<boolean>;\n\n /** The current value of the list selection. */\n value: 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 readonly rangeStartIndex = signal<number>(0);\n\n /** The end index to use for range selection. */\n readonly rangeEndIndex = signal<number>(0);\n\n /** The currently selected items. */\n readonly selectedItems = computed(() =>\n this.inputs.items().filter(item => this.inputs.value().includes(item.value())),\n );\n\n constructor(readonly inputs: ListSelectionInputs<T, V> & {focusManager: ListFocus<T>}) {}\n\n /** Selects the item at the current active index. */\n select(item?: ListSelectionItem<V>, opts = {anchor: true}) {\n item = item ?? (this.inputs.focusManager.inputs.activeItem() as ListSelectionItem<V>);\n\n if (\n !item ||\n item.disabled() ||\n !item.selectable() ||\n !this.inputs.focusManager.isFocusable(item as T) ||\n this.inputs.value().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.value.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.value.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.value().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.value().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.value()) {\n const item = this.inputs.items().find(i => i.value() === value);\n\n item\n ? this.deselect(item)\n : this.inputs.value.update(values => values.filter(v => v !== value));\n }\n }\n\n /**\n * Selects all items in the list or deselects all\n * items in the list if all items are already selected.\n */\n toggleAll() {\n const selectableValues = this.inputs\n .items()\n .filter(i => !i.disabled() && i.selectable() && this.inputs.focusManager.isFocusable(i))\n .map(i => i.value());\n\n selectableValues.every(i => this.inputs.value().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.value().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 readonly focusManager: ListFocus<T>;\n\n /** Whether the user is actively typing a typeahead search query. */\n readonly isTyping = computed(() => this._query().length > 0);\n\n /** Keeps track of the characters that typeahead search is being called with. */\n private readonly _query = signal('');\n\n /** The index where that the typeahead search was initiated from. */\n private readonly _startIndex = signal<number | undefined>(undefined);\n\n constructor(readonly inputs: ListTypeaheadInputs<T> & {focusManager: ListFocus<T>}) {\n this.focusManager = inputs.focusManager;\n }\n\n /** Performs a typeahead search, appending the given character to the search string. */\n search(char: string): boolean {\n if (char.length !== 1) {\n return false;\n }\n\n if (!this.isTyping() && char === ' ') {\n return false;\n }\n\n if (this._startIndex() === undefined) {\n this._startIndex.set(this.focusManager.activeIndex());\n }\n\n clearTimeout(this.timeout);\n this._query.update(q => q + char.toLowerCase());\n const item = this._getItem();\n\n if (item) {\n this.focusManager.focus(item);\n }\n\n this.timeout = setTimeout(() => {\n this._query.set('');\n this._startIndex.set(undefined);\n }, this.inputs.typeaheadDelay());\n\n return true;\n }\n\n /**\n * Returns the first item whose search term matches the\n * current query starting from the the current anchor index.\n */\n private _getItem() {\n const items = this.focusManager.inputs.items();\n const itemCount = items.length;\n const startIndex = this._startIndex()!;\n\n for (let i = 0; i < itemCount; i++) {\n const index = (startIndex + 1 + i) % itemCount;\n const item = items[index];\n\n if (\n this.focusManager.isFocusable(item) &&\n item.searchTerm().toLowerCase().startsWith(this._query())\n ) {\n return item;\n }\n }\n\n return undefined;\n }\n}\n"],"names":["ListSelection","inputs","rangeStartIndex","signal","rangeEndIndex","selectedItems","computed","items","filter","item","value","includes","constructor","select","opts","anchor","focusManager","activeItem","disabled","selectable","isFocusable","multi","deselectAll","index","findIndex","i","beginRangeSelection","update","values","concat","deselect","toggle","toggleOne","selectOne","selectAll","find","v","toggleAll","selectableValues","map","every","length","selectRange","isStartOfRange","prevActiveIndex","itemsInRange","_getItemsFromIndex","itemsOutOfRange","pop","set","activeIndex","upper","Math","max","lower","min","push","reverse","ListTypeahead","timeout","isTyping","_query","_startIndex","undefined","search","char","clearTimeout","q","toLowerCase","_getItem","focus","setTimeout","typeaheadDelay","itemCount","startIndex","searchTerm","startsWith"],"mappings":";;MAiCaA,aAAa,CAAA;EAYHC,MAAA;AAVZC,EAAAA,eAAe,GAAGC,MAAM,CAAS,CAAC,CAAC;AAGnCC,EAAAA,aAAa,GAAGD,MAAM,CAAS,CAAC,CAAC;AAGjCE,EAAAA,aAAa,GAAGC,QAAQ,CAAC,MAChC,IAAI,CAACL,MAAM,CAACM,KAAK,EAAE,CAACC,MAAM,CAACC,IAAI,IAAI,IAAI,CAACR,MAAM,CAACS,KAAK,EAAE,CAACC,QAAQ,CAACF,IAAI,CAACC,KAAK,EAAE,CAAC,CAAC,CAC/E;EAEDE,WAAAA,CAAqBX,MAAgE,EAAA;IAAhE,IAAA,CAAAA,MAAM,GAANA,MAAM;AAA6D,EAAA;AAGxFY,EAAAA,MAAMA,CAACJ,IAA2B,EAAEK,IAAI,GAAG;AAACC,IAAAA,MAAM,EAAE;AAAI,GAAC,EAAA;AACvDN,IAAAA,IAAI,GAAGA,IAAI,IAAK,IAAI,CAACR,MAAM,CAACe,YAAY,CAACf,MAAM,CAACgB,UAAU,EAA2B;I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AA;AAMQH,EAAAA,QAAQA,GAAA;IACd,MAAM9D,KAAK,GAAG,IAAI,CAACS,YAAY,CAACf,MAAM,CAACM,KAAK,EAAE;AAC9C,IAAA,MAAMkE,SAAS,GAAGlE,KAAK,CAACkC,MAAM;AAC9B,IAAA,MAAMiC,UAAU,GAAG,IAAI,CAACZ,WAAW,EAAG;IAEtC,KAAK,IAAIrC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGgD,SAAS,EAAEhD,CAAC,EAAE,EAAE;MAClC,MAAMF,KAAK,GAAG,CAACmD,UAAU,GAAG,CAAC,GAAGjD,CAAC,IAAIgD,SAAS;AAC9C,MAAA,MAAMhE,IAAI,GAAGF,KAAK,CAACgB,KAAK,CAAC;MAEzB,IACE,IAAI,CAACP,YAAY,CAACI,WAAW,CAACX,IAAI,CAAC,IACnCA,IAAI,CAACkE,UAAU,EAAE,CAACP,WAAW,EAAE,CAACQ,UAAU,CAAC,IAAI,CAACf,MAAM,EAAE,CAAC,EACzD;AACA,QAAA,OAAOpD,IAAI;AACb,MAAA;AACF,IAAA;AAEA,IAAA,OAAOsD,SAAS;AAClB,EAAA;AACD;;;;"}
1
+ {"version":3,"file":"_list-typeahead-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/behaviors/list-selection/list-selection.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/behaviors/list-typeahead/list-typeahead.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, signal, SignalLike, WritableSignalLike} from '../signal-like/signal-like';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../list-focus/list-focus';\n\n/** Represents an item in a collection, such as a listbox option, that can be selected. */\nexport interface ListSelectionItem<V> extends ListFocusItem {\n /** The value of the item. */\n value: SignalLike<V>;\n\n /** Whether the item is selectable. */\n selectable: SignalLike<boolean>;\n}\n\n/** Represents the required inputs for a collection that contains selectable items. */\nexport interface ListSelectionInputs<T extends ListSelectionItem<V>, V> extends ListFocusInputs<T> {\n /** Whether multiple items in the list can be selected at once. */\n multi: SignalLike<boolean>;\n\n /** The current value of the list selection. */\n value: 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 readonly rangeStartIndex = signal<number>(0);\n\n /** The end index to use for range selection. */\n readonly rangeEndIndex = signal<number>(0);\n\n /** The currently selected items. */\n readonly selectedItems = computed(() =>\n this.inputs.items().filter(item => this.inputs.value().includes(item.value())),\n );\n\n constructor(readonly inputs: ListSelectionInputs<T, V> & {focusManager: ListFocus<T>}) {}\n\n /** Selects the item at the current active index. */\n select(item?: ListSelectionItem<V>, opts = {anchor: true}) {\n item = item ?? (this.inputs.focusManager.inputs.activeItem() as ListSelectionItem<V>);\n\n if (\n !item ||\n item.disabled() ||\n !item.selectable() ||\n !this.inputs.focusManager.isFocusable(item as T) ||\n this.inputs.value().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.value.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.value.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.value().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.value().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.value()) {\n const item = this.inputs.items().find(i => i.value() === value);\n\n item\n ? this.deselect(item)\n : this.inputs.value.update(values => values.filter(v => v !== value));\n }\n }\n\n /**\n * Selects all items in the list or deselects all\n * items in the list if all items are already selected.\n */\n toggleAll() {\n const selectableValues = this.inputs\n .items()\n .filter(i => !i.disabled() && i.selectable() && this.inputs.focusManager.isFocusable(i))\n .map(i => i.value());\n\n selectableValues.every(i => this.inputs.value().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.value().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 readonly focusManager: ListFocus<T>;\n\n /** Whether the user is actively typing a typeahead search query. */\n readonly isTyping = computed(() => this._query().length > 0);\n\n /** Keeps track of the characters that typeahead search is being called with. */\n private readonly _query = signal('');\n\n /** The index where that the typeahead search was initiated from. */\n private readonly _startIndex = signal<number | undefined>(undefined);\n\n constructor(readonly inputs: ListTypeaheadInputs<T> & {focusManager: ListFocus<T>}) {\n this.focusManager = inputs.focusManager;\n }\n\n /** Performs a typeahead search, appending the given character to the search string. */\n search(char: string): boolean {\n if (char.length !== 1) {\n return false;\n }\n\n if (!this.isTyping() && char === ' ') {\n return false;\n }\n\n if (this._startIndex() === undefined) {\n this._startIndex.set(this.focusManager.activeIndex());\n }\n\n clearTimeout(this.timeout);\n this._query.update(q => q + char.toLowerCase());\n const item = this._getItem();\n\n if (item) {\n this.focusManager.focus(item);\n }\n\n this.timeout = setTimeout(() => {\n this._query.set('');\n this._startIndex.set(undefined);\n }, this.inputs.typeaheadDelay());\n\n return true;\n }\n\n /**\n * Returns the first item whose search term matches the\n * current query starting from the the current anchor index.\n */\n private _getItem() {\n const items = this.focusManager.inputs.items();\n const itemCount = items.length;\n const startIndex = this._startIndex()!;\n\n for (let i = 0; i < itemCount; i++) {\n const index = (startIndex + 1 + i) % itemCount;\n const item = items[index];\n\n if (\n this.focusManager.isFocusable(item) &&\n item.searchTerm().toLowerCase().startsWith(this._query())\n ) {\n return item;\n }\n }\n\n return undefined;\n }\n}\n"],"names":["ListSelection","inputs","rangeStartIndex","signal","rangeEndIndex","selectedItems","computed","items","filter","item","value","includes","constructor","select","opts","anchor","focusManager","activeItem","disabled","selectable","isFocusable","multi","deselectAll","index","findIndex","i","beginRangeSelection","update","values","concat","deselect","toggle","toggleOne","selectOne","selectAll","find","v","toggleAll","selectableValues","map","every","length","selectRange","isStartOfRange","prevActiveIndex","itemsInRange","_getItemsFromIndex","itemsOutOfRange","pop","set","activeIndex","upper","Math","max","lower","min","push","reverse","ListTypeahead","timeout","isTyping","_query","_startIndex","undefined","search","char","clearTimeout","q","toLowerCase","_getItem","focus","setTimeout","typeaheadDelay","itemCount","startIndex","searchTerm","startsWith"],"mappings":";;MAiCaA,aAAa,CAAA;EAYHC,MAAA;AAVZC,EAAAA,eAAe,GAAGC,MAAM,CAAS,CAAC,CAAC;AAGnCC,EAAAA,aAAa,GAAGD,MAAM,CAAS,CAAC,CAAC;AAGjCE,EAAAA,aAAa,GAAGC,QAAQ,CAAC,MAChC,IAAI,CAACL,MAAM,CAACM,KAAK,EAAE,CAACC,MAAM,CAACC,IAAI,IAAI,IAAI,CAACR,MAAM,CAACS,KAAK,EAAE,CAACC,QAAQ,CAACF,IAAI,CAACC,KAAK,EAAE,CAAC,CAAC,CAC/E;EAEDE,WAAAA,CAAqBX,MAAgE,EAAA;IAAhE,IAAA,CAAAA,MAAM,GAANA,MAAM;AAA6D,EAAA;AAGxFY,EAAAA,MAAMA,CAACJ,IAA2B,EAAEK,IAAI,GAAG;AAACC,IAAAA,MAAM,EAAE;AAAI,GAAC,EAAA;AACvDN,IAAAA,IAAI,GAAGA,IAAI,IAAK,IAAI,CAACR,MAAM,CAACe,YAAY,CAACf,MAAM,CAACgB,UAAU,EAA2B;IAErF,IACE,CAACR,IAAI,IACLA,IAAI,CAACS,QAAQ,EAAE,IACf,CAACT,IAAI,CAACU,UAAU,EAAE,IAClB,CAAC,IAAI,CAAClB,MAAM,CAACe,YAAY,CAACI,WAAW,CAACX,IAAS,CAAC,IAChD,IAAI,CAACR,MAAM,CAACS,KAAK,EAAE,CAACC,QAAQ,CAACF,IAAI,CAACC,KAAK,EAAE,CAAC,EAC1C;AACA,MAAA;AACF,IAAA;IAEA,IAAI,CAAC,IAAI,CAACT,MAAM,CAACoB,KAAK,EAAE,EAAE;MACxB,IAAI,CAACC,WAAW,EAAE;AACpB,IAAA;AAEA,IAAA,MAAMC,KAAK,GAAG,IAAI,CAACtB,M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K,CAACgB,KAAK,CAAC;MAEzB,IACE,IAAI,CAACP,YAAY,CAACI,WAAW,CAACX,IAAI,CAAC,IACnCA,IAAI,CAACkE,UAAU,EAAE,CAACP,WAAW,EAAE,CAACQ,UAAU,CAAC,IAAI,CAACf,MAAM,EAAE,CAAC,EACzD;AACA,QAAA,OAAOpD,IAAI;AACb,MAAA;AACF,IAAA;AAEA,IAAA,OAAOsD,SAAS;AAClB,EAAA;AACD;;;;"}
@@ -1,4 +1,4 @@
1
- import { computed, signal, KeyboardEventManager } from './_signal-like-chunk.mjs';
1
+ import { computed, signal, KeyboardEventManager } from './_collection-chunk.mjs';
2
2
  import { List } from './_list-chunk.mjs';
3
3
 
4
4
  class MenuPattern {
@@ -1 +1 @@
1
- {"version":3,"file":"_menu-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/menu/menu.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {KeyboardEventManager} from '../behaviors/event-manager';\nimport {computed, signal, SignalLike} from '../behaviors/signal-like/signal-like';\nimport {List, ListInputs, ListItem} from '../behaviors/list/list';\n\n/** The inputs for the MenuBarPattern class. */\nexport interface MenuBarInputs<V> extends ListInputs<MenuItemPattern<V>, V> {\n /** The menu items contained in the menu. */\n items: SignalLike<MenuItemPattern<V>[]>;\n\n /** Callback function triggered when a menu item is selected. */\n itemSelected?: (value: V) => void;\n\n /** The text direction of the menu bar. */\n textDirection: SignalLike<'ltr' | 'rtl'>;\n}\n\n/** The inputs for the MenuPattern class. */\nexport interface MenuInputs<V> extends Omit<ListInputs<MenuItemPattern<V>, V>, 'value'> {\n /** The unique ID of the menu. */\n id: SignalLike<string>;\n\n /** The menu items contained in the menu. */\n items: SignalLike<MenuItemPattern<V>[]>;\n\n /** A reference to the parent menu or menu trigger. */\n parent: SignalLike<MenuTriggerPattern<V> | MenuItemPattern<V> | undefined>;\n\n /** Callback function triggered when a menu item is selected. */\n itemSelected?: (value: V) => void;\n\n /** The text direction of the menu bar. */\n textDirection: SignalLike<'ltr' | 'rtl'>;\n\n /** The delay in milliseconds before expanding sub-menus on hover. */\n expansionDelay: SignalLike<number>;\n}\n\n/** The inputs for the MenuTriggerPattern class. */\nexport interface MenuTriggerInputs<V> {\n /** A reference to the menu trigger element. */\n element: SignalLike<HTMLElement | undefined>;\n\n /** A reference to the menu associated with the trigger. */\n menu: SignalLike<MenuPattern<V> | undefined>;\n\n /** The text direction of the menu bar. */\n textDirection: SignalLike<'ltr' | 'rtl'>;\n\n /** Whether the menu trigger is disabled. */\n disabled: SignalLike<boolean>;\n}\n\n/** The inputs for the MenuItemPattern class. */\nexport interface MenuItemInputs<V> extends Omit<ListItem<V>, 'index' | 'selectable'> {\n /** A reference to the parent menu or menu trigger. */\n parent: SignalLike<MenuPattern<V> | MenuBarPattern<V> | undefined>;\n\n /** A reference to the submenu associated with the menu item. */\n submenu: SignalLike<MenuPattern<V> | undefined>;\n}\n\n/** The menu ui pattern class. */\nexport class MenuPattern<V> {\n /** The unique ID of the menu. */\n readonly id: SignalLike<string>;\n\n /** The role of the menu. */\n readonly role = () => 'menu';\n\n /** Whether the menu is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** Whether the menu is visible. */\n readonly visible = computed(() =>\n this.inputs.parent() ? !!this.inputs.parent()?.expanded() : true,\n );\n\n /** Controls list behavior for the menu items. */\n readonly listBehavior: List<MenuItemPattern<V>, V>;\n\n /** Whether the menu or any of its child elements are currently focused. */\n readonly isFocused = signal(false);\n\n /** Whether the menu has received interaction. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the menu trigger has been hovered. */\n readonly hasBeenHovered = signal(false);\n\n /** Timeout used to open sub-menus on hover. */\n _openTimeout: any;\n\n /** Timeout used to close sub-menus on hover out. */\n _closeTimeout: any;\n\n /** The tab index of the menu. */\n readonly tabIndex = () => this.listBehavior.tabIndex();\n\n /** Whether the menu should be focused on mouse over. */\n readonly shouldFocus = computed(() => {\n const root = this.root();\n\n if (root instanceof MenuTriggerPattern) {\n return true;\n }\n\n if (root instanceof MenuBarPattern || root instanceof MenuPattern) {\n return root.isFocused();\n }\n\n return false;\n });\n\n /** The key used to expand sub-menus. */\n private readonly _expandKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The key used to collapse sub-menus. */\n private readonly _collapseKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** Represents the space key. Does nothing when the user is actively using typeahead. */\n readonly dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));\n\n /** The regexp used to decide if a key should trigger typeahead. */\n readonly typeaheadRegexp = /^.$/;\n\n /** The root of the menu. */\n readonly root: SignalLike<\n MenuTriggerPattern<V> | MenuBarPattern<V> | MenuPattern<V> | undefined\n > = computed(() => {\n const parent = this.inputs.parent();\n\n if (!parent) {\n return this;\n }\n\n if (parent instanceof MenuTriggerPattern) {\n return parent;\n }\n\n const grandparent = parent.inputs.parent();\n\n if (grandparent instanceof MenuBarPattern) {\n return grandparent;\n }\n\n return grandparent?.root();\n });\n\n /** Handles keyboard events for the menu. */\n readonly keydownManager = computed(() => {\n return new KeyboardEventManager()\n .on('ArrowDown', () => this.next(), {ignoreRepeat: false})\n .on('ArrowUp', () => this.prev(), {ignoreRepeat: false})\n .on('Home', () => this.first())\n .on('End', () => this.last())\n .on('Enter', () => this.trigger())\n .on('Escape', () => this.closeAll())\n .on(this._expandKey, () => this.expand())\n .on(this._collapseKey, () => this.collapse())\n .on(this.dynamicSpaceKey, () => this.trigger())\n .on(this.typeaheadRegexp, e => this.listBehavior.search(e.key));\n });\n\n constructor(readonly inputs: MenuInputs<V>) {\n this.id = inputs.id;\n this.listBehavior = new List<MenuItemPattern<V>, V>({\n ...inputs,\n value: signal([]),\n });\n }\n\n /** Sets the default state for the menu. */\n setDefaultState() {\n if (!this.inputs.parent()) {\n const firstFocusable = this.listBehavior.navigationBehavior.peekFirst();\n if (firstFocusable) {\n this.listBehavior.goto(firstFocusable, {focusElement: false});\n }\n }\n }\n\n /** Sets the default active state of the menu before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted() || this.hasBeenHovered()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\n }\n\n /** Handles keyboard events for the menu. */\n onKeydown(event: KeyboardEvent) {\n this.hasBeenInteracted.set(true);\n this.keydownManager().handle(event);\n }\n\n /** Handles mouseover events for the menu. */\n onMouseOver(event: MouseEvent) {\n if (!this.visible()) {\n return;\n }\n\n this.hasBeenHovered.set(true);\n const item = this.inputs.items().find(i => i.element()?.contains(event.target as Node));\n\n if (!item) {\n return;\n }\n\n const parent = this.inputs.parent();\n const activeItem = this?.inputs.activeItem();\n\n if (parent instanceof MenuItemPattern) {\n const grandparent = parent.inputs.parent();\n if (grandparent instanceof MenuPattern) {\n grandparent._clearTimeouts();\n grandparent.listBehavior.goto(parent, {focusElement: false});\n }\n }\n\n if (activeItem && activeItem !== item) {\n this._closeItem(activeItem);\n }\n\n if (item.expanded()) {\n this._clearCloseTimeout();\n }\n\n this._openItem(item);\n this.listBehavior.goto(item, {focusElement: this.shouldFocus()});\n }\n\n /** Closes the specified menu item after a delay. */\n private _closeItem(item: MenuItemPattern<V>) {\n this._clearOpenTimeout();\n\n if (!this._closeTimeout) {\n this._closeTimeout = setTimeout(() => {\n item.close();\n this._closeTimeout = undefined;\n }, this.inputs.expansionDelay());\n }\n }\n\n /** Opens the specified menu item after a delay. */\n private _openItem(item: MenuItemPattern<V>) {\n this._clearOpenTimeout();\n\n this._openTimeout = setTimeout(() => {\n item.open();\n this._openTimeout = undefined;\n }, this.inputs.expansionDelay());\n }\n\n /** Handles mouseout events for the menu. */\n onMouseOut(event: MouseEvent) {\n this._clearOpenTimeout();\n\n if (this.isFocused()) {\n return;\n }\n\n const root = this.root();\n const parent = this.inputs.parent();\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!root || !parent || parent instanceof MenuTriggerPattern) {\n return;\n }\n\n const grandparent = parent.inputs.parent();\n\n if (!grandparent || grandparent instanceof MenuBarPattern) {\n return;\n }\n\n if (!grandparent.inputs.element()?.contains(relatedTarget)) {\n parent.close();\n }\n }\n\n /** Handles click events for the menu. */\n onClick(event: MouseEvent) {\n const relatedTarget = event.target as Node | null;\n const item = this.inputs.items().find(i => i.element()?.contains(relatedTarget));\n\n if (item) {\n item.open();\n this.listBehavior.goto(item);\n this.submit(item);\n }\n }\n\n /** Handles focusin events for the menu. */\n onFocusIn() {\n this.isFocused.set(true);\n this.hasBeenInteracted.set(true);\n }\n\n /** Handles the focusout event for the menu. */\n onFocusOut(event: FocusEvent) {\n const parent = this.inputs.parent();\n const parentEl = parent?.inputs.element();\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!relatedTarget) {\n this.isFocused.set(false);\n this.inputs.parent()?.close({refocus: true});\n }\n\n if (parent instanceof MenuItemPattern) {\n const grandparent = parent.inputs.parent();\n const siblings = grandparent?.inputs.items().filter(i => i !== parent);\n const item = siblings?.find(i => i.element()?.contains(relatedTarget));\n\n if (item) {\n return;\n }\n }\n\n if (\n this.visible() &&\n !parentEl?.contains(relatedTarget) &&\n !this.inputs.element()?.contains(relatedTarget)\n ) {\n this.isFocused.set(false);\n this.inputs.parent()?.close();\n }\n }\n\n /** Focuses the previous menu item. */\n prev() {\n this.inputs.activeItem()?.close();\n this.listBehavior.prev();\n }\n\n /** Focuses the next menu item. */\n next() {\n this.inputs.activeItem()?.close();\n this.listBehavior.next();\n }\n\n /** Focuses the first menu item. */\n first() {\n this.inputs.activeItem()?.close();\n this.listBehavior.first();\n }\n\n /** Focuses the last menu item. */\n last() {\n this.inputs.activeItem()?.close();\n this.listBehavior.last();\n }\n\n /** Triggers the active menu item. */\n trigger() {\n this.inputs.activeItem()?.hasPopup()\n ? this.inputs.activeItem()?.open({first: true})\n : this.submit();\n }\n\n /** Submits the menu. */\n submit(item = this.inputs.activeItem()) {\n if (!item || item.disabled() || item.submenu()) {\n return;\n }\n\n const root = this.root();\n\n if (root instanceof MenuTriggerPattern) {\n root.close({refocus: true});\n root?.inputs.menu()?.inputs.itemSelected?.(item.value());\n } else if (root instanceof MenuBarPattern) {\n root.close();\n root?.inputs.itemSelected?.(item.value());\n } else if (root instanceof MenuPattern) {\n root.inputs.activeItem()?.close({refocus: true});\n root?.inputs.itemSelected?.(item.value());\n }\n }\n\n /** Collapses the current menu or focuses the previous item in the menubar. */\n collapse() {\n const root = this.root();\n const parent = this.inputs.parent();\n\n if (parent instanceof MenuItemPattern && !(parent.inputs.parent() instanceof MenuBarPattern)) {\n parent.close({refocus: true});\n } else if (root instanceof MenuBarPattern) {\n root.prev();\n }\n }\n\n /** Expands the current menu or focuses the next item in the menubar. */\n expand() {\n const root = this.root();\n const activeItem = this.inputs.activeItem();\n\n if (activeItem?.submenu()) {\n activeItem.open({first: true});\n } else if (root instanceof MenuBarPattern) {\n root.next();\n }\n }\n\n /** Closes the menu. */\n close() {\n this.inputs.parent()?.close();\n }\n\n /** Closes the menu and all parent menus. */\n closeAll() {\n const root = this.root();\n\n if (root instanceof MenuTriggerPattern) {\n root.close({refocus: true});\n }\n\n if (root instanceof MenuBarPattern) {\n root.close();\n }\n\n if (root instanceof MenuPattern) {\n root.inputs.activeItem()?.close({refocus: true});\n }\n }\n\n /** Clears any open or close timeouts for sub-menus. */\n _clearTimeouts() {\n this._clearOpenTimeout();\n this._clearCloseTimeout();\n }\n\n /** Clears the open timeout. */\n _clearOpenTimeout() {\n if (this._openTimeout) {\n clearTimeout(this._openTimeout);\n this._openTimeout = undefined;\n }\n }\n\n /** Clears the close timeout. */\n _clearCloseTimeout() {\n if (this._closeTimeout) {\n clearTimeout(this._closeTimeout);\n this._closeTimeout = undefined;\n }\n }\n}\n\n/** The menubar ui pattern class. */\nexport class MenuBarPattern<V> {\n /** Controls list behavior for the menu items. */\n readonly listBehavior: List<MenuItemPattern<V>, V>;\n\n /** The tab index of the menu. */\n readonly tabIndex = () => this.listBehavior.tabIndex();\n\n /** The key used to navigate to the next item. */\n private readonly _nextKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The key used to navigate to the previous item. */\n private readonly _previousKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** Represents the space key. Does nothing when the user is actively using typeahead. */\n readonly dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));\n\n /** The regexp used to decide if a key should trigger typeahead. */\n readonly typeaheadRegexp = /^.$/;\n\n /** Whether the menubar or any of its children are currently focused. */\n readonly isFocused = signal(false);\n\n /** Whether the menubar has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the menubar is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** Handles keyboard events for the menu. */\n readonly keydownManager = computed(() => {\n return new KeyboardEventManager()\n .on(this._nextKey, () => this.next(), {ignoreRepeat: false})\n .on(this._previousKey, () => this.prev(), {ignoreRepeat: false})\n .on('End', () => this.listBehavior.last())\n .on('Home', () => this.listBehavior.first())\n .on('Enter', () => this.inputs.activeItem()?.open({first: true}))\n .on('ArrowUp', () => this.inputs.activeItem()?.open({last: true}))\n .on('ArrowDown', () => this.inputs.activeItem()?.open({first: true}))\n .on(this.dynamicSpaceKey, () => this.inputs.activeItem()?.open({first: true}))\n .on(this.typeaheadRegexp, e => this.listBehavior.search(e.key));\n });\n\n constructor(readonly inputs: MenuBarInputs<V>) {\n this.listBehavior = new List<MenuItemPattern<V>, V>(inputs);\n }\n\n /** Sets the default state for the menubar. */\n setDefaultState() {\n const firstFocusable = this.listBehavior.navigationBehavior.peekFirst();\n if (firstFocusable) {\n this.inputs.activeItem.set(firstFocusable);\n }\n }\n\n /** Sets the default active state of the menubar before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\n }\n\n /** Handles keyboard events for the menu. */\n onKeydown(event: KeyboardEvent) {\n this.hasBeenInteracted.set(true);\n this.keydownManager().handle(event);\n }\n\n /** Handles click events for the menu bar. */\n onClick(event: MouseEvent) {\n const item = this.inputs.items().find(i => i.element()?.contains(event.target as Node));\n\n if (!item) {\n return;\n }\n\n this.goto(item);\n item.expanded() ? item.close() : item.open();\n }\n\n /** Handles mouseover events for the menu bar. */\n onMouseOver(event: MouseEvent) {\n const item = this.inputs.items().find(i => i.element()?.contains(event.target as Node));\n\n if (item) {\n this.goto(item, {focusElement: this.isFocused()});\n }\n }\n\n /** Handles focusin events for the menu bar. */\n onFocusIn() {\n this.isFocused.set(true);\n this.hasBeenInteracted.set(true);\n }\n\n /** Handles focusout events for the menu bar. */\n onFocusOut(event: FocusEvent) {\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!this.inputs.element()?.contains(relatedTarget)) {\n this.isFocused.set(false);\n this.close();\n }\n }\n\n /** Goes to and optionally focuses the specified menu item. */\n goto(item: MenuItemPattern<V>, opts?: {focusElement?: boolean}) {\n const prevItem = this.inputs.activeItem();\n this.listBehavior.goto(item, opts);\n\n if (prevItem?.expanded()) {\n prevItem?.close();\n this.inputs.activeItem()?.open();\n }\n\n if (item === prevItem) {\n if (item.expanded() && item.submenu()?.inputs.activeItem()) {\n item.submenu()?.inputs.activeItem()?.close();\n item.submenu()?.listBehavior.unfocus();\n }\n }\n }\n\n /** Focuses the next menu item. */\n next() {\n const prevItem = this.inputs.activeItem();\n this.listBehavior.next();\n\n if (prevItem?.expanded()) {\n prevItem?.close();\n this.inputs.activeItem()?.open({first: true});\n }\n }\n\n /** Focuses the previous menu item. */\n prev() {\n const prevItem = this.inputs.activeItem();\n this.listBehavior.prev();\n\n if (prevItem?.expanded()) {\n prevItem?.close();\n this.inputs.activeItem()?.open({first: true});\n }\n }\n\n /** Closes the menubar and refocuses the root menu bar item. */\n close() {\n this.inputs.activeItem()?.close({refocus: this.isFocused()});\n }\n}\n\n/** The menu trigger ui pattern class. */\nexport class MenuTriggerPattern<V> {\n /** Whether the menu trigger is expanded. */\n readonly expanded = signal(false);\n\n /** Whether the menu trigger has received interaction. */\n readonly hasBeenInteracted = signal(false);\n\n /** The role of the menu trigger. */\n readonly role = () => 'button';\n\n /** Whether the menu trigger has a popup. */\n readonly hasPopup = () => true;\n\n /** The menu associated with the trigger. */\n readonly menu: SignalLike<MenuPattern<V> | undefined>;\n\n /** The tab index of the menu trigger. */\n readonly tabIndex = computed(() =>\n this.expanded() && this.menu()?.inputs.activeItem() ? -1 : 0,\n );\n\n /** Whether the menu trigger is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** Handles keyboard events for the menu trigger. */\n readonly keydownManager = computed(() => {\n return new KeyboardEventManager()\n .on(' ', () => this.open({first: true}))\n .on('Enter', () => this.open({first: true}))\n .on('ArrowDown', () => this.open({first: true}))\n .on('ArrowUp', () => this.open({last: true}))\n .on('Escape', () => this.close({refocus: true}));\n });\n\n constructor(readonly inputs: MenuTriggerInputs<V>) {\n this.menu = this.inputs.menu;\n }\n\n /** Handles keyboard events for the menu trigger. */\n onKeydown(event: KeyboardEvent) {\n if (!this.inputs.disabled()) {\n this.hasBeenInteracted.set(true);\n this.keydownManager().handle(event);\n }\n }\n\n /** Handles click events for the menu trigger. */\n onClick() {\n if (!this.inputs.disabled()) {\n this.expanded() ? this.close() : this.open({first: true});\n }\n }\n\n /** Handles focusin events for the menu trigger. */\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n\n /** Handles focusout events for the menu trigger. */\n onFocusOut(event: FocusEvent) {\n const element = this.inputs.element();\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (\n this.expanded() &&\n !element?.contains(relatedTarget) &&\n !this.inputs.menu()?.inputs.element()?.contains(relatedTarget)\n ) {\n this.close();\n }\n }\n\n /** Opens the menu. */\n open(opts?: {first?: boolean; last?: boolean}) {\n this.expanded.set(true);\n\n if (opts?.first) {\n this.inputs.menu()?.first();\n } else if (opts?.last) {\n this.inputs.menu()?.last();\n }\n }\n\n /** Closes the menu. */\n close(opts: {refocus?: boolean} = {}) {\n this.expanded.set(false);\n this.menu()?.listBehavior.unfocus();\n\n if (opts.refocus) {\n this.inputs.element()?.focus();\n }\n\n let menuitems = this.inputs.menu()?.inputs.items() ?? [];\n\n while (menuitems.length) {\n const menuitem = menuitems.pop();\n menuitem?._expanded.set(false);\n menuitem?.inputs.parent()?.listBehavior.unfocus();\n menuitems = menuitems.concat(menuitem?.submenu()?.inputs.items() ?? []);\n }\n }\n}\n\n/** The menu item ui pattern class. */\nexport class MenuItemPattern<V> implements ListItem<V> {\n /** The value of the menu item. */\n readonly value: SignalLike<V>;\n\n /** The unique ID of the menu item. */\n readonly id: SignalLike<string>;\n\n /** Whether the menu item is disabled. */\n readonly disabled = () => this.inputs.parent()?.disabled() || this.inputs.disabled();\n\n /** The search term for the menu item. */\n readonly searchTerm: SignalLike<string>;\n\n /** The element of the menu item. */\n readonly element: SignalLike<HTMLElement | undefined>;\n\n /** Whether the menu item is active. */\n readonly active = computed(() => this.inputs.parent()?.inputs.activeItem() === this);\n\n /** Whether the menu item has received interaction. */\n readonly hasBeenInteracted = signal(false);\n\n /** The tab index of the menu item. */\n readonly tabIndex = computed(() => {\n if (this.submenu() && this.submenu()?.inputs.activeItem()) {\n return -1;\n }\n return this.inputs.parent()?.listBehavior.getItemTabindex(this) ?? -1;\n });\n\n /** The position of the menu item in the menu. */\n readonly index = computed(() => this.inputs.parent()?.inputs.items().indexOf(this) ?? -1);\n\n /** Whether the menu item is expanded. */\n readonly expanded = computed(() => (this.submenu() ? this._expanded() : null));\n\n /** Whether the menu item is expanded. */\n readonly _expanded = signal(false);\n\n /** The ID of the menu that the menu item controls. */\n readonly controls = signal<string | undefined>(undefined);\n\n /** The role of the menu item. */\n readonly role = () => 'menuitem';\n\n /** Whether the menu item has a popup. */\n readonly hasPopup = computed(() => !!this.submenu());\n\n /** The submenu associated with the menu item. */\n readonly submenu: SignalLike<MenuPattern<V> | undefined>;\n\n /** Whether the menu item is selectable. */\n readonly selectable: SignalLike<boolean>;\n\n constructor(readonly inputs: MenuItemInputs<V>) {\n this.id = inputs.id;\n this.value = inputs.value;\n this.element = inputs.element;\n this.submenu = this.inputs.submenu;\n this.searchTerm = inputs.searchTerm;\n this.selectable = computed(() => !this.submenu());\n }\n\n /** Opens the submenu. */\n open(opts?: {first?: boolean; last?: boolean}) {\n if (this.disabled()) {\n return;\n }\n\n this._expanded.set(true);\n\n if (opts?.first) {\n this.submenu()?.first();\n }\n if (opts?.last) {\n this.submenu()?.last();\n }\n }\n\n /** Closes the submenu. */\n close(opts: {refocus?: boolean} = {}) {\n this._expanded.set(false);\n\n if (opts.refocus) {\n this.inputs.parent()?.listBehavior.goto(this);\n }\n\n let menuitems = this.inputs.submenu()?.inputs.items() ?? [];\n\n while (menuitems.length) {\n const menuitem = menuitems.pop();\n menuitem?._expanded.set(false);\n menuitem?.inputs.parent()?.listBehavior.unfocus();\n menuitems = menuitems.concat(menuitem?.submenu()?.inputs.items() ?? []);\n\n const parent = menuitem?.inputs.parent();\n\n if (parent instanceof MenuPattern) {\n parent._clearTimeouts();\n }\n }\n }\n\n /** Handles focusin events for the menu item. */\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n}\n"],"names":["MenuPattern","inputs","id","role","disabled","visible","computed","parent","expanded","listBehavior","isFocused","signal","hasBeenInteracted","hasBeenHovered","_openTimeout","_closeTimeout","tabIndex","shouldFocus","root","MenuTriggerPattern","MenuBarPattern","_expandKey","textDirection","_collapseKey","dynamicSpaceKey","isTyping","typeaheadRegexp","grandparent","keydownManager","KeyboardEventManager","on","next","ignoreRepeat","prev","first","last","trigger","closeAll","expand","collapse","e","search","key","constructor","List","value","setDefaultState","firstFocusable","navigationBehavior","peekFirst","goto","focusElement","setDefaultStateEffect","items","length","onKeydown","event","set","handle","onMouseOver","item","find","i","element","contains","target","activeItem","MenuItemPattern","_clearTimeouts","_closeItem","_clearCloseTimeout","_openItem","_clearOpenTimeout","setTimeout","close","undefined","expansionDelay","open","onMouseOut","relatedTarget","onClick","submit","onFocusIn","onFocusOut","parentEl","refocus","siblings","filter","hasPopup","submenu","menu","itemSelected","clearTimeout","_nextKey","_previousKey","opts","prevItem","unfocus","focus","menuitems","menuitem","pop","_expanded","concat","searchTerm","active","getItemTabindex","index","indexOf","controls","selectable"],"mappings":";;;MAsEaA,WAAW,CAAA;EAyGDC,MAAA;EAvGZC,EAAE;EAGFC,IAAI,GAAGA,MAAM,MAAM;EAGnBC,QAAQ,GAAGA,MAAM,IAAI,CAACH,MAAM,CAACG,QAAQ,EAAE;EAGvCC,OAAO,GAAGC,QAAQ,CAAC,MAC1B,IAAI,CAACL,MAAM,CAACM,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,CAACN,MAAM,CAACM,MAAM,EAAE,EAAEC,QAAQ,EAAE,GAAG,IAAI,CACjE;EAGQC,YAAY;AAGZC,EAAAA,SAAS,GAAGC,MAAM,CAAC,KAAK,CAAC;AAGzBC,EAAAA,iBAAiB,GAAGD,MAAM,CAAC,KAAK,CAAC;AAGjCE,EAAAA,cAAc,GAAGF,MAAM,CAAC,KAAK,CAAC;EAGvCG,YAAY;EAGZC,aAAa;EAGJC,QAAQ,GAAGA,MAAM,IAAI,CAACP,YAAY,CAACO,QAAQ,EAAE;EAG7CC,WAAW,GAAGX,QAAQ,CAAC,MAAK;AACnC,IAAA,MAAMY,IAAI,GAAG,IAAI,CAACA,IAAI,EAAE;IAExB,IAAIA,IAAI,YAAYC,kBAAkB,EAAE;AACtC,MAAA,OAAO,IAAI;AACb,IAAA;AAEA,IAAA,IAAID,IAAI,YAAYE,cAAc,IAAIF,IAAI,YAAYlB,WAAW,EAAE;AACjE,MAAA,OAAOkB,IAAI,CAACR,SAAS,EAAE;AACzB,IAAA;AAEA,IAAA,OAAO,KAAK;AACd,EAAA,C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zB,MAAA;AACF,IAAA;AACF,EAAA;AAGAc,EAAAA,SAASA,GAAA;AACP,IAAA,IAAI,CAACtE,iBAAiB,CAAC6C,GAAG,CAAC,IAAI,CAAC;AAClC,EAAA;AACD;;;;"}
1
+ {"version":3,"file":"_menu-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/menu/menu.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {KeyboardEventManager} from '../behaviors/event-manager';\nimport {computed, signal, SignalLike} from '../behaviors/signal-like/signal-like';\nimport {List, ListInputs, ListItem} from '../behaviors/list/list';\n\n/** The inputs for the MenuBarPattern class. */\nexport interface MenuBarInputs<V> extends ListInputs<MenuItemPattern<V>, V> {\n /** The menu items contained in the menu. */\n items: SignalLike<MenuItemPattern<V>[]>;\n\n /** Callback function triggered when a menu item is selected. */\n itemSelected?: (value: V) => void;\n\n /** The text direction of the menu bar. */\n textDirection: SignalLike<'ltr' | 'rtl'>;\n}\n\n/** The inputs for the MenuPattern class. */\nexport interface MenuInputs<V> extends Omit<ListInputs<MenuItemPattern<V>, V>, 'value'> {\n /** The unique ID of the menu. */\n id: SignalLike<string>;\n\n /** The menu items contained in the menu. */\n items: SignalLike<MenuItemPattern<V>[]>;\n\n /** A reference to the parent menu or menu trigger. */\n parent: SignalLike<MenuTriggerPattern<V> | MenuItemPattern<V> | undefined>;\n\n /** Callback function triggered when a menu item is selected. */\n itemSelected?: (value: V) => void;\n\n /** The text direction of the menu bar. */\n textDirection: SignalLike<'ltr' | 'rtl'>;\n\n /** The delay in milliseconds before expanding sub-menus on hover. */\n expansionDelay: SignalLike<number>;\n}\n\n/** The inputs for the MenuTriggerPattern class. */\nexport interface MenuTriggerInputs<V> {\n /** A reference to the menu trigger element. */\n element: SignalLike<HTMLElement | undefined>;\n\n /** A reference to the menu associated with the trigger. */\n menu: SignalLike<MenuPattern<V> | undefined>;\n\n /** The text direction of the menu bar. */\n textDirection: SignalLike<'ltr' | 'rtl'>;\n\n /** Whether the menu trigger is disabled. */\n disabled: SignalLike<boolean>;\n}\n\n/** The inputs for the MenuItemPattern class. */\nexport interface MenuItemInputs<V> extends Omit<ListItem<V>, 'index' | 'selectable'> {\n /** A reference to the parent menu or menu trigger. */\n parent: SignalLike<MenuPattern<V> | MenuBarPattern<V> | undefined>;\n\n /** A reference to the submenu associated with the menu item. */\n submenu: SignalLike<MenuPattern<V> | undefined>;\n}\n\n/** The menu ui pattern class. */\nexport class MenuPattern<V> {\n /** The unique ID of the menu. */\n readonly id: SignalLike<string>;\n\n /** The role of the menu. */\n readonly role = () => 'menu';\n\n /** Whether the menu is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** Whether the menu is visible. */\n readonly visible = computed(() =>\n this.inputs.parent() ? !!this.inputs.parent()?.expanded() : true,\n );\n\n /** Controls list behavior for the menu items. */\n readonly listBehavior: List<MenuItemPattern<V>, V>;\n\n /** Whether the menu or any of its child elements are currently focused. */\n readonly isFocused = signal(false);\n\n /** Whether the menu has received interaction. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the menu trigger has been hovered. */\n readonly hasBeenHovered = signal(false);\n\n /** Timeout used to open sub-menus on hover. */\n _openTimeout: any;\n\n /** Timeout used to close sub-menus on hover out. */\n _closeTimeout: any;\n\n /** The tab index of the menu. */\n readonly tabIndex = () => this.listBehavior.tabIndex();\n\n /** Whether the menu should be focused on mouse over. */\n readonly shouldFocus = computed(() => {\n const root = this.root();\n\n if (root instanceof MenuTriggerPattern) {\n return true;\n }\n\n if (root instanceof MenuBarPattern || root instanceof MenuPattern) {\n return root.isFocused();\n }\n\n return false;\n });\n\n /** The key used to expand sub-menus. */\n private readonly _expandKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The key used to collapse sub-menus. */\n private readonly _collapseKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** Represents the space key. Does nothing when the user is actively using typeahead. */\n readonly dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));\n\n /** The regexp used to decide if a key should trigger typeahead. */\n readonly typeaheadRegexp = /^.$/;\n\n /** The root of the menu. */\n readonly root: SignalLike<\n MenuTriggerPattern<V> | MenuBarPattern<V> | MenuPattern<V> | undefined\n > = computed(() => {\n const parent = this.inputs.parent();\n\n if (!parent) {\n return this;\n }\n\n if (parent instanceof MenuTriggerPattern) {\n return parent;\n }\n\n const grandparent = parent.inputs.parent();\n\n if (grandparent instanceof MenuBarPattern) {\n return grandparent;\n }\n\n return grandparent?.root();\n });\n\n /** Handles keyboard events for the menu. */\n readonly keydownManager = computed(() => {\n return new KeyboardEventManager()\n .on('ArrowDown', () => this.next(), {ignoreRepeat: false})\n .on('ArrowUp', () => this.prev(), {ignoreRepeat: false})\n .on('Home', () => this.first())\n .on('End', () => this.last())\n .on('Enter', () => this.trigger())\n .on('Escape', () => this.closeAll())\n .on(this._expandKey, () => this.expand())\n .on(this._collapseKey, () => this.collapse())\n .on(this.dynamicSpaceKey, () => this.trigger())\n .on(this.typeaheadRegexp, e => this.listBehavior.search(e.key));\n });\n\n constructor(readonly inputs: MenuInputs<V>) {\n this.id = inputs.id;\n this.listBehavior = new List<MenuItemPattern<V>, V>({\n ...inputs,\n value: signal([]),\n });\n }\n\n /** Sets the default state for the menu. */\n setDefaultState() {\n if (!this.inputs.parent()) {\n const firstFocusable = this.listBehavior.navigationBehavior.peekFirst();\n if (firstFocusable) {\n this.listBehavior.goto(firstFocusable, {focusElement: false});\n }\n }\n }\n\n /** Sets the default active state of the menu before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted() || this.hasBeenHovered()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\n }\n\n /** Handles keyboard events for the menu. */\n onKeydown(event: KeyboardEvent) {\n this.hasBeenInteracted.set(true);\n this.keydownManager().handle(event);\n }\n\n /** Handles mouseover events for the menu. */\n onMouseOver(event: MouseEvent) {\n if (!this.visible()) {\n return;\n }\n\n this.hasBeenHovered.set(true);\n const item = this.inputs.items().find(i => i.element()?.contains(event.target as Node));\n\n if (!item) {\n return;\n }\n\n const parent = this.inputs.parent();\n const activeItem = this?.inputs.activeItem();\n\n if (parent instanceof MenuItemPattern) {\n const grandparent = parent.inputs.parent();\n if (grandparent instanceof MenuPattern) {\n grandparent._clearTimeouts();\n grandparent.listBehavior.goto(parent, {focusElement: false});\n }\n }\n\n if (activeItem && activeItem !== item) {\n this._closeItem(activeItem);\n }\n\n if (item.expanded()) {\n this._clearCloseTimeout();\n }\n\n this._openItem(item);\n this.listBehavior.goto(item, {focusElement: this.shouldFocus()});\n }\n\n /** Closes the specified menu item after a delay. */\n private _closeItem(item: MenuItemPattern<V>) {\n this._clearOpenTimeout();\n\n if (!this._closeTimeout) {\n this._closeTimeout = setTimeout(() => {\n item.close();\n this._closeTimeout = undefined;\n }, this.inputs.expansionDelay());\n }\n }\n\n /** Opens the specified menu item after a delay. */\n private _openItem(item: MenuItemPattern<V>) {\n this._clearOpenTimeout();\n\n this._openTimeout = setTimeout(() => {\n item.open();\n this._openTimeout = undefined;\n }, this.inputs.expansionDelay());\n }\n\n /** Handles mouseout events for the menu. */\n onMouseOut(event: MouseEvent) {\n this._clearOpenTimeout();\n\n if (this.isFocused()) {\n return;\n }\n\n const root = this.root();\n const parent = this.inputs.parent();\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!root || !parent || parent instanceof MenuTriggerPattern) {\n return;\n }\n\n const grandparent = parent.inputs.parent();\n\n if (!grandparent || grandparent instanceof MenuBarPattern) {\n return;\n }\n\n if (!grandparent.inputs.element()?.contains(relatedTarget)) {\n parent.close();\n }\n }\n\n /** Handles click events for the menu. */\n onClick(event: MouseEvent) {\n const relatedTarget = event.target as Node | null;\n const item = this.inputs.items().find(i => i.element()?.contains(relatedTarget));\n\n if (item) {\n item.open();\n this.listBehavior.goto(item);\n this.submit(item);\n }\n }\n\n /** Handles focusin events for the menu. */\n onFocusIn() {\n this.isFocused.set(true);\n this.hasBeenInteracted.set(true);\n }\n\n /** Handles the focusout event for the menu. */\n onFocusOut(event: FocusEvent) {\n const parent = this.inputs.parent();\n const parentEl = parent?.inputs.element();\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!relatedTarget) {\n this.isFocused.set(false);\n this.inputs.parent()?.close({refocus: true});\n }\n\n if (parent instanceof MenuItemPattern) {\n const grandparent = parent.inputs.parent();\n const siblings = grandparent?.inputs.items().filter(i => i !== parent);\n const item = siblings?.find(i => i.element()?.contains(relatedTarget));\n\n if (item) {\n return;\n }\n }\n\n if (\n this.visible() &&\n !parentEl?.contains(relatedTarget) &&\n !this.inputs.element()?.contains(relatedTarget)\n ) {\n this.isFocused.set(false);\n this.inputs.parent()?.close();\n }\n }\n\n /** Focuses the previous menu item. */\n prev() {\n this.inputs.activeItem()?.close();\n this.listBehavior.prev();\n }\n\n /** Focuses the next menu item. */\n next() {\n this.inputs.activeItem()?.close();\n this.listBehavior.next();\n }\n\n /** Focuses the first menu item. */\n first() {\n this.inputs.activeItem()?.close();\n this.listBehavior.first();\n }\n\n /** Focuses the last menu item. */\n last() {\n this.inputs.activeItem()?.close();\n this.listBehavior.last();\n }\n\n /** Triggers the active menu item. */\n trigger() {\n this.inputs.activeItem()?.hasPopup()\n ? this.inputs.activeItem()?.open({first: true})\n : this.submit();\n }\n\n /** Submits the menu. */\n submit(item = this.inputs.activeItem()) {\n if (!item || item.disabled() || item.submenu()) {\n return;\n }\n\n const root = this.root();\n\n if (root instanceof MenuTriggerPattern) {\n root.close({refocus: true});\n root?.inputs.menu()?.inputs.itemSelected?.(item.value());\n } else if (root instanceof MenuBarPattern) {\n root.close();\n root?.inputs.itemSelected?.(item.value());\n } else if (root instanceof MenuPattern) {\n root.inputs.activeItem()?.close({refocus: true});\n root?.inputs.itemSelected?.(item.value());\n }\n }\n\n /** Collapses the current menu or focuses the previous item in the menubar. */\n collapse() {\n const root = this.root();\n const parent = this.inputs.parent();\n\n if (parent instanceof MenuItemPattern && !(parent.inputs.parent() instanceof MenuBarPattern)) {\n parent.close({refocus: true});\n } else if (root instanceof MenuBarPattern) {\n root.prev();\n }\n }\n\n /** Expands the current menu or focuses the next item in the menubar. */\n expand() {\n const root = this.root();\n const activeItem = this.inputs.activeItem();\n\n if (activeItem?.submenu()) {\n activeItem.open({first: true});\n } else if (root instanceof MenuBarPattern) {\n root.next();\n }\n }\n\n /** Closes the menu. */\n close() {\n this.inputs.parent()?.close();\n }\n\n /** Closes the menu and all parent menus. */\n closeAll() {\n const root = this.root();\n\n if (root instanceof MenuTriggerPattern) {\n root.close({refocus: true});\n }\n\n if (root instanceof MenuBarPattern) {\n root.close();\n }\n\n if (root instanceof MenuPattern) {\n root.inputs.activeItem()?.close({refocus: true});\n }\n }\n\n /** Clears any open or close timeouts for sub-menus. */\n _clearTimeouts() {\n this._clearOpenTimeout();\n this._clearCloseTimeout();\n }\n\n /** Clears the open timeout. */\n _clearOpenTimeout() {\n if (this._openTimeout) {\n clearTimeout(this._openTimeout);\n this._openTimeout = undefined;\n }\n }\n\n /** Clears the close timeout. */\n _clearCloseTimeout() {\n if (this._closeTimeout) {\n clearTimeout(this._closeTimeout);\n this._closeTimeout = undefined;\n }\n }\n}\n\n/** The menubar ui pattern class. */\nexport class MenuBarPattern<V> {\n /** Controls list behavior for the menu items. */\n readonly listBehavior: List<MenuItemPattern<V>, V>;\n\n /** The tab index of the menu. */\n readonly tabIndex = () => this.listBehavior.tabIndex();\n\n /** The key used to navigate to the next item. */\n private readonly _nextKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The key used to navigate to the previous item. */\n private readonly _previousKey = computed(() => {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** Represents the space key. Does nothing when the user is actively using typeahead. */\n readonly dynamicSpaceKey = computed(() => (this.listBehavior.isTyping() ? '' : ' '));\n\n /** The regexp used to decide if a key should trigger typeahead. */\n readonly typeaheadRegexp = /^.$/;\n\n /** Whether the menubar or any of its children are currently focused. */\n readonly isFocused = signal(false);\n\n /** Whether the menubar has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the menubar is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** Handles keyboard events for the menu. */\n readonly keydownManager = computed(() => {\n return new KeyboardEventManager()\n .on(this._nextKey, () => this.next(), {ignoreRepeat: false})\n .on(this._previousKey, () => this.prev(), {ignoreRepeat: false})\n .on('End', () => this.listBehavior.last())\n .on('Home', () => this.listBehavior.first())\n .on('Enter', () => this.inputs.activeItem()?.open({first: true}))\n .on('ArrowUp', () => this.inputs.activeItem()?.open({last: true}))\n .on('ArrowDown', () => this.inputs.activeItem()?.open({first: true}))\n .on(this.dynamicSpaceKey, () => this.inputs.activeItem()?.open({first: true}))\n .on(this.typeaheadRegexp, e => this.listBehavior.search(e.key));\n });\n\n constructor(readonly inputs: MenuBarInputs<V>) {\n this.listBehavior = new List<MenuItemPattern<V>, V>(inputs);\n }\n\n /** Sets the default state for the menubar. */\n setDefaultState() {\n const firstFocusable = this.listBehavior.navigationBehavior.peekFirst();\n if (firstFocusable) {\n this.inputs.activeItem.set(firstFocusable);\n }\n }\n\n /** Sets the default active state of the menubar before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\n }\n\n /** Handles keyboard events for the menu. */\n onKeydown(event: KeyboardEvent) {\n this.hasBeenInteracted.set(true);\n this.keydownManager().handle(event);\n }\n\n /** Handles click events for the menu bar. */\n onClick(event: MouseEvent) {\n const item = this.inputs.items().find(i => i.element()?.contains(event.target as Node));\n\n if (!item) {\n return;\n }\n\n this.goto(item);\n item.expanded() ? item.close() : item.open();\n }\n\n /** Handles mouseover events for the menu bar. */\n onMouseOver(event: MouseEvent) {\n const item = this.inputs.items().find(i => i.element()?.contains(event.target as Node));\n\n if (item) {\n this.goto(item, {focusElement: this.isFocused()});\n }\n }\n\n /** Handles focusin events for the menu bar. */\n onFocusIn() {\n this.isFocused.set(true);\n this.hasBeenInteracted.set(true);\n }\n\n /** Handles focusout events for the menu bar. */\n onFocusOut(event: FocusEvent) {\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!this.inputs.element()?.contains(relatedTarget)) {\n this.isFocused.set(false);\n this.close();\n }\n }\n\n /** Goes to and optionally focuses the specified menu item. */\n goto(item: MenuItemPattern<V>, opts?: {focusElement?: boolean}) {\n const prevItem = this.inputs.activeItem();\n this.listBehavior.goto(item, opts);\n\n if (prevItem?.expanded()) {\n prevItem?.close();\n this.inputs.activeItem()?.open();\n }\n\n if (item === prevItem) {\n if (item.expanded() && item.submenu()?.inputs.activeItem()) {\n item.submenu()?.inputs.activeItem()?.close();\n item.submenu()?.listBehavior.unfocus();\n }\n }\n }\n\n /** Focuses the next menu item. */\n next() {\n const prevItem = this.inputs.activeItem();\n this.listBehavior.next();\n\n if (prevItem?.expanded()) {\n prevItem?.close();\n this.inputs.activeItem()?.open({first: true});\n }\n }\n\n /** Focuses the previous menu item. */\n prev() {\n const prevItem = this.inputs.activeItem();\n this.listBehavior.prev();\n\n if (prevItem?.expanded()) {\n prevItem?.close();\n this.inputs.activeItem()?.open({first: true});\n }\n }\n\n /** Closes the menubar and refocuses the root menu bar item. */\n close() {\n this.inputs.activeItem()?.close({refocus: this.isFocused()});\n }\n}\n\n/** The menu trigger ui pattern class. */\nexport class MenuTriggerPattern<V> {\n /** Whether the menu trigger is expanded. */\n readonly expanded = signal(false);\n\n /** Whether the menu trigger has received interaction. */\n readonly hasBeenInteracted = signal(false);\n\n /** The role of the menu trigger. */\n readonly role = () => 'button';\n\n /** Whether the menu trigger has a popup. */\n readonly hasPopup = () => true;\n\n /** The menu associated with the trigger. */\n readonly menu: SignalLike<MenuPattern<V> | undefined>;\n\n /** The tab index of the menu trigger. */\n readonly tabIndex = computed(() =>\n this.expanded() && this.menu()?.inputs.activeItem() ? -1 : 0,\n );\n\n /** Whether the menu trigger is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** Handles keyboard events for the menu trigger. */\n readonly keydownManager = computed(() => {\n return new KeyboardEventManager()\n .on(' ', () => this.open({first: true}))\n .on('Enter', () => this.open({first: true}))\n .on('ArrowDown', () => this.open({first: true}))\n .on('ArrowUp', () => this.open({last: true}))\n .on('Escape', () => this.close({refocus: true}));\n });\n\n constructor(readonly inputs: MenuTriggerInputs<V>) {\n this.menu = this.inputs.menu;\n }\n\n /** Handles keyboard events for the menu trigger. */\n onKeydown(event: KeyboardEvent) {\n if (!this.inputs.disabled()) {\n this.hasBeenInteracted.set(true);\n this.keydownManager().handle(event);\n }\n }\n\n /** Handles click events for the menu trigger. */\n onClick() {\n if (!this.inputs.disabled()) {\n this.expanded() ? this.close() : this.open({first: true});\n }\n }\n\n /** Handles focusin events for the menu trigger. */\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n\n /** Handles focusout events for the menu trigger. */\n onFocusOut(event: FocusEvent) {\n const element = this.inputs.element();\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (\n this.expanded() &&\n !element?.contains(relatedTarget) &&\n !this.inputs.menu()?.inputs.element()?.contains(relatedTarget)\n ) {\n this.close();\n }\n }\n\n /** Opens the menu. */\n open(opts?: {first?: boolean; last?: boolean}) {\n this.expanded.set(true);\n\n if (opts?.first) {\n this.inputs.menu()?.first();\n } else if (opts?.last) {\n this.inputs.menu()?.last();\n }\n }\n\n /** Closes the menu. */\n close(opts: {refocus?: boolean} = {}) {\n this.expanded.set(false);\n this.menu()?.listBehavior.unfocus();\n\n if (opts.refocus) {\n this.inputs.element()?.focus();\n }\n\n let menuitems = this.inputs.menu()?.inputs.items() ?? [];\n\n while (menuitems.length) {\n const menuitem = menuitems.pop();\n menuitem?._expanded.set(false);\n menuitem?.inputs.parent()?.listBehavior.unfocus();\n menuitems = menuitems.concat(menuitem?.submenu()?.inputs.items() ?? []);\n }\n }\n}\n\n/** The menu item ui pattern class. */\nexport class MenuItemPattern<V> implements ListItem<V> {\n /** The value of the menu item. */\n readonly value: SignalLike<V>;\n\n /** The unique ID of the menu item. */\n readonly id: SignalLike<string>;\n\n /** Whether the menu item is disabled. */\n readonly disabled = () => this.inputs.parent()?.disabled() || this.inputs.disabled();\n\n /** The search term for the menu item. */\n readonly searchTerm: SignalLike<string>;\n\n /** The element of the menu item. */\n readonly element: SignalLike<HTMLElement | undefined>;\n\n /** Whether the menu item is active. */\n readonly active = computed(() => this.inputs.parent()?.inputs.activeItem() === this);\n\n /** Whether the menu item has received interaction. */\n readonly hasBeenInteracted = signal(false);\n\n /** The tab index of the menu item. */\n readonly tabIndex = computed(() => {\n if (this.submenu() && this.submenu()?.inputs.activeItem()) {\n return -1;\n }\n return this.inputs.parent()?.listBehavior.getItemTabindex(this) ?? -1;\n });\n\n /** The position of the menu item in the menu. */\n readonly index = computed(() => this.inputs.parent()?.inputs.items().indexOf(this) ?? -1);\n\n /** Whether the menu item is expanded. */\n readonly expanded = computed(() => (this.submenu() ? this._expanded() : null));\n\n /** Whether the menu item is expanded. */\n readonly _expanded = signal(false);\n\n /** The ID of the menu that the menu item controls. */\n readonly controls = signal<string | undefined>(undefined);\n\n /** The role of the menu item. */\n readonly role = () => 'menuitem';\n\n /** Whether the menu item has a popup. */\n readonly hasPopup = computed(() => !!this.submenu());\n\n /** The submenu associated with the menu item. */\n readonly submenu: SignalLike<MenuPattern<V> | undefined>;\n\n /** Whether the menu item is selectable. */\n readonly selectable: SignalLike<boolean>;\n\n constructor(readonly inputs: MenuItemInputs<V>) {\n this.id = inputs.id;\n this.value = inputs.value;\n this.element = inputs.element;\n this.submenu = this.inputs.submenu;\n this.searchTerm = inputs.searchTerm;\n this.selectable = computed(() => !this.submenu());\n }\n\n /** Opens the submenu. */\n open(opts?: {first?: boolean; last?: boolean}) {\n if (this.disabled()) {\n return;\n }\n\n this._expanded.set(true);\n\n if (opts?.first) {\n this.submenu()?.first();\n }\n if (opts?.last) {\n this.submenu()?.last();\n }\n }\n\n /** Closes the submenu. */\n close(opts: {refocus?: boolean} = {}) {\n this._expanded.set(false);\n\n if (opts.refocus) {\n this.inputs.parent()?.listBehavior.goto(this);\n }\n\n let menuitems = this.inputs.submenu()?.inputs.items() ?? [];\n\n while (menuitems.length) {\n const menuitem = menuitems.pop();\n menuitem?._expanded.set(false);\n menuitem?.inputs.parent()?.listBehavior.unfocus();\n menuitems = menuitems.concat(menuitem?.submenu()?.inputs.items() ?? []);\n\n const parent = menuitem?.inputs.parent();\n\n if (parent instanceof MenuPattern) {\n parent._clearTimeouts();\n }\n }\n }\n\n /** Handles focusin events for the menu item. */\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n}\n"],"names":["MenuPattern","inputs","id","role","disabled","visible","computed","parent","expanded","listBehavior","isFocused","signal","hasBeenInteracted","hasBeenHovered","_openTimeout","_closeTimeout","tabIndex","shouldFocus","root","MenuTriggerPattern","MenuBarPattern","_expandKey","textDirection","_collapseKey","dynamicSpaceKey","isTyping","typeaheadRegexp","grandparent","keydownManager","KeyboardEventManager","on","next","ignoreRepeat","prev","first","last","trigger","closeAll","expand","collapse","e","search","key","constructor","List","value","setDefaultState","firstFocusable","navigationBehavior","peekFirst","goto","focusElement","setDefaultStateEffect","items","length","onKeydown","event","set","handle","onMouseOver","item","find","i","element","contains","target","activeItem","MenuItemPattern","_clearTimeouts","_closeItem","_clearCloseTimeout","_openItem","_clearOpenTimeout","setTimeout","close","undefined","expansionDelay","open","onMouseOut","relatedTarget","onClick","submit","onFocusIn","onFocusOut","parentEl","refocus","siblings","filter","hasPopup","submenu","menu","itemSelected","clearTimeout","_nextKey","_previousKey","opts","prevItem","unfocus","focus","menuitems","menuitem","pop","_expanded","concat","searchTerm","active","getItemTabindex","index","indexOf","controls","selectable"],"mappings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AAE;AACxB,IAAA;AACF,EAAA;AAGAuC,EAAAA,KAAKA,CAACqB,OAA4B,EAAE,EAAA;AAClC,IAAA,IAAI,CAACO,SAAS,CAAC7C,GAAG,CAAC,KAAK,CAAC;IAEzB,IAAIsC,IAAI,CAACV,OAAO,EAAE;AAChB,MAAA,IAAI,CAACpF,MAAM,CAACM,MAAM,EAAE,EAAEE,YAAY,CAACyC,IAAI,CAAC,IAAI,CAAC;AAC/C,IAAA;AAEA,IAAA,IAAIiD,SAAS,GAAG,IAAI,CAAClG,MAAM,CAACwF,OAAO,EAAE,EAAExF,MAAM,CAACoD,KAAK,EAAE,IAAI,EAAE;IAE3D,OAAO8C,SAAS,CAAC7C,MAAM,EAAE;AACvB,MAAA,MAAM8C,QAAQ,GAAGD,SAAS,CAACE,GAAG,EAAE;AAChCD,MAAAA,QAAQ,EAAEE,SAAS,CAAC7C,GAAG,CAAC,KAAK,CAAC;MAC9B2C,QAAQ,EAAEnG,MAAM,CAACM,MAAM,EAAE,EAAEE,YAAY,CAACwF,OAAO,EAAE;AACjDE,MAAAA,SAAS,GAAGA,SAAS,CAACI,MAAM,CAACH,QAAQ,EAAEX,OAAO,EAAE,EAAExF,MAAM,CAACoD,KAAK,EAAE,IAAI,EAAE,CAAC;MAEvE,MAAM9C,MAAM,GAAG6F,QAAQ,EAAEnG,MAAM,CAACM,MAAM,EAAE;MAExC,IAAIA,MAAM,YAAYP,WAAW,EAAE;QACjCO,MAAM,CAAC6D,cAAc,EAAE;AACzB,MAAA;AACF,IAAA;AACF,EAAA;AAGAc,EAAAA,SAASA,GAAA;AACP,IAAA,IAAI,CAACtE,iBAAiB,CAAC6C,GAAG,CAAC,IAAI,CAAC;AAClC,EAAA;AACD;;;;"}
@@ -1,4 +1,4 @@
1
- import { signal, computed, KeyboardEventManager, Modifier } from './_signal-like-chunk.mjs';
1
+ import { signal, computed, KeyboardEventManager, Modifier } from './_collection-chunk.mjs';
2
2
  import { List } from './_list-chunk.mjs';
3
3
  import { ClickEventManager } from './_click-event-manager-chunk.mjs';
4
4
 
@@ -182,6 +182,9 @@ class ListboxPattern {
182
182
  }
183
183
  if (firstItem) {
184
184
  this.inputs.activeItem.set(firstItem);
185
+ if (this.followFocus()) {
186
+ this.listBehavior.select();
187
+ }
185
188
  }
186
189
  }
187
190
  setDefaultStateEffect() {
@@ -219,52 +222,5 @@ class OptionPattern {
219
222
  }
220
223
  }
221
224
 
222
- class ComboboxListboxPattern extends ListboxPattern {
223
- inputs;
224
- id = computed(() => this.inputs.id());
225
- role = computed(() => 'listbox');
226
- activeId = computed(() => this.listBehavior.activeDescendant());
227
- items = computed(() => this.inputs.items());
228
- tabIndex = () => -1;
229
- multi = computed(() => {
230
- return this.inputs.combobox()?.readonly() ? this.inputs.multi() : false;
231
- });
232
- constructor(inputs) {
233
- if (inputs.combobox()) {
234
- inputs.focusMode = () => 'activedescendant';
235
- inputs.element = inputs.combobox().inputs.inputEl;
236
- }
237
- super(inputs);
238
- this.inputs = inputs;
239
- }
240
- onKeydown(_) {}
241
- onClick(_) {}
242
- setDefaultState() {}
243
- focus = (item, opts) => {
244
- this.listBehavior.goto(item, opts);
245
- };
246
- getActiveItem = () => this.inputs.activeItem();
247
- next = () => this.listBehavior.next();
248
- prev = () => this.listBehavior.prev();
249
- last = () => this.listBehavior.last();
250
- first = () => this.listBehavior.first();
251
- unfocus = () => this.listBehavior.unfocus();
252
- select = item => this.listBehavior.select(item);
253
- toggle = item => this.listBehavior.toggle(item);
254
- clearSelection = () => this.listBehavior.deselectAll();
255
- getItem = e => this._getItem(e);
256
- getSelectedItems = () => {
257
- const items = [];
258
- for (const value of this.inputs.value()) {
259
- const item = this.items().find(i => i.value() === value);
260
- if (item) {
261
- items.push(item);
262
- }
263
- }
264
- return items;
265
- };
266
- setValue = value => this.inputs.value.set(value ? [value] : []);
267
- }
268
-
269
- export { ComboboxListboxPattern, ListboxPattern, OptionPattern };
270
- //# sourceMappingURL=_combobox-listbox-chunk.mjs.map
225
+ export { ListboxPattern, OptionPattern };
226
+ //# sourceMappingURL=_option-chunk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_option-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/listbox/listbox.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/listbox/option.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 {OptionPattern} from './option';\nimport {KeyboardEventManager, Modifier, ClickEventManager} from '../behaviors/event-manager';\nimport {computed, signal, SignalLike} from '../behaviors/signal-like/signal-like';\nimport {List, ListInputs} from '../behaviors/list/list';\n\n/** Represents the required inputs for a listbox. */\nexport type ListboxInputs<V> = ListInputs<OptionPattern<V>, V> & {\n /** A unique identifier for the listbox. */\n id: SignalLike<string>;\n\n /** Whether the listbox is readonly. */\n readonly: SignalLike<boolean>;\n};\n\n/** Controls the state of a listbox. */\nexport class ListboxPattern<V> {\n readonly listBehavior: List<OptionPattern<V>, V>;\n\n /** Whether the listbox has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the list is vertically or horizontally oriented. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** Whether the listbox is disabled. */\n readonly disabled = computed(() => this.listBehavior.disabled());\n\n /** Whether the listbox is readonly. */\n readonly readonly: SignalLike<boolean>;\n\n /** The tab index of the listbox. */\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 /** Whether multiple items in the list can be selected at once. */\n multi: SignalLike<boolean>;\n\n /** The number of items in the listbox. */\n readonly setsize = computed(() => this.inputs.items().length);\n\n /** Whether the listbox selection follows focus. */\n readonly followFocus = computed(() => this.inputs.selectionMode() === 'follow');\n\n /** Whether the listbox should wrap. Used to disable wrapping while range selecting. */\n readonly wrap = signal(true);\n\n /** The key used to navigate to the previous item in the list. */\n readonly prevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key used to navigate to the next item in the list. */\n readonly nextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.inputs.textDirection() === 'rtl' ? '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 /** The regexp used to decide if a key should trigger typeahead. */\n readonly typeaheadRegexp = /^.$/;\n\n /** The keydown event manager for the listbox. */\n readonly keydown = computed(() => {\n const manager = new KeyboardEventManager();\n\n if (this.readonly()) {\n return manager\n .on(this.prevKey, () => this.listBehavior.prev(), {ignoreRepeat: false})\n .on(this.nextKey, () => this.listBehavior.next(), {ignoreRepeat: false})\n .on('Home', () => this.listBehavior.first())\n .on('End', () => this.listBehavior.last())\n .on(this.typeaheadRegexp, e => this.listBehavior.search(e.key));\n }\n\n if (!this.followFocus()) {\n manager\n .on(this.prevKey, () => this.listBehavior.prev(), {ignoreRepeat: false})\n .on(this.nextKey, () => this.listBehavior.next(), {ignoreRepeat: false})\n .on('Home', () => this.listBehavior.first())\n .on('End', () => this.listBehavior.last())\n .on(this.typeaheadRegexp, e => this.listBehavior.search(e.key));\n }\n\n if (this.followFocus()) {\n manager\n .on(this.prevKey, () => this.listBehavior.prev({selectOne: true}), {ignoreRepeat: false})\n .on(this.nextKey, () => this.listBehavior.next({selectOne: true}), {ignoreRepeat: false})\n .on('Home', () => this.listBehavior.first({selectOne: true}))\n .on('End', () => this.listBehavior.last({selectOne: true}))\n .on(this.typeaheadRegexp, e => this.listBehavior.search(e.key, {selectOne: true}));\n }\n\n if (this.inputs.multi()) {\n manager\n .on(Modifier.Any, 'Shift', () => this.listBehavior.anchor(this.listBehavior.activeIndex()))\n .on(Modifier.Shift, this.prevKey, () => this.listBehavior.prev({selectRange: true}), {\n ignoreRepeat: false,\n })\n .on(Modifier.Shift, this.nextKey, () => this.listBehavior.next({selectRange: true}), {\n ignoreRepeat: false,\n })\n .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'Home', () =>\n this.listBehavior.first({selectRange: true, anchor: false}),\n )\n .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'End', () =>\n this.listBehavior.last({selectRange: true, anchor: false}),\n )\n .on(Modifier.Shift, 'Enter', () =>\n this.listBehavior.updateSelection({selectRange: true, anchor: false}),\n )\n .on(Modifier.Shift, this.dynamicSpaceKey, () =>\n this.listBehavior.updateSelection({selectRange: true, anchor: false}),\n );\n }\n\n if (!this.followFocus() && this.inputs.multi()) {\n manager\n .on(this.dynamicSpaceKey, () => this.listBehavior.toggle())\n .on('Enter', () => this.listBehavior.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'A', () => this.listBehavior.toggleAll());\n }\n\n if (!this.followFocus() && !this.inputs.multi()) {\n manager.on(this.dynamicSpaceKey, () => this.listBehavior.toggleOne());\n manager.on('Enter', () => this.listBehavior.toggleOne());\n }\n\n if (this.inputs.multi() && this.followFocus()) {\n manager\n .on([Modifier.Ctrl, Modifier.Meta], this.prevKey, () => this.listBehavior.prev(), {\n ignoreRepeat: false,\n })\n .on([Modifier.Ctrl, Modifier.Meta], this.nextKey, () => this.listBehavior.next(), {\n ignoreRepeat: false,\n })\n .on([Modifier.Ctrl, Modifier.Meta], ' ', () => this.listBehavior.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'Enter', () => this.listBehavior.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'Home', () => this.listBehavior.first())\n .on([Modifier.Ctrl, Modifier.Meta], 'End', () => this.listBehavior.last())\n .on([Modifier.Ctrl, Modifier.Meta], 'A', () => {\n this.listBehavior.toggleAll();\n this.listBehavior.select(); // Ensure the currect option remains selected.\n });\n }\n\n return manager;\n });\n\n /** The click event manager for the listbox. */\n readonly clickManager = computed(() => {\n const manager = new ClickEventManager<PointerEvent>();\n\n if (this.readonly()) {\n return manager.on(e => this.listBehavior.goto(this._getItem(e)!));\n }\n\n if (this.multi()) {\n manager.on(Modifier.Shift, e =>\n this.listBehavior.goto(this._getItem(e)!, {selectRange: true}),\n );\n }\n\n if (!this.multi() && this.followFocus()) {\n return manager.on(e => this.listBehavior.goto(this._getItem(e)!, {selectOne: true}));\n }\n\n if (!this.multi() && !this.followFocus()) {\n return manager.on(e => this.listBehavior.goto(this._getItem(e)!, {toggle: true}));\n }\n\n if (this.multi() && this.followFocus()) {\n return manager\n .on(e => this.listBehavior.goto(this._getItem(e)!, {selectOne: true}))\n .on(Modifier.Ctrl, e => this.listBehavior.goto(this._getItem(e)!, {toggle: true}));\n }\n\n if (this.multi() && !this.followFocus()) {\n return manager.on(e => this.listBehavior.goto(this._getItem(e)!, {toggle: true}));\n }\n\n return manager;\n });\n\n constructor(readonly inputs: ListboxInputs<V>) {\n this.readonly = inputs.readonly;\n this.orientation = inputs.orientation;\n this.multi = inputs.multi;\n this.listBehavior = new List(inputs);\n }\n\n /** Returns a set of violations */\n validate(): string[] {\n const violations: string[] = [];\n\n if (!this.inputs.multi() && this.inputs.value().length > 1) {\n violations.push(\n `A single-select listbox should not have multiple selected options. Selected options: ${this.inputs.value().join(', ')}`,\n );\n }\n\n return violations;\n }\n\n /** Handles keydown events for the listbox. */\n onKeydown(event: KeyboardEvent) {\n if (!this.disabled()) {\n this.hasBeenInteracted.set(true);\n this.keydown().handle(event);\n }\n }\n\n onClick(event: PointerEvent) {\n if (!this.disabled()) {\n this.hasBeenInteracted.set(true);\n this.clickManager().handle(event);\n }\n }\n\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n\n /**\n * Sets the listbox to it's default initial state.\n *\n * Sets the active index of the listbox to the first focusable selected\n * item if one exists. Otherwise, sets focus to the first focusable item.\n *\n * This method should be called once the listbox and it's options are properly initialized,\n * meaning the ListboxPattern and OptionPatterns should have references to each other before this\n * is called.\n */\n setDefaultState() {\n let firstItem: OptionPattern<V> | null = null;\n\n for (const item of this.inputs.items()) {\n if (this.listBehavior.isFocusable(item)) {\n if (!firstItem) {\n firstItem = item;\n }\n if (item.selected()) {\n this.inputs.activeItem.set(item);\n return;\n }\n }\n }\n\n if (firstItem) {\n this.inputs.activeItem.set(firstItem);\n if (this.followFocus()) {\n this.listBehavior.select();\n }\n }\n }\n\n /**\n * Sets the default active state of the listbox before receiving interaction for the first time.\n */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n this.setDefaultState();\n }\n\n protected _getItem(e: PointerEvent) {\n if (!(e.target instanceof HTMLElement)) {\n return;\n }\n\n const element = e.target.closest('[role=\"option\"]');\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 {computed, SignalLike} from '../behaviors/signal-like/signal-like';\nimport {List, ListInputs, ListItem} from '../behaviors/list/list';\n\n/**\n * Represents the properties exposed by a listbox that need to be accessed by an option.\n * This exists to avoid circular dependency errors between the listbox and option.\n */\ninterface ListboxPattern<V> {\n inputs: ListInputs<OptionPattern<V>, V>;\n listBehavior: List<OptionPattern<V>, V>;\n}\n\n/** Represents the required inputs for an option in a listbox. */\nexport interface OptionInputs<V> extends Omit<ListItem<V>, 'index' | 'selectable'> {\n listbox: SignalLike<ListboxPattern<V> | undefined>;\n}\n\n/** Represents an option in a listbox. */\nexport class OptionPattern<V> {\n /** A unique identifier for the option. */\n readonly id: SignalLike<string>;\n\n /** The value of the option. */\n readonly value: SignalLike<V>;\n\n /** The position of the option in the list. */\n readonly index = computed(() => this.listbox()?.inputs.items().indexOf(this) ?? -1);\n\n /** Whether the option is active. */\n readonly active = computed(() => this.listbox()?.inputs.activeItem() === this);\n\n /** Whether the option is selected. */\n readonly selected = computed(() => this.listbox()?.inputs.value().includes(this.value()));\n\n /** Whether the option is selectable. */\n readonly selectable = () => true;\n\n /** Whether the option is disabled. */\n readonly disabled: SignalLike<boolean>;\n\n /** The text used by the typeahead search. */\n readonly searchTerm: SignalLike<string>;\n\n /** A reference to the parent listbox. */\n readonly listbox: SignalLike<ListboxPattern<V> | undefined>;\n\n /** The tab index of the option. */\n readonly tabIndex = computed(() => this.listbox()?.listBehavior.getItemTabindex(this));\n\n /** The html element that should receive focus. */\n readonly element: SignalLike<HTMLElement | undefined>;\n\n constructor(args: OptionInputs<V>) {\n this.id = args.id;\n this.value = args.value;\n this.listbox = args.listbox;\n this.element = args.element;\n this.disabled = args.disabled;\n this.searchTerm = args.searchTerm;\n }\n}\n"],"names":["ListboxPattern","inputs","listBehavior","hasBeenInteracted","signal","orientation","disabled","computed","readonly","tabIndex","activeDescendant","multi","setsize","items","length","followFocus","selectionMode","wrap","prevKey","textDirection","nextKey","dynamicSpaceKey","isTyping","typeaheadRegexp","keydown","manager","KeyboardEventManager","on","prev","ignoreRepeat","next","first","last","e","search","key","selectOne","Modifier","Any","anchor","activeIndex","Shift","selectRange","Ctrl","Meta","updateSelection","toggle","toggleAll","toggleOne","select","clickManager","ClickEventManager","goto","_getItem","constructor","List","validate","violations","value","push","join","onKeydown","event","set","handle","onClick","onFocusIn","setDefaultState","firstItem","item","isFocusable","selected","activeItem","setDefaultStateEffect","target","HTMLElement","element","closest","find","i","OptionPattern","id","index","listbox","indexOf","active","includes","selectable","searchTerm","getItemTabindex","args"],"mappings":";;;;MAuBaA,cAAc,CAAA;EAiLJC,MAAA;EAhLZC,YAAY;AAGZC,EAAAA,iBAAiB,GAAGC,MAAM,CAAC,KAAK,CAAC;EAGjCC,WAAW;EAGXC,QAAQ,GAAGC,QAAQ,CAAC,MAAM,IAAI,CAACL,YAAY,CAACI,QAAQ,EAAE,CAAC;EAGvDE,QAAQ;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ACT,EAAE,GAAGS,IAAI,CAACT,EAAE;AACjB,IAAA,IAAI,CAACvB,KAAK,GAAGgC,IAAI,CAAChC,KAAK;AACvB,IAAA,IAAI,CAACyB,OAAO,GAAGO,IAAI,CAACP,OAAO;AAC3B,IAAA,IAAI,CAACP,OAAO,GAAGc,IAAI,CAACd,OAAO;AAC3B,IAAA,IAAI,CAACtE,QAAQ,GAAGoF,IAAI,CAACpF,QAAQ;AAC7B,IAAA,IAAI,CAACkF,UAAU,GAAGE,IAAI,CAACF,UAAU;AACnC,EAAA;AACD;;;;"}
@@ -1,63 +1,37 @@
1
1
  import { ListExpansion } from './_expansion-chunk.mjs';
2
- import { computed, signal, KeyboardEventManager } from './_signal-like-chunk.mjs';
2
+ import { signal, computed, linkedSignal, KeyboardEventManager } from './_collection-chunk.mjs';
3
3
  import { ListFocus, ListNavigation } from './_list-navigation-chunk.mjs';
4
4
  import { ClickEventManager } from './_click-event-manager-chunk.mjs';
5
5
 
6
- class LabelControl {
7
- inputs;
8
- label = computed(() => this.inputs.label?.());
9
- labelledBy = computed(() => {
10
- const label = this.label();
11
- const labelledBy = this.inputs.labelledBy?.();
12
- const defaultLabelledBy = this.inputs.defaultLabelledBy();
13
- if (labelledBy && labelledBy.length > 0) {
14
- return labelledBy;
15
- }
16
- if (label) {
17
- return [];
18
- }
19
- return defaultLabelledBy;
20
- });
21
- constructor(inputs) {
22
- this.inputs = inputs;
23
- }
24
- }
25
-
26
6
  class TabPattern {
27
7
  inputs;
28
- id = () => this.inputs.id();
29
- index = computed(() => this.inputs.tablist().inputs.items().indexOf(this));
30
- value = () => this.inputs.value();
31
- disabled = () => this.inputs.disabled();
8
+ id;
9
+ disabled;
32
10
  element = () => this.inputs.element();
33
11
  expandable = () => true;
34
- expanded;
35
- active = computed(() => this.inputs.tablist().inputs.activeItem() === this);
36
- selected = computed(() => this.inputs.tablist().selectedTab() === this);
37
- tabIndex = computed(() => this.inputs.tablist().focusBehavior.getItemTabIndex(this));
38
- controls = computed(() => this.inputs.tabpanel()?.id());
12
+ expanded = linkedSignal(() => this.inputs.tabList().selectedTab() === this);
13
+ active = computed(() => this.inputs.tabList().inputs.activeItem() === this);
14
+ selected = computed(() => this.inputs.tabList().selectedTab() === this);
15
+ tabIndex = computed(() => this.inputs.tabList().focusBehavior.getItemTabIndex(this));
16
+ controls = computed(() => this.inputs.tabPanel()?.id());
39
17
  constructor(inputs) {
40
18
  this.inputs = inputs;
41
- this.expanded = inputs.expanded;
19
+ this.id = inputs.id;
20
+ this.disabled = inputs.disabled;
42
21
  }
43
22
  open() {
44
- return this.inputs.tablist().open(this);
23
+ return this.inputs.tabList().open(this);
45
24
  }
46
25
  }
47
26
  class TabPanelPattern {
48
27
  inputs;
49
- id = () => this.inputs.id();
50
- value = () => this.inputs.value();
51
- labelManager;
28
+ id;
52
29
  hidden = computed(() => this.inputs.tab()?.expanded() === false);
53
30
  tabIndex = computed(() => this.hidden() ? -1 : 0);
54
- labelledBy = computed(() => this.labelManager.labelledBy().length > 0 ? this.labelManager.labelledBy().join(' ') : undefined);
31
+ labelledBy = computed(() => this.inputs.tab()?.id());
55
32
  constructor(inputs) {
56
33
  this.inputs = inputs;
57
- this.labelManager = new LabelControl({
58
- ...inputs,
59
- defaultLabelledBy: computed(() => this.inputs.tab() ? [this.inputs.tab().id()] : [])
60
- });
34
+ this.id = inputs.id;
61
35
  }
62
36
  }
63
37
  class TabListPattern {
@@ -66,10 +40,10 @@ class TabListPattern {
66
40
  navigationBehavior;
67
41
  expansionBehavior;
68
42
  hasBeenInteracted = signal(false);
69
- activeTab = () => this.inputs.activeItem();
70
- selectedTab = signal(undefined);
71
- orientation = () => this.inputs.orientation();
72
- disabled = () => this.inputs.disabled();
43
+ activeTab;
44
+ selectedTab;
45
+ orientation;
46
+ disabled;
73
47
  tabIndex = computed(() => this.focusBehavior.getListTabIndex());
74
48
  activeDescendant = computed(() => this.focusBehavior.getActiveDescendant());
75
49
  followFocus = computed(() => this.inputs.selectionMode() === 'follow');
@@ -97,6 +71,10 @@ class TabListPattern {
97
71
  });
98
72
  constructor(inputs) {
99
73
  this.inputs = inputs;
74
+ this.selectedTab = inputs.selectedTab;
75
+ this.activeTab = inputs.activeItem;
76
+ this.orientation = inputs.orientation;
77
+ this.disabled = inputs.disabled;
100
78
  this.focusBehavior = new ListFocus(inputs);
101
79
  this.navigationBehavior = new ListNavigation({
102
80
  ...inputs,
@@ -144,9 +122,6 @@ class TabListPattern {
144
122
  }
145
123
  open(tab) {
146
124
  tab ??= this.activeTab();
147
- if (typeof tab === 'string') {
148
- tab = this.inputs.items().find(t => t.value() === tab);
149
- }
150
125
  if (tab === undefined) return false;
151
126
  const success = this.expansionBehavior.open(tab);
152
127
  if (success) {