@angular/aria 21.1.0-next.2 → 21.1.0-next.3

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 (76) hide show
  1. package/fesm2022/_accordion-chunk.mjs +108 -0
  2. package/fesm2022/_accordion-chunk.mjs.map +1 -0
  3. package/fesm2022/_combobox-chunk.mjs +2 -2
  4. package/fesm2022/_combobox-chunk.mjs.map +1 -1
  5. package/fesm2022/_combobox-listbox-chunk.mjs +4 -286
  6. package/fesm2022/_combobox-listbox-chunk.mjs.map +1 -1
  7. package/fesm2022/_combobox-tree-chunk.mjs +331 -0
  8. package/fesm2022/_combobox-tree-chunk.mjs.map +1 -0
  9. package/fesm2022/_deferred-content-chunk.mjs +124 -0
  10. package/fesm2022/_deferred-content-chunk.mjs.map +1 -0
  11. package/fesm2022/_expansion-chunk.mjs +41 -0
  12. package/fesm2022/_expansion-chunk.mjs.map +1 -0
  13. package/fesm2022/_list-chunk.mjs +287 -0
  14. package/fesm2022/_list-chunk.mjs.map +1 -0
  15. package/fesm2022/_list-navigation-chunk.mjs +1 -1
  16. package/fesm2022/_list-navigation-chunk.mjs.map +1 -1
  17. package/fesm2022/_menu-chunk.mjs +515 -0
  18. package/fesm2022/_menu-chunk.mjs.map +1 -0
  19. package/fesm2022/_pointer-event-manager-chunk.mjs +2 -82
  20. package/fesm2022/_pointer-event-manager-chunk.mjs.map +1 -1
  21. package/fesm2022/_signal-like-chunk.mjs +118 -0
  22. package/fesm2022/_signal-like-chunk.mjs.map +1 -0
  23. package/fesm2022/_tabs-chunk.mjs +159 -0
  24. package/fesm2022/_tabs-chunk.mjs.map +1 -0
  25. package/fesm2022/_toolbar-widget-group-chunk.mjs +148 -0
  26. package/fesm2022/_toolbar-widget-group-chunk.mjs.map +1 -0
  27. package/fesm2022/_widget-chunk.mjs +3 -2
  28. package/fesm2022/_widget-chunk.mjs.map +1 -1
  29. package/fesm2022/accordion.mjs +10 -5
  30. package/fesm2022/accordion.mjs.map +1 -1
  31. package/fesm2022/aria.mjs +1 -1
  32. package/fesm2022/aria.mjs.map +1 -1
  33. package/fesm2022/combobox.mjs +50 -13
  34. package/fesm2022/combobox.mjs.map +1 -1
  35. package/fesm2022/grid.mjs +3 -1
  36. package/fesm2022/grid.mjs.map +1 -1
  37. package/fesm2022/listbox.mjs +9 -7
  38. package/fesm2022/listbox.mjs.map +1 -1
  39. package/fesm2022/menu.mjs +9 -5
  40. package/fesm2022/menu.mjs.map +1 -1
  41. package/fesm2022/private.mjs +13 -1402
  42. package/fesm2022/private.mjs.map +1 -1
  43. package/fesm2022/tabs.mjs +14 -6
  44. package/fesm2022/tabs.mjs.map +1 -1
  45. package/fesm2022/toolbar.mjs +5 -1
  46. package/fesm2022/toolbar.mjs.map +1 -1
  47. package/fesm2022/tree.mjs +13 -5
  48. package/fesm2022/tree.mjs.map +1 -1
  49. package/package.json +2 -2
  50. package/types/_accordion-chunk.d.ts +100 -0
  51. package/types/_combobox-chunk.d.ts +187 -91
  52. package/types/_deferred-content-chunk.d.ts +42 -0
  53. package/types/_expansion-chunk.d.ts +40 -0
  54. package/types/_grid-chunk.d.ts +41 -41
  55. package/types/_keyboard-event-manager-chunk.d.ts +68 -0
  56. package/types/_list-chunk.d.ts +8 -9
  57. package/types/_list-navigation-chunk.d.ts +8 -101
  58. package/types/_listbox-chunk.d.ts +17 -16
  59. package/types/_menu-chunk.d.ts +267 -0
  60. package/types/_pointer-event-manager-chunk.d.ts +34 -0
  61. package/types/_tabs-chunk.d.ts +153 -0
  62. package/types/_toolbar-chunk.d.ts +124 -0
  63. package/types/_tree-chunk.d.ts +185 -0
  64. package/types/accordion.d.ts +13 -5
  65. package/types/aria.d.ts +1 -1
  66. package/types/combobox.d.ts +122 -6
  67. package/types/grid.d.ts +10 -0
  68. package/types/listbox.d.ts +17 -5
  69. package/types/menu.d.ts +23 -5
  70. package/types/private.d.ts +25 -885
  71. package/types/tabs.d.ts +24 -8
  72. package/types/toolbar.d.ts +12 -4
  73. package/types/tree.d.ts +16 -5
  74. package/fesm2022/_combobox-popup-chunk.mjs +0 -46
  75. package/fesm2022/_combobox-popup-chunk.mjs.map +0 -1
  76. package/types/_combobox-chunk.d2.ts +0 -193
