@angular/core 19.0.0-next.10 → 19.0.0-next.11

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 (39) hide show
  1. package/fesm2022/core.mjs +13205 -11798
  2. package/fesm2022/core.mjs.map +1 -1
  3. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  4. package/fesm2022/primitives/signals.mjs +8 -6
  5. package/fesm2022/primitives/signals.mjs.map +1 -1
  6. package/fesm2022/rxjs-interop.mjs +72 -4
  7. package/fesm2022/rxjs-interop.mjs.map +1 -1
  8. package/fesm2022/testing.mjs +4 -4
  9. package/index.d.ts +527 -51
  10. package/package.json +1 -1
  11. package/primitives/event-dispatch/index.d.ts +1 -1
  12. package/primitives/signals/index.d.ts +3 -1
  13. package/rxjs-interop/index.d.ts +32 -1
  14. package/schematics/bundles/{checker-77660732.js → checker-51c08a1b.js} +112 -97
  15. package/schematics/bundles/{compiler_host-81f430d9.js → compiler_host-d7f120f0.js} +2 -2
  16. package/schematics/bundles/control-flow-migration.js +3 -3
  17. package/schematics/bundles/explicit-standalone-flag.js +6 -4
  18. package/schematics/bundles/imports-4ac08251.js +1 -1
  19. package/schematics/bundles/{group_replacements-1f48eff7.js → index-f7b283e6.js} +247 -1649
  20. package/schematics/bundles/inject-migration.js +7 -6
  21. package/schematics/bundles/leading_space-d190b83b.js +1 -1
  22. package/schematics/bundles/migrate_ts_type_references-b2b55f62.js +1448 -0
  23. package/schematics/bundles/{nodes-0e7d45ca.js → ng_decorators-4579dec6.js} +1 -14
  24. package/schematics/bundles/nodes-a535b2be.js +27 -0
  25. package/schematics/bundles/output-migration.js +7295 -0
  26. package/schematics/bundles/pending-tasks.js +3 -3
  27. package/schematics/bundles/{program-1413936a.js → program-6e6520d8.js} +40 -18
  28. package/schematics/bundles/project_tsconfig_paths-e9ccccbf.js +1 -1
  29. package/schematics/bundles/provide-initializer.js +190 -0
  30. package/schematics/bundles/route-lazy-loading.js +3 -3
  31. package/schematics/bundles/signal-input-migration.js +73 -60
  32. package/schematics/bundles/signal-queries-migration.js +119 -90
  33. package/schematics/bundles/signals.js +54 -0
  34. package/schematics/bundles/standalone-migration.js +12 -11
  35. package/schematics/collection.json +11 -0
  36. package/schematics/migrations.json +7 -1
  37. package/schematics/ng-generate/output-migration/schema.json +19 -0
  38. package/schematics/ng-generate/signals/schema.json +65 -0
  39. package/testing/index.d.ts +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v19.0.0-next.10
2
+ * @license Angular v19.0.0-next.11
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -738,7 +738,12 @@ export declare const APP_ID: InjectionToken<string>;
738
738
  * The function is executed during the application bootstrap process,
739
739
  * and the needed data is available on startup.
740
740
  *
741
+ * Note that the provided initializer is run in the injection context.
742
+ *
743
+ * @deprecated from v19.0.0, use provideAppInitializer instead
744
+ *
741
745
  * @see {@link ApplicationInitStatus}
746
+ * @see {@link provideAppInitializer}
742
747
  *
743
748
  * @usageNotes
744
749
  *
@@ -747,10 +752,12 @@ export declare const APP_ID: InjectionToken<string>;
747
752
  * ### Example with NgModule-based application
748
753
  * ```
749
754
  * function initializeApp(): Promise<any> {
750
- * return new Promise((resolve, reject) => {
751
- * // Do some asynchronous stuff
752
- * resolve();
753
- * });
755
+ * const http = inject(HttpClient);
756
+ * return firstValueFrom(
757
+ * http
758
+ * .get("https://someUrl.com/api/user")
759
+ * .pipe(tap(user => { ... }))
760
+ * );
754
761
  * }
755
762
  *
756
763
  * @NgModule({
@@ -759,8 +766,8 @@ export declare const APP_ID: InjectionToken<string>;
759
766
  * bootstrap: [AppComponent],
760
767
  * providers: [{
761
768
  * provide: APP_INITIALIZER,
762
- * useFactory: () => initializeApp,
763
- * multi: true
769
+ * useValue: initializeApp,
770
+ * multi: true,
764
771
  * }]
765
772
  * })
766
773
  * export class AppModule {}
@@ -768,13 +775,13 @@ export declare const APP_ID: InjectionToken<string>;
768
775
  *
769
776
  * ### Example with standalone application
770
777
  * ```
