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

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 (70) hide show
  1. package/fesm2022/_accordion-chunk.mjs.map +1 -1
  2. package/fesm2022/_click-event-manager-chunk.mjs.map +1 -1
  3. package/fesm2022/_combobox-chunk.mjs +51 -2
  4. package/fesm2022/_combobox-chunk.mjs.map +1 -1
  5. package/fesm2022/_combobox-listbox-chunk.mjs +3 -0
  6. package/fesm2022/_combobox-listbox-chunk.mjs.map +1 -1
  7. package/fesm2022/_combobox-tree-chunk.mjs.map +1 -1
  8. package/fesm2022/_deferred-content-chunk.mjs +16 -14
  9. package/fesm2022/_deferred-content-chunk.mjs.map +1 -1
  10. package/fesm2022/_element-chunk.mjs.map +1 -1
  11. package/fesm2022/_expansion-chunk.mjs.map +1 -1
  12. package/fesm2022/_list-chunk.mjs.map +1 -1
  13. package/fesm2022/_list-navigation-chunk.mjs +3 -1
  14. package/fesm2022/_list-navigation-chunk.mjs.map +1 -1
  15. package/fesm2022/_list-typeahead-chunk.mjs.map +1 -1
  16. package/fesm2022/_menu-chunk.mjs.map +1 -1
  17. package/fesm2022/_signal-like-chunk.mjs +0 -1
  18. package/fesm2022/_signal-like-chunk.mjs.map +1 -1
  19. package/fesm2022/_tabs-chunk.mjs +22 -47
  20. package/fesm2022/_tabs-chunk.mjs.map +1 -1
  21. package/fesm2022/_toolbar-widget-group-chunk.mjs.map +1 -1
  22. package/fesm2022/_widget-chunk.mjs +55 -13
  23. package/fesm2022/_widget-chunk.mjs.map +1 -1
  24. package/fesm2022/accordion-testing.mjs.map +1 -1
  25. package/fesm2022/accordion.mjs +16 -14
  26. package/fesm2022/accordion.mjs.map +1 -1
  27. package/fesm2022/aria.mjs +1 -1
  28. package/fesm2022/aria.mjs.map +1 -1
  29. package/fesm2022/combobox.mjs +59 -34
  30. package/fesm2022/combobox.mjs.map +1 -1
  31. package/fesm2022/grid-testing.mjs +72 -0
  32. package/fesm2022/grid-testing.mjs.map +1 -0
  33. package/fesm2022/grid.mjs +83 -37
  34. package/fesm2022/grid.mjs.map +1 -1
  35. package/fesm2022/listbox-testing.mjs.map +1 -1
  36. package/fesm2022/listbox.mjs +58 -31
  37. package/fesm2022/listbox.mjs.map +1 -1
  38. package/fesm2022/menu-testing.mjs.map +1 -1
  39. package/fesm2022/menu.mjs +41 -35
  40. package/fesm2022/menu.mjs.map +1 -1
  41. package/fesm2022/private.mjs +156 -5
  42. package/fesm2022/private.mjs.map +1 -1
  43. package/fesm2022/simple-combobox.mjs +443 -0
  44. package/fesm2022/simple-combobox.mjs.map +1 -0
  45. package/fesm2022/tabs-testing.mjs.map +1 -1
  46. package/fesm2022/tabs.mjs +243 -218
  47. package/fesm2022/tabs.mjs.map +1 -1
  48. package/fesm2022/toolbar-testing.mjs.map +1 -1
  49. package/fesm2022/toolbar.mjs +11 -11
  50. package/fesm2022/toolbar.mjs.map +1 -1
  51. package/fesm2022/tree-testing.mjs.map +1 -1
  52. package/fesm2022/tree.mjs +65 -33
  53. package/fesm2022/tree.mjs.map +1 -1
  54. package/package.json +10 -2
  55. package/types/_combobox-chunk.d.ts +32 -2
  56. package/types/_grid-chunk.d.ts +16 -8
  57. package/types/_tabs-chunk.d.ts +7 -42
  58. package/types/combobox.d.ts +4 -3
  59. package/types/grid-testing.d.ts +79 -0
  60. package/types/grid.d.ts +14 -6
  61. package/types/listbox.d.ts +8 -6
  62. package/types/menu.d.ts +7 -4
  63. package/types/private.d.ts +106 -10
  64. package/types/simple-combobox.d.ts +124 -0
  65. package/types/tabs.d.ts +79 -74
  66. package/types/tree.d.ts +5 -2
  67. package/fesm2022/_pointer-event-manager-chunk.mjs +0 -54
  68. package/fesm2022/_pointer-event-manager-chunk.mjs.map +0 -1
  69. package/resources/code-examples.db +0 -0
  70. package/types/_pointer-event-manager-chunk.d.ts +0 -34
