index.d.ts 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151
  1. import { AfterContentInit } from '@angular/core';
  2. import { AfterViewInit } from '@angular/core';
  3. import { BooleanInput } from '@angular/cdk/coercion';
  4. import { ContentObserver } from '@angular/cdk/observers';
  5. import { DoCheck } from '@angular/core';
  6. import { ElementRef } from '@angular/core';
  7. import { EventEmitter } from '@angular/core';
  8. import * as i0 from '@angular/core';
  9. import * as i4 from '@angular/cdk/observers';
  10. import { InjectionToken } from '@angular/core';
  11. import { NgZone } from '@angular/core';
  12. import { Observable } from 'rxjs';
  13. import { OnChanges } from '@angular/core';
  14. import { OnDestroy } from '@angular/core';
  15. import { Platform } from '@angular/cdk/platform';
  16. import { QueryList } from '@angular/core';
  17. import { SimpleChanges } from '@angular/core';
  18. import { Subject } from 'rxjs';
  19. export declare class A11yModule {
  20. constructor(highContrastModeDetector: HighContrastModeDetector);
  21. static ɵfac: i0.ɵɵFactoryDeclaration<A11yModule, never>;
  22. static ɵmod: i0.ɵɵNgModuleDeclaration<A11yModule, [typeof i1.CdkAriaLive, typeof i2.CdkTrapFocus, typeof i3.CdkMonitorFocus], [typeof i4.ObserversModule], [typeof i1.CdkAriaLive, typeof i2.CdkTrapFocus, typeof i3.CdkMonitorFocus]>;
  23. static ɵinj: i0.ɵɵInjectorDeclaration<A11yModule>;
  24. }
  25. export declare class ActiveDescendantKeyManager<T> extends ListKeyManager<Highlightable & T> {
  26. /**
  27. * Sets the active item to the item at the specified index and adds the
  28. * active styles to the newly active item. Also removes active styles
  29. * from the previously active item.
  30. * @param index Index of the item to be set as active.
  31. */
  32. setActiveItem(index: number): void;
  33. /**
  34. * Sets the active item to the item to the specified one and adds the
  35. * active styles to the it. Also removes active styles from the
  36. * previously active item.
  37. * @param item Item to be set as active.
  38. */
  39. setActiveItem(item: T): void;
  40. }
  41. /**
  42. * Utility that creates visually hidden elements with a message content. Useful for elements that
  43. * want to use aria-describedby to further describe themselves without adding additional visual
  44. * content.
  45. */
  46. export declare class AriaDescriber implements OnDestroy {
  47. /**
  48. * @deprecated To be turned into a required parameter.
  49. * @breaking-change 14.0.0
  50. */
  51. private _platform?;
  52. private _document;
  53. /** Map of all registered message elements that have been placed into the document. */
  54. private _messageRegistry;
  55. /** Container for all registered messages. */
  56. private _messagesContainer;
  57. /** Unique ID for the service. */
  58. private readonly _id;
  59. constructor(_document: any,
  60. /**
  61. * @deprecated To be turned into a required parameter.
  62. * @breaking-change 14.0.0
  63. */
  64. _platform?: Platform | undefined);
  65. /**
  66. * Adds to the host element an aria-describedby reference to a hidden element that contains
  67. * the message. If the same message has already been registered, then it will reuse the created
  68. * message element.
  69. */
  70. describe(hostElement: Element, message: string, role?: string): void;
  71. /**
  72. * Adds to the host element an aria-describedby reference to an already-existing message element.
  73. */
  74. describe(hostElement: Element, message: HTMLElement): void;
  75. /** Removes the host element's aria-describedby reference to the message. */
  76. removeDescription(hostElement: Element, message: string, role?: string): void;
  77. /** Removes the host element's aria-describedby reference to the message element. */
  78. removeDescription(hostElement: Element, message: HTMLElement): void;
  79. /** Unregisters all created message elements and removes the message container. */
  80. ngOnDestroy(): void;
  81. /**
  82. * Creates a new element in the visually hidden message container element with the message
  83. * as its content and adds it to the message registry.
  84. */
  85. private _createMessageElement;
  86. /** Deletes the message element from the global messages container. */
  87. private _deleteMessageElement;
  88. /** Creates the global container for all aria-describedby messages. */
  89. private _createMessagesContainer;
  90. /** Removes all cdk-describedby messages that are hosted through the element. */
  91. private _removeCdkDescribedByReferenceIds;
  92. /**
  93. * Adds a message reference to the element using aria-describedby and increments the registered
  94. * message's reference count.
  95. */
  96. private _addMessageReference;
  97. /**
  98. * Removes a message reference from the element using aria-describedby
  99. * and decrements the registered message's reference count.
  100. */
  101. private _removeMessageReference;
  102. /** Returns true if the element has been described by the provided message ID. */
  103. private _isElementDescribedByMessage;
  104. /** Determines whether a message can be described on a particular element. */
  105. private _canBeDescribed;
  106. /** Checks whether a node is an Element node. */
  107. private _isElementNode;
  108. static ɵfac: i0.ɵɵFactoryDeclaration<AriaDescriber, never>;
  109. static ɵprov: i0.ɵɵInjectableDeclaration<AriaDescriber>;
  110. }
  111. /** Possible politeness levels. */
  112. export declare type AriaLivePoliteness = 'off' | 'polite' | 'assertive';
  113. /**
  114. * Attribute given to each host element that is described by a message element.
  115. * @deprecated To be turned into a private variable.
  116. * @breaking-change 14.0.0
  117. */
  118. export declare const CDK_DESCRIBEDBY_HOST_ATTRIBUTE = "cdk-describedby-host";
  119. /**
  120. * ID prefix used for each created message element.
  121. * @deprecated To be turned into a private variable.
  122. * @breaking-change 14.0.0
  123. */
  124. export declare const CDK_DESCRIBEDBY_ID_PREFIX = "cdk-describedby-message";
  125. /**
  126. * A directive that works similarly to aria-live, but uses the LiveAnnouncer to ensure compatibility
  127. * with a wider range of browsers and screen readers.
  128. */
  129. export declare class CdkAriaLive implements OnDestroy {
  130. private _elementRef;
  131. private _liveAnnouncer;
  132. private _contentObserver;
  133. private _ngZone;
  134. /** The aria-live politeness level to use when announcing messages. */
  135. get politeness(): AriaLivePoliteness;
  136. set politeness(value: AriaLivePoliteness);
  137. private _politeness;
  138. /** Time in milliseconds after which to clear out the announcer element. */
  139. duration: number;
  140. private _previousAnnouncedText?;
  141. private _subscription;
  142. constructor(_elementRef: ElementRef, _liveAnnouncer: LiveAnnouncer, _contentObserver: ContentObserver, _ngZone: NgZone);
  143. ngOnDestroy(): void;
  144. static ɵfac: i0.ɵɵFactoryDeclaration<CdkAriaLive, never>;
  145. static ɵdir: i0.ɵɵDirectiveDeclaration<CdkAriaLive, "[cdkAriaLive]", ["cdkAriaLive"], { "politeness": { "alias": "cdkAriaLive"; "required": false; }; "duration": { "alias": "cdkAriaLiveDuration"; "required": false; }; }, {}, never, never, false, never>;
  146. }
  147. /**
  148. * Directive that determines how a particular element was focused (via keyboard, mouse, touch, or
  149. * programmatically) and adds corresponding classes to the element.
  150. *
  151. * There are two variants of this directive:
  152. * 1) cdkMonitorElementFocus: does not consider an element to be focused if one of its children is
  153. * focused.
  154. * 2) cdkMonitorSubtreeFocus: considers an element focused if it or any of its children are focused.
  155. */
  156. export declare class CdkMonitorFocus implements AfterViewInit, OnDestroy {
  157. private _elementRef;
  158. private _focusMonitor;
  159. private _monitorSubscription;
  160. private _focusOrigin;
  161. readonly cdkFocusChange: EventEmitter<FocusOrigin>;
  162. constructor(_elementRef: ElementRef<HTMLElement>, _focusMonitor: FocusMonitor);
  163. get focusOrigin(): FocusOrigin;
  164. ngAfterViewInit(): void;
  165. ngOnDestroy(): void;
  166. static ɵfac: i0.ɵɵFactoryDeclaration<CdkMonitorFocus, never>;
  167. static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMonitorFocus, "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", ["cdkMonitorFocus"], {}, { "cdkFocusChange": "cdkFocusChange"; }, never, never, false, never>;
  168. }
  169. /** Directive for trapping focus within a region. */
  170. export declare class CdkTrapFocus implements OnDestroy, AfterContentInit, OnChanges, DoCheck {
  171. private _elementRef;
  172. private _focusTrapFactory;
  173. /** Underlying FocusTrap instance. */
  174. focusTrap: FocusTrap;
  175. /** Previously focused element to restore focus to upon destroy when using autoCapture. */
  176. private _previouslyFocusedElement;
  177. /** Whether the focus trap is active. */
  178. get enabled(): boolean;
  179. set enabled(value: BooleanInput);
  180. /**
  181. * Whether the directive should automatically move focus into the trapped region upon
  182. * initialization and return focus to the previous activeElement upon destruction.
  183. */
  184. get autoCapture(): boolean;
  185. set autoCapture(value: BooleanInput);
  186. private _autoCapture;
  187. constructor(_elementRef: ElementRef<HTMLElement>, _focusTrapFactory: FocusTrapFactory,
  188. /**
  189. * @deprecated No longer being used. To be removed.
  190. * @breaking-change 13.0.0
  191. */
  192. _document: any);
  193. ngOnDestroy(): void;
  194. ngAfterContentInit(): void;
  195. ngDoCheck(): void;
  196. ngOnChanges(changes: SimpleChanges): void;
  197. private _captureFocus;
  198. static ɵfac: i0.ɵɵFactoryDeclaration<CdkTrapFocus, never>;
  199. static ɵdir: i0.ɵɵDirectiveDeclaration<CdkTrapFocus, "[cdkTrapFocus]", ["cdkTrapFocus"], { "enabled": { "alias": "cdkTrapFocus"; "required": false; }; "autoCapture": { "alias": "cdkTrapFocusAutoCapture"; "required": false; }; }, {}, never, never, false, never>;
  200. }
  201. /**
  202. * Class that allows for trapping focus within a DOM element.
  203. *
  204. * This class uses a strategy pattern that determines how it traps focus.
  205. * See FocusTrapInertStrategy.
  206. */
  207. export declare class ConfigurableFocusTrap extends FocusTrap implements ManagedFocusTrap {
  208. private _focusTrapManager;
  209. private _inertStrategy;
  210. /** Whether the FocusTrap is enabled. */
  211. get enabled(): boolean;
  212. set enabled(value: boolean);
  213. constructor(_element: HTMLElement, _checker: InteractivityChecker, _ngZone: NgZone, _document: Document, _focusTrapManager: FocusTrapManager, _inertStrategy: FocusTrapInertStrategy, config: ConfigurableFocusTrapConfig);
  214. /** Notifies the FocusTrapManager that this FocusTrap will be destroyed. */
  215. destroy(): void;
  216. /** @docs-private Implemented as part of ManagedFocusTrap. */
  217. _enable(): void;
  218. /** @docs-private Implemented as part of ManagedFocusTrap. */
  219. _disable(): void;
  220. }
  221. /**
  222. * Options for creating a ConfigurableFocusTrap.
  223. */
  224. export declare interface ConfigurableFocusTrapConfig {
  225. /**
  226. * Whether to defer the creation of FocusTrap elements to be done manually by the user.
  227. */
  228. defer: boolean;
  229. }
  230. /** Factory that allows easy instantiation of configurable focus traps. */
  231. export declare class ConfigurableFocusTrapFactory {
  232. private _checker;
  233. private _ngZone;
  234. private _focusTrapManager;
  235. private _document;
  236. private _inertStrategy;
  237. constructor(_checker: InteractivityChecker, _ngZone: NgZone, _focusTrapManager: FocusTrapManager, _document: any, _inertStrategy?: FocusTrapInertStrategy);
  238. /**
  239. * Creates a focus-trapped region around the given element.
  240. * @param element The element around which focus will be trapped.
  241. * @param config The focus trap configuration.
  242. * @returns The created focus trap instance.
  243. */
  244. create(element: HTMLElement, config?: ConfigurableFocusTrapConfig): ConfigurableFocusTrap;
  245. /**
  246. * @deprecated Pass a config object instead of the `deferCaptureElements` flag.
  247. * @breaking-change 11.0.0
  248. */
  249. create(element: HTMLElement, deferCaptureElements: boolean): ConfigurableFocusTrap;
  250. static ɵfac: i0.ɵɵFactoryDeclaration<ConfigurableFocusTrapFactory, [null, null, null, null, { optional: true; }]>;
  251. static ɵprov: i0.ɵɵInjectableDeclaration<ConfigurableFocusTrapFactory>;
  252. }
  253. /**
  254. * Lightweight FocusTrapInertStrategy that adds a document focus event
  255. * listener to redirect focus back inside the FocusTrap.
  256. */
  257. export declare class EventListenerFocusTrapInertStrategy implements FocusTrapInertStrategy {
  258. /** Focus event handler. */
  259. private _listener;
  260. /** Adds a document event listener that keeps focus inside the FocusTrap. */
  261. preventFocus(focusTrap: ConfigurableFocusTrap): void;
  262. /** Removes the event listener added in preventFocus. */
  263. allowFocus(focusTrap: ConfigurableFocusTrap): void;
  264. /**
  265. * Refocuses the first element in the FocusTrap if the focus event target was outside
  266. * the FocusTrap.
  267. *
  268. * This is an event listener callback. The event listener is added in runOutsideAngular,
  269. * so all this code runs outside Angular as well.
  270. */
  271. private _trapFocus;
  272. }
  273. /** InjectionToken for FocusMonitorOptions. */
  274. export declare const FOCUS_MONITOR_DEFAULT_OPTIONS: InjectionToken<FocusMonitorOptions>;
  275. /** The injection token used to specify the inert strategy. */
  276. export declare const FOCUS_TRAP_INERT_STRATEGY: InjectionToken<FocusTrapInertStrategy>;
  277. /**
  278. * This is the interface for focusable items (used by the FocusKeyManager).
  279. * Each item must know how to focus itself, whether or not it is currently disabled
  280. * and be able to supply its label.
  281. */
  282. export declare interface FocusableOption extends ListKeyManagerOption {
  283. /** Focuses the `FocusableOption`. */
  284. focus(origin?: FocusOrigin): void;
  285. }
  286. export declare class FocusKeyManager<T> extends ListKeyManager<FocusableOption & T> {
  287. private _origin;
  288. /**
  289. * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls.
  290. * @param origin Focus origin to be used when focusing items.
  291. */
  292. setFocusOrigin(origin: FocusOrigin): this;
  293. /**
  294. * Sets the active item to the item at the specified
  295. * index and focuses the newly active item.
  296. * @param index Index of the item to be set as active.
  297. */
  298. setActiveItem(index: number): void;
  299. /**
  300. * Sets the active item to the item that is specified and focuses it.
  301. * @param item Item to be set as active.
  302. */
  303. setActiveItem(item: T): void;
  304. }
  305. /** Monitors mouse and keyboard events to determine the cause of focus events. */
  306. export declare class FocusMonitor implements OnDestroy {
  307. private _ngZone;
  308. private _platform;
  309. private readonly _inputModalityDetector;
  310. /** The focus origin that the next focus event is a result of. */
  311. private _origin;
  312. /** The FocusOrigin of the last focus event tracked by the FocusMonitor. */
  313. private _lastFocusOrigin;
  314. /** Whether the window has just been focused. */
  315. private _windowFocused;
  316. /** The timeout id of the window focus timeout. */
  317. private _windowFocusTimeoutId;
  318. /** The timeout id of the origin clearing timeout. */
  319. private _originTimeoutId;
  320. /**
  321. * Whether the origin was determined via a touch interaction. Necessary as properly attributing
  322. * focus events to touch interactions requires special logic.
  323. */
  324. private _originFromTouchInteraction;
  325. /** Map of elements being monitored to their info. */
  326. private _elementInfo;
  327. /** The number of elements currently being monitored. */
  328. private _monitoredElementCount;
  329. /**
  330. * Keeps track of the root nodes to which we've currently bound a focus/blur handler,
  331. * as well as the number of monitored elements that they contain. We have to treat focus/blur
  332. * handlers differently from the rest of the events, because the browser won't emit events
  333. * to the document when focus moves inside of a shadow root.
  334. */
  335. private _rootNodeFocusListenerCount;
  336. /**
  337. * The specified detection mode, used for attributing the origin of a focus
  338. * event.
  339. */
  340. private readonly _detectionMode;
  341. /**
  342. * Event listener for `focus` events on the window.
  343. * Needs to be an arrow function in order to preserve the context when it gets bound.
  344. */
  345. private _windowFocusListener;
  346. /** Used to reference correct document/window */
  347. protected _document?: Document;
  348. /** Subject for stopping our InputModalityDetector subscription. */
  349. private readonly _stopInputModalityDetector;
  350. constructor(_ngZone: NgZone, _platform: Platform, _inputModalityDetector: InputModalityDetector,
  351. /** @breaking-change 11.0.0 make document required */
  352. document: any | null, options: FocusMonitorOptions | null);
  353. /**
  354. * Event listener for `focus` and 'blur' events on the document.
  355. * Needs to be an arrow function in order to preserve the context when it gets bound.
  356. */
  357. private _rootNodeFocusAndBlurListener;
  358. /**
  359. * Monitors focus on an element and applies appropriate CSS classes.
  360. * @param element The element to monitor
  361. * @param checkChildren Whether to count the element as focused when its children are focused.
  362. * @returns An observable that emits when the focus state of the element changes.
  363. * When the element is blurred, null will be emitted.
  364. */
  365. monitor(element: HTMLElement, checkChildren?: boolean): Observable<FocusOrigin>;
  366. /**
  367. * Monitors focus on an element and applies appropriate CSS classes.
  368. * @param element The element to monitor
  369. * @param checkChildren Whether to count the element as focused when its children are focused.
  370. * @returns An observable that emits when the focus state of the element changes.
  371. * When the element is blurred, null will be emitted.
  372. */
  373. monitor(element: ElementRef<HTMLElement>, checkChildren?: boolean): Observable<FocusOrigin>;
  374. /**
  375. * Stops monitoring an element and removes all focus classes.
  376. * @param element The element to stop monitoring.
  377. */
  378. stopMonitoring(element: HTMLElement): void;
  379. /**
  380. * Stops monitoring an element and removes all focus classes.
  381. * @param element The element to stop monitoring.
  382. */
  383. stopMonitoring(element: ElementRef<HTMLElement>): void;
  384. /**
  385. * Focuses the element via the specified focus origin.
  386. * @param element Element to focus.
  387. * @param origin Focus origin.
  388. * @param options Options that can be used to configure the focus behavior.
  389. */
  390. focusVia(element: HTMLElement, origin: FocusOrigin, options?: FocusOptions_2): void;
  391. /**
  392. * Focuses the element via the specified focus origin.
  393. * @param element Element to focus.
  394. * @param origin Focus origin.
  395. * @param options Options that can be used to configure the focus behavior.
  396. */
  397. focusVia(element: ElementRef<HTMLElement>, origin: FocusOrigin, options?: FocusOptions_2): void;
  398. ngOnDestroy(): void;
  399. /** Access injected document if available or fallback to global document reference */
  400. private _getDocument;
  401. /** Use defaultView of injected document if available or fallback to global window reference */
  402. private _getWindow;
  403. private _getFocusOrigin;
  404. /**
  405. * Returns whether the focus event should be attributed to touch. Recall that in IMMEDIATE mode, a
  406. * touch origin isn't immediately reset at the next tick (see _setOrigin). This means that when we
  407. * handle a focus event following a touch interaction, we need to determine whether (1) the focus
  408. * event was directly caused by the touch interaction or (2) the focus event was caused by a
  409. * subsequent programmatic focus call triggered by the touch interaction.
  410. * @param focusEventTarget The target of the focus event under examination.
  411. */
  412. private _shouldBeAttributedToTouch;
  413. /**
  414. * Sets the focus classes on the element based on the given focus origin.
  415. * @param element The element to update the classes on.
  416. * @param origin The focus origin.
  417. */
  418. private _setClasses;
  419. /**
  420. * Updates the focus origin. If we're using immediate detection mode, we schedule an async
  421. * function to clear the origin at the end of a timeout. The duration of the timeout depends on
  422. * the origin being set.
  423. * @param origin The origin to set.
  424. * @param isFromInteraction Whether we are setting the origin from an interaction event.
  425. */
  426. private _setOrigin;
  427. /**
  428. * Handles focus events on a registered element.
  429. * @param event The focus event.
  430. * @param element The monitored element.
  431. */
  432. private _onFocus;
  433. /**
  434. * Handles blur events on a registered element.
  435. * @param event The blur event.
  436. * @param element The monitored element.
  437. */
  438. _onBlur(event: FocusEvent, element: HTMLElement): void;
  439. private _emitOrigin;
  440. private _registerGlobalListeners;
  441. private _removeGlobalListeners;
  442. /** Updates all the state on an element once its focus origin has changed. */
  443. private _originChanged;
  444. /**
  445. * Collects the `MonitoredElementInfo` of a particular element and
  446. * all of its ancestors that have enabled `checkChildren`.
  447. * @param element Element from which to start the search.
  448. */
  449. private _getClosestElementsInfo;
  450. /**
  451. * Returns whether an interaction is likely to have come from the user clicking the `label` of
  452. * an `input` or `textarea` in order to focus it.
  453. * @param focusEventTarget Target currently receiving focus.
  454. */
  455. private _isLastInteractionFromInputLabel;
  456. static ɵfac: i0.ɵɵFactoryDeclaration<FocusMonitor, [null, null, null, { optional: true; }, { optional: true; }]>;
  457. static ɵprov: i0.ɵɵInjectableDeclaration<FocusMonitor>;
  458. }
  459. /** Detection mode used for attributing the origin of a focus event. */
  460. export declare const enum FocusMonitorDetectionMode {
  461. /**
  462. * Any mousedown, keydown, or touchstart event that happened in the previous
  463. * tick or the current tick will be used to assign a focus event's origin (to
  464. * either mouse, keyboard, or touch). This is the default option.
  465. */
  466. IMMEDIATE = 0,
  467. /**
  468. * A focus event's origin is always attributed to the last corresponding
  469. * mousedown, keydown, or touchstart event, no matter how long ago it occurred.
  470. */
  471. EVENTUAL = 1
  472. }
  473. /** Injectable service-level options for FocusMonitor. */
  474. export declare interface FocusMonitorOptions {
  475. detectionMode?: FocusMonitorDetectionMode;
  476. }
  477. /**
  478. * Corresponds to the options that can be passed to the native `focus` event.
  479. * via https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
  480. */
  481. declare interface FocusOptions_2 {
  482. /** Whether the browser should scroll to the element when it is focused. */
  483. preventScroll?: boolean;
  484. }
  485. export { FocusOptions_2 as FocusOptions }
  486. export declare type FocusOrigin = 'touch' | 'mouse' | 'keyboard' | 'program' | null;
  487. /**
  488. * Class that allows for trapping focus within a DOM element.
  489. *
  490. * This class currently uses a relatively simple approach to focus trapping.
  491. * It assumes that the tab order is the same as DOM order, which is not necessarily true.
  492. * Things like `tabIndex > 0`, flex `order`, and shadow roots can cause the two to be misaligned.
  493. *
  494. * @deprecated Use `ConfigurableFocusTrap` instead.
  495. * @breaking-change 11.0.0
  496. */
  497. export declare class FocusTrap {
  498. readonly _element: HTMLElement;
  499. private _checker;
  500. readonly _ngZone: NgZone;
  501. readonly _document: Document;
  502. private _startAnchor;
  503. private _endAnchor;
  504. private _hasAttached;
  505. protected startAnchorListener: () => boolean;
  506. protected endAnchorListener: () => boolean;
  507. /** Whether the focus trap is active. */
  508. get enabled(): boolean;
  509. set enabled(value: boolean);
  510. protected _enabled: boolean;
  511. constructor(_element: HTMLElement, _checker: InteractivityChecker, _ngZone: NgZone, _document: Document, deferAnchors?: boolean);
  512. /** Destroys the focus trap by cleaning up the anchors. */
  513. destroy(): void;
  514. /**
  515. * Inserts the anchors into the DOM. This is usually done automatically
  516. * in the constructor, but can be deferred for cases like directives with `*ngIf`.
  517. * @returns Whether the focus trap managed to attach successfully. This may not be the case
  518. * if the target element isn't currently in the DOM.
  519. */
  520. attachAnchors(): boolean;
  521. /**
  522. * Waits for the zone to stabilize, then focuses the first tabbable element.
  523. * @returns Returns a promise that resolves with a boolean, depending
  524. * on whether focus was moved successfully.
  525. */
  526. focusInitialElementWhenReady(options?: FocusOptions): Promise<boolean>;
  527. /**
  528. * Waits for the zone to stabilize, then focuses
  529. * the first tabbable element within the focus trap region.
  530. * @returns Returns a promise that resolves with a boolean, depending
  531. * on whether focus was moved successfully.
  532. */
  533. focusFirstTabbableElementWhenReady(options?: FocusOptions): Promise<boolean>;
  534. /**
  535. * Waits for the zone to stabilize, then focuses
  536. * the last tabbable element within the focus trap region.
  537. * @returns Returns a promise that resolves with a boolean, depending
  538. * on whether focus was moved successfully.
  539. */
  540. focusLastTabbableElementWhenReady(options?: FocusOptions): Promise<boolean>;
  541. /**
  542. * Get the specified boundary element of the trapped region.
  543. * @param bound The boundary to get (start or end of trapped region).
  544. * @returns The boundary element.
  545. */
  546. private _getRegionBoundary;
  547. /**
  548. * Focuses the element that should be focused when the focus trap is initialized.
  549. * @returns Whether focus was moved successfully.
  550. */
  551. focusInitialElement(options?: FocusOptions): boolean;
  552. /**
  553. * Focuses the first tabbable element within the focus trap region.
  554. * @returns Whether focus was moved successfully.
  555. */
  556. focusFirstTabbableElement(options?: FocusOptions): boolean;
  557. /**
  558. * Focuses the last tabbable element within the focus trap region.
  559. * @returns Whether focus was moved successfully.
  560. */
  561. focusLastTabbableElement(options?: FocusOptions): boolean;
  562. /**
  563. * Checks whether the focus trap has successfully been attached.
  564. */
  565. hasAttached(): boolean;
  566. /** Get the first tabbable element from a DOM subtree (inclusive). */
  567. private _getFirstTabbableElement;
  568. /** Get the last tabbable element from a DOM subtree (inclusive). */
  569. private _getLastTabbableElement;
  570. /** Creates an anchor element. */
  571. private _createAnchor;
  572. /**
  573. * Toggles the `tabindex` of an anchor, based on the enabled state of the focus trap.
  574. * @param isEnabled Whether the focus trap is enabled.
  575. * @param anchor Anchor on which to toggle the tabindex.
  576. */
  577. private _toggleAnchorTabIndex;
  578. /**
  579. * Toggles the`tabindex` of both anchors to either trap Tab focus or allow it to escape.
  580. * @param enabled: Whether the anchors should trap Tab.
  581. */
  582. protected toggleAnchors(enabled: boolean): void;
  583. /** Executes a function when the zone is stable. */
  584. private _executeOnStable;
  585. }
  586. /**
  587. * Factory that allows easy instantiation of focus traps.
  588. * @deprecated Use `ConfigurableFocusTrapFactory` instead.
  589. * @breaking-change 11.0.0
  590. */
  591. export declare class FocusTrapFactory {
  592. private _checker;
  593. private _ngZone;
  594. private _document;
  595. constructor(_checker: InteractivityChecker, _ngZone: NgZone, _document: any);
  596. /**
  597. * Creates a focus-trapped region around the given element.
  598. * @param element The element around which focus will be trapped.
  599. * @param deferCaptureElements Defers the creation of focus-capturing elements to be done
  600. * manually by the user.
  601. * @returns The created focus trap instance.
  602. */
  603. create(element: HTMLElement, deferCaptureElements?: boolean): FocusTrap;
  604. static ɵfac: i0.ɵɵFactoryDeclaration<FocusTrapFactory, never>;
  605. static ɵprov: i0.ɵɵInjectableDeclaration<FocusTrapFactory>;
  606. }
  607. /**
  608. * A strategy that dictates how FocusTrap should prevent elements
  609. * outside of the FocusTrap from being focused.
  610. */
  611. export declare interface FocusTrapInertStrategy {
  612. /** Makes all elements outside focusTrap unfocusable. */
  613. preventFocus(focusTrap: FocusTrap): void;
  614. /** Reverts elements made unfocusable by preventFocus to their previous state. */
  615. allowFocus(focusTrap: FocusTrap): void;
  616. }
  617. /** Injectable that ensures only the most recently enabled FocusTrap is active. */
  618. declare class FocusTrapManager {
  619. private _focusTrapStack;
  620. /**
  621. * Disables the FocusTrap at the top of the stack, and then pushes
  622. * the new FocusTrap onto the stack.
  623. */
  624. register(focusTrap: ManagedFocusTrap): void;
  625. /**
  626. * Removes the FocusTrap from the stack, and activates the
  627. * FocusTrap that is the new top of the stack.
  628. */
  629. deregister(focusTrap: ManagedFocusTrap): void;
  630. static ɵfac: i0.ɵɵFactoryDeclaration<FocusTrapManager, never>;
  631. static ɵprov: i0.ɵɵInjectableDeclaration<FocusTrapManager>;
  632. }
  633. /** Set of possible high-contrast mode backgrounds. */
  634. export declare const enum HighContrastMode {
  635. NONE = 0,
  636. BLACK_ON_WHITE = 1,
  637. WHITE_ON_BLACK = 2
  638. }
  639. /**
  640. * Service to determine whether the browser is currently in a high-contrast-mode environment.
  641. *
  642. * Microsoft Windows supports an accessibility feature called "High Contrast Mode". This mode
  643. * changes the appearance of all applications, including web applications, to dramatically increase
  644. * contrast.
  645. *
  646. * IE, Edge, and Firefox currently support this mode. Chrome does not support Windows High Contrast
  647. * Mode. This service does not detect high-contrast mode as added by the Chrome "High Contrast"
  648. * browser extension.
  649. */
  650. export declare class HighContrastModeDetector implements OnDestroy {
  651. private _platform;
  652. /**
  653. * Figuring out the high contrast mode and adding the body classes can cause
  654. * some expensive layouts. This flag is used to ensure that we only do it once.
  655. */
  656. private _hasCheckedHighContrastMode;
  657. private _document;
  658. private _breakpointSubscription;
  659. constructor(_platform: Platform, document: any);
  660. /** Gets the current high-contrast-mode for the page. */
  661. getHighContrastMode(): HighContrastMode;
  662. ngOnDestroy(): void;
  663. /** Applies CSS classes indicating high-contrast mode to document body (browser-only). */
  664. _applyBodyHighContrastModeCssClasses(): void;
  665. static ɵfac: i0.ɵɵFactoryDeclaration<HighContrastModeDetector, never>;
  666. static ɵprov: i0.ɵɵInjectableDeclaration<HighContrastModeDetector>;
  667. }
  668. /**
  669. * This is the interface for highlightable items (used by the ActiveDescendantKeyManager).
  670. * Each item must know how to style itself as active or inactive and whether or not it is
  671. * currently disabled.
  672. */
  673. export declare interface Highlightable extends ListKeyManagerOption {
  674. /** Applies the styles for an active item to this item. */
  675. setActiveStyles(): void;
  676. /** Applies the styles for an inactive item to this item. */
  677. setInactiveStyles(): void;
  678. }
  679. declare namespace i1 {
  680. export {
  681. LiveAnnouncer,
  682. CdkAriaLive
  683. }
  684. }
  685. declare namespace i2 {
  686. export {
  687. FocusTrap,
  688. FocusTrapFactory,
  689. CdkTrapFocus
  690. }
  691. }
  692. declare namespace i3 {
  693. export {
  694. FocusOrigin,
  695. FocusOptions_2 as FocusOptions,
  696. FocusMonitorDetectionMode,
  697. FocusMonitorOptions,
  698. FOCUS_MONITOR_DEFAULT_OPTIONS,
  699. FocusMonitor,
  700. CdkMonitorFocus
  701. }
  702. }
  703. /**
  704. * Default options for the InputModalityDetector.
  705. *
  706. * Modifier keys are ignored by default (i.e. when pressed won't cause the service to detect
  707. * keyboard input modality) for two reasons:
  708. *
  709. * 1. Modifier keys are commonly used with mouse to perform actions such as 'right click' or 'open
  710. * in new tab', and are thus less representative of actual keyboard interaction.
  711. * 2. VoiceOver triggers some keyboard events when linearly navigating with Control + Option (but
  712. * confusingly not with Caps Lock). Thus, to have parity with other screen readers, we ignore
  713. * these keys so as to not update the input modality.
  714. *
  715. * Note that we do not by default ignore the right Meta key on Safari because it has the same key
  716. * code as the ContextMenu key on other browsers. When we switch to using event.key, we can
  717. * distinguish between the two.
  718. */
  719. export declare const INPUT_MODALITY_DETECTOR_DEFAULT_OPTIONS: InputModalityDetectorOptions;
  720. /**
  721. * Injectable options for the InputModalityDetector. These are shallowly merged with the default
  722. * options.
  723. */
  724. export declare const INPUT_MODALITY_DETECTOR_OPTIONS: InjectionToken<InputModalityDetectorOptions>;
  725. /**
  726. * The input modalities detected by this service. Null is used if the input modality is unknown.
  727. */
  728. export declare type InputModality = 'keyboard' | 'mouse' | 'touch' | null;
  729. /**
  730. * Service that detects the user's input modality.
  731. *
  732. * This service does not update the input modality when a user navigates with a screen reader
  733. * (e.g. linear navigation with VoiceOver, object navigation / browse mode with NVDA, virtual PC
  734. * cursor mode with JAWS). This is in part due to technical limitations (i.e. keyboard events do not
  735. * fire as expected in these modes) but is also arguably the correct behavior. Navigating with a
  736. * screen reader is akin to visually scanning a page, and should not be interpreted as actual user
  737. * input interaction.
  738. *
  739. * When a user is not navigating but *interacting* with a screen reader, this service attempts to
  740. * update the input modality to keyboard, but in general this service's behavior is largely
  741. * undefined.
  742. */
  743. export declare class InputModalityDetector implements OnDestroy {
  744. private readonly _platform;
  745. /** Emits whenever an input modality is detected. */
  746. readonly modalityDetected: Observable<InputModality>;
  747. /** Emits when the input modality changes. */
  748. readonly modalityChanged: Observable<InputModality>;
  749. /** The most recently detected input modality. */
  750. get mostRecentModality(): InputModality;
  751. /**
  752. * The most recently detected input modality event target. Is null if no input modality has been
  753. * detected or if the associated event target is null for some unknown reason.
  754. */
  755. _mostRecentTarget: HTMLElement | null;
  756. /** The underlying BehaviorSubject that emits whenever an input modality is detected. */
  757. private readonly _modality;
  758. /** Options for this InputModalityDetector. */
  759. private readonly _options;
  760. /**
  761. * The timestamp of the last touch input modality. Used to determine whether mousedown events
  762. * should be attributed to mouse or touch.
  763. */
  764. private _lastTouchMs;
  765. /**
  766. * Handles keydown events. Must be an arrow function in order to preserve the context when it gets
  767. * bound.
  768. */
  769. private _onKeydown;
  770. /**
  771. * Handles mousedown events. Must be an arrow function in order to preserve the context when it
  772. * gets bound.
  773. */
  774. private _onMousedown;
  775. /**
  776. * Handles touchstart events. Must be an arrow function in order to preserve the context when it
  777. * gets bound.
  778. */
  779. private _onTouchstart;
  780. constructor(_platform: Platform, ngZone: NgZone, document: Document, options?: InputModalityDetectorOptions);
  781. ngOnDestroy(): void;
  782. static ɵfac: i0.ɵɵFactoryDeclaration<InputModalityDetector, [null, null, null, { optional: true; }]>;
  783. static ɵprov: i0.ɵɵInjectableDeclaration<InputModalityDetector>;
  784. }
  785. /** Options to configure the behavior of the InputModalityDetector. */
  786. export declare interface InputModalityDetectorOptions {
  787. /** Keys to ignore when detecting keyboard input modality. */
  788. ignoreKeys?: number[];
  789. }
  790. /**
  791. * Utility for checking the interactivity of an element, such as whether is is focusable or
  792. * tabbable.
  793. */
  794. export declare class InteractivityChecker {
  795. private _platform;
  796. constructor(_platform: Platform);
  797. /**
  798. * Gets whether an element is disabled.
  799. *
  800. * @param element Element to be checked.
  801. * @returns Whether the element is disabled.
  802. */
  803. isDisabled(element: HTMLElement): boolean;
  804. /**
  805. * Gets whether an element is visible for the purposes of interactivity.
  806. *
  807. * This will capture states like `display: none` and `visibility: hidden`, but not things like
  808. * being clipped by an `overflow: hidden` parent or being outside the viewport.
  809. *
  810. * @returns Whether the element is visible.
  811. */
  812. isVisible(element: HTMLElement): boolean;
  813. /**
  814. * Gets whether an element can be reached via Tab key.
  815. * Assumes that the element has already been checked with isFocusable.
  816. *
  817. * @param element Element to be checked.
  818. * @returns Whether the element is tabbable.
  819. */
  820. isTabbable(element: HTMLElement): boolean;
  821. /**
  822. * Gets whether an element can be focused by the user.
  823. *
  824. * @param element Element to be checked.
  825. * @param config The config object with options to customize this method's behavior
  826. * @returns Whether the element is focusable.
  827. */
  828. isFocusable(element: HTMLElement, config?: IsFocusableConfig): boolean;
  829. static ɵfac: i0.ɵɵFactoryDeclaration<InteractivityChecker, never>;
  830. static ɵprov: i0.ɵɵInjectableDeclaration<InteractivityChecker>;
  831. }
  832. /** Gets whether an event could be a faked `mousedown` event dispatched by a screen reader. */
  833. export declare function isFakeMousedownFromScreenReader(event: MouseEvent): boolean;
  834. /** Gets whether an event could be a faked `touchstart` event dispatched by a screen reader. */
  835. export declare function isFakeTouchstartFromScreenReader(event: TouchEvent): boolean;
  836. /**
  837. * Configuration for the isFocusable method.
  838. */
  839. export declare class IsFocusableConfig {
  840. /**
  841. * Whether to count an element as focusable even if it is not currently visible.
  842. */
  843. ignoreVisibility: boolean;
  844. }
  845. /**
  846. * This class manages keyboard events for selectable lists. If you pass it a query list
  847. * of items, it will set the active item correctly when arrow events occur.
  848. */
  849. export declare class ListKeyManager<T extends ListKeyManagerOption> {
  850. private _items;
  851. private _activeItemIndex;
  852. private _activeItem;
  853. private _wrap;
  854. private readonly _letterKeyStream;
  855. private _typeaheadSubscription;
  856. private _itemChangesSubscription?;
  857. private _vertical;
  858. private _horizontal;
  859. private _allowedModifierKeys;
  860. private _homeAndEnd;
  861. private _pageUpAndDown;
  862. /**
  863. * Predicate function that can be used to check whether an item should be skipped
  864. * by the key manager. By default, disabled items are skipped.
  865. */
  866. private _skipPredicateFn;
  867. private _pressedLetters;
  868. constructor(_items: QueryList<T> | T[]);
  869. /**
  870. * Stream that emits any time the TAB key is pressed, so components can react
  871. * when focus is shifted off of the list.
  872. */
  873. readonly tabOut: Subject<void>;
  874. /** Stream that emits whenever the active item of the list manager changes. */
  875. readonly change: Subject<number>;
  876. /**
  877. * Sets the predicate function that determines which items should be skipped by the
  878. * list key manager.
  879. * @param predicate Function that determines whether the given item should be skipped.
  880. */
  881. skipPredicate(predicate: (item: T) => boolean): this;
  882. /**
  883. * Configures wrapping mode, which determines whether the active item will wrap to
  884. * the other end of list when there are no more items in the given direction.
  885. * @param shouldWrap Whether the list should wrap when reaching the end.
  886. */
  887. withWrap(shouldWrap?: boolean): this;
  888. /**
  889. * Configures whether the key manager should be able to move the selection vertically.
  890. * @param enabled Whether vertical selection should be enabled.
  891. */
  892. withVerticalOrientation(enabled?: boolean): this;
  893. /**
  894. * Configures the key manager to move the selection horizontally.
  895. * Passing in `null` will disable horizontal movement.
  896. * @param direction Direction in which the selection can be moved.
  897. */
  898. withHorizontalOrientation(direction: 'ltr' | 'rtl' | null): this;
  899. /**
  900. * Modifier keys which are allowed to be held down and whose default actions will be prevented
  901. * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys.
  902. */
  903. withAllowedModifierKeys(keys: ListKeyManagerModifierKey[]): this;
  904. /**
  905. * Turns on typeahead mode which allows users to set the active item by typing.
  906. * @param debounceInterval Time to wait after the last keystroke before setting the active item.
  907. */
  908. withTypeAhead(debounceInterval?: number): this;
  909. /** Cancels the current typeahead sequence. */
  910. cancelTypeahead(): this;
  911. /**
  912. * Configures the key manager to activate the first and last items
  913. * respectively when the Home or End key is pressed.
  914. * @param enabled Whether pressing the Home or End key activates the first/last item.
  915. */
  916. withHomeAndEnd(enabled?: boolean): this;
  917. /**
  918. * Configures the key manager to activate every 10th, configured or first/last element in up/down direction
  919. * respectively when the Page-Up or Page-Down key is pressed.
  920. * @param enabled Whether pressing the Page-Up or Page-Down key activates the first/last item.
  921. * @param delta Whether pressing the Home or End key activates the first/last item.
  922. */
  923. withPageUpDown(enabled?: boolean, delta?: number): this;
  924. /**
  925. * Sets the active item to the item at the index specified.
  926. * @param index The index of the item to be set as active.
  927. */
  928. setActiveItem(index: number): void;
  929. /**
  930. * Sets the active item to the specified item.
  931. * @param item The item to be set as active.
  932. */
  933. setActiveItem(item: T): void;
  934. /**
  935. * Sets the active item depending on the key event passed in.
  936. * @param event Keyboard event to be used for determining which element should be active.
  937. */
  938. onKeydown(event: KeyboardEvent): void;
  939. /** Index of the currently active item. */
  940. get activeItemIndex(): number | null;
  941. /** The active item. */
  942. get activeItem(): T | null;
  943. /** Gets whether the user is currently typing into the manager using the typeahead feature. */
  944. isTyping(): boolean;
  945. /** Sets the active item to the first enabled item in the list. */
  946. setFirstItemActive(): void;
  947. /** Sets the active item to the last enabled item in the list. */
  948. setLastItemActive(): void;
  949. /** Sets the active item to the next enabled item in the list. */
  950. setNextItemActive(): void;
  951. /** Sets the active item to a previous enabled item in the list. */
  952. setPreviousItemActive(): void;
  953. /**
  954. * Allows setting the active without any other effects.
  955. * @param index Index of the item to be set as active.
  956. */
  957. updateActiveItem(index: number): void;
  958. /**
  959. * Allows setting the active item without any other effects.
  960. * @param item Item to be set as active.
  961. */
  962. updateActiveItem(item: T): void;
  963. /** Cleans up the key manager. */
  964. destroy(): void;
  965. /**
  966. * This method sets the active item, given a list of items and the delta between the
  967. * currently active item and the new active item. It will calculate differently
  968. * depending on whether wrap mode is turned on.
  969. */
  970. private _setActiveItemByDelta;
  971. /**
  972. * Sets the active item properly given "wrap" mode. In other words, it will continue to move
  973. * down the list until it finds an item that is not disabled, and it will wrap if it
  974. * encounters either end of the list.
  975. */
  976. private _setActiveInWrapMode;
  977. /**
  978. * Sets the active item properly given the default mode. In other words, it will
  979. * continue to move down the list until it finds an item that is not disabled. If
  980. * it encounters either end of the list, it will stop and not wrap.
  981. */
  982. private _setActiveInDefaultMode;
  983. /**
  984. * Sets the active item to the first enabled item starting at the index specified. If the
  985. * item is disabled, it will move in the fallbackDelta direction until it either
  986. * finds an enabled item or encounters the end of the list.
  987. */
  988. private _setActiveItemByIndex;
  989. /** Returns the items as an array. */
  990. private _getItemsArray;
  991. }
  992. /** Modifier keys handled by the ListKeyManager. */
  993. export declare type ListKeyManagerModifierKey = 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey';
  994. /** This interface is for items that can be passed to a ListKeyManager. */
  995. export declare interface ListKeyManagerOption {
  996. /** Whether the option is disabled. */
  997. disabled?: boolean;
  998. /** Gets the label for this option. */
  999. getLabel?(): string;
  1000. }
  1001. /** Injection token that can be used to configure the default options for the LiveAnnouncer. */
  1002. export declare const LIVE_ANNOUNCER_DEFAULT_OPTIONS: InjectionToken<LiveAnnouncerDefaultOptions>;
  1003. export declare const LIVE_ANNOUNCER_ELEMENT_TOKEN: InjectionToken<HTMLElement | null>;
  1004. /** @docs-private */
  1005. export declare function LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY(): null;
  1006. export declare class LiveAnnouncer implements OnDestroy {
  1007. private _ngZone;
  1008. private _defaultOptions?;
  1009. private _liveElement;
  1010. private _document;
  1011. private _previousTimeout;
  1012. private _currentPromise;
  1013. private _currentResolve;
  1014. constructor(elementToken: any, _ngZone: NgZone, _document: any, _defaultOptions?: LiveAnnouncerDefaultOptions | undefined);
  1015. /**
  1016. * Announces a message to screen readers.
  1017. * @param message Message to be announced to the screen reader.
  1018. * @returns Promise that will be resolved when the message is added to the DOM.
  1019. */
  1020. announce(message: string): Promise<void>;
  1021. /**
  1022. * Announces a message to screen readers.
  1023. * @param message Message to be announced to the screen reader.
  1024. * @param politeness The politeness of the announcer element.
  1025. * @returns Promise that will be resolved when the message is added to the DOM.
  1026. */
  1027. announce(message: string, politeness?: AriaLivePoliteness): Promise<void>;
  1028. /**
  1029. * Announces a message to screen readers.
  1030. * @param message Message to be announced to the screen reader.
  1031. * @param duration Time in milliseconds after which to clear out the announcer element. Note
  1032. * that this takes effect after the message has been added to the DOM, which can be up to
  1033. * 100ms after `announce` has been called.
  1034. * @returns Promise that will be resolved when the message is added to the DOM.
  1035. */
  1036. announce(message: string, duration?: number): Promise<void>;
  1037. /**
  1038. * Announces a message to screen readers.
  1039. * @param message Message to be announced to the screen reader.
  1040. * @param politeness The politeness of the announcer element.
  1041. * @param duration Time in milliseconds after which to clear out the announcer element. Note
  1042. * that this takes effect after the message has been added to the DOM, which can be up to
  1043. * 100ms after `announce` has been called.
  1044. * @returns Promise that will be resolved when the message is added to the DOM.
  1045. */
  1046. announce(message: string, politeness?: AriaLivePoliteness, duration?: number): Promise<void>;
  1047. /**
  1048. * Clears the current text from the announcer element. Can be used to prevent
  1049. * screen readers from reading the text out again while the user is going
  1050. * through the page landmarks.
  1051. */
  1052. clear(): void;
  1053. ngOnDestroy(): void;
  1054. private _createLiveElement;
  1055. /**
  1056. * Some browsers won't expose the accessibility node of the live announcer element if there is an
  1057. * `aria-modal` and the live announcer is outside of it. This method works around the issue by
  1058. * pointing the `aria-owns` of all modals to the live announcer element.
  1059. */
  1060. private _exposeAnnouncerToModals;
  1061. static ɵfac: i0.ɵɵFactoryDeclaration<LiveAnnouncer, [{ optional: true; }, null, null, { optional: true; }]>;
  1062. static ɵprov: i0.ɵɵInjectableDeclaration<LiveAnnouncer>;
  1063. }
  1064. /** Object that can be used to configure the default options for the LiveAnnouncer. */
  1065. export declare interface LiveAnnouncerDefaultOptions {
  1066. /** Default politeness for the announcements. */
  1067. politeness?: AriaLivePoliteness;
  1068. /** Default duration for the announcement messages. */
  1069. duration?: number;
  1070. }
  1071. /**
  1072. * A FocusTrap managed by FocusTrapManager.
  1073. * Implemented by ConfigurableFocusTrap to avoid circular dependency.
  1074. */
  1075. declare interface ManagedFocusTrap {
  1076. _enable(): void;
  1077. _disable(): void;
  1078. focusInitialElementWhenReady(): Promise<boolean>;
  1079. }
  1080. /**
  1081. * ID used for the body container where all messages are appended.
  1082. * @deprecated No longer being used. To be removed.
  1083. * @breaking-change 14.0.0
  1084. */
  1085. export declare const MESSAGES_CONTAINER_ID = "cdk-describedby-message-container";
  1086. /**
  1087. * Interface used to register message elements and keep a count of how many registrations have
  1088. * the same message and the reference to the message element used for the `aria-describedby`.
  1089. */
  1090. export declare interface RegisteredMessage {
  1091. /** The element containing the message. */
  1092. messageElement: Element;
  1093. /** The number of elements that reference this message element via `aria-describedby`. */
  1094. referenceCount: number;
  1095. }
  1096. export { }