UNPKG

11.2 kBTypeScriptView Raw
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 */
8export interface Inject {
9 token: any;
10}
11export declare const createInject: MetadataFactory<Inject>;
12export declare const createInjectionToken: MetadataFactory<object>;
13export interface Attribute {
14 attributeName?: string;
15}
16export declare const createAttribute: MetadataFactory<Attribute>;
17export interface Query {
18 descendants: boolean;
19 first: boolean;
20 read: any;
21 isViewQuery: boolean;
22 selector: any;
23 static?: boolean;
24}
25export declare const createContentChildren: MetadataFactory<Query>;
26export declare const createContentChild: MetadataFactory<Query>;
27export declare const createViewChildren: MetadataFactory<Query>;
28export declare const createViewChild: MetadataFactory<Query>;
29export interface Directive {
30 selector?: string;
31 inputs?: string[];
32 outputs?: string[];
33 host?: {
34 [key: string]: string;
35 };
36 providers?: Provider[];
37 exportAs?: string;
38 queries?: {
39 [key: string]: any;
40 };
41 guards?: {
42 [key: string]: any;
43 };
44}
45export declare const createDirective: MetadataFactory<Directive>;
46export interface Component extends Directive {
47 changeDetection?: ChangeDetectionStrategy;
48 viewProviders?: Provider[];
49 moduleId?: string;
50 templateUrl?: string;
51 template?: string;
52 styleUrls?: string[];
53 styles?: string[];
54 animations?: any[];
55 encapsulation?: ViewEncapsulation;
56 interpolation?: [string, string];
57 entryComponents?: Array<Type | any[]>;
58 preserveWhitespaces?: boolean;
59}
60export declare enum ViewEncapsulation {
61 Emulated = 0,
62 Native = 1,
63 None = 2,
64 ShadowDom = 3
65}
66export declare enum ChangeDetectionStrategy {
67 OnPush = 0,
68 Default = 1
69}
70export declare const createComponent: MetadataFactory<Component>;
71export interface Pipe {
72 name: string;
73 pure?: boolean;
74}
75export declare const createPipe: MetadataFactory<Pipe>;
76export interface Input {
77 bindingPropertyName?: string;
78}
79export declare const createInput: MetadataFactory<Input>;
80export interface Output {
81 bindingPropertyName?: string;
82}
83export declare const createOutput: MetadataFactory<Output>;
84export interface HostBinding {
85 hostPropertyName?: string;
86}
87export declare const createHostBinding: MetadataFactory<HostBinding>;
88export interface HostListener {
89 eventName?: string;
90 args?: string[];
91}
92export declare const createHostListener: MetadataFactory<HostListener>;
93export interface NgModule {
94 providers?: Provider[];
95 declarations?: Array<Type | any[]>;
96 imports?: Array<Type | ModuleWithProviders | any[]>;
97 exports?: Array<Type | any[]>;
98 entryComponents?: Array<Type | any[]>;
99 bootstrap?: Array<Type | any[]>;
100 schemas?: Array<SchemaMetadata | any[]>;
101 id?: string;
102}
103export declare const createNgModule: MetadataFactory<NgModule>;
104export interface ModuleWithProviders {
105 ngModule: Type;
106 providers?: Provider[];
107}
108export interface Injectable {
109 providedIn?: Type | 'root' | any;
110 useClass?: Type | any;
111 useExisting?: Type | any;
112 useValue?: any;
113 useFactory?: Type | any;
114 deps?: Array<Type | any[]>;
115}
116export declare const createInjectable: MetadataFactory<Injectable>;
117export interface SchemaMetadata {
118 name: string;
119}
120export declare const CUSTOM_ELEMENTS_SCHEMA: SchemaMetadata;
121export declare const NO_ERRORS_SCHEMA: SchemaMetadata;
122export declare const createOptional: MetadataFactory<unknown>;
123export declare const createSelf: MetadataFactory<unknown>;
124export declare const createSkipSelf: MetadataFactory<unknown>;
125export declare const createHost: MetadataFactory<unknown>;
126export interface Type extends Function {
127 new (...args: any[]): any;
128}
129export declare const Type: FunctionConstructor;
130export declare enum SecurityContext {
131 NONE = 0,
132 HTML = 1,
133 STYLE = 2,
134 SCRIPT = 3,
135 URL = 4,
136 RESOURCE_URL = 5
137}
138export declare type Provider = any;
139export declare const enum NodeFlags {
140 None = 0,
141 TypeElement = 1,
142 TypeText = 2,
143 ProjectedTemplate = 4,
144 CatRenderNode = 3,
145 TypeNgContent = 8,
146 TypePipe = 16,
147 TypePureArray = 32,
148 TypePureObject = 64,
149 TypePurePipe = 128,
150 CatPureExpression = 224,
151 TypeValueProvider = 256,
152 TypeClassProvider = 512,
153 TypeFactoryProvider = 1024,
154 TypeUseExistingProvider = 2048,
155 LazyProvider = 4096,
156 PrivateProvider = 8192,
157 TypeDirective = 16384,
158 Component = 32768,
159 CatProviderNoDirective = 3840,
160 CatProvider = 20224,
161 OnInit = 65536,
162 OnDestroy = 131072,
163 DoCheck = 262144,
164 OnChanges = 524288,
165 AfterContentInit = 1048576,
166 AfterContentChecked = 2097152,
167 AfterViewInit = 4194304,
168 AfterViewChecked = 8388608,
169 EmbeddedViews = 16777216,
170 ComponentView = 33554432,
171 TypeContentQuery = 67108864,
172 TypeViewQuery = 134217728,
173 StaticQuery = 268435456,
174 DynamicQuery = 536870912,
175 TypeModuleProvider = 1073741824,
176 CatQuery = 201326592,
177 Types = 201347067
178}
179export declare const enum DepFlags {
180 None = 0,
181 SkipSelf = 1,
182 Optional = 2,
183 Self = 4,
184 Value = 8
185}
186/**
187 * Injection flags for DI.
188 */
189export declare const enum InjectFlags {
190 Default = 0,
191 /**
192 * Specifies that an injector should retrieve a dependency from any injector until reaching the
193 * host element of the current component. (Only used with Element Injector)
194 */
195 Host = 1,
196 /** Don't descend into ancestors of the node requesting injection. */
197 Self = 2,
198 /** Skip the node that is requesting injection. */
199 SkipSelf = 4,
200 /** Inject `defaultValue` instead if token not found. */
201 Optional = 8
202}
203export declare const enum ArgumentType {
204 Inline = 0,
205 Dynamic = 1
206}
207export declare const enum BindingFlags {
208 TypeElementAttribute = 1,
209 TypeElementClass = 2,
210 TypeElementStyle = 4,
211 TypeProperty = 8,
212 SyntheticProperty = 16,
213 SyntheticHostProperty = 32,
214 CatSyntheticProperty = 48,
215 Types = 15
216}
217export declare const enum QueryBindingType {
218 First = 0,
219 All = 1
220}
221export declare const enum QueryValueType {
222 ElementRef = 0,
223 RenderElement = 1,
224 TemplateRef = 2,
225 ViewContainerRef = 3,
226 Provider = 4
227}
228export declare const enum ViewFlags {
229 None = 0,
230 OnPush = 2
231}
232export declare enum MissingTranslationStrategy {
233 Error = 0,
234 Warning = 1,
235 Ignore = 2
236}
237export interface MetadataFactory<T> {
238 (...args: any[]): T;
239 isTypeOf(obj: any): obj is T;
240 ngMetadataName: string;
241}
242export interface Route {
243 children?: Route[];
244 loadChildren?: string | Type | any;
245}
246/**
247 * Flags used to generate R3-style CSS Selectors. They are pasted from
248 * core/src/render3/projection.ts because they cannot be referenced directly.
249 */
250export declare const enum SelectorFlags {
251 /** Indicates this is the beginning of a new negative selector */
252 NOT = 1,
253 /** Mode for matching attributes */
254 ATTRIBUTE = 2,
255 /** Mode for matching tag names */
256 ELEMENT = 4,
257 /** Mode for matching class names */
258 CLASS = 8
259}
260export declare type R3CssSelector = (string | SelectorFlags)[];
261export declare type R3CssSelectorList = R3CssSelector[];
262export declare function parseSelectorToR3Selector(selector: string | null): R3CssSelectorList;
263/**
264 * Flags passed into template functions to determine which blocks (i.e. creation, update)
265 * should be executed.
266 *
267 * Typically, a template runs both the creation block and the update block on initialization and
268 * subsequent runs only execute the update block. However, dynamically created views require that
269 * the creation block be executed separately from the update block (for backwards compat).
270 */
271export declare const enum RenderFlags {
272 Create = 1,
273 Update = 2
274}
275/**
276 * A set of marker values to be used in the attributes arrays. These markers indicate that some
277 * items are not regular attributes and the processing should be adapted accordingly.
278 */
279export declare const enum AttributeMarker {
280 /**
281 * Marker indicates that the following 3 values in the attributes array are:
282 * namespaceUri, attributeName, attributeValue
283 * in that order.
284 */
285 NamespaceURI = 0,
286 /**
287 * Signals class declaration.
288 *
289 * Each value following `Classes` designates a class name to include on the element.
290 * ## Example:
291 *
292 * Given:
293 * ```
294 * <div class="foo bar baz">...<d/vi>
295 * ```
296 *
297 * the generated code is:
298 * ```
299 * var _c1 = [AttributeMarker.Classes, 'foo', 'bar', 'baz'];
300 * ```
301 */
302 Classes = 1,
303 /**
304 * Signals style declaration.
305 *
306 * Each pair of values following `Styles` designates a style name and value to include on the
307 * element.
308 * ## Example:
309 *
310 * Given:
311 * ```
312 * <div style="width:100px; height:200px; color:red">...</div>
313 * ```
314 *
315 * the generated code is:
316 * ```
317 * var _c1 = [AttributeMarker.Styles, 'width', '100px', 'height'. '200px', 'color', 'red'];
318 * ```
319 */
320 Styles = 2,
321 /**
322 * Signals that the following attribute names were extracted from input or output bindings.
323 *
324 * For example, given the following HTML:
325 *
326 * ```
327 * <div moo="car" [foo]="exp" (bar)="doSth()">
328 * ```
329 *
330 * the generated code is:
331 *
332 * ```
333 * var _c1 = ['moo', 'car', AttributeMarker.Bindings, 'foo', 'bar'];
334 * ```
335 */
336 Bindings = 3,
337 /**
338 * Signals that the following attribute names were hoisted from an inline-template declaration.
339 *
340 * For example, given the following HTML:
341 *
342 * ```
343 * <div *ngFor="let value of values; trackBy:trackBy" dirA [dirB]="value">
344 * ```
345 *
346 * the generated code for the `template()` instruction would include:
347 *
348 * ```
349 * ['dirA', '', AttributeMarker.Bindings, 'dirB', AttributeMarker.Template, 'ngFor', 'ngForOf',
350 * 'ngForTrackBy', 'let-value']
351 * ```
352 *
353 * while the generated code for the `element()` instruction inside the template function would
354 * include:
355 *
356 * ```
357 * ['dirA', '', AttributeMarker.Bindings, 'dirB']
358 * ```
359 */
360 Template = 4,
361 /**
362 * Signals that the following attribute is `ngProjectAs` and its value is a parsed `CssSelector`.
363 *
364 * For example, given the following HTML:
365 *
366 * ```
367 * <h1 attr="value" ngProjectAs="[title]">
368 * ```
369 *
370 * the generated code for the `element()` instruction would include:
371 *
372 * ```
373 * ['attr', 'value', AttributeMarker.ProjectAs, ['', 'title', '']]
374 * ```
375 */
376 ProjectAs = 5,
377 /**
378 * Signals that the following attribute will be translated by runtime i18n
379 *
380 * For example, given the following HTML:
381 *
382 * ```
383 * <div moo="car" foo="value" i18n-foo [bar]="binding" i18n-bar>
384 * ```
385 *
386 * the generated code is:
387 *
388 * ```
389 * var _c1 = ['moo', 'car', AttributeMarker.I18n, 'foo', 'bar'];
390 */
391 I18n = 6
392}