@angular/core 15.0.0-next.2 → 15.0.0-next.4

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 (44) hide show
  1. package/esm2020/src/core_private_export.mjs +2 -2
  2. package/esm2020/src/debug/debug_node.mjs +1 -1
  3. package/esm2020/src/di/index.mjs +1 -1
  4. package/esm2020/src/di/injector.mjs +1 -1
  5. package/esm2020/src/di/injector_compatibility.mjs +15 -11
  6. package/esm2020/src/di/interface/injector.mjs +1 -1
  7. package/esm2020/src/di/r3_injector.mjs +3 -2
  8. package/esm2020/src/render3/component_ref.mjs +103 -84
  9. package/esm2020/src/render3/context_discovery.mjs +17 -14
  10. package/esm2020/src/render3/definition.mjs +3 -2
  11. package/esm2020/src/render3/di.mjs +3 -2
  12. package/esm2020/src/render3/features/host_directives_feature.mjs +35 -13
  13. package/esm2020/src/render3/instructions/element.mjs +4 -16
  14. package/esm2020/src/render3/instructions/listener.mjs +2 -4
  15. package/esm2020/src/render3/instructions/lview_debug.mjs +9 -9
  16. package/esm2020/src/render3/instructions/projection.mjs +1 -1
  17. package/esm2020/src/render3/instructions/shared.mjs +123 -101
  18. package/esm2020/src/render3/instructions/styling.mjs +2 -2
  19. package/esm2020/src/render3/interfaces/definition.mjs +1 -1
  20. package/esm2020/src/render3/interfaces/node.mjs +3 -3
  21. package/esm2020/src/render3/interfaces/type_checks.mjs +3 -3
  22. package/esm2020/src/render3/jit/directive.mjs +7 -2
  23. package/esm2020/src/render3/ng_module_ref.mjs +1 -1
  24. package/esm2020/src/render3/node_manipulation.mjs +20 -5
  25. package/esm2020/src/render3/node_manipulation_i18n.mjs +2 -2
  26. package/esm2020/src/render3/util/discovery_utils.mjs +2 -2
  27. package/esm2020/src/util/is_dev_mode.mjs +11 -19
  28. package/esm2020/src/version.mjs +1 -1
  29. package/esm2020/src/zone/async-stack-tagging.mjs +28 -0
  30. package/esm2020/src/zone/ng_zone.mjs +8 -3
  31. package/esm2020/testing/src/logger.mjs +3 -3
  32. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  33. package/esm2020/testing/src/test_bed.mjs +4 -4
  34. package/fesm2015/core.mjs +1463 -1363
  35. package/fesm2015/core.mjs.map +1 -1
  36. package/fesm2015/testing.mjs +970 -901
  37. package/fesm2015/testing.mjs.map +1 -1
  38. package/fesm2020/core.mjs +1464 -1366
  39. package/fesm2020/core.mjs.map +1 -1
  40. package/fesm2020/testing.mjs +969 -900
  41. package/fesm2020/testing.mjs.map +1 -1
  42. package/index.d.ts +100 -33
  43. package/package.json +1 -1
  44. 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.2
2
+ * @license Angular v15.0.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -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>
@@ -3257,12 +3282,26 @@ export declare interface HostDecorator {
3257
3282
  }
3258
3283
 
3259
3284
  /** Values that can be used to define a host directive through the `HostDirectivesFeature`. */
