1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { ContentObserver } from '@angular/cdk/observers';
|
---|
9 | import { ElementRef, NgZone, OnDestroy } from '@angular/core';
|
---|
10 | import { AriaLivePoliteness, LiveAnnouncerDefaultOptions } from './live-announcer-tokens';
|
---|
11 | export declare class LiveAnnouncer implements OnDestroy {
|
---|
12 | private _ngZone;
|
---|
13 | private _defaultOptions?;
|
---|
14 | private _liveElement;
|
---|
15 | private _document;
|
---|
16 | private _previousTimeout;
|
---|
17 | constructor(elementToken: any, _ngZone: NgZone, _document: any, _defaultOptions?: LiveAnnouncerDefaultOptions | undefined);
|
---|
18 | /**
|
---|
19 | * Announces a message to screenreaders.
|
---|
20 | * @param message Message to be announced to the screenreader.
|
---|
21 | * @returns Promise that will be resolved when the message is added to the DOM.
|
---|
22 | */
|
---|
23 | announce(message: string): Promise<void>;
|
---|
24 | /**
|
---|
25 | * Announces a message to screenreaders.
|
---|
26 | * @param message Message to be announced to the screenreader.
|
---|
27 | * @param politeness The politeness of the announcer element.
|
---|
28 | * @returns Promise that will be resolved when the message is added to the DOM.
|
---|
29 | */
|
---|
30 | announce(message: string, politeness?: AriaLivePoliteness): Promise<void>;
|
---|
31 | /**
|
---|
32 | * Announces a message to screenreaders.
|
---|
33 | * @param message Message to be announced to the screenreader.
|
---|
34 | * @param duration Time in milliseconds after which to clear out the announcer element. Note
|
---|
35 | * that this takes effect after the message has been added to the DOM, which can be up to
|
---|
36 | * 100ms after `announce` has been called.
|
---|
37 | * @returns Promise that will be resolved when the message is added to the DOM.
|
---|
38 | */
|
---|
39 | announce(message: string, duration?: number): Promise<void>;
|
---|
40 | /**
|
---|
41 | * Announces a message to screenreaders.
|
---|
42 | * @param message Message to be announced to the screenreader.
|
---|
43 | * @param politeness The politeness of the announcer element.
|
---|
44 | * @param duration Time in milliseconds after which to clear out the announcer element. Note
|
---|
45 | * that this takes effect after the message has been added to the DOM, which can be up to
|
---|
46 | * 100ms after `announce` has been called.
|
---|
47 | * @returns Promise that will be resolved when the message is added to the DOM.
|
---|
48 | */
|
---|
49 | announce(message: string, politeness?: AriaLivePoliteness, duration?: number): Promise<void>;
|
---|
50 | /**
|
---|
51 | * Clears the current text from the announcer element. Can be used to prevent
|
---|
52 | * screen readers from reading the text out again while the user is going
|
---|
53 | * through the page landmarks.
|
---|
54 | */
|
---|
55 | clear(): void;
|
---|
56 | ngOnDestroy(): void;
|
---|
57 | private _createLiveElement;
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * A directive that works similarly to aria-live, but uses the LiveAnnouncer to ensure compatibility
|
---|
61 | * with a wider range of browsers and screen readers.
|
---|
62 | */
|
---|
63 | export declare class CdkAriaLive implements OnDestroy {
|
---|
64 | private _elementRef;
|
---|
65 | private _liveAnnouncer;
|
---|
66 | private _contentObserver;
|
---|
67 | private _ngZone;
|
---|
68 | /** The aria-live politeness level to use when announcing messages. */
|
---|
69 | get politeness(): AriaLivePoliteness;
|
---|
70 | set politeness(value: AriaLivePoliteness);
|
---|
71 | private _politeness;
|
---|
72 | private _previousAnnouncedText?;
|
---|
73 | private _subscription;
|
---|
74 | constructor(_elementRef: ElementRef, _liveAnnouncer: LiveAnnouncer, _contentObserver: ContentObserver, _ngZone: NgZone);
|
---|
75 | ngOnDestroy(): void;
|
---|
76 | }
|
---|