@angular/cdk-experimental 20.2.0-next.2 → 20.2.0-rc.0

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 (80) hide show
  1. package/accordion/index.d.ts +3 -3
  2. package/{accordion.d-CC6dGMlv.d.ts → accordion.d.d.ts} +7 -5
  3. package/{expansion.d-Zkcf-XJU.d.ts → expansion.d.d.ts} +3 -3
  4. package/fesm2022/accordion.mjs +17 -17
  5. package/fesm2022/accordion.mjs.map +1 -1
  6. package/fesm2022/{accordion-D9JoxtzT.mjs → accordion2.mjs} +8 -6
  7. package/fesm2022/accordion2.mjs.map +1 -0
  8. package/fesm2022/cdk-experimental.mjs +1 -1
  9. package/fesm2022/cdk-experimental.mjs.map +1 -1
  10. package/fesm2022/column-resize.mjs +54 -54
  11. package/fesm2022/column-resize.mjs.map +1 -1
  12. package/fesm2022/combobox.mjs +10 -10
  13. package/fesm2022/combobox.mjs.map +1 -1
  14. package/fesm2022/deferred-content.mjs +6 -6
  15. package/fesm2022/deferred-content.mjs.map +1 -1
  16. package/fesm2022/{expansion-C9iQLHOG.mjs → expansion.mjs} +2 -2
  17. package/fesm2022/expansion.mjs.map +1 -0
  18. package/fesm2022/{list-focus-Czul8jzR.mjs → list-navigation.mjs} +67 -62
  19. package/fesm2022/list-navigation.mjs.map +1 -0
  20. package/fesm2022/list.mjs +355 -0
  21. package/fesm2022/list.mjs.map +1 -0
  22. package/fesm2022/listbox.mjs +10 -11
  23. package/fesm2022/listbox.mjs.map +1 -1
  24. package/fesm2022/option.mjs +231 -0
  25. package/fesm2022/option.mjs.map +1 -0
  26. package/fesm2022/{polyfill-CXksG4af.mjs → polyfill.mjs} +2 -2
  27. package/fesm2022/polyfill.mjs.map +1 -0
  28. package/fesm2022/popover-edit.mjs +44 -44
  29. package/fesm2022/popover-edit.mjs.map +1 -1
  30. package/fesm2022/radio-group.mjs +44 -11
  31. package/fesm2022/radio-group.mjs.map +1 -1
  32. package/fesm2022/radio-group2.mjs +143 -0
  33. package/fesm2022/radio-group2.mjs.map +1 -0
  34. package/fesm2022/scrolling.mjs +7 -7
  35. package/fesm2022/scrolling.mjs.map +1 -1
  36. package/fesm2022/selection.mjs +19 -19
  37. package/fesm2022/selection.mjs.map +1 -1
  38. package/fesm2022/table-scroll-container.mjs +7 -7
  39. package/fesm2022/table-scroll-container.mjs.map +1 -1
  40. package/fesm2022/tabs.mjs +20 -20
  41. package/fesm2022/tabs.mjs.map +1 -1
  42. package/fesm2022/{tabs-hMdwtXv2.mjs → tabs2.mjs} +34 -70
  43. package/fesm2022/tabs2.mjs.map +1 -0
  44. package/fesm2022/toolbar.mjs +168 -0
  45. package/fesm2022/toolbar.mjs.map +1 -0
  46. package/fesm2022/toolbar2.mjs +224 -0
  47. package/fesm2022/toolbar2.mjs.map +1 -0
  48. package/fesm2022/tree.mjs +140 -219
  49. package/fesm2022/tree.mjs.map +1 -1
  50. package/fesm2022/ui-patterns.mjs +8 -8
  51. package/fesm2022/ui-patterns.mjs.map +1 -1
  52. package/list.d.d.ts +207 -0
  53. package/listbox/index.d.ts +3 -4
  54. package/{listbox.d-Ckp1is82.d.ts → listbox.d.d.ts} +9 -62
  55. package/package.json +6 -2
  56. package/{pointer-event-manager.d-BqSm9Jh5.d.ts → pointer-event-manager.d.d.ts} +12 -8
  57. package/radio-group/index.d.ts +15 -7
  58. package/radio-group.d.d.ts +80 -0
  59. package/tabs/index.d.ts +4 -4
  60. package/{tabs.d-Db8oTrMB.d.ts → tabs.d.d.ts} +15 -30
  61. package/toolbar/index.d.ts +89 -0
  62. package/toolbar.d.d.ts +136 -0
  63. package/tree/index.d.ts +28 -63
  64. package/ui-patterns/index.d.ts +8 -8
  65. package/fesm2022/accordion-D9JoxtzT.mjs.map +0 -1
  66. package/fesm2022/expansion-C9iQLHOG.mjs.map +0 -1
  67. package/fesm2022/list-focus-Czul8jzR.mjs.map +0 -1
  68. package/fesm2022/list-selection-C41ApAbt.mjs +0 -136
  69. package/fesm2022/list-selection-C41ApAbt.mjs.map +0 -1
  70. package/fesm2022/list-typeahead-DIIbNJrP.mjs +0 -64
  71. package/fesm2022/list-typeahead-DIIbNJrP.mjs.map +0 -1
  72. package/fesm2022/option-CgeKz9_Q.mjs +0 -321
  73. package/fesm2022/option-CgeKz9_Q.mjs.map +0 -1
  74. package/fesm2022/polyfill-CXksG4af.mjs.map +0 -1
  75. package/fesm2022/radio-button-92xc4w-A.mjs +0 -203
  76. package/fesm2022/radio-button-92xc4w-A.mjs.map +0 -1
  77. package/fesm2022/tabs-hMdwtXv2.mjs.map +0 -1
  78. package/list-selection.d-fbAPr_N_.d.ts +0 -69
  79. package/list-typeahead.d-ljh3nJ9y.d.ts +0 -48
  80. package/radio-group.d-CFC0aKQM.d.ts +0 -114
