@angular/cdk 20.0.0-next.0 → 20.0.0-next.2

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 (181) hide show
  1. package/a11y/index.d.ts +330 -1234
  2. package/a11y-module.d-7d03e079.d.ts +313 -0
  3. package/accordion/index.d.ts +8 -27
  4. package/activedescendant-key-manager.d-11921e3a.d.ts +31 -0
  5. package/bidi/index.d.ts +3 -62
  6. package/bidi-module.d-f8648621.d.ts +53 -0
  7. package/clipboard/index.d.ts +61 -75
  8. package/coercion/index.d.ts +10 -33
  9. package/coercion/private/index.d.ts +2 -2
  10. package/collections/index.d.ts +13 -291
  11. package/data-source.d-7cab2c9d.d.ts +42 -0
  12. package/dialog/index.d.ts +204 -249
  13. package/drag-drop/index.d.ts +1077 -1157
  14. package/fesm2022/a11y-module-e6996d20.mjs +952 -0
  15. package/fesm2022/a11y-module-e6996d20.mjs.map +1 -0
  16. package/fesm2022/a11y.mjs +47 -2445
  17. package/fesm2022/a11y.mjs.map +1 -1
  18. package/fesm2022/accordion.mjs +12 -16
  19. package/fesm2022/accordion.mjs.map +1 -1
  20. package/fesm2022/activedescendant-key-manager-1351a9d3.mjs +16 -0
  21. package/fesm2022/activedescendant-key-manager-1351a9d3.mjs.map +1 -0
  22. package/fesm2022/array-ee3b4bab.mjs +6 -0
  23. package/fesm2022/array-ee3b4bab.mjs.map +1 -0
  24. package/fesm2022/backwards-compatibility-bcbe473e.mjs +25 -0
  25. package/fesm2022/backwards-compatibility-bcbe473e.mjs.map +1 -0
  26. package/fesm2022/bidi-module-0726b65c.mjs +78 -0
  27. package/fesm2022/bidi-module-0726b65c.mjs.map +1 -0
  28. package/fesm2022/bidi.mjs +4 -143
  29. package/fesm2022/bidi.mjs.map +1 -1
  30. package/fesm2022/breakpoints-observer-d4584b66.mjs +179 -0
  31. package/fesm2022/breakpoints-observer-d4584b66.mjs.map +1 -0
  32. package/fesm2022/cdk.mjs +1 -1
  33. package/fesm2022/cdk.mjs.map +1 -1
  34. package/fesm2022/clipboard.mjs +10 -14
  35. package/fesm2022/clipboard.mjs.map +1 -1
  36. package/fesm2022/coercion/private.mjs +2 -18
  37. package/fesm2022/coercion/private.mjs.map +1 -1
  38. package/fesm2022/coercion.mjs +5 -39
  39. package/fesm2022/coercion.mjs.map +1 -1
  40. package/fesm2022/collections.mjs +7 -476
  41. package/fesm2022/collections.mjs.map +1 -1
  42. package/fesm2022/css-pixel-value-286c9a60.mjs +10 -0
  43. package/fesm2022/css-pixel-value-286c9a60.mjs.map +1 -0
  44. package/fesm2022/data-source-5320b6fd.mjs +15 -0
  45. package/fesm2022/data-source-5320b6fd.mjs.map +1 -0
  46. package/fesm2022/dialog.mjs +37 -39
  47. package/fesm2022/dialog.mjs.map +1 -1
  48. package/fesm2022/directionality-7ea26429.mjs +72 -0
  49. package/fesm2022/directionality-7ea26429.mjs.map +1 -0
  50. package/fesm2022/dispose-view-repeater-strategy-b11b87ea.mjs +44 -0
  51. package/fesm2022/dispose-view-repeater-strategy-b11b87ea.mjs.map +1 -0
  52. package/fesm2022/drag-drop.mjs +48 -50
  53. package/fesm2022/drag-drop.mjs.map +1 -1
  54. package/fesm2022/element-705567fe.mjs +29 -0
  55. package/fesm2022/element-705567fe.mjs.map +1 -0
  56. package/fesm2022/fake-event-detection-7055b1bd.mjs +24 -0
  57. package/fesm2022/fake-event-detection-7055b1bd.mjs.map +1 -0
  58. package/fesm2022/focus-key-manager-58d29acd.mjs +22 -0
  59. package/fesm2022/focus-key-manager-58d29acd.mjs.map +1 -0
  60. package/fesm2022/focus-monitor-cebaa0d1.mjs +629 -0
  61. package/fesm2022/focus-monitor-cebaa0d1.mjs.map +1 -0
  62. package/fesm2022/id-generator-fba495fb.mjs +37 -0
  63. package/fesm2022/id-generator-fba495fb.mjs.map +1 -0
  64. package/fesm2022/keycodes-107cd3e4.mjs +122 -0
  65. package/fesm2022/keycodes-107cd3e4.mjs.map +1 -0
  66. package/fesm2022/keycodes.mjs +2 -136
  67. package/fesm2022/keycodes.mjs.map +1 -1
  68. package/fesm2022/layout.mjs +12 -184
  69. package/fesm2022/layout.mjs.map +1 -1
  70. package/fesm2022/list-key-manager-c7b5cefb.mjs +360 -0
  71. package/fesm2022/list-key-manager-c7b5cefb.mjs.map +1 -0
  72. package/fesm2022/listbox.mjs +21 -20
  73. package/fesm2022/listbox.mjs.map +1 -1
  74. package/fesm2022/menu.mjs +76 -60
  75. package/fesm2022/menu.mjs.map +1 -1
  76. package/fesm2022/modifiers-33a5859e.mjs +13 -0
  77. package/fesm2022/modifiers-33a5859e.mjs.map +1 -0
  78. package/fesm2022/observable-97c0792c.mjs +15 -0
  79. package/fesm2022/observable-97c0792c.mjs.map +1 -0
  80. package/fesm2022/observe-content-d2a6b5a0.mjs +210 -0
  81. package/fesm2022/observe-content-d2a6b5a0.mjs.map +1 -0
  82. package/fesm2022/observers/private.mjs +3 -7
  83. package/fesm2022/observers/private.mjs.map +1 -1
  84. package/fesm2022/observers.mjs +5 -213
  85. package/fesm2022/observers.mjs.map +1 -1
  86. package/fesm2022/overlay-module-863b82c9.mjs +3029 -0
  87. package/fesm2022/overlay-module-863b82c9.mjs.map +1 -0
  88. package/fesm2022/overlay.mjs +28 -3019
  89. package/fesm2022/overlay.mjs.map +1 -1
  90. package/fesm2022/passive-listeners-c0bdc49f.mjs +31 -0
  91. package/fesm2022/passive-listeners-c0bdc49f.mjs.map +1 -0
  92. package/fesm2022/platform-1be098b0.mjs +77 -0
  93. package/fesm2022/platform-1be098b0.mjs.map +1 -0
  94. package/fesm2022/platform.mjs +13 -293
  95. package/fesm2022/platform.mjs.map +1 -1
  96. package/fesm2022/portal-directives-c88fea11.mjs +615 -0
  97. package/fesm2022/portal-directives-c88fea11.mjs.map +1 -0
  98. package/fesm2022/portal.mjs +3 -650
  99. package/fesm2022/portal.mjs.map +1 -1
  100. package/fesm2022/private.mjs +3 -63
  101. package/fesm2022/private.mjs.map +1 -1
  102. package/fesm2022/recycle-view-repeater-strategy-c1712813.mjs +156 -0
  103. package/fesm2022/recycle-view-repeater-strategy-c1712813.mjs.map +1 -0
  104. package/fesm2022/scrolling-61955dd1.mjs +99 -0
  105. package/fesm2022/scrolling-61955dd1.mjs.map +1 -0
  106. package/fesm2022/scrolling-module-aa9eeac5.mjs +1463 -0
  107. package/fesm2022/scrolling-module-aa9eeac5.mjs.map +1 -0
  108. package/fesm2022/scrolling.mjs +12 -1463
  109. package/fesm2022/scrolling.mjs.map +1 -1
  110. package/fesm2022/selection-model-30243dba.mjs +221 -0
  111. package/fesm2022/selection-model-30243dba.mjs.map +1 -0
  112. package/fesm2022/shadow-dom-9f403d00.mjs +49 -0
  113. package/fesm2022/shadow-dom-9f403d00.mjs.map +1 -0
  114. package/fesm2022/stepper.mjs +32 -30
  115. package/fesm2022/stepper.mjs.map +1 -1
  116. package/fesm2022/style-loader-e14dc585.mjs +47 -0
  117. package/fesm2022/style-loader-e14dc585.mjs.map +1 -0
  118. package/fesm2022/table.mjs +88 -132
  119. package/fesm2022/table.mjs.map +1 -1
  120. package/fesm2022/test-environment-34eef1ee.mjs +19 -0
  121. package/fesm2022/test-environment-34eef1ee.mjs.map +1 -0
  122. package/fesm2022/testing/selenium-webdriver.mjs +2 -1
  123. package/fesm2022/testing/selenium-webdriver.mjs.map +1 -1
  124. package/fesm2022/testing/testbed.mjs +33 -74
  125. package/fesm2022/testing/testbed.mjs.map +1 -1
  126. package/fesm2022/testing.mjs +2 -697
  127. package/fesm2022/testing.mjs.map +1 -1
  128. package/fesm2022/text-field.mjs +24 -23
  129. package/fesm2022/text-field.mjs.map +1 -1
  130. package/fesm2022/text-filtering-b60ba8a2.mjs +698 -0
  131. package/fesm2022/text-filtering-b60ba8a2.mjs.map +1 -0
  132. package/fesm2022/tree-key-manager-2f20c79c.mjs +360 -0
  133. package/fesm2022/tree-key-manager-2f20c79c.mjs.map +1 -0
  134. package/fesm2022/tree.mjs +33 -33
  135. package/fesm2022/tree.mjs.map +1 -1
  136. package/fesm2022/typeahead-11ae39bd.mjs +88 -0
  137. package/fesm2022/typeahead-11ae39bd.mjs.map +1 -0
  138. package/fesm2022/unique-selection-dispatcher-1d6f91d8.mjs +49 -0
  139. package/fesm2022/unique-selection-dispatcher-1d6f91d8.mjs.map +1 -0
  140. package/fesm2022/visually-hidden-83aea4a0.mjs +18 -0
  141. package/fesm2022/visually-hidden-83aea4a0.mjs.map +1 -0
  142. package/focus-key-manager.d-415a6958.d.ts +33 -0
  143. package/focus-monitor.d-810a02e6.d.ts +209 -0
  144. package/harness-environment.d-4d615248.d.ts +619 -0
  145. package/index.d.ts +2 -2
  146. package/keycodes/index.d.ts +123 -244
  147. package/layout/index.d.ts +23 -25
  148. package/list-key-manager.d-72e9a2e7.d.ts +164 -0
  149. package/listbox/index.d.ts +91 -107
  150. package/menu/index.d.ts +596 -682
  151. package/number-property.d-ce316715.d.ts +15 -0
  152. package/observe-content.d-c08bc882.d.ts +84 -0
  153. package/observers/index.d.ts +4 -90
  154. package/observers/private/index.d.ts +3 -3
  155. package/overlay/index.d.ts +110 -951
  156. package/overlay-module.d-5d06db8a.d.ts +790 -0
  157. package/package.json +1 -1
  158. package/platform/index.d.ts +45 -86
  159. package/platform.d-0a5b4792.d.ts +33 -0
  160. package/portal/index.d.ts +5 -264
  161. package/portal-directives.d-d345bd53.d.ts +210 -0
  162. package/private/index.d.ts +3 -20
  163. package/schematics/ng-add/index.js +1 -1
  164. package/schematics/ng-add/index.mjs +1 -1
  165. package/schematics/ng-update/html-parsing/angular.js +2 -2
  166. package/schematics/ng-update/html-parsing/angular.mjs +2 -2
  167. package/scrolling/index.d.ts +7 -687
  168. package/scrolling-module.d-a08a462d.d.ts +551 -0
  169. package/selection-model.d-1a70542c.d.ts +111 -0
  170. package/stepper/index.d.ts +74 -124
  171. package/style-loader.d-19baab84.d.ts +21 -0
  172. package/table/index.d.ts +329 -453
  173. package/testing/index.d.ts +32 -675
  174. package/testing/selenium-webdriver/index.d.ts +30 -20
  175. package/testing/testbed/index.d.ts +9 -19
  176. package/text-field/index.d.ts +11 -30
  177. package/tree/index.d.ts +205 -271
  178. package/tree-key-manager-strategy.d-603161dd.d.ts +116 -0
  179. package/unique-selection-dispatcher.d-7993b9f5.d.ts +32 -0
  180. package/view-repeater.d-79039e1f.d.ts +88 -0
  181. package/viewport-ruler.d-f3d3e82f.d.ts +57 -0
