source: trip-planner-front/node_modules/@angular/cdk/esm2015/bidi/directionality.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 5.3 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 { EventEmitter, Inject, Injectable, Optional } from '@angular/core';
9import { DIR_DOCUMENT } from './dir-document-token';
10import * as i0 from "@angular/core";
11import * as i1 from "./dir-document-token";
12/**
13 * The directionality (LTR / RTL) context for the application (or a subtree of it).
14 * Exposes the current direction and a stream of direction changes.
15 */
16export class Directionality {
17 constructor(_document) {
18 /** The current 'ltr' or 'rtl' value. */
19 this.value = 'ltr';
20 /** Stream that emits whenever the 'ltr' / 'rtl' state changes. */
21 this.change = new EventEmitter();
22 if (_document) {
23 // TODO: handle 'auto' value -
24 // We still need to account for dir="auto".
25 // It looks like HTMLElemenet.dir is also "auto" when that's set to the attribute,
26 // but getComputedStyle return either "ltr" or "rtl". avoiding getComputedStyle for now
27 const bodyDir = _document.body ? _document.body.dir : null;
28 const htmlDir = _document.documentElement ? _document.documentElement.dir : null;
29 const value = bodyDir || htmlDir;
30 this.value = (value === 'ltr' || value === 'rtl') ? value : 'ltr';
31 }
32 }
33 ngOnDestroy() {
34 this.change.complete();
35 }
36}
37Directionality.ɵprov = i0.ɵɵdefineInjectable({ factory: function Directionality_Factory() { return new Directionality(i0.ɵɵinject(i1.DIR_DOCUMENT, 8)); }, token: Directionality, providedIn: "root" });
38Directionality.decorators = [
39 { type: Injectable, args: [{ providedIn: 'root' },] }
40];
41Directionality.ctorParameters = () => [
42 { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DIR_DOCUMENT,] }] }
43];
44//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlyZWN0aW9uYWxpdHkuanMiLCJzb3VyY2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I7XG4gICAgICB0aGlzLnZhbHVlID0gKHZhbHVlID09PSAnbHRyJyB8fCB2YWx1ZSA9PT0gJ3J0bCcpID8gdmFsdWUgOiAnbHRyJztcbiAgICB9XG4gIH1cblxuICBuZ09uRGVzdHJveSgpIHtcbiAgICB0aGlzLmNoYW5nZS5jb21wbGV0ZSgpO1xuICB9XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.