package/toolbar.d.d.ts ADDED
@@ -0,0 +1,136 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { SignalLike, KeyboardEventManager, PointerEventManager } from './pointer-event-manager.d.js';
3
+ import { ListItem, List, ListInputs } from './list.d.js';
4
+
5
+ /**
6
+ * Represents the properties exposed by a toolbar widget that need to be accessed by a radio group.
7
+ * This exists to avoid circular dependency errors between the toolbar and radio button.
8
+ */
9
+ type ToolbarWidgetLike = {
10
+ id: SignalLike<string>;
11
+ index: SignalLike<number>;
12
+ element: SignalLike<HTMLElement>;
13
+ disabled: SignalLike<boolean>;
14
+ searchTerm: SignalLike<any>;
15
+ value: SignalLike<any>;
16
+ };
17
+ /**
18
+ * Represents the properties exposed by a radio group that need to be accessed by a radio button.
19
+ * This exists to avoid circular dependency errors between the radio group and radio button.
20
+ */
21
+ interface RadioGroupLike<V> {
22
+ /** The list behavior for the radio group. */
23
+ listBehavior: List<RadioButtonPattern<V> | ToolbarWidgetLike, V>;
24
+ /** Whether the list is readonly */
25
+ readonly: SignalLike<boolean>;
26
+ /** Whether the radio group is disabled. */
27
+ disabled: SignalLike<boolean>;
28
+ }
29
+ /** Represents the required inputs for a radio button in a radio group. */
30
+ interface RadioButtonInputs<V> extends Omit<ListItem<V>, 'searchTerm' | 'index'> {
31
+ /** A reference to the parent radio group. */
32
+ group: SignalLike<RadioGroupLike<V> | undefined>;
33
+ }
34
+ /** Represents a radio button within a radio group. */
35
+ declare class RadioButtonPattern<V> {
36
+ readonly inputs: RadioButtonInputs<V>;
37
+ /** A unique identifier for the radio button. */
38
+ id: SignalLike<string>;
39
+ /** The value associated with the radio button. */
40
+ value: SignalLike<V>;
41
+ /** The position of the radio button within the group. */
42
+ index: SignalLike<number>;
43
+ /** Whether the radio button is currently the active one (focused). */
44
+ active: _angular_core.Signal<boolean>;
45
+ /** Whether the radio button is selected. */
46
+ selected: SignalLike<boolean>;
47
+ /** Whether the radio button is disabled. */
48
+ disabled: SignalLike<boolean>;
49
+ /** A reference to the parent radio group. */
50
+ group: SignalLike<RadioGroupLike<V> | undefined>;
51
+ /** The tabindex of the radio button. */
52
+ tabindex: _angular_core.Signal<0 | -1 | undefined>;
53
+ /** The HTML element associated with the radio button. */
54
+ element: SignalLike<HTMLElement>;
55
+ /** The search term for typeahead. */
56
+ readonly searchTerm: () => string;
57
+ constructor(inputs: RadioButtonInputs<V>);
58
+ }
59
+
60
+ /** Represents the required inputs for a toolbar. */
61
+ type ToolbarInputs<V> = Omit<ListInputs<ToolbarWidgetPattern | RadioButtonPattern<V>, V>, 'multi' | 'typeaheadDelay' | 'value' | 'selectionMode'>;
62
+ /** Controls the state of a toolbar. */
63
+ declare class ToolbarPattern<V> {
64
+ readonly inputs: ToolbarInputs<V>;
65
+ /** The list behavior for the toolbar. */
66
+ listBehavior: List<ToolbarWidgetPattern | RadioButtonPattern<V>, V>;
67
+ /** Whether the tablist is vertically or horizontally oriented. */
68
+ readonly orientation: SignalLike<'vertical' | 'horizontal'>;
69
+ /** Whether the toolbar is disabled. */
70
+ disabled: _angular_core.Signal<boolean>;
71
+ /** The tabindex of the toolbar (if using activedescendant). */
72
+ tabindex: _angular_core.Signal<0 | -1>;
73
+ /** The id of the current active widget (if using activedescendant). */
74
+ activedescendant: _angular_core.Signal<string | undefined>;
75
+ /** The key used to navigate to the previous widget. */
76
+ prevKey: _angular_core.Signal<"ArrowUp" | "ArrowRight" | "ArrowLeft">;
77
+ /** The key used to navigate to the next widget. */
78
+ nextKey: _angular_core.Signal<"ArrowRight" | "ArrowLeft" | "ArrowDown">;
79
+ /** The alternate key used to navigate to the previous widget */
80
+ altPrevKey: _angular_core.Signal<"ArrowUp" | "ArrowRight" | "ArrowLeft">;
81
+ /** The alternate key used to navigate to the next widget. */
82
+ altNextKey: _angular_core.Signal<"ArrowRight" | "ArrowLeft" | "ArrowDown">;
83
+ /** The keydown event manager for the toolbar. */
84
+ keydown: _angular_core.Signal<KeyboardEventManager<KeyboardEvent>>;
85
+ selectRadioButton(): void;
86
+ /** The pointerdown event manager for the toolbar. */
87
+ pointerdown: _angular_core.Signal<PointerEventManager<PointerEvent>>;
88
+ /** Navigates to the widget associated with the given pointer event. */
89
+ goto(event: PointerEvent): void;
90
+ /** Handles keydown events for the toolbar. */
91
+ onKeydown(event: KeyboardEvent): void;
92
+ /** Handles pointerdown events for the toolbar. */
93
+ onPointerdown(event: PointerEvent): void;
94
+ /** Finds the Toolbar Widget associated with a pointer event target. */
95
+ private _getItem;
96
+ constructor(inputs: ToolbarInputs<V>);
97
+ /**
98
+ * Sets the toolbar to its default initial state.
99
+ *
100
+ * Sets the active index to the selected widget if one exists and is focusable.
101
+ * Otherwise, sets the active index to the first focusable widget.
102
+ */
103
+ setDefaultState(): void;
104
+ /** Validates the state of the toolbar and returns a list of accessibility violations. */
105
+ validate(): string[];
106
+ }
107
+ /** Represents the required inputs for a toolbar widget in a toolbar. */
108
+ interface ToolbarWidgetInputs extends Omit<ListItem<any>, 'searchTerm' | 'value' | 'index'> {
109
+ /** A reference to the parent toolbar. */
110
+ parentToolbar: SignalLike<ToolbarPattern<null>>;
111
+ }
112
+ declare class ToolbarWidgetPattern {
113
+ readonly inputs: ToolbarWidgetInputs;
114
+ /** A unique identifier for the widget. */
115
+ id: SignalLike<string>;
116
+ /** The html element that should receive focus. */
117
+ readonly element: SignalLike<HTMLElement>;
118
+ /** Whether the widget is disabled. */
119
+ disabled: SignalLike<boolean>;
120
+ /** A reference to the parent toolbar. */
121
+ parentToolbar: SignalLike<ToolbarPattern<null> | undefined>;
122
+ /** The tabindex of the widgdet. */
123
+ tabindex: _angular_core.Signal<0 | -1>;
124
+ /** The text used by the typeahead search. */
125
+ readonly searchTerm: () => string;
126
+ /** The value associated with the widget. */
127
+ readonly value: () => any;
128
+ /** The position of the widget within the toolbar. */
129
+ index: _angular_core.Signal<number>;
130
+ /** Whether the widget is currently the active one (focused). */
131
+ active: _angular_core.Signal<boolean>;
132
+ constructor(inputs: ToolbarWidgetInputs);
133
+ }
134
+
135
+ export { RadioButtonPattern, ToolbarPattern, ToolbarWidgetPattern };
136
+ export type { RadioButtonInputs, ToolbarInputs, ToolbarWidgetInputs };
package/tree/index.d.ts CHANGED
@@ -1,14 +1,13 @@
1
1
  import * as _angular_cdk_bidi from '@angular/cdk/bidi';
