@angular/cdk-experimental 21.0.0-next.4 → 21.0.0-next.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/fesm2022/{accordion2.mjs → _accordion-chunk.mjs} +4 -3
  2. package/fesm2022/_accordion-chunk.mjs.map +1 -0
  3. package/fesm2022/_combobox-chunk.mjs +278 -0
  4. package/fesm2022/_combobox-chunk.mjs.map +1 -0
  5. package/fesm2022/{option.mjs → _combobox-listbox-chunk.mjs} +55 -8
  6. package/fesm2022/_combobox-listbox-chunk.mjs.map +1 -0
  7. package/fesm2022/_combobox-tree-chunk.mjs +398 -0
  8. package/fesm2022/_combobox-tree-chunk.mjs.map +1 -0
  9. package/fesm2022/{expansion.mjs → _expansion-chunk.mjs} +2 -2
  10. package/fesm2022/_expansion-chunk.mjs.map +1 -0
  11. package/fesm2022/{list.mjs → _list-chunk.mjs} +9 -5
  12. package/fesm2022/_list-chunk.mjs.map +1 -0
  13. package/fesm2022/_list-navigation-chunk.mjs +131 -0
  14. package/fesm2022/_list-navigation-chunk.mjs.map +1 -0
  15. package/fesm2022/{list-navigation.mjs → _pointer-event-manager-chunk.mjs} +2 -118
  16. package/fesm2022/_pointer-event-manager-chunk.mjs.map +1 -0
  17. package/fesm2022/{polyfill.mjs → _polyfill-chunk.mjs} +1 -1
  18. package/fesm2022/_polyfill-chunk.mjs.map +1 -0
  19. package/fesm2022/{tabs2.mjs → _tabs-chunk.mjs} +4 -4
  20. package/fesm2022/_tabs-chunk.mjs.map +1 -0
  21. package/fesm2022/_toolbar-chunk.mjs +273 -0
  22. package/fesm2022/_toolbar-chunk.mjs.map +1 -0
  23. package/fesm2022/_toolbar-radio-group-chunk.mjs +222 -0
  24. package/fesm2022/_toolbar-radio-group-chunk.mjs.map +1 -0
  25. package/fesm2022/accordion.mjs +4 -3
  26. package/fesm2022/accordion.mjs.map +1 -1
  27. package/fesm2022/cdk-experimental.mjs +1 -1
  28. package/fesm2022/cdk-experimental.mjs.map +1 -1
  29. package/fesm2022/column-resize.mjs +1 -1
  30. package/fesm2022/combobox.mjs +99 -308
  31. package/fesm2022/combobox.mjs.map +1 -1
  32. package/fesm2022/deferred-content.mjs +6 -7
  33. package/fesm2022/deferred-content.mjs.map +1 -1
  34. package/fesm2022/listbox.mjs +53 -12
  35. package/fesm2022/listbox.mjs.map +1 -1
  36. package/fesm2022/popover-edit.mjs +1 -1
  37. package/fesm2022/radio-group.mjs +42 -47
  38. package/fesm2022/radio-group.mjs.map +1 -1
  39. package/fesm2022/tabs.mjs +5 -4
  40. package/fesm2022/tabs.mjs.map +1 -1
  41. package/fesm2022/toolbar.mjs +69 -19
  42. package/fesm2022/toolbar.mjs.map +1 -1
  43. package/fesm2022/tree.mjs +57 -344
  44. package/fesm2022/tree.mjs.map +1 -1
  45. package/fesm2022/ui-patterns.mjs +11 -8
  46. package/fesm2022/ui-patterns.mjs.map +1 -1
  47. package/package.json +18 -18
  48. package/{accordion.d.d.ts → types/_accordion-chunk.d.ts} +3 -2
  49. package/types/_combobox-chunk.d.ts +138 -0
  50. package/{expansion.d.d.ts → types/_expansion-chunk.d.ts} +2 -2
  51. package/{list.d.d.ts → types/_list-chunk.d.ts} +4 -2
  52. package/{pointer-event-manager.d.d.ts → types/_list-navigation-chunk.d.ts} +7 -96
  53. package/{listbox.d.d.ts → types/_listbox-chunk.d.ts} +8 -4
  54. package/types/_pointer-event-manager-chunk.d.ts +98 -0
  55. package/types/_radio-group-chunk.d.ts +92 -0
  56. package/{tabs.d.d.ts → types/_tabs-chunk.d.ts} +4 -3
  57. package/types/_toolbar-chunk.d.ts +150 -0
  58. package/types/_tree-chunk.d.ts +139 -0
  59. package/{accordion/index.d.ts → types/accordion.d.ts} +4 -3
  60. package/types/combobox.d.ts +54 -0
  61. package/{deferred-content/index.d.ts → types/deferred-content.d.ts} +3 -3
  62. package/{listbox/index.d.ts → types/listbox.d.ts} +15 -5
  63. package/{radio-group/index.d.ts → types/radio-group.d.ts} +21 -23
  64. package/{tabs/index.d.ts → types/tabs.d.ts} +5 -4
  65. package/types/toolbar.d.ts +115 -0
  66. package/{tree/index.d.ts → types/tree.d.ts} +17 -137
  67. package/types/ui-patterns.d.ts +157 -0
  68. package/combobox/index.d.ts +0 -94
  69. package/fesm2022/accordion2.mjs.map +0 -1
  70. package/fesm2022/expansion.mjs.map +0 -1
  71. package/fesm2022/list-navigation.mjs.map +0 -1
  72. package/fesm2022/list.mjs.map +0 -1
  73. package/fesm2022/option.mjs.map +0 -1
  74. package/fesm2022/polyfill.mjs.map +0 -1
  75. package/fesm2022/radio-group2.mjs +0 -143
  76. package/fesm2022/radio-group2.mjs.map +0 -1
  77. package/fesm2022/tabs2.mjs.map +0 -1
  78. package/fesm2022/toolbar2.mjs +0 -224
  79. package/fesm2022/toolbar2.mjs.map +0 -1
  80. package/radio-group.d.d.ts +0 -80
  81. package/toolbar/index.d.ts +0 -91
  82. package/toolbar.d.d.ts +0 -136
  83. package/ui-patterns/index.d.ts +0 -9
  84. /package/{index.d.ts → types/cdk-experimental.d.ts} +0 -0
  85. /package/{column-resize/index.d.ts → types/column-resize.d.ts} +0 -0
  86. /package/{popover-edit/index.d.ts → types/popover-edit.d.ts} +0 -0
  87. /package/{scrolling/index.d.ts → types/scrolling.d.ts} +0 -0
  88. /package/{selection/index.d.ts → types/selection.d.ts} +0 -0
  89. /package/{table-scroll-container/index.d.ts → types/table-scroll-container.d.ts} +0 -0
