@angular/core 15.0.0-next.3 → 15.0.0-next.5

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 (40) hide show
  1. package/esm2020/src/core_private_export.mjs +2 -2
  2. package/esm2020/src/di/index.mjs +1 -1
  3. package/esm2020/src/di/injectable.mjs +1 -1
  4. package/esm2020/src/di/injection_token.mjs +6 -3
  5. package/esm2020/src/di/injector.mjs +1 -1
  6. package/esm2020/src/di/injector_compatibility.mjs +15 -11
  7. package/esm2020/src/di/interface/injector.mjs +1 -1
  8. package/esm2020/src/di/r3_injector.mjs +3 -2
  9. package/esm2020/src/errors.mjs +1 -1
  10. package/esm2020/src/metadata/directives.mjs +1 -1
  11. package/esm2020/src/render3/component_ref.mjs +113 -84
  12. package/esm2020/src/render3/context_discovery.mjs +7 -7
  13. package/esm2020/src/render3/di.mjs +3 -2
  14. package/esm2020/src/render3/features/host_directives_feature.mjs +101 -10
  15. package/esm2020/src/render3/features/ng_onchanges_feature.mjs +4 -2
  16. package/esm2020/src/render3/instructions/element.mjs +3 -15
  17. package/esm2020/src/render3/instructions/shared.mjs +151 -128
  18. package/esm2020/src/render3/interfaces/definition.mjs +1 -1
  19. package/esm2020/src/render3/jit/module.mjs +2 -2
  20. package/esm2020/src/render3/ng_module_ref.mjs +1 -1
  21. package/esm2020/src/render3/node_manipulation.mjs +15 -1
  22. package/esm2020/src/render3/util/discovery_utils.mjs +2 -2
  23. package/esm2020/src/util/is_dev_mode.mjs +11 -19
  24. package/esm2020/src/version.mjs +1 -1
  25. package/esm2020/src/zone/async-stack-tagging.mjs +28 -0
  26. package/esm2020/src/zone/ng_zone.mjs +8 -3
  27. package/esm2020/testing/src/logger.mjs +3 -3
  28. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  29. package/esm2020/testing/src/test_bed.mjs +4 -4
  30. package/fesm2015/core.mjs +1789 -1613
  31. package/fesm2015/core.mjs.map +1 -1
  32. package/fesm2015/testing.mjs +1055 -904
  33. package/fesm2015/testing.mjs.map +1 -1
  34. package/fesm2020/core.mjs +1788 -1614
  35. package/fesm2020/core.mjs.map +1 -1
  36. package/fesm2020/testing.mjs +1052 -902
  37. package/fesm2020/testing.mjs.map +1 -1
  38. package/index.d.ts +105 -24
  39. package/package.json +1 -1
  40. package/testing/index.d.ts +9 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.0.0-next.3