771
- * export function initializeApp(http: HttpClient) {
772
- * return (): Promise<any> =>
773
- * firstValueFrom(
774
- * http
775
- * .get("https://someUrl.com/api/user")
776
- * .pipe(tap(user => { ... }))
777
- * );
778
+ * function initializeApp() {
779
+ * const http = inject(HttpClient);
780
+ * return firstValueFrom(
781
+ * http
782
+ * .get("https://someUrl.com/api/user")
783
+ * .pipe(tap(user => { ... }))
784
+ * );
778
785
  * }
779
786
  *
780
787
  * bootstrapApplication(App, {
@@ -782,9 +789,8 @@ export declare const APP_ID: InjectionToken<string>;
782
789
  * provideHttpClient(),
783
790
  * {
784
791
  * provide: APP_INITIALIZER,
785
- * useFactory: initializeApp,
792
+ * useValue: initializeApp,
786
793
  * multi: true,
787
- * deps: [HttpClient],
788
794
  * },
789
795
  * ],
790
796
  * });
@@ -799,44 +805,46 @@ export declare const APP_ID: InjectionToken<string>;
799
805
  *
800
806
  * ### Example with NgModule-based application
801
807
  * ```
802
- * function initializeAppFactory(httpClient: HttpClient): () => Observable<any> {
803
- * return () => httpClient.get("https://someUrl.com/api/user")
804
- * .pipe(
805
- * tap(user => { ... })
806
- * );
807
- * }
808
+ * function initializeApp() {
809
+ * const http = inject(HttpClient);
810
+ * return firstValueFrom(
811
+ * http
812
+ * .get("https://someUrl.com/api/user")
813
+ * .pipe(tap(user => { ... }))
814
+ * );
815
+ * }
808
816
  *
809
- * @NgModule({
810
- * imports: [BrowserModule, HttpClientModule],
811
- * declarations: [AppComponent],
812
- * bootstrap: [AppComponent],
813
- * providers: [{
814
- * provide: APP_INITIALIZER,
815
- * useFactory: initializeAppFactory,
816
- * deps: [HttpClient],
817
- * multi: true
818
- * }]
819
- * })
820
- * export class AppModule {}
817
+ * @NgModule({
818
+ * imports: [BrowserModule, HttpClientModule],
819
+ * declarations: [AppComponent],
820
+ * bootstrap: [AppComponent],
821
+ * providers: [{
822
+ * provide: APP_INITIALIZER,
823
+ * useValue: initializeApp,
824
+ * multi: true,
825
+ * }]
826
+ * })
827
+ * export class AppModule {}
821
828
  * ```
822
829
  *
823
830
  * ### Example with standalone application
