@angular/core 18.2.1 → 18.2.2

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 (47) hide show
  1. package/esm2022/primitives/event-dispatch/src/event_dispatcher.mjs +7 -1
  2. package/esm2022/src/application/application_ref.mjs +107 -37
  3. package/esm2022/src/change_detection/scheduling/zoneless_scheduling.mjs +1 -1
  4. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +37 -13
  5. package/esm2022/src/core.mjs +3 -2
  6. package/esm2022/src/core_private_export.mjs +1 -2
  7. package/esm2022/src/core_render3_private_export.mjs +2 -2
  8. package/esm2022/src/defer/dom_triggers.mjs +13 -8
  9. package/esm2022/src/render3/after_render/api.mjs +70 -0
  10. package/esm2022/src/render3/after_render/hooks.mjs +70 -0
  11. package/esm2022/src/render3/after_render/manager.mjs +141 -0
  12. package/esm2022/src/render3/component_ref.mjs +14 -6
  13. package/esm2022/src/render3/interfaces/view.mjs +1 -1
  14. package/esm2022/src/render3/node_manipulation.mjs +1 -1
  15. package/esm2022/src/render3/util/view_utils.mjs +1 -1
  16. package/esm2022/src/version.mjs +1 -1
  17. package/esm2022/testing/src/application_error_handler.mjs +3 -3
  18. package/esm2022/testing/src/logger.mjs +3 -3
  19. package/fesm2022/core.mjs +448 -407
  20. package/fesm2022/core.mjs.map +1 -1
  21. package/fesm2022/primitives/event-dispatch.mjs +6 -1
  22. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  23. package/fesm2022/primitives/signals.mjs +1 -1
  24. package/fesm2022/rxjs-interop.mjs +1 -1
  25. package/fesm2022/testing.mjs +4 -4
  26. package/index.d.ts +85 -72
  27. package/package.json +1 -1
  28. package/primitives/event-dispatch/index.d.ts +1 -1
  29. package/primitives/signals/index.d.ts +1 -1
  30. package/rxjs-interop/index.d.ts +1 -1
  31. package/schematics/migrations/after-render-phase/bundle.js +3694 -3575
  32. package/schematics/migrations/http-providers/bundle.js +3694 -3575
  33. package/schematics/migrations/invalid-two-way-bindings/bundle.js +3694 -3575
  34. package/schematics/ng-generate/control-flow-migration/bundle.js +3726 -3607
  35. package/schematics/ng-generate/inject-migration/bundle.js +3694 -3575
  36. package/schematics/ng-generate/route-lazy-loading/bundle.js +3694 -3575
  37. package/schematics/ng-generate/standalone-migration/bundle.js +3744 -3601
  38. package/testing/index.d.ts +1 -1
  39. package/esm2022/src/render3/after_render_hooks.mjs +0 -299
  40. package/esm2022/src/render3/queue_state_update.mjs +0 -39
  41. package/schematics/migrations/after-render-phase/bundle.js.map +0 -7
  42. package/schematics/migrations/http-providers/bundle.js.map +0 -7
  43. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +0 -7
  44. package/schematics/ng-generate/control-flow-migration/bundle.js.map +0 -7
  45. package/schematics/ng-generate/inject-migration/bundle.js.map +0 -7
  46. package/schematics/ng-generate/route-lazy-loading/bundle.js.map +0 -7
  47. package/schematics/ng-generate/standalone-migration/bundle.js.map +0 -7
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.2.1
2
+ * @license Angular v18.2.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.2.1
2
+ * @license Angular v18.2.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.2.1
2
+ * @license Angular v18.2.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -175,10 +175,10 @@ class TestBedApplicationErrorHandler {
175
175
  throw e;
176
176
  }
177
177
  }
178
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: TestBedApplicationErrorHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
179
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: TestBedApplicationErrorHandler }); }
178
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: TestBedApplicationErrorHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
179
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: TestBedApplicationErrorHandler }); }
180
180
  }
181
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: TestBedApplicationErrorHandler, decorators: [{
181
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: TestBedApplicationErrorHandler, decorators: [{
182
182
  type: Injectable
183
183
  }] });
184
184
 
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.2.1
2
+ * @license Angular v18.2.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -362,6 +362,37 @@ export declare function afterRender<E = never, W = never, M = never>(spec: {
362
362
  */
363
363
  export declare function afterRender(callback: VoidFunction, options?: AfterRenderOptions): AfterRenderRef;
364
364
 
365
+ declare type AfterRenderHook = (value?: unknown) => unknown;
366
+
367
+ declare type AfterRenderHooks = [
368
+ AfterRenderHook | undefined,
369
+ AfterRenderHook | undefined,
370
+ AfterRenderHook | undefined,
371
+ AfterRenderHook | undefined
372
+ ];
373
+
374
+ declare class AfterRenderImpl {
375
+ static readonly PHASES: readonly [AfterRenderPhase.EarlyRead, AfterRenderPhase.Write, AfterRenderPhase.MixedReadWrite, AfterRenderPhase.Read];
376
+ private readonly ngZone;
377
+ private readonly scheduler;
378
+ private readonly errorHandler;
379
+ /** Current set of active sequences. */
380
+ private readonly sequences;
381
+ /** Tracks registrations made during the current set of executions. */
382
+ private readonly deferredRegistrations;
383
+ /** Whether the `AfterRenderManager` is currently executing hooks. */
384
+ executing: boolean;
385
+ /**
386
+ * Run the sequence of phases of hooks, once through. As a result of executing some hooks, more
387
+ * might be scheduled.
388
+ */
389
+ execute(): void;
390
+ register(sequence: AfterRenderSequence): void;
391
+ unregister(sequence: AfterRenderSequence): void;
392
+ /** @nocollapse */
393
+ static ɵprov: unknown;
394
+ }
395
+
365
396
  /**
366
397
  * Options passed to `afterRender` and `afterNextRender`.
367
398
  *
@@ -390,6 +421,7 @@ export declare interface AfterRenderOptions {
390
421
  phase?: AfterRenderPhase;
391
422
  }
392
423
 
424
+
393
425
  /**
394
426
  * The phase to run an `afterRender` or `afterNextRender` callback in.
395
427
  *
@@ -464,6 +496,26 @@ export declare interface AfterRenderRef {
464
496
  destroy(): void;
465
497
  }
466
498
 
499
+ declare class AfterRenderSequence implements AfterRenderRef {
500
+ readonly impl: AfterRenderImpl;
501
+ readonly hooks: AfterRenderHooks;
502
+ once: boolean;
503
+ /**
504
+ * Whether this sequence errored or was destroyed during this execution, and hooks should no
505
+ * longer run for it.
506
+ */
507
+ erroredOrDestroyed: boolean;
508
+ /**
509
+ * The value returned by the last hook execution (if any), ready to be pipelined into the next
510
+ * one.
511
+ */
512
+ pipelinedValue: unknown;
513
+ private unregisterOnDestroy;
514
+ constructor(impl: AfterRenderImpl, hooks: AfterRenderHooks, once: boolean, destroyRef: DestroyRef);
515
+ afterRun(): void;
516
+ destroy(): void;
517
+ }
518
+
467
519
  /**
468
520
  * @description
469
521
  * A lifecycle hook that is called after the default change detector has
@@ -828,7 +880,7 @@ export declare class ApplicationRef {
828
880
  private _destroyed;
829
881
  private _destroyListeners;
830
882
  private readonly internalErrorHandler;
831
- private readonly afterRenderEffectManager;
883
+ private readonly afterRenderManager;
832
884
  private readonly zonelessEnabled;
833
885
  private externalTestViews;
834
886
  private beforeRender;
@@ -948,7 +1000,30 @@ export declare class ApplicationRef {
948
1000
  * detection pass during which all change detection must complete.
949
1001
  */
950
1002
  tick(): void;
951
- private detectChangesInAttachedViews;
1003
+ /**
1004
+ * Performs the core work of synchronizing the application state with the UI, resolving any
1005
+ * pending dirtiness (potentially in a loop).
1006
+ */
1007
+ private synchronize;
1008
+ /**
1009
+ * Perform a single synchronization pass.
1010
+ */
1011
+ private synchronizeOnce;
1012
+ /**
1013
+ * Checks `allViews` for views which require refresh/traversal, and updates `dirtyFlags`
1014
+ * accordingly, with two potential behaviors:
1015
+ *
1016
+ * 1. If any of our views require updating, then this adds the `ViewTreeTraversal` dirty flag.
1017
+ * This _should_ be a no-op, since the scheduler should've added the flag at the same time the
1018
+ * view was marked as needing updating.
1019
+ *
1020
+ * TODO(alxhub): figure out if this behavior is still needed for edge cases.
1021
+ *
1022
+ * 2. If none of our views require updating, then clear the view-related `dirtyFlag`s. This
1023
+ * happens when the scheduler is notified of a view becoming dirty, but the view itself isn't
1024
+ * reachable through traversal from our roots (e.g. it's detached from the CD tree).
1025
+ */
1026
+ private syncDirtyFlagsWithViews;
952
1027
  /**
953
1028
  * Attaches a view so that it will be dirty checked.
954
1029
  * The view will be automatically detached when it is destroyed.
@@ -6153,24 +6228,6 @@ declare type InputTransformFunction = (value: any) => any;
6153
6228
  */
6154
6229
  declare type InsertBeforeIndex = null | number | number[];
6155
6230
 
6156
- /**
6157
- * Options passed to `internalAfterNextRender`.
6158
- */
6159
- declare interface InternalAfterNextRenderOptions {
6160
- /**
6161
- * The `Injector` to use during creation.
6162
- *
6163
- * If this is not provided, the current injection context will be used instead (via `inject`).
6164
- */
6165
- injector?: Injector;
6166
- /**
6167
- * When true, the hook will execute both on client and on the server.
6168
- *
6169
- * When false or undefined, the hook only executes in the browser.
6170
- */
6171
- runOnServer?: boolean;
6172
- }
6173
-
6174
6231
  /**
6175
6232
  * This enum is an exact copy of the `InjectFlags` enum above, but the difference is that this is a
6176
6233
  * const enum, so actual enum values would be inlined in generated code. The `InjectFlags` enum can
@@ -6980,8 +7037,6 @@ declare interface LViewEnvironment {
6980
7037
  sanitizer: Sanitizer | null;
6981
7038
  /** Container for reactivity system `effect`s. */
6982
7039
  inlineEffectRunner: ɵEffectScheduler | null;
6983
- /** Container for after render hooks */
6984
- afterRenderEventManager: ɵAfterRenderEventManager | null;
6985
7040
  /** Scheduler for change detection to notify when application state changes. */
6986
7041
  changeDetectionScheduler: ɵChangeDetectionScheduler | null;
6987
7042
  }
