UNPKG

2.81 kBTypeScriptView Raw
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 { ElementRef, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
9import { Observable, Subject } from 'rxjs';
10import { StyleDefinition, StyleUtils } from '../style-utils/style-utils';
11import { StyleBuilder } from '../style-builder/style-builder';
12import { MediaMarshaller } from '../media-marshaller/media-marshaller';
13export declare abstract class BaseDirective2 implements OnChanges, OnDestroy {
14 protected elementRef: ElementRef;
15 protected styleBuilder: StyleBuilder;
16 protected styler: StyleUtils;
17 protected marshal: MediaMarshaller;
18 protected DIRECTIVE_KEY: string;
19 protected inputs: string[];
20 /** The most recently used styles for the builder */
21 protected mru: StyleDefinition;
22 protected destroySubject: Subject<void>;
23 protected currentValue: any;
24 /** Access to host element's parent DOM node */
25 protected get parentElement(): HTMLElement | null;
26 /** Access to the HTMLElement for the directive */
27 protected get nativeElement(): HTMLElement;
28 /** Access to the activated value for the directive */
29 get activatedValue(): string;
30 set activatedValue(value: string);
31 /** Cache map for style computation */
32 protected styleCache: Map<string, StyleDefinition>;
33 protected constructor(elementRef: ElementRef, styleBuilder: StyleBuilder, styler: StyleUtils, marshal: MediaMarshaller);
34 /** For @Input changes */
35 ngOnChanges(changes: SimpleChanges): void;
36 ngOnDestroy(): void;
37 /** Register with central marshaller service */
38 protected init(extraTriggers?: Observable<any>[]): void;
39 /** Add styles to the element using predefined style builder */
40 protected addStyles(input: string, parent?: Object): void;
41 /** Remove generated styles from an element using predefined style builder */
42 protected clearStyles(): void;
43 /** Force trigger style updates on DOM element */
44 protected triggerUpdate(): void;
45 /**
46 * Determine the DOM element's Flexbox flow (flex-direction).
47 *
48 * Check inline style first then check computed (stylesheet) style.
49 * And optionally add the flow value to element's inline style.
50 */
51 protected getFlexFlowDirection(target: HTMLElement, addIfMissing?: boolean): string;
52 protected hasWrap(target: HTMLElement): boolean;
53 /** Applies styles given via string pair or object map to the directive element */
54 protected applyStyleToElement(style: StyleDefinition, value?: string | number, element?: HTMLElement): void;
55 protected setValue(val: any, bp: string): void;
56 protected updateWithValue(input: string): void;
57}