@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":"_tabs-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/behaviors/label/label.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/tabs/tabs.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 */\nimport {computed, SignalLike} from '../signal-like/signal-like';\n\n/** Represents the required inputs for the label control. */\nexport interface LabelControlInputs {\n /** The default `aria-labelledby` ids. */\n defaultLabelledBy: SignalLike<string[]>;\n}\n\n/** Represents the optional inputs for the label control. */\nexport interface LabelControlOptionalInputs {\n /** The `aria-label`. */\n label?: SignalLike<string | undefined>;\n\n /** The user-provided `aria-labelledby` ids. */\n labelledBy?: SignalLike<string[]>;\n}\n\n/** Controls label and description of an element. */\nexport class LabelControl {\n /** The `aria-label`. */\n readonly label = computed(() => this.inputs.label?.());\n\n /** The `aria-labelledby` ids. */\n readonly labelledBy = computed(() => {\n const label = this.label();\n const labelledBy = this.inputs.labelledBy?.();\n const defaultLabelledBy = this.inputs.defaultLabelledBy();\n\n if (labelledBy && labelledBy.length > 0) {\n return labelledBy;\n }\n\n // If an aria-label is provided by developers, do not set aria-labelledby with the\n // defaultLabelledBy value because if both attributes are set, aria-labelledby will be used.\n if (label) {\n return [];\n }\n\n return defaultLabelledBy;\n });\n\n constructor(readonly inputs: LabelControlInputs & LabelControlOptionalInputs) {}\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 {KeyboardEventManager, ClickEventManager} from '../behaviors/event-manager';\nimport {ExpansionItem, ListExpansionInputs, ListExpansion} from '../behaviors/expansion/expansion';\nimport {\n SignalLike,\n computed,\n signal,\n WritableSignalLike,\n} from '../behaviors/signal-like/signal-like';\nimport {LabelControl, LabelControlOptionalInputs} from '../behaviors/label/label';\nimport {ListFocus} from '../behaviors/list-focus/list-focus';\nimport {\n ListNavigationItem,\n ListNavigation,\n ListNavigationInputs,\n} from '../behaviors/list-navigation/list-navigation';\n\n/** The required inputs to tabs. */\nexport interface TabInputs\n extends Omit<ListNavigationItem, 'index'>, Omit<ExpansionItem, 'expandable'> {\n /** The parent tablist that controls the tab. */\n tablist: SignalLike<TabListPattern>;\n\n /** The remote tabpanel controlled by the tab. */\n tabpanel: SignalLike<TabPanelPattern | undefined>;\n\n /** The remote tabpanel unique identifier. */\n value: SignalLike<string>;\n}\n\n/** A tab in a tablist. */\nexport class TabPattern {\n /** A global unique identifier for the tab. */\n readonly id: SignalLike<string> = () => this.inputs.id();\n\n /** The index of the tab. */\n readonly index = computed(() => this.inputs.tablist().inputs.items().indexOf(this));\n\n /** The remote tabpanel unique identifier. */\n readonly value: SignalLike<string> = () => this.inputs.value();\n\n /** Whether the tab is disabled. */\n readonly disabled: SignalLike<boolean> = () => this.inputs.disabled();\n\n /** The html element that should receive focus. */\n readonly element: SignalLike<HTMLElement> = () => this.inputs.element()!;\n\n /** Whether this tab has expandable panel. */\n readonly expandable: SignalLike<boolean> = () => true;\n\n /** Whether the tab panel is expanded. */\n readonly expanded: WritableSignalLike<boolean>;\n\n /** Whether the tab is active. */\n readonly active = computed(() => this.inputs.tablist().inputs.activeItem() === this);\n\n /** Whether the tab is selected. */\n readonly selected = computed(() => this.inputs.tablist().selectedTab() === this);\n\n /** The tab index of the tab. */\n readonly tabIndex = computed(() => this.inputs.tablist().focusBehavior.getItemTabIndex(this));\n\n /** The id of the tabpanel associated with the tab. */\n readonly controls = computed(() => this.inputs.tabpanel()?.id());\n\n constructor(readonly inputs: TabInputs) {\n this.expanded = inputs.expanded;\n }\n\n /** Opens the tab. */\n open(): boolean {\n return this.inputs.tablist().open(this);\n }\n}\n\n/** The required inputs for the tabpanel. */\nexport interface TabPanelInputs extends LabelControlOptionalInputs {\n /** A global unique identifier for the tabpanel. */\n id: SignalLike<string>;\n\n /** The tab that controls this tabpanel. */\n tab: SignalLike<TabPattern | undefined>;\n\n /** A local unique identifier for the tabpanel. */\n value: SignalLike<string>;\n}\n\n/** A tabpanel associated with a tab. */\nexport class TabPanelPattern {\n /** A global unique identifier for the tabpanel. */\n readonly id: SignalLike<string> = () => this.inputs.id();\n\n /** A local unique identifier for the tabpanel. */\n readonly value: SignalLike<string> = () => this.inputs.value();\n\n /** Controls label for this tabpanel. */\n readonly labelManager: LabelControl;\n\n /** Whether the tabpanel is hidden. */\n readonly hidden = computed(() => this.inputs.tab()?.expanded() === false);\n\n /** The tab index of this tabpanel. */\n readonly tabIndex = computed(() => (this.hidden() ? -1 : 0));\n\n /** The aria-labelledby value for this tabpanel. */\n readonly labelledBy = computed(() =>\n this.labelManager.labelledBy().length > 0\n ? this.labelManager.labelledBy().join(' ')\n : undefined,\n );\n\n constructor(readonly inputs: TabPanelInputs) {\n this.labelManager = new LabelControl({\n ...inputs,\n defaultLabelledBy: computed(() => (this.inputs.tab() ? [this.inputs.tab()!.id()] : [])),\n });\n }\n}\n\n/** The required inputs for the tablist. */\nexport interface TabListInputs\n extends\n Omit<ListNavigationInputs<TabPattern>, 'multi'>,\n Omit<ListExpansionInputs, 'multiExpandable' | 'items'> {\n /** The selection strategy used by the tablist. */\n selectionMode: SignalLike<'follow' | 'explicit'>;\n}\n\n/** Controls the state of a tablist. */\nexport class TabListPattern {\n /** The list focus behavior for the tablist. */\n readonly focusBehavior: ListFocus<TabPattern>;\n\n /** The list navigation behavior for the tablist. */\n readonly navigationBehavior: ListNavigation<TabPattern>;\n\n /** Controls expansion for the tablist. */\n readonly expansionBehavior: ListExpansion;\n\n /** Whether the tablist has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** The currently active tab. */\n readonly activeTab: SignalLike<TabPattern | undefined> = () => this.inputs.activeItem();\n\n /** The currently selected tab. */\n readonly selectedTab: WritableSignalLike<TabPattern | undefined> = signal(undefined);\n\n /** Whether the tablist is vertically or horizontally oriented. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'> = () => this.inputs.orientation();\n\n /** Whether the tablist is disabled. */\n readonly disabled: SignalLike<boolean> = () => this.inputs.disabled();\n\n /** The tab index of the tablist. */\n readonly tabIndex = computed(() => this.focusBehavior.getListTabIndex());\n\n /** The id of the current active tab. */\n readonly activeDescendant = computed(() => this.focusBehavior.getActiveDescendant());\n\n /** Whether selection should follow focus. */\n readonly followFocus = computed(() => this.inputs.selectionMode() === 'follow');\n\n /** The key used to navigate to the previous tab in the tablist. */\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 /** The keydown event manager for the tablist. */\n readonly keydown = computed(() => {\n return new KeyboardEventManager()\n .on(\n this.prevKey,\n () => this._navigate(() => this.navigationBehavior.prev(), this.followFocus()),\n {ignoreRepeat: false},\n )\n .on(\n this.nextKey,\n () => this._navigate(() => this.navigationBehavior.next(), this.followFocus()),\n {ignoreRepeat: false},\n )\n .on('Home', () => this._navigate(() => this.navigationBehavior.first(), this.followFocus()))\n .on('End', () => this._navigate(() => this.navigationBehavior.last(), this.followFocus()))\n .on(' ', () => this.open())\n .on('Enter', () => this.open());\n });\n\n /** The click event manager for the tablist. */\n readonly clickManager = computed(() => {\n return new ClickEventManager<PointerEvent>().on(e =>\n this._navigate(() => this.navigationBehavior.goto(this._getItem(e)!), true),\n );\n });\n\n constructor(readonly inputs: TabListInputs) {\n this.focusBehavior = new ListFocus(inputs);\n\n this.navigationBehavior = new ListNavigation({\n ...inputs,\n focusManager: this.focusBehavior,\n });\n\n this.expansionBehavior = new ListExpansion({\n ...inputs,\n multiExpandable: () => false,\n });\n }\n\n /**\n * Sets the tablist to its default initial state.\n *\n * Sets the active index of the tablist to the first focusable selected\n * tab if one exists. Otherwise, sets focus to the first focusable tab.\n *\n * This method should be called once the tablist and its tabs are properly initialized.\n */\n setDefaultState() {\n let firstItem: TabPattern | undefined;\n\n for (const item of this.inputs.items()) {\n if (!this.focusBehavior.isFocusable(item)) continue;\n\n if (firstItem === undefined) {\n firstItem = item;\n }\n\n if (item.selected()) {\n this.inputs.activeItem.set(item);\n return;\n }\n }\n if (firstItem !== undefined) {\n this.inputs.activeItem.set(firstItem);\n }\n }\n\n /** Sets the default active state of the tablist before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n this.setDefaultState();\n }\n\n /** Handles keydown events for the tablist. */\n onKeydown(event: KeyboardEvent) {\n if (!this.disabled()) {\n this.hasBeenInteracted.set(true);\n this.keydown().handle(event);\n }\n }\n\n /** The click event manager for the tablist. */\n onClick(event: PointerEvent) {\n if (!this.disabled()) {\n this.hasBeenInteracted.set(true);\n this.clickManager().handle(event);\n }\n }\n\n /** Handles focusin events for the tablist. */\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n\n /** Opens the tab by given value. */\n open(value: string): boolean;\n\n /** Opens the given tab or the current active tab. */\n open(tab?: TabPattern): boolean;\n\n open(tab: TabPattern | string | undefined): boolean {\n tab ??= this.activeTab();\n\n if (typeof tab === 'string') {\n tab = this.inputs.items().find(t => t.value() === tab);\n }\n\n if (tab === undefined) return false;\n\n const success = this.expansionBehavior.open(tab);\n if (success) {\n this.selectedTab.set(tab);\n }\n\n return success;\n }\n\n /** Executes a navigation operation and expand the active tab if needed. */\n private _navigate(op: () => boolean, shouldExpand: boolean = false): void {\n const success = op();\n if (success && shouldExpand) {\n this.open();\n }\n }\n\n /** Returns the tab item associated with the given pointer event. */\n private _getItem(e: PointerEvent) {\n if (!(e.target instanceof HTMLElement)) {\n return;\n }\n\n const element = e.target.closest('[role=\"tab\"]');\n return this.inputs.items().find(i => i.element() === element);\n }\n}\n"],"names":["LabelControl","inputs","label","computed","labelledBy","defaultLabelledBy","length","constructor","TabPattern","id","index","tablist","items","indexOf","value","disabled","element","expandable","expanded","active","activeItem","selected","selectedTab","tabIndex","focusBehavior","getItemTabIndex","controls","tabpanel","open","TabPanelPattern","labelManager","hidden","tab","join","undefined","TabListPattern","navigationBehavior","expansionBehavior","hasBeenInteracted","signal","activeTab","orientation","getListTabIndex","activeDescendant","getActiveDescendant","followFocus","selectionMode","prevKey","textDirection","nextKey","keydown","KeyboardEventManager","on","_navigate","prev","ignoreRepeat","next","first","last","clickManager","ClickEventManager","e","goto","_getItem","ListFocus","ListNavigation","focusManager","ListExpansion","multiExpandable","setDefaultState","firstItem","item","isFocusable","set","setDefaultStateEffect","onKeydown","event","handle","onClick","onFocusIn","find","t","success","op","shouldExpand","target","HTMLElement","closest","i"],"mappings":";;;;;MAyBaA,YAAY,CAAA;EAuBFC,MAAA;EArBZC,KAAK,GAAGC,QAAQ,CAAC,MAAM,IAAI,CAACF,MAAM,CAACC,KAAK,IAAI,CAAC;EAG7CE,UAAU,GAAGD,QAAQ,CAAC,MAAK;AAClC,IAAA,MAAMD,KAAK,GAAG,IAAI,CAACA,KAAK,EAAE;IAC1B,MAAME,UAAU,GAAG,IAAI,CAACH,MAAM,CAACG,UAAU,IAAI;IAC7C,MAAMC,iBAAiB,GAAG,IAAI,CAACJ,MAAM,CAACI,iBAAiB,EAAE;AAEzD,IAAA,IAAID,UAAU,IAAIA,UAAU,CAACE,MAAM,GAAG,CAAC,EAAE;AACvC,MAAA,OAAOF,UAAU;AACnB,IAAA;AAIA,IAAA,IAAIF,KAAK,EAAE;AACT,MAAA,OAAO,EAAE;AACX,IAAA;AAEA,IAAA,OAAOG,iBAAiB;AAC1B,EAAA,CAAC,CAAC;EAEFE,WAAAA,CAAqBN,MAAuD,EAAA;IAAvD,IAAA,CAAAA,MAAM,GAANA,MAAM;AAAoD,EAAA;AAChF;;MCXYO,UAAU,CAAA;EAkCAP,MAAA;EAhCZQ,EAAE,GAAuBA,MAAM,IAAI,CAACR,MAAM,CAACQ,EAA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Q,CAAC,IAAIA,CAAC,CAACxE,OAAO,EAAE,KAAKA,OAAO,CAAC;AAC/D,EAAA;AACD;;;;"}
1
+ {"version":3,"file":"_tabs-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/tabs/tabs.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, ClickEventManager} from '../behaviors/event-manager';\nimport {ExpansionItem, ListExpansion, ListExpansionInputs} from '../behaviors/expansion/expansion';\nimport {\n SignalLike,\n WritableSignalLike,\n computed,\n linkedSignal,\n signal,\n} from '../behaviors/signal-like/signal-like';\nimport {ListFocus} from '../behaviors/list-focus/list-focus';\nimport {\n ListNavigation,\n ListNavigationInputs,\n ListNavigationItem,\n} from '../behaviors/list-navigation/list-navigation';\n\n/** The required inputs to tabs. */\nexport interface TabInputs\n extends Omit<ListNavigationItem, 'index'>, Omit<ExpansionItem, 'expandable' | 'expanded'> {\n /** The parent tablist that controls the tab. */\n tabList: SignalLike<TabListPattern>;\n\n /** The remote tabpanel controlled by the tab. */\n tabPanel: SignalLike<TabPanelPattern | undefined>;\n}\n\n/** A tab in a tablist. */\nexport class TabPattern {\n /** A global unique identifier for the tab. */\n readonly id: SignalLike<string>; // set from inputs\n\n /** Whether the tab is disabled. */\n readonly disabled: SignalLike<boolean>; // set from inputs\n\n /** The html element that should receive focus. */\n readonly element: SignalLike<HTMLElement> = () => this.inputs.element()!;\n\n /** Whether this tab has expandable panel. */\n readonly expandable: SignalLike<boolean> = () => true;\n\n /*\n * Whether the tab panel is expanded.\n * Primarily controlled by the behavior, which will read/write this value.\n * The consumer of this pattern will instead only use the selectedTab input.\n * The pattern will be responsible for synchronizing their state.\n */\n readonly expanded: WritableSignalLike<boolean> = linkedSignal(\n () => this.inputs.tabList().selectedTab() === this,\n );\n\n /** Whether the tab is active. */\n readonly active = computed(() => this.inputs.tabList().inputs.activeItem() === this);\n\n /** Whether the tab is selected. */\n readonly selected = computed(() => this.inputs.tabList().selectedTab() === this);\n\n /** The tab index of the tab. */\n readonly tabIndex = computed(() => this.inputs.tabList().focusBehavior.getItemTabIndex(this));\n\n /** The id of the tabpanel associated with the tab. */\n readonly controls = computed(() => this.inputs.tabPanel()?.id());\n\n constructor(readonly inputs: TabInputs) {\n this.id = inputs.id;\n this.disabled = inputs.disabled;\n }\n\n /** Opens the tab. */\n open(): boolean {\n return this.inputs.tabList().open(this);\n }\n}\n\n/** The required inputs for the tabpanel. */\nexport interface TabPanelInputs {\n /** A global unique identifier for the tabpanel. */\n id: SignalLike<string>;\n\n /** The tab that controls this tabpanel. */\n readonly tab: SignalLike<TabPattern | undefined>;\n}\n\n/** A tabpanel associated with a tab. */\nexport class TabPanelPattern {\n /** A global unique identifier for the tabpanel. */\n readonly id: SignalLike<string>; // set from inputs\n\n /** Whether the tabpanel is hidden. */\n readonly hidden = computed(() => this.inputs.tab()?.expanded() === false);\n\n /** The tab index of this tabpanel. */\n readonly tabIndex = computed(() => (this.hidden() ? -1 : 0));\n\n /** The aria-labelledby value for this tabpanel. */\n readonly labelledBy = computed(() => this.inputs.tab()?.id());\n\n constructor(readonly inputs: TabPanelInputs) {\n this.id = inputs.id;\n }\n}\n\n/** The required inputs for the tablist. */\nexport interface TabListInputs\n extends\n Omit<ListNavigationInputs<TabPattern>, 'multi'>,\n Omit<ListExpansionInputs, 'multiExpandable' | 'items'> {\n /** The selection strategy used by the tablist. */\n selectionMode: SignalLike<'follow' | 'explicit'>;\n\n /** The currently selected tab. */\n selectedTab: WritableSignalLike<TabPattern | undefined>;\n}\n\n/** Controls the state of a tablist. */\nexport class TabListPattern {\n /** The list focus behavior for the tablist. */\n readonly focusBehavior: ListFocus<TabPattern>;\n\n /** The list navigation behavior for the tablist. */\n readonly navigationBehavior: ListNavigation<TabPattern>;\n\n /** Controls expansion for the tablist. */\n readonly expansionBehavior: ListExpansion;\n\n /** Whether the tablist has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** The currently active tab. */\n readonly activeTab: SignalLike<TabPattern | undefined>; // set from inputs\n\n /** The currently selected tab. */\n readonly selectedTab: WritableSignalLike<TabPattern | undefined>; // set from inputs\n\n /** Whether the tablist is vertically or horizontally oriented. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'>; // set from inputs\n\n /** Whether the tablist is disabled. */\n readonly disabled: SignalLike<boolean>; // set from inputs\n\n /** The tab index of the tablist. */\n readonly tabIndex = computed(() => this.focusBehavior.getListTabIndex());\n\n /** The id of the current active tab. */\n readonly activeDescendant = computed(() => this.focusBehavior.getActiveDescendant());\n\n /** Whether selection should follow focus. */\n readonly followFocus = computed(() => this.inputs.selectionMode() === 'follow');\n\n /** The key used to navigate to the previous tab in the tablist. */\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 /** The keydown event manager for the tablist. */\n readonly keydown = computed(() => {\n return new KeyboardEventManager()\n .on(\n this.prevKey,\n () => this._navigate(() => this.navigationBehavior.prev(), this.followFocus()),\n {ignoreRepeat: false},\n )\n .on(\n this.nextKey,\n () => this._navigate(() => this.navigationBehavior.next(), this.followFocus()),\n {ignoreRepeat: false},\n )\n .on('Home', () => this._navigate(() => this.navigationBehavior.first(), this.followFocus()))\n .on('End', () => this._navigate(() => this.navigationBehavior.last(), this.followFocus()))\n .on(' ', () => this.open())\n .on('Enter', () => this.open());\n });\n\n /** The click event manager for the tablist. */\n readonly clickManager = computed(() => {\n return new ClickEventManager<PointerEvent>().on(e =>\n this._navigate(() => this.navigationBehavior.goto(this._getItem(e)!), true),\n );\n });\n\n constructor(readonly inputs: TabListInputs) {\n this.selectedTab = inputs.selectedTab;\n this.activeTab = inputs.activeItem;\n this.orientation = inputs.orientation;\n this.disabled = inputs.disabled;\n\n this.focusBehavior = new ListFocus(inputs);\n\n this.navigationBehavior = new ListNavigation({\n ...inputs,\n focusManager: this.focusBehavior,\n });\n\n this.expansionBehavior = new ListExpansion({\n ...inputs,\n multiExpandable: () => false,\n });\n }\n\n /**\n * Sets the tablist to its default initial state.\n *\n * Sets the active index of the tablist to the first focusable selected\n * tab if one exists. Otherwise, sets focus to the first focusable tab.\n *\n * This method should be called once the tablist and its tabs are properly initialized.\n */\n setDefaultState() {\n let firstItem: TabPattern | undefined;\n\n for (const item of this.inputs.items()) {\n if (!this.focusBehavior.isFocusable(item)) continue;\n\n if (firstItem === undefined) {\n firstItem = item;\n }\n\n if (item.selected()) {\n this.inputs.activeItem.set(item);\n return;\n }\n }\n if (firstItem !== undefined) {\n this.inputs.activeItem.set(firstItem);\n }\n }\n\n /** Sets the default active state of the tablist before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n this.setDefaultState();\n }\n\n /** Handles keydown events for the tablist. */\n onKeydown(event: KeyboardEvent) {\n if (!this.disabled()) {\n this.hasBeenInteracted.set(true);\n this.keydown().handle(event);\n }\n }\n\n /** The click event manager for the tablist. */\n onClick(event: PointerEvent) {\n if (!this.disabled()) {\n this.hasBeenInteracted.set(true);\n this.clickManager().handle(event);\n }\n }\n\n /** Handles focusin events for the tablist. */\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n\n /** Opens the given tab or the current active tab. */\n open(tab?: TabPattern): boolean;\n open(tab: TabPattern | undefined): boolean {\n tab ??= this.activeTab();\n\n if (tab === undefined) return false;\n\n const success = this.expansionBehavior.open(tab);\n if (success) {\n this.selectedTab.set(tab);\n }\n\n return success;\n }\n\n /** Executes a navigation operation and expand the active tab if needed. */\n private _navigate(op: () => boolean, shouldExpand: boolean = false): void {\n const success = op();\n if (success && shouldExpand) {\n this.open();\n }\n }\n\n /** Returns the tab item associated with the given pointer event. */\n private _getItem(e: PointerEvent) {\n if (!(e.target instanceof HTMLElement)) {\n return;\n }\n\n const element = e.target.closest('[role=\"tab\"]');\n return this.inputs.items().find(i => i.element() === element);\n }\n}\n"],"names":["TabPattern","inputs","id","disabled","element","expandable","expanded","linkedSignal","tabList","selectedTab","active","computed","activeItem","selected","tabIndex","focusBehavior","getItemTabIndex","controls","tabPanel","constructor","open","TabPanelPattern","hidden","tab","labelledBy","TabListPattern","navigationBehavior","expansionBehavior","hasBeenInteracted","signal","activeTab","orientation","getListTabIndex","activeDescendant","getActiveDescendant","followFocus","selectionMode","prevKey","textDirection","nextKey","keydown","KeyboardEventManager","on","_navigate","prev","ignoreRepeat","next","first","last","clickManager","ClickEventManager","e","goto","_getItem","ListFocus","ListNavigation","focusManager","ListExpansion","multiExpandable","setDefaultState","firstItem","item","items","isFocusable","undefined","set","setDefaultStateEffect","onKeydown","event","handle","onClick","onFocusIn","success","op","shouldExpand","target","HTMLElement","closest","find","i"],"mappings":";;;;;MAmCaA,UAAU,CAAA;EAmCAC,MAAA;EAjCZC,EAAE;EAGFC,QAAQ;EAGRC,OAAO,GAA4BA,MAAM,IAAI,CAACH,MAAM,CAACG,OAAO,EAAG;EAG/DC,UAAU,GAAwBA,MAAM,IAAI;AAQ5CC,EAAAA,QAAQ,GAAgCC,YAAY,CAC3D,MAAM,IAAI,CAACN,MAAM,CAACO,OAAO,EAAE,CAACC,WAAW,EAAE,KAAK,IAAI,CACnD;AAGQC,EAAAA,MAAM,GAAGC,QAAQ,CAAC,MAAM,IAAI,CAACV,MAAM,CAACO,OAAO,EAAE,CAACP,MAAM,CAACW,UAAU,EAAE,KAAK,IAAI,CAAC;AAG3EC,EAAAA,QAAQ,GAAGF,QAAQ,CAAC,MAAM,IAAI,CAACV,MAAM,CAACO,OAAO,EAAE,CAACC,WAAW,EAAE,KAAK,IAAI,CA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E,CAACgB,IAAI,CAACC,CAAC,IAAIA,CAAC,CAAC3E,OAAO,EAAE,KAAKA,OAAO,CAAC;AAC/D,EAAA;AACD;;;;"}
@@ -1,4 +1,4 @@
1
- import { signal, computed, KeyboardEventManager } from './_signal-like-chunk.mjs';
1
+ import { signal, computed, KeyboardEventManager } from './_collection-chunk.mjs';
2
2
  import { List } from './_list-chunk.mjs';
3
3
 
4
4
  class ToolbarPattern {
@@ -1 +1 @@
1
- {"version":3,"file":"_toolbar-widget-group-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar-widget.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar-widget-group.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, signal, SignalLike} from '../behaviors/signal-like/signal-like';\nimport {KeyboardEventManager} from '../behaviors/event-manager';\nimport {List, ListInputs} from '../behaviors/list/list';\nimport {ToolbarWidgetPattern} from './toolbar-widget';\n\n/** Represents the required inputs for a toolbar. */\nexport type ToolbarInputs<V> = Omit<\n ListInputs<ToolbarWidgetPattern<V>, V>,\n 'multi' | 'typeaheadDelay' | 'selectionMode' | 'focusMode'\n> & {\n /** A function that returns the toolbar item associated with a given element. */\n getItem: (e: Element) => ToolbarWidgetPattern<V> | undefined;\n};\n\n/** Controls the state of a toolbar. */\nexport class ToolbarPattern<V> {\n /** The list behavior for the toolbar. */\n readonly listBehavior: List<ToolbarWidgetPattern<V>, V>;\n\n /** Whether the toolbar has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the tablist is vertically or horizontally oriented. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** Whether disabled items in the group should be focusable. */\n readonly softDisabled: SignalLike<boolean>;\n\n /** Whether the toolbar is disabled. */\n readonly disabled = computed(() => this.listBehavior.disabled());\n\n /** The tab index of the toolbar (if using activedescendant). */\n readonly tabIndex = computed(() => this.listBehavior.tabIndex());\n\n /** The id of the current active widget (if using activedescendant). */\n readonly activeDescendant = computed(() => this.listBehavior.activeDescendant());\n\n /** The currently active item in the toolbar. */\n readonly activeItem = () => this.listBehavior.inputs.activeItem();\n\n /** The key used to navigate to the previous widget. */\n private readonly _prevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key used to navigate to the next widget. */\n private readonly _nextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The alternate key used to navigate to the previous widget. */\n private readonly _altPrevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n }\n return 'ArrowUp';\n });\n\n /** The alternate key used to navigate to the next widget. */\n private readonly _altNextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n }\n return 'ArrowDown';\n });\n\n /** The keydown event manager for the toolbar. */\n private readonly _keydown = computed(() => {\n const manager = new KeyboardEventManager();\n\n return manager\n .on(this._nextKey, () => this.listBehavior.next(), {ignoreRepeat: false})\n .on(this._prevKey, () => this.listBehavior.prev(), {ignoreRepeat: false})\n .on(this._altNextKey, () => this._groupNext(), {ignoreRepeat: false})\n .on(this._altPrevKey, () => this._groupPrev(), {ignoreRepeat: false})\n .on(' ', () => this.select())\n .on('Enter', () => this.select())\n .on('Home', () => this.listBehavior.first())\n .on('End', () => this.listBehavior.last());\n });\n\n /** Navigates to the next widget in a widget group. */\n private _groupNext() {\n const currGroup = this.inputs.activeItem()?.group();\n const nextGroup = this.listBehavior.navigationBehavior.peekNext()?.group();\n\n if (!currGroup) {\n return;\n }\n\n if (currGroup !== nextGroup) {\n this.listBehavior.goto(\n this.listBehavior.navigationBehavior.peekFirst({\n items: currGroup.inputs.items(),\n })!,\n );\n\n return;\n }\n\n this.listBehavior.next();\n }\n\n /** Navigates to the previous widget in a widget group. */\n private _groupPrev() {\n const currGroup = this.inputs.activeItem()?.group();\n const nextGroup = this.listBehavior.navigationBehavior.peekPrev()?.group();\n\n if (!currGroup) {\n return;\n }\n\n if (currGroup !== nextGroup) {\n this.listBehavior.goto(\n this.listBehavior.navigationBehavior.peekLast({\n items: currGroup.inputs.items(),\n })!,\n );\n\n return;\n }\n\n this.listBehavior.prev();\n }\n\n /** Navigates to the widget targeted by a pointer event. */\n private _goto(e: MouseEvent) {\n const item = this.inputs.getItem(e.target as Element);\n\n if (item) {\n this.listBehavior.goto(item);\n this.select();\n }\n }\n\n select() {\n const group = this.inputs.activeItem()?.group();\n\n if (!group?.multi()) {\n group?.inputs.items().forEach(i => this.listBehavior.deselect(i));\n }\n\n this.listBehavior.toggle();\n }\n\n constructor(readonly inputs: ToolbarInputs<V>) {\n this.orientation = inputs.orientation;\n this.softDisabled = inputs.softDisabled;\n\n this.listBehavior = new List({\n ...inputs,\n multi: () => true,\n focusMode: () => 'roving',\n selectionMode: () => 'explicit',\n typeaheadDelay: () => 0, // Toolbar widgets do not support typeahead.\n });\n }\n\n /** Handles keydown events for the toolbar. */\n onKeydown(event: KeyboardEvent) {\n if (this.disabled()) return;\n this.hasBeenInteracted.set(true);\n this._keydown().handle(event);\n }\n\n onPointerdown(event: PointerEvent) {\n this.hasBeenInteracted.set(true);\n event.preventDefault();\n }\n\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n\n /** Handles click events for the toolbar. */\n onClick(event: MouseEvent) {\n if (this.disabled() || (event as PointerEvent).pointerType === '') return;\n this._goto(event);\n }\n\n /**\n * Sets the toolbar to its default initial state.\n *\n * Sets the active index to the selected widget if one exists and is focusable.\n * Otherwise, sets the active index to the first focusable widget.\n */\n setDefaultState() {\n const firstItem = this.listBehavior.navigationBehavior.peekFirst({\n items: this.inputs.items(),\n });\n\n if (firstItem) {\n this.inputs.activeItem.set(firstItem);\n }\n }\n\n /** Sets the default active state of the toolbar before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {SignalLike, computed} from '../behaviors/signal-like/signal-like';\nimport {ListItem} from '../behaviors/list/list';\nimport type {ToolbarPattern} from './toolbar';\nimport {ToolbarWidgetGroupPattern} from './toolbar-widget-group';\n\n/** Represents the required inputs for a toolbar widget in a toolbar. */\nexport interface ToolbarWidgetInputs<V> extends Omit<\n ListItem<V>,\n 'searchTerm' | 'index' | 'selectable'\n> {\n /** A reference to the parent toolbar. */\n toolbar: SignalLike<ToolbarPattern<V>>;\n\n /** A reference to the parent widget group. */\n group: SignalLike<ToolbarWidgetGroupPattern<ToolbarWidgetPattern<V>, V> | undefined>;\n}\n\nexport class ToolbarWidgetPattern<V> implements ListItem<V> {\n /** A unique identifier for the widget. */\n readonly id = () => this.inputs.id();\n\n /** The html element that should receive focus. */\n readonly element = () => this.inputs.element();\n\n /** Whether the widget is disabled. */\n readonly disabled = () => this.inputs.disabled() || this.group()?.disabled() || false;\n\n /** A reference to the parent toolbar. */\n readonly group = () => this.inputs.group();\n\n /** A reference to the toolbar containing the widget. */\n readonly toolbar = () => this.inputs.toolbar();\n\n /** The tabindex of the widget. */\n readonly tabIndex = computed(() => this.toolbar().listBehavior.getItemTabindex(this));\n\n /** The text used by the typeahead search. */\n readonly searchTerm = () => ''; // Unused because toolbar does not support typeahead.\n\n /** The value associated with the widget. */\n readonly value = () => this.inputs.value();\n\n /** Whether the widget is selectable. */\n readonly selectable = () => true; // Unused because toolbar does not support selection.\n\n /** The position of the widget within the toolbar. */\n readonly index = computed(() => this.toolbar().inputs.items().indexOf(this) ?? -1);\n\n /** Whether the widget is selected (only relevant in a selection group). */\n readonly selected = computed(() =>\n this.toolbar().listBehavior.inputs.value().includes(this.value()),\n );\n\n /** Whether the widget is currently the active one (focused). */\n readonly active: SignalLike<boolean> = computed(() => this.toolbar().activeItem() === this);\n\n constructor(readonly inputs: ToolbarWidgetInputs<V>) {}\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {ListItem} from '../behaviors/list/list';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport type {ToolbarPattern} from './toolbar';\n\n/** Represents the required inputs for a toolbar widget group. */\nexport interface ToolbarWidgetGroupInputs<T extends ListItem<V>, V> {\n /** A reference to the parent toolbar. */\n toolbar: SignalLike<ToolbarPattern<V> | undefined>;\n\n /** Whether the widget group is disabled. */\n disabled: SignalLike<boolean>;\n\n /** The list of items within the widget group. */\n items: SignalLike<T[]>;\n\n /** Whether the group allows multiple widgets to be selected. */\n multi: SignalLike<boolean>;\n}\n\n/** A group of widgets within a toolbar that provides nested navigation. */\nexport class ToolbarWidgetGroupPattern<T extends ListItem<V>, V> {\n /** Whether the widget is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** A reference to the parent toolbar. */\n readonly toolbar = () => this.inputs.toolbar();\n\n /** Whether the group allows multiple widgets to be selected. */\n readonly multi = () => this.inputs.multi();\n\n readonly searchTerm = () => ''; // Unused because toolbar does not support typeahead.\n readonly value = () => '' as V; // Unused because toolbar does not support selection.\n readonly selectable = () => true; // Unused because toolbar does not support selection.\n readonly element = () => undefined; // Unused because toolbar does not focus the group element.\n\n constructor(readonly inputs: ToolbarWidgetGroupInputs<T, V>) {}\n}\n"],"names":["ToolbarPattern","inputs","listBehavior","hasBeenInteracted","signal","orientation","softDisabled","disabled","computed","tabIndex","activeDescendant","activeItem","_prevKey","textDirection","_nextKey","_altPrevKey","_altNextKey","_keydown","manager","KeyboardEventManager","on","next","ignoreRepeat","prev","_groupNext","_groupPrev","select","first","last","currGroup","group","nextGroup","navigationBehavior","peekNext","goto","peekFirst","items","peekPrev","peekLast","_goto","e","item","getItem","target","multi","forEach","i","deselect","toggle","constructor","List","focusMode","selectionMode","typeaheadDelay","onKeydown","event","set","handle","onPointerdown","preventDefault","onFocusIn","onClick","pointerType","setDefaultState","firstItem","setDefaultStateEffect","length","ToolbarWidgetPattern","id","element","toolbar","getItemTabindex","searchTerm","value","selectable","index","indexOf","selected","includes","active","ToolbarWidgetGroupPattern","undefined"],"mappings":";;;MAuBaA,cAAc,CAAA;EAwIJC,MAAA;EAtIZC,YAAY;AAGZC,EAAAA,iBAAiB,GAAGC,MAAM,CAAC,KAAK,CAAC;EAGjCC,WAAW;EAGXC,YAAY;EAGZC,QAAQ,GAAGC,QAAQ,CAAC,MAAM,IAAI,CAACN,YAAY,CAACK,QAAQ,EAAE,CAAC;EAGvDE,QAAQ,GAAGD,QAAQ,CAAC,MAAM,IAAI,CAACN,YAAY,CAACO,QAAQ,EAAE,CAAC;EAGvDC,gBAAgB,GAAGF,QAAQ,CAAC,MAAM,IAAI,CAACN,YAAY,CAACQ,gBAAgB,EAAE,CAAC;EAGvEC,UAAU,GAAGA,MAAM,IAAI,CAACT,YAAY,CAACD,MAAM,CAACU,UAAU,EAAE;EAGhDC,QAAQ,GAAGJ,QAAQ,CAAC,MAAK;IACxC,IAAI,IAAI,CAACP,MAAM,CAACI,WAAW,EAAE,KAAK,UAAU,EAAE;AAC5C,MAAA,OAAO,SAAS;AAClB,IAAA;AACA,IAAA,OAAO,IAAI,CAACJ,MAAM,CAACY,aAAa,EAAE,KAAK,KAAK,GAAG,YAAY,GAAG,WAAW;AAC3E,EAAA,CAAC,CAAC;EAGeC,QAA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AAE,CAACK,QAAQ,CAAC,IAAI,CAACL,KAAK,EAAE,CAAC,CAClE;AAGQM,EAAAA,MAAM,GAAwBvE,QAAQ,CAAC,MAAM,IAAI,CAAC8D,OAAO,EAAE,CAAC3D,UAAU,EAAE,KAAK,IAAI,CAAC;EAE3FsC,WAAAA,CAAqBhD,MAA8B,EAAA;IAA9B,IAAA,CAAAA,MAAM,GAANA,MAAM;AAA2B,EAAA;AACvD;;MCrCY+E,yBAAyB,CAAA;EAef/E,MAAA;EAbZM,QAAQ,GAAGA,MAAM,IAAI,CAACN,MAAM,CAACM,QAAQ,EAAE;EAGvC+D,OAAO,GAAGA,MAAM,IAAI,CAACrE,MAAM,CAACqE,OAAO,EAAE;EAGrC1B,KAAK,GAAGA,MAAM,IAAI,CAAC3C,MAAM,CAAC2C,KAAK,EAAE;EAEjC4B,UAAU,GAAGA,MAAM,EAAE;EACrBC,KAAK,GAAGA,MAAM,EAAO;EACrBC,UAAU,GAAGA,MAAM,IAAI;EACvBL,OAAO,GAAGA,MAAMY,SAAS;EAElChC,WAAAA,CAAqBhD,MAAsC,EAAA;IAAtC,IAAA,CAAAA,MAAM,GAANA,MAAM;AAAmC,EAAA;AAC/D;;;;"}
1
+ {"version":3,"file":"_toolbar-widget-group-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar-widget.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/toolbar/toolbar-widget-group.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, signal, SignalLike} from '../behaviors/signal-like/signal-like';\nimport {KeyboardEventManager} from '../behaviors/event-manager';\nimport {List, ListInputs} from '../behaviors/list/list';\nimport {ToolbarWidgetPattern} from './toolbar-widget';\n\n/** Represents the required inputs for a toolbar. */\nexport type ToolbarInputs<V> = Omit<\n ListInputs<ToolbarWidgetPattern<V>, V>,\n 'multi' | 'typeaheadDelay' | 'selectionMode' | 'focusMode'\n> & {\n /** A function that returns the toolbar item associated with a given element. */\n getItem: (e: Element) => ToolbarWidgetPattern<V> | undefined;\n};\n\n/** Controls the state of a toolbar. */\nexport class ToolbarPattern<V> {\n /** The list behavior for the toolbar. */\n readonly listBehavior: List<ToolbarWidgetPattern<V>, V>;\n\n /** Whether the toolbar has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** Whether the tablist is vertically or horizontally oriented. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** Whether disabled items in the group should be focusable. */\n readonly softDisabled: SignalLike<boolean>;\n\n /** Whether the toolbar is disabled. */\n readonly disabled = computed(() => this.listBehavior.disabled());\n\n /** The tab index of the toolbar (if using activedescendant). */\n readonly tabIndex = computed(() => this.listBehavior.tabIndex());\n\n /** The id of the current active widget (if using activedescendant). */\n readonly activeDescendant = computed(() => this.listBehavior.activeDescendant());\n\n /** The currently active item in the toolbar. */\n readonly activeItem = () => this.listBehavior.inputs.activeItem();\n\n /** The key used to navigate to the previous widget. */\n private readonly _prevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key used to navigate to the next widget. */\n private readonly _nextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The alternate key used to navigate to the previous widget. */\n private readonly _altPrevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n }\n return 'ArrowUp';\n });\n\n /** The alternate key used to navigate to the next widget. */\n private readonly _altNextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n }\n return 'ArrowDown';\n });\n\n /** The keydown event manager for the toolbar. */\n private readonly _keydown = computed(() => {\n const manager = new KeyboardEventManager();\n\n return manager\n .on(this._nextKey, () => this.listBehavior.next(), {ignoreRepeat: false})\n .on(this._prevKey, () => this.listBehavior.prev(), {ignoreRepeat: false})\n .on(this._altNextKey, () => this._groupNext(), {ignoreRepeat: false})\n .on(this._altPrevKey, () => this._groupPrev(), {ignoreRepeat: false})\n .on(' ', () => this.select())\n .on('Enter', () => this.select())\n .on('Home', () => this.listBehavior.first())\n .on('End', () => this.listBehavior.last());\n });\n\n /** Navigates to the next widget in a widget group. */\n private _groupNext() {\n const currGroup = this.inputs.activeItem()?.group();\n const nextGroup = this.listBehavior.navigationBehavior.peekNext()?.group();\n\n if (!currGroup) {\n return;\n }\n\n if (currGroup !== nextGroup) {\n this.listBehavior.goto(\n this.listBehavior.navigationBehavior.peekFirst({\n items: currGroup.inputs.items(),\n })!,\n );\n\n return;\n }\n\n this.listBehavior.next();\n }\n\n /** Navigates to the previous widget in a widget group. */\n private _groupPrev() {\n const currGroup = this.inputs.activeItem()?.group();\n const nextGroup = this.listBehavior.navigationBehavior.peekPrev()?.group();\n\n if (!currGroup) {\n return;\n }\n\n if (currGroup !== nextGroup) {\n this.listBehavior.goto(\n this.listBehavior.navigationBehavior.peekLast({\n items: currGroup.inputs.items(),\n })!,\n );\n\n return;\n }\n\n this.listBehavior.prev();\n }\n\n /** Navigates to the widget targeted by a pointer event. */\n private _goto(e: MouseEvent) {\n const item = this.inputs.getItem(e.target as Element);\n\n if (item) {\n this.listBehavior.goto(item);\n this.select();\n }\n }\n\n select() {\n const group = this.inputs.activeItem()?.group();\n\n if (!group?.multi()) {\n group?.inputs.items().forEach(i => this.listBehavior.deselect(i));\n }\n\n this.listBehavior.toggle();\n }\n\n constructor(readonly inputs: ToolbarInputs<V>) {\n this.orientation = inputs.orientation;\n this.softDisabled = inputs.softDisabled;\n\n this.listBehavior = new List({\n ...inputs,\n multi: () => true,\n focusMode: () => 'roving',\n selectionMode: () => 'explicit',\n typeaheadDelay: () => 0, // Toolbar widgets do not support typeahead.\n });\n }\n\n /** Handles keydown events for the toolbar. */\n onKeydown(event: KeyboardEvent) {\n if (this.disabled()) return;\n this.hasBeenInteracted.set(true);\n this._keydown().handle(event);\n }\n\n onPointerdown(event: PointerEvent) {\n this.hasBeenInteracted.set(true);\n event.preventDefault();\n }\n\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n\n /** Handles click events for the toolbar. */\n onClick(event: MouseEvent) {\n if (this.disabled() || (event as PointerEvent).pointerType === '') return;\n this._goto(event);\n }\n\n /**\n * Sets the toolbar to its default initial state.\n *\n * Sets the active index to the selected widget if one exists and is focusable.\n * Otherwise, sets the active index to the first focusable widget.\n */\n setDefaultState() {\n const firstItem = this.listBehavior.navigationBehavior.peekFirst({\n items: this.inputs.items(),\n });\n\n if (firstItem) {\n this.inputs.activeItem.set(firstItem);\n }\n }\n\n /** Sets the default active state of the toolbar before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n if (this.inputs.items().length > 0) {\n this.setDefaultState();\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {SignalLike, computed} from '../behaviors/signal-like/signal-like';\nimport {ListItem} from '../behaviors/list/list';\nimport type {ToolbarPattern} from './toolbar';\nimport {ToolbarWidgetGroupPattern} from './toolbar-widget-group';\n\n/** Represents the required inputs for a toolbar widget in a toolbar. */\nexport interface ToolbarWidgetInputs<V> extends Omit<\n ListItem<V>,\n 'searchTerm' | 'index' | 'selectable'\n> {\n /** A reference to the parent toolbar. */\n toolbar: SignalLike<ToolbarPattern<V>>;\n\n /** A reference to the parent widget group. */\n group: SignalLike<ToolbarWidgetGroupPattern<ToolbarWidgetPattern<V>, V> | undefined>;\n}\n\nexport class ToolbarWidgetPattern<V> implements ListItem<V> {\n /** A unique identifier for the widget. */\n readonly id = () => this.inputs.id();\n\n /** The html element that should receive focus. */\n readonly element = () => this.inputs.element();\n\n /** Whether the widget is disabled. */\n readonly disabled = () => this.inputs.disabled() || this.group()?.disabled() || false;\n\n /** A reference to the parent toolbar. */\n readonly group = () => this.inputs.group();\n\n /** A reference to the toolbar containing the widget. */\n readonly toolbar = () => this.inputs.toolbar();\n\n /** The tabindex of the widget. */\n readonly tabIndex = computed(() => this.toolbar().listBehavior.getItemTabindex(this));\n\n /** The text used by the typeahead search. */\n readonly searchTerm = () => ''; // Unused because toolbar does not support typeahead.\n\n /** The value associated with the widget. */\n readonly value = () => this.inputs.value();\n\n /** Whether the widget is selectable. */\n readonly selectable = () => true; // Unused because toolbar does not support selection.\n\n /** The position of the widget within the toolbar. */\n readonly index = computed(() => this.toolbar().inputs.items().indexOf(this) ?? -1);\n\n /** Whether the widget is selected (only relevant in a selection group). */\n readonly selected = computed(() =>\n this.toolbar().listBehavior.inputs.value().includes(this.value()),\n );\n\n /** Whether the widget is currently the active one (focused). */\n readonly active: SignalLike<boolean> = computed(() => this.toolbar().activeItem() === this);\n\n constructor(readonly inputs: ToolbarWidgetInputs<V>) {}\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {ListItem} from '../behaviors/list/list';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport type {ToolbarPattern} from './toolbar';\n\n/** Represents the required inputs for a toolbar widget group. */\nexport interface ToolbarWidgetGroupInputs<T extends ListItem<V>, V> {\n /** A reference to the parent toolbar. */\n toolbar: SignalLike<ToolbarPattern<V> | undefined>;\n\n /** Whether the widget group is disabled. */\n disabled: SignalLike<boolean>;\n\n /** The list of items within the widget group. */\n items: SignalLike<T[]>;\n\n /** Whether the group allows multiple widgets to be selected. */\n multi: SignalLike<boolean>;\n}\n\n/** A group of widgets within a toolbar that provides nested navigation. */\nexport class ToolbarWidgetGroupPattern<T extends ListItem<V>, V> {\n /** Whether the widget is disabled. */\n readonly disabled = () => this.inputs.disabled();\n\n /** A reference to the parent toolbar. */\n readonly toolbar = () => this.inputs.toolbar();\n\n /** Whether the group allows multiple widgets to be selected. */\n readonly multi = () => this.inputs.multi();\n\n readonly searchTerm = () => ''; // Unused because toolbar does not support typeahead.\n readonly value = () => '' as V; // Unused because toolbar does not support selection.\n readonly selectable = () => true; // Unused because toolbar does not support selection.\n readonly element = () => undefined; // Unused because toolbar does not focus the group element.\n\n constructor(readonly inputs: ToolbarWidgetGroupInputs<T, V>) {}\n}\n"],"names":["ToolbarPattern","inputs","listBehavior","hasBeenInteracted","signal","orientation","softDisabled","disabled","computed","tabIndex","activeDescendant","activeItem","_prevKey","textDirection","_nextKey","_altPrevKey","_altNextKey","_keydown","manager","KeyboardEventManager","on","next","ignoreRepeat","prev","_groupNext","_groupPrev","select","first","last","currGroup","group","nextGroup","navigationBehavior","peekNext","goto","peekFirst","items","peekPrev","peekLast","_goto","e","item","getItem","target","multi","forEach","i","deselect","toggle","constructor","List","focusMode","selectionMode","typeaheadDelay","onKeydown","event","set","handle","onPointerdown","preventDefault","onFocusIn","onClick","pointerType","setDefaultState","firstItem","setDefaultStateEffect","length","ToolbarWidgetPattern","id","element","toolbar","getItemTabindex","searchTerm","value","selectable","index","indexOf","selected","includes","active","ToolbarWidgetGroupPattern","undefined"],"mappings":";;;MAuBaA,cAAc,CAAA;EAwIJC,MAAA;EAtIZC,YAAY;AAGZC,EAAAA,iBAAiB,GAAGC,MAAM,CAAC,KAAK,CAAC;EAGjCC,WAAW;EAGXC,YAAY;EAGZC,QAAQ,GAAGC,QAAQ,CAAC,MAAM,IAAI,CAACN,YAAY,CAACK,QAAQ,EAAE,CAAC;EAGvDE,QAAQ,GAAGD,QAAQ,CAAC,MA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}
@@ -0,0 +1,8 @@
1
+ import { numberAttribute } from '@angular/core';
2
+
3
+ function tabIndexTransform(v) {
4
+ return v === undefined ? undefined : numberAttribute(v);
5
+ }
6
+
7
+ export { tabIndexTransform };
8
+ //# sourceMappingURL=_transforms-chunk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_transforms-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/utils/transforms.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 {numberAttribute} from '@angular/core';\n\n/**\n * Transform function for tabIndex inputs.\n * Returns undefined if the value is undefined, otherwise converts it to a number.\n */\nexport function tabIndexTransform(v: string | number | undefined): number | undefined {\n return v === undefined ? undefined : numberAttribute(v);\n}\n"],"names":["tabIndexTransform","v","undefined","numberAttribute"],"mappings":";;AAcM,SAAUA,iBAAiBA,CAACC,CAA8B,EAAA;EAC9D,OAAOA,CAAC,KAAKC,SAAS,GAAGA,SAAS,GAAGC,eAAe,CAACF,CAAC,CAAC;AACzD;;;;"}
@@ -1,4 +1,4 @@
1
- import { computed, signal, KeyboardEventManager, Modifier } from './_signal-like-chunk.mjs';
1
+ import { computed, signal, KeyboardEventManager, Modifier } from './_collection-chunk.mjs';
2
2
  import { ListExpansion } from './_expansion-chunk.mjs';
3
3
  import { ListNavigation, ListFocus } from './_list-navigation-chunk.mjs';
4
4
  import { ListSelection, ListTypeahead } from './_list-typeahead-chunk.mjs';
@@ -478,50 +478,5 @@ class TreePattern {
478
478
  }
479
479
  }
480
480
 
481
- class ComboboxTreePattern extends TreePattern {
482
- inputs;
483
- toggleExpansion = item => this.treeBehavior.toggleExpansion(item);
484
- isItemCollapsible = () => this.inputs.activeItem()?.parent() instanceof TreeItemPattern;
485
- role = () => 'tree';
486
- activeId = computed(() => this.treeBehavior.activeDescendant());
487
- getActiveItem = () => this.inputs.activeItem();
488
- items = computed(() => this.inputs.items());
489
- tabIndex = () => -1;
490
- constructor(inputs) {
491
- if (inputs.combobox()) {
492
- inputs.multi = () => false;
493
- inputs.focusMode = () => 'activedescendant';
494
- inputs.element = inputs.combobox().inputs.inputEl;
495
- }
496
- super(inputs);
497
- this.inputs = inputs;
498
- }
499
- onKeydown(_) {}
500
- onClick(_) {}
501
- setDefaultState() {}
502
- focus = item => this.treeBehavior.goto(item);
503
- next = () => this.treeBehavior.next();
504
- prev = () => this.treeBehavior.prev();
505
- last = () => this.treeBehavior.last();
506
- first = () => this.treeBehavior.first();
507
- unfocus = () => this.treeBehavior.unfocus();
508
- select = item => this.treeBehavior.select(item);
509
- toggle = item => this.treeBehavior.toggle(item);
510
- clearSelection = () => this.treeBehavior.deselectAll();
511
- getItem = e => this._getItem(e);
512
- getSelectedItems = () => this.inputs.items().filter(item => item.selected());
513
- setValue = value => this.inputs.value.set(value ? [value] : []);
514
- expandItem = () => this._expandOrFirstChild();
515
- collapseItem = () => this._collapseOrParent();
516
- isItemExpandable(item = this.inputs.activeItem()) {
517
- return item ? item.expandable() : false;
518
- }
519
- expandAll = () => this.treeBehavior.expandAll();
520
- collapseAll = () => this.treeBehavior.collapseAll();
521
- isItemSelectable = (item = this.inputs.activeItem()) => {
522
- return item ? item.selectable() : false;
523
- };
524
- }
525
-
526
- export { ComboboxTreePattern, TreeItemPattern, TreePattern };
527
- //# sourceMappingURL=_combobox-tree-chunk.mjs.map
481
+ export { TreeItemPattern, TreePattern };
482
+ //# sourceMappingURL=_tree-chunk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_tree-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/behaviors/tree/tree.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/tree/tree.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, signal, SignalLike} from '../signal-like/signal-like';\nimport {ExpansionItem, ListExpansion, ListExpansionInputs} from '../expansion/expansion';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../list-focus/list-focus';\nimport {\n ListNavigation,\n ListNavigationInputs,\n ListNavigationItem,\n} from '../list-navigation/list-navigation';\nimport {\n ListSelection,\n ListSelectionInputs,\n ListSelectionItem,\n} from '../list-selection/list-selection';\nimport {\n ListTypeahead,\n ListTypeaheadInputs,\n ListTypeaheadItem,\n} from '../list-typeahead/list-typeahead';\nimport {NavOptions} from '../list/list';\n\n/** Represents an item in the tree. */\nexport interface TreeItem<V, T extends TreeItem<V, T>>\n extends\n ListTypeaheadItem,\n ListNavigationItem,\n ListSelectionItem<V>,\n ListFocusItem,\n ExpansionItem {\n /** The children of this item. */\n children: SignalLike<T[] | undefined>;\n\n /** The parent of this item. */\n parent: SignalLike<T | undefined>;\n\n /** Whether this item is visible. */\n visible: SignalLike<boolean>;\n}\n\n/** The necessary inputs for the tree behavior. */\nexport type TreeInputs<T extends TreeItem<V, T>, V> = ListFocusInputs<T> &\n ListNavigationInputs<T> &\n ListSelectionInputs<T, V> &\n ListTypeaheadInputs<T> &\n ListExpansionInputs;\n\n/** Controls focus for a tree, ensuring that only visible items are focusable. */\nclass TreeListFocus<T extends TreeItem<V, T>, V> extends ListFocus<T> {\n override isFocusable(item: T): boolean {\n return super.isFocusable(item) && item.visible();\n }\n}\n\n/** Controls the state of a tree. */\nexport class Tree<T extends TreeItem<V, T>, V> {\n /** Controls navigation for the tree. */\n readonly navigationBehavior: ListNavigation<T>;\n\n /** Controls selection for the tree. */\n readonly selectionBehavior: ListSelection<T, V>;\n\n /** Controls typeahead for the tree. */\n readonly typeaheadBehavior: ListTypeahead<T>;\n\n /** Controls focus for the tree. */\n readonly focusBehavior: ListFocus<T>;\n\n /** Controls expansion for the tree. */\n readonly expansionBehavior: ListExpansion;\n\n /** Whether the tree is disabled. */\n readonly disabled = computed(() => this.focusBehavior.isListDisabled());\n\n /** The id of the current active item. */\n readonly activeDescendant = computed(() => this.focusBehavior.getActiveDescendant());\n\n /** The tab index of the tree. */\n readonly tabIndex = computed(() => this.focusBehavior.getListTabIndex());\n\n /** The index of the currently active item in the tree (within the flattened list). */\n readonly activeIndex = computed(() => this.focusBehavior.activeIndex());\n\n /** The uncommitted index for selecting a range of options. */\n private readonly _anchorIndex = signal(0);\n\n /** Whether the list should wrap. */\n private readonly _wrap = signal(true);\n\n constructor(readonly inputs: TreeInputs<T, V>) {\n this.focusBehavior = new TreeListFocus<T, V>(inputs);\n this.selectionBehavior = new ListSelection<T, V>({...inputs, focusManager: this.focusBehavior});\n this.typeaheadBehavior = new ListTypeahead<T>({...inputs, focusManager: this.focusBehavior});\n this.expansionBehavior = new ListExpansion(inputs);\n this.navigationBehavior = new ListNavigation<T>({\n ...inputs,\n focusManager: this.focusBehavior,\n wrap: computed(() => this._wrap() && this.inputs.wrap()),\n });\n }\n\n /** Returns the tab index for the given item. */\n getItemTabindex(item: T) {\n return this.focusBehavior.getItemTabIndex(item);\n }\n\n /** Navigates to the first option in the tree. */\n first(opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.first(opts));\n }\n\n /** Navigates to the last option in the tree. */\n last(opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.last(opts));\n }\n\n /** Navigates to the next option in the tree. */\n next(opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.next(opts));\n }\n\n /** Navigates to the previous option in the tree. */\n prev(opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.prev(opts));\n }\n\n /** Navigates to the first child of the current active item. */\n firstChild(opts?: NavOptions<T>) {\n this._navigate(opts, () => {\n const item = this.inputs.activeItem();\n const items = item?.children?.() ?? [];\n return this.navigationBehavior.first({items, ...opts});\n });\n }\n\n /** Navigates to the last child of the current active item. */\n lastChild(opts?: NavOptions<T>) {\n this._navigate(opts, () => {\n const item = this.inputs.activeItem();\n const items = item?.children?.() ?? [];\n return this.navigationBehavior.last({items, ...opts});\n });\n }\n\n /** Navigates to the next sibling of the current active item. */\n nextSibling(opts?: NavOptions<T>) {\n this._navigate(opts, () => {\n const item = this.inputs.activeItem();\n const items = item?.parent?.()?.children?.() ?? [];\n return this.navigationBehavior.next({items, ...opts});\n });\n }\n\n /** Navigates to the previous sibling of the current active item. */\n prevSibling(opts?: NavOptions<T>) {\n this._navigate(opts, () => {\n const item = this.inputs.activeItem();\n const items = item?.parent?.()?.children?.() ?? [];\n return this.navigationBehavior.prev({items, ...opts});\n });\n }\n\n /** Navigates to the parent of the current active item. */\n parent(opts?: NavOptions<T>) {\n this._navigate(opts, () =>\n this.navigationBehavior.goto(this.inputs.activeItem()?.parent?.(), opts),\n );\n }\n\n /** Navigates to the given item in the tree. */\n goto(item: T, opts?: NavOptions<T>) {\n this._navigate(opts, () => this.navigationBehavior.goto(item, opts));\n }\n\n /** Removes focus from the tree. */\n unfocus() {\n this.inputs.activeItem.set(undefined);\n }\n\n /** Marks the given index as the potential start of a range selection. */\n anchor(index: number) {\n this._anchorIndex.set(index);\n }\n\n /** Handles typeahead search navigation for the tree. */\n search(char: string, opts?: NavOptions<T>) {\n this._navigate(opts, () => this.typeaheadBehavior.search(char));\n }\n\n /** Checks if the tree is currently typing for typeahead search. */\n isTyping() {\n return this.typeaheadBehavior.isTyping();\n }\n\n /** Selects the currently active item in the tree. */\n select(item?: T) {\n this.selectionBehavior.select(item);\n }\n\n /** Sets the selection to only the current active item. */\n selectOne() {\n this.selectionBehavior.selectOne();\n }\n\n /** Deselects the currently active item in the tree. */\n deselect(item?: T) {\n this.selectionBehavior.deselect(item);\n }\n\n /** Deselects all items in the tree. */\n deselectAll() {\n this.selectionBehavior.deselectAll();\n }\n\n /** Toggles the currently active item in the tree. */\n toggle(item?: T) {\n this.selectionBehavior.toggle(item);\n }\n\n /** Toggles the currently active item in the tree, deselecting all other items. */\n toggleOne() {\n this.selectionBehavior.toggleOne();\n }\n\n /** Toggles the selection of all items in the tree. */\n toggleAll() {\n this.selectionBehavior.toggleAll();\n }\n\n /** Toggles the expansion of the given item. */\n toggleExpansion(item?: T) {\n item ??= this.inputs.activeItem();\n if (!item || !this.isFocusable(item)) return;\n\n if (this.isExpandable(item)) {\n this.expansionBehavior.toggle(item);\n }\n }\n\n /** Expands the given item. */\n expand(item: T) {\n if (this.isExpandable(item)) {\n this.expansionBehavior.open(item);\n }\n }\n\n /** Collapses the given item. */\n collapse(item: T) {\n this.expansionBehavior.close(item);\n }\n\n /** Expands all sibling items of the given item (or active item). */\n expandSiblings(item?: T) {\n item ??= this.inputs.activeItem();\n if (!item) return;\n\n // If the item has a parent, get all of the parent's children.\n // Otherwise, it is a root item, and get all other root items.\n const parent = item.parent?.();\n const siblings = parent ? parent.children?.() : this.inputs.items().filter(i => !i.parent?.());\n\n siblings?.forEach(s => this.expand(s));\n }\n\n /** Expands all items in the tree. */\n expandAll() {\n this.expansionBehavior.openAll();\n }\n\n /** Collapses all items in the tree. */\n collapseAll() {\n this.expansionBehavior.closeAll();\n }\n\n /** Checks if the given item is able to receive focus. */\n isFocusable(item: T) {\n return this.focusBehavior.isFocusable(item);\n }\n\n /** Checks if the given item is expandable. */\n isExpandable(item: T) {\n return this.expansionBehavior.isExpandable(item);\n }\n\n /** Handles updating selection for the tree. */\n updateSelection(opts: NavOptions<T> = {anchor: true}) {\n if (opts.toggle) {\n this.selectionBehavior.toggle();\n }\n if (opts.select) {\n this.selectionBehavior.select();\n }\n if (opts.selectOne) {\n this.selectionBehavior.selectOne();\n }\n if (opts.selectRange) {\n this.selectionBehavior.selectRange();\n }\n if (!opts.anchor) {\n this.anchor(this.selectionBehavior.rangeStartIndex());\n }\n }\n\n /**\n * Safely performs a navigation operation.\n */\n private _navigate(opts: NavOptions<T> = {}, operation: () => boolean) {\n if (opts?.selectRange) {\n this._wrap.set(false);\n this.selectionBehavior.rangeStartIndex.set(this._anchorIndex());\n }\n\n const moved = operation();\n\n if (moved) {\n this.updateSelection(opts);\n }\n\n this._wrap.set(true);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n SignalLike,\n computed,\n WritableSignalLike,\n signal,\n} from '../behaviors/signal-like/signal-like';\nimport {Tree, TreeItem, TreeInputs as TreeBehaviorInputs} from '../behaviors/tree/tree';\nimport {KeyboardEventManager, Modifier, ClickEventManager} from '../behaviors/event-manager';\n\n/** Represents the required inputs for a tree item. */\nexport interface TreeItemInputs<V> extends Omit<\n TreeItem<V, TreeItemPattern<V>>,\n 'index' | 'parent' | 'visible' | 'expandable'\n> {\n /** The parent item. */\n parent: SignalLike<TreeItemPattern<V> | TreePattern<V>>;\n\n /** Whether this item has children. Children can be lazily loaded. */\n hasChildren: SignalLike<boolean>;\n\n /** The tree pattern this item belongs to. */\n tree: SignalLike<TreePattern<V>>;\n}\n\n/**\n * Represents an item in a Tree.\n */\nexport class TreeItemPattern<V> implements TreeItem<V, TreeItemPattern<V>> {\n /** A unique identifier for this item. */\n readonly id: SignalLike<string> = () => this.inputs.id();\n\n /** The value of this item. */\n readonly value: SignalLike<V> = () => this.inputs.value();\n\n /** A reference to the item element. */\n readonly element: SignalLike<HTMLElement> = () => this.inputs.element()!;\n\n /** Whether the item is disabled. */\n readonly disabled: SignalLike<boolean> = () => this.inputs.disabled();\n\n /** The text used by the typeahead search. */\n readonly searchTerm: SignalLike<string> = () => this.inputs.searchTerm();\n\n /** The tree pattern this item belongs to. */\n readonly tree: SignalLike<TreePattern<V>> = () => this.inputs.tree();\n\n /** The parent item. */\n readonly parent: SignalLike<TreeItemPattern<V> | undefined> = computed(() => {\n const parent = this.inputs.parent();\n return parent instanceof TreeItemPattern ? parent : undefined;\n });\n\n /** The children items. */\n readonly children: SignalLike<TreeItemPattern<V>[]> = () => this.inputs.children() ?? [];\n\n /** The position of this item among its siblings. */\n readonly index = computed(() => this.tree().inputs.items().indexOf(this));\n\n /** Whether the item is expandable. It's expandable if children item exist. */\n readonly expandable: SignalLike<boolean> = () => this.inputs.hasChildren();\n\n /** Whether the item is selectable. */\n readonly selectable: SignalLike<boolean> = () => this.inputs.selectable();\n\n /** Whether the item is expanded. */\n readonly expanded: WritableSignalLike<boolean>;\n\n /** The level of the current item in a tree. */\n readonly level: SignalLike<number> = computed(() => this.inputs.parent().level() + 1);\n\n /** Whether this item is visible. */\n readonly visible: SignalLike<boolean> = computed(\n () => this.inputs.parent().expanded() && this.inputs.parent().visible(),\n );\n\n /** The number of items under the same parent at the same level. */\n readonly setsize = computed(() => this.inputs.parent().children().length);\n\n /** The position of this item among its siblings (1-based). */\n readonly posinset = computed(() => this.inputs.parent().children().indexOf(this) + 1);\n\n /** Whether the item is active. */\n readonly active = computed(() => this.tree().activeItem() === this);\n\n /** The tab index of the item. */\n readonly tabIndex = computed(() => this.tree().treeBehavior.getItemTabindex(this));\n\n /** Whether the item is selected. */\n readonly selected: SignalLike<boolean | undefined> = computed(() => {\n if (this.tree().nav()) {\n return undefined;\n }\n if (!this.selectable()) {\n return undefined;\n }\n return this.tree().value().includes(this.value());\n });\n\n /** The current type of this item. */\n readonly current: SignalLike<string | undefined> = computed(() => {\n if (!this.tree().nav()) {\n return undefined;\n }\n if (!this.selectable()) {\n return undefined;\n }\n return this.tree().value().includes(this.value()) ? this.tree().currentType() : undefined;\n });\n\n constructor(readonly inputs: TreeItemInputs<V>) {\n this.expanded = inputs.expanded;\n }\n}\n\n/** The selection operations that the tree can perform. */\ninterface SelectOptions {\n toggle?: boolean;\n selectOne?: boolean;\n selectRange?: boolean;\n anchor?: boolean;\n}\n\n/** Represents the required inputs for a tree. */\nexport interface TreeInputs<V> extends Omit<\n TreeBehaviorInputs<TreeItemPattern<V>, V>,\n 'multiExpandable'\n> {\n /** A unique identifier for the tree. */\n id: SignalLike<string>;\n\n /** Whether the tree is in navigation mode. */\n nav: SignalLike<boolean>;\n\n /** The aria-current type. */\n currentType: SignalLike<'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false'>;\n\n /** The text direction of the tree. */\n textDirection: SignalLike<'ltr' | 'rtl'>;\n}\n\n/** Controls the state and interactions of a tree view. */\nexport class TreePattern<V> implements TreeInputs<V> {\n /** The tree behavior for the tree. */\n readonly treeBehavior: Tree<TreeItemPattern<V>, V>;\n\n /** Whether the tree has been interacted with. */\n readonly hasBeenInteracted = signal(false);\n\n /** The root level is 0. */\n readonly level = () => 0;\n\n /** The root is always expanded. */\n readonly expanded = () => true;\n\n /** The root is always visible. */\n readonly visible = () => true;\n\n /** The tab index of the tree. */\n readonly tabIndex: SignalLike<-1 | 0> = computed(() => this.treeBehavior.tabIndex());\n\n /** The id of the current active item. */\n readonly activeDescendant = computed(() => this.treeBehavior.activeDescendant());\n\n /** The direct children of the root (top-level tree items). */\n readonly children = computed(() =>\n this.inputs.items().filter(item => item.level() === this.level() + 1),\n );\n\n /** Whether the tree selection follows focus. */\n readonly followFocus = computed(() => this.inputs.selectionMode() === 'follow');\n\n /** Whether the tree direction is RTL. */\n readonly isRtl = computed(() => this.inputs.textDirection() === 'rtl');\n\n /** The key for navigating to the previous item. */\n readonly prevKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.isRtl() ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key for navigating to the next item. */\n readonly nextKey = computed(() => {\n if (this.inputs.orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.isRtl() ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The key for collapsing an item or moving to its parent. */\n readonly collapseKey = computed(() => {\n if (this.inputs.orientation() === 'horizontal') {\n return 'ArrowUp';\n }\n return this.isRtl() ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key for expanding an item or moving to its first child. */\n readonly expandKey = computed(() => {\n if (this.inputs.orientation() === 'horizontal') {\n return 'ArrowDown';\n }\n return this.isRtl() ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** Represents the space key. Does nothing when the user is actively using typeahead. */\n readonly dynamicSpaceKey = computed(() => (this.treeBehavior.isTyping() ? '' : ' '));\n\n /** Regular expression to match characters for typeahead. */\n readonly typeaheadRegexp = /^.$/;\n\n /** The keydown event manager for the tree. */\n readonly keydown = computed(() => {\n const manager = new KeyboardEventManager();\n const tree = this.treeBehavior;\n\n manager\n .on(this.prevKey, () => tree.prev({selectOne: this.followFocus()}), {ignoreRepeat: false})\n .on(this.nextKey, () => tree.next({selectOne: this.followFocus()}), {ignoreRepeat: false})\n .on('Home', () => tree.first({selectOne: this.followFocus()}))\n .on('End', () => tree.last({selectOne: this.followFocus()}))\n .on(this.typeaheadRegexp, e => tree.search(e.key, {selectOne: this.followFocus()}))\n .on(Modifier.Shift, '*', () => tree.expandSiblings())\n .on(this.expandKey, () => this._expandOrFirstChild({selectOne: this.followFocus()}))\n .on(this.collapseKey, () => this._collapseOrParent({selectOne: this.followFocus()}));\n\n if (this.inputs.multi()) {\n manager\n // TODO: Tracking the anchor by index can break if the\n // tree is expanded or collapsed causing the index to change.\n .on(Modifier.Any, 'Shift', () => tree.anchor(this.treeBehavior.activeIndex()))\n .on(Modifier.Shift, this.prevKey, () => tree.prev({selectRange: true}), {\n ignoreRepeat: false,\n })\n .on(Modifier.Shift, this.nextKey, () => tree.next({selectRange: true}), {\n ignoreRepeat: false,\n })\n .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'Home', () =>\n tree.first({selectRange: true, anchor: false}),\n )\n .on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'End', () =>\n tree.last({selectRange: true, anchor: false}),\n )\n .on(Modifier.Shift, 'Enter', () => tree.updateSelection({selectRange: true, anchor: false}))\n .on(Modifier.Shift, this.dynamicSpaceKey, () =>\n tree.updateSelection({selectRange: true, anchor: false}),\n );\n }\n\n if (!this.followFocus() && this.inputs.multi()) {\n manager\n .on(this.dynamicSpaceKey, () => tree.toggle())\n .on('Enter', () => tree.toggle(), {preventDefault: !this.nav()})\n .on([Modifier.Ctrl, Modifier.Meta], 'A', () => tree.toggleAll());\n }\n\n if (!this.followFocus() && !this.inputs.multi()) {\n manager.on(this.dynamicSpaceKey, () => tree.selectOne());\n manager.on('Enter', () => tree.selectOne(), {preventDefault: !this.nav()});\n }\n\n if (this.inputs.multi() && this.followFocus()) {\n manager\n .on([Modifier.Ctrl, Modifier.Meta], this.prevKey, () => tree.prev(), {ignoreRepeat: false})\n .on([Modifier.Ctrl, Modifier.Meta], this.nextKey, () => tree.next(), {ignoreRepeat: false})\n .on([Modifier.Ctrl, Modifier.Meta], this.expandKey, () => this._expandOrFirstChild())\n .on([Modifier.Ctrl, Modifier.Meta], this.collapseKey, () => this._collapseOrParent())\n .on([Modifier.Ctrl, Modifier.Meta], ' ', () => tree.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'Enter', () => tree.toggle())\n .on([Modifier.Ctrl, Modifier.Meta], 'Home', () => tree.first())\n .on([Modifier.Ctrl, Modifier.Meta], 'End', () => tree.last())\n .on([Modifier.Ctrl, Modifier.Meta], 'A', () => {\n tree.toggleAll();\n tree.select(); // Ensure the currect item remains selected.\n });\n }\n\n return manager;\n });\n\n /** The click event manager for the tree. */\n readonly clickManager = computed(() => {\n const manager = new ClickEventManager<PointerEvent>();\n\n if (this.multi()) {\n manager.on(Modifier.Shift, (e: PointerEvent) => this.goto(e, {selectRange: true}));\n }\n\n if (!this.multi()) {\n return manager.on((e: PointerEvent) => this.goto(e, {selectOne: true}));\n }\n\n if (this.multi() && this.followFocus()) {\n return manager\n .on((e: PointerEvent) => this.goto(e, {selectOne: true}))\n .on(Modifier.Ctrl, (e: PointerEvent) => this.goto(e, {toggle: true}));\n }\n\n if (this.multi() && !this.followFocus()) {\n return manager.on((e: PointerEvent) => this.goto(e, {toggle: true}));\n }\n\n return manager;\n });\n\n /** A unique identifier for the tree. */\n readonly id: SignalLike<string> = () => this.inputs.id();\n\n /** The host native element. */\n readonly element: SignalLike<HTMLElement> = () => this.inputs.element()!;\n\n /** Whether the tree is in navigation mode. */\n readonly nav: SignalLike<boolean> = () => this.inputs.nav();\n\n /** The aria-current type. */\n readonly currentType: SignalLike<\n 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false'\n > = () => this.inputs.currentType();\n\n /** All items in the tree, in document order (DFS-like, a flattened list). */\n readonly items: SignalLike<TreeItemPattern<V>[]> = () => this.inputs.items();\n\n /** The focus strategy used by the tree. */\n readonly focusMode: SignalLike<'roving' | 'activedescendant'> = () => this.inputs.focusMode();\n\n /** Whether the tree is disabled. */\n readonly disabled: SignalLike<boolean> = () => this.inputs.disabled();\n\n /** The currently active item in the tree. */\n readonly activeItem: WritableSignalLike<TreeItemPattern<V> | undefined>;\n\n /** Whether disabled items should be focusable. */\n readonly softDisabled: SignalLike<boolean> = () => this.inputs.softDisabled();\n\n /** Whether the focus should wrap when navigating past the first or last item. */\n readonly wrap: SignalLike<boolean> = () => this.inputs.wrap();\n\n /** The orientation of the tree. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'> = () => this.inputs.orientation();\n\n /** The text direction of the tree. */\n readonly textDirection: SignalLike<'ltr' | 'rtl'> = () => this.textDirection();\n\n /** Whether multiple items can be selected at the same time. */\n readonly multi: SignalLike<boolean> = computed(() => (this.nav() ? false : this.inputs.multi()));\n\n /** The selection mode of the tree. */\n readonly selectionMode: SignalLike<'follow' | 'explicit'> = () => this.inputs.selectionMode();\n\n /** The delay in milliseconds to wait before clearing the typeahead buffer. */\n readonly typeaheadDelay: SignalLike<number> = () => this.inputs.typeaheadDelay();\n\n /** The current selected items of the tree. */\n readonly value: WritableSignalLike<V[]>;\n\n constructor(readonly inputs: TreeInputs<V>) {\n this.activeItem = inputs.activeItem;\n this.value = inputs.value;\n\n this.treeBehavior = new Tree<TreeItemPattern<V>, V>({\n ...inputs,\n multi: this.multi,\n multiExpandable: () => true,\n });\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 tree should not have multiple selected options. Selected options: ${this.inputs.value().join(', ')}`,\n );\n }\n\n return violations;\n }\n\n /**\n * Sets the tree to it's default initial state.\n *\n * Sets the active index of the tree to the first focusable selected tree item if one exists.\n * Otherwise, sets focus to the first focusable tree item.\n */\n setDefaultState() {\n let firstItem: TreeItemPattern<V> | undefined;\n\n for (const item of this.inputs.items()) {\n if (!item.visible()) continue;\n if (!this.treeBehavior.isFocusable(item)) continue;\n\n if (firstItem === undefined) {\n firstItem = item;\n }\n\n if (item.selected()) {\n this.activeItem.set(item);\n return;\n }\n }\n\n if (firstItem !== undefined) {\n this.activeItem.set(firstItem);\n }\n }\n\n /** Sets the default active state of the tree before receiving interaction for the first time. */\n setDefaultStateEffect(): void {\n if (this.hasBeenInteracted()) return;\n\n this.setDefaultState();\n }\n\n /** Handles keydown events on the tree. */\n onKeydown(event: KeyboardEvent) {\n if (!this.disabled()) {\n this.hasBeenInteracted.set(true);\n this.keydown().handle(event);\n }\n }\n\n /** Handles click events on the tree. */\n onClick(event: PointerEvent) {\n if (!this.disabled()) {\n this.hasBeenInteracted.set(true);\n this.clickManager().handle(event);\n }\n }\n\n /** Handles focusin events on the tree. */\n onFocusIn() {\n this.hasBeenInteracted.set(true);\n }\n\n /** Navigates to the given tree item in the tree. */\n goto(e: PointerEvent, opts?: SelectOptions) {\n const item = this._getItem(e);\n if (!item) return;\n\n this.treeBehavior.goto(item, opts);\n this.treeBehavior.toggleExpansion(item);\n }\n\n /** Expands the active item if possible, otherwise navigates to the first child. */\n _expandOrFirstChild(opts?: SelectOptions) {\n const item = this.treeBehavior.inputs.activeItem();\n if (item && this.treeBehavior.isExpandable(item) && !item.expanded()) {\n this.treeBehavior.expand(item);\n } else {\n this.treeBehavior.firstChild(opts);\n }\n }\n\n /** Collapses the active item if possible, otherwise navigates to the parent. */\n _collapseOrParent(opts?: SelectOptions) {\n const item = this.treeBehavior.inputs.activeItem();\n if (item && this.treeBehavior.isExpandable(item) && item.expanded()) {\n this.treeBehavior.collapse(item);\n } else {\n this.treeBehavior.parent(opts);\n }\n }\n\n /** Retrieves the TreeItemPattern associated with a DOM event, if any. */\n protected _getItem(event: Event): TreeItemPattern<V> | undefined {\n if (!(event.target instanceof HTMLElement)) {\n return;\n }\n const element = event.target.closest('[role=\"treeitem\"]');\n return this.inputs.items().find(i => i.element() === element);\n }\n}\n"],"names":["TreeListFocus","ListFocus","isFocusable","item","visible","Tree","inputs","navigationBehavior","selectionBehavior","typeaheadBehavior","focusBehavior","expansionBehavior","disabled","computed","isListDisabled","activeDescendant","getActiveDescendant","tabIndex","getListTabIndex","activeIndex","_anchorIndex","signal","_wrap","constructor","ListSelection","focusManager","ListTypeahead","ListExpansion","ListNavigation","wrap","getItemTabindex","getItemTabIndex","first","opts","_navigate","last","next","prev","firstChild","activeItem","items","children","lastChild","nextSibling","parent","prevSibling","goto","unfocus","set","undefined","anchor","index","search","char","isTyping","select","selectOne","deselect","deselectAll","toggle","toggleOne","toggleAll","toggleExpansion","isExpandable","expand","open","collapse","close","expandSiblings","siblings","filter","i","forEach","s","expandAll","openAll","collapseAll","closeAll","updateSelection","selectRange","rangeStartIndex","operation","moved","TreeItemPattern","id","value","element","searchTerm","tree","indexOf","expandable","hasChildren","selectable","expanded","level","setsize","length","posinset","active","treeBehavior","selected","nav","includes","current","currentType","TreePattern","hasBeenInteracted","followFocus","selectionMode","isRtl","textDirection","prevKey","orientation","nextKey","collapseKey","expandKey","dynamicSpaceKey","typeaheadRegexp","keydown","manager","KeyboardEventManager","on","ignoreRepeat","e","key","Modifier","Shift","_expandOrFirstChild","_collapseOrParent","multi","Any","Ctrl","Meta","preventDefault","clickManager","ClickEventManager","focusMode","softDisabled","typeaheadDelay","multiExpandable","validate","violations","push","join","setDefaultState","firstItem","setDefaultStateEffect","onKeydown","event","handle","onClick","onFocusIn","_getItem","target","HTMLElement","closest","find"],"mappings":";;;;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,YAAY,CAAC5D,IAAI,CAAC,IAAIA,IAAI,CAAC0F,QAAQ,EAAE,EAAE;AACnE,MAAA,IAAI,CAACM,YAAY,CAACjC,QAAQ,CAAC/D,IAAI,CAAC;AAClC,IAAA,CAAA,MAAO;AACL,MAAA,IAAI,CAACgG,YAAY,CAACvD,MAAM,CAACX,IAAI,CAAC;AAChC,IAAA;AACF,EAAA;EAGUuH,QAAQA,CAACJ,KAAY,EAAA;AAC7B,IAAA,IAAI,EAAEA,KAAK,CAACK,MAAM,YAAYC,WAAW,CAAC,EAAE;AAC1C,MAAA;AACF,IAAA;IACA,MAAMpE,OAAO,GAAG8D,KAAK,CAACK,MAAM,CAACE,OAAO,CAAC,mBAAmB,CAAC;AACzD,IAAA,OAAO,IAAI,CAACrJ,MAAM,CAACkC,KAAK,EAAE,CAACoH,IAAI,CAACrF,CAAC,IAAIA,CAAC,CAACe,OAAO,EAAE,KAAKA,OAAO,CAAC;AAC/D,EAAA;AACD;;;;"}
@@ -1,6 +1,7 @@
1
- import { computed, signal, linkedSignal, KeyboardEventManager, Modifier } from './_signal-like-chunk.mjs';
2
- import { PointerEventManager } from './_pointer-event-manager-chunk.mjs';
1
+ import { computed, signal, linkedSignal, KeyboardEventManager, Modifier } from './_collection-chunk.mjs';
2
+ import { ClickEventManager } from './_click-event-manager-chunk.mjs';
3
3
  import { untracked } from '@angular/core/primitives/signals';
4
+ import { ElementRef } from '@angular/core';
4
5
 
5
6
  class GridData {
6
7
  inputs;
@@ -511,15 +512,47 @@ class Grid {
511
512
  return this.setDefaultState();
512
513
  }
513
514
  if (this.focusBehavior.stateStale()) {
514
- if (this.focusBehavior.focusCell(this.focusBehavior.activeCell())) {
515
+ const activeCell = this.focusBehavior.activeCell();
516
+ const activeCoords = this.focusBehavior.activeCoords();
517
+ if (activeCell && this.focusBehavior.focusCell(activeCell)) {
515
518
  return true;
516
519
  }
517
- if (this.focusBehavior.focusCoordinates(this.focusBehavior.activeCoords())) {
520
+ if (this.focusBehavior.focusCoordinates(activeCoords)) {
518
521
  return true;
519
522
  }
520
- if (this.focusBehavior.focusCoordinates(this.navigationBehavior.peekFirst())) {
523
+ const maxRow = this.data.maxRowCount() - 1;
524
+ const targetRow = Math.min(activeCoords.row, maxRow);
525
+ if (targetRow >= 0) {
526
+ if (this.focusBehavior.focusCoordinates({
527
+ row: targetRow,
528
+ col: activeCoords.col
529
+ })) {
530
+ return true;
531
+ }
532
+ const colCount = this.data.getColCount(targetRow);
533
+ if (colCount !== undefined) {
534
+ const targetCol = Math.min(activeCoords.col, colCount - 1);
535
+ if (targetCol >= 0 && this.focusBehavior.focusCoordinates({
536
+ row: targetRow,
537
+ col: targetCol
538
+ })) {
539
+ return true;
540
+ }
541
+ }
542
+ const firstInRow = this.navigationBehavior.peekFirst(targetRow);
543
+ if (firstInRow !== undefined && this.focusBehavior.focusCoordinates(firstInRow)) {
544
+ return true;
545
+ }
546
+ }
547
+ const firstAvailable = this.navigationBehavior.peekFirst();
548
+ if (firstAvailable !== undefined && this.focusBehavior.focusCoordinates(firstAvailable)) {
521
549
  return true;
522
550
  }
551
+ this.focusBehavior.activeCell.set(undefined);
552
+ this.focusBehavior.activeCoords.set({
553
+ row: -1,
554
+ col: -1
555
+ });
523
556
  }
524
557
  return false;
525
558
  }
@@ -633,8 +666,8 @@ class GridPattern {
633
666
  }
634
667
  return manager;
635
668
  });
636
- pointerdown = computed(() => {
637
- const manager = new PointerEventManager();
669
+ clickManager = computed(() => {
670
+ const manager = new ClickEventManager();
638
671
  if (!this.inputs.enableSelection()) {
639
672
  manager.on(e => {
640
673
  const cell = this.inputs.getCell(e.target);
@@ -680,10 +713,10 @@ class GridPattern {
680
713
  this.activeCell()?.onKeydown(event);
681
714
  this.keydown().handle(event);
682
715
  }
683
- onPointerdown(event) {
716
+ onClick(event) {
684
717
  if (this.disabled()) return;
685
718
  this.hasBeenInteracted.set(true);
686
- this.pointerdown().handle(event);
719
+ this.clickManager().handle(event);
687
720
  }
688
721
  onFocusIn(event) {
689
722
  this.isFocused.set(true);
@@ -827,12 +860,24 @@ class GridCellPattern {
827
860
  }
828
861
  }
829
862
 
863
+ function resolveElement(resolver, context) {
864
+ if (typeof resolver === 'function') {
865
+ return resolver(context) ?? undefined;
866
+ }
867
+ return (resolver instanceof ElementRef ? resolver.nativeElement : resolver) ?? undefined;
868
+ }
869
+
830
870
  class GridCellWidgetPattern {
831
871
  inputs;
832
872
  element = () => this.inputs.element();
833
- widgetHost = computed(() => this.inputs.focusTarget() ?? this.element());
873
+ widgetHost = () => resolveElement(this.inputs.focusTarget(), this.element()) ?? this.element();
834
874
  disabled = computed(() => this.inputs.disabled() || this.inputs.cell().disabled());
835
- tabIndex = computed(() => this.inputs.cell().widgetTabIndex());
875
+ tabIndex = computed(() => {
876
+ if (this.inputs.focusTarget()) {
877
+ return -1;
878
+ }
879
+ return this.inputs.cell().widgetTabIndex();
880
+ });
836
881
  active = computed(() => this.inputs.cell().active() && this.inputs.cell().widget() === this);
837
882
  isActivated = signal(false);
838
883
  lastActivateEvent = signal(undefined);
@@ -840,18 +885,18 @@ class GridCellWidgetPattern {
840
885
  keydown = computed(() => {
841
886
  const manager = new KeyboardEventManager();
842
887
  if (this.inputs.widgetType() === 'simple') {
843
- return manager;
888
+ return manager.on('Enter', e => this.inputs.onActivate?.(e), {
889
+ preventDefault: false,
890
+ stopPropagation: false
891
+ }).on(' ', e => this.inputs.onActivate?.(e), {
892
+ preventDefault: false,
893
+ stopPropagation: false
894
+ });
844
895
  }
845
896
  if (this.isActivated()) {
846
- manager.on('Escape', e => {
847
- this.deactivate(e);
848
- this.focus();
849
- });
897
+ manager.on('Escape', e => this.deactivate(e));
850
898
  if (this.inputs.widgetType() === 'editable') {
851
- manager.on('Enter', e => {
852
- this.deactivate(e);
853
- this.focus();
854
- });
899
+ manager.on('Enter', e => this.deactivate(e));
855
900
  }
856
901
  return manager;
857
902
  }
@@ -885,6 +930,24 @@ class GridCellWidgetPattern {
885
930
  focus() {
886
931
  this.widgetHost().focus();
887
932
  }
933
+ activationEffect() {
934
+ if (this.isActivated()) {
935
+ const event = this.lastActivateEvent();
936
+ this.inputs.onActivate?.(event);
937
+ if (this.inputs.focusTarget()) {
938
+ this.focus();
939
+ }
940
+ }
941
+ }
942
+ deactivationEffect() {
943
+ const event = this.lastDeactivateEvent();
944
+ if (event) {
945
+ this.inputs.onDeactivate?.(event);
946
+ if (event instanceof KeyboardEvent) {
947
+ this.focus();
948
+ }
949
+ }
950
+ }
888
951
  activate(event) {
889
952
  if (this.isActivated()) return;
890
953
  if (this.inputs.widgetType() === 'simple') return;
@@ -898,5 +961,5 @@ class GridCellWidgetPattern {
898
961
  }
899
962
  }
900
963
 
901
- export { GridCellPattern, GridCellWidgetPattern, GridPattern, GridRowPattern };
964
+ export { GridCellPattern, GridCellWidgetPattern, GridPattern, GridRowPattern, resolveElement };
902
965
  //# sourceMappingURL=_widget-chunk.mjs.map