@@ -1,4 +1,3 @@
1
- import * as _angular_core from '@angular/core';
2
1
  import { ListFocusItem, SignalLike, ListFocusInputs, WritableSignalLike, ListFocus, ListNavigationItem, ListNavigationInputs, ListNavigation } from './_list-navigation-chunk.js';
3
2
 
4
3
  /** Represents an item in a collection, such as a listbox option, that can be selected. */
@@ -23,11 +22,11 @@ declare class ListSelection<T extends ListSelectionItem<V>, V> {
23
22
  focusManager: ListFocus<T>;
24
23
  };
25
24
  /** The start index to use for range selection. */
26
- rangeStartIndex: _angular_core.WritableSignal<number>;
25
+ rangeStartIndex: WritableSignalLike<number>;
27
26
  /** The end index to use for range selection. */
28
- rangeEndIndex: _angular_core.WritableSignal<number>;
27
+ rangeEndIndex: WritableSignalLike<number>;
29
28
  /** The currently selected items. */
30
- selectedItems: _angular_core.Signal<T[]>;
29
+ selectedItems: SignalLike<T[]>;
31
30
  constructor(inputs: ListSelectionInputs<T, V> & {
32
31
  focusManager: ListFocus<T>;
33
32
  });
@@ -93,7 +92,7 @@ declare class ListTypeahead<T extends ListTypeaheadItem> {
93
92
  /** The focus controller of the parent list. */
94
93
  focusManager: ListFocus<T>;
95
94
  /** Whether the user is actively typing a typeahead search query. */
96
- isTyping: _angular_core.Signal<boolean>;
95
+ isTyping: SignalLike<boolean>;
97
96
  /** Keeps track of the characters that typeahead search is being called with. */
98
97
  private _query;
99
98
  /** The index where that the typeahead search was initiated from. */
@@ -135,13 +134,13 @@ declare class List<T extends ListItem<V>, V> {
135
134
  /** Controls focus for the list. */
136
135
  focusBehavior: ListFocus<T>;
137
136
  /** Whether the list is disabled. */
138
- disabled: _angular_core.Signal<boolean>;
137
+ disabled: SignalLike<boolean>;
139
138
  /** The id of the current active item. */
140
- activeDescendant: _angular_core.Signal<string | undefined>;
139
+ activeDescendant: SignalLike<string | undefined>;
141
140
  /** The tab index of the list. */
142
- tabIndex: _angular_core.Signal<0 | -1>;
141
+ tabIndex: SignalLike<0 | -1>;
143
142
  /** The index of the currently active item in the list. */
144
- activeIndex: _angular_core.Signal<number>;
143
+ activeIndex: SignalLike<number>;
145
144
  /**
146
145
  * The uncommitted index for selecting a range of options.
147
146
  *
@@ -1,107 +1,14 @@
1
- import * as _angular_core from '@angular/core';
2
-
3
- /**
4
- * Options that are applicable to all event handlers.
5
- *
6
- * This library has not yet had a need for stopPropagationImmediate.
7
- */
8
- interface EventHandlerOptions {
9
- stopPropagation: boolean;
10
- preventDefault: boolean;
11
- }
12
- /** A basic event handler. */
13
- type EventHandler<T extends Event> = (event: T) => void;
14
- /** A function that determines whether an event is to be handled. */
15
- type EventMatcher<T extends Event> = (event: T) => boolean;
16
- /** A config that specifies how to handle a particular event. */
17
- interface EventHandlerConfig<T extends Event> extends EventHandlerOptions {
18
- matcher: EventMatcher<T>;
19
- handler: EventHandler<T>;
20
- }
21
- /** Bit flag representation of the possible modifier keys that can be present on an event. */
22
- declare enum Modifier {
23
- None = 0,
24
- Ctrl = 1,
25
- Shift = 2,
26
- Alt = 4,
27
- Meta = 8,
28
- Any = "Any"
29
- }
30
- type ModifierInputs = Modifier | Modifier[];
31
- /**
32
- * Abstract base class for all event managers.
33
- *
34
- * Event managers are designed to normalize how event handlers are authored and create a safety net
35
- * for common event handling gotchas like remembering to call preventDefault or stopPropagation.
36
- */
37
- declare abstract class EventManager<T extends Event> {
38
- protected configs: EventHandlerConfig<T>[];
39
- abstract options: EventHandlerOptions;
40
- /** Runs the handlers that match with the given event. */
41
- handle(event: T): void;
42
- /** Configures the event manager to handle specific events. (See subclasses for more). */
43
- abstract on(...args: [...unknown[]]): this;
44
- }
45
-
46
1
  type SignalLike<T> = () => T;
47
2
  interface WritableSignalLike<T> extends SignalLike<T> {
48
3
  set(value: T): void;
49
4
  update(updateFn: (value: T) => T): void;
5
+ asReadonly(): SignalLike<T>;
50
6
  }
51
7
  /** Converts a getter setter style signal to a WritableSignalLike. */
52
8
  declare function convertGetterSetterToWritableSignalLike<T>(getter: () => T, setter: (v: T) => void): WritableSignalLike<T>;
53
-
54
- /**
55
- * Used to represent a keycode.
56
- *
57
- * This is used to match whether an events keycode should be handled. The ability to match using a
58
- * string, SignalLike, or Regexp gives us more flexibility when authoring event handlers.
59
- */
60
- type KeyCode = string | SignalLike<string> | RegExp;
61
- /**
62
- * An event manager that is specialized for handling keyboard events. By default this manager stops
63
- * propagation and prevents default on all events it handles.
64
- */
65
- declare class KeyboardEventManager<T extends KeyboardEvent> extends EventManager<T> {
66
- options: EventHandlerOptions;
67
- /** Configures this event manager to handle events with a specific key and no modifiers. */
68
- on(key: KeyCode, handler: EventHandler<T>, options?: Partial<EventHandlerOptions>): this;
69
- /** Configures this event manager to handle events with a specific modifer and key combination. */
70
- on(modifiers: ModifierInputs, key: KeyCode, handler: EventHandler<T>, options?: Partial<EventHandlerOptions>): this;
71
- private _normalizeInputs;
72
- private _isMatch;
73
- }
74
-
75
- /**
76
- * The different mouse buttons that may appear on a pointer event.
77
- */
78
- declare enum MouseButton {
79
- Main = 0,
80
- Auxiliary = 1,
81
- Secondary = 2
82
- }
83
- /** An event manager that is specialized for handling pointer events. */
84
- declare class PointerEventManager<T extends PointerEvent> extends EventManager<T> {
85
- options: EventHandlerOptions;
86
- /**
87
- * Configures this event manager to handle events with a specific modifer and mouse button
88
- * combination.
89
- */
90
- on(button: MouseButton, modifiers: ModifierInputs, handler: EventHandler<T>): this;
91
- /**
92
- * Configures this event manager to handle events with a specific mouse button and no modifiers.
93
- */
94
- on(modifiers: ModifierInputs, handler: EventHandler<T>): this;
95
- /**
96
- * Configures this event manager to handle events with the main mouse button and no modifiers.
97
- *
98
- * @param handler The handler function
99
- * @param options Options for whether to stop propagation or prevent default.
100
- */
101
- on(handler: EventHandler<T>): this;
102
- private _normalizeInputs;
103
- _isMatch(event: PointerEvent, button: MouseButton, modifiers: ModifierInputs): boolean;
104
- }
9
+ declare function computed<T>(computation: () => T): SignalLike<T>;
10
+ declare function signal<T>(initialValue: T): WritableSignalLike<T>;
11
+ declare function linkedSignal<T>(sourceFn: () => T): WritableSignalLike<T>;
105
12
 
106
13
  /** Represents an item in a collection, such as a listbox option, than may receive focus. */
107
14
  interface ListFocusItem {
@@ -132,11 +39,11 @@ interface ListFocusInputs<T extends ListFocusItem> {
132
39
  declare class ListFocus<T extends ListFocusItem> {
133
40
  readonly inputs: ListFocusInputs<T>;
134
41
  /** The last item that was active. */
135
- prevActiveItem: _angular_core.WritableSignal<T | undefined>;
42
+ prevActiveItem: WritableSignalLike<T | undefined>;
136
43
  /** The index of the last item that was active. */
137
- prevActiveIndex: _angular_core.Signal<number>;
44
+ prevActiveIndex: SignalLike<number>;
138
45
  /** The current active index in the list. */
139
- activeIndex: _angular_core.Signal<number>;
46
+ activeIndex: SignalLike<number>;
140
47
  constructor(inputs: ListFocusInputs<T>);
141
48
  /** Whether the list is in a disabled state. */
142
49
  isListDisabled(): boolean;
@@ -208,5 +115,5 @@ declare class ListNavigation<T extends ListNavigationItem> {
208
115
  private _peek;
209
116
  }
210
117
 
211
- export { KeyboardEventManager, ListFocus, ListNavigation, PointerEventManager, convertGetterSetterToWritableSignalLike };
118
+ export { ListFocus, ListNavigation, computed, convertGetterSetterToWritableSignalLike, linkedSignal, signal };
212
119
  export type { ListFocusInputs, ListFocusItem, ListNavigationInputs, ListNavigationItem, SignalLike, WritableSignalLike };
@@ -1,6 +1,7 @@
1
- import * as _angular_core from '@angular/core';
2
- import { SignalLike, KeyboardEventManager, PointerEventManager } from './_list-navigation-chunk.js';
1
+ import { SignalLike, WritableSignalLike } from './_list-navigation-chunk.js';
3
2
  import { ListItem, ListInputs, List } from './_list-chunk.js';
3
+ import { KeyboardEventManager } from './_keyboard-event-manager-chunk.js';
4
+ import { PointerEventManager } from './_pointer-event-manager-chunk.js';
4
5
 
5
6
  /**
6
7
  * Represents the properties exposed by a listbox that need to be accessed by an option.
@@ -21,11 +22,11 @@ declare class OptionPattern<V> {
21
22
  /** The value of the option. */
22
23
  value: SignalLike<V>;
23
24
  /** The position of the option in the list. */
24
- index: _angular_core.Signal<number>;
25
+ index: SignalLike<number>;
25
26
  /** Whether the option is active. */
26
- active: _angular_core.Signal<boolean>;
27
+ active: SignalLike<boolean>;
27
28
  /** Whether the option is selected. */
28
- selected: _angular_core.Signal<boolean | undefined>;
29
+ selected: SignalLike<boolean | undefined>;
29
30
  /** Whether the option is selectable. */
30
31
  selectable: () => boolean;
31
32
  /** Whether the option is disabled. */
@@ -35,7 +36,7 @@ declare class OptionPattern<V> {
35
36
  /** A reference to the parent listbox. */
36
37
  listbox: SignalLike<ListboxPattern$1<V> | undefined>;
37
38
  /** The tab index of the option. */
38
- tabIndex: _angular_core.Signal<0 | -1 | undefined>;
39
+ tabIndex: SignalLike<0 | -1 | undefined>;
39
40
  /** The html element that should receive focus. */
40
41
  element: SignalLike<HTMLElement | undefined>;
41
42
  constructor(args: OptionInputs<V>);
@@ -55,33 +56,33 @@ declare class ListboxPattern<V> {
55
56
  /** Whether the list is vertically or horizontally oriented. */
56
57
  orientation: SignalLike<'vertical' | 'horizontal'>;
57
58
  /** Whether the listbox is disabled. */
58
- disabled: _angular_core.Signal<boolean>;
59
+ disabled: SignalLike<boolean>;
59
60
  /** Whether the listbox is readonly. */
60
61
  readonly: SignalLike<boolean>;
61
62
  /** The tab index of the listbox. */
62
63
  tabIndex: SignalLike<-1 | 0>;
63
64
  /** The id of the current active item. */
64
- activeDescendant: _angular_core.Signal<string | undefined>;
65
+ activeDescendant: SignalLike<string | undefined>;
65
66
  /** Whether multiple items in the list can be selected at once. */
66
67
  multi: SignalLike<boolean>;
67
68
  /** The number of items in the listbox. */
68
- setsize: _angular_core.Signal<number>;
69
+ setsize: SignalLike<number>;
69
70
  /** Whether the listbox selection follows focus. */
70
- followFocus: _angular_core.Signal<boolean>;
71
+ followFocus: SignalLike<boolean>;
71
72
  /** Whether the listbox should wrap. Used to disable wrapping while range selecting. */
72
- wrap: _angular_core.WritableSignal<boolean>;
73
+ wrap: WritableSignalLike<boolean>;
73
74
  /** The key used to navigate to the previous item in the list. */
74
- prevKey: _angular_core.Signal<"ArrowUp" | "ArrowRight" | "ArrowLeft">;
75
+ prevKey: SignalLike<"ArrowUp" | "ArrowRight" | "ArrowLeft">;
75
76
  /** The key used to navigate to the next item in the list. */
76
- nextKey: _angular_core.Signal<"ArrowRight" | "ArrowLeft" | "ArrowDown">;
77
+ nextKey: SignalLike<"ArrowRight" | "ArrowLeft" | "ArrowDown">;
77
78
  /** Represents the space key. Does nothing when the user is actively using typeahead. */
78
- dynamicSpaceKey: _angular_core.Signal<"" | " ">;
79
+ dynamicSpaceKey: SignalLike<"" | " ">;
79
80
  /** The regexp used to decide if a key should trigger typeahead. */
80
81
  typeaheadRegexp: RegExp;
81
82
  /** The keydown event manager for the listbox. */
82
- keydown: _angular_core.Signal<KeyboardEventManager<KeyboardEvent>>;
83
+ keydown: SignalLike<KeyboardEventManager<KeyboardEvent>>;
83
84
  /** The pointerdown event manager for the listbox. */
84
- pointerdown: _angular_core.Signal<PointerEventManager<PointerEvent>>;
85
+ pointerdown: SignalLike<PointerEventManager<PointerEvent>>;
85
86
  constructor(inputs: ListboxInputs<V>);
86
87
  /** Returns a set of violations */
87
88
  validate(): string[];
@@ -0,0 +1,267 @@
1
+ import { SignalLike, WritableSignalLike } from './_list-navigation-chunk.js';
2
+ import { KeyboardEventManager } from './_keyboard-event-manager-chunk.js';
3
+ import { ListInputs, ListItem, List } from './_list-chunk.js';
4
+
5
+ /** The inputs for the MenuBarPattern class. */
6
+ interface MenuBarInputs<V> extends ListInputs<MenuItemPattern<V>, V> {
7
+ /** The menu items contained in the menu. */
8
+ items: SignalLike<MenuItemPattern<V>[]>;
9
+ /** Callback function triggered when a menu item is selected. */
10
+ onSelect?: (value: V) => void;
11
+ /** The text direction of the menu bar. */
12
+ textDirection: SignalLike<'ltr' | 'rtl'>;
13
+ }
14
+ /** The inputs for the MenuPattern class. */
15
+ interface MenuInputs<V> extends Omit<ListInputs<MenuItemPattern<V>, V>, 'values'> {
16
+ /** The unique ID of the menu. */
17
+ id: SignalLike<string>;
18
+ /** The menu items contained in the menu. */
19
+ items: SignalLike<MenuItemPattern<V>[]>;
20
+ /** A reference to the parent menu or menu trigger. */
21
+ parent: SignalLike<MenuTriggerPattern<V> | MenuItemPattern<V> | undefined>;
22
+ /** Callback function triggered when a menu item is selected. */
23
+ onSelect?: (value: V) => void;
24
+ /** The text direction of the menu bar. */
25
+ textDirection: SignalLike<'ltr' | 'rtl'>;
26
+ /** The delay in milliseconds before expanding sub-menus on hover. */
27
+ expansionDelay: SignalLike<number>;
28
+ }
29
+ /** The inputs for the MenuTriggerPattern class. */
30
+ interface MenuTriggerInputs<V> {
31
+ /** A reference to the menu trigger element. */
32
+ element: SignalLike<HTMLElement | undefined>;
33
+ /** A reference to the menu associated with the trigger. */
34
+ menu: SignalLike<MenuPattern<V> | undefined>;
35
+ /** The text direction of the menu bar. */
36
+ textDirection: SignalLike<'ltr' | 'rtl'>;
37
+ /** Whether the menu trigger is disabled. */
38
+ disabled: SignalLike<boolean>;
39
+ }
40
+ /** The inputs for the MenuItemPattern class. */
41
+ interface MenuItemInputs<V> extends Omit<ListItem<V>, 'index' | 'selectable'> {
42
+ /** A reference to the parent menu or menu trigger. */
43
+ parent: SignalLike<MenuPattern<V> | MenuBarPattern<V> | undefined>;
44
+ /** A reference to the submenu associated with the menu item. */
45
+ submenu: SignalLike<MenuPattern<V> | undefined>;
46
+ }
47
+ /** The menu ui pattern class. */
48
+ declare class MenuPattern<V> {
49
+ readonly inputs: MenuInputs<V>;
50
+ /** The unique ID of the menu. */
51
+ id: SignalLike<string>;
52
+ /** The role of the menu. */
53
+ role: () => string;
54
+ /** Whether the menu is disabled. */
55
+ disabled: () => boolean;
56
+ /** Whether the menu is visible. */
57
+ visible: SignalLike<boolean>;
58
+ /** Controls list behavior for the menu items. */
59
+ listBehavior: List<MenuItemPattern<V>, V>;
60
+ /** Whether the menu or any of its child elements are currently focused. */
61
+ isFocused: WritableSignalLike<boolean>;
62
+ /** Whether the menu has received focus. */
63
+ hasBeenFocused: WritableSignalLike<boolean>;
64
+ /** Whether the menu trigger has been hovered. */
65
+ hasBeenHovered: WritableSignalLike<boolean>;
66
+ /** Timeout used to open sub-menus on hover. */
67
+ _openTimeout: any;
68
+ /** Timeout used to close sub-menus on hover out. */
69
+ _closeTimeout: any;
70
+ /** The tab index of the menu. */
71
+ tabIndex: () => 0 | -1;
72
+ /** Whether the menu should be focused on mouse over. */
73
+ shouldFocus: SignalLike<boolean>;
74
+ /** The key used to expand sub-menus. */
75
+ private _expandKey;
76
+ /** The key used to collapse sub-menus. */
77
+ private _collapseKey;
78
+ /** Represents the space key. Does nothing when the user is actively using typeahead. */
79
+ dynamicSpaceKey: SignalLike<"" | " ">;
80
+ /** The regexp used to decide if a key should trigger typeahead. */
81
+ typeaheadRegexp: RegExp;
82
+ /** The root of the menu. */
83
+ root: SignalLike<MenuTriggerPattern<V> | MenuBarPattern<V> | MenuPattern<V> | undefined>;
84
+ /** Handles keyboard events for the menu. */
85
+ keydownManager: SignalLike<KeyboardEventManager<KeyboardEvent>>;
86
+ constructor(inputs: MenuInputs<V>);
87
+ /** Sets the default state for the menu. */
88
+ setDefaultState(): void;
89
+ /** Handles keyboard events for the menu. */
90
+ onKeydown(event: KeyboardEvent): void;
91
+ /** Handles mouseover events for the menu. */
92
+ onMouseOver(event: MouseEvent): void;
93
+ /** Closes the specified menu item after a delay. */
94
+ private _closeItem;
95
+ /** Opens the specified menu item after a delay. */
96
+ private _openItem;
97
+ /** Handles mouseout events for the menu. */
98
+ onMouseOut(event: MouseEvent): void;
99
+ /** Handles click events for the menu. */
100
+ onClick(event: MouseEvent): void;
101
+ /** Handles focusin events for the menu. */
102
+ onFocusIn(): void;
103
+ /** Handles the focusout event for the menu. */
104
+ onFocusOut(event: FocusEvent): void;
105
+ /** Focuses the previous menu item. */
106
+ prev(): void;
107
+ /** Focuses the next menu item. */
108
+ next(): void;
109
+ /** Focuses the first menu item. */
110
+ first(): void;
111
+ /** Focuses the last menu item. */
112
+ last(): void;
113
+ /** Triggers the active menu item. */
114
+ trigger(): void;
115
+ /** Submits the menu. */
116
+ submit(item?: MenuItemPattern<V> | undefined): void;
117
+ /** Collapses the current menu or focuses the previous item in the menubar. */
118
+ collapse(): void;
119
+ /** Expands the current menu or focuses the next item in the menubar. */
120
+ expand(): void;
121
+ /** Closes the menu. */
122
+ close(): void;
123
+ /** Closes the menu and all parent menus. */
124
+ closeAll(): void;
125
+ /** Clears any open or close timeouts for sub-menus. */
126
+ _clearTimeouts(): void;
127
+ /** Clears the open timeout. */
128
+ _clearOpenTimeout(): void;
129
+ /** Clears the close timeout. */
130
+ _clearCloseTimeout(): void;
131
+ }
132
+ /** The menubar ui pattern class. */
133
+ declare class MenuBarPattern<V> {
134
+ readonly inputs: MenuBarInputs<V>;
135
+ /** Controls list behavior for the menu items. */
136
+ listBehavior: List<MenuItemPattern<V>, V>;
137
+ /** The tab index of the menu. */
138
+ tabIndex: () => 0 | -1;
139
+ /** The key used to navigate to the next item. */
140
+ private _nextKey;
141
+ /** The key used to navigate to the previous item. */
142
+ private _previousKey;
143
+ /** Represents the space key. Does nothing when the user is actively using typeahead. */
144
+ dynamicSpaceKey: SignalLike<"" | " ">;
145
+ /** The regexp used to decide if a key should trigger typeahead. */
146
+ typeaheadRegexp: RegExp;
147
+ /** Whether the menubar or any of its children are currently focused. */
148
+ isFocused: WritableSignalLike<boolean>;
149
+ /** Whether the menubar has been focused. */
150
+ hasBeenFocused: WritableSignalLike<boolean>;
151
+ /** Whether the menubar is disabled. */
152
+ disabled: () => boolean;
153
+ /** Handles keyboard events for the menu. */
154
+ keydownManager: SignalLike<KeyboardEventManager<KeyboardEvent>>;
155
+ constructor(inputs: MenuBarInputs<V>);
156
+ /** Sets the default state for the menubar. */
157
+ setDefaultState(): void;
158
+ /** Handles keyboard events for the menu. */
159
+ onKeydown(event: KeyboardEvent): void;
160
+ /** Handles click events for the menu bar. */
161
+ onClick(event: MouseEvent): void;
162
+ /** Handles mouseover events for the menu bar. */
163
+ onMouseOver(event: MouseEvent): void;
164
+ /** Handles focusin events for the menu bar. */
165
+ onFocusIn(): void;
166
+ /** Handles focusout events for the menu bar. */
167
+ onFocusOut(event: FocusEvent): void;
168
+ /** Goes to and optionally focuses the specified menu item. */
169
+ goto(item: MenuItemPattern<V>, opts?: {
170
+ focusElement?: boolean;
171
+ }): void;
172
+ /** Focuses the next menu item. */
173
+ next(): void;
174
+ /** Focuses the previous menu item. */
175
+ prev(): void;
176
+ /** Closes the menubar and refocuses the root menu bar item. */
177
+ close(): void;
178
+ }
179
+ /** The menu trigger ui pattern class. */
180
+ declare class MenuTriggerPattern<V> {
181
+ readonly inputs: MenuTriggerInputs<V>;
182
+ /** Whether the menu is expanded. */
183
+ expanded: WritableSignalLike<boolean>;
184
+ /** Whether the menu trigger has received focus. */
185
+ hasBeenFocused: WritableSignalLike<boolean>;
186
+ /** The role of the menu trigger. */
187
+ role: () => string;
188
+ /** Whether the menu trigger has a popup. */
189
+ hasPopup: () => boolean;
190
+ /** The menu associated with the trigger. */
191
+ menu: SignalLike<MenuPattern<V> | undefined>;
192
+ /** The tab index of the menu trigger. */
193
+ tabIndex: SignalLike<-1 | 0>;
194
+ /** Whether the menu trigger is disabled. */
195
+ disabled: () => boolean;
196
+ /** Handles keyboard events for the menu trigger. */
197
+ keydownManager: SignalLike<KeyboardEventManager<KeyboardEvent>>;
198
+ constructor(inputs: MenuTriggerInputs<V>);
199
+ /** Handles keyboard events for the menu trigger. */
200
+ onKeydown(event: KeyboardEvent): void;
201
+ /** Handles click events for the menu trigger. */
202
+ onClick(): void;
203
+ /** Handles focusin events for the menu trigger. */
204
+ onFocusIn(): void;
205
+ /** Handles focusout events for the menu trigger. */
206
+ onFocusOut(event: FocusEvent): void;
207
+ /** Opens the menu. */
208
+ open(opts?: {
209
+ first?: boolean;
210
+ last?: boolean;
211
+ }): void;
212
+ /** Closes the menu. */
213
+ close(opts?: {
214
+ refocus?: boolean;
215
+ }): void;
216
+ }
217
+ /** The menu item ui pattern class. */
218
+ declare class MenuItemPattern<V> implements ListItem<V> {
219
+ readonly inputs: MenuItemInputs<V>;
220
+ /** The value of the menu item. */
221
+ value: SignalLike<V>;
222
+ /** The unique ID of the menu item. */
223
+ id: SignalLike<string>;
224
+ /** Whether the menu item is disabled. */
225
+ disabled: () => boolean;
226
+ /** The search term for the menu item. */
227
+ searchTerm: SignalLike<string>;
228
+ /** The element of the menu item. */
229
+ element: SignalLike<HTMLElement | undefined>;
230
+ /** Whether the menu item is active. */
231
+ active: SignalLike<boolean>;
232
+ /** Whether the menu item has received focus. */
233
+ hasBeenFocused: WritableSignalLike<boolean>;
234
+ /** The tab index of the menu item. */
235
+ tabIndex: SignalLike<0 | -1>;
236
+ /** The position of the menu item in the menu. */
237
+ index: SignalLike<number>;
238
+ /** Whether the menu item is expanded. */
239
+ expanded: SignalLike<boolean | null>;
240
+ /** Whether the menu item is expanded. */
241
+ _expanded: WritableSignalLike<boolean>;
242
+ /** The ID of the menu that the menu item controls. */
243
+ controls: WritableSignalLike<string | undefined>;
244
+ /** The role of the menu item. */
245
+ role: () => string;
246
+ /** Whether the menu item has a popup. */
247
+ hasPopup: SignalLike<boolean>;
248
+ /** The submenu associated with the menu item. */
249
+ submenu: SignalLike<MenuPattern<V> | undefined>;
250
+ /** Whether the menu item is selectable. */
251
+ selectable: SignalLike<boolean>;
252
+ constructor(inputs: MenuItemInputs<V>);
253
+ /** Opens the submenu. */
254
+ open(opts?: {
255
+ first?: boolean;
256
+ last?: boolean;
257
+ }): void;
258
+ /** Closes the submenu. */
259
+ close(opts?: {
260
+ refocus?: boolean;
261
+ }): void;
262
+ /** Handles focusin events for the menu item. */
263
+ onFocusIn(): void;
264
+ }
265
+
266
+ export { MenuBarPattern, MenuItemPattern, MenuPattern, MenuTriggerPattern };
267
+ export type { MenuBarInputs, MenuInputs, MenuItemInputs, MenuTriggerInputs };
@@ -0,0 +1,34 @@
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
+ 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 };