package/types/tabs.d.ts CHANGED
@@ -1,15 +1,60 @@
1
- import * as _angular_core from '@angular/core';
2
- import { OnInit, OnDestroy } from '@angular/core';
3
1
  import * as _angular_cdk_bidi from '@angular/cdk/bidi';
4
- import { TabPattern, TabListPattern, TabPanelPattern } from './_tabs-chunk.js';
5
- import { HasElement } from './_element-chunk.js';
2
+ import * as _angular_core from '@angular/core';
3
+ import { OnInit, OnDestroy, WritableSignal } from '@angular/core';
4
+ import { TabPattern, TabPanelPattern, TabListPattern } from './_tabs-chunk.js';
6
5
  import { DeferredContentAware, DeferredContent } from './_deferred-content-chunk.js';
6
+ import { HasElement } from './_element-chunk.js';
7
7
  import './_keyboard-event-manager-chunk.js';
8
8
  import './_signal-like-chunk.js';
9
9
  import './_click-event-manager-chunk.js';
10
10
  import './_expansion-chunk.js';
11
11
  import './_list-navigation-chunk.js';
12
12
 
13
+ /**
14
+ * A TabPanel container for the resources of layered content associated with a tab.
15
+ *
16
+ * The `ngTabPanel` directive holds the content for a specific tab. It is linked to an
17
+ * `ngTab` by a matching `value`. If a tab panel is hidden, the `inert` attribute will be
18
+ * applied to remove it from the accessibility tree. Proper styling is required for visual hiding.
19
+ *
20
+ * ```html
21
+ * <div ngTabPanel value="myTabId">
22
+ * <ng-template ngTabContent>
23
+ * <!-- Content for the tab panel -->
24
+ * </ng-template>
25
+ * </div>
26
+ * ```
27
+ *
28
+ * @developerPreview 21.0
29
+ *
30
+ * @see [Tabs](guide/aria/tabs)
31
+ */
32
+ declare class TabPanel implements OnInit, OnDestroy {
33
+ /** A reference to the host element. */
34
+ private readonly _elementRef;
35
+ /** A reference to the host element. */
36
+ readonly element: HTMLElement;
37
+ /** The DeferredContentAware host directive. */
38
+ private readonly _deferredContentAware;
39
+ /** The parent Tabs. */
40
+ private readonly _tabs;
41
+ /** A global unique identifier for the tab. */
42
+ readonly id: _angular_core.InputSignal<string>;
43
+ /** The Tab UIPattern associated with the tabpanel */
44
+ readonly _tabPattern: WritableSignal<TabPattern | undefined>;
45
+ /** A local unique identifier for the tabpanel. */
46
+ readonly value: _angular_core.InputSignal<string>;
47
+ /** Whether the tab panel is visible. */
48
+ readonly visible: _angular_core.Signal<boolean>;
49
+ /** The TabPanel UIPattern. */
50
+ readonly _pattern: TabPanelPattern;
51
+ constructor();
52
+ ngOnInit(): void;
53
+ ngOnDestroy(): void;
54
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TabPanel, never>;
55
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TabPanel, "[ngTabPanel]", ["ngTabPanel"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": true; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
56
+ }
57
+
13
58
  /**
14
59
  * A selectable tab in a TabList.
15
60
  *
@@ -31,16 +76,14 @@ declare class Tab implements HasElement, OnInit, OnDestroy {
31
76
  private readonly _elementRef;
32
77
  /** A reference to the host element. */
33
78
  readonly element: HTMLElement;
34
- /** The parent Tabs. */
35
- private readonly _tabs;
79
+ /** The parent Tabs wrapper. */
80
+ private readonly _tabsWrapper;
36
81
  /** The parent TabList. */
37
82
  private readonly _tabList;
38
83
  /** A unique identifier for the widget. */
39
84
  readonly id: _angular_core.InputSignal<string>;
40
- /** The parent TabList UIPattern. */
41
- private readonly _tablistPattern;
42
- /** The TabPanel UIPattern associated with the tab */
43
- private readonly _tabpanelPattern;
85
+ /** The panel associated with this tab. */
86
+ readonly panel: _angular_core.Signal<TabPanel | undefined>;
44
87
  /** Whether a tab is disabled. */
45
88
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
46
89
  /** The remote tabpanel unique identifier. */
@@ -82,16 +125,18 @@ declare class TabList implements OnInit, OnDestroy {
82
125
  private readonly _elementRef;
83
126
  /** A reference to the host element. */
84
127
  readonly element: HTMLElement;
85
- /** The parent Tabs. */
128
+ /** The parent Tabs container. */
129
+ private readonly _tabsParent;
130
+ /** The Tabs registered for this TabList. */
86
131
  private readonly _tabs;
87
- /** The Tabs nested inside of the TabList. */
88
- private readonly _unorderedTabs;
89
- /** Text direction. */
90
- readonly textDirection: _angular_core.WritableSignal<_angular_cdk_bidi.Direction>;
132
+ /** The Tabs registered for this TabList. */
133
+ readonly _sortedTabs: _angular_core.Signal<Tab[]>;
91
134
  /** The Tab UIPatterns of the child Tabs. */
92
- readonly _tabPatterns: _angular_core.Signal<TabPattern[]>;
135
+ private readonly _tabPatterns;
93
136
  /** Whether the tablist is vertically or horizontally oriented. */
94
137
  readonly orientation: _angular_core.InputSignal<"vertical" | "horizontal">;
138
+ /** Text direction. */
139
+ readonly textDirection: WritableSignal<_angular_cdk_bidi.Direction>;
95
140
  /** Whether focus should wrap when navigating. */
96
141
  readonly wrap: _angular_core.InputSignalWithTransform<boolean, unknown>;
97
142
  /**
@@ -111,8 +156,10 @@ declare class TabList implements OnInit, OnDestroy {
111
156
  * - `explicit`: Tabs are selected explicitly by the user (e.g., via click or spacebar).
112
157
  */
113
158
  readonly selectionMode: _angular_core.InputSignal<"follow" | "explicit">;
114
- /** The current selected tab. */
159
+ /** The current selected tab as a model input. */
115
160
  readonly selectedTab: _angular_core.ModelSignal<string | undefined>;
161
+ /** The current selected Tab pattern, passed to the List pattern. */
162
+ private readonly _selectedTabPattern;
116
163
  /** Whether the tablist is disabled. */
117
164
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
118
165
  /** The TabList UIPattern. */
@@ -120,59 +167,15 @@ declare class TabList implements OnInit, OnDestroy {
120
167
  constructor();
121
168
  ngOnInit(): void;
122
169
  ngOnDestroy(): void;
123
- _register(child: Tab): void;
124
- _unregister(child: Tab): void;
170
+ _registerTab(child: Tab): void;
171
+ _unregisterTab(child: Tab): void;
125
172
  /** Opens the tab panel with the specified value. */
126
173
  open(value: string): boolean;
174
+ findTab(value?: string): Tab | undefined;
127
175
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TabList, never>;
128
176
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TabList, "[ngTabList]", ["ngTabList"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; "softDisabled": { "alias": "softDisabled"; "required": false; "isSignal": true; }; "focusMode": { "alias": "focusMode"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; "selectedTab": { "alias": "selectedTab"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "selectedTab": "selectedTabChange"; }, never, never, true, never>;
129
177
  }
130
178
 
131
- /**
132
- * A TabPanel container for the resources of layered content associated with a tab.
133
- *
134
- * The `ngTabPanel` directive holds the content for a specific tab. It is linked to an
135
- * `ngTab` by a matching `value`. If a tab panel is hidden, the `inert` attribute will be
136
- * applied to remove it from the accessibility tree. Proper styling is required for visual hiding.
137
- *
138
- * ```html
139
- * <div ngTabPanel value="myTabId">
140
- * <ng-template ngTabContent>
141
- * <!-- Content for the tab panel -->
142
- * </ng-template>
143
- * </div>
144
- * ```
145
- *
146
- * @developerPreview 21.0
147
- *
148
- * @see [Tabs](guide/aria/tabs)
149
- */
150
- declare class TabPanel implements OnInit, OnDestroy {
151
- /** A reference to the host element. */
152
- private readonly _elementRef;
153
- /** A reference to the host element. */
154
- readonly element: HTMLElement;
155
- /** The DeferredContentAware host directive. */
156
- private readonly _deferredContentAware;
157
- /** The parent Tabs. */
158
- private readonly _tabs;
159
- /** A global unique identifier for the tab. */
160
- readonly id: _angular_core.InputSignal<string>;
161
- /** The Tab UIPattern associated with the tabpanel */
162
- private readonly _tabPattern;
163
- /** A local unique identifier for the tabpanel. */
164
- readonly value: _angular_core.InputSignal<string>;
165
- /** Whether the tab panel is visible. */
166
- readonly visible: _angular_core.Signal<boolean>;
167
- /** The TabPanel UIPattern. */
168
- readonly _pattern: TabPanelPattern;
169
- constructor();
170
- ngOnInit(): void;
171
- ngOnDestroy(): void;
172
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<TabPanel, never>;
173
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TabPanel, "[ngTabPanel]", ["ngTabPanel"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": true; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
174
- }
175
-
176
179
  /**
177
180
  * A Tabs container.
178
181
  *
@@ -209,16 +212,18 @@ declare class Tabs {
209
212
  private readonly _elementRef;
210
213
  /** A reference to the host element. */
211
214
  readonly element: HTMLElement;
212
- /** The TabList nested inside of the container. */
213
- private readonly _tablist;
214
- /** The TabPanels nested inside of the container. */
215
- private readonly _unorderedPanels;
216
- /** The Tab UIPattern of the child Tabs. */
217
- readonly _tabPatterns: _angular_core.Signal<TabPattern[] | undefined>;
218
- /** The TabPanel UIPattern of the child TabPanels. */
219
- readonly _unorderedTabpanelPatterns: _angular_core.Signal<TabPanelPattern[]>;
220
- _register(child: TabList | TabPanel): void;
221
- _unregister(child: TabList | TabPanel): void;
215
+ /** The TabList registered for this container. */
216
+ private readonly _tabList;
217
+ /** The TabPanels registered for this container. */
218
+ private readonly _tabPanels;
219
+ /** The TabPanels registered for this container. */
220
+ private readonly _tabPanelsList;
221
+ constructor();
222
+ _registerList(list: TabList): void;
223
+ _unregisterList(list: TabList): void;
224
+ _registerPanel(panel: TabPanel): void;
225
+ _unregisterPanel(panel: TabPanel): void;
226
+ findTabPanel(value?: string): TabPanel | undefined;
222
227
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<Tabs, never>;
223
228
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Tabs, "[ngTabs]", ["ngTabs"], {}, {}, never, never, true, never>;
224
229
  }
package/types/tree.d.ts CHANGED
@@ -13,7 +13,6 @@ import './_list-chunk.js';
13
13
  import './_keyboard-event-manager-chunk.js';
14
14
  import './_click-event-manager-chunk.js';
15
15
  import './_combobox-chunk.js';
16
- import './_pointer-event-manager-chunk.js';
17
16
 
18
17
  /**
19
18
  * Group that contains children tree items.
@@ -193,6 +192,8 @@ declare class Tree<V> {
193
192
  readonly softDisabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
194
193
  /** The delay in seconds before the typeahead search is reset. */
195
194
  readonly typeaheadDelay: _angular_core.InputSignal<number>;
195
+ /** The tabindex of the tree. */
196
+ readonly tabIndex: _angular_core.InputSignalWithTransform<number | undefined, string | number | undefined>;
196
197
  /** The values of the currently selected items. */
197
198
  readonly value: _angular_core.ModelSignal<V[]>;
198
199
  /** Text direction. */
@@ -206,12 +207,14 @@ declare class Tree<V> {
206
207
  readonly currentType: _angular_core.InputSignal<"page" | "step" | "location" | "date" | "time" | "true" | "false">;
207
208
  /** The UI pattern for the tree. */
208
209
  readonly _pattern: TreePattern<V>;
210
+ /** The ID of the active descendant in the tree. */
211
+ readonly activeDescendant: Signal<string | undefined>;
209
212
  constructor();
210
213
  _register(child: TreeItem<V>): void;
211
214
  _unregister(child: TreeItem<V>): void;
212
215
  scrollActiveItemIntoView(options?: ScrollIntoViewOptions): void;
213
216
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<Tree<any>, never>;
214
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Tree<any>, "[ngTree]", ["ngTree"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "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; }; "softDisabled": { "alias": "softDisabled"; "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, [{ directive: typeof ComboboxPopup; inputs: {}; outputs: {}; }]>;
217
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Tree<any>, "[ngTree]", ["ngTree"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "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; }; "softDisabled": { "alias": "softDisabled"; "required": false; "isSignal": true; }; "typeaheadDelay": { "alias": "typeaheadDelay"; "required": false; "isSignal": true; }; "tabIndex": { "alias": "tabIndex"; "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, [{ directive: typeof ComboboxPopup; inputs: {}; outputs: {}; }]>;
215
218
  }
216
219
 
217
220
  export { Tree, TreeItem, TreeItemGroup, ComboboxPopup as ɵɵComboboxPopup, DeferredContent as ɵɵDeferredContent };
@@ -1,54 +0,0 @@
1
- import { EventManager, Modifier, hasModifiers } from './_signal-like-chunk.mjs';
2
-
3
- var MouseButton;
4
- (function (MouseButton) {
5
- MouseButton[MouseButton["Main"] = 0] = "Main";
6
- MouseButton[MouseButton["Auxiliary"] = 1] = "Auxiliary";
7
- MouseButton[MouseButton["Secondary"] = 2] = "Secondary";
8
- })(MouseButton || (MouseButton = {}));
9
- class PointerEventManager extends EventManager {
10
- options = {
11
- preventDefault: false,
12
- stopPropagation: false
13
- };
14
- on(...args) {
15
- const {
16
- button,
17
- handler,
18
- modifiers
19
- } = this._normalizeInputs(...args);
20
- this.configs.push({
21
- handler,
22
- matcher: event => this._isMatch(event, button, modifiers),
23
- ...this.options
24
- });
25
- return this;
26
- }
27
- _normalizeInputs(...args) {
28
- if (args.length === 3) {
29
- return {
30
- button: args[0],
31
- modifiers: args[1],
32
- handler: args[2]
33
- };
34
- }
35
- if (args.length === 2) {
36
- return {
37
- button: MouseButton.Main,
38
- modifiers: args[0],
39
- handler: args[1]
40
- };
41
- }
42
- return {
43
- button: MouseButton.Main,
44
- modifiers: Modifier.None,
45
- handler: args[0]
46
- };
47
- }
48
- _isMatch(event, button, modifiers) {
49
- return button === (event.button ?? 0) && hasModifiers(event, modifiers);
50
- }
51
- }
52
-
53
- export { PointerEventManager };
54
- //# sourceMappingURL=_pointer-event-manager-chunk.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_pointer-event-manager-chunk.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/src/aria/private/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\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 readonly 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 (args.length === 2) {\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":["MouseButton","PointerEventManager","EventManager","options","preventDefault","stopPropagation","on","args","button","handler","modifiers","_normalizeInputs","configs","push","matcher","event","_isMatch","length","Main","Modifier","None","hasModifiers"],"mappings":";;AAoBA,IAAYA,WAIX;AAJD,CAAA,UAAYA,WAAW,EAAA;EACrBA,WAAA,CAAAA,WAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ;EACRA,WAAA,CAAAA,WAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAa;EACbA,WAAA,CAAAA,WAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAa;AACf,CAAC,EAJWA,WAAW,KAAXA,WAAW,GAAA,EAAA,CAAA,CAAA;AAOjB,MAAOC,mBAA4C,SAAQC,YAAe,CAAA;AACrEC,EAAAA,OAAO,GAAwB;AACtCC,IAAAA,cAAc,EAAE,KAAK;AACrBC,IAAAA,eAAe,EAAE;GAClB;EAqBDC,EAAEA,CAAC,GAAGC,IAAW,EAAA;IACf,MAAM;MAACC,MAAM;MAAEC,OAAO;AAAEC,MAAAA;AAAS,KAAC,GAAG,IAAI,CAACC,gBAAgB,CAAC,GAAGJ,IAAI,CAAC;AAEnE,IAAA,IAAI,CAACK,OAAO,CAACC,IAAI,CAAC;MAChBJ,OAAO;AACPK,MAAAA,OAAO,EAAEC,KAAK,IAAI,IAAI,CAACC,QAAQ,CAACD,KAAK,EAAEP,MAAM,EAAEE,SAAS,CAAC;AACzD,MAAA,GAAG,IAAI,CAACP;AACT,KAAA,CAAC;AACF,IAAA,OAAO,IAAI;AACb,EAAA;EAEQQ,gBAAgBA,CAAC,GAAGJ,IAAW,EAAA;AACrC,IAAA,IAAIA,IAAI,CAACU,MAAM,KAAK,CAAC,EAAE;MACrB,OAAO;AACLT,QAAAA,MAAM,EAAED,IAAI,CAAC,CAAC,CAAgB;AAC9BG,QAAAA,SAAS,EAAEH,IAAI,CAAC,CAAC,CAAmB;QACpCE,OAAO,EAAEF,IAAI,CAAC,CAAC;OAChB;AACH,IAAA;AAEA,IAAA,IAAIA,IAAI,CAACU,MAAM,KAAK,CAAC,EAAE;MACrB,OAAO;QACLT,MAAM,EAAER,WAAW,CAACkB,IAAI;AACxBR,QAAAA,SAAS,EAAEH,IAAI,CAAC,CAAC,CAAmB;QACpCE,OAAO,EAAEF,IAAI,CAAC,CAAC;OAChB;AACH,IAAA;IAEA,OAAO;MACLC,MAAM,EAAER,WAAW,CAACkB,IAAI;MACxBR,SAAS,EAAES,QAAQ,CAACC,IAAI;MACxBX,OAAO,EAAEF,IAAI,CAAC,CAAC;KAChB;AACH,EAAA;AAEAS,EAAAA,QAAQA,CAACD,KAAmB,EAAEP,MAAmB,EAAEE,SAAyB,EAAA;AAC1E,IAAA,OAAOF,MAAM,MAAMO,KAAK,CAACP,MAAM,IAAI,CAAC,CAAC,IAAIa,YAAY,CAACN,KAAK,EAAEL,SAAS,CAAC;AACzE,EAAA;AACD;;;;"}
Binary file
@@ -1,34 +0,0 @@
1
- import { EventManager, EventHandlerOptions, ModifierInputs, EventHandler } from './_keyboard-event-manager-chunk.js';
2
-
3
- /**
4
- * The different mouse buttons that may appear on a pointer event.
5
- */
6
- declare enum MouseButton {
7
- Main = 0,
8
- Auxiliary = 1,
9
- Secondary = 2
10
- }
11
- /** An event manager that is specialized for handling pointer events. */
12
- declare class PointerEventManager<T extends PointerEvent> extends EventManager<T> {
13
- readonly options: EventHandlerOptions;
14
- /**
15
- * Configures this event manager to handle events with a specific modifer and mouse button
16
- * combination.
17
- */
18
- on(button: MouseButton, modifiers: ModifierInputs, handler: EventHandler<T>): this;
19
- /**
20
- * Configures this event manager to handle events with a specific mouse button and no modifiers.
21
- */
22
- on(modifiers: ModifierInputs, handler: EventHandler<T>): this;
23
- /**
24
- * Configures this event manager to handle events with the main mouse button and no modifiers.
25
- *
26
- * @param handler The handler function
27
- * @param options Options for whether to stop propagation or prevent default.
28
- */
29
- on(handler: EventHandler<T>): this;
30
- private _normalizeInputs;
31
- _isMatch(event: PointerEvent, button: MouseButton, modifiers: ModifierInputs): boolean;
32
- }
33
-
34
- export { PointerEventManager };