@angular/core 17.2.0-next.0 → 17.2.0-next.1

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 (63) hide show
  1. package/esm2022/primitives/signals/index.mjs +2 -2
  2. package/esm2022/src/application/application_init.mjs +2 -2
  3. package/esm2022/src/application/application_ref.mjs +2 -2
  4. package/esm2022/src/application/application_tokens.mjs +10 -9
  5. package/esm2022/src/authoring/input.mjs +1 -1
  6. package/esm2022/src/authoring/input_signal.mjs +4 -1
  7. package/esm2022/src/authoring/input_type_checking.mjs +1 -1
  8. package/esm2022/src/authoring/queries.mjs +8 -7
  9. package/esm2022/src/authoring.mjs +1 -1
  10. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +51 -18
  11. package/esm2022/src/core_private_export.mjs +2 -2
  12. package/esm2022/src/defer/instructions.mjs +4 -2
  13. package/esm2022/src/di/forward_ref.mjs +1 -1
  14. package/esm2022/src/di/initializer_token.mjs +2 -2
  15. package/esm2022/src/di/injector.mjs +4 -4
  16. package/esm2022/src/di/injector_token.mjs +2 -2
  17. package/esm2022/src/di/internal_tokens.mjs +2 -2
  18. package/esm2022/src/di/scope.mjs +2 -2
  19. package/esm2022/src/hydration/error_handling.mjs +17 -6
  20. package/esm2022/src/hydration/utils.mjs +54 -8
  21. package/esm2022/src/i18n/tokens.mjs +5 -5
  22. package/esm2022/src/linker/compiler.mjs +2 -2
  23. package/esm2022/src/linker/query_list.mjs +7 -1
  24. package/esm2022/src/metadata/di.mjs +1 -1
  25. package/esm2022/src/platform/platform.mjs +2 -2
  26. package/esm2022/src/platform/platform_ref.mjs +2 -2
  27. package/esm2022/src/render3/component_ref.mjs +1 -1
  28. package/esm2022/src/render3/instructions/all.mjs +2 -1
  29. package/esm2022/src/render3/instructions/element.mjs +3 -3
  30. package/esm2022/src/render3/instructions/queries.mjs +6 -40
  31. package/esm2022/src/render3/instructions/queries_signals.mjs +55 -0
  32. package/esm2022/src/render3/instructions/write_to_directive_input.mjs +1 -1
  33. package/esm2022/src/render3/query.mjs +46 -7
  34. package/esm2022/src/render3/query_reactive.mjs +110 -0
  35. package/esm2022/src/render3/reactivity/computed.mjs +4 -1
  36. package/esm2022/src/render3/reactivity/signal.mjs +4 -1
  37. package/esm2022/src/util/ng_dev_mode.mjs +11 -3
  38. package/esm2022/src/version.mjs +1 -1
  39. package/esm2022/testing/src/component_fixture.mjs +128 -93
  40. package/esm2022/testing/src/logger.mjs +3 -3
  41. package/esm2022/testing/src/test_bed.mjs +11 -6
  42. package/esm2022/testing/src/test_bed_common.mjs +9 -2
  43. package/esm2022/testing/src/test_bed_compiler.mjs +5 -4
  44. package/esm2022/testing/src/testing.mjs +2 -2
  45. package/fesm2022/core.mjs +359 -100
  46. package/fesm2022/core.mjs.map +1 -1
  47. package/fesm2022/primitives/signals.mjs +2 -2
  48. package/fesm2022/rxjs-interop.mjs +1 -1
  49. package/fesm2022/testing.mjs +143 -96
  50. package/fesm2022/testing.mjs.map +1 -1
  51. package/index.d.ts +120 -21
  52. package/package.json +1 -1
  53. package/primitives/signals/index.d.ts +3 -1
  54. package/rxjs-interop/index.d.ts +1 -1
  55. package/schematics/migrations/block-template-entities/bundle.js +242 -207
  56. package/schematics/migrations/block-template-entities/bundle.js.map +3 -3
  57. package/schematics/migrations/compiler-options/bundle.js +13 -13
  58. package/schematics/migrations/transfer-state/bundle.js +13 -13
  59. package/schematics/ng-generate/control-flow-migration/bundle.js +252 -217
  60. package/schematics/ng-generate/control-flow-migration/bundle.js.map +3 -3
  61. package/schematics/ng-generate/standalone-migration/bundle.js +1942 -1675
  62. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  63. package/testing/index.d.ts +6 -17
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.2.0-next.0
2
+ * @license Angular v17.2.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -332,7 +332,7 @@ export declare interface AfterViewInit {
332
332
  }