package/menu/index.d.ts CHANGED
@@ -1,241 +1,428 @@
1
- import { AfterContentInit } from '@angular/core';
2
- import { ConnectedPosition } from '@angular/cdk/overlay';
3
- import { Directionality } from '@angular/cdk/bidi';
4
- import { ElementRef } from '@angular/core';
5
- import { EventEmitter } from '@angular/core';
6
- import { FocusableOption } from '@angular/cdk/a11y';
7
- import { FocusKeyManager } from '@angular/cdk/a11y';
8
- import { FocusOrigin } from '@angular/cdk/a11y';
9
1
  import * as i0 from '@angular/core';
10
- import * as i1 from '@angular/cdk/overlay';
11
- import { InjectionToken } from '@angular/core';
12
- import { Injector } from '@angular/core';
13
- import { NgZone } from '@angular/core';
14
- import { Observable } from 'rxjs';
15
- import { OnChanges } from '@angular/core';
16
- import { OnDestroy } from '@angular/core';
17
- import { Optional } from '@angular/core';
18
- import { OverlayRef } from '@angular/cdk/overlay';
19
- import { QueryList } from '@angular/core';
20
- import { Renderer2 } from '@angular/core';
21
- import { ScrollStrategy } from '@angular/cdk/overlay';
22
- import { SimpleChanges } from '@angular/core';
23
- import { Subject } from 'rxjs';
24
- import { TemplatePortal } from '@angular/cdk/portal';
25
- import { TemplateRef } from '@angular/core';
26
- import { ViewContainerRef } from '@angular/core';
2
+ import { ElementRef, Renderer2, QueryList, InjectionToken, Optional, OnDestroy, Injector, ViewContainerRef, EventEmitter, TemplateRef, OnChanges, SimpleChanges, NgZone, AfterContentInit } from '@angular/core';
3
+ import { S as ScrollStrategy, C as ConnectedPosition, O as OverlayRef, a as OverlayModule } from '../overlay-module.d-5d06db8a.js';
4
+ import * as rxjs from 'rxjs';
5
+ import { Observable, Subject } from 'rxjs';
6
+ import { F as FocusOrigin } from '../focus-monitor.d-810a02e6.js';
7
+ import { F as FocusableOption, a as FocusKeyManager } from '../focus-key-manager.d-415a6958.js';
8
+ import { D as Directionality } from '../bidi-module.d-f8648621.js';
9
+ import { T as TemplatePortal } from '../portal-directives.d-d345bd53.js';
10
+ import '../scrolling-module.d-a08a462d.js';
11
+ import '../data-source.d-7cab2c9d.js';
12
+ import '../number-property.d-ce316715.js';
13
+ import '@angular/common';
14
+ import '../viewport-ruler.d-f3d3e82f.js';
15
+ import '../platform.d-0a5b4792.js';
16
+ import '../style-loader.d-19baab84.js';
17
+ import '../list-key-manager.d-72e9a2e7.js';
27
18
 
28
- /** Injection token used to return classes implementing the Menu interface */
29
- export declare const CDK_MENU: InjectionToken<Menu>;
19
+ /** Item to track for mouse focus events. */
20
+ interface FocusableElement {
21
+ /** A reference to the element to be tracked. */
22
+ _elementRef: ElementRef<HTMLElement>;
23
+ }
24
+ /**
25
+ * PointerFocusTracker keeps track of the currently active item under mouse focus. It also has
26
+ * observables which emit when the users mouse enters and leaves a tracked element.
27
+ */
28
+ declare class PointerFocusTracker<T extends FocusableElement> {
29
+ private _renderer;
30
+ private readonly _items;
31
+ private _eventCleanups;
32
+ private _itemsSubscription;
33
+ /** Emits when an element is moused into. */
34
+ readonly entered: Observable<T>;
35
+ /** Emits when an element is moused out. */
36
+ readonly exited: Observable<T>;
37
+ /** The element currently under mouse focus. */
38
+ activeElement?: T;
39
+ /** The element previously under mouse focus. */
40
+ previousElement?: T;
41
+ constructor(_renderer: Renderer2, _items: QueryList<T>);
42
+ /** Stop the managers listeners. */
43
+ destroy(): void;
44
+ /** Binds the enter/exit events on all the items. */
45
+ private _bindEvents;
46
+ /** Cleans up the currently-bound events. */
47
+ private _cleanupEvents;
48
+ }
30
49
 
50
+ /** The relative item in the inline menu to focus after closing all popup menus. */
51
+ declare enum FocusNext {
52
+ nextItem = 0,
53
+ previousItem = 1,
54
+ currentItem = 2
55
+ }
56
+ /** A single item (menu) in the menu stack. */
57
+ interface MenuStackItem {
58
+ /** A reference to the menu stack this menu stack item belongs to. */
59
+ menuStack?: MenuStack;
60
+ }
61
+ /** Injection token used for an implementation of MenuStack. */
62
+ declare const MENU_STACK: InjectionToken<MenuStack>;
63
+ /** Provider that provides the parent menu stack, or a new menu stack if there is no parent one. */
64
+ declare const PARENT_OR_NEW_MENU_STACK_PROVIDER: {
65
+ provide: InjectionToken<MenuStack>;
66
+ deps: Optional[][];
67
+ useFactory: (parentMenuStack?: MenuStack) => MenuStack;
68
+ };
69
+ /** Provider that provides the parent menu stack, or a new inline menu stack if there is no parent one. */
70
+ declare const PARENT_OR_NEW_INLINE_MENU_STACK_PROVIDER: (orientation: "vertical" | "horizontal") => {
71
+ provide: InjectionToken<MenuStack>;
72
+ deps: Optional[][];
73
+ useFactory: (parentMenuStack?: MenuStack) => MenuStack;
74
+ };
75
+ /** Options that can be provided to the close or closeAll methods. */
76
+ interface CloseOptions {
77
+ /** The element to focus next if the close operation causes the menu stack to become empty. */
78
+ focusNextOnEmpty?: FocusNext;
79
+ /** Whether to focus the parent trigger after closing the menu. */
80
+ focusParentTrigger?: boolean;
81
+ }
82
+ /** Event dispatched when a menu is closed. */
83
+ interface MenuStackCloseEvent {
84
+ /** The menu being closed. */
85
+ item: MenuStackItem;
86
+ /** Whether to focus the parent trigger after closing the menu. */
87
+ focusParentTrigger?: boolean;
88
+ }
31
89
  /**
32
- * A directive that opens a menu when a user right-clicks within its host element.
33
- * It is aware of nested context menus and will trigger only the lowest level non-disabled context menu.
90
+ * MenuStack allows subscribers to listen for close events (when a MenuStackItem is popped off
91
+ * of the stack) in order to perform closing actions. Upon the MenuStack being empty it emits
92
+ * from the `empty` observable specifying the next focus action which the listener should perform
93
+ * as requested by the closer.
34
94
  */