824
831
  * ```
825
- * function initializeAppFactory(httpClient: HttpClient): () => Observable<any> {
826
- * return () => httpClient.get("https://someUrl.com/api/user")
827
- * .pipe(
828
- * tap(user => { ... })
829
- * );
830
- * }
832
+ * function initializeApp() {
833
+ * const http = inject(HttpClient);
834
+ * return firstValueFrom(
835
+ * http
836
+ * .get("https://someUrl.com/api/user")
837
+ * .pipe(tap(user => { ... }))
838
+ * );
839
+ * }
831
840
  *
832
841
  * bootstrapApplication(App, {
833
842
  * providers: [
834
843
  * provideHttpClient(),
835
844
  * {
836
845
  * provide: APP_INITIALIZER,
837
- * useFactory: initializeAppFactory,
846
+ * useValue: initializeApp,
838
847
  * multi: true,
839
- * deps: [HttpClient],
840
848
  * },
841
849
  * ],
842
850
  * });
@@ -870,6 +878,7 @@ export declare class ApplicationInitStatus {
870
878
  readonly done = false;
871
879
  readonly donePromise: Promise<any>;
872
880
  private readonly appInits;
881
+ private readonly injector;
873
882
  constructor();
874
883
  static ɵfac: i0.ɵɵFactoryDeclaration<ApplicationInitStatus, never>;
875
884
  static ɵprov: i0.ɵɵInjectableDeclaration<ApplicationInitStatus>;
@@ -2391,10 +2400,12 @@ export declare interface ContentChildFunction {
2391
2400
  <LocatorT>(locator: ProviderToken<LocatorT> | string, opts?: {
2392
2401
  descendants?: boolean;
2393
2402
  read?: undefined;
2403
+ debugName?: string;
2394
2404
  }): Signal<LocatorT | undefined>;
2395
2405
  <LocatorT, ReadT>(locator: ProviderToken<LocatorT> | string, opts: {
2396
2406
  descendants?: boolean;
2397
2407
  read: ProviderToken<ReadT>;
2408
+ debugName?: string;
2398
2409
  }): Signal<ReadT | undefined>;
2399
2410
  /**
2400
2411
  * Initializes a content child query that is always expected to match.
@@ -2403,10 +2414,12 @@ export declare interface ContentChildFunction {
2403
2414
  <LocatorT>(locator: ProviderToken<LocatorT> | string, opts?: {
2404
2415
  descendants?: boolean;
2405
2416
  read?: undefined;
2417
+ debugName?: string;
2406
2418
  }): Signal<LocatorT>;
2407
2419
  <LocatorT, ReadT>(locator: ProviderToken<LocatorT> | string, opts: {
2408
2420
  descendants?: boolean;
2409
2421
  read: ProviderToken<ReadT>;
2422
+ debugName?: string;
2410
2423
  }): Signal<ReadT>;
2411
2424
  };
2412
2425
  }
@@ -2432,11 +2445,13 @@ export declare const ContentChildren: ContentChildrenDecorator;
2432
2445
  export declare function contentChildren<LocatorT>(locator: ProviderToken<LocatorT> | string, opts?: {
2433
2446
  descendants?: boolean;
2434
2447
  read?: undefined;
2448
+ debugName?: string;
2435
2449
  }): Signal<ReadonlyArray<LocatorT>>;
2436
2450
 
2437
2451
  export declare function contentChildren<LocatorT, ReadT>(locator: ProviderToken<LocatorT> | string, opts: {
2438
2452
  descendants?: boolean;
2439
2453
  read: ProviderToken<ReadT>;
2454
+ debugName?: string;
2440
2455
  }): Signal<ReadonlyArray<ReadT>>;
2441
2456
 
2442
2457
  /**
@@ -2600,6 +2615,10 @@ export declare interface CreateComputedOptions<T> {
2600
2615
  * A comparison function which defines equality for computed values.
2601
2616
  */
2602
2617
  equal?: ValueEqualityFn<T>;
2618
+ /**
2619
+ * A debug name for the computed signal. Used in Angular DevTools to identify the signal.
2620
+ */
2621
+ debugName?: string;
2603
2622
  }
2604
2623
 
2605
2624
  /**
@@ -2631,6 +2650,10 @@ export declare interface CreateEffectOptions {
2631
2650
  * @deprecated no longer required, signal writes are allowed by default.
2632
2651
  */
2633
2652
  allowSignalWrites?: boolean;
2653
+ /**
2654
+ * A debug name for the effect. Used in Angular DevTools to identify the effect.
2655
+ */
2656
+ debugName?: string;
2634
2657
  }
2635
2658
 
2636
2659
  /**
@@ -2694,6 +2717,10 @@ export declare interface CreateSignalOptions<T> {
2694
2717
  * A comparison function which defines equality for signal values.
2695
2718
  */
2696
2719
  equal?: ValueEqualityFn<T>;
2720
+ /**
2721
+ * A debug name for the signal. Used in Angular DevTools to identify the signal.
2722
+ */
2723
+ debugName?: string;
2697
2724
  }
2698
2725
 
2699
2726
  /**
@@ -3012,6 +3039,38 @@ export declare class DefaultIterableDiffer<V> implements IterableDiffer<V>, Iter
3012
3039
  private _addToRemovals;
3013
3040
  }
3014
3041
 
3042
+ declare const DEFER_BLOCK_ID = "di";
3043
+
3044
+ declare const DEFER_BLOCK_STATE = "s";
3045
+
3046
+ declare const DEFER_HYDRATE_TRIGGERS = "t";
3047
+
3048
+ declare const DEFER_PARENT_BLOCK_ID = "p";
3049
+
3050
+ /**
3051
+ * Basic set of data structures used for identifying a defer block
3052
+ * and triggering defer blocks
3053
+ */
3054
+ declare interface DeferBlock {
3055
+ lView: LView;
3056
+ tNode: TNode;
3057
+ lContainer: LContainer;
3058
+ }
3059
+
3060
+ /**
3061
+ * Represents defer trigger types.
3062
+ */
3063
+ declare const enum DeferBlockTrigger {
3064
+ Idle = 0,
3065
+ Immediate = 1,
3066
+ Viewport = 2,
3067
+ Interaction = 3,
3068
+ Hover = 4,
3069
+ Timer = 5,
3070
+ When = 6,
3071
+ Never = 7
3072
+ }
3073
+
3015
3074
  /**
3016
3075
  * Describes the state of defer block dependency loading.
3017
3076
  */
@@ -3131,6 +3190,10 @@ declare interface DehydratedView {
3131
3190
  * removed from the DOM during hydration cleanup.
3132
3191
  */
3133
3192
  dehydratedIcuData?: Map<number, DehydratedIcuData>;
3193
+ /**
3194
+ * A mapping of defer block unique ids to the defer block data
3195
+ */
3196
+ dehydratedDeferBlockData?: Record<string, SerializedDeferBlock>;
3134
3197
  }
3135
3198
 
3136
3199
  /**
@@ -4097,6 +4160,10 @@ declare const ENVIRONMENT = 10;
4097
4160
  * A multi-provider token for initialization functions that will run upon construction of an
4098
4161
  * environment injector.
4099
4162
  *
4163
+ * @deprecated from v19.0.0, use provideEnvironmentInitializer instead
4164
+ *
4165
+ * @see {@link provideEnvironmentInitializer}
4166
+ *
4100
4167
  * Note: As opposed to the `APP_INITIALIZER` token, the `ENVIRONMENT_INITIALIZER` functions are not awaited,
4101
4168
  * hence they should not be `async`.
4102
4169
  *
@@ -5115,6 +5182,14 @@ export declare interface HostListenerDecorator {
5115
5182
  new (eventName: string, args?: string[]): any;
5116
5183
  }
5117
5184
 
5185
+ /** * Describes specified delay (in ms) in the `hydrate on timer()` trigger. */
5186
+ declare interface HydrateTimerTriggerDetails {
5187
+ delay: number;
5188
+ }
5189
+
5190
+ /** * Describes all possible hydration trigger details specified in a template. */
5191
+ declare type HydrateTriggerDetails = HydrateTimerTriggerDetails;
5192
+
5118
5193
  declare const HYDRATION = 6;
5119
5194
 
5120
5195
  declare const HYDRATION_INFO_KEY = "__ngDebugHydrationInfo__";
@@ -6233,6 +6308,10 @@ export declare interface InputOptions<T, TransformT> {
6233
6308
  * handle such string values and convert them to `boolean`. See: {@link booleanAttribute}.
6234
6309
  */
6235
6310
  transform?: (v: TransformT) => T;
6311
+ /**
6312
+ * A debug name for the input signal. Used in Angular DevTools to identify the signal.
6313
+ */
6314
+ debugName?: string;
6236
6315
  }
6237
6316
 
6238
6317
  /**
@@ -6730,6 +6809,22 @@ declare enum LContainerFlags {
6730
6809
 
6731
6810
  declare type LegacyInputPartialMapping = string | [bindingPropertyName: string, classPropertyName: string, transformFunction?: Function];
6732
6811
 
6812
+ /**
6813
+ * @experimental
6814
+ */
6815
+ export declare function linkedSignal<D>(computation: () => D, options?: {
6816
+ equal?: ValueEqualityFn<NoInfer<D>>;
6817
+ }): WritableSignal<D>;
6818
+
6819
+ export declare function linkedSignal<S, D>(options: {
6820
+ source: () => S;
6821
+ computation: (source: NoInfer<S>, previous?: {
6822
+ source: NoInfer<S>;
6823
+ value: NoInfer<D>;
6824
+ }) => D;
6825
+ equal?: ValueEqualityFn<NoInfer<D>>;
6826
+ }): WritableSignal<D>;
6827
+
6733
6828
  /**
6734
6829
  * Event listener configuration returned from `getListeners`.
6735
6830
  * @publicApi
@@ -7325,6 +7420,10 @@ export declare interface ModelOptions {
7325
7420
  * name as the input, but suffixed with `Change`. By default, the class field name is used.
7326
7421
  */
7327
7422
  alias?: string;
7423
+ /**
7424
+ * A debug name for the model signal. Used in Angular DevTools to identify the signal.
7425
+ */
7426
+ debugName?: string;
7328
7427
  }
7329
7428
 
7330
7429
  /**
@@ -8319,6 +8418,7 @@ declare class PendingTasksInternal implements OnDestroy {
8319
8418
  private get _hasPendingTasks();
8320
8419
  hasPendingTasks: BehaviorSubject<boolean>;
8321
8420
  add(): number;
8421
+ has(taskId: number): boolean;
8322
8422
  remove(taskId: number): void;
8323
8423
  ngOnDestroy(): void;
8324
8424
  /** @nocollapse */
@@ -8453,6 +8553,11 @@ export declare const PLATFORM_ID: InjectionToken<Object>;
8453
8553
 
8454
8554
  /**
8455
8555
  * A function that is executed when a platform is initialized.
8556
+ *
8557
+ * @deprecated from v19.0.0, use providePlatformInitializer instead
8558
+ *
8559
+ * @see {@link providePlatformInitializer}
8560
+ *
8456
8561
  * @publicApi
8457
8562
  */
8458
8563
  export declare const PLATFORM_INITIALIZER: InjectionToken<readonly (() => void)[]>;
@@ -8584,6 +8689,75 @@ declare type ProcessProvidersFunction = (providers: Provider[]) => Provider[];
8584
8689
  */
8585
8690
  declare type ProjectionSlots = (ɵCssSelectorList | '*')[];
8586
8691
 
8692
+ /**
8693
+ * @description
8694
+ * The provided function is injected at application startup and executed during
8695
+ * app initialization. If the function returns a Promise or an Observable, initialization
8696
+ * does not complete until the Promise is resolved or the Observable is completed.
8697
+ *
8698
+ * You can, for example, create a function that loads language data
8699
+ * or an external configuration, and provide that function using `provideAppInitializer()`.
8700
+ * The function is executed during the application bootstrap process,
8701
+ * and the needed data is available on startup.
8702
+ *
8703
+ * Note that the provided initializer is run in the injection context.
8704
+ *
8705
+ * Previously, this was achieved using the `APP_INITIALIZER` token which is now deprecated.
8706
+ *
8707
+ * @see {@link APP_INITIALIZER}
8708
+ *
8709
+ * @usageNotes
8710
+ * The following example illustrates how to configure an initialization function using
8711
+ * `provideAppInitializer()`
8712
+ * ```
8713
+ * bootstrapApplication(App, {
8714
+ * providers: [
8715
+ * provideAppInitializer(() => {
8716
+ * const http = inject(HttpClient);
8717
+ * return firstValueFrom(
8718
+ * http
8719
+ * .get("https://someUrl.com/api/user")
8720
+ * .pipe(tap(user => { ... }))
8721
+ * );
8722
+ * }),
8723
+ * provideHttpClient(),
8724
+ * ],
8725
+ * });
8726
+ * ```
8727
+ *
8728
+ * @publicApi
8729
+ */
8730
+ export declare function provideAppInitializer(initializerFn: () => Observable<unknown> | Promise<unknown> | void): EnvironmentProviders;
8731
+
8732
+ /**
8733
+ * @description
8734
+ * This function is used to provide initialization functions that will be executed upon construction
8735
+ * of an environment injector.
8736
+ *
8737
+ * Note that the provided initializer is run in the injection context.
8738
+ *
8739
+ * Previously, this was achieved using the `ENVIRONMENT_INITIALIZER` token which is now deprecated.
8740
+ *
8741
+ * @see {@link ENVIRONMENT_INITIALIZER}
8742
+ *
8743
+ * @usageNotes
8744
+ * The following example illustrates how to configure an initialization function using
8745
+ * `provideEnvironmentInitializer()`
8746
+ * ```
8747
+ * createEnvironmentInjector(
8748
+ * [
8749
+ * provideEnvironmentInjector(() => {
8750
+ * console.log('environment initialized');
8751
+ * }),
8752
+ * ],
8753
+ * parentInjector
8754
+ * );
8755
+ * ```
8756
+ *
8757
+ * @publicApi
8758
+ */
8759
+ export declare function provideEnvironmentInitializer(initializerFn: () => void): EnvironmentProviders;
8760
+
8587
8761
  /**
8588
8762
  * Used to periodically verify no expressions have changed after they were checked.
8589
8763
  *
@@ -8651,6 +8825,21 @@ export declare function provideExperimentalCheckNoChangesForDebug(options: {
8651
8825
  */
8652
8826
  export declare function provideExperimentalZonelessChangeDetection(): EnvironmentProviders;
8653
8827
 
8828
+ /**
8829
+ * @description
8830
+ * This function is used to provide initialization functions that will be executed upon
8831
+ * initialization of the platform injector.
8832
+ *
8833
+ * Note that the provided initializer is run in the injection context.
8834
+ *
8835
+ * Previously, this was achieved using the `PLATFORM_INITIALIZER` token which is now deprecated.
8836
+ *
8837
+ * @see {@link PLATFORM_INITIALIZER}
8838
+ *
8839
+ * @publicApi
8840
+ */
8841
+ export declare function providePlatformInitializer(initializerFn: () => void): EnvironmentProviders;
8842
+
8654
8843
  /**
8655
8844
  * Describes how the `Injector` should be configured.
8656
8845
  * @see [Dependency Injection Guide](guide/di/dependency-injection.
@@ -9425,6 +9614,164 @@ export declare interface RendererType2 {
9425
9614
  */
9426
9615
  export declare function resolveForwardRef<T>(type: T): T;
9427
9616
 
9617
+ /**
9618
+ * A Resource is an asynchronous dependency (for example, the results of an API call) that is
9619
+ * managed and delivered through signals.
9620
+ *
9621
+ * The usual way of creating a `Resource` is through the `resource` function, but various other APIs
9622
+ * may present `Resource` instances to describe their own concepts.
9623
+ *
9624
+ * @experimental
9625
+ */
9626
+ export declare interface Resource<T> {
9627
+ /**
9628
+ * The current value of the `Resource`, or `undefined` if there is no current value.
9629
+ */
9630
+ readonly value: Signal<T | undefined>;
9631
+ /**
9632
+ * The current status of the `Resource`, which describes what the resource is currently doing and
9633
+ * what can be expected of its `value`.
9634
+ */
9635
+ readonly status: Signal<ResourceStatus>;
9636
+ /**
9637
+ * When in the `error` state, this returns the last known error from the `Resource`.
9638
+ */
9639
+ readonly error: Signal<unknown>;
9640
+ /**
9641
+ * Whether this resource is loading a new value (or reloading the existing one).
9642
+ */
9643
+ readonly isLoading: Signal<boolean>;
9644
+ /**
9645
+ * Whether this resource has a valid current value.
9646
+ *
9647
+ * This function is reactive.
9648
+ */
9649
+ hasValue(): this is Resource<T> & {
9650
+ value: Signal<T>;
9651
+ };
9652
+ /**
9653
+ * Instructs the resource to re-load any asynchronous dependency it may have.
9654
+ *
9655
+ * Note that the resource will not enter its reloading state until the actual backend request is
9656
+ * made.
9657
+ *
9658
+ * @returns true if a reload was initiated, false if a reload was unnecessary or unsupported
9659
+ */
9660
+ reload(): boolean;
9661
+ }
9662
+
9663
+ /**
9664
+ * Constructs a `Resource` that projects a reactive request to an asynchronous operation defined by
9665
+ * a loader function, which exposes the result of the loading operation via signals.
9666
+ *
9667
+ * Note that `resource` is intended for _read_ operations, not operations which perform mutations.
9668
+ * `resource` will cancel in-progress loads via the `AbortSignal` when destroyed or when a new
9669
+ * request object becomes available, which could prematurely abort mutations.
9670
+ *
9671
+ * @experimental
9672
+ */
9673
+ export declare function resource<T, R>(options: ResourceOptions<T, R>): ResourceRef<T>;
9674
+
9675
+ /**
9676
+ * Loading function for a `Resource`.
9677
+ *
9678
+ * @experimental
9679
+ */
9680
+ export declare type ResourceLoader<T, R> = (param: ResourceLoaderParams<R>) => PromiseLike<T>;
9681
+
9682
+ /**
9683
+ * Parameter to a `ResourceLoader` which gives the request and other options for the current loading
9684
+ * operation.
9685
+ *
9686
+ * @experimental
9687
+ */
9688
+ export declare interface ResourceLoaderParams<R> {
9689
+ request: Exclude<NoInfer<R>, undefined>;
9690
+ abortSignal: AbortSignal;
9691
+ previous: {
9692
+ status: ResourceStatus;
9693
+ };
9694
+ }
9695
+
9696
+ /**
9697
+ * Options to the `resource` function, for creating a resource.
9698
+ *
9699
+ * @experimental
9700
+ */
9701
+ export declare interface ResourceOptions<T, R> {
9702
+ /**
9703
+ * A reactive function which determines the request to be made. Whenever the request changes, the
9704
+ * loader will be triggered to fetch a new value for the resource.
9705
+ *
9706
+ * If a request function isn't provided, the loader won't rerun unless the resource is reloaded.
9707
+ */
9708
+ request?: () => R;
9709
+ /**
9710
+ * Loading function which returns a `Promise` of the resource's value for a given request.
9711
+ */
9712
+ loader: ResourceLoader<T, R>;
9713
+ /**
9714
+ * Equality function used to compare the return value of the loader.
9715
+ */
9716
+ equal?: ValueEqualityFn<T>;
9717
+ /**
9718
+ * Overrides the `Injector` used by `resource`.
9719
+ */
9720
+ injector?: Injector;
9721
+ }
9722
+
9723
+ /**
9724
+ * A `WritableResource` created through the `resource` function.
9725
+ *
9726
+ * @experimental
9727
+ */
9728
+ export declare interface ResourceRef<T> extends WritableResource<T> {
9729
+ /**
9730
+ * Manually destroy the resource, which cancels pending requests and returns it to `idle` state.
9731
+ */
9732
+ destroy(): void;
9733
+ }
9734
+
9735
+ /**
9736
+ * Status of a `Resource`.
9737
+ *
9738
+ * @experimental
9739
+ */
9740
+ export declare enum ResourceStatus {
9741
+ /**
9742
+ * The resource has no valid request and will not perform any loading.
9743
+ *
9744
+ * `value()` will be `undefined`.
9745
+ */
9746
+ Idle = 0,
9747
+ /**
9748
+ * Loading failed with an error.
9749
+ *
9750
+ * `value()` will be `undefined`.
9751
+ */
9752
+ Error = 1,
9753
+ /**
9754
+ * The resource is currently loading a new value as a result of a change in its `request`.
9755
+ *
9756
+ * `value()` will be `undefined`.
9757
+ */
9758
+ Loading = 2,
9759
+ /**
9760
+ * The resource is currently reloading a fresh value for the same request.
9761
+ *
9762
+ * `value()` will continue to return the previously fetched value during the reloading operation.
9763
+ */
9764
+ Reloading = 3,
9765
+ /**
9766
+ * Loading has completed and the resource has the value returned from the loader.
9767
+ */
9768
+ Resolved = 4,
9769
+ /**
9770
+ * The resource's value was set locally via `.set()` or `.update()`.
9771
+ */
9772
+ Local = 5
9773
+ }
9774
+
9428
9775
  /**
9429
9776
  * The goal here is to make sure that the browser DOM API is the Renderer.
9430
9777
  * We do this by defining a subset of DOM API to be the renderer and then
@@ -9647,6 +9994,33 @@ declare interface SerializedContainerView extends SerializedView {
9647
9994
  [MULTIPLIER]?: number;
9648
9995
  }
9649
9996
 
9997
+ /**
9998
+ * Serialized data structure that contains relevant defer block
9999
+ * information that describes a given incremental hydration boundary
10000
+ */
10001
+ declare interface SerializedDeferBlock {
10002
+ /**
10003
+ * This contains the unique id of this defer block's parent, if it exists.
10004
+ */
10005
+ [DEFER_PARENT_BLOCK_ID]: string | null;
10006
+ /**
10007
+ * This field represents a status, based on the `DeferBlockState` enum.
10008
+ */
10009
+ [DEFER_BLOCK_STATE]?: number;
10010
+ /**
10011
+ * Number of root nodes that belong to this defer block's template.
10012
+ * This information is needed to effectively traverse the DOM tree
10013
+ * and add jsaction attributes to root nodes appropriately for
10014
+ * incremental hydration.
10015
+ */
10016
+ [NUM_ROOT_NODES]: number;
10017
+ /**
10018
+ * The list of triggers that exist for incremental hydration, based on the
10019
+ * `Trigger` enum.
10020
+ */
10021
+ [DEFER_HYDRATE_TRIGGERS]: (DeferBlockTrigger | SerializedTriggerDetails)[] | null;
10022
+ }
10023
+
9650
10024
  /**
9651
10025
  * Represents element containers within this view, stored as key-value pairs
9652
10026
  * where key is an index of a container in an LView (also used in the
@@ -9658,6 +10032,11 @@ declare interface SerializedElementContainers {
9658
10032
  [key: number]: number;
9659
10033
  }
9660
10034
 
10035
+ declare interface SerializedTriggerDetails {
10036
+ trigger: DeferBlockTrigger;
10037
+ delay?: number;
10038
+ }
10039
+
9661
10040
  /**
9662
10041
  * Serialized data structure that contains relevant hydration
9663
10042
  * annotation information that describes a given hydration boundary
@@ -9705,6 +10084,15 @@ declare interface SerializedView {
9705
10084
  * active ICU cases.
9706
10085
  */
9707
10086
  [I18N_DATA]?: Record<number, number[]>;
10087
+ /**
10088
+ * If this view represents a `@defer` block, this field contains
10089
+ * unique id of the block.
10090
+ */
10091
+ [DEFER_BLOCK_ID]?: string;
10092
+ /**
10093
+ * This field represents a status, based on the `DeferBlockState` enum.
10094
+ */
10095
+ [DEFER_BLOCK_STATE]?: number;
9708
10096
  }
9709
10097
 
9710
10098
  /**
@@ -10040,6 +10428,14 @@ declare interface TDeferBlockDetails {
10040
10428
  * standalone components used within this defer block.
10041
10429
  */
10042
10430
  providers: Provider[] | null;
10431
+ /**
10432
+ * List of hydrate triggers for a given block
10433
+ */
10434
+ hydrateTriggers: Map<DeferBlockTrigger, HydrateTriggerDetails | null> | null;
10435
+ /**
10436
+ * List of prefetch triggers for a given block
10437
+ */
10438
+ prefetchTriggers: Set<DeferBlockTrigger> | null;
10043
10439
  }
10044
10440
 
10045
10441
  /** Static data for an <ng-container> */
@@ -11782,19 +12178,25 @@ export declare interface ViewChildFunction {
11782
12178
  *
11783
12179
  * @publicAPI
11784
12180
  */
11785
- <LocatorT>(locator: ProviderToken<LocatorT> | string): Signal<LocatorT | undefined>;
11786
12181
  <LocatorT, ReadT>(locator: ProviderToken<LocatorT> | string, opts: {
11787
12182
  read: ProviderToken<ReadT>;
12183
+ debugName?: string;
11788
12184
  }): Signal<ReadT | undefined>;
12185
+ <LocatorT>(locator: ProviderToken<LocatorT> | string, opts?: {
12186
+ debugName?: string;
12187
+ }): Signal<LocatorT | undefined>;
11789
12188
  /**
11790
12189
  * Initializes a view child query that is expected to always match an element.
11791
12190
  *
11792
12191
  * @publicAPI
11793
12192
  */
11794
12193
  required: {
11795
- <LocatorT>(locator: ProviderToken<LocatorT> | string): Signal<LocatorT>;
12194
+ <LocatorT>(locator: ProviderToken<LocatorT> | string, opts?: {
12195
+ debugName?: string;
12196
+ }): Signal<LocatorT>;
11796
12197
  <LocatorT, ReadT>(locator: ProviderToken<LocatorT> | string, opts: {
11797
12198
  read: ProviderToken<ReadT>;
12199
+ debugName?: string;
11798
12200
  }): Signal<ReadT>;
11799
12201
  };
11800
12202
  }
@@ -11814,10 +12216,13 @@ export declare type ViewChildren = Query;
11814
12216
  */
11815
12217
  export declare const ViewChildren: ViewChildrenDecorator;
11816
12218
 
11817
- export declare function viewChildren<LocatorT>(locator: ProviderToken<LocatorT> | string): Signal<ReadonlyArray<LocatorT>>;
12219
+ export declare function viewChildren<LocatorT>(locator: ProviderToken<LocatorT> | string, opts?: {
12220
+ debugName?: string;
12221
+ }): Signal<ReadonlyArray<LocatorT>>;
11818
12222
 
11819
12223
  export declare function viewChildren<LocatorT, ReadT>(locator: ProviderToken<LocatorT> | string, opts: {
11820
12224
  read: ProviderToken<ReadT>;
12225
+ debugName?: string;
11821
12226
  }): Signal<ReadonlyArray<ReadT>>;
11822
12227
 
11823
12228
  /**
@@ -12165,6 +12570,29 @@ export declare abstract class ViewRef extends ChangeDetectorRef {
12165
12570
  abstract onDestroy(callback: Function): void;
12166
12571
  }
12167
12572
 
12573
+ /**
12574
+ * A `Resource` with a mutable value.
12575
+ *
12576
+ * Overwriting the value of a resource sets it to the 'local' state.
12577
+ *
12578
+ * @experimental
12579
+ */
12580
+ export declare interface WritableResource<T> extends Resource<T> {
12581
+ readonly value: WritableSignal<T | undefined>;
12582
+ hasValue(): this is WritableResource<T> & {
12583
+ value: WritableSignal<T>;
12584
+ };
12585
+ /**
12586
+ * Convenience wrapper for `value.set`.
12587
+ */
12588
+ set(value: T | undefined): void;
12589
+ /**
12590
+ * Convenience wrapper for `value.update`.
12591
+ */
12592
+ update(updater: (value: T | undefined) => T | undefined): void;
12593
+ asReadonly(): Resource<T>;
12594
+ }
12595
+
12168
12596
  /**
12169
12597
  * A `Signal` with a value that can be mutated via a setter interface.
12170
12598
  */
@@ -12792,10 +13220,7 @@ export declare interface ɵDeferBlockDependencyInterceptor {
12792
13220
  /**
12793
13221
  * Defer block instance for testing.
12794
13222
  */
12795
- export declare interface ɵDeferBlockDetails {
12796
- lContainer: LContainer;
12797
- lView: LView;
12798
- tNode: TNode;
13223
+ export declare interface ɵDeferBlockDetails extends DeferBlock {
12799
13224
  tDetails: TDeferBlockDetails;
12800
13225
  }
12801
13226
 
@@ -13291,6 +13716,10 @@ export declare interface ɵInputSignalNode<T, TransformT> extends SignalNode<T>
13291
13716
  * purposes we assume it's a valid `T` value. Type-checking will enforce that.
13292
13717
  */
13293
13718
  applyValueToInputSignal<T, TransformT>(node: ɵInputSignalNode<T, TransformT>, value: T): void;
13719
+ /**
13720
+ * A debug name for the input signal. Used in Angular DevTools to identify the signal.
13721
+ */
13722
+ debugName?: string;
13294
13723
  }
13295
13724
 
13296
13725
  /**
@@ -13340,6 +13769,12 @@ export declare function ɵinternalProvideZoneChangeDetection({ ngZoneFactory, ig
13340
13769
  */
13341
13770
  export declare const ɵIS_HYDRATION_DOM_REUSE_ENABLED: InjectionToken<boolean>;
13342
13771
 
13772
+ /**
13773
+ * Internal token that indicates whether incremental hydration support
13774
+ * is enabled.
13775
+ */
13776
+ export declare const ɵIS_INCREMENTAL_HYDRATION_ENABLED: InjectionToken<boolean>;
13777
+
13343
13778
  export declare function ɵisBoundToModule<C>(cf: ComponentFactory<C>): boolean;
13344
13779
 
13345
13780
  export declare function ɵisComponentDefPendingResolution(type: Type<any>): boolean;
@@ -14547,6 +14982,14 @@ export declare function ɵwithEventReplay(): Provider[];
14547
14982
  */
14548
14983
  export declare function ɵwithI18nSupport(): Provider[];
14549
14984
 
14985
+ /**
14986
+ * Returns a set of providers required to setup support for incremental hydration.
14987
+ * Requires hydration to be enabled separately.
14988
+ *
14989
+ * @developerPreview
14990
+ */
14991
+ export declare function ɵwithIncrementalHydration(): Provider[];
14992
+
14550
14993
  /**
14551
14994
  * Returns a writable type version of type.
14552
14995
  *
@@ -15349,21 +15792,54 @@ export declare function ɵɵdefer(index: number, primaryTmplIndex: number, depen
15349
15792
  */
15350
15793
  export declare function ɵɵdeferEnableTimerScheduling(tView: TView, tDetails: TDeferBlockDetails, placeholderConfigIndex?: number | null, loadingConfigIndex?: number | null): void;
15351
15794
 
15795
+ /**
15796
+ * Specifies that hydration never occurs.
15797
+ * @codeGenApi
15798
+ */
15352
15799
  export declare function ɵɵdeferHydrateNever(): void;
15353
15800
 
15801
+ /**
15802
+ * Creates runtime data structures for the `on hover` hydrate trigger.
15803
+ * @codeGenApi
15804
+ */
15354
15805
  export declare function ɵɵdeferHydrateOnHover(): void;
15355
15806
 
15807
+ /**
15808
+ * Sets up logic to handle the `on idle` deferred trigger.
15809
+ * @codeGenApi
15810
+ */
15356
15811
  export declare function ɵɵdeferHydrateOnIdle(): void;
15357
15812
 
15813
+ /**
15814
+ * Sets up logic to handle the `on immediate` hydrate trigger.
15815
+ * @codeGenApi
15816
+ */
15358
15817
  export declare function ɵɵdeferHydrateOnImmediate(): void;
15359
15818
 
15819
+ /**
15820
+ * Creates runtime data structures for the `on interaction` hydrate trigger.
15821
+ * @codeGenApi
15822
+ */
15360
15823
  export declare function ɵɵdeferHydrateOnInteraction(): void;
15361
15824
 
15362
- export declare function ɵɵdeferHydrateOnTimer(): void;
15825
+ /**
15826
+ * Creates runtime data structures for the `on timer` hydrate trigger.
15827
+ * @param delay Amount of time to wait before loading the content.
15828
+ * @codeGenApi
15829
+ */
15830
+ export declare function ɵɵdeferHydrateOnTimer(delay: number): void;
15363
15831
 
15832
+ /**
15833
+ * Creates runtime data structures for the `on viewport` hydrate trigger.
15834
+ * @codeGenApi
15835
+ */
15364
15836
  export declare function ɵɵdeferHydrateOnViewport(): void;
15365
15837
 
15366
- export declare function ɵɵdeferHydrateWhen(): void;
15838
+ /**
15839
+ * Hydrates the deferred content when a value becomes truthy.
15840
+ * @codeGenApi
15841
+ */
15842
+ export declare function ɵɵdeferHydrateWhen(rawValue: unknown): void;
15367
15843
 
15368
15844
  /**
15369
15845
  * Creates runtime data structures for the `on hover` deferred trigger.