1
|
/**
|
2
|
* @license
|
3
|
* Copyright Google Inc. 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 { InjectionToken, Injector } from '../di';
|
9
|
import { ViewEncapsulation } from '../metadata/view';
|
10
|
/**
|
11
|
* @deprecated Use `RendererType2` (and `Renderer2`) instead.
|
12
|
*/
|
13
|
export declare class RenderComponentType {
|
14
|
id: string;
|
15
|
templateUrl: string;
|
16
|
slotCount: number;
|
17
|
encapsulation: ViewEncapsulation;
|
18
|
styles: Array<string | any[]>;
|
19
|
animations: any;
|
20
|
constructor(id: string, templateUrl: string, slotCount: number, encapsulation: ViewEncapsulation, styles: Array<string | any[]>, animations: any);
|
21
|
}
|
22
|
/**
|
23
|
* @deprecated Debug info is handeled internally in the view engine now.
|
24
|
*/
|
25
|
export declare abstract class RenderDebugInfo {
|
26
|
readonly abstract injector: Injector;
|
27
|
readonly abstract component: any;
|
28
|
readonly abstract providerTokens: any[];
|
29
|
readonly abstract references: {
|
30
|
[key: string]: any;
|
31
|
};
|
32
|
readonly abstract context: any;
|
33
|
readonly abstract source: string;
|
34
|
}
|
35
|
/**
|
36
|
* @deprecated Use the `Renderer2` instead.
|
37
|
*/
|
38
|
export interface DirectRenderer {
|
39
|
remove(node: any): void;
|
40
|
appendChild(node: any, parent: any): void;
|
41
|
insertBefore(node: any, refNode: any): void;
|
42
|
nextSibling(node: any): any;
|
43
|
parentElement(node: any): any;
|
44
|
}
|
45
|
/**
|
46
|
* @deprecated Use the `Renderer2` instead.
|
47
|
*/
|
48
|
export declare abstract class Renderer {
|
49
|
abstract selectRootElement(selectorOrNode: string | any, debugInfo?: RenderDebugInfo): any;
|
50
|
abstract createElement(parentElement: any, name: string, debugInfo?: RenderDebugInfo): any;
|
51
|
abstract createViewRoot(hostElement: any): any;
|
52
|
abstract createTemplateAnchor(parentElement: any, debugInfo?: RenderDebugInfo): any;
|
53
|
abstract createText(parentElement: any, value: string, debugInfo?: RenderDebugInfo): any;
|
54
|
abstract projectNodes(parentElement: any, nodes: any[]): void;
|
55
|
abstract attachViewAfter(node: any, viewRootNodes: any[]): void;
|
56
|
abstract detachView(viewRootNodes: any[]): void;
|
57
|
abstract destroyView(hostElement: any, viewAllNodes: any[]): void;
|
58
|
abstract listen(renderElement: any, name: string, callback: Function): Function;
|
59
|
abstract listenGlobal(target: string, name: string, callback: Function): Function;
|
60
|
abstract setElementProperty(renderElement: any, propertyName: string, propertyValue: any): void;
|
61
|
abstract setElementAttribute(renderElement: any, attributeName: string, attributeValue: string): void;
|
62
|
/**
|
63
|
* Used only in debug mode to serialize property changes to dom nodes as attributes.
|
64
|
*/
|
65
|
abstract setBindingDebugInfo(renderElement: any, propertyName: string, propertyValue: string): void;
|
66
|
abstract setElementClass(renderElement: any, className: string, isAdd: boolean): void;
|
67
|
abstract setElementStyle(renderElement: any, styleName: string, styleValue: string): void;
|
68
|
abstract invokeElementMethod(renderElement: any, methodName: string, args?: any[]): void;
|
69
|
abstract setText(renderNode: any, text: string): void;
|
70
|
abstract animate(element: any, startingStyles: any, keyframes: any[], duration: number, delay: number, easing: string, previousPlayers?: any[]): any;
|
71
|
}
|
72
|
export declare const Renderer2Interceptor: InjectionToken<Renderer2[]>;
|
73
|
/**
|
74
|
* Injectable service that provides a low-level interface for modifying the UI.
|
75
|
*
|
76
|
* Use this service to bypass Angular's templating and make custom UI changes that can't be
|
77
|
* expressed declaratively. For example if you need to set a property or an attribute whose name is
|
78
|
* not statically known, use {@link Renderer#setElementProperty} or {@link
|
79
|
* Renderer#setElementAttribute}
|
80
|
* respectively.
|
81
|
*
|
82
|
* If you are implementing a custom renderer, you must implement this interface.
|
83
|
*
|
84
|
* The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`.
|
85
|
*
|
86
|
* @deprecated Use `RendererFactory2` instead.
|
87
|
*/
|
88
|
export declare abstract class RootRenderer {
|
89
|
abstract renderComponent(componentType: RenderComponentType): Renderer;
|
90
|
}
|
91
|
/**
|
92
|
* @experimental
|
93
|
*/
|
94
|
export interface RendererType2 {
|
95
|
id: string;
|
96
|
encapsulation: ViewEncapsulation;
|
97
|
styles: (string | any[])[];
|
98
|
data: {
|
99
|
[kind: string]: any;
|
100
|
};
|
101
|
}
|
102
|
/**
|
103
|
* @experimental
|
104
|
*/
|
105
|
export declare abstract class RendererFactory2 {
|
106
|
abstract createRenderer(hostElement: any, type: RendererType2 | null): Renderer2;
|
107
|
abstract begin?(): void;
|
108
|
abstract end?(): void;
|
109
|
abstract whenRenderingDone?(): Promise<any>;
|
110
|
}
|
111
|
/**
|
112
|
* @experimental
|
113
|
*/
|
114
|
export declare enum RendererStyleFlags2 {
|
115
|
Important = 1,
|
116
|
DashCase = 2,
|
117
|
}
|
118
|
/**
|
119
|
* @experimental
|
120
|
*/
|
121
|
export declare abstract class Renderer2 {
|
122
|
/**
|
123
|
* This field can be used to store arbitrary data on this renderer instance.
|
124
|
* This is useful for renderers that delegate to other renderers.
|
125
|
*/
|
126
|
readonly abstract data: {
|
127
|
[key: string]: any;
|
128
|
};
|
129
|
abstract destroy(): void;
|
130
|
abstract createElement(name: string, namespace?: string | null): any;
|
131
|
abstract createComment(value: string): any;
|
132
|
abstract createText(value: string): any;
|
133
|
/**
|
134
|
* This property is allowed to be null / undefined,
|
135
|
* in which case the view engine won't call it.
|
136
|
* This is used as a performance optimization for production mode.
|
137
|
*/
|
138
|
destroyNode: ((node: any) => void) | null;
|
139
|
abstract appendChild(parent: any, newChild: any): void;
|
140
|
abstract insertBefore(parent: any, newChild: any, refChild: any): void;
|
141
|
abstract removeChild(parent: any, oldChild: any): void;
|
142
|
abstract selectRootElement(selectorOrNode: string | any): any;
|
143
|
/**
|
144
|
* Attention: On WebWorkers, this will always return a value,
|
145
|
* as we are asking for a result synchronously. I.e.
|
146
|
* the caller can't rely on checking whether this is null or not.
|
147
|
*/
|
148
|
abstract parentNode(node: any): any;
|
149
|
/**
|
150
|
* Attention: On WebWorkers, this will always return a value,
|
151
|
* as we are asking for a result synchronously. I.e.
|
152
|
* the caller can't rely on checking whether this is null or not.
|
153
|
*/
|
154
|
abstract nextSibling(node: any): any;
|
155
|
abstract setAttribute(el: any, name: string, value: string, namespace?: string | null): void;
|
156
|
abstract removeAttribute(el: any, name: string, namespace?: string | null): void;
|
157
|
abstract addClass(el: any, name: string): void;
|
158
|
abstract removeClass(el: any, name: string): void;
|
159
|
abstract setStyle(el: any, style: string, value: any, flags?: RendererStyleFlags2): void;
|
160
|
abstract removeStyle(el: any, style: string, flags?: RendererStyleFlags2): void;
|
161
|
abstract setProperty(el: any, name: string, value: any): void;
|
162
|
abstract setValue(node: any, value: string): void;
|
163
|
abstract listen(target: 'window' | 'document' | 'body' | any, eventName: string, callback: (event: any) => boolean | void): () => void;
|
164
|
}
|