[6a3a178] | 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 | */
|
---|
| 8 | import { ChangeDetectionStrategy, ViewEncapsulation } from '../../core';
|
---|
| 9 | import * as o from '../../output/output_ast';
|
---|
| 10 | export interface R3PartialDeclaration {
|
---|
| 11 | /**
|
---|
| 12 | * The minimum version of the compiler that can process this partial declaration.
|
---|
| 13 | */
|
---|
| 14 | minVersion: string;
|
---|
| 15 | /**
|
---|
| 16 | * Version number of the Angular compiler that was used to compile this declaration. The linker
|
---|
| 17 | * will be able to detect which version a library is using and interpret its metadata accordingly.
|
---|
| 18 | */
|
---|
| 19 | version: string;
|
---|
| 20 | /**
|
---|
| 21 | * A reference to the `@angular/core` ES module, which allows access
|
---|
| 22 | * to all Angular exports, including Ivy instructions.
|
---|
| 23 | */
|
---|
| 24 | ngImport: o.Expression;
|
---|
| 25 | /**
|
---|
| 26 | * Reference to the decorated class, which is subject to this partial declaration.
|
---|
| 27 | */
|
---|
| 28 | type: o.Expression;
|
---|
| 29 | }
|
---|
| 30 | /**
|
---|
| 31 | * Describes the shape of the object that the `ɵɵngDeclareDirective()` function accepts.
|
---|
| 32 | */
|
---|
| 33 | export interface R3DeclareDirectiveMetadata extends R3PartialDeclaration {
|
---|
| 34 | /**
|
---|
| 35 | * Unparsed selector of the directive.
|
---|
| 36 | */
|
---|
| 37 | selector?: string;
|
---|
| 38 | /**
|
---|
| 39 | * A mapping of inputs from class property names to binding property names, or to a tuple of
|
---|
| 40 | * binding property name and class property name if the names are different.
|
---|
| 41 | */
|
---|
| 42 | inputs?: {
|
---|
| 43 | [classPropertyName: string]: string | [string, string];
|
---|
| 44 | };
|
---|
| 45 | /**
|
---|
| 46 | * A mapping of outputs from class property names to binding property names.
|
---|
| 47 | */
|
---|
| 48 | outputs?: {
|
---|
| 49 | [classPropertyName: string]: string;
|
---|
| 50 | };
|
---|
| 51 | /**
|
---|
| 52 | * Information about host bindings present on the component.
|
---|
| 53 | */
|
---|
| 54 | host?: {
|
---|
| 55 | /**
|
---|
| 56 | * A mapping of attribute names to their value expression.
|
---|
| 57 | */
|
---|
| 58 | attributes?: {
|
---|
| 59 | [key: string]: o.Expression;
|
---|
| 60 | };
|
---|
| 61 | /**
|
---|
| 62 | * A mapping of event names to their unparsed event handler expression.
|
---|
| 63 | */
|
---|
| 64 | listeners: {
|
---|
| 65 | [key: string]: string;
|
---|
| 66 | };
|
---|
| 67 | /**
|
---|
| 68 | * A mapping of bound properties to their unparsed binding expression.
|
---|
| 69 | */
|
---|
| 70 | properties?: {
|
---|
| 71 | [key: string]: string;
|
---|
| 72 | };
|
---|
| 73 | /**
|
---|
| 74 | * The value of the class attribute, if present. This is stored outside of `attributes` as its
|
---|
| 75 | * string value must be known statically.
|
---|
| 76 | */
|
---|
| 77 | classAttribute?: string;
|
---|
| 78 | /**
|
---|
| 79 | * The value of the style attribute, if present. This is stored outside of `attributes` as its
|
---|
| 80 | * string value must be known statically.
|
---|
| 81 | */
|
---|
| 82 | styleAttribute?: string;
|
---|
| 83 | };
|
---|
| 84 | /**
|
---|
| 85 | * Information about the content queries made by the directive.
|
---|
| 86 | */
|
---|
| 87 | queries?: R3DeclareQueryMetadata[];
|
---|
| 88 | /**
|
---|
| 89 | * Information about the view queries made by the directive.
|
---|
| 90 | */
|
---|
| 91 | viewQueries?: R3DeclareQueryMetadata[];
|
---|
| 92 | /**
|
---|
| 93 | * The list of providers provided by the directive.
|
---|
| 94 | */
|
---|
| 95 | providers?: o.Expression;
|
---|
| 96 | /**
|
---|
| 97 | * The names by which the directive is exported.
|
---|
| 98 | */
|
---|
| 99 | exportAs?: string[];
|
---|
| 100 | /**
|
---|
| 101 | * Whether the directive has an inheritance clause. Defaults to false.
|
---|
| 102 | */
|
---|
| 103 | usesInheritance?: boolean;
|
---|
| 104 | /**
|
---|
| 105 | * Whether the directive implements the `ngOnChanges` hook. Defaults to false.
|
---|
| 106 | */
|
---|
| 107 | usesOnChanges?: boolean;
|
---|
| 108 | }
|
---|
| 109 | /**
|
---|
| 110 | * Describes the shape of the object that the `ɵɵngDeclareComponent()` function accepts.
|
---|
| 111 | */
|
---|
| 112 | export interface R3DeclareComponentMetadata extends R3DeclareDirectiveMetadata {
|
---|
| 113 | /**
|
---|
| 114 | * The component's unparsed template string as opaque expression. The template is represented
|
---|
| 115 | * using either a string literal or template literal without substitutions, but its value is
|
---|
| 116 | * not read directly. Instead, the template parser is given the full source file's text and
|
---|
| 117 | * the range of this expression to parse directly from source.
|
---|
| 118 | */
|
---|
| 119 | template: o.Expression;
|
---|
| 120 | /**
|
---|
| 121 | * Whether the template was inline (using `template`) or external (using `templateUrl`).
|
---|
| 122 | * Defaults to false.
|
---|
| 123 | */
|
---|
| 124 | isInline?: boolean;
|
---|
| 125 | /**
|
---|
| 126 | * CSS from inline styles and included styleUrls.
|
---|
| 127 | */
|
---|
| 128 | styles?: string[];
|
---|
| 129 | /**
|
---|
| 130 | * List of components which matched in the template, including sufficient
|
---|
| 131 | * metadata for each directive to attribute bindings and references within
|
---|
| 132 | * the template to each directive specifically, if the runtime instructions
|
---|
| 133 | * support this.
|
---|
| 134 | */
|
---|
| 135 | components?: R3DeclareUsedDirectiveMetadata[];
|
---|
| 136 | /**
|
---|
| 137 | * List of directives which matched in the template, including sufficient
|
---|
| 138 | * metadata for each directive to attribute bindings and references within
|
---|
| 139 | * the template to each directive specifically, if the runtime instructions
|
---|
| 140 | * support this.
|
---|
| 141 | */
|
---|
| 142 | directives?: R3DeclareUsedDirectiveMetadata[];
|
---|
| 143 | /**
|
---|
| 144 | * A map of pipe names to an expression referencing the pipe type (possibly a forward reference
|
---|
| 145 | * wrapped in a `forwardRef` invocation) which are used in the template.
|
---|
| 146 | */
|
---|
| 147 | pipes?: {
|
---|
| 148 | [pipeName: string]: o.Expression | (() => o.Expression);
|
---|
| 149 | };
|
---|
| 150 | /**
|
---|
| 151 | * The list of view providers defined in the component.
|
---|
| 152 | */
|
---|
| 153 | viewProviders?: o.Expression;
|
---|
| 154 | /**
|
---|
| 155 | * A collection of animation triggers that will be used in the component template.
|
---|
| 156 | */
|
---|
| 157 | animations?: o.Expression;
|
---|
| 158 | /**
|
---|
| 159 | * Strategy used for detecting changes in the component.
|
---|
| 160 | * Defaults to `ChangeDetectionStrategy.Default`.
|
---|
| 161 | */
|
---|
| 162 | changeDetection?: ChangeDetectionStrategy;
|
---|
| 163 | /**
|
---|
| 164 | * An encapsulation policy for the template and CSS styles.
|
---|
| 165 | * Defaults to `ViewEncapsulation.Emulated`.
|
---|
| 166 | */
|
---|
| 167 | encapsulation?: ViewEncapsulation;
|
---|
| 168 | /**
|
---|
| 169 | * Overrides the default interpolation start and end delimiters. Defaults to {{ and }}.
|
---|
| 170 | */
|
---|
| 171 | interpolation?: [string, string];
|
---|
| 172 | /**
|
---|
| 173 | * Whether whitespace in the template should be preserved. Defaults to false.
|
---|
| 174 | */
|
---|
| 175 | preserveWhitespaces?: boolean;
|
---|
| 176 | }
|
---|
| 177 | export interface R3DeclareUsedDirectiveMetadata {
|
---|
| 178 | /**
|
---|
| 179 | * Selector of the directive.
|
---|
| 180 | */
|
---|
| 181 | selector: string;
|
---|
| 182 | /**
|
---|
| 183 | * Reference to the directive class (possibly a forward reference wrapped in a `forwardRef`
|
---|
| 184 | * invocation).
|
---|
| 185 | */
|
---|
| 186 | type: o.Expression | (() => o.Expression);
|
---|
| 187 | /**
|
---|
| 188 | * Property names of the directive's inputs.
|
---|
| 189 | */
|
---|
| 190 | inputs?: string[];
|
---|
| 191 | /**
|
---|
| 192 | * Event names of the directive's outputs.
|
---|
| 193 | */
|
---|
| 194 | outputs?: string[];
|
---|
| 195 | /**
|
---|
| 196 | * Names by which this directive exports itself for references.
|
---|
| 197 | */
|
---|
| 198 | exportAs?: string[];
|
---|
| 199 | }
|
---|
| 200 | export interface R3DeclareQueryMetadata {
|
---|
| 201 | /**
|
---|
| 202 | * Name of the property on the class to update with query results.
|
---|
| 203 | */
|
---|
| 204 | propertyName: string;
|
---|
| 205 | /**
|
---|
| 206 | * Whether to read only the first matching result, or an array of results. Defaults to false.
|
---|
| 207 | */
|
---|
| 208 | first?: boolean;
|
---|
| 209 | /**
|
---|
| 210 | * Either an expression representing a type or `InjectionToken` for the query
|
---|
| 211 | * predicate, or a set of string selectors.
|
---|
| 212 | */
|
---|
| 213 | predicate: o.Expression | string[];
|
---|
| 214 | /**
|
---|
| 215 | * Whether to include only direct children or all descendants. Defaults to false.
|
---|
| 216 | */
|
---|
| 217 | descendants?: boolean;
|
---|
| 218 | /**
|
---|
| 219 | * True to only fire changes if there are underlying changes to the query.
|
---|
| 220 | */
|
---|
| 221 | emitDistinctChangesOnly?: boolean;
|
---|
| 222 | /**
|
---|
| 223 | * An expression representing a type to read from each matched node, or null if the default value
|
---|
| 224 | * for a given node is to be returned.
|
---|
| 225 | */
|
---|
| 226 | read?: o.Expression;
|
---|
| 227 | /**
|
---|
| 228 | * Whether or not this query should collect only static results. Defaults to false.
|
---|
| 229 | *
|
---|
| 230 | * If static is true, the query's results will be set on the component after nodes are created,
|
---|
| 231 | * but before change detection runs. This means that any results that relied upon change detection
|
---|
| 232 | * to run (e.g. results inside *ngIf or *ngFor views) will not be collected. Query results are
|
---|
| 233 | * available in the ngOnInit hook.
|
---|
| 234 | *
|
---|
| 235 | * If static is false, the query's results will be set on the component after change detection
|
---|
| 236 | * runs. This means that the query results can contain nodes inside *ngIf or *ngFor views, but
|
---|
| 237 | * the results will not be available in the ngOnInit hook (only in the ngAfterContentInit for
|
---|
| 238 | * content hooks and ngAfterViewInit for view hooks).
|
---|
| 239 | */
|
---|
| 240 | static?: boolean;
|
---|
| 241 | }
|
---|
| 242 | /**
|
---|
| 243 | * Describes the shape of the objects that the `ɵɵngDeclareNgModule()` accepts.
|
---|
| 244 | */
|
---|
| 245 | export interface R3DeclareNgModuleMetadata extends R3PartialDeclaration {
|
---|
| 246 | /**
|
---|
| 247 | * An array of expressions representing the bootstrap components specified by the module.
|
---|
| 248 | */
|
---|
| 249 | bootstrap?: o.Expression[];
|
---|
| 250 | /**
|
---|
| 251 | * An array of expressions representing the directives and pipes declared by the module.
|
---|
| 252 | */
|
---|
| 253 | declarations?: o.Expression[];
|
---|
| 254 | /**
|
---|
| 255 | * An array of expressions representing the imports of the module.
|
---|
| 256 | */
|
---|
| 257 | imports?: o.Expression[];
|
---|
| 258 | /**
|
---|
| 259 | * An array of expressions representing the exports of the module.
|
---|
| 260 | */
|
---|
| 261 | exports?: o.Expression[];
|
---|
| 262 | /**
|
---|
| 263 | * The set of schemas that declare elements to be allowed in the NgModule.
|
---|
| 264 | */
|
---|
| 265 | schemas?: o.Expression[];
|
---|
| 266 | /** Unique ID or expression representing the unique ID of an NgModule. */
|
---|
| 267 | id?: o.Expression;
|
---|
| 268 | }
|
---|
| 269 | /**
|
---|
| 270 | * Describes the shape of the objects that the `ɵɵngDeclareInjector()` accepts.
|
---|
| 271 | */
|
---|
| 272 | export interface R3DeclareInjectorMetadata extends R3PartialDeclaration {
|
---|
| 273 | /**
|
---|
| 274 | * The list of providers provided by the injector.
|
---|
| 275 | */
|
---|
| 276 | providers?: o.Expression;
|
---|
| 277 | /**
|
---|
| 278 | * The list of imports into the injector.
|
---|
| 279 | */
|
---|
| 280 | imports?: o.Expression[];
|
---|
| 281 | }
|
---|
| 282 | /**
|
---|
| 283 | * Describes the shape of the object that the `ɵɵngDeclarePipe()` function accepts.
|
---|
| 284 | *
|
---|
| 285 | * This interface serves primarily as documentation, as conformance to this interface is not
|
---|
| 286 | * enforced during linking.
|
---|
| 287 | */
|
---|
| 288 | export interface R3DeclarePipeMetadata extends R3PartialDeclaration {
|
---|
| 289 | /**
|
---|
| 290 | * The name to use in templates to refer to this pipe.
|
---|
| 291 | */
|
---|
| 292 | name: string;
|
---|
| 293 | /**
|
---|
| 294 | * Whether this pipe is "pure".
|
---|
| 295 | *
|
---|
| 296 | * A pure pipe's `transform()` method is only invoked when its input arguments change.
|
---|
| 297 | *
|
---|
| 298 | * Default: true.
|
---|
| 299 | */
|
---|
| 300 | pure?: boolean;
|
---|
| 301 | }
|
---|
| 302 | /**
|
---|
| 303 | * Describes the shape of the object that the `ɵɵngDeclareFactory()` function accepts.
|
---|
| 304 | *
|
---|
| 305 | * This interface serves primarily as documentation, as conformance to this interface is not
|
---|
| 306 | * enforced during linking.
|
---|
| 307 | */
|
---|
| 308 | export interface R3DeclareFactoryMetadata extends R3PartialDeclaration {
|
---|
| 309 | /**
|
---|
| 310 | * A collection of dependencies that this factory relies upon.
|
---|
| 311 | *
|
---|
| 312 | * If this is `null`, then the type's constructor is nonexistent and will be inherited from an
|
---|
| 313 | * ancestor of the type.
|
---|
| 314 | *
|
---|
| 315 | * If this is `'invalid'`, then one or more of the parameters wasn't resolvable and any attempt to
|
---|
| 316 | * use these deps will result in a runtime error.
|
---|
| 317 | */
|
---|
| 318 | deps: R3DeclareDependencyMetadata[] | 'invalid' | null;
|
---|
| 319 | /**
|
---|
| 320 | * Type of the target being created by the factory.
|
---|
| 321 | */
|
---|
| 322 | target: FactoryTarget;
|
---|
| 323 | }
|
---|
| 324 | export declare enum FactoryTarget {
|
---|
| 325 | Directive = 0,
|
---|
| 326 | Component = 1,
|
---|
| 327 | Injectable = 2,
|
---|
| 328 | Pipe = 3,
|
---|
| 329 | NgModule = 4
|
---|
| 330 | }
|
---|
| 331 | /**
|
---|
| 332 | * Describes the shape of the object that the `ɵɵngDeclareInjectable()` function accepts.
|
---|
| 333 | *
|
---|
| 334 | * This interface serves primarily as documentation, as conformance to this interface is not
|
---|
| 335 | * enforced during linking.
|
---|
| 336 | */
|
---|
| 337 | export interface R3DeclareInjectableMetadata extends R3PartialDeclaration {
|
---|
| 338 | /**
|
---|
| 339 | * If provided, specifies that the declared injectable belongs to a particular injector:
|
---|
| 340 | * - `InjectorType` such as `NgModule`,
|
---|
| 341 | * - `'root'` the root injector
|
---|
| 342 | * - `'any'` all injectors.
|
---|
| 343 | * If not provided, then it does not belong to any injector. Must be explicitly listed in the
|
---|
| 344 | * providers of an injector.
|
---|
| 345 | */
|
---|
| 346 | providedIn?: o.Expression;
|
---|
| 347 | /**
|
---|
| 348 | * If provided, an expression that evaluates to a class to use when creating an instance of this
|
---|
| 349 | * injectable.
|
---|
| 350 | */
|
---|
| 351 | useClass?: o.Expression;
|
---|
| 352 | /**
|
---|
| 353 | * If provided, an expression that evaluates to a function to use when creating an instance of
|
---|
| 354 | * this injectable.
|
---|
| 355 | */
|
---|
| 356 | useFactory?: o.Expression;
|
---|
| 357 | /**
|
---|
| 358 | * If provided, an expression that evaluates to a token of another injectable that this injectable
|
---|
| 359 | * aliases.
|
---|
| 360 | */
|
---|
| 361 | useExisting?: o.Expression;
|
---|
| 362 | /**
|
---|
| 363 | * If provided, an expression that evaluates to the value of the instance of this injectable.
|
---|
| 364 | */
|
---|
| 365 | useValue?: o.Expression;
|
---|
| 366 | /**
|
---|
| 367 | * An array of dependencies to support instantiating this injectable via `useClass` or
|
---|
| 368 | * `useFactory`.
|
---|
| 369 | */
|
---|
| 370 | deps?: R3DeclareDependencyMetadata[];
|
---|
| 371 | }
|
---|
| 372 | /**
|
---|
| 373 | * Metadata indicating how a dependency should be injected into a factory.
|
---|
| 374 | */
|
---|
| 375 | export interface R3DeclareDependencyMetadata {
|
---|
| 376 | /**
|
---|
| 377 | * An expression representing the token or value to be injected, or `null` if the dependency is
|
---|
| 378 | * not valid.
|
---|
| 379 | *
|
---|
| 380 | * If this dependency is due to the `@Attribute()` decorator, then this is an expression
|
---|
| 381 | * evaluating to the name of the attribute.
|
---|
| 382 | */
|
---|
| 383 | token: o.Expression | null;
|
---|
| 384 | /**
|
---|
| 385 | * Whether the dependency is injecting an attribute value.
|
---|
| 386 | * Default: false.
|
---|
| 387 | */
|
---|
| 388 | attribute?: boolean;
|
---|
| 389 | /**
|
---|
| 390 | * Whether the dependency has an @Host qualifier.
|
---|
| 391 | * Default: false,
|
---|
| 392 | */
|
---|
| 393 | host?: boolean;
|
---|
| 394 | /**
|
---|
| 395 | * Whether the dependency has an @Optional qualifier.
|
---|
| 396 | * Default: false,
|
---|
| 397 | */
|
---|
| 398 | optional?: boolean;
|
---|
| 399 | /**
|
---|
| 400 | * Whether the dependency has an @Self qualifier.
|
---|
| 401 | * Default: false,
|
---|
| 402 | */
|
---|
| 403 | self?: boolean;
|
---|
| 404 | /**
|
---|
| 405 | * Whether the dependency has an @SkipSelf qualifier.
|
---|
| 406 | * Default: false,
|
---|
| 407 | */
|
---|
| 408 | skipSelf?: boolean;
|
---|
| 409 | }
|
---|
| 410 | /**
|
---|
| 411 | * Describes the shape of the object that the `ɵɵngDeclareClassMetadata()` function accepts.
|
---|
| 412 | *
|
---|
| 413 | * This interface serves primarily as documentation, as conformance to this interface is not
|
---|
| 414 | * enforced during linking.
|
---|
| 415 | */
|
---|
| 416 | export interface R3DeclareClassMetadata extends R3PartialDeclaration {
|
---|
| 417 | /**
|
---|
| 418 | * The Angular decorators of the class.
|
---|
| 419 | */
|
---|
| 420 | decorators: o.Expression;
|
---|
| 421 | /**
|
---|
| 422 | * Optionally specifies the constructor parameters, their types and the Angular decorators of each
|
---|
| 423 | * parameter. This property is omitted if the class does not have a constructor.
|
---|
| 424 | */
|
---|
| 425 | ctorParameters?: o.Expression;
|
---|
| 426 | /**
|
---|
| 427 | * Optionally specifies the Angular decorators applied to the class properties. This property is
|
---|
| 428 | * omitted if no properties have any decorators.
|
---|
| 429 | */
|
---|
| 430 | propDecorators?: o.Expression;
|
---|
| 431 | }
|
---|