UNPKG

3.04 kBTypeScriptView Raw
1import { AfterContentInit } from '@angular/core';
2import { EventEmitter } from '@angular/core';
3import * as i0 from '@angular/core';
4import { InjectionToken } from '@angular/core';
5import { OnDestroy } from '@angular/core';
6
7export declare class BidiModule {
8 static ɵfac: i0.ɵɵFactoryDeclaration<BidiModule, never>;
9 static ɵmod: i0.ɵɵNgModuleDeclaration<BidiModule, [typeof i1.Dir], never, [typeof i1.Dir]>;
10 static ɵinj: i0.ɵɵInjectorDeclaration<BidiModule>;
11}
12
13/**
14 * Directive to listen for changes of direction of part of the DOM.
15 *
16 * Provides itself as Directionality such that descendant directives only need to ever inject
17 * Directionality to get the closest direction.
18 */
19export declare class Dir implements Directionality, AfterContentInit, OnDestroy {
20 /** Normalized direction that accounts for invalid/unsupported values. */
21 private _dir;
22 /** Whether the `value` has been set to its initial value. */
23 private _isInitialized;
24 /** Direction as passed in by the consumer. */
25 _rawDir: string;
26 /** Event emitted when the direction changes. */
27 readonly change: EventEmitter<Direction>;
28 /** @docs-private */
29 get dir(): Direction;
30 set dir(value: Direction | 'auto');
31 /** Current layout direction of the element. */
32 get value(): Direction;
33 /** Initialize once default value has been set. */
34 ngAfterContentInit(): void;
35 ngOnDestroy(): void;
36 static ɵfac: i0.ɵɵFactoryDeclaration<Dir, never>;
37 static ɵdir: i0.ɵɵDirectiveDeclaration<Dir, "[dir]", ["dir"], { "dir": { "alias": "dir"; "required": false; }; }, { "change": "dirChange"; }, never, never, false, never>;
38}
39
40/**
41 * Injection token used to inject the document into Directionality.
42 * This is used so that the value can be faked in tests.
43 *
44 * We can't use the real document in tests because changing the real `dir` causes geometry-based
45 * tests in Safari to fail.
46 *
47 * We also can't re-provide the DOCUMENT token from platform-browser because the unit tests
48 * themselves use things like `querySelector` in test code.
49 *
50 * This token is defined in a separate file from Directionality as a workaround for
51 * https://github.com/angular/angular/issues/22559
52 *
53 * @docs-private
54 */
55export declare const DIR_DOCUMENT: InjectionToken<Document>;
56
57export declare type Direction = 'ltr' | 'rtl';
58
59/**
60 * The directionality (LTR / RTL) context for the application (or a subtree of it).
61 * Exposes the current direction and a stream of direction changes.
62 */
63export declare class Directionality implements OnDestroy {
64 /** The current 'ltr' or 'rtl' value. */
65 readonly value: Direction;
66 /** Stream that emits whenever the 'ltr' / 'rtl' state changes. */
67 readonly change: EventEmitter<Direction>;
68 constructor(_document?: any);
69 ngOnDestroy(): void;
70 static ɵfac: i0.ɵɵFactoryDeclaration<Directionality, [{ optional: true; }]>;
71 static ɵprov: i0.ɵɵInjectableDeclaration<Directionality>;
72}
73
74declare namespace i1 {
75 export {
76 Dir
77 }
78}
79
80export { }