2
+ * @license Angular v15.0.0-next.5
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1029,10 +1029,10 @@ export declare interface Component extends Directive {
1029
1029
  preserveWhitespaces?: boolean;
1030
1030
  /**
1031
1031
  * Angular components marked as `standalone` do not need to be declared in an NgModule. Such
1032
- * components directly manage their own template dependencies (components, directives and pipes
1032
+ * components directly manage their own template dependencies (components, directives, and pipes
1033
1033
  * used in a template) via the imports property.
1034
1034
  *
1035
- * More information about standalone components, directives and pipes can be found in [this
1035
+ * More information about standalone components, directives, and pipes can be found in [this
1036
1036
  * guide](guide/standalone-components).
1037
1037
  *
1038
1038
  * @developerPreview
@@ -1041,12 +1041,12 @@ export declare interface Component extends Directive {
1041
1041
  /**
1042
1042
  * The imports property specifies the standalone component's template dependencies — those
1043
1043
  * directives, components, and pipes that can be used within its template. Standalone components
1044
- * can import other standalone components, directives and pipes as well as existing NgModules.
1044
+ * can import other standalone components, directives, and pipes as well as existing NgModules.
1045
1045
  *
1046
1046
  * This property is only available for standalone components - specifying it for components
1047
1047
  * declared in an NgModule generates a compilation error.
1048
1048
  *
1049
- * More information about standalone components, directives and pipes can be found in [this
1049
+ * More information about standalone components, directives, and pipes can be found in [this
1050
1050
  * guide](guide/standalone-components).
1051
1051
  *
1052
1052
  * @developerPreview
@@ -1059,7 +1059,7 @@ export declare interface Component extends Directive {
1059
1059
  * This property is only available for standalone components - specifying it for components
1060
1060
  * declared in an NgModule generates a compilation error.
1061
1061
  *
1062
- * More information about standalone components, directives and pipes can be found in [this
1062
+ * More information about standalone components, directives, and pipes can be found in [this
1063
1063
  * guide](guide/standalone-components).
1064
1064
  */
1065
1065
  schemas?: SchemaMetadata[];
@@ -2384,7 +2384,7 @@ export declare interface Directive {
2384
2384
  * directives don't depend on any "intermediate context" of an NgModule (ex. configured
2385
2385
  * providers).
2386
2386
  *
2387
- * More information about standalone components, directives and pipes can be found in [this
2387
+ * More information about standalone components, directives, and pipes can be found in [this
2388
2388
  * guide](guide/standalone-components).
2389
2389
  *
2390
2390
  * @developerPreview
@@ -2698,6 +2698,10 @@ export declare abstract class EmbeddedViewRef<C> extends ViewRef {
2698
2698
  * does not result in additional changes to any bindings (also known as
2699
2699
  * unidirectional data flow).
2700
2700
  *
2701
+ * Using this method is discouraged as the Angular CLI will set production mode when using the
2702
+ * `optimization` option.
2703
+ * @see {@link cli/build ng build}
2704
+ *
2701
2705
  * @publicApi
2702
2706
  */
2703
2707
  export declare function enableProdMode(): void;
@@ -2722,6 +2726,27 @@ export declare abstract class EnvironmentInjector implements Injector {
2722
2726
  * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
2723
2727
  * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
2724
2728
  */
2729
+ abstract get<T>(token: ProviderToken<T>, notFoundValue: undefined, options: InjectOptions & {
2730
+ optional?: false;
2731
+ }): T;
2732
+ /**
2733
+ * Retrieves an instance from the injector based on the provided token.
2734
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
2735
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
2736
+ */
2737
+ abstract get<T>(token: ProviderToken<T>, notFoundValue: null | undefined, options: InjectOptions): T | null;
2738
+ /**
2739
+ * Retrieves an instance from the injector based on the provided token.
2740
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
2741
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
2742
+ */
2743
+ abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions): T;
2744
+ /**
2745
+ * Retrieves an instance from the injector based on the provided token.
2746
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
2747
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
2748
+ * @deprecated use object-based flags (`InjectOptions`) instead.
2749
+ */
2725
2750
  abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
2726
2751
  /**
2727
2752
  * @deprecated from v4.0.0 use ProviderToken<T>
@@ -3256,6 +3281,15 @@ export declare interface HostDecorator {
3256
3281
  new (): Host;
3257
3282
  }
3258
3283
 
3284
+ /**
3285
+ * Mapping between the public aliases of directive bindings and the underlying inputs/outputs that
3286
+ * they represent. Also serves as an allowlist of the inputs/outputs from the host directive that
3287
+ * the author has decided to expose.
3288
+ */
3289
+ declare type HostDirectiveBindingMap = {
3290
+ [publicName: string]: string;
3291
+ };
3292
+
3259
3293
  /** Values that can be used to define a host directive through the `HostDirectivesFeature`. */
3260
3294
  declare type HostDirectiveConfig = Type<unknown> | {
3261
3295
  directive: Type<unknown>;
@@ -3268,15 +3302,17 @@ declare interface HostDirectiveDef<T = unknown> {
3268
3302
  /** Class representing the host directive. */
3269
3303
  directive: Type<T>;
3270
3304
  /** Directive inputs that have been exposed. */
3271
- inputs: {
3272
- [publicName: string]: string;
3273
- };
3305
+ inputs: HostDirectiveBindingMap;
3274
3306
  /** Directive outputs that have been exposed. */
3275
- outputs: {
3276
- [publicName: string]: string;
3277
- };
3307
+ outputs: HostDirectiveBindingMap;
3278
3308
  }
3279
3309
 
3310
+ /**
3311
+ * Mapping between a directive that was used as a host directive
3312
+ * and the configuration that was used to define it as such.
3313
+ */
3314
+ declare type HostDirectiveDefs = Map<ɵDirectiveDef<unknown>, HostDirectiveDef>;
3315
+
3280
3316
  /**
3281
3317
  * Type of the HostListener metadata.
3282
3318
  *
@@ -3781,7 +3817,8 @@ export declare interface Injectable {
3781
3817
  /**
3782
3818
  * Determines which injectors will provide the injectable.
3783
3819
  *
3784
- * - `Type<any>` - associates the injectable with an `@NgModule` or other `InjectorType`,
3820
+ * - `Type<any>` - associates the injectable with an `@NgModule` or other `InjectorType`. This
3821
+ * option is DEPRECATED.
3785
3822
  * - 'null' : Equivalent to `undefined`. The injectable is not provided in any scope automatically
3786
3823
  * and must be added to a `providers` array of an [@NgModule](api/core/NgModule#providers),
3787
3824
  * [@Component](api/core/Directive#providers) or [@Directive](api/core/Directive#providers).
@@ -3792,7 +3829,7 @@ export declare interface Injectable {
3792
3829
  * - 'platform' : A special singleton platform injector shared by all
3793
3830
  * applications on the page.
3794
3831
  * - 'any' : Provides a unique instance in each lazy loaded module while all eagerly loaded
3795
- * modules share one instance.
3832
+ * modules share one instance. This option is DEPRECATED.
3796
3833
  *
3797
3834
  */
3798
3835
  providedIn?: Type<any> | 'root' | 'platform' | 'any' | null;
@@ -3937,8 +3974,11 @@ export declare enum InjectFlags {
3937
3974
  * As you can see in the Tree-shakable InjectionToken example below.
3938
3975
  *
3939
3976
  * Additionally, if a `factory` is specified you can also specify the `providedIn` option, which
3940
- * overrides the above behavior and marks the token as belonging to a particular `@NgModule`. As
3941
- * mentioned above, `'root'` is the default value for `providedIn`.
3977
+ * overrides the above behavior and marks the token as belonging to a particular `@NgModule` (note:
3978
+ * this option is now deprecated). As mentioned above, `'root'` is the default value for
3979
+ * `providedIn`.
3980
+ *
3981
+ * The `providedIn: NgModule` and `providedIn: 'any'` options are deprecated.
3942
3982
  *
3943
3983
  * @usageNotes
3944
3984
  * ### Basic Examples
@@ -4033,11 +4073,38 @@ export declare const INJECTOR: InjectionToken<Injector>;
4033
4073
  export declare abstract class Injector {
4034
4074
  static THROW_IF_NOT_FOUND: {};
4035
4075
  static NULL: Injector;
4076
+ /**
4077
+ * Internal note on the `options?: InjectOptions|InjectFlags` override of the `get`
4078
+ * method: consider dropping the `InjectFlags` part in one of the major versions.
4079
+ * It can **not** be done in minor/patch, since it's breaking for custom injectors
4080
+ * that only implement the old `InjectorFlags` interface.
4081
+ */
4082
+ /**
4083
+ * Retrieves an instance from the injector based on the provided token.
4084
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
4085
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
4086
+ */
4087
+ abstract get<T>(token: ProviderToken<T>, notFoundValue: undefined, options: InjectOptions & {
4088
+ optional?: false;
4089
+ }): T;
4036
4090
  /**
4037
4091
  * Retrieves an instance from the injector based on the provided token.
4038
4092
  * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
4039
4093
  * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
4040
4094
  */
4095
+ abstract get<T>(token: ProviderToken<T>, notFoundValue: null | undefined, options: InjectOptions): T | null;
4096
+ /**
4097
+ * Retrieves an instance from the injector based on the provided token.
4098
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
4099
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
4100
+ */
4101
+ abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions | InjectFlags): T;
4102
+ /**
4103
+ * Retrieves an instance from the injector based on the provided token.
4104
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
4105
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
4106
+ * @deprecated use object-based flags (`InjectOptions`) instead.
4107
+ */
4041
4108
  abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
4042
4109
  /**
4043
4110
  * @deprecated from v4.0.0 use ProviderToken<T>
@@ -4188,10 +4255,11 @@ declare interface InternalViewRef extends ViewRef {
4188
4255
 
4189
4256
 
4190
4257
  /**
4191
- * Returns whether Angular is in development mode. After called once,
4192
- * the value is locked and won't change any more.
4258
+ * Returns whether Angular is in development mode.
4193
4259
  *
4194
- * By default, this is true, unless a user calls `enableProdMode` before calling this.
4260
+ * By default, this is true, unless `enableProdMode` is invoked prior to calling this method or the
4261
+ * application is built using the Angular CLI with the `optimization` option.
4262
+ * @see {@link cli/build ng build}
4195
4263
  *
4196
4264
  * @publicApi
4197
4265
  */
@@ -5824,7 +5892,7 @@ export declare interface Pipe {
5824
5892
  * Angular pipes marked as `standalone` do not need to be declared in an NgModule. Such
5825
5893
  * pipes don't depend on any "intermediate context" of an NgModule (ex. configured providers).
5826
5894
  *
5827
- * More information about standalone components, directives and pipes can be found in [this
5895
+ * More information about standalone components, directives, and pipes can be found in [this
5828
5896
  * guide](guide/standalone-components).
5829
5897
  */
5830
5898
  standalone?: boolean;
@@ -6447,7 +6515,7 @@ declare class R3Injector extends EnvironmentInjector {
6447
6515
  destroy(): void;
6448
6516
  onDestroy(callback: () => void): void;
6449
6517
  runInContext<ReturnT>(fn: () => ReturnT): ReturnT;
6450
- get<T>(token: ProviderToken<T>, notFoundValue?: any, flags?: InjectFlags): T;
6518
+ get<T>(token: ProviderToken<T>, notFoundValue?: any, flags?: InjectFlags | InjectOptions): T;
6451
6519
  toString(): string;
6452
6520
  private assertNotDestroyed;
6453
6521
  /**
@@ -7262,6 +7330,12 @@ declare const enum RuntimeErrorCode {
7262
7330
  UNKNOWN_ELEMENT = 304,
7263
7331
  TEMPLATE_STRUCTURE_ERROR = 305,
7264
7332
  INVALID_EVENT_BINDING = 306,
7333
+ HOST_DIRECTIVE_UNRESOLVABLE = 307,
7334
+ HOST_DIRECTIVE_NOT_STANDALONE = 308,
7335
+ DUPLICATE_DIRECTITVE = 309,
7336
+ HOST_DIRECTIVE_COMPONENT = 310,
7337
+ HOST_DIRECTIVE_UNDEFINED_BINDING = 311,
7338
+ HOST_DIRECTIVE_CONFLICTING_ALIAS = 312,
7265
7339
  MULTIPLE_PLATFORMS = 400,
7266
7340
  PLATFORM_NOT_FOUND = 401,
7267
7341
  ERROR_HANDLER_NOT_FOUND = 402,
@@ -10018,6 +10092,8 @@ export declare class ɵConsole {
10018
10092
  static ɵprov: i0.ɵɵInjectableDeclaration<ɵConsole>;
10019
10093
  }
10020
10094
 
10095
+ export declare function ɵconvertToBitFlags(flags: InjectOptions | InjectFlags | undefined): InjectFlags | undefined;
10096
+
10021
10097
  /**
10022
10098
  * Create a new `Injector` which is configured using a `defType` of `InjectorType<any>`s.
10023
10099
  *
@@ -10183,8 +10259,13 @@ export declare interface ɵDirectiveDef<T> {
10183
10259
  /**
10184
10260
  * Function that will add the host directives to the list of matches during directive matching.
10185
10261
  * Patched onto the definition by the `HostDirectivesFeature`.
10262
+ * @param currentDef Definition that has been matched.
10263
+ * @param matchedDefs List of all matches for a specified node. Will be mutated to include the
10264
+ * host directives.
10265
+ * @param hostDirectiveDefs Mapping of directive definitions to their host directive
10266
+ * configuration. Host directives will be added to the map as they're being matched to the node.
10186
10267
  */
10187
- findHostDirectiveDefs: ((matches: ɵDirectiveDef<unknown>[], def: ɵDirectiveDef<unknown>, tView: TView, lView: LView, tNode: TElementNode | TContainerNode | TElementContainerNode) => void) | null;
10268
+ findHostDirectiveDefs: ((currentDef: ɵDirectiveDef<unknown>, matchedDefs: ɵDirectiveDef<unknown>[], hostDirectiveDefs: HostDirectiveDefs) => void) | null;
10188
10269
  /** Additional directives to be applied whenever the directive has been matched. */
10189
10270
  hostDirectives: HostDirectiveDef[] | null;
10190
10271
  setInput: (<U extends T>(this: ɵDirectiveDef<U>, instance: U, value: any, publicName: string, privateName: string) => void) | null;
@@ -12631,7 +12712,7 @@ export declare function ɵɵgetCurrentView(): OpaqueViewState;
12631
12712
  export declare function ɵɵgetInheritedFactory<T>(type: Type<any>): (type: Type<T>) => T;
12632
12713
 
12633
12714
  /**
12634
- * This feature add the host directives behavior to a directive definition by patching a
12715
+ * This feature adds the host directives behavior to a directive definition by patching a
12635
12716
  * function onto it. The expectation is that the runtime will invoke the function during
12636
12717
  * directive matching.
12637
12718
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "15.0.0-next.3",
3
+ "version": "15.0.0-next.5",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.0.0-next.3
2
+ * @license Angular v15.0.0-next.5
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -13,6 +13,7 @@ import { Directive } from '@angular/core';
13
13
  import { ElementRef } from '@angular/core';
14
14
  import { InjectFlags } from '@angular/core';
15
15
  import { InjectionToken } from '@angular/core';
16
+ import { InjectOptions } from '@angular/core';
16
17
  import { NgModule } from '@angular/core';
17
18
  import { NgZone } from '@angular/core';
18
19
  import { Pipe } from '@angular/core';
@@ -278,7 +279,14 @@ export declare interface TestBed {
278
279
  }): void;
279
280
  configureTestingModule(moduleDef: TestModuleMetadata): TestBed;
280
281
  compileComponents(): Promise<any>;
282
+ inject<T>(token: ProviderToken<T>, notFoundValue: undefined, options: InjectOptions & {
283
+ optional?: false;
284
+ }): T;
285
+ inject<T>(token: ProviderToken<T>, notFoundValue: null | undefined, options: InjectOptions): T | null;
286
+ inject<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions): T;
287
+ /** @deprecated use object-based flags (`InjectOptions`) instead. */
281
288
  inject<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
289
+ /** @deprecated use object-based flags (`InjectOptions`) instead. */
282
290
  inject<T>(token: ProviderToken<T>, notFoundValue: null, flags?: InjectFlags): T | null;
283
291
  /** @deprecated from v9.0.0 use TestBed.inject */
284
292
  get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): any;