@@ -0,0 +1,131 @@
1
+ import { signal, computed } from '@angular/core';
2
+
3
+ /** Controls focus for a list of items. */
4
+ class ListFocus {
5
+ inputs;
6
+ /** The last item that was active. */
7
+ prevActiveItem = signal(undefined);
8
+ /** The index of the last item that was active. */
9
+ prevActiveIndex = computed(() => {
10
+ return this.prevActiveItem() ? this.inputs.items().indexOf(this.prevActiveItem()) : -1;
11
+ });
12
+ /** The current active index in the list. */
13
+ activeIndex = computed(() => {
14
+ return this.inputs.activeItem() ? this.inputs.items().indexOf(this.inputs.activeItem()) : -1;
15
+ });
16
+ constructor(inputs) {
17
+ this.inputs = inputs;
18
+ }
19
+ /** Whether the list is in a disabled state. */
20
+ isListDisabled() {
21
+ return this.inputs.disabled() || this.inputs.items().every(i => i.disabled());
22
+ }
23
+ /** The id of the current active item. */
24
+ getActiveDescendant() {
25
+ if (this.isListDisabled()) {
26
+ return undefined;
27
+ }
28
+ if (this.inputs.focusMode() === 'roving') {
29
+ return undefined;
30
+ }
31
+ return this.inputs.activeItem()?.id() ?? undefined;
32
+ }
33
+ /** The tabindex for the list. */
34
+ getListTabindex() {
35
+ if (this.isListDisabled()) {
36
+ return 0;
37
+ }
38
+ return this.inputs.focusMode() === 'activedescendant' ? 0 : -1;
39
+ }
40
+ /** Returns the tabindex for the given item. */
41
+ getItemTabindex(item) {
42
+ if (this.isListDisabled()) {
43
+ return -1;
44
+ }
45
+ if (this.inputs.focusMode() === 'activedescendant') {
46
+ return -1;
47
+ }
48
+ return this.inputs.activeItem() === item ? 0 : -1;
49
+ }
50
+ /** Moves focus to the given item if it is focusable. */
51
+ focus(item) {
52
+ if (this.isListDisabled() || !this.isFocusable(item)) {
53
+ return false;
54
+ }
55
+ this.prevActiveItem.set(this.inputs.activeItem());
56
+ this.inputs.activeItem.set(item);
57
+ this.inputs.focusMode() === 'roving' ? item.element().focus() : this.inputs.element()?.focus();
58
+ return true;
59
+ }
60
+ /** Returns true if the given item can be navigated to. */
61
+ isFocusable(item) {
62
+ return !item.disabled() || !this.inputs.skipDisabled();
63
+ }
64
+ }
65
+
66
+ /** Controls navigation for a list of items. */
67
+ class ListNavigation {
68
+ inputs;
69
+ constructor(inputs) {
70
+ this.inputs = inputs;
71
+ }
72
+ /** Navigates to the given item. */
73
+ goto(item) {
74
+ return item ? this.inputs.focusManager.focus(item) : false;
75
+ }
76
+ /** Navigates to the next item in the list. */
77
+ next() {
78
+ return this._advance(1);
79
+ }
80
+ /** Peeks the next item in the list. */
81
+ peekNext() {
82
+ return this._peek(1);
83
+ }
84
+ /** Navigates to the previous item in the list. */
85
+ prev() {
86
+ return this._advance(-1);
87
+ }
88
+ /** Peeks the previous item in the list. */
89
+ peekPrev() {
90
+ return this._peek(-1);
91
+ }
92
+ /** Navigates to the first item in the list. */
93
+ first() {
94
+ const item = this.inputs.items().find(i => this.inputs.focusManager.isFocusable(i));
95
+ return item ? this.goto(item) : false;
96
+ }
97
+ /** Navigates to the last item in the list. */
98
+ last() {
99
+ const items = this.inputs.items();
100
+ for (let i = items.length - 1; i >= 0; i--) {
101
+ if (this.inputs.focusManager.isFocusable(items[i])) {
102
+ return this.goto(items[i]);
103
+ }
104
+ }
105
+ return false;
106
+ }
107
+ /** Advances to the next or previous focusable item in the list based on the given delta. */
108
+ _advance(delta) {
109
+ const item = this._peek(delta);
110
+ return item ? this.goto(item) : false;
111
+ }
112
+ /** Peeks the next or previous focusable item in the list based on the given delta. */
113
+ _peek(delta) {
114
+ const items = this.inputs.items();
115
+ const itemCount = items.length;
116
+ const startIndex = this.inputs.focusManager.activeIndex();
117
+ const step = (i) => this.inputs.wrap() ? (i + delta + itemCount) % itemCount : i + delta;
118
+ // If wrapping is enabled, this loop ultimately terminates when `i` gets back to `startIndex`
119
+ // in the case that all options are disabled. If wrapping is disabled, the loop terminates
120
+ // when the index goes out of bounds.
121
+ for (let i = step(startIndex); i !== startIndex && i < itemCount && i >= 0; i = step(i)) {
122
+ if (this.inputs.focusManager.isFocusable(items[i])) {
123
+ return items[i];
124
+ }
125
+ }
126
+ return;
127
+ }
128
+ }
129
+
130
+ export { ListFocus, ListNavigation };
131
+ //# sourceMappingURL=_list-navigation-chunk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_list-navigation-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/behaviors/list-focus/list-focus.ts","../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/behaviors/list-navigation/list-navigation.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, signal} from '@angular/core';\nimport {SignalLike, WritableSignalLike} from '../signal-like/signal-like';\n\n/** Represents an item in a collection, such as a listbox option, than may receive focus. */\nexport interface ListFocusItem {\n /** A unique identifier for the item. */\n id: SignalLike<string>;\n\n /** The html element that should receive focus. */\n element: SignalLike<HTMLElement>;\n\n /** Whether an item is disabled. */\n disabled: SignalLike<boolean>;\n\n /** The index of the item in the list. */\n index: SignalLike<number>;\n}\n\n/** Represents the required inputs for a collection that contains focusable items. */\nexport interface ListFocusInputs<T extends ListFocusItem> {\n /** The focus strategy used by the list. */\n focusMode: SignalLike<'roving' | 'activedescendant'>;\n\n /** Whether the list is disabled. */\n disabled: SignalLike<boolean>;\n\n /** The items in the list. */\n items: SignalLike<T[]>;\n\n /** The active item. */\n activeItem: WritableSignalLike<T | undefined>;\n\n /** Whether disabled items in the list should be skipped when navigating. */\n skipDisabled: SignalLike<boolean>;\n\n element: SignalLike<HTMLElement | undefined>;\n}\n\n/** Controls focus for a list of items. */\nexport class ListFocus<T extends ListFocusItem> {\n /** The last item that was active. */\n prevActiveItem = signal<T | undefined>(undefined);\n\n /** The index of the last item that was active. */\n prevActiveIndex = computed(() => {\n return this.prevActiveItem() ? this.inputs.items().indexOf(this.prevActiveItem()!) : -1;\n });\n\n /** The current active index in the list. */\n activeIndex = computed(() => {\n return this.inputs.activeItem() ? this.inputs.items().indexOf(this.inputs.activeItem()!) : -1;\n });\n\n constructor(readonly inputs: ListFocusInputs<T>) {}\n\n /** Whether the list is in a disabled state. */\n isListDisabled(): boolean {\n return this.inputs.disabled() || this.inputs.items().every(i => i.disabled());\n }\n\n /** The id of the current active item. */\n getActiveDescendant(): string | undefined {\n if (this.isListDisabled()) {\n return undefined;\n }\n if (this.inputs.focusMode() === 'roving') {\n return undefined;\n }\n return this.inputs.activeItem()?.id() ?? undefined;\n }\n\n /** The tabindex for the list. */\n getListTabindex(): -1 | 0 {\n if (this.isListDisabled()) {\n return 0;\n }\n return this.inputs.focusMode() === 'activedescendant' ? 0 : -1;\n }\n\n /** Returns the tabindex for the given item. */\n getItemTabindex(item: T): -1 | 0 {\n if (this.isListDisabled()) {\n return -1;\n }\n if (this.inputs.focusMode() === 'activedescendant') {\n return -1;\n }\n return this.inputs.activeItem() === item ? 0 : -1;\n }\n\n /** Moves focus to the given item if it is focusable. */\n focus(item: T): boolean {\n if (this.isListDisabled() || !this.isFocusable(item)) {\n return false;\n }\n\n this.prevActiveItem.set(this.inputs.activeItem());\n this.inputs.activeItem.set(item);\n\n this.inputs.focusMode() === 'roving' ? item.element().focus() : this.inputs.element()?.focus();\n\n return true;\n }\n\n /** Returns true if the given item can be navigated to. */\n isFocusable(item: T): boolean {\n return !item.disabled() || !this.inputs.skipDisabled();\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} from '../signal-like/signal-like';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../list-focus/list-focus';\n\n/** Represents an item in a collection, such as a listbox option, than can be navigated to. */\nexport interface ListNavigationItem extends ListFocusItem {}\n\n/** Represents the required inputs for a collection that has navigable items. */\nexport interface ListNavigationInputs<T extends ListNavigationItem> extends ListFocusInputs<T> {\n /** Whether focus should wrap when navigating. */\n wrap: SignalLike<boolean>;\n\n /** Whether the list is vertically or horizontally oriented. */\n orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** The direction that text is read based on the users locale. */\n textDirection: SignalLike<'rtl' | 'ltr'>;\n}\n\n/** Controls navigation for a list of items. */\nexport class ListNavigation<T extends ListNavigationItem> {\n constructor(readonly inputs: ListNavigationInputs<T> & {focusManager: ListFocus<T>}) {}\n\n /** Navigates to the given item. */\n goto(item?: T): boolean {\n return item ? this.inputs.focusManager.focus(item) : false;\n }\n\n /** Navigates to the next item in the list. */\n next(): boolean {\n return this._advance(1);\n }\n\n /** Peeks the next item in the list. */\n peekNext(): T | undefined {\n return this._peek(1);\n }\n\n /** Navigates to the previous item in the list. */\n prev(): boolean {\n return this._advance(-1);\n }\n\n /** Peeks the previous item in the list. */\n peekPrev(): T | undefined {\n return this._peek(-1);\n }\n\n /** Navigates to the first item in the list. */\n first(): boolean {\n const item = this.inputs.items().find(i => this.inputs.focusManager.isFocusable(i));\n return item ? this.goto(item) : false;\n }\n\n /** Navigates to the last item in the list. */\n last(): boolean {\n const items = this.inputs.items();\n for (let i = items.length - 1; i >= 0; i--) {\n if (this.inputs.focusManager.isFocusable(items[i])) {\n return this.goto(items[i]);\n }\n }\n return false;\n }\n\n /** Advances to the next or previous focusable item in the list based on the given delta. */\n private _advance(delta: 1 | -1): boolean {\n const item = this._peek(delta);\n return item ? this.goto(item) : false;\n }\n\n /** Peeks the next or previous focusable item in the list based on the given delta. */\n private _peek(delta: 1 | -1): T | undefined {\n const items = this.inputs.items();\n const itemCount = items.length;\n const startIndex = this.inputs.focusManager.activeIndex();\n const step = (i: number) =>\n this.inputs.wrap() ? (i + delta + itemCount) % itemCount : i + delta;\n\n // If wrapping is enabled, this loop ultimately terminates when `i` gets back to `startIndex`\n // in the case that all options are disabled. If wrapping is disabled, the loop terminates\n // when the index goes out of bounds.\n for (let i = step(startIndex); i !== startIndex && i < itemCount && i >= 0; i = step(i)) {\n if (this.inputs.focusManager.isFocusable(items[i])) {\n return items[i];\n }\n }\n\n return;\n }\n}\n"],"names":[],"mappings":";;AA8CA;MACa,SAAS,CAAA;AAcC,IAAA,MAAA;;AAZrB,IAAA,cAAc,GAAG,MAAM,CAAgB,SAAS,CAAC;;AAGjD,IAAA,eAAe,GAAG,QAAQ,CAAC,MAAK;QAC9B,OAAO,IAAI,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EA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AAG,SAAS,IAAI,SAAS,GAAG,CAAC,GAAG,KAAK;;;;QAKtE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,UAAU,IAAI,CAAC,GAAG,SAAS,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE;AACvF,YAAA,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;AAClD,gBAAA,OAAO,KAAK,CAAC,CAAC,CAAC;;;QAInB;;AAEH;;;;"}
@@ -1,5 +1,3 @@
1
- import { signal, computed } from '@angular/core';
2
-
3
1
  /** Bit flag representation of the possible modifier keys that can be present on an event. */