333
333
 
334
334
  /**
335
- * A [DI token](guide/glossary#di-token "DI token definition") that indicates which animations
335
+ * A [DI token](api/core/InjectionToken) that indicates which animations
336
336
  * module has been loaded.
337
337
  * @publicApi
338
338
  */
@@ -3925,7 +3925,7 @@ declare const FLAGS = 2;
3925
3925
  export declare function forwardRef(forwardRefFn: ForwardRefFn): Type<any>;
3926
3926
 
3927
3927
  /**
3928
- * An interface that a function passed into {@link forwardRef} has to implement.
3928
+ * An interface that a function passed into `forwardRef` has to implement.
3929
3929
  *
3930
3930
  * @usageNotes
3931
3931
  * ### Example
@@ -4545,6 +4545,18 @@ export declare interface HostListenerDecorator {
4545
4545
 
4546
4546
  declare const HYDRATION = 6;
4547
4547
 
4548
+ declare const HYDRATION_INFO_KEY = "__ngDebugHydrationInfo__";
4549
+
4550
+ /**
4551
+ * Internal type that represents a claimed node.
4552
+ * Only used in dev mode.
4553
+ */
4554
+ declare enum HydrationStatus {
4555
+ Hydrated = "hydrated",
4556
+ Skipped = "skipped",
4557
+ Mismatched = "mismatched"
4558
+ }
4559
+
4548
4560
  declare namespace i0 {
4549
4561
  export {
4550
4562
  ɵɵinject,
@@ -5211,10 +5223,10 @@ export declare const INJECTOR: InjectionToken<Injector>;
5211
5223
 
5212
5224
  /**
5213
5225
  * Concrete injectors implement this interface. Injectors are configured
5214
- * with [providers](guide/glossary#provider) that associate
5215
- * dependencies of various types with [injection tokens](guide/glossary#di-token).
5226
+ * with [providers](guide/dependency-injection-providers) that associate
5227
+ * dependencies of various types with [injection tokens](guide/dependency-injection-providers).
5216
5228
  *
5217
- * @see ["DI Providers"](guide/dependency-injection-providers).
5229
+ * @see [DI Providers](guide/dependency-injection-providers).
5218
5230
  * @see {@link StaticProvider}
5219
5231
  *
5220
5232
  * @usageNotes
@@ -5478,7 +5490,7 @@ export declare interface InputFunction {
5478
5490
  */
5479
5491
  <ReadT>(): InputSignal<ReadT | undefined>;
5480
5492
  <ReadT>(initialValue: ReadT, opts?: InputOptionsWithoutTransform<ReadT>): InputSignal<ReadT>;
5481
- <ReadT, WriteT>(initialValue: ReadT, opts: InputOptionsWithTransform<ReadT, WriteT>): InputSignal<ReadT, WriteT>;
5493
+ <ReadT, WriteT>(initialValue: ReadT, opts: InputOptionsWithTransform<ReadT, WriteT>): InputSignalWithTransform<ReadT, WriteT>;
5482
5494
  /**
5483
5495
  * Initializes a required input.
5484
5496
  *
@@ -5489,7 +5501,7 @@ export declare interface InputFunction {
5489
5501
  */
5490
5502
  required: {
5491
5503
  <ReadT>(opts?: InputOptionsWithoutTransform<ReadT>): InputSignal<ReadT>;
5492
- <ReadT, WriteT>(opts: InputOptionsWithTransform<ReadT, WriteT>): InputSignal<ReadT, WriteT>;
5504
+ <ReadT, WriteT>(opts: InputOptionsWithTransform<ReadT, WriteT>): InputSignalWithTransform<ReadT, WriteT>;
5493
5505
  };
5494
5506
  }
5495
5507
 
@@ -5531,18 +5543,17 @@ export declare type InputOptionsWithoutTransform<ReadT> = Omit<InputOptions<Read
5531
5543
  export declare type InputOptionsWithTransform<ReadT, WriteT> = Required<Pick<InputOptions<ReadT, WriteT>, 'transform'>> & InputOptions<ReadT, WriteT>;
5532
5544
 
5533
5545
  /**
5534
- * `InputSignal` is represents a special `Signal` for a directive/component input.
5546
+ * `InputSignal` represents a special `Signal` for a directive/component input.
5535
5547
  *
5536
5548
  * An input signal is similar to a non-writable signal except that it also
5537
5549
  * carries additional type-information for transforms, and that Angular internally
5538
5550
  * updates the signal whenever a new value is bound.
5539
5551
  *
5552
+ * @see {@link InputOptionsWithTransform} for inputs with transforms.
5553
+ *
5540
5554
  * @developerPreview
5541
5555
  */
5542
- export declare interface InputSignal<ReadT, WriteT = ReadT> extends Signal<ReadT> {
5543
- [SIGNAL]: InputSignalNode<ReadT, WriteT>;
5544
- [ɵINPUT_SIGNAL_BRAND_READ_TYPE]: ReadT;
5545
- [ɵINPUT_SIGNAL_BRAND_WRITE_TYPE]: WriteT;
5556
+ export declare interface InputSignal<ReadT> extends InputSignalWithTransform<ReadT, ReadT> {
5546
5557
  }
5547
5558
 
5548
5559
  /**
@@ -5566,6 +5577,36 @@ declare interface InputSignalNode<ReadT, WriteT> extends SignalNode<ReadT | type
5566
5577
  applyValueToInputSignal<ReadT, WriteT>(node: InputSignalNode<ReadT, WriteT>, value: ReadT): void;
5567
5578
  }
5568
5579
 
5580
+ /**
5581
+ * `InputSignalWithTransform` represents a special `Signal` for a
5582
+ * directive/component input with a `transform` function.
5583
+ *
5584
+ * Signal inputs with transforms capture an extra generic for their transform write
5585
+ * type. Transforms can expand the accepted bound values for an input while ensuring
5586
+ * value retrievals of the signal input are still matching the generic input type.
5587
+ *
5588
+ * ```ts
5589
+ * class MyDir {
5590
+ * disabled = input(false, {
5591
+ * transform: (v: string|boolean) => convertToBoolean(v),
5592
+ * }); // InputSignalWithTransform<boolean, string|boolean>
5593
+ *
5594
+ * click() {
5595
+ * this.disabled() // always returns a `boolean`.
5596
+ * }
5597
+ * }
5598
+ * ```
5599
+ *
5600
+ * @see {@link InputSignal} for additional information.
5601
+ *
5602
+ * @developerPreview
5603
+ */
5604
+ export declare interface InputSignalWithTransform<ReadT, WriteT> extends Signal<ReadT> {
5605
+ [SIGNAL]: InputSignalNode<ReadT, WriteT>;
5606
+ [ɵINPUT_SIGNAL_BRAND_READ_TYPE]: ReadT;
5607
+ [ɵINPUT_SIGNAL_BRAND_WRITE_TYPE]: WriteT;
5608
+ }
5609
+
5569
5610
  /** Function that can be used to transform incoming input values. */
5570
5611
  declare type InputTransformFunction = (value: any) => any;
5571
5612
 
@@ -7713,6 +7754,7 @@ declare const enum QueryFlags {
7713
7754
  export declare class QueryList<T> implements Iterable<T> {
7714
7755
  private _emitDistinctChangesOnly;
7715
7756
  readonly dirty = true;
7757
+ private _onDirty?;
7716
7758
  private _results;
7717
7759
  private _changesDetected;
7718
7760
  private _changes;
@@ -10673,6 +10715,8 @@ export declare interface ViewChildDecorator {
10673
10715
  *
10674
10716
  * @usageNotes
10675
10717
  *
10718
+ * ### Example 1
10719
+ *
10676
10720
  * {@example core/di/ts/viewChild/view_child_example.ts region='Component'}
10677
10721
  *
10678
10722
  * ### Example 2
@@ -11573,9 +11617,11 @@ export declare const ɵDEFER_BLOCK_CONFIG: InjectionToken<ɵDeferBlockConfig>;
11573
11617
 
11574
11618
  /**
11575
11619
  * **INTERNAL**, avoid referencing it in application code.
11576
- *
11620
+ * *
11577
11621
  * Injector token that allows to provide `DeferBlockDependencyInterceptor` class
11578
11622
  * implementation.
11623
+ *
11624
+ * This token is only injected in devMode
11579
11625
  */
11580
11626
  export declare const ɵDEFER_BLOCK_DEPENDENCY_INTERCEPTOR: InjectionToken<ɵDeferBlockDependencyInterceptor>;
11581
11627
 
@@ -11999,6 +12045,18 @@ export declare type ɵGlobalDevModeUtils = {
11999
12045
  [GLOBAL_PUBLISH_EXPANDO_KEY]: typeof globalUtilsFunctions;
12000
12046
  };
12001
12047
 
12048
+ export declare type ɵHydratedNode = {
12049
+ [HYDRATION_INFO_KEY]?: ɵHydrationInfo;
12050
+ };
12051
+
12052
+ export declare type ɵHydrationInfo = {
12053
+ status: HydrationStatus.Hydrated | HydrationStatus.Skipped;
12054
+ } | {
12055
+ status: HydrationStatus.Mismatched;
12056
+ actualNodeDetails: string | null;
12057
+ expectedNodeDetails: string | null;
12058
+ };
12059
+
12002
12060
  /**
12003
12061
  * Injection token that configures the image optimized image functionality.
12004
12062
  * See {@link ImageConfig} for additional information about parameters that
@@ -12027,6 +12085,7 @@ export declare const ɵIMAGE_CONFIG_DEFAULTS: ɵImageConfig;
12027
12085
  */
12028
12086
  export declare type ɵImageConfig = {
12029
12087
  breakpoints?: number[];
12088
+ placeholderResolution?: number;
12030
12089
  disableImageSizeWarning?: boolean;
12031
12090
  disableImageLazyLoadWarning?: boolean;
12032
12091
  };
@@ -12524,6 +12583,8 @@ export declare interface ɵProviderRecord {
12524
12583
 
12525
12584
  export declare function ɵprovideZonelessChangeDetection(): EnvironmentProviders;
12526
12585
 
12586
+ export declare function ɵreadHydrationInfo(node: RNode): ɵHydrationInfo | null;
12587
+
12527
12588
  export declare class ɵReflectionCapabilities implements PlatformReflectionCapabilities {
12528
12589
  private _reflect;
12529
12590
  constructor(reflect?: any);
@@ -12979,13 +13040,16 @@ export declare function ɵtruncateMiddle(str: string, maxLength?: number): strin
12979
13040
  */
12980
13041
  export declare function ɵunregisterLocaleData(): void;
12981
13042
 
12982
- /** Unwraps all `InputSignal` class fields of the given directive. */
13043
+ /**
13044
+ * Unwraps all `InputSignal`/`InputSignalWithTransform` class fields of
13045
+ * the given directive.
13046
+ */
12983
13047
  export declare type ɵUnwrapDirectiveSignalInputs<Dir, Fields extends keyof Dir> = {
12984
13048
  [P in Fields]: ɵUnwrapInputSignalWriteType<Dir[P]>;
12985
13049
  };
12986
13050
 
12987
- /** Retrieves the `WriteT` of an `InputSignal`. */
12988
- declare type ɵUnwrapInputSignalWriteType<Field> = Field extends InputSignal<unknown, infer WriteT> ? WriteT : never;
13051
+ /** Retrieves the `WriteT` of an `InputSignal` and `InputSignalWithTransform`. */
13052
+ declare type ɵUnwrapInputSignalWriteType<Field> = Field extends InputSignalWithTransform<unknown, infer WriteT> ? WriteT : never;
12989
13053
 
12990
13054
  export declare function ɵunwrapSafeValue(value: ɵSafeValue): string;
12991
13055
 
@@ -13968,7 +14032,19 @@ export declare function ɵɵconditional<T>(containerIndex: number, matchingTempl
13968
14032
  */
13969
14033
  export declare function ɵɵcontentQuery<T>(directiveIndex: number, predicate: ProviderToken<unknown> | string | string[], flags: QueryFlags, read?: any): void;
13970
14034
 
13971
- export declare function ɵɵcontentQuerySignal(): void;
14035
+ /**
14036
+ * Registers a QueryList, associated with a content query, for later refresh (part of a view
14037
+ * refresh).
14038
+ *
14039
+ * @param directiveIndex Current directive index
14040
+ * @param predicate The type for which the query will search
14041
+ * @param flags Flags associated with the query
14042
+ * @param read What to save in the query
14043
+ * @returns QueryList<T>
14044
+ *
14045
+ * @codeGenApi
14046
+ */
14047
+ export declare function ɵɵcontentQuerySignal<T>(target: Signal<T>, directiveIndex: number, predicate: ProviderToken<unknown> | string[], flags: QueryFlags, read?: any): void;
13972
14048
 
13973
14049
  /**
13974
14050
  * Copies the fields not handled by the `ɵɵInheritDefinitionFeature` from the supertype of a
@@ -15620,7 +15696,19 @@ export declare function ɵɵpureFunction8(slotOffset: number, pureFn: (v1: any,
15620
15696
  */
15621
15697
  export declare function ɵɵpureFunctionV(slotOffset: number, pureFn: (...v: any[]) => any, exps: any[], thisArg?: any): any;
15622
15698
 
15623
- export declare function ɵɵqueryAdvance(_count?: number): void;
15699
+ /**
15700
+ * Advances the current query index by a specified offset.
15701
+ *
15702
+ * Adjusting the current query index is necessary in cases where a given directive has a mix of
15703
+ * zone-based and signal-based queries. The signal-based queries don't require tracking of the
15704
+ * current index (those are refreshed on demand and not during change detection) so this instruction
15705
+ * is only necessary for backward-compatibility.
15706
+ *
15707
+ * @param index offset to apply to the current query index (defaults to 1)
15708
+ *
15709
+ * @codeGenApi
15710
+ */
15711
+ export declare function ɵɵqueryAdvance(indexOffset?: number): void;
15624
15712
 
15625
15713
  /**
15626
15714
  * Refreshes a query by combining matches from all active views and removing matches from deleted
@@ -16876,7 +16964,7 @@ export declare function ɵɵtrustConstantResourceUrl(url: TemplateStringsArray):
16876
16964
  export declare function ɵɵvalidateIframeAttribute(attrValue: any, tagName: string, attrName: string): any;
16877
16965
 
16878
16966
  /**
16879
- * Creates new QueryList, stores the reference in LView and returns QueryList.
16967
+ * Creates a new view query by initializing internal data structures.
16880
16968
  *
16881
16969
  * @param predicate The type for which the query will search
16882
16970
  * @param flags Flags associated with the query
@@ -16886,6 +16974,17 @@ export declare function ɵɵvalidateIframeAttribute(attrValue: any, tagName: str
16886
16974
  */
16887
16975
  export declare function ɵɵviewQuery<T>(predicate: ProviderToken<unknown> | string | string[], flags: QueryFlags, read?: any): void;
16888
16976
 
16889
- export declare function ɵɵviewQuerySignal(): void;
16977
+ /**
16978
+ * Creates a new view query by initializing internal data structures and binding a new query to the
16979
+ * target signal.
16980
+ *
16981
+ * @param target The target signal to assign the query results to.
16982
+ * @param predicate The type or label that should match a given query
16983
+ * @param flags Flags associated with the query
16984
+ * @param read What to save in the query
16985
+ *
16986
+ * @codeGenApi
16987
+ */
16988
+ export declare function ɵɵviewQuerySignal(target: Signal<unknown>, predicate: ProviderToken<unknown> | string[], flags: QueryFlags, read?: ProviderToken<unknown>): void;
16890
16989
 
16891
16990
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "17.2.0-next.0",
3
+ "version": "17.2.0-next.1",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.2.0-next.0
2
+ * @license Angular v17.2.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -53,6 +53,8 @@ export declare function consumerBeforeComputation(node: ReactiveNode | null): Re
53
53
  */
54
54
  export declare function consumerDestroy(node: ReactiveNode): void;
55
55
 
56
+ export declare function consumerMarkDirty(node: ReactiveNode): void;
57
+
56
58
  /**
57
59
  * Determine whether this consumer has any dependencies which have changed since the last time
58
60
  * they were read.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.2.0-next.0
2
+ * @license Angular v17.2.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */