source: trip-planner-front/node_modules/@angular/cdk/esm2015/a11y/live-announcer/live-announcer.js

Last change on this file was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

  • Property mode set to 100644
File size: 23.7 KB
Line 
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 */
8import { ContentObserver } from '@angular/cdk/observers';
9import { DOCUMENT } from '@angular/common';
10import { Directive, ElementRef, Inject, Injectable, Input, NgZone, Optional, } from '@angular/core';
11import { LIVE_ANNOUNCER_ELEMENT_TOKEN, LIVE_ANNOUNCER_DEFAULT_OPTIONS, } from './live-announcer-tokens';
12import * as i0 from "@angular/core";
13import * as i1 from "./live-announcer-tokens";
14import * as i2 from "@angular/common";
15export class LiveAnnouncer {
16 constructor(elementToken, _ngZone, _document, _defaultOptions) {
17 this._ngZone = _ngZone;
18 this._defaultOptions = _defaultOptions;
19 // We inject the live element and document as `any` because the constructor signature cannot
20 // reference browser globals (HTMLElement, Document) on non-browser environments, since having
21 // a class decorator causes TypeScript to preserve the constructor signature types.
22 this._document = _document;
23 this._liveElement = elementToken || this._createLiveElement();
24 }
25 announce(message, ...args) {
26 const defaultOptions = this._defaultOptions;
27 let politeness;
28 let duration;
29 if (args.length === 1 && typeof args[0] === 'number') {
30 duration = args[0];
31 }
32 else {
33 [politeness, duration] = args;
34 }
35 this.clear();
36 clearTimeout(this._previousTimeout);
37 if (!politeness) {
38 politeness =
39 (defaultOptions && defaultOptions.politeness) ? defaultOptions.politeness : 'polite';
40 }
41 if (duration == null && defaultOptions) {
42 duration = defaultOptions.duration;
43 }
44 // TODO: ensure changing the politeness works on all environments we support.
45 this._liveElement.setAttribute('aria-live', politeness);
46 // This 100ms timeout is necessary for some browser + screen-reader combinations:
47 // - Both JAWS and NVDA over IE11 will not announce anything without a non-zero timeout.
48 // - With Chrome and IE11 with NVDA or JAWS, a repeated (identical) message won't be read a
49 // second time without clearing and then using a non-zero delay.
50 // (using JAWS 17 at time of this writing).
51 return this._ngZone.runOutsideAngular(() => {
52 return new Promise(resolve => {
53 clearTimeout(this._previousTimeout);
54 this._previousTimeout = setTimeout(() => {
55 this._liveElement.textContent = message;
56 resolve();
57 if (typeof duration === 'number') {
58 this._previousTimeout = setTimeout(() => this.clear(), duration);
59 }
60 }, 100);
61 });
62 });
63 }
64 /**
65 * Clears the current text from the announcer element. Can be used to prevent
66 * screen readers from reading the text out again while the user is going
67 * through the page landmarks.
68 */
69 clear() {
70 if (this._liveElement) {
71 this._liveElement.textContent = '';
72 }
73 }
74 ngOnDestroy() {
75 clearTimeout(this._previousTimeout);
76 if (this._liveElement && this._liveElement.parentNode) {
77 this._liveElement.parentNode.removeChild(this._liveElement);
78 this._liveElement = null;
79 }
80 }
81 _createLiveElement() {
82 const elementClass = 'cdk-live-announcer-element';
83 const previousElements = this._document.getElementsByClassName(elementClass);
84 const liveEl = this._document.createElement('div');
85 // Remove any old containers. This can happen when coming in from a server-side-rendered page.
86 for (let i = 0; i < previousElements.length; i++) {
87 previousElements[i].parentNode.removeChild(previousElements[i]);
88 }
89 liveEl.classList.add(elementClass);
90 liveEl.classList.add('cdk-visually-hidden');
91 liveEl.setAttribute('aria-atomic', 'true');
92 liveEl.setAttribute('aria-live', 'polite');
93 this._document.body.appendChild(liveEl);
94 return liveEl;
95 }
96}
97LiveAnnouncer.ɵprov = i0.ɵɵdefineInjectable({ factory: function LiveAnnouncer_Factory() { return new LiveAnnouncer(i0.ɵɵinject(i1.LIVE_ANNOUNCER_ELEMENT_TOKEN, 8), i0.ɵɵinject(i0.NgZone), i0.ɵɵinject(i2.DOCUMENT), i0.ɵɵinject(i1.LIVE_ANNOUNCER_DEFAULT_OPTIONS, 8)); }, token: LiveAnnouncer, providedIn: "root" });
98LiveAnnouncer.decorators = [
99 { type: Injectable, args: [{ providedIn: 'root' },] }
100];
101LiveAnnouncer.ctorParameters = () => [
102 { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [LIVE_ANNOUNCER_ELEMENT_TOKEN,] }] },
103 { type: NgZone },
104 { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
105 { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [LIVE_ANNOUNCER_DEFAULT_OPTIONS,] }] }
106];
107/**
108 * A directive that works similarly to aria-live, but uses the LiveAnnouncer to ensure compatibility
109 * with a wider range of browsers and screen readers.
110 */
111export class CdkAriaLive {
112 constructor(_elementRef, _liveAnnouncer, _contentObserver, _ngZone) {
113 this._elementRef = _elementRef;
114 this._liveAnnouncer = _liveAnnouncer;
115 this._contentObserver = _contentObserver;
116 this._ngZone = _ngZone;
117 this._politeness = 'polite';
118 }
119 /** The aria-live politeness level to use when announcing messages. */
120 get politeness() { return this._politeness; }
121 set politeness(value) {
122 this._politeness = value === 'off' || value === 'assertive' ? value : 'polite';
123 if (this._politeness === 'off') {
124 if (this._subscription) {
125 this._subscription.unsubscribe();
126 this._subscription = null;
127 }
128 }
129 else if (!this._subscription) {
130 this._subscription = this._ngZone.runOutsideAngular(() => {
131 return this._contentObserver
132 .observe(this._elementRef)
133 .subscribe(() => {
134 // Note that we use textContent here, rather than innerText, in order to avoid a reflow.
135 const elementText = this._elementRef.nativeElement.textContent;
136 // The `MutationObserver` fires also for attribute
137 // changes which we don't want to announce.
138 if (elementText !== this._previousAnnouncedText) {
139 this._liveAnnouncer.announce(elementText, this._politeness);
140 this._previousAnnouncedText = elementText;
141 }
142 });
143 });
144 }
145 }
146 ngOnDestroy() {
147 if (this._subscription) {
148 this._subscription.unsubscribe();
149 }
150 }
151}
152CdkAriaLive.decorators = [
153 { type: Directive, args: [{
154 selector: '[cdkAriaLive]',
155 exportAs: 'cdkAriaLive',
156 },] }
157];
158CdkAriaLive.ctorParameters = () => [
159 { type: ElementRef },
160 { type: LiveAnnouncer },
161 { type: ContentObserver },
162 { type: NgZone }
163];
164CdkAriaLive.propDecorators = {
165 politeness: [{ type: Input, args: ['cdkAriaLive',]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Ghpcy5fcHJldmlvdXNBbm5vdW5jZWRUZXh0KSB7XG4gICAgICAgICAgICAgIHRoaXMuX2xpdmVBbm5vdW5jZXIuYW5ub3VuY2UoZWxlbWVudFRleHQsIHRoaXMuX3BvbGl0ZW5lc3MpO1xuICAgICAgICAgICAgICB0aGlzLl9wcmV2aW91c0Fubm91bmNlZFRleHQgPSBlbGVtZW50VGV4dDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KTtcbiAgICAgIH0pO1xuICAgIH1cbiAgfVxuICBwcml2YXRlIF9wb2xpdGVuZXNzOiBBcmlhTGl2ZVBvbGl0ZW5lc3MgPSAncG9saXRlJztcblxuICBwcml2YXRlIF9wcmV2aW91c0Fubm91bmNlZFRleHQ/OiBzdHJpbmc7XG4gIHByaXZhdGUgX3N1YnNjcmlwdGlvbjogU3Vic2NyaXB0aW9uIHwgbnVsbDtcblxuICBjb25zdHJ1Y3Rvcihwcml2YXRlIF9lbGVtZW50UmVmOiBFbGVtZW50UmVmLCBwcml2YXRlIF9saXZlQW5ub3VuY2VyOiBMaXZlQW5ub3VuY2VyLFxuICAgICAgICAgICAgICBwcml2YXRlIF9jb250ZW50T2JzZXJ2ZXI6IENvbnRlbnRPYnNlcnZlciwgcHJpdmF0ZSBfbmdab25lOiBOZ1pvbmUpIHt9XG5cbiAgbmdPbkRlc3Ryb3koKSB7XG4gICAgaWYgKHRoaXMuX3N1YnNjcmlwdGlvbikge1xuICAgICAgdGhpcy5fc3Vic2NyaXB0aW9uLnVuc3Vic2NyaWJlKCk7XG4gICAgfVxuICB9XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.