3260
- declare type HostDirectiveDefiniton = Type<unknown> | {
3285
+ declare type HostDirectiveConfig = Type<unknown> | {
3261
3286
  directive: Type<unknown>;
3262
3287
  inputs?: string[];
3263
3288
  outputs?: string[];
3264
3289
  };
3265
3290
 
3291
+ /** Runtime information used to configure a host directive. */
3292
+ declare interface HostDirectiveDef<T = unknown> {
3293
+ /** Class representing the host directive. */
3294
+ directive: Type<T>;
3295
+ /** Directive inputs that have been exposed. */
3296
+ inputs: {
3297
+ [publicName: string]: string;
3298
+ };
3299
+ /** Directive outputs that have been exposed. */
3300
+ outputs: {
3301
+ [publicName: string]: string;
3302
+ };
3303
+ }
3304
+
3266
3305
  /**
3267
3306
  * Type of the HostListener metadata.
3268
3307
  *
@@ -4019,11 +4058,38 @@ export declare const INJECTOR: InjectionToken<Injector>;
4019
4058
  export declare abstract class Injector {
4020
4059
  static THROW_IF_NOT_FOUND: {};
4021
4060
  static NULL: Injector;
4061
+ /**
4062
+ * Internal note on the `options?: InjectOptions|InjectFlags` override of the `get`
4063
+ * method: consider dropping the `InjectFlags` part in one of the major versions.
4064
+ * It can **not** be done in minor/patch, since it's breaking for custom injectors
4065
+ * that only implement the old `InjectorFlags` interface.
4066
+ */
4067
+ /**
4068
+ * Retrieves an instance from the injector based on the provided token.
4069
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
4070
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
4071
+ */
4072
+ abstract get<T>(token: ProviderToken<T>, notFoundValue: undefined, options: InjectOptions & {
4073
+ optional?: false;
4074
+ }): T;
4075
+ /**
4076
+ * Retrieves an instance from the injector based on the provided token.
4077
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
4078
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
4079
+ */
4080
+ abstract get<T>(token: ProviderToken<T>, notFoundValue: null | undefined, options: InjectOptions): T | null;
4022
4081
  /**
4023
4082
  * Retrieves an instance from the injector based on the provided token.
4024
4083
  * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
4025
4084
  * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
4026
4085
  */
4086
+ abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions | InjectFlags): T;
4087
+ /**
4088
+ * Retrieves an instance from the injector based on the provided token.
4089
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
4090
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
4091
+ * @deprecated use object-based flags (`InjectOptions`) instead.
4092
+ */
4027
4093
  abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
4028
4094
  /**
4029
4095
  * @deprecated from v4.0.0 use ProviderToken<T>
@@ -4174,10 +4240,11 @@ declare interface InternalViewRef extends ViewRef {
4174
4240
 
4175
4241
 
4176
4242
  /**
4177
- * Returns whether Angular is in development mode. After called once,
4178
- * the value is locked and won't change any more.
4243
+ * Returns whether Angular is in development mode.
4179
4244
  *
4180
- * By default, this is true, unless a user calls `enableProdMode` before calling this.
4245
+ * By default, this is true, unless `enableProdMode` is invoked prior to calling this method or the
4246
+ * application is built using the Angular CLI with the `optimization` option.
4247
+ * @see {@link cli/build ng build}
4181
4248
  *
4182
4249
  * @publicApi
4183
4250
  */
@@ -6433,7 +6500,7 @@ declare class R3Injector extends EnvironmentInjector {
6433
6500
  destroy(): void;
6434
6501
  onDestroy(callback: () => void): void;
6435
6502
  runInContext<ReturnT>(fn: () => ReturnT): ReturnT;
6436
- get<T>(token: ProviderToken<T>, notFoundValue?: any, flags?: InjectFlags): T;
6503
+ get<T>(token: ProviderToken<T>, notFoundValue?: any, flags?: InjectFlags | InjectOptions): T;
6437
6504
  toString(): string;
6438
6505
  private assertNotDestroyed;
6439
6506
  /**
@@ -7951,11 +8018,7 @@ declare interface TNode {
7951
8018
  * injector.
7952
8019
  */
7953
8020
  injectorIndex: number;
7954
- /**
7955
- * Stores starting index of the directives.
7956
- *
7957
- * NOTE: The first directive is always component (if present).
7958
- */
8021
+ /** Stores starting index of the directives. */
7959
8022
  directiveStart: number;
7960
8023
  /**
7961
8024
  * Stores final exclusive index of the directives.
@@ -7965,6 +8028,12 @@ declare interface TNode {
7965
8028
  * `LFrame.bindingRootIndex` before `HostBindingFunction` is executed.
7966
8029
  */
7967
8030
  directiveEnd: number;
8031
+ /**
8032
+ * Offset from the `directiveStart` at which the component (one at most) of the node is stored.
8033
+ * Set to -1 if no components have been applied to the node. Component index can be found using
8034
+ * `directiveStart + componentOffset`.
8035
+ */
8036
+ componentOffset: number;
7968
8037
  /**
7969
8038
  * Stores the last directive which had a styling instruction.
7970
8039
  *
@@ -8277,29 +8346,23 @@ declare interface TNode {
8277
8346
  declare const enum TNodeFlags {
8278
8347
  /** Bit #1 - This bit is set if the node is a host for any directive (including a component) */
8279
8348
  isDirectiveHost = 1,
8280
- /**
8281
- * Bit #2 - This bit is set if the node is a host for a component.
8282
- *
8283
- * Setting this bit implies that the `isDirectiveHost` bit is set as well.
8284
- * */
8285
- isComponentHost = 2,
8286
- /** Bit #3 - This bit is set if the node has been projected */
8287
- isProjected = 4,
8288
- /** Bit #4 - This bit is set if any directive on this node has content queries */
8289
- hasContentQuery = 8,
8290
- /** Bit #5 - This bit is set if the node has any "class" inputs */
8291
- hasClassInput = 16,
8292
- /** Bit #6 - This bit is set if the node has any "style" inputs */
8293
- hasStyleInput = 32,
8294
- /** Bit #7 This bit is set if the node has been detached by i18n */
8295
- isDetached = 64,
8296
- /**
8297
- * Bit #8 - This bit is set if the node has directives with host bindings.
8349
+ /** Bit #2 - This bit is set if the node has been projected */
8350
+ isProjected = 2,
8351
+ /** Bit #3 - This bit is set if any directive on this node has content queries */
8352
+ hasContentQuery = 4,
8353
+ /** Bit #4 - This bit is set if the node has any "class" inputs */
8354
+ hasClassInput = 8,
8355
+ /** Bit #5 - This bit is set if the node has any "style" inputs */
8356
+ hasStyleInput = 16,
8357
+ /** Bit #6 This bit is set if the node has been detached by i18n */
8358
+ isDetached = 32,
8359
+ /**
8360
+ * Bit #7 - This bit is set if the node has directives with host bindings.
8298
8361
  *
8299
8362
  * This flags allows us to guard host-binding logic and invoke it only on nodes
8300
8363
  * that actually have directives with host bindings.
8301
8364
  */
8302
- hasHostBindings = 128
8365
+ hasHostBindings = 64
8303
8366
  }