@@ -11994,17 +12049,9 @@ export declare function ɵ_sanitizeHtml(defaultDoc: any, unsafeHtmlInput: string
11994
12049
 
11995
12050
  export declare function ɵ_sanitizeUrl(url: string): string;
11996
12051
 
11997
- /**
11998
- * Implements core timing for `afterRender` and `afterNextRender` events.
11999
- * Delegates to an optional `AfterRenderCallbackHandler` for implementation.
12000
- */
12001
- export declare class ɵAfterRenderEventManager {
12002
- /**
12003
- * Executes internal and user-provided callbacks.
12004
- */
12052
+ export declare class ɵAfterRenderManager {
12053
+ impl: AfterRenderImpl | null;
12005
12054
  execute(): void;
12006
- executeInternalCallbacks(): void;
12007
- ngOnDestroy(): void;
12008
12055
  /** @nocollapse */
12009
12056
  static ɵprov: unknown;
12010
12057
  }
@@ -12264,7 +12311,6 @@ export declare class ɵChangeDetectionSchedulerImpl implements ɵChangeDetection
12264
12311
  private readonly angularZoneId;
12265
12312
  private readonly scheduleInRootZone;
12266
12313
  private cancelScheduledCallback;
12267
- private shouldRefreshViews;
12268
12314
  private useMicrotaskScheduler;
12269
12315
  runningTick: boolean;
12270
12316
  pendingRenderTaskId: number | null;
@@ -13042,23 +13088,6 @@ export declare const ɵINPUT_SIGNAL_BRAND_WRITE_TYPE: unique symbol;
13042
13088
  */
13043
13089
  export declare const ɵINTERNAL_APPLICATION_ERROR_HANDLER: InjectionToken<(e: any) => void>;
13044
13090
 
13045
- /**
13046
- * Register a callback to run once before any userspace `afterRender` or
13047
- * `afterNextRender` callbacks.
13048
- *
13049
- * This function should almost always be used instead of `afterRender` or
13050
- * `afterNextRender` for implementing framework functionality. Consider:
13051
- *
13052
- * 1.) `AfterRenderPhase.EarlyRead` is intended to be used for implementing
13053
- * custom layout. If the framework itself mutates the DOM after *any*
13054
- * `AfterRenderPhase.EarlyRead` callbacks are run, the phase can no
13055
- * longer reliably serve its purpose.
13056
- *
13057
- * 2.) Importing `afterRender` in the framework can reduce the ability for it
13058
- * to be tree-shaken, and the framework shouldn't need much of the behavior.
13059
- */
13060
- export declare function ɵinternalAfterNextRender(callback: VoidFunction, options?: InternalAfterNextRenderOptions): void;
13061
-
13062
13091
  /**
13063
13092
  * Internal create application API that implements the core application creation logic and optional
13064
13093
  * bootstrap logic.
@@ -13359,10 +13388,11 @@ export declare const enum ɵNotificationSource {
13359
13388
  DebugApplyChanges = 3,
13360
13389
  MarkForCheck = 4,
13361
13390
  Listener = 5,
13362
- NewRenderHook = 6,
13363
- ViewAttached = 7,
13364
- ViewDetachedFromDOM = 8,
13365
- AsyncAnimationsLoaded = 9
13391
+ RenderHook = 6,
13392
+ DeferredRenderHook = 7,
13393
+ ViewAttached = 8,
13394
+ ViewDetachedFromDOM = 9,
13395
+ AsyncAnimationsLoaded = 10
13366
13396
  }
13367
13397
 
13368
13398
  /**
@@ -13527,23 +13557,6 @@ export declare interface ɵProviderRecord {
13527
13557
  importPath?: Type<unknown>[];
13528
13558
  }
13529
13559
 
13530
- /**
13531
- * Queue a state update to be performed asynchronously.
13532
- *
13533
- * This is useful to safely update application state that is used in an expression that was already
13534
- * checked during change detection. This defers the update until later and prevents
13535
- * `ExpressionChangedAfterItHasBeenChecked` errors. Using signals for state is recommended instead,
13536
- * but it's not always immediately possible to change the state to a signal because it would be a
13537
- * breaking change. When the callback updates state used in an expression, this needs to be
13538
- * accompanied by an explicit notification to the framework that something has changed (i.e.
13539
- * updating a signal or calling `ChangeDetectorRef.markForCheck()`) or may still cause
13540
- * `ExpressionChangedAfterItHasBeenChecked` in dev mode or fail to synchronize the state to the DOM
13541
- * in production.
13542
- */
13543
- export declare function ɵqueueStateUpdate(callback: VoidFunction, options?: {
13544
- injector?: Injector;
13545
- }): void;
13546
-
13547
13560
  export declare function ɵreadHydrationInfo(node: RNode): ɵHydrationInfo | null;
13548
13561
 
13549
13562
  export declare class ɵReflectionCapabilities implements PlatformReflectionCapabilities {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "18.2.1",
3
+ "version": "18.2.2",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.2.1
2
+ * @license Angular v18.2.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.2.1
2
+ * @license Angular v18.2.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.2.1
2
+ * @license Angular v18.2.2
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */