@angular/core 12.0.0-rc.0 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/bundles/core-testing.umd.js +1 -1
  2. package/bundles/core-testing.umd.js.map +1 -1
  3. package/bundles/core.umd.js +95 -73
  4. package/bundles/core.umd.js.map +1 -1
  5. package/core.d.ts +58 -46
  6. package/core.metadata.json +1 -1
  7. package/esm2015/src/core_private_export.js +2 -1
  8. package/esm2015/src/debug/debug_node.js +11 -10
  9. package/esm2015/src/di/index.js +1 -1
  10. package/esm2015/src/di/inject_switch.js +1 -1
  11. package/esm2015/src/di/injector.js +1 -1
  12. package/esm2015/src/di/injector_compatibility.js +1 -1
  13. package/esm2015/src/di/interface/provider.js +1 -1
  14. package/esm2015/src/di/provider_token.js +9 -0
  15. package/esm2015/src/di/r3_injector.js +1 -1
  16. package/esm2015/src/metadata/di.js +1 -1
  17. package/esm2015/src/render3/component_ref.js +1 -1
  18. package/esm2015/src/render3/di.js +1 -1
  19. package/esm2015/src/render3/error_code.js +1 -1
  20. package/esm2015/src/render3/i18n/i18n_parse.js +36 -9
  21. package/esm2015/src/render3/instructions/di.js +1 -1
  22. package/esm2015/src/render3/instructions/listener.js +9 -14
  23. package/esm2015/src/render3/interfaces/injector.js +1 -1
  24. package/esm2015/src/render3/interfaces/query.js +1 -1
  25. package/esm2015/src/render3/interfaces/renderer.js +1 -1
  26. package/esm2015/src/render3/interfaces/view.js +1 -1
  27. package/esm2015/src/render3/jit/module.js +5 -5
  28. package/esm2015/src/render3/node_manipulation.js +18 -3
  29. package/esm2015/src/render3/query.js +1 -1
  30. package/esm2015/src/render3/util/discovery_utils.js +19 -28
  31. package/esm2015/src/render3/util/misc_utils.js +4 -4
  32. package/esm2015/src/render3/view_ref.js +1 -4
  33. package/esm2015/src/testability/testability.js +3 -3
  34. package/esm2015/src/version.js +1 -1
  35. package/esm2015/testing/src/r3_test_bed.js +1 -1
  36. package/esm2015/testing/src/test_bed.js +1 -1
  37. package/esm2015/testing/src/test_bed_common.js +1 -1
  38. package/fesm2015/core.js +97 -71
  39. package/fesm2015/core.js.map +1 -1
  40. package/fesm2015/testing.js +1 -1
  41. package/fesm2015/testing.js.map +1 -1
  42. package/package.json +2 -2
  43. package/src/r3_symbols.d.ts +15 -6
  44. package/testing/testing.d.ts +20 -20
  45. package/testing/testing.metadata.json +1 -1
  46. package/testing.d.ts +1 -1
package/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v12.0.0-rc.0
2
+ * @license Angular v12.0.0
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1328,11 +1328,11 @@ export declare interface ContentChildDecorator {
1328
1328
  *
1329
1329
  * @Annotation
1330
1330
  */
1331
- (selector: Type<any> | InjectionToken<unknown> | Function | string, opts?: {
1331
+ (selector: ProviderToken<unknown> | Function | string, opts?: {
1332
1332
  read?: any;
1333
1333
  static?: boolean;
1334
1334
  }): any;
1335
- new (selector: Type<any> | InjectionToken<unknown> | Function | string, opts?: {
1335
+ new (selector: ProviderToken<unknown> | Function | string, opts?: {
1336
1336
  read?: any;
1337
1337
  static?: boolean;
1338
1338
  }): ContentChild;
@@ -1402,12 +1402,12 @@ export declare interface ContentChildrenDecorator {
1402
1402
  *
1403
1403
  * @Annotation
1404
1404
  */
1405
- (selector: Type<any> | InjectionToken<unknown> | Function | string, opts?: {
1405
+ (selector: ProviderToken<unknown> | Function | string, opts?: {
1406
1406
  descendants?: boolean;
1407
1407
  emitDistinctChangesOnly?: boolean;
1408
1408
  read?: any;
1409
1409
  }): any;
1410
- new (selector: Type<any> | InjectionToken<unknown> | Function | string, opts?: {
1410
+ new (selector: ProviderToken<unknown> | Function | string, opts?: {
1411
1411
  descendants?: boolean;
1412
1412
  emitDistinctChangesOnly?: boolean;
1413
1413
  read?: any;
@@ -2670,10 +2670,7 @@ export declare interface GetTestability {
2670
2670
 
2671
2671
  declare type GlobalTargetName = 'document' | 'window' | 'body';
2672
2672
 
2673
- declare type GlobalTargetResolver = (element: any) => {
2674
- name: GlobalTargetName;
2675
- target: EventTarget;
2676
- };
2673
+ declare type GlobalTargetResolver = (element: any) => EventTarget;
2677
2674
 
2678
2675
  /**
2679
2676
  * Flag to signify that this `LContainer` may have transplanted views which need to be change
@@ -3478,9 +3475,9 @@ export declare abstract class Injector {
3478
3475
  * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
3479
3476
  * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
3480
3477
  */
3481
- abstract get<T>(token: Type<T> | AbstractType<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
3478
+ abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
3482
3479
  /**
3483
- * @deprecated from v4.0.0 use Type<T>, AbstractType<T> or InjectionToken<T>
3480
+ * @deprecated from v4.0.0 use ProviderToken<T>
3484
3481
  * @suppress {duplicate}
3485
3482
  */
3486
3483
  abstract get(token: any, notFoundValue?: any): any;
@@ -5479,6 +5476,15 @@ declare interface ProviderOverride {
5479
5476
  deprecatedBehavior: boolean;
5480
5477
  }
5481
5478
 
5479
+ /**
5480
+ * @description
5481
+ *
5482
+ * Token that can be used to retrieve an instance from an injector or through a query.
5483
+ *
5484
+ * @publicApi
5485
+ */
5486
+ export declare type ProviderToken<T> = Type<T> | AbstractType<T> | InjectionToken<T>;
5487
+
5482
5488
  /**
5483
5489
  * Testability API.
5484
5490
  * `declare` keyword causes tsickle to generate externs, so these methods are
@@ -5815,7 +5821,7 @@ declare class R3Injector {
5815
5821
  * hook was found.
5816
5822
  */
5817
5823
  destroy(): void;
5818
- get<T>(token: Type<T> | AbstractType<T> | InjectionToken<T>, notFoundValue?: any, flags?: InjectFlags): T;
5824
+ get<T>(token: ProviderToken<T>, notFoundValue?: any, flags?: InjectFlags): T;
5819
5825
  toString(): string;
5820
5826
  private assertNotDestroyed;
5821
5827
  /**
@@ -6834,7 +6840,7 @@ export declare interface StaticClassSansProvider {
6834
6840
  * Describes how an `Injector` should be configured as static (that is, without reflection).
6835
6841
  * A static provider provides tokens to an injector for various types of dependencies.
6836
6842
  *
6837
- * @see [Injector.create()](/api/core/Injector#create).
6843
+ * @see `Injector.create()`.
6838
6844
  * @see ["Dependency Injection Guide"](guide/dependency-injection-providers).
6839
6845
  *
6840
6846
  * @publicApi
@@ -6956,7 +6962,7 @@ declare interface TContainerNode extends TNode {
6956
6962
  *
6957
6963
  * Injector bloom filters are also stored here.
6958
6964
  */
6959
- declare type TData = (TNode | ɵPipeDef<any> | ɵDirectiveDef<any> | ɵComponentDef<any> | number | TStylingRange | TStylingKey | Type<any> | InjectionToken<any> | TI18n | I18nUpdateOpCodes | TIcu | null | string)[];
6965
+ declare type TData = (TNode | ɵPipeDef<any> | ɵDirectiveDef<any> | ɵComponentDef<any> | number | TStylingRange | TStylingKey | ProviderToken<any> | TI18n | I18nUpdateOpCodes | TIcu | null | string)[];
6960
6966
 
6961
6967
  /** Static data for an <ng-container> */
6962
6968
  declare interface TElementContainerNode extends TNode {
@@ -7011,8 +7017,8 @@ export declare abstract class TemplateRef<C> {
7011
7017
 
7012
7018
  /**
7013
7019
  * The Testability service provides testing hooks that can be accessed from
7014
- * the browser and by services such as Protractor. Each bootstrapped Angular
7015
- * application on the page will have an instance of Testability.
7020
+ * the browser. Each bootstrapped Angular application on the page will have
7021
+ * an instance of Testability.
7016
7022
  * @publicApi
7017
7023
  */
7018
7024
  export declare class Testability implements PublicTestability {
@@ -7825,7 +7831,7 @@ declare interface TQuery {
7825
7831
  * An object representing query metadata extracted from query annotations.
7826
7832
  */
7827
7833
  declare interface TQueryMetadata {
7828
- predicate: Type<any> | InjectionToken<unknown> | string[];
7834
+ predicate: ProviderToken<unknown> | string[];
7829
7835
  read: any;
7830
7836
  flags: QueryFlags;
7831
7837
  }
@@ -8492,11 +8498,11 @@ export declare interface ViewChildDecorator {
8492
8498
  *
8493
8499
  * @Annotation
8494
8500
  */
8495
- (selector: Type<any> | InjectionToken<unknown> | Function | string, opts?: {
8501
+ (selector: ProviderToken<unknown> | Function | string, opts?: {
8496
8502
  read?: any;
8497
8503
  static?: boolean;
8498
8504
  }): any;
8499
- new (selector: Type<any> | InjectionToken<unknown> | Function | string, opts?: {
8505
+ new (selector: ProviderToken<unknown> | Function | string, opts?: {
8500
8506
  read?: any;
8501
8507
  static?: boolean;
8502
8508
  }): ViewChild;
@@ -8554,11 +8560,11 @@ export declare interface ViewChildrenDecorator {
8554
8560
  *
8555
8561
  * @Annotation
8556
8562
  */
8557
- (selector: Type<any> | InjectionToken<unknown> | Function | string, opts?: {
8563
+ (selector: ProviderToken<unknown> | Function | string, opts?: {
8558
8564
  read?: any;
8559
8565
  emitDistinctChangesOnly?: boolean;
8560
8566
  }): any;
8561
- new (selector: Type<any> | InjectionToken<unknown> | Function | string, opts?: {
8567
+ new (selector: ProviderToken<unknown> | Function | string, opts?: {
8562
8568
  read?: any;
8563
8569
  emitDistinctChangesOnly?: boolean;
8564
8570
  }): ViewChildren;
@@ -8822,9 +8828,6 @@ declare class ViewRef_2<T> implements EmbeddedViewRef<T>, InternalViewRef, viewE
8822
8828
  /**
8823
8829
  * Marks a view and all of its ancestors dirty.
8824
8830
  *
8825
- * It also triggers change detection by calling `scheduleTick` internally, which coalesces
8826
- * multiple `markForCheck` calls to into one change detection run.
8827
- *
8828
8831
  * This can be used to ensure an {@link ChangeDetectionStrategy#OnPush OnPush} component is
8829
8832
  * checked when it needs to be re-rendered but the two normal triggers haven't marked it
8830
8833
  * dirty (i.e. inputs haven't changed and events haven't fired in the view).
@@ -9099,9 +9102,9 @@ export declare function ɵand(flags: ɵNodeFlags, matchedQueriesDsl: null | [str
9099
9102
  /** Checks whether a function is wrapped by a `forwardRef`. */
9100
9103
  export declare function ɵangular_packages_core_core_a(fn: any): fn is () => any;
9101
9104
 
9102
- export declare function ɵangular_packages_core_core_b<T>(token: Type<T> | AbstractType<T> | InjectionToken<T>): T;
9105
+ export declare function ɵangular_packages_core_core_b<T>(token: ProviderToken<T>): T;
9103
9106
 
9104
- export declare function ɵangular_packages_core_core_b<T>(token: Type<T> | AbstractType<T> | InjectionToken<T>, flags?: InjectFlags): T | null;
9107
+ export declare function ɵangular_packages_core_core_b<T>(token: ProviderToken<T>, flags?: InjectFlags): T | null;
9105
9108
 
9106
9109
  /**
9107
9110
  * Schedule work at next available slot.
@@ -9352,7 +9355,7 @@ export declare class ɵangular_packages_core_core_bw implements Injector {
9352
9355
  get(token: any, notFoundValue?: any): any;
9353
9356
  }
9354
9357
 
9355
- export declare function ɵangular_packages_core_core_bx(): (<T>(token: Type<T> | AbstractType<T> | InjectionToken<T>, flags?: InjectFlags | undefined) => T | null) | undefined;
9358
+ export declare function ɵangular_packages_core_core_bx(): (<T>(token: ProviderToken<T>, flags?: InjectFlags | undefined) => T | null) | undefined;
9356
9359
 
9357
9360
 
9358
9361
  /**
@@ -11330,6 +11333,24 @@ export declare function ɵresolveComponentResources(resourceResolver: (url: stri
11330
11333
  text(): Promise<string>;
11331
11334
  }>)): Promise<void>;
11332
11335
 
11336
+ export declare class ɵRuntimeError extends Error {
11337
+ code: ɵRuntimeErrorCode;
11338
+ constructor(code: ɵRuntimeErrorCode, message: string);
11339
+ }
11340
+
11341
+
11342
+ export declare const enum ɵRuntimeErrorCode {
11343
+ EXPRESSION_CHANGED_AFTER_CHECKED = "100",
11344
+ CYCLIC_DI_DEPENDENCY = "200",
11345
+ PROVIDER_NOT_FOUND = "201",
11346
+ MULTIPLE_COMPONENTS_MATCH = "300",
11347
+ EXPORT_NOT_FOUND = "301",
11348
+ PIPE_NOT_FOUND = "302",
11349
+ UNKNOWN_BINDING = "303",
11350
+ UNKNOWN_ELEMENT = "304",
11351
+ TEMPLATE_STRUCTURE_ERROR = "305"
11352
+ }
11353
+
11333
11354
  /**
11334
11355
  * Marker interface for a value that's safe to use as HTML.
11335
11356
  *
@@ -12191,7 +12212,7 @@ export declare type ɵɵComponentDeclaration<T, Selector extends String, ExportA
12191
12212
  *
12192
12213
  * @codeGenApi
12193
12214
  */
12194
- export declare function ɵɵcontentQuery<T>(directiveIndex: number, predicate: Type<any> | InjectionToken<unknown> | string[], flags: QueryFlags, read?: any): void;
12215
+ export declare function ɵɵcontentQuery<T>(directiveIndex: number, predicate: ProviderToken<unknown> | string[], flags: QueryFlags, read?: any): void;
12195
12216
 
12196
12217
  /**
12197
12218
  * Copies the fields not handled by the `ɵɵInheritDefinitionFeature` from the supertype of a
@@ -12725,9 +12746,9 @@ export declare type ɵɵDirectiveDeclaration<T, Selector extends string, ExportA
12725
12746
  *
12726
12747
  * @codeGenApi
12727
12748
  */
12728
- export declare function ɵɵdirectiveInject<T>(token: Type<T> | AbstractType<T> | InjectionToken<T>): T;
12749
+ export declare function ɵɵdirectiveInject<T>(token: ProviderToken<T>): T;
12729
12750
 
12730
- export declare function ɵɵdirectiveInject<T>(token: Type<T> | AbstractType<T> | InjectionToken<T>, flags: InjectFlags): T;
12751
+ export declare function ɵɵdirectiveInject<T>(token: ProviderToken<T>, flags: InjectFlags): T;
12731
12752
 
12732
12753
  /**
12733
12754
  * Disables directive matching on element.
@@ -13027,9 +13048,9 @@ export declare function ɵɵInheritDefinitionFeature(definition: ɵDirectiveDef<
13027
13048
  * @codeGenApi
13028
13049
  * @publicApi This instruction has been emitted by ViewEngine for some time and is deployed to npm.
13029
13050
  */
13030
- export declare function ɵɵinject<T>(token: Type<T> | AbstractType<T> | InjectionToken<T>): T;
13051
+ export declare function ɵɵinject<T>(token: ProviderToken<T>): T;
13031
13052
 
13032
- export declare function ɵɵinject<T>(token: Type<T> | AbstractType<T> | InjectionToken<T>, flags?: InjectFlags): T | null;
13053
+ export declare function ɵɵinject<T>(token: ProviderToken<T>, flags?: InjectFlags): T | null;
13033
13054
 
13034
13055
  /**
13035
13056
  * Information about how a type or `InjectionToken` interfaces with the DI system.
@@ -14048,10 +14069,7 @@ export declare function ɵɵreference<T>(index: number): T;
14048
14069
  */
14049
14070
  export declare function ɵɵresolveBody(element: RElement & {
14050
14071
  ownerDocument: Document;
14051
- }): {
14052
- name: string;
14053
- target: HTMLElement;
14054
- };
14072
+ }): HTMLElement;
14055
14073
 
14056
14074
  /**
14057
14075
  *
@@ -14059,10 +14077,7 @@ export declare function ɵɵresolveBody(element: RElement & {
14059
14077
  */
14060
14078
  export declare function ɵɵresolveDocument(element: RElement & {
14061
14079
  ownerDocument: Document;
14062
- }): {
14063
- name: string;
14064
- target: Document;
14065
- };
14080
+ }): Document;
14066
14081
 
14067
14082
  /**
14068
14083
  *
@@ -14070,10 +14085,7 @@ export declare function ɵɵresolveDocument(element: RElement & {
14070
14085
  */
14071
14086
  export declare function ɵɵresolveWindow(element: RElement & {
14072
14087
  ownerDocument: Document;
14073
- }): {
14074
- name: string;
14075
- target: (Window & typeof globalThis) | null;
14076
- };
14088
+ }): (Window & typeof globalThis) | null;
14077
14089
 
14078
14090
  /**
14079
14091
  * Restores `contextViewData` to the given OpaqueViewState instance.
@@ -14873,7 +14885,7 @@ export declare function ɵɵstylePropInterpolateV(prop: string, values: any[], v
14873
14885
  *
14874
14886
  * @codeGenApi
14875
14887
  */
14876
- export declare function ɵɵsyntheticHostListener(eventName: string, listenerFn: (e?: any) => any, useCapture?: boolean, eventTargetResolver?: GlobalTargetResolver): typeof ɵɵsyntheticHostListener;
14888
+ export declare function ɵɵsyntheticHostListener(eventName: string, listenerFn: (e?: any) => any): typeof ɵɵsyntheticHostListener;
14877
14889
 
14878
14890
  /**
14879
14891
  * Updates a synthetic host binding (e.g. `[@foo]`) on a component or directive.
@@ -15200,6 +15212,6 @@ export declare function ɵɵtrustConstantResourceUrl(url: TemplateStringsArray):
15200
15212
  *
15201
15213
  * @codeGenApi
15202
15214
  */
15203
- export declare function ɵɵviewQuery<T>(predicate: Type<any> | InjectionToken<unknown> | string[], flags: QueryFlags, read?: any): void;
15215
+ export declare function ɵɵviewQuery<T>(predicate: ProviderToken<unknown> | string[], flags: QueryFlags, read?: any): void;
15204
15216
 
15205
15217
  export { }