8304
8367
 
8305
8368
  /**
@@ -10008,6 +10071,8 @@ export declare class ɵConsole {
10008
10071
  static ɵprov: i0.ɵɵInjectableDeclaration<ɵConsole>;
10009
10072
  }
10010
10073
 
10074
+ export declare function ɵconvertToBitFlags(flags: InjectOptions | InjectFlags | undefined): InjectFlags | undefined;
10075
+
10011
10076
  /**
10012
10077
  * Create a new `Injector` which is configured using a `defType` of `InjectorType<any>`s.
10013
10078
  *
@@ -10171,10 +10236,12 @@ export declare interface ɵDirectiveDef<T> {
10171
10236
  */
10172
10237
  readonly features: DirectiveDefFeature[] | null;
10173
10238
  /**
10174
- * Function that will apply the host directives to the list of matches during directive matching.
10239
+ * Function that will add the host directives to the list of matches during directive matching.
10175
10240
  * Patched onto the definition by the `HostDirectivesFeature`.
10176
10241
  */
10177
- applyHostDirectives: ((tView: TView, viewData: LView, tNode: TElementNode | TContainerNode | TElementContainerNode, matches: any[]) => void) | null;
10242
+ findHostDirectiveDefs: ((matches: ɵDirectiveDef<unknown>[], def: ɵDirectiveDef<unknown>, tView: TView, lView: LView, tNode: TElementNode | TContainerNode | TElementContainerNode) => void) | null;
10243
+ /** Additional directives to be applied whenever the directive has been matched. */
10244
+ hostDirectives: HostDirectiveDef[] | null;
10178
10245
  setInput: (<U extends T>(this: ɵDirectiveDef<U>, instance: U, value: any, publicName: string, privateName: string) => void) | null;
10179
10246
  }
10180
10247
 
@@ -12638,7 +12705,7 @@ export declare function ɵɵgetInheritedFactory<T>(type: Type<any>): (type: Type
12638
12705
  *
12639
12706
  * @codeGenApi
12640
12707
  */
12641
- export declare function ɵɵHostDirectivesFeature(rawHostDirectives: HostDirectiveDefiniton[] | (() => HostDirectiveDefiniton[])): (definition: ɵDirectiveDef<unknown>) => void;
12708
+ export declare function ɵɵHostDirectivesFeature(rawHostDirectives: HostDirectiveConfig[] | (() => HostDirectiveConfig[])): (definition: ɵDirectiveDef<unknown>) => void;
12642
12709
 
12643
12710
  /**
12644
12711
  * Update a property on a host element. Only applies to native node properties, not inputs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "15.0.0-next.2",
3
+ "version": "15.0.0-next.4",
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.2
2
+ * @license Angular v15.0.0-next.4
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;