4
2
  var Modifier;
5
3
  (function (Modifier) {
@@ -143,119 +141,5 @@ class PointerEventManager extends EventManager {
143
141
  }
144
142
  }
145
143
 
146
- /** Controls focus for a list of items. */
147
- class ListFocus {
148
- inputs;
149
- /** The last item that was active. */
150
- prevActiveItem = signal(undefined);
151
- /** The index of the last item that was active. */
152
- prevActiveIndex = computed(() => {
153
- return this.prevActiveItem() ? this.inputs.items().indexOf(this.prevActiveItem()) : -1;
154
- });
155
- /** The current active index in the list. */
156
- activeIndex = computed(() => {
157
- return this.inputs.activeItem() ? this.inputs.items().indexOf(this.inputs.activeItem()) : -1;
158
- });
159
- constructor(inputs) {
160
- this.inputs = inputs;
161
- }
162
- /** Whether the list is in a disabled state. */
163
- isListDisabled() {
164
- return this.inputs.disabled() || this.inputs.items().every(i => i.disabled());
165
- }
166
- /** The id of the current active item. */
167
- getActiveDescendant() {
168
- if (this.isListDisabled()) {
169
- return undefined;
170
- }
171
- if (this.inputs.focusMode() === 'roving') {
172
- return undefined;
173
- }
174
- return this.inputs.activeItem()?.id() ?? undefined;
175
- }
176
- /** The tabindex for the list. */
177
- getListTabindex() {
178
- if (this.isListDisabled()) {
179
- return 0;
180
- }
181
- return this.inputs.focusMode() === 'activedescendant' ? 0 : -1;
182
- }
183
- /** Returns the tabindex for the given item. */
184
- getItemTabindex(item) {
185
- if (this.isListDisabled()) {
186
- return -1;
187
- }
188
- if (this.inputs.focusMode() === 'activedescendant') {
189
- return -1;
190
- }
191
- return this.inputs.activeItem() === item ? 0 : -1;
192
- }
193
- /** Moves focus to the given item if it is focusable. */
194
- focus(item) {
195
- if (this.isListDisabled() || !this.isFocusable(item)) {
196
- return false;
197
- }
198
- this.prevActiveItem.set(this.inputs.activeItem());
199
- this.inputs.activeItem.set(item);
200
- this.inputs.focusMode() === 'roving' ? item.element().focus() : this.inputs.element()?.focus();
201
- return true;
202
- }
203
- /** Returns true if the given item can be navigated to. */
204
- isFocusable(item) {
205
- return !item.disabled() || !this.inputs.skipDisabled();
206
- }
207
- }
208
-
209
- /** Controls navigation for a list of items. */
210
- class ListNavigation {
211
- inputs;
212
- constructor(inputs) {
213
- this.inputs = inputs;
214
- }
215
- /** Navigates to the given item. */
216
- goto(item) {
217
- return item ? this.inputs.focusManager.focus(item) : false;
218
- }
219
- /** Navigates to the next item in the list. */
220
- next() {
221
- return this._advance(1);
222
- }
223
- /** Navigates to the previous item in the list. */
224
- prev() {
225
- return this._advance(-1);
226
- }
227
- /** Navigates to the first item in the list. */
228
- first() {
229
- const item = this.inputs.items().find(i => this.inputs.focusManager.isFocusable(i));
230
- return item ? this.goto(item) : false;
231
- }
232
- /** Navigates to the last item in the list. */
233
- last() {
234
- const items = this.inputs.items();
235
- for (let i = items.length - 1; i >= 0; i--) {
236
- if (this.inputs.focusManager.isFocusable(items[i])) {
237
- return this.goto(items[i]);
238
- }
239
- }
240
- return false;
241
- }
242
- /** Advances to the next or previous focusable item in the list based on the given delta. */
243
- _advance(delta) {
244
- const items = this.inputs.items();
245
- const itemCount = items.length;
246
- const startIndex = this.inputs.focusManager.activeIndex();
247
- const step = (i) => this.inputs.wrap() ? (i + delta + itemCount) % itemCount : i + delta;
248
- // If wrapping is enabled, this loop ultimately terminates when `i` gets back to `startIndex`
249
- // in the case that all options are disabled. If wrapping is disabled, the loop terminates
250
- // when the index goes out of bounds.
251
- for (let i = step(startIndex); i !== startIndex && i < itemCount && i >= 0; i = step(i)) {
252
- if (this.inputs.focusManager.isFocusable(items[i])) {
253
- return this.goto(items[i]);
254
- }
255
- }
256
- return false;
257
- }
258
- }
259
-
260
- export { KeyboardEventManager, ListFocus, ListNavigation, Modifier, PointerEventManager };
261
- //# sourceMappingURL=list-navigation.mjs.map
144
+ export { KeyboardEventManager, Modifier, PointerEventManager };
145
+ //# sourceMappingURL=_pointer-event-manager-chunk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_pointer-event-manager-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/behaviors/event-manager/event-manager.ts","../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/behaviors/event-manager/keyboard-event-manager.ts","../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/behaviors/event-manager/pointer-event-manager.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\n/**\n * An event that supports modifier keys.\n *\n * Matches the native KeyboardEvent, MouseEvent, and TouchEvent.\n */\nexport interface EventWithModifiers extends Event {\n ctrlKey: boolean;\n shiftKey: boolean;\n altKey: boolean;\n metaKey: boolean;\n}\n\n/**\n * Options that are applicable to all event handlers.\n *\n * This library has not yet had a need for stopPropagationImmediate.\n */\nexport interface EventHandlerOptions {\n stopPropagation: boolean;\n preventDefault: boolean;\n}\n\n/** A basic event handler. */\nexport type EventHandler<T extends Event> = (event: T) => void;\n\n/** A function that determines whether an event is to be handled. */\nexport type EventMatcher<T extends Event> = (event: T) => boolean;\n\n/** A config that specifies how to handle a particular event. */\nexport interface EventHandlerConfig<T extends Event> extends EventHandlerOptions {\n matcher: EventMatcher<T>;\n handler: EventHandler<T>;\n}\n\n/** Bit flag representation of the possible modifier keys that can be present on an event. */\nexport enum Modifier {\n None = 0,\n Ctrl = 0b1,\n Shift = 0b10,\n Alt = 0b100,\n Meta = 0b1000,\n Any = 'Any',\n}\n\nexport type ModifierInputs = Modifier | Modifier[];\n\n/**\n * Abstract base class for all event managers.\n *\n * Event managers are designed to normalize how event handlers are authored and create a safety net\n * for common event handling gotchas like remembering to call preventDefault or stopPropagation.\n */\nexport abstract class EventManager<T extends Event> {\n protected configs: EventHandlerConfig<T>[] = [];\n abstract options: EventHandlerOptions;\n\n /** Runs the handlers that match with the given event. */\n handle(event: T): void {\n for (const config of this.configs) {\n if (config.matcher(event)) {\n config.handler(event);\n\n if (config.preventDefault) {\n event.preventDefault();\n }\n\n if (config.stopPropagation) {\n event.stopPropagation();\n }\n }\n }\n }\n\n /** Configures the event manager to handle specific events. (See subclasses for more). */\n abstract on(...args: [...unknown[]]): this;\n}\n\n/** Gets bit flag representation of the modifier keys present on the given event. */\nexport function getModifiers(event: EventWithModifiers): number {\n return (\n (+event.ctrlKey && Modifier.Ctrl) |\n (+event.shiftKey && Modifier.Shift) |\n (+event.altKey && Modifier.Alt) |\n (+event.metaKey && Modifier.Meta)\n );\n}\n\n/**\n * Checks if the given event has modifiers that are an exact match for any of the given modifier\n * flag combinations.\n */\nexport function hasModifiers(event: EventWithModifiers, modifiers: ModifierInputs): boolean {\n const eventModifiers = getModifiers(event);\n const modifiersList = Array.isArray(modifiers) ? modifiers : [modifiers];\n\n if (modifiersList.includes(Modifier.Any)) {\n return true;\n }\n\n return modifiersList.some(modifiers => eventModifiers === modifiers);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {SignalLike} from '../signal-like/signal-like';\nimport {\n EventHandler,\n EventHandlerOptions,\n EventManager,\n hasModifiers,\n ModifierInputs,\n Modifier,\n} from './event-manager';\n\n/**\n * Used to represent a keycode.\n *\n * This is used to match whether an events keycode should be handled. The ability to match using a\n * string, SignalLike, or Regexp gives us more flexibility when authoring event handlers.\n */\ntype KeyCode = string | SignalLike<string> | RegExp;\n\n/**\n * An event manager that is specialized for handling keyboard events. By default this manager stops\n * propagation and prevents default on all events it handles.\n */\nexport class KeyboardEventManager<T extends KeyboardEvent> extends EventManager<T> {\n options: EventHandlerOptions = {\n preventDefault: true,\n stopPropagation: true,\n };\n\n /** Configures this event manager to handle events with a specific key and no modifiers. */\n on(key: KeyCode, handler: EventHandler<T>): this;\n\n /** Configures this event manager to handle events with a specific modifer and key combination. */\n on(modifiers: ModifierInputs, key: KeyCode, handler: EventHandler<T>): this;\n\n on(...args: any[]) {\n const {modifiers, key, handler} = this._normalizeInputs(...args);\n\n this.configs.push({\n handler: handler,\n matcher: event => this._isMatch(event, key, modifiers),\n ...this.options,\n });\n\n return this;\n }\n\n private _normalizeInputs(...args: any[]) {\n const key = args.length === 3 ? args[1] : args[0];\n const handler = args.length === 3 ? args[2] : args[1];\n const modifiers = args.length === 3 ? args[0] : Modifier.None;\n\n return {\n key: key as KeyCode,\n handler: handler as EventHandler<T>,\n modifiers: modifiers as ModifierInputs,\n };\n }\n\n private _isMatch(event: T, key: KeyCode, modifiers: ModifierInputs) {\n if (!hasModifiers(event, modifiers)) {\n return false;\n }\n\n if (key instanceof RegExp) {\n return key.test(event.key);\n }\n\n const keyStr = typeof key === 'string' ? key : key();\n return keyStr.toLowerCase() === event.key.toLowerCase();\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 EventHandler,\n EventHandlerOptions,\n EventManager,\n hasModifiers,\n ModifierInputs,\n Modifier,\n} from './event-manager';\n\n/**\n * The different mouse buttons that may appear on a pointer event.\n */\nexport enum MouseButton {\n Main = 0,\n Auxiliary = 1,\n Secondary = 2,\n}\n\n/** An event manager that is specialized for handling pointer events. */\nexport class PointerEventManager<T extends PointerEvent> extends EventManager<T> {\n options: EventHandlerOptions = {\n preventDefault: false,\n stopPropagation: false,\n };\n\n /**\n * Configures this event manager to handle events with a specific modifer and mouse button\n * combination.\n */\n on(button: MouseButton, modifiers: ModifierInputs, handler: EventHandler<T>): this;\n\n /**\n * Configures this event manager to handle events with a specific mouse button and no modifiers.\n */\n on(modifiers: ModifierInputs, handler: EventHandler<T>): this;\n\n /**\n * Configures this event manager to handle events with the main mouse button and no modifiers.\n *\n * @param handler The handler function\n * @param options Options for whether to stop propagation or prevent default.\n */\n on(handler: EventHandler<T>): this;\n\n on(...args: any[]) {\n const {button, handler, modifiers} = this._normalizeInputs(...args);\n\n this.configs.push({\n handler,\n matcher: event => this._isMatch(event, button, modifiers),\n ...this.options,\n });\n return this;\n }\n\n private _normalizeInputs(...args: any[]) {\n if (args.length === 3) {\n return {\n button: args[0] as MouseButton,\n modifiers: args[1] as ModifierInputs,\n handler: args[2] as EventHandler<T>,\n };\n }\n\n if (typeof args[0] === 'number' && typeof args[1] === 'function') {\n return {\n button: MouseButton.Main,\n modifiers: args[0] as ModifierInputs,\n handler: args[1] as EventHandler<T>,\n };\n }\n\n return {\n button: MouseButton.Main,\n modifiers: Modifier.None,\n handler: args[0] as EventHandler<T>,\n };\n }\n\n _isMatch(event: PointerEvent, button: MouseButton, modifiers: ModifierInputs) {\n return button === (event.button ?? 0) && hasModifiers(event, modifiers);\n }\n}\n"],"names":[],"mappings":"AA0CA;IACY;AAAZ,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ;AACR,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAU;AACV,IAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAY;AACZ,IAAA,Q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,OAAO,IAAI;;IAGL,gBAAgB,CAAC,GAAG,IAAW,EAAA;AACrC,QAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;YACrB,OAAO;AACL,gBAAA,MAAM,EAAE,IAAI,CAAC,CAAC,CAAgB;AAC9B,gBAAA,SAAS,EAAE,IAAI,CAAC,CAAC,CAAmB;AACpC,gBAAA,OAAO,EAAE,IAAI,CAAC,CAAC,CAAoB;aACpC;;AAGH,QAAA,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE;YAChE,OAAO;gBACL,MAAM,EAAE,WAAW,CAAC,IAAI;AACxB,gBAAA,SAAS,EAAE,IAAI,CAAC,CAAC,CAAmB;AACpC,gBAAA,OAAO,EAAE,IAAI,CAAC,CAAC,CAAoB;aACpC;;QAGH,OAAO;YACL,MAAM,EAAE,WAAW,CAAC,IAAI;YACxB,SAAS,EAAE,QAAQ,CAAC,IAAI;AACxB,YAAA,OAAO,EAAE,IAAI,CAAC,CAAC,CAAoB;SACpC;;AAGH,IAAA,QAAQ,CAAC,KAAmB,EAAE,MAAmB,EAAE,SAAyB,EAAA;AAC1E,QAAA,OAAO,MAAM,MAAM,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC;;AAE1E;;;;"}
@@ -11,4 +11,4 @@ function closest(element, selector) {
11
11
  }
12
12
 
13
13
  export { closest };
14
- //# sourceMappingURL=polyfill.mjs.map
14
+ //# sourceMappingURL=_polyfill-chunk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_polyfill-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/popover-edit/polyfill.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\n/** closest implementation that is able to start from non-Element Nodes. */\nexport function closest(\n element: EventTarget | Element | null | undefined,\n selector: string,\n): Element | null {\n if (!(element instanceof Node)) {\n return null;\n }\n\n let curr: Node | null = element;\n while (curr != null && !(curr instanceof Element)) {\n curr = curr.parentNode;\n }\n\n return curr?.closest(selector) ?? null;\n}\n"],"names":[],"mappings":"AAQA;AACgB,SAAA,OAAO,CACrB,OAAiD,EACjD,QAAgB,EAAA;AAEhB,IAAA,IAAI,EAAE,OAAO,YAAY,IAAI,CAAC,EAAE;AAC9B,QAAA,OAAO,IAAI;;IAGb,IAAI,IAAI,GAAgB,OAAO;IAC/B,OAAO,IAAI,IAAI,IAAI,IAAI,EAAE,IAAI,YAAY,OAAO,CAAC,EAAE;AACjD,QAAA,IAAI,GAAG,IAAI,CAAC,UAAU;;IAGxB,OAAO,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI;AACxC;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { computed } from '@angular/core';
2
- import { ExpansionControl, ListExpansion } from './expansion.mjs';
3
- import { List } from './list.mjs';
4
- import { KeyboardEventManager, PointerEventManager } from './list-navigation.mjs';
2
+ import { ExpansionControl, ListExpansion } from './_expansion-chunk.mjs';
3
+ import { List } from './_list-chunk.mjs';
4
+ import { KeyboardEventManager, PointerEventManager } from './_pointer-event-manager-chunk.mjs';
5
5
 
6
6
  /** Controls label and description of an element. */
7
7
  class LabelControl {
@@ -208,4 +208,4 @@ class TabListPattern {
208
208
  }
209
209
 
210
210
  export { TabListPattern, TabPanelPattern, TabPattern };
211
- //# sourceMappingURL=tabs2.mjs.map
211
+ //# sourceMappingURL=_tabs-chunk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_tabs-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/behaviors/label/label.ts","../../../../../k8-fastbuild-ST-199a4f3c4e20/bin/src/cdk-experimental/ui-patterns/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} from '@angular/core';\nimport {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 {computed} from '@angular/core';\nimport {KeyboardEventManager, PointerEventManager} from '../behaviors/event-manager';\nimport {\n ExpansionItem,\n ExpansionControl,\n ListExpansionInputs,\n ListExpansion,\n} from '../behaviors/expansion/expansion';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\nimport {LabelControl, LabelControlOptionalInputs} from '../behaviors/label/label';\nimport {List, ListInputs, ListItem} from '../behaviors/list/list';\n\n/** The required inputs to tabs. */\nexport interface TabInputs\n extends Omit<ListItem<string>, 'searchTerm' | 'index'>,\n Omit<ExpansionItem, 'expansionId' | '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\n/** A tab in a tablist. */\nexport class TabPattern {\n /** Controls expansion for this tab. */\n readonly expansion: ExpansionControl;\n\n /** A global unique identifier for the tab. */\n readonly id: SignalLike<string>;\n\n /** The index of the tab. */\n readonly index = computed(() => this.inputs.tablist().inputs.items().indexOf(this));\n\n /** A local unique identifier for the tab. */\n readonly value: SignalLike<string>;\n\n /** Whether the tab is disabled. */\n readonly disabled: SignalLike<boolean>;\n\n /** The html element that should receive focus. */\n readonly element: SignalLike<HTMLElement>;\n\n /** The text used by the typeahead search. */\n readonly searchTerm = () => ''; // Unused because tabs do not support typeahead.\n\n /** Whether this tab has expandable content. */\n readonly expandable = computed(() => this.expansion.expandable());\n\n /** The unique identifier used by the expansion behavior. */\n readonly expansionId = computed(() => this.expansion.expansionId());\n\n /** Whether the tab is expanded. */\n readonly expanded = computed(() => this.expansion.isExpanded());\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().inputs.value().includes(this.value()));\n\n /** The tabindex of the tab. */\n readonly tabindex = computed(() => this.inputs.tablist().listBehavior.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.value = inputs.value;\n this.disabled = inputs.disabled;\n this.element = inputs.element;\n this.expansion = new ExpansionControl({\n ...inputs,\n expansionId: inputs.value,\n expandable: () => true,\n expansionManager: inputs.tablist().expansionManager,\n });\n }\n}\n\n/** The required inputs for the tabpanel. */\nexport interface TabPanelInputs extends LabelControlOptionalInputs {\n id: SignalLike<string>;\n tab: SignalLike<TabPattern | undefined>;\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>;\n\n /** A local unique identifier for the tabpanel. */\n readonly value: SignalLike<string>;\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 tabindex 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.id = inputs.id;\n this.value = inputs.value;\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 type TabListInputs = Omit<ListInputs<TabPattern, string>, 'multi' | 'typeaheadDelay'> &\n Omit<ListExpansionInputs, 'multiExpandable' | 'expandedIds' | 'items'>;\n\n/** Controls the state of a tablist. */\nexport class TabListPattern {\n /** The list behavior for the tablist. */\n readonly listBehavior: List<TabPattern, string>;\n\n /** Controls expansion for the tablist. */\n readonly expansionManager: ListExpansion;\n\n /** Whether the tablist is vertically or horizontally oriented. */\n readonly orientation: SignalLike<'vertical' | 'horizontal'>;\n\n /** Whether the tablist is disabled. */\n readonly disabled: SignalLike<boolean>;\n\n /** The tabindex of the tablist. */\n readonly tabindex = computed(() => this.listBehavior.tabindex());\n\n /** The id of the current active tab. */\n readonly activedescendant = computed(() => this.listBehavior.activedescendant());\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(this.prevKey, () => this.listBehavior.prev({select: this.followFocus()}))\n .on(this.nextKey, () => this.listBehavior.next({select: this.followFocus()}))\n .on('Home', () => this.listBehavior.first({select: this.followFocus()}))\n .on('End', () => this.listBehavior.last({select: this.followFocus()}))\n .on(' ', () => this.listBehavior.select())\n .on('Enter', () => this.listBehavior.select());\n });\n\n /** The pointerdown event manager for the tablist. */\n readonly pointerdown = computed(() => {\n return new PointerEventManager().on(e =>\n this.listBehavior.goto(this._getItem(e)!, {select: true}),\n );\n });\n\n constructor(readonly inputs: TabListInputs) {\n this.disabled = inputs.disabled;\n this.orientation = inputs.orientation;\n\n this.listBehavior = new List({\n ...inputs,\n multi: () => false,\n typeaheadDelay: () => 0, // Tabs do not support typeahead.\n });\n\n this.expansionManager = new ListExpansion({\n ...inputs,\n multiExpandable: () => false,\n expandedIds: this.inputs.value,\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.listBehavior.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 /** Handles keydown events for the tablist. */\n onKeydown(event: KeyboardEvent) {\n if (!this.disabled()) {\n this.keydown().handle(event);\n }\n }\n\n /** The pointerdown event manager for the tablist. */\n onPointerdown(event: PointerEvent) {\n if (!this.disabled()) {\n this.pointerdown().handle(event);\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":[],"mappings":";;;;;AAyBA;MACa,YAAY,CAAA;AAuBF,IAAA,MAAA;;AArBZ,IAAA,KAAK,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;;AAG7C,IAAA,UAAU,GAAG,QAAQ,CAAC,MAAK;AAClC,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE;QAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI;QAC7C,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE;QAEzD,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AACvC,YAAA,OAAO,UAAU;;;;QAKnB,IAAI,KAAK,EAAE;AACT,YAAA,OAAO,EAAE;;AAGX,QAAA,OAAO,iBAAiB;AAC1B,KAAC,CAAC;AAEF,IAAA,WAAA,CAAqB,MAAuD,EAAA;QAAvD,IAAM,CAAA,MAAA,GAAN,MAAM;;AAC5B;;ACnBD;MACa,UAAU,CAAA;AA2CA,IAAA,MAAA;;AAzCZ,IAAA,SAAS;;AAGT,IAAA,EAAE;;IAGF,KAAK,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;;AAG1E,IAAA,KAAK;;AAGL,IAAA,QAAQ;;AAGR,IAAA,OAAO;;AAGP,IAAA,UAAU,GAAG,MAAM,EAAE,CAAC;;AAGtB,IAAA,UAAU,GAAG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I,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC;gBAAE;AAE1C,YAAA,IAAI,SAAS,KAAK,SAAS,EAAE;gBAC3B,SAAS,GAAG,IAAI;;AAGlB,YAAA,IAAI,IAAI,CAAC,QAAQ,EAAE,EAAE;gBACnB,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC;gBAChC;;;AAGJ,QAAA,IAAI,SAAS,KAAK,SAAS,EAAE;YAC3B,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC;;;;AAKzC,IAAA,SAAS,CAAC,KAAoB,EAAA;AAC5B,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE;YACpB,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;;;;AAKhC,IAAA,aAAa,CAAC,KAAmB,EAAA;AAC/B,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE;YACpB,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;;;;AAK5B,IAAA,QAAQ,CAAC,CAAe,EAAA;QAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC,EAAE;YACtC;;QAGF,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC;QAChD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,KAAK,OAAO,CAAC;;AAEhE;;;;"}
@@ -0,0 +1,273 @@
1
+ import { computed, signal } from '@angular/core';
2
+ import { List } from './_list-chunk.mjs';
3
+ import { PointerEventManager, KeyboardEventManager } from './_pointer-event-manager-chunk.mjs';
4
+
5
+ class ToolbarWidgetPattern {
6
+ inputs;
7
+ /** A unique identifier for the widget. */
8
+ id;
9
+ /** The html element that should receive focus. */
10
+ element;
11
+ /** Whether the widget is disabled. */
12
+ disabled;
13
+ /** A reference to the parent toolbar. */
14
+ toolbar;
15
+ /** The tabindex of the widgdet. */
16
+ tabindex = computed(() => this.toolbar().listBehavior.getItemTabindex(this));
17
+ /** The text used by the typeahead search. */
18
+ searchTerm = () => ''; // Unused because toolbar does not support typeahead.
19
+ /** The value associated with the widget. */
20
+ value = () => ''; // Unused because toolbar does not support selection.
21
+ /** The position of the widget within the toolbar. */
22
+ index = computed(() => this.toolbar().inputs.items().indexOf(this) ?? -1);
23
+ /** Whether the widget is currently the active one (focused). */
24
+ active = computed(() => this.toolbar().inputs.activeItem() === this);
25
+ constructor(inputs) {
26
+ this.inputs = inputs;
27
+ this.id = inputs.id;
28
+ this.element = inputs.element;
29
+ this.disabled = inputs.disabled;
30
+ this.toolbar = inputs.toolbar;
31
+ }
32
+ }
33
+
34
+ /** A group of widgets within a toolbar that provides nested navigation. */
35
+ class ToolbarWidgetGroupPattern {
36
+ inputs;
37
+ /** A unique identifier for the widget. */
38
+ id;
39
+ /** The html element that should receive focus. */
40
+ element;
41
+ /** Whether the widget is disabled. */
42
+ disabled;
43
+ /** A reference to the parent toolbar. */
44
+ toolbar;
45
+ /** The text used by the typeahead search. */
46
+ searchTerm = () => ''; // Unused because toolbar does not support typeahead.
47
+ /** The value associated with the widget. */
48
+ value = () => ''; // Unused because toolbar does not support selection.
49
+ /** The position of the widget within the toolbar. */
50
+ index = computed(() => this.toolbar()?.inputs.items().indexOf(this) ?? -1);
51
+ /** The actions that can be performed on the widget group. */
52
+ controls = computed(() => this.inputs.controls() ?? this._defaultControls);
53
+ /** Default toolbar widget group controls when no controls provided. */
54
+ _defaultControls = {
55
+ isOnFirstItem: () => true,
56
+ isOnLastItem: () => true,
57
+ next: () => { },
58
+ prev: () => { },
59
+ first: () => { },
60
+ last: () => { },
61
+ unfocus: () => { },
62
+ trigger: () => { },
63
+ goto: () => { },
64
+ setDefaultState: () => { },
65
+ };
66
+ constructor(inputs) {
67
+ this.inputs = inputs;
68
+ this.id = inputs.id;
69
+ this.element = inputs.element;
70
+ this.disabled = inputs.disabled;
71
+ this.toolbar = inputs.toolbar;
72
+ }
73
+ }
74
+
75
+ /** Controls the state of a toolbar. */
76
+ class ToolbarPattern {
77
+ inputs;
78
+ /** The list behavior for the toolbar. */
79
+ listBehavior;
80
+ /** Whether the tablist is vertically or horizontally oriented. */
81
+ orientation;
82
+ /** Whether disabled items in the group should be skipped when navigating. */
83
+ skipDisabled;
84
+ /** Whether the toolbar is disabled. */
85
+ disabled = computed(() => this.listBehavior.disabled());
86
+ /** The tabindex of the toolbar (if using activedescendant). */
87
+ tabindex = computed(() => this.listBehavior.tabindex());
88
+ /** The id of the current active widget (if using activedescendant). */
89
+ activedescendant = computed(() => this.listBehavior.activedescendant());
90
+ /** The key used to navigate to the previous widget. */
91
+ _prevKey = computed(() => {
92
+ if (this.inputs.orientation() === 'vertical') {
93
+ return 'ArrowUp';
94
+ }
95
+ return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
96
+ });
97
+ /** The key used to navigate to the next widget. */
98
+ _nextKey = computed(() => {
99
+ if (this.inputs.orientation() === 'vertical') {
100
+ return 'ArrowDown';
101
+ }
102
+ return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
103
+ });
104
+ /** The alternate key used to navigate to the previous widget. */
105
+ _altPrevKey = computed(() => {
106
+ if (this.inputs.orientation() === 'vertical') {
107
+ return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
108
+ }
109
+ return 'ArrowUp';
110
+ });
111
+ /** The alternate key used to navigate to the next widget. */
112
+ _altNextKey = computed(() => {
113
+ if (this.inputs.orientation() === 'vertical') {
114
+ return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
115
+ }
116
+ return 'ArrowDown';
117
+ });
118
+ /** The keydown event manager for the toolbar. */
119
+ _keydown = computed(() => {
120
+ const manager = new KeyboardEventManager();
121
+ return manager
122
+ .on(this._nextKey, () => this._next())
123
+ .on(this._prevKey, () => this._prev())
124
+ .on(this._altNextKey, () => this._groupNext())
125
+ .on(this._altPrevKey, () => this._groupPrev())
126
+ .on(' ', () => this._trigger())
127
+ .on('Enter', () => this._trigger())
128
+ .on('Home', () => this._first())
129
+ .on('End', () => this._last());
130
+ });
131
+ /** The pointerdown event manager for the toolbar. */
132
+ _pointerdown = computed(() => new PointerEventManager().on(e => this._goto(e)));
133
+ /** Navigates to the next widget in the toolbar. */
134
+ _next() {
135
+ const item = this.inputs.activeItem();
136
+ if (item instanceof ToolbarWidgetGroupPattern) {
137
+ if (!item.disabled() && !item.controls().isOnLastItem()) {
138
+ item.controls().next(false);
139
+ return;
140
+ }
141
+ item.controls().unfocus();
142
+ }
143
+ this.listBehavior.next();
144
+ const newItem = this.inputs.activeItem();
145
+ if (newItem instanceof ToolbarWidgetGroupPattern) {
146
+ newItem.controls().first();
147
+ }
148
+ }
149
+ /** Navigates to the previous widget in the toolbar. */
150
+ _prev() {
151
+ const item = this.inputs.activeItem();
152
+ if (item instanceof ToolbarWidgetGroupPattern) {
153
+ if (!item.disabled() && !item.controls().isOnFirstItem()) {
154
+ item.controls().prev(false);
155
+ return;
156
+ }
157
+ item.controls().unfocus();
158
+ }
159
+ this.listBehavior.prev();
160
+ const newItem = this.inputs.activeItem();
161
+ if (newItem instanceof ToolbarWidgetGroupPattern) {
162
+ newItem.controls().last();
163
+ }
164
+ }
165
+ _groupNext() {
166
+ const item = this.inputs.activeItem();
167
+ if (item instanceof ToolbarWidgetPattern)
168
+ return;
169
+ item?.controls().next(true);
170
+ }
171
+ _groupPrev() {
172
+ const item = this.inputs.activeItem();
173
+ if (item instanceof ToolbarWidgetPattern)
174
+ return;
175
+ item?.controls().prev(true);
176
+ }
177
+ /** Triggers the action of the currently active widget. */
178
+ _trigger() {
179
+ const item = this.inputs.activeItem();
180
+ if (item instanceof ToolbarWidgetGroupPattern) {
181
+ item.controls().trigger();
182
+ }
183
+ }
184
+ /** Navigates to the first widget in the toolbar. */
185
+ _first() {
186
+ const item = this.inputs.activeItem();
187
+ if (item instanceof ToolbarWidgetGroupPattern) {
188
+ item.controls().unfocus();
189
+ }
190
+ this.listBehavior.first();
191
+ const newItem = this.inputs.activeItem();
192
+ if (newItem instanceof ToolbarWidgetGroupPattern) {
193
+ newItem.controls().first();
194
+ }
195
+ }
196
+ /** Navigates to the last widget in the toolbar. */
197
+ _last() {
198
+ const item = this.inputs.activeItem();
199
+ if (item instanceof ToolbarWidgetGroupPattern) {
200
+ item.controls().unfocus();
201
+ }
202
+ this.listBehavior.last();
203
+ const newItem = this.inputs.activeItem();
204
+ if (newItem instanceof ToolbarWidgetGroupPattern) {
205
+ newItem.controls().last();
206
+ }
207
+ }
208
+ /** Navigates to the widget targeted by a pointer event. */
209
+ _goto(e) {
210
+ const item = this.inputs.getItem(e.target);
211
+ if (!item)
212
+ return;
213
+ this.listBehavior.goto(item);
214
+ if (item instanceof ToolbarWidgetGroupPattern) {
215
+ item.controls().goto(e);
216
+ }
217
+ }
218
+ constructor(inputs) {
219
+ this.inputs = inputs;
220
+ this.orientation = inputs.orientation;
221
+ this.skipDisabled = inputs.skipDisabled;
222
+ this.listBehavior = new List({
223
+ ...inputs,
224
+ multi: () => false,
225
+ focusMode: () => 'roving',
226
+ selectionMode: () => 'explicit',
227
+ value: signal([]),
228
+ typeaheadDelay: () => 0, // Toolbar widgets do not support typeahead.
229
+ });
230
+ }
231
+ /** Handles keydown events for the toolbar. */
232
+ onKeydown(event) {
233
+ if (this.disabled())
234
+ return;
235
+ this._keydown().handle(event);
236
+ }
237
+ /** Handles pointerdown events for the toolbar. */
238
+ onPointerdown(event) {
239
+ if (this.disabled())
240
+ return;
241
+ this._pointerdown().handle(event);
242
+ }
243
+ /**
244
+ * Sets the toolbar to its default initial state.
245
+ *
246
+ * Sets the active index to the selected widget if one exists and is focusable.
247
+ * Otherwise, sets the active index to the first focusable widget.
248
+ */
249
+ setDefaultState() {
250
+ let firstItem = null;
251
+ for (const item of this.inputs.items()) {
252
+ if (this.listBehavior.isFocusable(item)) {
253
+ if (!firstItem) {
254
+ firstItem = item;
255
+ }
256
+ }
257
+ }
258
+ if (firstItem) {
259
+ this.inputs.activeItem.set(firstItem);
260
+ }
261
+ if (firstItem instanceof ToolbarWidgetGroupPattern) {
262
+ firstItem.controls().setDefaultState();
263
+ }
264
+ }
265
+ /** Validates the state of the toolbar and returns a list of accessibility violations. */
266
+ validate() {
267
+ const violations = [];
268
+ return violations;
269
+ }
270
+ }
271
+
272
+ export { ToolbarPattern, ToolbarWidgetGroupPattern, ToolbarWidgetPattern };
273
+ //# sourceMappingURL=_toolbar-chunk.mjs.map