2
2
  import * as _angular_core from '@angular/core';
3
3
  import { OnInit, OnDestroy, Signal } from '@angular/core';
4
- import { S as SignalLike, d as ListFocus, b as ListNavigation, K as KeyboardEventManager, P as PointerEventManager, f as ListFocusItem, e as ListNavigationItem, a as ListFocusInputs, L as ListNavigationInputs } from '../pointer-event-manager.d-BqSm9Jh5.js';
5
- import { L as ListSelection, a as ListSelectionItem, b as ListSelectionInputs } from '../list-selection.d-fbAPr_N_.js';
6
- import { L as ListTypeahead, a as ListTypeaheadItem, b as ListTypeaheadInputs } from '../list-typeahead.d-ljh3nJ9y.js';
7
- import { E as ExpansionItem, a as ListExpansion, b as ExpansionControl } from '../expansion.d-Zkcf-XJU.js';
4
+ import { SignalLike, KeyboardEventManager, PointerEventManager } from '../pointer-event-manager.d.js';
5
+ import { List, ListItem, ListInputs } from '../list.d.js';
6
+ import { ExpansionItem, ListExpansion, ExpansionControl } from '../expansion.d.js';
8
7
  import * as i1 from '@angular/cdk-experimental/deferred-content';
9
8
 
10
9
  /** Represents the required inputs for a tree item. */
11
- interface TreeItemInputs<V> extends ListFocusItem, ListNavigationItem, ListSelectionItem<V>, ListTypeaheadItem {
10
+ interface TreeItemInputs<V> extends Omit<ListItem<V>, 'index'> {
12
11
  /** The parent item. */
13
12
  parent: SignalLike<TreeItemPattern<V> | TreePattern<V>>;
14
13
  /** Whether this item has children. Children can be lazily loaded. */
@@ -25,6 +24,8 @@ interface TreeItemPattern<V> extends TreeItemInputs<V> {
25
24
  */
26
25
  declare class TreeItemPattern<V> implements ExpansionItem {
27
26
  readonly inputs: TreeItemInputs<V>;
27
+ /** The position of this item among its siblings. */
28
+ readonly index: _angular_core.Signal<number>;
28
29
  /** The unique identifier used by the expansion behavior. */
29
30
  readonly expansionId: SignalLike<string>;
30
31
  /** Controls expansion for child items. */
@@ -61,7 +62,7 @@ interface SelectOptions {
61
62
  anchor?: boolean;
62
63
  }
63
64
  /** Represents the required inputs for a tree. */
64
- interface TreeInputs<V> extends Omit<ListFocusInputs<TreeItemPattern<V>> & ListNavigationInputs<TreeItemPattern<V>> & ListSelectionInputs<TreeItemPattern<V>, V> & ListTypeaheadInputs<TreeItemPattern<V>>, 'items'> {
65
+ interface TreeInputs<V> extends Omit<ListInputs<TreeItemPattern<V>, V>, 'items'> {
65
66
  /** All items in the tree, in document order (DFS-like, a flattened list). */
66
67
  allItems: SignalLike<TreeItemPattern<V>[]>;
67
68
  /** Whether the tree is in navigation mode. */
@@ -74,14 +75,8 @@ interface TreePattern<V> extends TreeInputs<V> {
74
75
  /** Controls the state and interactions of a tree view. */
75
76
  declare class TreePattern<V> {
76
77
  readonly inputs: TreeInputs<V>;
77
- /** Controls focus for the all visible tree items. */
78
- readonly focusManager: ListFocus<TreeItemPattern<V>>;
79
- /** Controls navigation for all visible tree items. */
80
- readonly navigationManager: ListNavigation<TreeItemPattern<V>>;
81
- /** Controls selection for all visible tree items. */
82
- readonly selectionManager: ListSelection<TreeItemPattern<V>, V>;
83
- /** Controls typeahead for all visible tree items. */
84
- readonly typeaheadManager: ListTypeahead<TreeItemPattern<V>>;
78
+ /** The list behavior for the tree. */
79
+ readonly listBehavior: List<TreeItemPattern<V>, V>;
85
80
  /** Controls expansion for direct children of the tree root (top-level items). */
86
81
  readonly expansionManager: ListExpansion;
87
82
  /** The root level is 0. */
@@ -92,8 +87,6 @@ declare class TreePattern<V> {
92
87
  readonly tabindex: _angular_core.Signal<0 | -1>;
93
88
  /** The id of the current active item. */
94
89
  readonly activedescendant: _angular_core.Signal<string | undefined>;
95
- /** Whether the tree is performing a range selection. */
96
- readonly inSelection: _angular_core.WritableSignal<boolean>;
97
90
  /** The direct children of the root (top-level tree items). */
98
91
  readonly children: _angular_core.Signal<TreeItemPattern<V>[]>;
99
92
  /** All currently visible tree items. An item is visible if their parent is expanded. */
@@ -112,14 +105,6 @@ declare class TreePattern<V> {
112
105
  readonly dynamicSpaceKey: _angular_core.Signal<"" | " ">;
113
106
  /** Regular expression to match characters for typeahead. */
114
107
  readonly typeaheadRegexp: RegExp;
115
- /** Uncommitted tree item for selecting a range of tree items. */
116
- readonly anchorItem: _angular_core.WritableSignal<TreeItemPattern<V> | undefined>;
117
- /**
118
- * Uncommitted tree item index for selecting a range of tree items.
119
- *
120
- * The index is computed in case the tree item position is changed caused by tree expansions.
121
- */
122
- readonly anchorIndex: _angular_core.Signal<number>;
123
108
  /** The keydown event manager for the tree. */
124
109
  readonly keydown: _angular_core.Signal<KeyboardEventManager<KeyboardEvent>>;
125
110
  /** The pointerdown event manager for the tree. */
@@ -136,18 +121,8 @@ declare class TreePattern<V> {
136
121
  onKeydown(event: KeyboardEvent): void;
137
122
  /** Handles pointerdown events on the tree. */
138
123
  onPointerdown(event: PointerEvent): void;
139
- /** Navigates to the first visible tree item in the tree. */
140
- first(opts?: SelectOptions): void;
141
- /** Navigates to the last visible tree item in the tree. */
142
- last(opts?: SelectOptions): void;
143
- /** Navigates to the next visible tree item in the tree. */
144
- next(opts?: SelectOptions): void;
145
- /** Navigates to the previous visible tree item in the tree. */
146
- prev(opts?: SelectOptions): void;
147
124
  /** Navigates to the given tree item in the tree. */
148
- goto(event: PointerEvent, opts?: SelectOptions): void;
149
- /** Handles typeahead search navigation for the tree. */
150
- search(char: string, opts?: SelectOptions): void;
125
+ goto(e: PointerEvent, opts?: SelectOptions): void;
151
126
  /** Toggles to expand or collapse a tree item. */
152
127
  toggleExpansion(item?: TreeItemPattern<V>): void;
153
128
  /** Expands a tree item. */
@@ -156,10 +131,6 @@ declare class TreePattern<V> {
156
131
  expandSiblings(item?: TreeItemPattern<V>): void;
157
132
  /** Collapses a tree item. */
158
133
  collapse(item?: TreeItemPattern<V>): void;
159
- /** Safely performs a navigation operation. */
160
- private _navigate;
161
- /** Handles updating selection for the tree. */
162
- private _updateSelection;
163
134
  /** Retrieves the TreeItemPattern associated with a DOM event, if any. */
164
135
  private _getItem;
165
136
  }
@@ -191,8 +162,6 @@ interface HasElement {
191
162
  declare class CdkTree<V> {
192
163
  /** All CdkTreeItem instances within this tree. */
193
164
  private readonly _unorderedItems;
194
- /** All CdkGroup instances within this tree. */
195
- readonly unorderedGroups: _angular_core.WritableSignal<Set<CdkTreeItemGroup<V>>>;
196
165
  /** Orientation of the tree. */
197
166
  readonly orientation: _angular_core.InputSignal<"vertical" | "horizontal">;
198
167
  /** Whether multi-selection is allowed. */
@@ -223,8 +192,8 @@ declare class CdkTree<V> {
223
192
  private _hasFocused;
224
193
  constructor();
225
194
  onFocus(): void;
226
- register(child: CdkTreeItemGroup<V> | CdkTreeItem<V>): void;
227
- deregister(child: CdkTreeItemGroup<V> | CdkTreeItem<V>): void;
195
+ register(child: CdkTreeItem<V>): void;
196
+ unregister(child: CdkTreeItem<V>): void;
228
197
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CdkTree<any>, never>;
229
198
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CdkTree<any>, "[cdkTree]", ["cdkTree"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "multi": { "alias": "multi"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; "focusMode": { "alias": "focusMode"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; "skipDisabled": { "alias": "skipDisabled"; "required": false; "isSignal": true; }; "typeaheadDelay": { "alias": "typeaheadDelay"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "nav": { "alias": "nav"; "required": false; "isSignal": true; }; "currentType": { "alias": "currentType"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
230
199
  }
@@ -236,35 +205,33 @@ declare class CdkTreeItem<V> implements OnInit, OnDestroy, HasElement {
236
205
  private readonly _elementRef;
237
206
  /** A unique identifier for the tree item. */
238
207
  private readonly _id;
239
- /** The top level CdkTree. */
240
- private readonly _tree;
241
- /** The parent CdkTreeItem. */
242
- private readonly _treeItem;
243
- /** The parent CdkGroup, if any. */
244
- private readonly _parentGroup;
245
- /** The top level TreePattern. */
246
- private readonly _treePattern;
247
- /** The parent TreeItemPattern. */
248
- private readonly _parentPattern;
208
+ /** The owned tree item group. */
209
+ private readonly _group;
210
+ /** The id of the owned group. */
211
+ readonly ownsId: Signal<string | undefined>;
249
212
  /** The host native element. */
250
213
  readonly element: Signal<any>;
251
214
  /** The value of the tree item. */
252
215
  readonly value: _angular_core.InputSignal<V>;
216
+ /** The parent tree root or tree item group. */
217
+ readonly parent: _angular_core.InputSignal<CdkTreeItemGroup<V> | CdkTree<V>>;
253
218
  /** Whether the tree item is disabled. */
254
219
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
255
220
  /** Optional label for typeahead. Defaults to the element's textContent. */
256
221
  readonly label: _angular_core.InputSignal<string | undefined>;
257
222
  /** Search term for typeahead. */
258
223
  readonly searchTerm: Signal<any>;
259
- /** Manual group assignment. */
260
- readonly group: _angular_core.WritableSignal<CdkTreeItemGroup<V> | undefined>;
224
+ /** The tree root. */
225
+ readonly tree: Signal<CdkTree<V>>;
261
226
  /** The UI pattern for this item. */
262
- readonly pattern: TreeItemPattern<V>;
227
+ pattern: TreeItemPattern<V>;
263
228
  constructor();
264
229
  ngOnInit(): void;
265
230
  ngOnDestroy(): void;
231
+ register(group: CdkTreeItemGroup<V>): void;
232
+ unregister(): void;
266
233
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CdkTreeItem<any>, never>;
267
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CdkTreeItem<any>, "[cdkTreeItem]", ["cdkTreeItem"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
234
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CdkTreeItem<any>, "[cdkTreeItem]", ["cdkTreeItem"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; "parent": { "alias": "parent"; "required": true; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
268
235
  }
269
236
  /**
270
237
  * Container that designates content as a group.
@@ -274,8 +241,6 @@ declare class CdkTreeItemGroup<V> implements OnInit, OnDestroy, HasElement {
274
241
  private readonly _elementRef;
275
242
  /** The DeferredContentAware host directive. */
276
243
  private readonly _deferredContentAware;
277
- /** The top level CdkTree. */
278
- private readonly _tree;
279
244
  /** All groupable items that are descendants of the group. */
280
245
  private readonly _unorderedItems;
281
246
  /** The host native element. */
@@ -286,15 +251,15 @@ declare class CdkTreeItemGroup<V> implements OnInit, OnDestroy, HasElement {
286
251
  readonly visible: _angular_core.WritableSignal<boolean>;
287
252
  /** Child items within this group. */
288
253
  readonly children: Signal<CdkTreeItem<V>[]>;
289
- /** Identifier for matching the group owner. */
290
- readonly value: _angular_core.InputSignal<V>;
254
+ /** Tree item that owns the group. */
255
+ readonly ownedBy: _angular_core.InputSignal<CdkTreeItem<V>>;
291
256
  constructor();
292
257
  ngOnInit(): void;
293
258
  ngOnDestroy(): void;
294
259
  register(child: CdkTreeItem<V>): void;
295
- deregister(child: CdkTreeItem<V>): void;
260
+ unregister(child: CdkTreeItem<V>): void;
296
261
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CdkTreeItemGroup<any>, never>;
297
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CdkTreeItemGroup<any>, "[cdkTreeItemGroup]", ["cdkTreeItemGroup"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
262
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CdkTreeItemGroup<any>, "[cdkTreeItemGroup]", ["cdkTreeItemGroup"], { "ownedBy": { "alias": "ownedBy"; "required": true; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
298
263
  }
299
264
  /**
300
265
  * A structural directive that marks the `ng-template` to be used as the content
@@ -1,9 +1,9 @@
1
- export { L as ListboxInputs, a as ListboxPattern, O as OptionInputs, b as OptionPattern } from '../listbox.d-Ckp1is82.js';
2
- export { b as RadioButtonInputs, c as RadioButtonPattern, R as RadioGroupInputs, a as RadioGroupPattern } from '../radio-group.d-CFC0aKQM.js';
3
- export { S as SignalLike, W as WritableSignalLike, c as convertGetterSetterToWritableSignalLike } from '../pointer-event-manager.d-BqSm9Jh5.js';
4
- export { T as TabInputs, d as TabListInputs, e as TabListPattern, b as TabPanelInputs, c as TabPanelPattern, a as TabPattern } from '../tabs.d-Db8oTrMB.js';
5
- export { A as AccordionGroupInputs, a as AccordionGroupPattern, d as AccordionPanelInputs, e as AccordionPanelPattern, b as AccordionTriggerInputs, c as AccordionTriggerPattern } from '../accordion.d-CC6dGMlv.js';
1
+ export { ListboxInputs, ListboxPattern, OptionInputs, OptionPattern } from '../listbox.d.js';
2
+ export { RadioGroupInputs, RadioGroupPattern, ToolbarLike } from '../radio-group.d.js';
3
+ export { RadioButtonInputs, RadioButtonPattern, ToolbarInputs, ToolbarPattern, ToolbarWidgetInputs, ToolbarWidgetPattern } from '../toolbar.d.js';
4
+ export { SignalLike, WritableSignalLike, convertGetterSetterToWritableSignalLike } from '../pointer-event-manager.d.js';
5
+ export { TabInputs, TabListInputs, TabListPattern, TabPanelInputs, TabPanelPattern, TabPattern } from '../tabs.d.js';
6
+ export { AccordionGroupInputs, AccordionGroupPattern, AccordionPanelInputs, AccordionPanelPattern, AccordionTriggerInputs, AccordionTriggerPattern } from '../accordion.d.js';
6
7
  import '@angular/core';
7
- import '../list-selection.d-fbAPr_N_.js';
8
- import '../list-typeahead.d-ljh3nJ9y.js';
9
- import '../expansion.d-Zkcf-XJU.js';
8
+ import '../list.d.js';
9
+ import '../expansion.d.js';
@@ -1 +0,0 @@
1
- {"version":3,"file":"accordion-D9JoxtzT.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/accordion/accordion.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} from '@angular/core';\nimport {KeyboardEventManager, PointerEventManager} from '../behaviors/event-manager';\nimport {\n ExpansionItem,\n ExpansionControl,\n ListExpansion,\n ListExpansionInputs,\n} from '../behaviors/expansion/expansion';\nimport {ListFocus, ListFocusInputs, ListFocusItem} from '../behaviors/list-focus/list-focus';\nimport {\n ListNavigation,\n ListNavigationInputs,\n ListNavigationItem,\n} from '../behaviors/list-navigation/list-navigation';\nimport {SignalLike} from '../behaviors/signal-like/signal-like';\n\n/** Inputs of the AccordionGroupPattern. */\nexport type AccordionGroupInputs = Omit<\n ListNavigationInputs<AccordionTriggerPattern> &\n ListFocusInputs<AccordionTriggerPattern> &\n Omit<ListExpansionInputs, 'items'>,\n 'focusMode'\n>;\n\nconst focusMode = () => 'roving' as const;\n\nexport interface AccordionGroupPattern extends AccordionGroupInputs {}\n/** A pattern controls the nested Accordions. */\nexport class AccordionGroupPattern {\n /** Controls navigation for the group. */\n navigation: ListNavigation<AccordionTriggerPattern>;\n\n /** Controls focus for the group. */\n focusManager: ListFocus<AccordionTriggerPattern>;\n\n /** Controls expansion for the group. */\n expansionManager: ListExpansion;\n\n constructor(readonly inputs: AccordionGroupInputs) {\n this.wrap = inputs.wrap;\n this.orientation = inputs.orientation;\n this.textDirection = inputs.textDirection;\n this.activeIndex = inputs.activeIndex;\n this.disabled = inputs.disabled;\n this.multiExpandable = inputs.multiExpandable;\n this.items = inputs.items;\n this.expandedIds = inputs.expandedIds;\n this.skipDisabled = inputs.skipDisabled;\n this.focusManager = new ListFocus({\n ...inputs,\n focusMode,\n });\n this.navigation = new ListNavigation({\n ...inputs,\n focusMode,\n focusManager: this.focusManager,\n });\n this.expansionManager = new ListExpansion({\n ...inputs,\n });\n }\n}\n\n/** Inputs for the AccordionTriggerPattern. */\nexport type AccordionTriggerInputs = ListNavigationItem &\n ListFocusItem &\n Omit<ExpansionItem, 'expansionId' | 'expandable'> & {\n /** A local unique identifier for the trigger. */\n value: SignalLike<string>;\n\n /** The parent accordion group that controls this trigger. */\n accordionGroup: SignalLike<AccordionGroupPattern>;\n\n /** The accordion panel controlled by this trigger. */\n accordionPanel: SignalLike<AccordionPanelPattern | undefined>;\n };\n\nexport interface AccordionTriggerPattern extends AccordionTriggerInputs {}\n/** A pattern controls the expansion state of an accordion. */\nexport class AccordionTriggerPattern {\n /** Whether this tab has expandable content. */\n expandable: SignalLike<boolean>;\n\n /** The unique identifier used by the expansion behavior. */\n expansionId: SignalLike<string>;\n\n /** Whether an accordion is expanded. */\n expanded: SignalLike<boolean>;\n\n /** Controls the expansion state for the trigger. */\n expansionControl: ExpansionControl;\n\n /** Whether the trigger is active. */\n active = computed(() => this.inputs.accordionGroup().focusManager.activeItem() === this);\n\n /** Id of the accordion panel controlled by the trigger. */\n controls = computed(() => this.inputs.accordionPanel()?.id());\n\n /** The tabindex of the trigger. */\n tabindex = computed(() => (this.inputs.accordionGroup().focusManager.isFocusable(this) ? 0 : -1));\n\n /** Whether the trigger is disabled. Disabling an accordion group disables all the triggers. */\n disabled = computed(() => this.inputs.disabled() || this.inputs.accordionGroup().disabled());\n\n constructor(readonly inputs: AccordionTriggerInputs) {\n this.id = inputs.id;\n this.element = inputs.element;\n this.value = inputs.value;\n this.accordionGroup = inputs.accordionGroup;\n this.accordionPanel = inputs.accordionPanel;\n this.expansionControl = new ExpansionControl({\n ...inputs,\n expansionId: inputs.value,\n expandable: () => true,\n expansionManager: inputs.accordionGroup().expansionManager,\n });\n this.expandable = this.expansionControl.isExpandable;\n this.expansionId = this.expansionControl.expansionId;\n this.expanded = this.expansionControl.isExpanded;\n }\n\n /** The key used to navigate to the previous accordion trigger. */\n prevKey = computed(() => {\n if (this.inputs.accordionGroup().orientation() === 'vertical') {\n return 'ArrowUp';\n }\n return this.inputs.accordionGroup().textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n });\n\n /** The key used to navigate to the next accordion trigger. */\n nextKey = computed(() => {\n if (this.inputs.accordionGroup().orientation() === 'vertical') {\n return 'ArrowDown';\n }\n return this.inputs.accordionGroup().textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n });\n\n /** The keydown event manager for the accordion trigger. */\n keydown = computed(() => {\n return new KeyboardEventManager()\n .on(this.prevKey, () => this.accordionGroup().navigation.prev())\n .on(this.nextKey, () => this.accordionGroup().navigation.next())\n .on('Home', () => this.accordionGroup().navigation.first())\n .on('End', () => this.accordionGroup().navigation.last())\n .on(' ', () => this.expansionControl.toggle())\n .on('Enter', () => this.expansionControl.toggle());\n });\n\n /** The pointerdown event manager for the accordion trigger. */\n pointerdown = computed(() => {\n return new PointerEventManager().on(e => {\n const item = this._getItem(e);\n\n if (item) {\n this.accordionGroup().navigation.goto(item);\n this.expansionControl.toggle();\n }\n });\n });\n\n /** Handles keydown events on the trigger, delegating to the group if not disabled. */\n onKeydown(event: KeyboardEvent): void {\n this.keydown().handle(event);\n }\n\n /** Handles pointerdown events on the trigger, delegating to the group if not disabled. */\n onPointerdown(event: PointerEvent): void {\n this.pointerdown().handle(event);\n }\n\n /** Handles focus events on the trigger. This ensures the tabbing changes the active index. */\n onFocus(event: FocusEvent): void {\n const item = this._getItem(event);\n\n if (item && this.inputs.accordionGroup().focusManager.isFocusable(item)) {\n this.accordionGroup().focusManager.focus(item);\n }\n }\n\n private _getItem(e: Event) {\n if (!(e.target instanceof HTMLElement)) {\n return;\n }\n\n const element = e.target.closest('[role=\"button\"]');\n return this.accordionGroup()\n .items()\n .find(i => i.element() === element);\n }\n}\n\n/** Represents the required inputs for the AccordionPanelPattern. */\nexport interface AccordionPanelInputs {\n /** A global unique identifier for the panel. */\n id: SignalLike<string>;\n\n /** A local unique identifier for the panel, matching its trigger's value. */\n value: SignalLike<string>;\n\n /** The parent accordion trigger that controls this panel. */\n accordionTrigger: SignalLike<AccordionTriggerPattern | undefined>;\n}\n\nexport interface AccordionPanelPattern extends AccordionPanelInputs {}\n/** Represents an accordion panel. */\nexport class AccordionPanelPattern {\n /** Whether the accordion panel is hidden. True if the associated trigger is not expanded. */\n hidden: SignalLike<boolean>;\n\n constructor(readonly inputs: AccordionPanelInputs) {\n this.id = inputs.id;\n this.value = inputs.value;\n this.accordionTrigger = inputs.accordionTrigger;\n this.hidden = computed(() => inputs.accordionTrigger()?.expanded() === false);\n }\n}\n"],"names":[],"mappings":";;;;AAgCA,MAAM,SAAS,GAAG,MAAM,QAAiB;AAGzC;MACa,qBAAqB,CAAA;AAUX,IAAA,MAAA;;AARrB,IAAA,UAAU;;AAGV,IAAA,YAAY;;AAGZ,IAAA,gBAAgB;AAEhB,IAAA,WAAA,CAAqB,MAA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AAG,MAAM,CAAC,EAAE;AACnB,QAAA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;AACzB,QAAA,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB;AAC/C,QAAA,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,MAAM,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,KAAK,KAAK,CAAC;;AAEhF;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"expansion-C9iQLHOG.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/expansion/expansion.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, WritableSignalLike} from '../signal-like/signal-like';\n\n/** Represents an item that can be expanded or collapsed. */\nexport interface ExpansionItem {\n /** Whether the item is expandable. */\n expandable: SignalLike<boolean>;\n\n /** Used to uniquely identify an expansion item. */\n expansionId: SignalLike<string>;\n\n /** Whether the expansion is disabled. */\n disabled: SignalLike<boolean>;\n}\n\nexport interface ExpansionControl extends ExpansionItem {}\n/**\n * Controls a single item's expansion state and interactions,\n * delegating actual state changes to an Expansion manager.\n */\nexport class ExpansionControl {\n /** Whether this specific item is currently expanded. Derived from the Expansion manager. */\n readonly isExpanded = computed(() => this.inputs.expansionManager.isExpanded(this));\n\n /** Whether this item can be expanded. */\n readonly isExpandable = computed(() => this.inputs.expansionManager.isExpandable(this));\n\n constructor(readonly inputs: ExpansionItem & {expansionManager: ListExpansion}) {\n this.expansionId = inputs.expansionId;\n this.expandable = inputs.expandable;\n this.disabled = inputs.disabled;\n }\n\n /** Requests the Expansopn manager to open this item. */\n open() {\n this.inputs.expansionManager.open(this);\n }\n\n /** Requests the Expansion manager to close this item. */\n close() {\n this.inputs.expansionManager.close(this);\n }\n\n /** Requests the Expansion manager to toggle this item. */\n toggle() {\n this.inputs.expansionManager.toggle(this);\n }\n}\n\n/** Represents the required inputs for an expansion behavior. */\nexport interface ListExpansionInputs {\n /** Whether multiple items can be expanded at once. */\n multiExpandable: SignalLike<boolean>;\n\n /** An array of ids of the currently expanded items. */\n expandedIds: WritableSignalLike<string[]>;\n\n /** An array of expansion items. */\n items: SignalLike<ExpansionItem[]>;\n\n /** Whether all expansions are disabled. */\n disabled: SignalLike<boolean>;\n}\n\n/** Manages the expansion state of a list of items. */\nexport class ListExpansion {\n /** A signal holding an array of ids of the currently expanded items. */\n expandedIds: WritableSignalLike<string[]>;\n\n constructor(readonly inputs: ListExpansionInputs) {\n this.expandedIds = inputs.expandedIds;\n }\n\n /** Opens the specified item. */\n open(item: ExpansionItem) {\n if (!this.isExpandable(item)) return;\n if (this.isExpanded(item)) return;\n if (!this.inputs.multiExpandable()) {\n this.closeAll();\n }\n this.expandedIds.update(ids => ids.concat(item.expansionId()));\n }\n\n /** Closes the specified item. */\n close(item: ExpansionItem) {\n if (this.isExpandable(item)) {\n this.expandedIds.update(ids => ids.filter(id => id !== item.expansionId()));\n }\n }\n\n /** Toggles the expansion state of the specified item. */\n toggle(item: ExpansionItem) {\n this.expandedIds().includes(item.expansionId()) ? this.close(item) : this.open(item);\n }\n\n /** Opens all focusable items in the list. */\n openAll() {\n if (this.inputs.multiExpandable()) {\n for (const item of this.inputs.items()) {\n this.open(item);\n }\n }\n }\n\n /** Closes all focusable items in the list. */\n closeAll() {\n for (const item of this.inputs.items()) {\n this.close(item);\n }\n }\n\n /** Checks whether the specified item is expandable / collapsible. */\n isExpandable(item: ExpansionItem) {\n return !this.inputs.disabled() && !item.disabled() && item.expandable();\n }\n\n /** Checks whether the specified item is currently expanded. */\n isExpanded(item: ExpansionItem): boolean {\n return this.expandedIds().includes(item.expansionId());\n }\n}\n"],"names":[],"mappings":";;AAuBA;;;AAGG;MACU,gBAAgB,CAAA;AAON,IAAA,MAAA;;AALZ,IA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list-focus-Czul8jzR.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/event-manager/event-manager.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/event-manager/keyboard-event-manager.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/event-manager/pointer-event-manager.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/list-navigation/list-navigation.ts","../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/list-focus/list-focus.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","/**\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 /** Navigates to the previous item in the list. */\n prev(): boolean {\n return this._advance(-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 items = this.inputs.items();\n const itemCount = items.length;\n const startIndex = this.inputs.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 this.goto(items[i]);\n }\n }\n\n return false;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {computed, signal} from '@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\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 index of the current active item. */\n activeIndex: WritableSignalLike<number>;\n\n /** Whether disabled items in the list should be skipped when navigating. */\n skipDisabled: SignalLike<boolean>;\n}\n\n/** Controls focus for a list of items. */\nexport class ListFocus<T extends ListFocusItem> {\n /** The last index that was active. */\n prevActiveIndex = signal(0);\n\n /** The current active item. */\n activeItem = computed(() => this.inputs.items()[this.inputs.activeIndex()]);\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.items()[this.inputs.activeIndex()].id();\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.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.prevActiveIndex.set(this.inputs.activeIndex());\n const index = this.inputs.items().indexOf(item);\n this.inputs.activeIndex.set(index);\n\n if (this.inputs.focusMode() === 'roving') {\n item.element().focus();\n }\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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,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE;;AAEzD;;;;"}
@@ -1,136 +0,0 @@
1
- import { signal, computed } from '@angular/core';
2
-
3
- /** Controls selection for a list of items. */
4
- class ListSelection {
5
- inputs;
6
- /** The start index to use for range selection. */
7
- rangeStartIndex = signal(0);
8
- /** The end index to use for range selection. */
9
- rangeEndIndex = signal(0);
10
- /** The currently selected items. */
11
- selectedItems = computed(() => this.inputs.items().filter(item => this.inputs.value().includes(item.value())));
12
- constructor(inputs) {
13
- this.inputs = inputs;
14
- }
15
- /** Selects the item at the current active index. */
16
- select(item, opts = { anchor: true }) {
17
- item = item ?? this.inputs.focusManager.activeItem();
18
- if (item.disabled() || this.inputs.value().includes(item.value())) {
19
- return;
20
- }
21
- if (!this.inputs.multi()) {
22
- this.deselectAll();
23
- }
24
- const index = this.inputs.items().findIndex(i => i === item);
25
- if (opts.anchor) {
26
- this.beginRangeSelection(index);
27
- }
28
- this.inputs.value.update(values => values.concat(item.value()));
29
- }
30
- /** Deselects the item at the current active index. */
31
- deselect(item) {
32
- item = item ?? this.inputs.focusManager.activeItem();
33
- if (!item.disabled()) {
34
- this.inputs.value.update(values => values.filter(value => value !== item.value()));
35
- }
36
- }
37
- /** Toggles the item at the current active index. */
38
- toggle() {
39
- const item = this.inputs.focusManager.activeItem();
40
- this.inputs.value().includes(item.value()) ? this.deselect() : this.select();
41
- }
42
- /** Toggles only the item at the current active index. */
43
- toggleOne() {
44
- const item = this.inputs.focusManager.activeItem();
45
- this.inputs.value().includes(item.value()) ? this.deselect() : this.selectOne();
46
- }
47
- /** Selects all items in the list. */
48
- selectAll() {
49
- if (!this.inputs.multi()) {
50
- return; // Should we log a warning?
51
- }
52
- for (const item of this.inputs.items()) {
53
- this.select(item, { anchor: false });
54
- }
55
- this.beginRangeSelection();
56
- }
57
- /** Deselects all items in the list. */
58
- deselectAll() {
59
- for (const item of this.inputs.items()) {
60
- this.deselect(item);
61
- }
62
- }
63
- /**
64
- * Selects all items in the list or deselects all
65
- * items in the list if all items are already selected.
66
- */
67
- toggleAll() {
68
- const selectableValues = this.inputs
69
- .items()
70
- .filter(i => !i.disabled())
71
- .map(i => i.value());
72
- selectableValues.every(i => this.inputs.value().includes(i))
73
- ? this.deselectAll()
74
- : this.selectAll();
75
- }
76
- /** Sets the selection to only the current active item. */
77
- selectOne() {
78
- if (this.inputs.focusManager.activeItem().disabled()) {
79
- return;
80
- }
81
- this.deselectAll();
82
- if (this.inputs.value().length > 0 && !this.inputs.multi()) {
83
- return;
84
- }
85
- this.select();
86
- }
87
- /**
88
- * Selects all items in the list up to the anchor item.
89
- *
90
- * Deselects all items that were previously within the
91
- * selected range that are now outside of the selected range
92
- */
93
- selectRange(opts = { anchor: true }) {
94
- const isStartOfRange = this.inputs.focusManager.prevActiveIndex() === this.rangeStartIndex();
95
- if (isStartOfRange && opts.anchor) {
96
- this.beginRangeSelection(this.inputs.focusManager.prevActiveIndex());
97
- }
98
- const itemsInRange = this._getItemsFromIndex(this.rangeStartIndex());
99
- const itemsOutOfRange = this._getItemsFromIndex(this.rangeEndIndex()).filter(i => !itemsInRange.includes(i));
100
- for (const item of itemsOutOfRange) {
101
- this.deselect(item);
102
- }
103
- for (const item of itemsInRange) {
104
- this.select(item, { anchor: false });
105
- }
106
- if (itemsInRange.length) {
107
- const item = itemsInRange.pop();
108
- const index = this.inputs.items().findIndex(i => i === item);
109
- this.rangeEndIndex.set(index);
110
- }
111
- }
112
- /** Marks the given index as the start of a range selection. */
113
- beginRangeSelection(index = this.inputs.activeIndex()) {
114
- this.rangeStartIndex.set(index);
115
- this.rangeEndIndex.set(index);
116
- }
117
- /** Returns the items in the list starting from the given index. */
118
- _getItemsFromIndex(index) {
119
- if (index === -1) {
120
- return [];
121
- }
122
- const upper = Math.max(this.inputs.activeIndex(), index);
123
- const lower = Math.min(this.inputs.activeIndex(), index);
124
- const items = [];
125
- for (let i = lower; i <= upper; i++) {
126
- items.push(this.inputs.items()[i]);
127
- }
128
- if (this.inputs.activeIndex() < index) {
129
- return items.reverse();
130
- }
131
- return items;
132
- }
133
- }
134
-
135
- export { ListSelection as L };
136
- //# sourceMappingURL=list-selection-C41ApAbt.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-selection-C41ApAbt.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-46c76129e412/bin/src/cdk-experimental/ui-patterns/behaviors/list-selection/list-selection.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';\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 selected. */\nexport interface ListSelectionItem<V> extends ListFocusItem {\n /** The value of the item. */\n value: SignalLike<V>;\n}\n\n/** Represents the required inputs for a collection that contains selectable items. */\nexport interface ListSelectionInputs<T extends ListSelectionItem<V>, V> extends ListFocusInputs<T> {\n /** Whether multiple items in the list can be selected at once. */\n multi: SignalLike<boolean>;\n\n /** The current value of the list selection. */\n value: WritableSignalLike<V[]>;\n\n /** The selection strategy used by the list. */\n selectionMode: SignalLike<'follow' | 'explicit'>;\n}\n\n/** Controls selection for a list of items. */\nexport class ListSelection<T extends ListSelectionItem<V>, V> {\n /** The start index to use for range selection. */\n rangeStartIndex = signal<number>(0);\n\n /** The end index to use for range selection. */\n rangeEndIndex = signal<number>(0);\n\n /** The currently selected items. */\n selectedItems = computed(() =>\n this.inputs.items().filter(item => this.inputs.value().includes(item.value())),\n );\n\n constructor(readonly inputs: ListSelectionInputs<T, V> & {focusManager: ListFocus<T>}) {}\n\n /** Selects the item at the current active index. */\n select(item?: ListSelectionItem<V>, opts = {anchor: true}) {\n item = item ?? (this.inputs.focusManager.activeItem() as ListSelectionItem<V>);\n\n if (item.disabled() || this.inputs.value().includes(item.value())) {\n return;\n }\n\n if (!this.inputs.multi()) {\n this.deselectAll();\n }\n\n const index = this.inputs.items().findIndex(i => i === item);\n if (opts.anchor) {\n this.beginRangeSelection(index);\n }\n this.inputs.value.update(values => values.concat(item.value()));\n }\n\n /** Deselects the item at the current active index. */\n deselect(item?: T) {\n item = item ?? this.inputs.focusManager.activeItem();\n\n if (!item.disabled()) {\n this.inputs.value.update(values => values.filter(value => value !== item.value()));\n }\n }\n\n /** Toggles the item at the current active index. */\n toggle() {\n const item = this.inputs.focusManager.activeItem();\n this.inputs.value().includes(item.value()) ? this.deselect() : this.select();\n }\n\n /** Toggles only the item at the current active index. */\n toggleOne() {\n const item = this.inputs.focusManager.activeItem();\n this.inputs.value().includes(item.value()) ? this.deselect() : this.selectOne();\n }\n\n /** Selects all items in the list. */\n selectAll() {\n if (!this.inputs.multi()) {\n return; // Should we log a warning?\n }\n\n for (const item of this.inputs.items()) {\n this.select(item, {anchor: false});\n }\n\n this.beginRangeSelection();\n }\n\n /** Deselects all items in the list. */\n deselectAll() {\n for (const item of this.inputs.items()) {\n this.deselect(item);\n }\n }\n\n /**\n * Selects all items in the list or deselects all\n * items in the list if all items are already selected.\n */\n toggleAll() {\n const selectableValues = this.inputs\n .items()\n .filter(i => !i.disabled())\n .map(i => i.value());\n\n selectableValues.every(i => this.inputs.value().includes(i))\n ? this.deselectAll()\n : this.selectAll();\n }\n\n /** Sets the selection to only the current active item. */\n selectOne() {\n if (this.inputs.focusManager.activeItem().disabled()) {\n return;\n }\n\n this.deselectAll();\n\n if (this.inputs.value().length > 0 && !this.inputs.multi()) {\n return;\n }\n\n this.select();\n }\n\n /**\n * Selects all items in the list up to the anchor item.\n *\n * Deselects all items that were previously within the\n * selected range that are now outside of the selected range\n */\n selectRange(opts = {anchor: true}) {\n const isStartOfRange = this.inputs.focusManager.prevActiveIndex() === this.rangeStartIndex();\n\n if (isStartOfRange && opts.anchor) {\n this.beginRangeSelection(this.inputs.focusManager.prevActiveIndex());\n }\n\n const itemsInRange = this._getItemsFromIndex(this.rangeStartIndex());\n const itemsOutOfRange = this._getItemsFromIndex(this.rangeEndIndex()).filter(\n i => !itemsInRange.includes(i),\n );\n\n for (const item of itemsOutOfRange) {\n this.deselect(item);\n }\n\n for (const item of itemsInRange) {\n this.select(item, {anchor: false});\n }\n\n if (itemsInRange.length) {\n const item = itemsInRange.pop();\n const index = this.inputs.items().findIndex(i => i === item);\n this.rangeEndIndex.set(index);\n }\n }\n\n /** Marks the given index as the start of a range selection. */\n beginRangeSelection(index: number = this.inputs.activeIndex()) {\n this.rangeStartIndex.set(index);\n this.rangeEndIndex.set(index);\n }\n\n /** Returns the items in the list starting from the given index. */\n private _getItemsFromIndex(index: number) {\n if (index === -1) {\n return [];\n }\n\n const upper = Math.max(this.inputs.activeIndex(), index);\n const lower = Math.min(this.inputs.activeIndex(), index);\n\n const items = [];\n for (let i = lower; i <= upper; i++) {\n items.push(this.inputs.items()[i]);\n }\n\n if (this.inputs.activeIndex() < index) {\n return items.reverse();\n }\n\n return items;\n }\n}\n"],"names":[],"mappings":";;AA8BA;MACa,aAAa,CAAA;AAYH,IAAA,MAAA;;AAVrB,IAAA,eAAe,GAAG,MAAM,CAAS,CAAC,CAAC;;AAGnC,IAAA,aAAa,GAAG,MAAM,CAAS,CAAC,CAAC;;AAGjC,IAAA,aAAa,GAAG,QAAQ,CAAC,MACvB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAC/E;AAED,IAAA,WAAA,CAAqB,MAAgE,EAAA;QAAhE,IAAM,CAAA,MAAA,GAAN,MAAM;;;IAG3B,MAAM,CAAC,IAA2B,EAAE,IAAI,GAAG,EAAC,MAAM,EAAE,IAAI,EAAC,EAAA;QACvD,IAAI,GAAG,IAAI,IAAK,IAAI,CAAC,MAAM,CAAC,YAAY,CA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