35
- export declare class CdkContextMenuTrigger extends CdkMenuTriggerBase implements OnDestroy {
36
- /** The CDK overlay service. */
37
- private readonly _overlay;
38
- /** The directionality of the page. */
39
- private readonly _directionality;
40
- /** The app's context menu tracking registry */
41
- private readonly _contextMenuTracker;
42
- private readonly _changeDetectorRef;
43
- /** Whether the context menu is disabled. */
44
- disabled: boolean;
45
- constructor();
95
+ declare class MenuStack {
96
+ /** The ID of this menu stack. */
97
+ readonly id: string;
98
+ /** All MenuStackItems tracked by this MenuStack. */
99
+ private readonly _elements;
100
+ /** Emits the element which was popped off of the stack when requested by a closer. */
101
+ private readonly _close;
102
+ /** Emits once the MenuStack has become empty after popping off elements. */
103
+ private readonly _empty;
104
+ /** Emits whether any menu in the menu stack has focus. */
105
+ private readonly _hasFocus;
106
+ /** Observable which emits the MenuStackItem which has been requested to close. */
107
+ readonly closed: Observable<MenuStackCloseEvent>;
108
+ /** Observable which emits whether any menu in the menu stack has focus. */
109
+ readonly hasFocus: Observable<boolean>;
46
110
  /**
47
- * Open the attached menu at the specified location.
48
- * @param coordinates where to open the context menu
111
+ * Observable which emits when the MenuStack is empty after popping off the last element. It
112
+ * emits a FocusNext event which specifies the action the closer has requested the listener
113
+ * perform.
49
114
  */
50
- open(coordinates: ContextMenuCoordinates): void;
51
- /** Close the currently opened context menu. */
52
- close(): void;
115
+ readonly emptied: Observable<FocusNext | undefined>;
53
116
  /**
54
- * Open the context menu and closes any previously open menus.
55
- * @param event the mouse event which opens the context menu.
117
+ * Whether the inline menu associated with this menu stack is vertical or horizontal.
118
+ * `null` indicates there is no inline menu associated with this menu stack.
56
119
  */
57
- _openOnContextMenu(event: MouseEvent): void;
120
+ private _inlineMenuOrientation;
121
+ /** Creates a menu stack that originates from an inline menu. */
122
+ static inline(orientation: 'vertical' | 'horizontal'): MenuStack;
58
123
  /**
59
- * Get the configuration object used to create the overlay.
60
- * @param coordinates the location to place the opened menu
124
+ * Adds an item to the menu stack.
125
+ * @param menu the MenuStackItem to put on the stack.
61
126
  */
62
- private _getOverlayConfig;
127
+ push(menu: MenuStackItem): void;
63
128
  /**
64
- * Get the position strategy for the overlay which specifies where to place the menu.
65
- * @param coordinates the location to place the opened menu
129
+ * Pop items off of the stack up to and including `lastItem` and emit each on the close
130
+ * observable. If the stack is empty or `lastItem` is not on the stack it does nothing.
131
+ * @param lastItem the last item to pop off the stack.
132
+ * @param options Options that configure behavior on close.
66
133
  */
67
- private _getOverlayPositionStrategy;
68
- /** Subscribe to the menu stack close events and close this menu when requested. */
69
- private _setMenuStackCloseListener;
134
+ close(lastItem: MenuStackItem, options?: CloseOptions): void;
70
135
  /**
71
- * Subscribe to the overlays outside pointer events stream and handle closing out the stack if a
72
- * click occurs outside the menus.
73
- * @param userEvent User-generated event that opened the menu.
136
+ * Pop items off of the stack up to but excluding `lastItem` and emit each on the close
137
+ * observable. If the stack is empty or `lastItem` is not on the stack it does nothing.
138
+ * @param lastItem the element which should be left on the stack
139
+ * @return whether or not an item was removed from the stack
74
140
  */
75
- private _subscribeToOutsideClicks;
141
+ closeSubMenuOf(lastItem: MenuStackItem): boolean;
76
142
  /**
77
- * Open the attached menu at the specified location.
78
- * @param userEvent User-generated event that opened the menu
79
- * @param coordinates where to open the context menu
143
+ * Pop off all MenuStackItems and emit each one on the `close` observable one by one.
144
+ * @param options Options that configure behavior on close.
80
145
  */
81
- private _open;
82
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkContextMenuTrigger, never>;
83
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkContextMenuTrigger, "[cdkContextMenuTriggerFor]", ["cdkContextMenuTriggerFor"], { "menuTemplateRef": { "alias": "cdkContextMenuTriggerFor"; "required": false; }; "menuPosition": { "alias": "cdkContextMenuPosition"; "required": false; }; "menuData": { "alias": "cdkContextMenuTriggerData"; "required": false; }; "disabled": { "alias": "cdkContextMenuDisabled"; "required": false; }; }, { "opened": "cdkContextMenuOpened"; "closed": "cdkContextMenuClosed"; }, never, never, true, never>;
84
- static ngAcceptInputType_disabled: unknown;
146
+ closeAll(options?: CloseOptions): void;
147
+ /** Return true if this stack is empty. */
148
+ isEmpty(): boolean;
149
+ /** Return the length of the stack. */
150
+ length(): number;
151
+ /** Get the top most element on the stack. */
152
+ peek(): MenuStackItem | undefined;
153
+ /** Whether the menu stack is associated with an inline menu. */
154
+ hasInlineMenu(): boolean;
155
+ /** The orientation of the associated inline menu. */
156
+ inlineMenuOrientation(): "vertical" | "horizontal" | null;
157
+ /** Sets whether the menu stack contains the focused element. */
158
+ setHasFocus(hasFocus: boolean): void;
159
+ static ɵfac: i0.ɵɵFactoryDeclaration<MenuStack, never>;
160
+ static ɵprov: i0.ɵɵInjectableDeclaration<MenuStack>;
161
+ }
162
+
163
+ /** Injection token used to return classes implementing the Menu interface */
164
+ declare const CDK_MENU: InjectionToken<Menu>;
165
+ /** Interface which specifies Menu operations and used to break circular dependency issues */
166
+ interface Menu extends MenuStackItem {
167
+ /** The id of the menu's host element. */
168
+ id: string;
169
+ /** The menu's native DOM host element. */
170
+ nativeElement: HTMLElement;
171
+ /** The direction items in the menu flow. */
172
+ readonly orientation: 'horizontal' | 'vertical';
173
+ /** Place focus on the first MenuItem in the menu. */
174
+ focusFirstItem(focusOrigin: FocusOrigin): void;
175
+ /** Place focus on the last MenuItem in the menu. */
176
+ focusLastItem(focusOrigin: FocusOrigin): void;
85
177
  }
86
178
 
87
179
  /**
88
- * Directive which configures the element as a Menu which should contain child elements marked as
89
- * CdkMenuItem or CdkMenuGroup. Sets the appropriate role and aria-attributes for a menu and
90
- * contains accessible keyboard and mouse handling logic.
91
- *
92
- * It also acts as a RadioGroup for elements marked with role `menuitemradio`.
180
+ * MenuAim is responsible for determining if a sibling menuitem's menu should be closed when a
181
+ * Toggler item is hovered into. It is up to the hovered in item to call the MenuAim service in
182
+ * order to determine if it may perform its close actions.
93
183
  */
94
- export declare class CdkMenu extends CdkMenuBase implements AfterContentInit, OnDestroy {
95
- private _parentTrigger;
96
- /** Event emitted when the menu is closed. */
97
- readonly closed: EventEmitter<void>;
98
- /** The direction items in the menu flow. */
99
- readonly orientation = "vertical";
100
- /** Whether the menu is displayed inline (i.e. always present vs a conditional popup that the user triggers with a trigger element). */
101
- readonly isInline: boolean;
102
- constructor();
103
- ngAfterContentInit(): void;
104
- ngOnDestroy(): void;
184
+ interface MenuAim {
105
185
  /**
106
- * Handle keyboard events for the Menu.
107
- * @param event The keyboard event to be handled.
186
+ * Set the Menu and its PointerFocusTracker.
187
+ * @param menu The menu that this menu aim service controls.
188
+ * @param pointerTracker The `PointerFocusTracker` for the given menu.
108
189
  */
109
- _handleKeyEvent(event: KeyboardEvent): void;
190
+ initialize(menu: Menu, pointerTracker: PointerFocusTracker<FocusableElement & Toggler>): void;
110
191
  /**
111
- * Set focus the either the current, previous or next item based on the FocusNext event.
112
- * @param focusNext The element to focus.
192
+ * Calls the `doToggle` callback when it is deemed that the user is not moving towards
193
+ * the submenu.
194
+ * @param doToggle the function called when the user is not moving towards the submenu.
113
195
  */
114
- private _toggleMenuFocus;
115
- /** Subscribe to the MenuStack emptied events. */
116
- private _subscribeToMenuStackEmptied;
117
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenu, never>;
118
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenu, "[cdkMenu]", ["cdkMenu"], {}, { "closed": "closed"; }, never, never, true, never>;
196
+ toggle(doToggle: () => void): void;
197
+ }
198
+ /** Injection token used for an implementation of MenuAim. */
199
+ declare const MENU_AIM: InjectionToken<MenuAim>;
200
+ /** An element which when hovered over may open or close a menu. */
201
+ interface Toggler {
202
+ /** Gets the open menu, or undefined if no menu is open. */
203
+ getMenu(): Menu | undefined;
119
204
  }
120
-
121
205
  /**
122
- * Directive applied to an element which configures it as a MenuBar by setting the appropriate
123
- * role, aria attributes, and accessible keyboard and mouse handling logic. The component that
124
- * this directive is applied to should contain components marked with CdkMenuItem.
206
+ * TargetMenuAim predicts if a user is moving into a submenu. It calculates the
207
+ * trajectory of the user's mouse movement in the current menu to determine if the
208
+ * mouse is moving towards an open submenu.
125
209
  *
210
+ * The determination is made by calculating the slope of the users last NUM_POINTS moves where each
211
+ * pair of points determines if the trajectory line points into the submenu. It uses consensus
212
+ * approach by checking if at least NUM_POINTS / 2 pairs determine that the user is moving towards
213
+ * to submenu.
126
214
  */
127
- export declare class CdkMenuBar extends CdkMenuBase implements AfterContentInit {
128
- /** The direction items in the menu flow. */
129
- readonly orientation = "horizontal";
130
- /** Whether the menu is displayed inline (i.e. always present vs a conditional popup that the user triggers with a trigger element). */
131
- readonly isInline = true;
132
- ngAfterContentInit(): void;
215
+ declare class TargetMenuAim implements MenuAim, OnDestroy {
216
+ private readonly _ngZone;
217
+ private readonly _renderer;
218
+ private _cleanupMousemove;
219
+ /** The last NUM_POINTS mouse move events. */
220
+ private readonly _points;
221
+ /** Reference to the root menu in which we are tracking mouse moves. */
222
+ private _menu;
223
+ /** Reference to the root menu's mouse manager. */
224
+ private _pointerTracker;
225
+ /** The id associated with the current timeout call waiting to resolve. */
226
+ private _timeoutId;
227
+ /** Emits when this service is destroyed. */
228
+ private readonly _destroyed;
229
+ ngOnDestroy(): void;
133
230
  /**
134
- * Handle keyboard events for the Menu.
135
- * @param event The keyboard event to be handled.
231
+ * Set the Menu and its PointerFocusTracker.
232
+ * @param menu The menu that this menu aim service controls.
233
+ * @param pointerTracker The `PointerFocusTracker` for the given menu.
136
234
  */
137
- _handleKeyEvent(event: KeyboardEvent): void;
235
+ initialize(menu: Menu, pointerTracker: PointerFocusTracker<FocusableElement & Toggler>): void;
138
236
  /**
139
- * Set focus to either the current, previous or next item based on the FocusNext event, then
140
- * open the previous or next item.
141
- * @param focusNext The element to focus.
237
+ * Calls the `doToggle` callback when it is deemed that the user is not moving towards
238
+ * the submenu.
239
+ * @param doToggle the function called when the user is not moving towards the submenu.
142
240
  */
143
- private _toggleOpenMenu;
144
- /** Subscribe to the MenuStack emptied events. */
145
- private _subscribeToMenuStackEmptied;
146
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuBar, never>;
147
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuBar, "[cdkMenuBar]", ["cdkMenuBar"], {}, {}, never, never, true, never>;
241
+ toggle(doToggle: () => void): void;
242
+ /**
243
+ * Start the delayed toggle handler if one isn't running already.
244
+ *
245
+ * The delayed toggle handler executes the `doToggle` callback after some period of time iff the
246
+ * users mouse is on an item in the current menu.
247
+ *
248
+ * @param doToggle the function called when the user is not moving towards the submenu.
249
+ */
250
+ private _startTimeout;
251
+ /** Whether the user is heading towards the open submenu. */
252
+ private _isMovingToSubmenu;
253
+ /** Get the bounding DOMRect for the open submenu. */
254
+ private _getSubmenuBounds;
255
+ /**
256
+ * Check if a reference to the PointerFocusTracker and menu element is provided.
257
+ * @throws an error if neither reference is provided.
258
+ */
259
+ private _checkConfigured;
260
+ /** Subscribe to the root menus mouse move events and update the tracked mouse points. */
261
+ private _subscribeToMouseMoves;
262
+ static ɵfac: i0.ɵɵFactoryDeclaration<TargetMenuAim, never>;
263
+ static ɵprov: i0.ɵɵInjectableDeclaration<TargetMenuAim>;
264
+ }
265
+ /**
266
+ * CdkTargetMenuAim is a provider for the TargetMenuAim service. It can be added to an
267
+ * element with either the `cdkMenu` or `cdkMenuBar` directive and child menu items.
268
+ */
269
+ declare class CdkTargetMenuAim {
270
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkTargetMenuAim, never>;
271
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkTargetMenuAim, "[cdkTargetMenuAim]", ["cdkTargetMenuAim"], {}, {}, never, never, true, never>;
148
272
  }
149
273
 
150
274
  /**
151
- * Abstract directive that implements shared logic common to all menus.
152
- * This class can be extended to create custom menu types.
275
+ * A grouping container for `CdkMenuItemRadio` instances, similar to a `role="radiogroup"` element.
153
276
  */
154
- export declare abstract class CdkMenuBase extends CdkMenuGroup implements Menu, AfterContentInit, OnDestroy {
155
- private _focusMonitor;
156
- protected ngZone: NgZone;
157
- private _renderer;
158
- /** The menu's native DOM host element. */
159
- readonly nativeElement: HTMLElement;
160
- /** The stack of menus this menu belongs to. */
161
- readonly menuStack: MenuStack;
162
- /** The menu aim service used by this menu. */
163
- protected readonly menuAim: MenuAim | null;
164
- /** The directionality (text direction) of the current page. */
165
- protected readonly dir: Directionality | null;
166
- /** The id of the menu's host element. */
167
- id: string;
168
- /** All child MenuItem elements nested in this Menu. */
169
- readonly items: QueryList<CdkMenuItem>;
170
- /** The direction items in the menu flow. */
171
- orientation: 'horizontal' | 'vertical';
277
+ declare class CdkMenuGroup {
278
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuGroup, never>;
279
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuGroup, "[cdkMenuGroup]", ["cdkMenuGroup"], {}, {}, never, never, true, never>;
280
+ }
281
+
282
+ /** Injection token used for an implementation of MenuStack. */
283
+ declare const MENU_TRIGGER: InjectionToken<CdkMenuTriggerBase>;
284
+ /** Injection token used to configure the behavior of the menu when the page is scrolled. */
285
+ declare const MENU_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;
286
+ /**
287
+ * Abstract directive that implements shared logic common to all menu triggers.
288
+ * This class can be extended to create custom menu trigger types.
289
+ */
290
+ declare abstract class CdkMenuTriggerBase implements OnDestroy {
291
+ /** The DI injector for this component. */
292
+ readonly injector: Injector;
293
+ /** The view container ref for this component */
294
+ protected readonly viewContainerRef: ViewContainerRef;
295
+ /** The menu stack in which this menu resides. */
296
+ protected readonly menuStack: MenuStack;
297
+ /** Function used to configure the scroll strategy for the menu. */
298
+ protected readonly menuScrollStrategy: () => ScrollStrategy;
172
299
  /**
173
- * Whether the menu is displayed inline (i.e. always present vs a conditional popup that the
174
- * user triggers with a trigger element).
300
+ * A list of preferred menu positions to be used when constructing the
301
+ * `FlexibleConnectedPositionStrategy` for this trigger's menu.
175
302
  */
176
- isInline: boolean;
177
- /** Handles keyboard events for the menu. */
178
- protected keyManager: FocusKeyManager<CdkMenuItem>;
179
- /** Emits when the MenuBar is destroyed. */
303
+ menuPosition: ConnectedPosition[];
304
+ /** Emits when the attached menu is requested to open */
305
+ readonly opened: EventEmitter<void>;
306
+ /** Emits when the attached menu is requested to close */
307
+ readonly closed: EventEmitter<void>;
308
+ /** Template reference variable to the menu this trigger opens */
309
+ menuTemplateRef: TemplateRef<unknown> | null;
310
+ /** Context data to be passed along to the menu template */
311
+ menuData: unknown;
312
+ /** A reference to the overlay which manages the triggered menu */
313
+ protected overlayRef: OverlayRef | null;
314
+ /** Emits when this trigger is destroyed. */
180
315
  protected readonly destroyed: Subject<void>;
181
- /** The Menu Item which triggered the open submenu. */
182
- protected triggerItem?: CdkMenuItem;
183
- /** Tracks the users mouse movements over the menu. */
184
- protected pointerTracker?: PointerFocusTracker<CdkMenuItem>;
185
- /** Whether this menu's menu stack has focus. */
186
- private _menuStackHasFocus;
187
- private _tabIndexSignal;
188
- ngAfterContentInit(): void;
316
+ /** Emits when the outside pointer events listener on the overlay should be stopped. */
317
+ protected readonly stopOutsideClicksListener: rxjs.Observable<void>;
318
+ /** The child menu opened by this trigger. */
319
+ protected childMenu?: Menu;
320
+ /** The content of the menu panel opened by this trigger. */
321
+ private _menuPortal;
322
+ /** The injector to use for the child menu opened by this trigger. */
323
+ private _childMenuInjector?;
189
324
  ngOnDestroy(): void;
325
+ /** Whether the attached menu is open. */
326
+ isOpen(): boolean;
327
+ /** Registers a child menu as having been opened by this trigger. */
328
+ registerChildMenu(child: Menu): void;
190
329
  /**
191
- * Place focus on the first MenuItem in the menu and set the focus origin.
192
- * @param focusOrigin The origin input mode of the focus event.
330
+ * Get the portal to be attached to the overlay which contains the menu. Allows for the menu
331
+ * content to change dynamically and be reflected in the application.
193
332
  */
194
- focusFirstItem(focusOrigin?: FocusOrigin): void;
333
+ protected getMenuContentPortal(): TemplatePortal<any>;
195
334
  /**
196
- * Place focus on the last MenuItem in the menu and set the focus origin.
197
- * @param focusOrigin The origin input mode of the focus event.
335
+ * Whether the given element is inside the scope of this trigger's menu stack.
336
+ * @param element The element to check.
337
+ * @return Whether the element is inside the scope of this trigger's menu stack.
198
338
  */
199
- focusLastItem(focusOrigin?: FocusOrigin): void;
200
- /** Gets the tabindex for this menu. */
201
- _getTabIndex(): 0 | -1 | null;
339
+ protected isElementInsideMenuStack(element: Element): boolean;
340
+ /** Destroy and unset the overlay reference it if exists */
341
+ private _destroyOverlay;
342
+ /** Gets the injector to use when creating a child menu. */
343
+ private _getChildMenuInjector;
344
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuTriggerBase, never>;
345
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuTriggerBase, never, never, {}, {}, never, never, true, never>;
346
+ }
347
+
348
+ /**
349
+ * A directive that turns its host element into a trigger for a popup menu.
350
+ * It can be combined with cdkMenuItem to create sub-menus. If the element is in a top level
351
+ * MenuBar it will open the menu on click, or if a sibling is already opened it will open on hover.
352
+ * If it is inside of a Menu it will open the attached Submenu on hover regardless of its sibling
353
+ * state.
354
+ */
355
+ declare class CdkMenuTrigger extends CdkMenuTriggerBase implements OnChanges, OnDestroy {
356
+ private readonly _elementRef;
357
+ private readonly _overlay;
358
+ private readonly _ngZone;
359
+ private readonly _changeDetectorRef;
360
+ private readonly _inputModalityDetector;
361
+ private readonly _directionality;
362
+ private readonly _renderer;
363
+ private _cleanupMouseenter;
364
+ /** The parent menu this trigger belongs to. */
365
+ private readonly _parentMenu;
366
+ /** The menu aim service used by this menu. */
367
+ private readonly _menuAim;
368
+ constructor();
369
+ /** Toggle the attached menu. */
370
+ toggle(): void;
371
+ /** Open the attached menu. */
372
+ open(): void;
373
+ /** Close the opened menu. */
374
+ close(): void;
202
375
  /**
203
- * Close the open menu if the current active item opened the requested MenuStackItem.
204
- * @param menu The menu requested to be closed.
205
- * @param options Options to configure the behavior on close.
206
- * - `focusParentTrigger` Whether to focus the parent trigger after closing the menu.
376
+ * Get a reference to the rendered Menu if the Menu is open and rendered in the DOM.
207
377
  */
208
- protected closeOpenMenu(menu: MenuStackItem, options?: {
209
- focusParentTrigger?: boolean;
210
- }): void;
211
- /** Setup the FocusKeyManager with the correct orientation for the menu. */
212
- private _setKeyManager;
378
+ getMenu(): Menu | undefined;
379
+ ngOnChanges(changes: SimpleChanges): void;
380
+ ngOnDestroy(): void;
213
381
  /**
214
- * Subscribe to the menu trigger's open events in order to track the trigger which opened the menu
215
- * and stop tracking it when the menu is closed.
382
+ * Handles keyboard events for the menu item.
383
+ * @param event The keyboard event to handle
216
384
  */
217
- private _subscribeToMenuOpen;
218
- /** Subscribe to the MenuStack close events. */
219
- private _subscribeToMenuStackClosed;
220
- /** Subscribe to the MenuStack hasFocus events. */
221
- private _subscribeToMenuStackHasFocus;
385
+ _toggleOnKeydown(event: KeyboardEvent): void;
386
+ /** Handles clicks on the menu trigger. */
387
+ _handleClick(): void;
222
388
  /**
223
- * Set the PointerFocusTracker and ensure that when mouse focus changes the key manager is updated
224
- * with the latest menu item under mouse focus.
389
+ * Sets whether the trigger's menu stack has focus.
390
+ * @param hasFocus Whether the menu stack has focus.
225
391
  */
226
- private _setUpPointerTracker;
227
- /** Handles focus landing on the host element of the menu. */
228
- private _handleFocus;
229
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuBase, never>;
230
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuBase, never, never, { "id": { "alias": "id"; "required": false; }; }, {}, ["items"], never, true, never>;
231
- }
232
-
233
- /**
234
- * A grouping container for `CdkMenuItemRadio` instances, similar to a `role="radiogroup"` element.
235
- */
236
- export declare class CdkMenuGroup {
237
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuGroup, never>;
238
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuGroup, "[cdkMenuGroup]", ["cdkMenuGroup"], {}, {}, never, never, true, never>;
392
+ _setHasFocus(hasFocus: boolean): void;
393
+ /**
394
+ * Subscribe to the mouseenter events and close any sibling menu items if this element is moused
395
+ * into.
396
+ */
397
+ private _subscribeToMouseEnter;
398
+ /** Close out any sibling menu trigger menus. */
399
+ private _closeSiblingTriggers;
400
+ /** Get the configuration object used to create the overlay. */
401
+ private _getOverlayConfig;
402
+ /** Build the position strategy for the overlay which specifies where to place the menu. */
403
+ private _getOverlayPositionStrategy;
404
+ /** Get the preferred positions for the opened menu relative to the menu item. */
405
+ private _getOverlayPositions;
406
+ /**
407
+ * Subscribe to the MenuStack close events if this is a standalone trigger and close out the menu
408
+ * this triggers when requested.
409
+ */
410
+ private _registerCloseHandler;
411
+ /**
412
+ * Subscribe to the overlays outside pointer events stream and handle closing out the stack if a
413
+ * click occurs outside the menus.
414
+ */
415
+ private _subscribeToOutsideClicks;
416
+ /** Subscribe to the MenuStack hasFocus events. */
417
+ private _subscribeToMenuStackHasFocus;
418
+ /** Subscribe to the MenuStack closed events. */
419
+ private _subscribeToMenuStackClosed;
420
+ /** Sets the role attribute for this trigger if needed. */
421
+ private _setRole;
422
+ /** Sets thte `type` attribute of the trigger. */
423
+ private _setType;
424
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuTrigger, never>;
425
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuTrigger, "[cdkMenuTriggerFor]", ["cdkMenuTriggerFor"], { "menuTemplateRef": { "alias": "cdkMenuTriggerFor"; "required": false; }; "menuPosition": { "alias": "cdkMenuPosition"; "required": false; }; "menuData": { "alias": "cdkMenuTriggerData"; "required": false; }; }, { "opened": "cdkMenuOpened"; "closed": "cdkMenuClosed"; }, never, never, true, never>;
239
426
  }
240
427
 
241
428
  /**
@@ -243,7 +430,7 @@ export declare class CdkMenuGroup {
243
430
  * keyboard when residing in a CdkMenu, CdkMenuBar, or CdkMenuGroup. It performs user defined
244
431
  * behavior when clicked.
245
432
  */
246
- export declare class CdkMenuItem implements FocusableOption, FocusableElement, Toggler, OnDestroy {
433
+ declare class CdkMenuItem implements FocusableOption, FocusableElement, Toggler, OnDestroy {
247
434
  protected readonly _dir: Directionality | null;
248
435
  readonly _elementRef: ElementRef<HTMLElement>;
249
436
  protected _ngZone: NgZone;
@@ -349,20 +536,160 @@ export declare class CdkMenuItem implements FocusableOption, FocusableElement, T
349
536
  }
350
537
 
351
538
  /**
352
- * A directive providing behavior for the "menuitemcheckbox" ARIA role, which behaves similarly to a
353
- * conventional checkbox.
539
+ * Abstract directive that implements shared logic common to all menus.
540
+ * This class can be extended to create custom menu types.
354
541
  */
355
- export declare class CdkMenuItemCheckbox extends CdkMenuItemSelectable {
542
+ declare abstract class CdkMenuBase extends CdkMenuGroup implements Menu, AfterContentInit, OnDestroy {
543
+ private _focusMonitor;
544
+ protected ngZone: NgZone;
545
+ private _renderer;
546
+ /** The menu's native DOM host element. */
547
+ readonly nativeElement: HTMLElement;
548
+ /** The stack of menus this menu belongs to. */
549
+ readonly menuStack: MenuStack;
550
+ /** The menu aim service used by this menu. */
551
+ protected readonly menuAim: MenuAim | null;
552
+ /** The directionality (text direction) of the current page. */
553
+ protected readonly dir: Directionality | null;
554
+ /** The id of the menu's host element. */
555
+ id: string;
556
+ /** All child MenuItem elements nested in this Menu. */
557
+ readonly items: QueryList<CdkMenuItem>;
558
+ /** The direction items in the menu flow. */
559
+ orientation: 'horizontal' | 'vertical';
356
560
  /**
357
- * Toggle the checked state of the checkbox.
358
- * @param options Options the configure how the item is triggered
359
- * - keepOpen: specifies that the menu should be kept open after triggering the item.
561
+ * Whether the menu is displayed inline (i.e. always present vs a conditional popup that the
562
+ * user triggers with a trigger element).
360
563
  */
361
- trigger(options?: {
362
- keepOpen: boolean;
564
+ isInline: boolean;
565
+ /** Handles keyboard events for the menu. */
566
+ protected keyManager: FocusKeyManager<CdkMenuItem>;
567
+ /** Emits when the MenuBar is destroyed. */
568
+ protected readonly destroyed: Subject<void>;
569
+ /** The Menu Item which triggered the open submenu. */
570
+ protected triggerItem?: CdkMenuItem;
571
+ /** Tracks the users mouse movements over the menu. */
572
+ protected pointerTracker?: PointerFocusTracker<CdkMenuItem>;
573
+ /** Whether this menu's menu stack has focus. */
574
+ private _menuStackHasFocus;
575
+ private _tabIndexSignal;
576
+ ngAfterContentInit(): void;
577
+ ngOnDestroy(): void;
578
+ /**
579
+ * Place focus on the first MenuItem in the menu and set the focus origin.
580
+ * @param focusOrigin The origin input mode of the focus event.
581
+ */
582
+ focusFirstItem(focusOrigin?: FocusOrigin): void;
583
+ /**
584
+ * Place focus on the last MenuItem in the menu and set the focus origin.
585
+ * @param focusOrigin The origin input mode of the focus event.
586
+ */
587
+ focusLastItem(focusOrigin?: FocusOrigin): void;
588
+ /** Gets the tabindex for this menu. */
589
+ _getTabIndex(): 0 | -1 | null;
590
+ /**
591
+ * Close the open menu if the current active item opened the requested MenuStackItem.
592
+ * @param menu The menu requested to be closed.
593
+ * @param options Options to configure the behavior on close.
594
+ * - `focusParentTrigger` Whether to focus the parent trigger after closing the menu.
595
+ */
596
+ protected closeOpenMenu(menu: MenuStackItem, options?: {
597
+ focusParentTrigger?: boolean;
363
598
  }): void;
364
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuItemCheckbox, never>;
365
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuItemCheckbox, "[cdkMenuItemCheckbox]", ["cdkMenuItemCheckbox"], {}, {}, never, never, true, never>;
599
+ /** Setup the FocusKeyManager with the correct orientation for the menu. */
600
+ private _setKeyManager;
601
+ /**
602
+ * Subscribe to the menu trigger's open events in order to track the trigger which opened the menu
603
+ * and stop tracking it when the menu is closed.
604
+ */
605
+ private _subscribeToMenuOpen;
606
+ /** Subscribe to the MenuStack close events. */
607
+ private _subscribeToMenuStackClosed;
608
+ /** Subscribe to the MenuStack hasFocus events. */
609
+ private _subscribeToMenuStackHasFocus;
610
+ /**
611
+ * Set the PointerFocusTracker and ensure that when mouse focus changes the key manager is updated
612
+ * with the latest menu item under mouse focus.
613
+ */
614
+ private _setUpPointerTracker;
615
+ /** Handles focus landing on the host element of the menu. */
616
+ private _handleFocus;
617
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuBase, never>;
618
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuBase, never, never, { "id": { "alias": "id"; "required": false; }; }, {}, ["items"], never, true, never>;
619
+ }
620
+
621
+ /**
622
+ * Directive applied to an element which configures it as a MenuBar by setting the appropriate
623
+ * role, aria attributes, and accessible keyboard and mouse handling logic. The component that
624
+ * this directive is applied to should contain components marked with CdkMenuItem.
625
+ *
626
+ */
627
+ declare class CdkMenuBar extends CdkMenuBase implements AfterContentInit {
628
+ /** The direction items in the menu flow. */
629
+ readonly orientation = "horizontal";
630
+ /** Whether the menu is displayed inline (i.e. always present vs a conditional popup that the user triggers with a trigger element). */
631
+ readonly isInline = true;
632
+ ngAfterContentInit(): void;
633
+ /**
634
+ * Handle keyboard events for the Menu.
635
+ * @param event The keyboard event to be handled.
636
+ */
637
+ _handleKeyEvent(event: KeyboardEvent): void;
638
+ /**
639
+ * Set focus to either the current, previous or next item based on the FocusNext event, then
640
+ * open the previous or next item.
641
+ * @param focusNext The element to focus.
642
+ */
643
+ private _toggleOpenMenu;
644
+ /** Subscribe to the MenuStack emptied events. */
645
+ private _subscribeToMenuStackEmptied;
646
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuBar, never>;
647
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuBar, "[cdkMenuBar]", ["cdkMenuBar"], {}, {}, never, never, true, never>;
648
+ }
649
+
650
+ /**
651
+ * Directive which configures the element as a Menu which should contain child elements marked as
652
+ * CdkMenuItem or CdkMenuGroup. Sets the appropriate role and aria-attributes for a menu and
653
+ * contains accessible keyboard and mouse handling logic.
654
+ *
655
+ * It also acts as a RadioGroup for elements marked with role `menuitemradio`.
656
+ */
657
+ declare class CdkMenu extends CdkMenuBase implements AfterContentInit, OnDestroy {
658
+ private _parentTrigger;
659
+ /** Event emitted when the menu is closed. */
660
+ readonly closed: EventEmitter<void>;
661
+ /** The direction items in the menu flow. */
662
+ readonly orientation = "vertical";
663
+ /** Whether the menu is displayed inline (i.e. always present vs a conditional popup that the user triggers with a trigger element). */
664
+ readonly isInline: boolean;
665
+ constructor();
666
+ ngAfterContentInit(): void;
667
+ ngOnDestroy(): void;
668
+ /**
669
+ * Handle keyboard events for the Menu.
670
+ * @param event The keyboard event to be handled.
671
+ */
672
+ _handleKeyEvent(event: KeyboardEvent): void;
673
+ /**
674
+ * Set focus the either the current, previous or next item based on the FocusNext event.
675
+ * @param focusNext The element to focus.
676
+ */
677
+ private _toggleMenuFocus;
678
+ /** Subscribe to the MenuStack emptied events. */
679
+ private _subscribeToMenuStackEmptied;
680
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenu, never>;
681
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenu, "[cdkMenu]", ["cdkMenu"], {}, { "closed": "closed"; }, never, never, true, never>;
682
+ }
683
+
684
+ /** Base class providing checked state for selectable MenuItems. */
685
+ declare abstract class CdkMenuItemSelectable extends CdkMenuItem {
686
+ /** Whether the element is checked */
687
+ checked: boolean;
688
+ /** Whether the item should close the menu if triggered by the spacebar. */
689
+ protected closeOnSpacebarTrigger: boolean;
690
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuItemSelectable, never>;
691
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuItemSelectable, never, never, { "checked": { "alias": "cdkMenuItemChecked"; "required": false; }; }, {}, never, never, true, never>;
692
+ static ngAcceptInputType_checked: unknown;
366
693
  }
367
694
 
368
695
  /**
@@ -370,7 +697,7 @@ export declare class CdkMenuItemCheckbox extends CdkMenuItemSelectable {
370
697
  * a conventional radio-button. Any sibling `CdkMenuItemRadio` instances within the same `CdkMenu`
371
698
  * or `CdkMenuGroup` comprise a radio group with unique selection enforced.
372
699
  */
373
- export declare class CdkMenuItemRadio extends CdkMenuItemSelectable implements OnDestroy {
700
+ declare class CdkMenuItemRadio extends CdkMenuItemSelectable implements OnDestroy {
374
701
  /** The unique selection dispatcher for this radio's `CdkMenuGroup`. */
375
702
  private readonly _selectionDispatcher;
376
703
  /** An ID to identify this radio item to the `UniqueSelectionDispatcher`. */
@@ -393,514 +720,101 @@ export declare class CdkMenuItemRadio extends CdkMenuItemSelectable implements O
393
720
  static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuItemRadio, "[cdkMenuItemRadio]", ["cdkMenuItemRadio"], {}, {}, never, never, true, never>;
394
721
  }
395
722
 
396
- /** Base class providing checked state for selectable MenuItems. */
397
- export declare abstract class CdkMenuItemSelectable extends CdkMenuItem {
398
- /** Whether the element is checked */
399
- checked: boolean;
400
- /** Whether the item should close the menu if triggered by the spacebar. */
401
- protected closeOnSpacebarTrigger: boolean;
402
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuItemSelectable, never>;
403
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuItemSelectable, never, never, { "checked": { "alias": "cdkMenuItemChecked"; "required": false; }; }, {}, never, never, true, never>;
404
- static ngAcceptInputType_checked: unknown;
723
+ /**
724
+ * A directive providing behavior for the "menuitemcheckbox" ARIA role, which behaves similarly to a
725
+ * conventional checkbox.
726
+ */
727
+ declare class CdkMenuItemCheckbox extends CdkMenuItemSelectable {
728
+ /**
729
+ * Toggle the checked state of the checkbox.
730
+ * @param options Options the configure how the item is triggered
731
+ * - keepOpen: specifies that the menu should be kept open after triggering the item.
732
+ */
733
+ trigger(options?: {
734
+ keepOpen: boolean;
735
+ }): void;
736
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuItemCheckbox, never>;
737
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuItemCheckbox, "[cdkMenuItemCheckbox]", ["cdkMenuItemCheckbox"], {}, {}, never, never, true, never>;
405
738
  }
406
739
 
407
- /** Module that declares components and directives for the CDK menu. */
408
- export declare class CdkMenuModule {
409
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuModule, never>;
410
- static ɵmod: i0.ɵɵNgModuleDeclaration<CdkMenuModule, never, [typeof i1.OverlayModule, typeof i2.CdkMenuBar, typeof i3.CdkMenu, typeof i4.CdkMenuItem, typeof i5.CdkMenuItemRadio, typeof i6.CdkMenuItemCheckbox, typeof i7.CdkMenuTrigger, typeof i8.CdkMenuGroup, typeof i9.CdkContextMenuTrigger, typeof i10.CdkTargetMenuAim], [typeof i2.CdkMenuBar, typeof i3.CdkMenu, typeof i4.CdkMenuItem, typeof i5.CdkMenuItemRadio, typeof i6.CdkMenuItemCheckbox, typeof i7.CdkMenuTrigger, typeof i8.CdkMenuGroup, typeof i9.CdkContextMenuTrigger, typeof i10.CdkTargetMenuAim]>;
411
- static ɵinj: i0.ɵɵInjectorDeclaration<CdkMenuModule>;
740
+ /** Tracks the last open context menu trigger across the entire application. */
741
+ declare class ContextMenuTracker {
742
+ /** The last open context menu trigger. */
743
+ private static _openContextMenuTrigger?;
744
+ /**
745
+ * Close the previous open context menu and set the given one as being open.
746
+ * @param trigger The trigger for the currently open Context Menu.
747
+ */
748
+ update(trigger: CdkContextMenuTrigger): void;
749
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuTracker, never>;
750
+ static ɵprov: i0.ɵɵInjectableDeclaration<ContextMenuTracker>;
412
751
  }
413
-
752
+ /** The coordinates where the context menu should open. */
753
+ type ContextMenuCoordinates = {
754
+ x: number;
755
+ y: number;
756
+ };
414
757
  /**
415
- * A directive that turns its host element into a trigger for a popup menu.
416
- * It can be combined with cdkMenuItem to create sub-menus. If the element is in a top level
417
- * MenuBar it will open the menu on click, or if a sibling is already opened it will open on hover.
418
- * If it is inside of a Menu it will open the attached Submenu on hover regardless of its sibling
419
- * state.
758
+ * A directive that opens a menu when a user right-clicks within its host element.
759
+ * It is aware of nested context menus and will trigger only the lowest level non-disabled context menu.
420
760
  */
421
- export declare class CdkMenuTrigger extends CdkMenuTriggerBase implements OnChanges, OnDestroy {
422
- private readonly _elementRef;
761
+ declare class CdkContextMenuTrigger extends CdkMenuTriggerBase implements OnDestroy {
762
+ /** The CDK overlay service. */
423
763
  private readonly _overlay;
424
- private readonly _ngZone;
425
- private readonly _changeDetectorRef;
426
- private readonly _inputModalityDetector;
764
+ /** The directionality of the page. */
427
765
  private readonly _directionality;
428
- private readonly _renderer;
429
- private _cleanupMouseenter;
430
- /** The parent menu this trigger belongs to. */
431
- private readonly _parentMenu;
432
- /** The menu aim service used by this menu. */
433
- private readonly _menuAim;
766
+ /** The app's context menu tracking registry */
767
+ private readonly _contextMenuTracker;
768
+ private readonly _changeDetectorRef;
769
+ /** Whether the context menu is disabled. */
770
+ disabled: boolean;
434
771
  constructor();
435
- /** Toggle the attached menu. */
436
- toggle(): void;
437
- /** Open the attached menu. */
438
- open(): void;
439
- /** Close the opened menu. */
440
- close(): void;
441
- /**
442
- * Get a reference to the rendered Menu if the Menu is open and rendered in the DOM.
443
- */
444
- getMenu(): Menu | undefined;
445
- ngOnChanges(changes: SimpleChanges): void;
446
- ngOnDestroy(): void;
447
772
  /**
448
- * Handles keyboard events for the menu item.
449
- * @param event The keyboard event to handle
773
+ * Open the attached menu at the specified location.
774
+ * @param coordinates where to open the context menu
450
775
  */
451
- _toggleOnKeydown(event: KeyboardEvent): void;
452
- /** Handles clicks on the menu trigger. */
453
- _handleClick(): void;
776
+ open(coordinates: ContextMenuCoordinates): void;
777
+ /** Close the currently opened context menu. */
778
+ close(): void;
454
779
  /**
455
- * Sets whether the trigger's menu stack has focus.
456
- * @param hasFocus Whether the menu stack has focus.
780
+ * Open the context menu and closes any previously open menus.
781
+ * @param event the mouse event which opens the context menu.
457
782
  */
458
- _setHasFocus(hasFocus: boolean): void;
783
+ _openOnContextMenu(event: MouseEvent): void;
459
784
  /**
460
- * Subscribe to the mouseenter events and close any sibling menu items if this element is moused
461
- * into.
785
+ * Get the configuration object used to create the overlay.
786
+ * @param coordinates the location to place the opened menu
462
787
  */
463
- private _subscribeToMouseEnter;
464
- /** Close out any sibling menu trigger menus. */
465
- private _closeSiblingTriggers;
466
- /** Get the configuration object used to create the overlay. */
467
788
  private _getOverlayConfig;
468
- /** Build the position strategy for the overlay which specifies where to place the menu. */
469
- private _getOverlayPositionStrategy;
470
- /** Get the preferred positions for the opened menu relative to the menu item. */
471
- private _getOverlayPositions;
472
789
  /**
473
- * Subscribe to the MenuStack close events if this is a standalone trigger and close out the menu
474
- * this triggers when requested.
790
+ * Get the position strategy for the overlay which specifies where to place the menu.
791
+ * @param coordinates the location to place the opened menu
475
792
  */
476
- private _registerCloseHandler;
793
+ private _getOverlayPositionStrategy;
794
+ /** Subscribe to the menu stack close events and close this menu when requested. */
795
+ private _setMenuStackCloseListener;
477
796
  /**
478
797
  * Subscribe to the overlays outside pointer events stream and handle closing out the stack if a
479
798
  * click occurs outside the menus.
799
+ * @param userEvent User-generated event that opened the menu.
480
800
  */
481
801
  private _subscribeToOutsideClicks;
482
- /** Subscribe to the MenuStack hasFocus events. */
483
- private _subscribeToMenuStackHasFocus;
484
- /** Subscribe to the MenuStack closed events. */
485
- private _subscribeToMenuStackClosed;
486
- /** Sets the role attribute for this trigger if needed. */
487
- private _setRole;
488
- /** Sets thte `type` attribute of the trigger. */
489
- private _setType;
490
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuTrigger, never>;
491
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuTrigger, "[cdkMenuTriggerFor]", ["cdkMenuTriggerFor"], { "menuTemplateRef": { "alias": "cdkMenuTriggerFor"; "required": false; }; "menuPosition": { "alias": "cdkMenuPosition"; "required": false; }; "menuData": { "alias": "cdkMenuTriggerData"; "required": false; }; }, { "opened": "cdkMenuOpened"; "closed": "cdkMenuClosed"; }, never, never, true, never>;
492
- }
493
-
494
- /**
495
- * Abstract directive that implements shared logic common to all menu triggers.
496
- * This class can be extended to create custom menu trigger types.
497
- */
498
- export declare abstract class CdkMenuTriggerBase implements OnDestroy {
499
- /** The DI injector for this component. */
500
- readonly injector: Injector;
501
- /** The view container ref for this component */
502
- protected readonly viewContainerRef: ViewContainerRef;
503
- /** The menu stack in which this menu resides. */
504
- protected readonly menuStack: MenuStack;
505
- /** Function used to configure the scroll strategy for the menu. */
506
- protected readonly menuScrollStrategy: () => ScrollStrategy;
507
- /**
508
- * A list of preferred menu positions to be used when constructing the
509
- * `FlexibleConnectedPositionStrategy` for this trigger's menu.
510
- */
511
- menuPosition: ConnectedPosition[];
512
- /** Emits when the attached menu is requested to open */
513
- readonly opened: EventEmitter<void>;
514
- /** Emits when the attached menu is requested to close */
515
- readonly closed: EventEmitter<void>;
516
- /** Template reference variable to the menu this trigger opens */
517
- menuTemplateRef: TemplateRef<unknown> | null;
518
- /** Context data to be passed along to the menu template */
519
- menuData: unknown;
520
- /** A reference to the overlay which manages the triggered menu */
521
- protected overlayRef: OverlayRef | null;
522
- /** Emits when this trigger is destroyed. */
523
- protected readonly destroyed: Subject<void>;
524
- /** Emits when the outside pointer events listener on the overlay should be stopped. */
525
- protected readonly stopOutsideClicksListener: Observable<void>;
526
- /** The child menu opened by this trigger. */
527
- protected childMenu?: Menu;
528
- /** The content of the menu panel opened by this trigger. */
529
- private _menuPortal;
530
- /** The injector to use for the child menu opened by this trigger. */
531
- private _childMenuInjector?;
532
- ngOnDestroy(): void;
533
- /** Whether the attached menu is open. */
534
- isOpen(): boolean;
535
- /** Registers a child menu as having been opened by this trigger. */
536
- registerChildMenu(child: Menu): void;
537
- /**
538
- * Get the portal to be attached to the overlay which contains the menu. Allows for the menu
539
- * content to change dynamically and be reflected in the application.
540
- */
541
- protected getMenuContentPortal(): TemplatePortal<any>;
542
- /**
543
- * Whether the given element is inside the scope of this trigger's menu stack.
544
- * @param element The element to check.
545
- * @return Whether the element is inside the scope of this trigger's menu stack.
546
- */
547
- protected isElementInsideMenuStack(element: Element): boolean;
548
- /** Destroy and unset the overlay reference it if exists */
549
- private _destroyOverlay;
550
- /** Gets the injector to use when creating a child menu. */
551
- private _getChildMenuInjector;
552
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuTriggerBase, never>;
553
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuTriggerBase, never, never, {}, {}, never, never, true, never>;
554
- }
555
-
556
- /**
557
- * CdkTargetMenuAim is a provider for the TargetMenuAim service. It can be added to an
558
- * element with either the `cdkMenu` or `cdkMenuBar` directive and child menu items.
559
- */
560
- export declare class CdkTargetMenuAim {
561
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkTargetMenuAim, never>;
562
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkTargetMenuAim, "[cdkTargetMenuAim]", ["cdkTargetMenuAim"], {}, {}, never, never, true, never>;
563
- }
564
-
565
- /** Options that can be provided to the close or closeAll methods. */
566
- export declare interface CloseOptions {
567
- /** The element to focus next if the close operation causes the menu stack to become empty. */
568
- focusNextOnEmpty?: FocusNext;
569
- /** Whether to focus the parent trigger after closing the menu. */
570
- focusParentTrigger?: boolean;
571
- }
572
-
573
- /** The coordinates where the context menu should open. */
574
- export declare type ContextMenuCoordinates = {
575
- x: number;
576
- y: number;
577
- };
578
-
579
- /** Tracks the last open context menu trigger across the entire application. */
580
- export declare class ContextMenuTracker {
581
- /** The last open context menu trigger. */
582
- private static _openContextMenuTrigger?;
583
- /**
584
- * Close the previous open context menu and set the given one as being open.
585
- * @param trigger The trigger for the currently open Context Menu.
586
- */
587
- update(trigger: CdkContextMenuTrigger): void;
588
- static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuTracker, never>;
589
- static ɵprov: i0.ɵɵInjectableDeclaration<ContextMenuTracker>;
590
- }
591
-
592
- /** Item to track for mouse focus events. */
593
- export declare interface FocusableElement {
594
- /** A reference to the element to be tracked. */
595
- _elementRef: ElementRef<HTMLElement>;
596
- }
597
-
598
- /** The relative item in the inline menu to focus after closing all popup menus. */
599
- export declare enum FocusNext {
600
- nextItem = 0,
601
- previousItem = 1,
602
- currentItem = 2
603
- }
604
-
605
- declare namespace i10 {
606
- export {
607
- MenuAim,
608
- MENU_AIM,
609
- Toggler,
610
- TargetMenuAim,
611
- CdkTargetMenuAim
612
- }
613
- }
614
-
615
- declare namespace i2 {
616
- export {
617
- CdkMenuBar
618
- }
619
- }
620
-
621
- declare namespace i3 {
622
- export {
623
- CdkMenu
624
- }
625
- }
626
-
627
- declare namespace i4 {
628
- export {
629
- CdkMenuItem
630
- }
631
- }
632
-
633
- declare namespace i5 {
634
- export {
635
- CdkMenuItemRadio
636
- }
637
- }
638
-
639
- declare namespace i6 {
640
- export {
641
- CdkMenuItemCheckbox
642
- }
643
- }
644
-
645
- declare namespace i7 {
646
- export {
647
- CdkMenuTrigger
648
- }
649
- }
650
-
651
- declare namespace i8 {
652
- export {
653
- CdkMenuGroup
654
- }
655
- }
656
-
657
- declare namespace i9 {
658
- export {
659
- ContextMenuTracker,
660
- ContextMenuCoordinates,
661
- CdkContextMenuTrigger
662
- }
663
- }
664
-
665
- /** Interface which specifies Menu operations and used to break circular dependency issues */
666
- export declare interface Menu extends MenuStackItem {
667
- /** The id of the menu's host element. */
668
- id: string;
669
- /** The menu's native DOM host element. */
670
- nativeElement: HTMLElement;
671
- /** The direction items in the menu flow. */
672
- readonly orientation: 'horizontal' | 'vertical';
673
- /** Place focus on the first MenuItem in the menu. */
674
- focusFirstItem(focusOrigin: FocusOrigin): void;
675
- /** Place focus on the last MenuItem in the menu. */
676
- focusLastItem(focusOrigin: FocusOrigin): void;
677
- }
678
-
679
- /** Injection token used for an implementation of MenuAim. */
680
- export declare const MENU_AIM: InjectionToken<MenuAim>;
681
-
682
- /** Injection token used to configure the behavior of the menu when the page is scrolled. */
683
- export declare const MENU_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;
684
-
685
- /** Injection token used for an implementation of MenuStack. */
686
- export declare const MENU_STACK: InjectionToken<MenuStack>;
687
-
688
- /** Injection token used for an implementation of MenuStack. */
689
- export declare const MENU_TRIGGER: InjectionToken<CdkMenuTriggerBase>;
690
-
691
- /**
692
- * MenuAim is responsible for determining if a sibling menuitem's menu should be closed when a
693
- * Toggler item is hovered into. It is up to the hovered in item to call the MenuAim service in
694
- * order to determine if it may perform its close actions.
695
- */
696
- export declare interface MenuAim {
697
- /**
698
- * Set the Menu and its PointerFocusTracker.
699
- * @param menu The menu that this menu aim service controls.
700
- * @param pointerTracker The `PointerFocusTracker` for the given menu.
701
- */
702
- initialize(menu: Menu, pointerTracker: PointerFocusTracker<FocusableElement & Toggler>): void;
703
802
  /**
704
- * Calls the `doToggle` callback when it is deemed that the user is not moving towards
705
- * the submenu.
706
- * @param doToggle the function called when the user is not moving towards the submenu.
707
- */
708
- toggle(doToggle: () => void): void;
709
- }
710
-
711
- /**
712
- * MenuStack allows subscribers to listen for close events (when a MenuStackItem is popped off
713
- * of the stack) in order to perform closing actions. Upon the MenuStack being empty it emits
714
- * from the `empty` observable specifying the next focus action which the listener should perform
715
- * as requested by the closer.
716
- */
717
- export declare class MenuStack {
718
- /** The ID of this menu stack. */
719
- readonly id: string;
720
- /** All MenuStackItems tracked by this MenuStack. */
721
- private readonly _elements;
722
- /** Emits the element which was popped off of the stack when requested by a closer. */
723
- private readonly _close;
724
- /** Emits once the MenuStack has become empty after popping off elements. */
725
- private readonly _empty;
726
- /** Emits whether any menu in the menu stack has focus. */
727
- private readonly _hasFocus;
728
- /** Observable which emits the MenuStackItem which has been requested to close. */
729
- readonly closed: Observable<MenuStackCloseEvent>;
730
- /** Observable which emits whether any menu in the menu stack has focus. */
731
- readonly hasFocus: Observable<boolean>;
732
- /**
733
- * Observable which emits when the MenuStack is empty after popping off the last element. It
734
- * emits a FocusNext event which specifies the action the closer has requested the listener
735
- * perform.
736
- */
737
- readonly emptied: Observable<FocusNext | undefined>;
738
- /**
739
- * Whether the inline menu associated with this menu stack is vertical or horizontal.
740
- * `null` indicates there is no inline menu associated with this menu stack.
741
- */
742
- private _inlineMenuOrientation;
743
- /** Creates a menu stack that originates from an inline menu. */
744
- static inline(orientation: 'vertical' | 'horizontal'): MenuStack;
745
- /**
746
- * Adds an item to the menu stack.
747
- * @param menu the MenuStackItem to put on the stack.
748
- */
749
- push(menu: MenuStackItem): void;
750
- /**
751
- * Pop items off of the stack up to and including `lastItem` and emit each on the close
752
- * observable. If the stack is empty or `lastItem` is not on the stack it does nothing.
753
- * @param lastItem the last item to pop off the stack.
754
- * @param options Options that configure behavior on close.
755
- */
756
- close(lastItem: MenuStackItem, options?: CloseOptions): void;
757
- /**
758
- * Pop items off of the stack up to but excluding `lastItem` and emit each on the close
759
- * observable. If the stack is empty or `lastItem` is not on the stack it does nothing.
760
- * @param lastItem the element which should be left on the stack
761
- * @return whether or not an item was removed from the stack
762
- */
763
- closeSubMenuOf(lastItem: MenuStackItem): boolean;
764
- /**
765
- * Pop off all MenuStackItems and emit each one on the `close` observable one by one.
766
- * @param options Options that configure behavior on close.
767
- */
768
- closeAll(options?: CloseOptions): void;
769
- /** Return true if this stack is empty. */
770
- isEmpty(): boolean;
771
- /** Return the length of the stack. */
772
- length(): number;
773
- /** Get the top most element on the stack. */
774
- peek(): MenuStackItem | undefined;
775
- /** Whether the menu stack is associated with an inline menu. */
776
- hasInlineMenu(): boolean;
777
- /** The orientation of the associated inline menu. */
778
- inlineMenuOrientation(): "vertical" | "horizontal" | null;
779
- /** Sets whether the menu stack contains the focused element. */
780
- setHasFocus(hasFocus: boolean): void;
781
- static ɵfac: i0.ɵɵFactoryDeclaration<MenuStack, never>;
782
- static ɵprov: i0.ɵɵInjectableDeclaration<MenuStack>;
783
- }
784
-
785
- /** Event dispatched when a menu is closed. */
786
- export declare interface MenuStackCloseEvent {
787
- /** The menu being closed. */
788
- item: MenuStackItem;
789
- /** Whether to focus the parent trigger after closing the menu. */
790
- focusParentTrigger?: boolean;
791
- }
792
-
793
- /** A single item (menu) in the menu stack. */
794
- export declare interface MenuStackItem {
795
- /** A reference to the menu stack this menu stack item belongs to. */
796
- menuStack?: MenuStack;
797
- }
798
-
799
- /** Provider that provides the parent menu stack, or a new inline menu stack if there is no parent one. */
800
- export declare const PARENT_OR_NEW_INLINE_MENU_STACK_PROVIDER: (orientation: "vertical" | "horizontal") => {
801
- provide: InjectionToken<MenuStack>;
802
- deps: Optional[][];
803
- useFactory: (parentMenuStack?: MenuStack) => MenuStack;
804
- };
805
-
806
- /** Provider that provides the parent menu stack, or a new menu stack if there is no parent one. */
807
- export declare const PARENT_OR_NEW_MENU_STACK_PROVIDER: {
808
- provide: InjectionToken<MenuStack>;
809
- deps: Optional[][];
810
- useFactory: (parentMenuStack?: MenuStack) => MenuStack;
811
- };
812
-
813
- /**
814
- * PointerFocusTracker keeps track of the currently active item under mouse focus. It also has
815
- * observables which emit when the users mouse enters and leaves a tracked element.
816
- */
817
- export declare class PointerFocusTracker<T extends FocusableElement> {
818
- private _renderer;
819
- private readonly _items;
820
- private _eventCleanups;
821
- private _itemsSubscription;
822
- /** Emits when an element is moused into. */
823
- readonly entered: Observable<T>;
824
- /** Emits when an element is moused out. */
825
- readonly exited: Observable<T>;
826
- /** The element currently under mouse focus. */
827
- activeElement?: T;
828
- /** The element previously under mouse focus. */
829
- previousElement?: T;
830
- constructor(_renderer: Renderer2, _items: QueryList<T>);
831
- /** Stop the managers listeners. */
832
- destroy(): void;
833
- /** Binds the enter/exit events on all the items. */
834
- private _bindEvents;
835
- /** Cleans up the currently-bound events. */
836
- private _cleanupEvents;
837
- }
838
-
839
- /**
840
- * TargetMenuAim predicts if a user is moving into a submenu. It calculates the
841
- * trajectory of the user's mouse movement in the current menu to determine if the
842
- * mouse is moving towards an open submenu.
843
- *
844
- * The determination is made by calculating the slope of the users last NUM_POINTS moves where each
845
- * pair of points determines if the trajectory line points into the submenu. It uses consensus
846
- * approach by checking if at least NUM_POINTS / 2 pairs determine that the user is moving towards
847
- * to submenu.
848
- */
849
- export declare class TargetMenuAim implements MenuAim, OnDestroy {
850
- private readonly _ngZone;
851
- private readonly _renderer;
852
- private _cleanupMousemove;
853
- /** The last NUM_POINTS mouse move events. */
854
- private readonly _points;
855
- /** Reference to the root menu in which we are tracking mouse moves. */
856
- private _menu;
857
- /** Reference to the root menu's mouse manager. */
858
- private _pointerTracker;
859
- /** The id associated with the current timeout call waiting to resolve. */
860
- private _timeoutId;
861
- /** Emits when this service is destroyed. */
862
- private readonly _destroyed;
863
- ngOnDestroy(): void;
864
- /**
865
- * Set the Menu and its PointerFocusTracker.
866
- * @param menu The menu that this menu aim service controls.
867
- * @param pointerTracker The `PointerFocusTracker` for the given menu.
868
- */
869
- initialize(menu: Menu, pointerTracker: PointerFocusTracker<FocusableElement & Toggler>): void;
870
- /**
871
- * Calls the `doToggle` callback when it is deemed that the user is not moving towards
872
- * the submenu.
873
- * @param doToggle the function called when the user is not moving towards the submenu.
874
- */
875
- toggle(doToggle: () => void): void;
876
- /**
877
- * Start the delayed toggle handler if one isn't running already.
878
- *
879
- * The delayed toggle handler executes the `doToggle` callback after some period of time iff the
880
- * users mouse is on an item in the current menu.
881
- *
882
- * @param doToggle the function called when the user is not moving towards the submenu.
883
- */
884
- private _startTimeout;
885
- /** Whether the user is heading towards the open submenu. */
886
- private _isMovingToSubmenu;
887
- /** Get the bounding DOMRect for the open submenu. */
888
- private _getSubmenuBounds;
889
- /**
890
- * Check if a reference to the PointerFocusTracker and menu element is provided.
891
- * @throws an error if neither reference is provided.
803
+ * Open the attached menu at the specified location.
804
+ * @param userEvent User-generated event that opened the menu
805
+ * @param coordinates where to open the context menu
892
806
  */
893
- private _checkConfigured;
894
- /** Subscribe to the root menus mouse move events and update the tracked mouse points. */
895
- private _subscribeToMouseMoves;
896
- static ɵfac: i0.ɵɵFactoryDeclaration<TargetMenuAim, never>;
897
- static ɵprov: i0.ɵɵInjectableDeclaration<TargetMenuAim>;
807
+ private _open;
808
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkContextMenuTrigger, never>;
809
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkContextMenuTrigger, "[cdkContextMenuTriggerFor]", ["cdkContextMenuTriggerFor"], { "menuTemplateRef": { "alias": "cdkContextMenuTriggerFor"; "required": false; }; "menuPosition": { "alias": "cdkContextMenuPosition"; "required": false; }; "menuData": { "alias": "cdkContextMenuTriggerData"; "required": false; }; "disabled": { "alias": "cdkContextMenuDisabled"; "required": false; }; }, { "opened": "cdkContextMenuOpened"; "closed": "cdkContextMenuClosed"; }, never, never, true, never>;
810
+ static ngAcceptInputType_disabled: unknown;
898
811
  }
899
812
 
900
- /** An element which when hovered over may open or close a menu. */
901
- export declare interface Toggler {
902
- /** Gets the open menu, or undefined if no menu is open. */
903
- getMenu(): Menu | undefined;
813
+ /** Module that declares components and directives for the CDK menu. */
814
+ declare class CdkMenuModule {
815
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuModule, never>;
816
+ static ɵmod: i0.ɵɵNgModuleDeclaration<CdkMenuModule, never, [typeof OverlayModule, typeof CdkMenuBar, typeof CdkMenu, typeof CdkMenuItem, typeof CdkMenuItemRadio, typeof CdkMenuItemCheckbox, typeof CdkMenuTrigger, typeof CdkMenuGroup, typeof CdkContextMenuTrigger, typeof CdkTargetMenuAim], [typeof CdkMenuBar, typeof CdkMenu, typeof CdkMenuItem, typeof CdkMenuItemRadio, typeof CdkMenuItemCheckbox, typeof CdkMenuTrigger, typeof CdkMenuGroup, typeof CdkContextMenuTrigger, typeof CdkTargetMenuAim]>;
817
+ static ɵinj: i0.ɵɵInjectorDeclaration<CdkMenuModule>;
904
818
  }
905
819
 
906
- export { }
820
+ export { CDK_MENU, CdkContextMenuTrigger, CdkMenu, CdkMenuBar, CdkMenuBase, CdkMenuGroup, CdkMenuItem, CdkMenuItemCheckbox, CdkMenuItemRadio, CdkMenuItemSelectable, CdkMenuModule, CdkMenuTrigger, CdkMenuTriggerBase, CdkTargetMenuAim, type CloseOptions, type ContextMenuCoordinates, ContextMenuTracker, FocusNext, type FocusableElement, MENU_AIM, MENU_SCROLL_STRATEGY, MENU_STACK, MENU_TRIGGER, type Menu, type MenuAim, MenuStack, type MenuStackCloseEvent, type MenuStackItem, PARENT_OR_NEW_INLINE_MENU_STACK_PROVIDER, PARENT_OR_NEW_MENU_STACK_PROVIDER, PointerFocusTracker, TargetMenuAim, type Toggler };