@angular/core 19.1.0-next.4 → 19.1.0-rc.0

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/LICENSE +1 -1
  2. package/fesm2022/core.mjs +190 -162
  3. package/fesm2022/core.mjs.map +1 -1
  4. package/fesm2022/primitives/event-dispatch.mjs +1 -24
  5. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  6. package/fesm2022/primitives/signals.mjs +1 -1
  7. package/fesm2022/rxjs-interop.mjs +1 -1
  8. package/fesm2022/testing.mjs +5 -5
  9. package/index.d.ts +17 -11
  10. package/package.json +1 -1
  11. package/primitives/event-dispatch/index.d.ts +1 -1
  12. package/primitives/signals/index.d.ts +1 -1
  13. package/rxjs-interop/index.d.ts +1 -1
  14. package/schematics/bundles/apply_import_manager-6508401d.js +732 -0
  15. package/schematics/bundles/{checker-884633eb.js → checker-24b68d23.js} +33 -9
  16. package/schematics/bundles/cleanup-unused-imports.js +295 -0
  17. package/schematics/bundles/{compiler_host-22f6513d.js → compiler_host-5f693799.js} +2 -2
  18. package/schematics/bundles/control-flow-migration.js +3 -3
  19. package/schematics/bundles/explicit-standalone-flag.js +3 -3
  20. package/schematics/bundles/imports-abe29092.js +1 -1
  21. package/schematics/bundles/{combine_units-4a95b1b9.js → index-767e341d.js} +10 -723
  22. package/schematics/bundles/index-b1033cf0.js +30 -0
  23. package/schematics/bundles/inject-migration.js +3 -3
  24. package/schematics/bundles/leading_space-d190b83b.js +1 -1
  25. package/schematics/bundles/{migrate_ts_type_references-4b11f3f2.js → migrate_ts_type_references-bc7d8784.js} +29 -28
  26. package/schematics/bundles/nodes-a9f0b985.js +1 -1
  27. package/schematics/bundles/output-migration.js +26 -25
  28. package/schematics/bundles/pending-tasks.js +3 -3
  29. package/schematics/bundles/{program-094352ba.js → program-c810a4c2.js} +81 -40
  30. package/schematics/bundles/project_tsconfig_paths-e9ccccbf.js +1 -1
  31. package/schematics/bundles/provide-initializer.js +3 -3
  32. package/schematics/bundles/route-lazy-loading.js +3 -3
  33. package/schematics/bundles/signal-input-migration.js +31 -30
  34. package/schematics/bundles/signal-queries-migration.js +48 -47
  35. package/schematics/bundles/signals.js +6 -5
  36. package/schematics/bundles/standalone-migration.js +9 -25
  37. package/schematics/collection.json +5 -0
  38. package/schematics/ng-generate/cleanup-unused-imports/schema.json +7 -0
  39. package/testing/index.d.ts +1 -1
package/fesm2022/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v19.1.0-next.4
2
+ * @license Angular v19.1.0-rc.0
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1715,8 +1715,7 @@ function getPipeDef$1(type) {
1715
1715
  */
1716
1716
  function isStandalone(type) {
1717
1717
  const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);
1718
- // TODO: standalone as default value (invert the condition)
1719
- return def !== null ? def.standalone : false;
1718
+ return def !== null && def.standalone;
1720
1719
  }
1721
1720
 
1722
1721
  /**
@@ -2903,6 +2902,7 @@ const ON_DESTROY_HOOKS = 21;
2903
2902
  const EFFECTS_TO_SCHEDULE = 22;
2904
2903
  const EFFECTS = 23;
2905
2904
  const REACTIVE_TEMPLATE_CONSUMER = 24;
2905
+ const AFTER_RENDER_SEQUENCES_TO_ADD = 25;
2906
2906
  /**
2907
2907
  * Size of LView's header. Necessary to adjust for it when setting slots.
2908
2908
  *
@@ -2910,7 +2910,7 @@ const REACTIVE_TEMPLATE_CONSUMER = 24;
2910
2910
  * instruction index into `LView` index. All other indexes should be in the `LView` index space and
2911
2911
  * there should be no need to refer to `HEADER_OFFSET` anywhere else.
2912
2912
  */
2913
- const HEADER_OFFSET = 25;
2913
+ const HEADER_OFFSET = 26;
2914
2914
 
2915
2915
  /**
2916
2916
  * Special location which allows easy identification of type. If we have an array which was
@@ -2985,6 +2985,7 @@ function hasI18n(lView) {
2985
2985
  return (lView[FLAGS] & 32 /* LViewFlags.HasI18n */) === 32 /* LViewFlags.HasI18n */;
2986
2986
  }
2987
2987
  function isDestroyed(lView) {
2988
+ // Determines whether a given LView is marked as destroyed.
2988
2989
  return (lView[FLAGS] & 256 /* LViewFlags.Destroyed */) === 256 /* LViewFlags.Destroyed */;
2989
2990
  }
2990
2991
 
@@ -3430,7 +3431,7 @@ function requiresRefreshOrTraversal(lView) {
3430
3431
  * parents above.
3431
3432
  */
3432
3433
  function updateAncestorTraversalFlagsOnAttach(lView) {
3433
- lView[ENVIRONMENT].changeDetectionScheduler?.notify(9 /* NotificationSource.ViewAttached */);
3434
+ lView[ENVIRONMENT].changeDetectionScheduler?.notify(8 /* NotificationSource.ViewAttached */);
3434
3435
  if (lView[FLAGS] & 64 /* LViewFlags.Dirty */) {
3435
3436
  lView[FLAGS] |= 1024 /* LViewFlags.RefreshView */;
3436
3437
  }
@@ -3465,7 +3466,7 @@ function markAncestorsForTraversal(lView) {
3465
3466
  * Stores a LView-specific destroy callback.
3466
3467
  */
3467
3468
  function storeLViewOnDestroy(lView, onDestroyCallback) {
3468
- if ((lView[FLAGS] & 256 /* LViewFlags.Destroyed */) === 256 /* LViewFlags.Destroyed */) {
3469
+ if (isDestroyed(lView)) {
3469
3470
  throw new RuntimeError(911 /* RuntimeErrorCode.VIEW_ALREADY_DESTROYED */, ngDevMode && 'View has already been destroyed.');
3470
3471
  }
3471
3472
  if (lView[ON_DESTROY_HOOKS] === null) {
@@ -6139,7 +6140,7 @@ class PendingTasks {
6139
6140
  return;
6140
6141
  }
6141
6142
  // Notifying the scheduler will hold application stability open until the next tick.
6142
- this.scheduler.notify(12 /* NotificationSource.PendingTaskRemoved */);
6143
+ this.scheduler.notify(11 /* NotificationSource.PendingTaskRemoved */);
6143
6144
  this.internalPendingTasks.remove(taskId);
6144
6145
  };
6145
6146
  }
@@ -6181,7 +6182,8 @@ class PendingTasks {
6181
6182
  }
6182
6183
 
6183
6184
  class EventEmitter_ extends Subject {
6184
- __isAsync; // tslint:disable-line
6185
+ // tslint:disable-next-line:require-internal-with-underscore
6186
+ __isAsync;
6185
6187
  destroyRef = undefined;
6186
6188
  pendingTasks = undefined;
6187
6189
  constructor(isAsync = false) {
@@ -8587,6 +8589,23 @@ function assertNotInReactiveContext(debugFn, extraContext) {
8587
8589
  }
8588
8590
  }
8589
8591
 
8592
+ class ViewContext {
8593
+ view;
8594
+ node;
8595
+ constructor(view, node) {
8596
+ this.view = view;
8597
+ this.node = node;
8598
+ }
8599
+ /**
8600
+ * @internal
8601
+ * @nocollapse
8602
+ */
8603
+ static __NG_ELEMENT_ID__ = injectViewContext;
8604
+ }
8605
+ function injectViewContext() {
8606
+ return new ViewContext(getLView(), getCurrentTNode());
8607
+ }
8608
+
8590
8609
  /**
8591
8610
  * The phase to run an `afterRender` or `afterNextRender` callback in.
8592
8611
  *
@@ -8717,21 +8736,32 @@ class AfterRenderImpl {
8717
8736
  this.sequences.add(sequence);
8718
8737
  }
8719
8738
  if (this.deferredRegistrations.size > 0) {
8720
- this.scheduler.notify(8 /* NotificationSource.DeferredRenderHook */);
8739
+ this.scheduler.notify(7 /* NotificationSource.RenderHook */);
8721
8740
  }
8722
8741
  this.deferredRegistrations.clear();
8723
8742
  }
8724
8743
  register(sequence) {
8725
- if (!this.executing) {
8726
- this.sequences.add(sequence);
8727
- // Trigger an `ApplicationRef.tick()` if one is not already pending/running, because we have a
8728
- // new render hook that needs to run.
8729
- this.scheduler.notify(7 /* NotificationSource.RenderHook */);
8744
+ const { view } = sequence;
8745
+ if (view !== undefined) {
8746
+ // Delay adding it to the manager, add it to the view instead.
8747
+ (view[AFTER_RENDER_SEQUENCES_TO_ADD] ??= []).push(sequence);
8748
+ // Mark the view for traversal to ensure we eventually schedule the afterNextRender.
8749
+ markAncestorsForTraversal(view);
8750
+ view[FLAGS] |= 8192 /* LViewFlags.HasChildViewsToRefresh */;
8751
+ }
8752
+ else if (!this.executing) {
8753
+ this.addSequence(sequence);
8730
8754
  }
8731
8755
  else {
8732
8756
  this.deferredRegistrations.add(sequence);
8733
8757
  }
8734
8758
  }
8759
+ addSequence(sequence) {
8760
+ this.sequences.add(sequence);
8761
+ // Trigger an `ApplicationRef.tick()` if one is not already pending/running, because we have a
8762
+ // new render hook that needs to run.
8763
+ this.scheduler.notify(7 /* NotificationSource.RenderHook */);
8764
+ }
8735
8765
  unregister(sequence) {
8736
8766
  if (this.executing && this.sequences.has(sequence)) {
8737
8767
  // We can't remove an `AfterRenderSequence` in the middle of iteration.
@@ -8761,6 +8791,7 @@ class AfterRenderImpl {
8761
8791
  class AfterRenderSequence {
8762
8792
  impl;
8763
8793
  hooks;
8794
+ view;
8764
8795
  once;
8765
8796
  snapshot;
8766
8797
  /**
@@ -8774,9 +8805,10 @@ class AfterRenderSequence {
8774
8805
  */
8775
8806
  pipelinedValue = undefined;
8776
8807
  unregisterOnDestroy;
8777
- constructor(impl, hooks, once, destroyRef, snapshot = null) {
8808
+ constructor(impl, hooks, view, once, destroyRef, snapshot = null) {
8778
8809
  this.impl = impl;
8779
8810
  this.hooks = hooks;
8811
+ this.view = view;
8780
8812
  this.once = once;
8781
8813
  this.snapshot = snapshot;
8782
8814
  this.unregisterOnDestroy = destroyRef?.onDestroy(() => this.destroy());
@@ -8794,6 +8826,10 @@ class AfterRenderSequence {
8794
8826
  destroy() {
8795
8827
  this.impl.unregister(this);
8796
8828
  this.unregisterOnDestroy?.();
8829
+ const scheduled = this.view?.[AFTER_RENDER_SEQUENCES_TO_ADD];
8830
+ if (scheduled) {
8831
+ this.view[AFTER_RENDER_SEQUENCES_TO_ADD] = scheduled.filter((s) => s !== this);
8832
+ }
8797
8833
  }
8798
8834
  }
8799
8835
 
@@ -8844,7 +8880,8 @@ function afterRenderImpl(callbackOrSpec, injector, options, once) {
8844
8880
  const tracing = injector.get(TracingService, null, { optional: true });
8845
8881
  const hooks = options?.phase ?? AfterRenderPhase.MixedReadWrite;
8846
8882
  const destroyRef = options?.manualCleanup !== true ? injector.get(DestroyRef) : null;
8847
- const sequence = new AfterRenderSequence(manager.impl, getHooks(callbackOrSpec, hooks), once, destroyRef, tracing?.snapshot(null));
8883
+ const viewContext = injector.get(ViewContext, null, { optional: true });
8884
+ const sequence = new AfterRenderSequence(manager.impl, getHooks(callbackOrSpec, hooks), viewContext?.view, once, destroyRef, tracing?.snapshot(null));
8848
8885
  manager.impl.register(sequence);
8849
8886
  return sequence;
8850
8887
  }
@@ -9316,9 +9353,11 @@ function getTriggerElement(triggerLView, triggerIndex) {
9316
9353
  function registerDomTrigger(initialLView, tNode, triggerIndex, walkUpTimes, registerFn, callback, type) {
9317
9354
  const injector = initialLView[INJECTOR];
9318
9355
  const zone = injector.get(NgZone);
9356
+ let poll;
9319
9357
  function pollDomTrigger() {
9320
9358
  // If the initial view was destroyed, we don't need to do anything.
9321
9359
  if (isDestroyed(initialLView)) {
9360
+ poll.destroy();
9322
9361
  return;
9323
9362
  }
9324
9363
  const lDetails = getLDeferBlockDetails(initialLView, tNode);
@@ -9326,14 +9365,16 @@ function registerDomTrigger(initialLView, tNode, triggerIndex, walkUpTimes, regi
9326
9365
  // If the block was loaded before the trigger was resolved, we don't need to do anything.
9327
9366
  if (renderedState !== DeferBlockInternalState.Initial &&
9328
9367
  renderedState !== DeferBlockState.Placeholder) {
9368
+ poll.destroy();
9329
9369
  return;
9330
9370
  }
9331
9371
  const triggerLView = getTriggerLView(initialLView, tNode, walkUpTimes);
9332
9372
  // Keep polling until we resolve the trigger's LView.
9333
9373
  if (!triggerLView) {
9334
- afterNextRender({ read: pollDomTrigger }, { injector });
9374
+ // Keep polling.
9335
9375
  return;
9336
9376
  }
9377
+ poll.destroy();
9337
9378
  // It's possible that the trigger's view was destroyed before we resolved the trigger element.
9338
9379
  if (isDestroyed(triggerLView)) {
9339
9380
  return;
@@ -9360,7 +9401,7 @@ function registerDomTrigger(initialLView, tNode, triggerIndex, walkUpTimes, regi
9360
9401
  storeTriggerCleanupFn(type, lDetails, cleanup);
9361
9402
  }
9362
9403
  // Begin polling for the trigger.
9363
- afterNextRender({ read: pollDomTrigger }, { injector });
9404
+ poll = afterRender({ read: pollDomTrigger }, { injector });
9364
9405
  }
9365
9406
 
9366
9407
  const DEFER_BLOCK_SSR_ID_ATTRIBUTE = 'ngb';
@@ -11674,7 +11715,7 @@ function detachViewFromDOM(tView, lView) {
11674
11715
  // When we remove a view from the DOM, we need to rerun afterRender hooks
11675
11716
  // We don't necessarily needs to run change detection. DOM removal only requires
11676
11717
  // change detection if animations are enabled (this notification is handled by animations).
11677
- lView[ENVIRONMENT].changeDetectionScheduler?.notify(10 /* NotificationSource.ViewDetachedFromDOM */);
11718
+ lView[ENVIRONMENT].changeDetectionScheduler?.notify(9 /* NotificationSource.ViewDetachedFromDOM */);
11678
11719
  applyView(tView, lView, lView[RENDERER], 2 /* WalkTNodeTreeAction.Detach */, null, null);
11679
11720
  }
11680
11721
  /**
@@ -11858,13 +11899,14 @@ function detachView(lContainer, removeIndex) {
11858
11899
  * @param lView The view to be destroyed.
11859
11900
  */
11860
11901
  function destroyLView(tView, lView) {
11861
- if (!(lView[FLAGS] & 256 /* LViewFlags.Destroyed */)) {
11862
- const renderer = lView[RENDERER];
11863
- if (renderer.destroyNode) {
11864
- applyView(tView, lView, renderer, 3 /* WalkTNodeTreeAction.Destroy */, null, null);
11865
- }
11866
- destroyViewTree(lView);
11902
+ if (isDestroyed(lView)) {
11903
+ return;
11867
11904
  }
11905
+ const renderer = lView[RENDERER];
11906
+ if (renderer.destroyNode) {
11907
+ applyView(tView, lView, renderer, 3 /* WalkTNodeTreeAction.Destroy */, null, null);
11908
+ }
11909
+ destroyViewTree(lView);
11868
11910
  }
11869
11911
  /**
11870
11912
  * Calls onDestroys hooks for all directives and pipes in a given view and then removes all
@@ -11875,7 +11917,7 @@ function destroyLView(tView, lView) {
11875
11917
  * @param lView The LView to clean up
11876
11918
  */
11877
11919
  function cleanUpView(tView, lView) {
11878
- if (lView[FLAGS] & 256 /* LViewFlags.Destroyed */) {
11920
+ if (isDestroyed(lView)) {
11879
11921
  return;
11880
11922
  }
11881
11923
  const prevConsumer = setActiveConsumer$1(null);
@@ -14660,6 +14702,15 @@ function collectNativeNodesInLContainer(lContainer, result) {
14660
14702
  }
14661
14703
  }
14662
14704
 
14705
+ function addAfterRenderSequencesForView(lView) {
14706
+ if (lView[AFTER_RENDER_SEQUENCES_TO_ADD] !== null) {
14707
+ for (const sequence of lView[AFTER_RENDER_SEQUENCES_TO_ADD]) {
14708
+ sequence.impl.addSequence(sequence);
14709
+ }
14710
+ lView[AFTER_RENDER_SEQUENCES_TO_ADD].length = 0;
14711
+ }
14712
+ }
14713
+
14663
14714
  let freeConsumers = [];
14664
14715
  /**
14665
14716
  * Create a new template consumer pointing at the specified LView.
@@ -14861,9 +14912,9 @@ function checkNoChangesInternal(lView, mode, notifyErrorHandler = true) {
14861
14912
  */
14862
14913
  function refreshView(tView, lView, templateFn, context) {
14863
14914
  ngDevMode && assertEqual(isCreationMode(lView), false, 'Should be run in update mode');
14864
- const flags = lView[FLAGS];
14865
- if ((flags & 256 /* LViewFlags.Destroyed */) === 256 /* LViewFlags.Destroyed */)
14915
+ if (isDestroyed(lView))
14866
14916
  return;
14917
+ const flags = lView[FLAGS];
14867
14918
  // Check no changes mode is a dev only mode used to verify that bindings have not changed
14868
14919
  // since they were assigned. We do not want to execute lifecycle hooks in that mode.
14869
14920
  const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode();
@@ -15005,6 +15056,7 @@ function refreshView(tView, lView, templateFn, context) {
15005
15056
  // no changes cycle, the component would be not be dirty for the next update pass. This would
15006
15057
  // be different in production mode where the component dirty state is not reset.
15007
15058
  if (!isInCheckNoChangesPass) {
15059
+ addAfterRenderSequencesForView(lView);
15008
15060
  lView[FLAGS] &= ~(64 /* LViewFlags.Dirty */ | 8 /* LViewFlags.FirstLViewPass */);
15009
15061
  }
15010
15062
  }
@@ -15120,12 +15172,17 @@ function detectChangesInView(lView, mode) {
15120
15172
  refreshView(tView, lView, tView.template, lView[CONTEXT]);
15121
15173
  }
15122
15174
  else if (flags & 8192 /* LViewFlags.HasChildViewsToRefresh */) {
15123
- runEffectsInView(lView);
15175
+ if (!isInCheckNoChangesPass) {
15176
+ runEffectsInView(lView);
15177
+ }
15124
15178
  detectChangesInEmbeddedViews(lView, 1 /* ChangeDetectionMode.Targeted */);
15125
15179
  const components = tView.components;
15126
15180
  if (components !== null) {
15127
15181
  detectChangesInChildComponents(lView, components, 1 /* ChangeDetectionMode.Targeted */);
15128
15182
  }
15183
+ if (!isInCheckNoChangesPass) {
15184
+ addAfterRenderSequencesForView(lView);
15185
+ }
15129
15186
  }
15130
15187
  }
15131
15188
  /** Refreshes child components in the current view (update mode). */
@@ -15229,7 +15286,7 @@ class ViewRef$1 {
15229
15286
  this._lView[CONTEXT] = value;
15230
15287
  }
15231
15288
  get destroyed() {
15232
- return (this._lView[FLAGS] & 256 /* LViewFlags.Destroyed */) === 256 /* LViewFlags.Destroyed */;
15289
+ return isDestroyed(this._lView);
15233
15290
  }
15234
15291
  destroy() {
15235
15292
  if (this._appRef) {
@@ -18110,7 +18167,7 @@ function createRootComponent(componentView, rootComponentDef, rootDirectives, ho
18110
18167
  function setRootNodeAttributes(hostRenderer, componentDef, hostRNode, rootSelectorOrNode) {
18111
18168
  if (rootSelectorOrNode) {
18112
18169
  // The placeholder will be replaced with the actual version at build time.
18113
- setUpAttributes(hostRenderer, hostRNode, ['ng-version', '19.1.0-next.4']);
18170
+ setUpAttributes(hostRenderer, hostRNode, ['ng-version', '19.1.0-rc.0']);
18114
18171
  }
18115
18172
  else {
18116
18173
  // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
@@ -19709,7 +19766,6 @@ class NgModuleRef extends NgModuleRef$1 {
19709
19766
  _parent;
19710
19767
  // tslint:disable-next-line:require-internal-with-underscore
19711
19768
  _bootstrapComponents = [];
19712
- // tslint:disable-next-line:require-internal-with-underscore
19713
19769
  _r3Injector;
19714
19770
  instance;
19715
19771
  destroyCbs = [];
@@ -21197,7 +21253,8 @@ class CachedInjectorService {
21197
21253
  *
21198
21254
  * This token is only injected in devMode
21199
21255
  */
21200
- const DEFER_BLOCK_DEPENDENCY_INTERCEPTOR = new InjectionToken('DEFER_BLOCK_DEPENDENCY_INTERCEPTOR');
21256
+ const DEFER_BLOCK_DEPENDENCY_INTERCEPTOR =
21257
+ /* @__PURE__ */ new InjectionToken('DEFER_BLOCK_DEPENDENCY_INTERCEPTOR');
21201
21258
  /**
21202
21259
  * **INTERNAL**, token used for configuring defer block behavior.
21203
21260
  */
@@ -21589,7 +21646,6 @@ class Console {
21589
21646
  }
21590
21647
  // Note: for reporting errors use `DOM.logError()` as it is platform specific
21591
21648
  warn(message) {
21592
- // tslint:disable-next-line:no-console
21593
21649
  console.warn(message);
21594
21650
  }
21595
21651
  static ɵfac = function Console_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Console)(); };
@@ -23046,6 +23102,77 @@ function isSubscribable(obj) {
23046
23102
  return !!obj && typeof obj.subscribe === 'function';
23047
23103
  }
23048
23104
 
23105
+ /**
23106
+ * A scheduler which manages the execution of effects.
23107
+ */
23108
+ class EffectScheduler {
23109
+ /** @nocollapse */
23110
+ static ɵprov = /** @pureOrBreakMyCode */ /* @__PURE__ */ ɵɵdefineInjectable({
23111
+ token: EffectScheduler,
23112
+ providedIn: 'root',
23113
+ factory: () => new ZoneAwareEffectScheduler(),
23114
+ });
23115
+ }
23116
+ /**
23117
+ * A wrapper around `ZoneAwareQueueingScheduler` that schedules flushing via the microtask queue
23118
+ * when.
23119
+ */
23120
+ class ZoneAwareEffectScheduler {
23121
+ queuedEffectCount = 0;
23122
+ queues = new Map();
23123
+ schedule(handle) {
23124
+ this.enqueue(handle);
23125
+ }
23126
+ remove(handle) {
23127
+ const zone = handle.zone;
23128
+ const queue = this.queues.get(zone);
23129
+ if (!queue.has(handle)) {
23130
+ return;
23131
+ }
23132
+ queue.delete(handle);
23133
+ this.queuedEffectCount--;
23134
+ }
23135
+ enqueue(handle) {
23136
+ const zone = handle.zone;
23137
+ if (!this.queues.has(zone)) {
23138
+ this.queues.set(zone, new Set());
23139
+ }
23140
+ const queue = this.queues.get(zone);
23141
+ if (queue.has(handle)) {
23142
+ return;
23143
+ }
23144
+ this.queuedEffectCount++;
23145
+ queue.add(handle);
23146
+ }
23147
+ /**
23148
+ * Run all scheduled effects.
23149
+ *
23150
+ * Execution order of effects within the same zone is guaranteed to be FIFO, but there is no
23151
+ * ordering guarantee between effects scheduled in different zones.
23152
+ */
23153
+ flush() {
23154
+ while (this.queuedEffectCount > 0) {
23155
+ for (const [zone, queue] of this.queues) {
23156
+ // `zone` here must be defined.
23157
+ if (zone === null) {
23158
+ this.flushQueue(queue);
23159
+ }
23160
+ else {
23161
+ zone.run(() => this.flushQueue(queue));
23162
+ }
23163
+ }
23164
+ }
23165
+ }
23166
+ flushQueue(queue) {
23167
+ for (const handle of queue) {
23168
+ queue.delete(handle);
23169
+ this.queuedEffectCount--;
23170
+ // TODO: what happens if this throws an error?
23171
+ handle.run();
23172
+ }
23173
+ }
23174
+ }
23175
+
23049
23176
  /**
23050
23177
  * A DI token that you can use to provide
23051
23178
  * one or more initialization functions.
@@ -23290,68 +23417,6 @@ class ApplicationInitStatus {
23290
23417
  args: [{ providedIn: 'root' }]
23291
23418
  }], () => [], null); })();
23292
23419
 
23293
- /**
23294
- * A scheduler which manages the execution of effects.
23295
- */
23296
- class EffectScheduler {
23297
- /** @nocollapse */
23298
- static ɵprov = /** @pureOrBreakMyCode */ /* @__PURE__ */ ɵɵdefineInjectable({
23299
- token: EffectScheduler,
23300
- providedIn: 'root',
23301
- factory: () => new ZoneAwareEffectScheduler(),
23302
- });
23303
- }
23304
- /**
23305
- * A wrapper around `ZoneAwareQueueingScheduler` that schedules flushing via the microtask queue
23306
- * when.
23307
- */
23308
- class ZoneAwareEffectScheduler {
23309
- queuedEffectCount = 0;
23310
- queues = new Map();
23311
- schedule(handle) {
23312
- this.enqueue(handle);
23313
- }
23314
- enqueue(handle) {
23315
- const zone = handle.zone;
23316
- if (!this.queues.has(zone)) {
23317
- this.queues.set(zone, new Set());
23318
- }
23319
- const queue = this.queues.get(zone);
23320
- if (queue.has(handle)) {
23321
- return;
23322
- }
23323
- this.queuedEffectCount++;
23324
- queue.add(handle);
23325
- }
23326
- /**
23327
- * Run all scheduled effects.
23328
- *
23329
- * Execution order of effects within the same zone is guaranteed to be FIFO, but there is no
23330
- * ordering guarantee between effects scheduled in different zones.
23331
- */
23332
- flush() {
23333
- while (this.queuedEffectCount > 0) {
23334
- for (const [zone, queue] of this.queues) {
23335
- // `zone` here must be defined.
23336
- if (zone === null) {
23337
- this.flushQueue(queue);
23338
- }
23339
- else {
23340
- zone.run(() => this.flushQueue(queue));
23341
- }
23342
- }
23343
- }
23344
- }
23345
- flushQueue(queue) {
23346
- for (const handle of queue) {
23347
- queue.delete(handle);
23348
- this.queuedEffectCount--;
23349
- // TODO: what happens if this throws an error?
23350
- handle.run();
23351
- }
23352
- }
23353
- }
23354
-
23355
23420
  /**
23356
23421
  * A DI token that provides a set of callbacks to
23357
23422
  * be called for every component that is bootstrapped.
@@ -23529,12 +23594,6 @@ class ApplicationRef {
23529
23594
  * @internal
23530
23595
  */
23531
23596
  dirtyFlags = 0 /* ApplicationRefDirtyFlags.None */;
23532
- /**
23533
- * Like `dirtyFlags` but don't cause `tick()` to loop.
23534
- *
23535
- * @internal
23536
- */
23537
- deferredDirtyFlags = 0 /* ApplicationRefDirtyFlags.None */;
23538
23597
  /**
23539
23598
  * Most recent snapshot from the `TracingService`, if any.
23540
23599
  *
@@ -23639,7 +23698,7 @@ class ApplicationRef {
23639
23698
  * {@example core/ts/platform/platform.ts region='domNode'}
23640
23699
  */
23641
23700
  bootstrap(componentOrFactory, rootSelectorOrNode) {
23642
- (typeof ngDevMode === 'undefined' || ngDevMode) && this.warnIfDestroyed();
23701
+ (typeof ngDevMode === 'undefined' || ngDevMode) && warnIfDestroyed(this._destroyed);
23643
23702
  const isComponentFactory = componentOrFactory instanceof ComponentFactory$1;
23644
23703
  const initStatus = this._injector.get(ApplicationInitStatus);
23645
23704
  if (!initStatus.done) {
@@ -23709,7 +23768,7 @@ class ApplicationRef {
23709
23768
  snapshot.dispose();
23710
23769
  return;
23711
23770
  }
23712
- (typeof ngDevMode === 'undefined' || ngDevMode) && this.warnIfDestroyed();
23771
+ (typeof ngDevMode === 'undefined' || ngDevMode) && warnIfDestroyed(this._destroyed);
23713
23772
  if (this._runningTick) {
23714
23773
  throw new RuntimeError(101 /* RuntimeErrorCode.RECURSIVE_APPLICATION_REF_TICK */, ngDevMode && 'ApplicationRef.tick is called recursively');
23715
23774
  }
@@ -23741,9 +23800,6 @@ class ApplicationRef {
23741
23800
  if (this._rendererFactory === null && !this._injector.destroyed) {
23742
23801
  this._rendererFactory = this._injector.get(RendererFactory2, null, { optional: true });
23743
23802
  }
23744
- // When beginning synchronization, all deferred dirtiness becomes active dirtiness.
23745
- this.dirtyFlags |= this.deferredDirtyFlags;
23746
- this.deferredDirtyFlags = 0 /* ApplicationRefDirtyFlags.None */;
23747
23803
  let runs = 0;
23748
23804
  while (this.dirtyFlags !== 0 /* ApplicationRefDirtyFlags.None */ && runs++ < MAXIMUM_REFRESH_RERUNS) {
23749
23805
  this.synchronizeOnce();
@@ -23759,9 +23815,6 @@ class ApplicationRef {
23759
23815
  * Perform a single synchronization pass.
23760
23816
  */
23761
23817
  synchronizeOnce() {
23762
- // If we happened to loop, deferred dirtiness can be processed as active dirtiness again.
23763
- this.dirtyFlags |= this.deferredDirtyFlags;
23764
- this.deferredDirtyFlags = 0 /* ApplicationRefDirtyFlags.None */;
23765
23818
  // First, process any dirty root effects.
23766
23819
  if (this.dirtyFlags & 16 /* ApplicationRefDirtyFlags.RootEffects */) {
23767
23820
  this.dirtyFlags &= ~16 /* ApplicationRefDirtyFlags.RootEffects */;
@@ -23840,7 +23893,7 @@ class ApplicationRef {
23840
23893
  * This will throw if the view is already attached to a ViewContainer.
23841
23894
  */
23842
23895
  attachView(viewRef) {
23843
- (typeof ngDevMode === 'undefined' || ngDevMode) && this.warnIfDestroyed();
23896
+ (typeof ngDevMode === 'undefined' || ngDevMode) && warnIfDestroyed(this._destroyed);
23844
23897
  const view = viewRef;
23845
23898
  this._views.push(view);
23846
23899
  view.attachToAppRef(this);
@@ -23849,7 +23902,7 @@ class ApplicationRef {
23849
23902
  * Detaches a view from dirty checking again.
23850
23903
  */
23851
23904
  detachView(viewRef) {
23852
- (typeof ngDevMode === 'undefined' || ngDevMode) && this.warnIfDestroyed();
23905
+ (typeof ngDevMode === 'undefined' || ngDevMode) && warnIfDestroyed(this._destroyed);
23853
23906
  const view = viewRef;
23854
23907
  remove(this._views, view);
23855
23908
  view.detachFromAppRef();
@@ -23893,7 +23946,7 @@ class ApplicationRef {
23893
23946
  * @returns A function which unregisters a listener.
23894
23947
  */
23895
23948
  onDestroy(callback) {
23896
- (typeof ngDevMode === 'undefined' || ngDevMode) && this.warnIfDestroyed();
23949
+ (typeof ngDevMode === 'undefined' || ngDevMode) && warnIfDestroyed(this._destroyed);
23897
23950
  this._destroyListeners.push(callback);
23898
23951
  return () => remove(this._destroyListeners, callback);
23899
23952
  }
@@ -23920,11 +23973,6 @@ class ApplicationRef {
23920
23973
  get viewCount() {
23921
23974
  return this._views.length;
23922
23975
  }
23923
- warnIfDestroyed() {
23924
- if ((typeof ngDevMode === 'undefined' || ngDevMode) && this._destroyed) {
23925
- console.warn(formatRuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, 'This instance of the `ApplicationRef` has already been destroyed.'));
23926
- }
23927
- }
23928
23976
  static ɵfac = function ApplicationRef_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ApplicationRef)(); };
23929
23977
  static ɵprov = /*@__PURE__*/ ɵɵdefineInjectable({ token: ApplicationRef, factory: ApplicationRef.ɵfac, providedIn: 'root' });
23930
23978
  }
@@ -23932,6 +23980,11 @@ class ApplicationRef {
23932
23980
  type: Injectable,
23933
23981
  args: [{ providedIn: 'root' }]
23934
23982
  }], () => [], null); })();
23983
+ function warnIfDestroyed(destroyed) {
23984
+ if (destroyed) {
23985
+ console.warn(formatRuntimeError(406 /* RuntimeErrorCode.APPLICATION_REF_ALREADY_DESTROYED */, 'This instance of the `ApplicationRef` has already been destroyed.'));
23986
+ }
23987
+ }
23935
23988
  function remove(list, el) {
23936
23989
  const index = list.indexOf(el);
23937
23990
  if (index > -1) {
@@ -24092,7 +24145,7 @@ function triggerResourceLoading(tDetails, lView, tNode) {
24092
24145
  tDetails.loadingState = DeferDependenciesLoadingState.FAILED;
24093
24146
  if (tDetails.errorTmplIndex === null) {
24094
24147
  const templateLocation = ngDevMode ? getTemplateLocationDetails(lView) : '';
24095
- const error = new RuntimeError(750 /* RuntimeErrorCode.DEFER_LOADING_FAILED */, ngDevMode &&
24148
+ const error = new RuntimeError(-750 /* RuntimeErrorCode.DEFER_LOADING_FAILED */, ngDevMode &&
24096
24149
  'Loading dependencies for `@defer` block failed, ' +
24097
24150
  `but no \`@error\` block was configured${templateLocation}. ` +
24098
24151
  'Consider using the `@error` block to render an error state.');
@@ -27677,7 +27730,6 @@ function reconcile(liveCollection, newCollection, trackByFn) {
27677
27730
  'Duplicated keys were: \n' +
27678
27731
  duplicatedKeysMsg.join(', \n') +
27679
27732
  '.');
27680
- // tslint:disable-next-line:no-console
27681
27733
  console.warn(message);
27682
27734
  }
27683
27735
  }
@@ -28505,10 +28557,8 @@ if (typeof ngI18nClosureMode === 'undefined') {
28505
28557
  // Make sure to refer to ngI18nClosureMode as ['ngI18nClosureMode'] for closure.
28506
28558
  // NOTE: we need to have it in IIFE so that the tree-shaker is happy.
28507
28559
  (function () {
28508
- // tslint:disable-next-line:no-toplevel-property-access
28509
28560
  _global['ngI18nClosureMode'] =
28510
28561
  // TODO(FW-1250): validate that this actually, you know, works.
28511
- // tslint:disable-next-line:no-toplevel-property-access
28512
28562
  typeof goog !== 'undefined' && typeof goog.getMsg === 'function';
28513
28563
  })();
28514
28564
  }
@@ -33509,8 +33559,9 @@ function recreateMatchingLViews(def, rootLView) {
33509
33559
  */
33510
33560
  function clearRendererCache(factory, def) {
33511
33561
  // Cast to read a private field.
33512
- // NOTE: This must be kept synchronized with the renderer factory implementation in platform-browser.
33513
- factory.rendererByCompId?.delete(def.id);
33562
+ // NOTE: This must be kept synchronized with the renderer factory implementation in
33563
+ // platform-browser and platform-browser/animations.
33564
+ factory.componentReplaced?.(def.id);
33514
33565
  }
33515
33566
  /**
33516
33567
  * Recreates an LView in-place from a new component definition.
@@ -34976,7 +35027,7 @@ class Version {
34976
35027
  /**
34977
35028
  * @publicApi
34978
35029
  */
34979
- const VERSION = new Version('19.1.0-next.4');
35030
+ const VERSION = new Version('19.1.0-rc.0');
34980
35031
 
34981
35032
  /**
34982
35033
  * Combination of NgModuleFactory and ComponentFactories.
@@ -35386,13 +35437,6 @@ class ChangeDetectionSchedulerImpl {
35386
35437
  this.appRef.dirtyFlags |= 4 /* ApplicationRefDirtyFlags.ViewTreeCheck */;
35387
35438
  break;
35388
35439
  }
35389
- case 8 /* NotificationSource.DeferredRenderHook */: {
35390
- // Render hooks are "deferred" when they're triggered from other render hooks. Using the
35391
- // deferred dirty flags ensures that adding new hooks doesn't automatically trigger a loop
35392
- // inside tick().
35393
- this.appRef.deferredDirtyFlags |= 8 /* ApplicationRefDirtyFlags.AfterRender */;
35394
- break;
35395
- }
35396
35440
  case 6 /* NotificationSource.CustomElement */: {
35397
35441
  // We use `ViewTreeTraversal` to ensure we refresh the element even if this is triggered
35398
35442
  // during CD. In practice this is a no-op since the elements code also calls via a
@@ -35401,7 +35445,7 @@ class ChangeDetectionSchedulerImpl {
35401
35445
  force = true;
35402
35446
  break;
35403
35447
  }
35404
- case 13 /* NotificationSource.RootEffect */: {
35448
+ case 12 /* NotificationSource.RootEffect */: {
35405
35449
  this.appRef.dirtyFlags |= 16 /* ApplicationRefDirtyFlags.RootEffects */;
35406
35450
  // Root effects still force a CD, even if the scheduler is disabled. This ensures that
35407
35451
  // effects always run, even when triggered from outside the zone when the scheduler is
@@ -35409,7 +35453,7 @@ class ChangeDetectionSchedulerImpl {
35409
35453
  force = true;
35410
35454
  break;
35411
35455
  }
35412
- case 14 /* NotificationSource.ViewEffect */: {
35456
+ case 13 /* NotificationSource.ViewEffect */: {
35413
35457
  // This is technically a no-op, since view effects will also send a
35414
35458
  // `MarkAncestorsForTraversal` notification. Still, we set this for logical consistency.
35415
35459
  this.appRef.dirtyFlags |= 2 /* ApplicationRefDirtyFlags.ViewTreeTraversal */;
@@ -35419,7 +35463,7 @@ class ChangeDetectionSchedulerImpl {
35419
35463
  force = true;
35420
35464
  break;
35421
35465
  }
35422
- case 12 /* NotificationSource.PendingTaskRemoved */: {
35466
+ case 11 /* NotificationSource.PendingTaskRemoved */: {
35423
35467
  // Removing a pending task via the public API forces a scheduled tick, ensuring that
35424
35468
  // stability is async and delayed until there was at least an opportunity to run
35425
35469
  // application synchronization. This prevents some footguns when working with the
@@ -35428,10 +35472,10 @@ class ChangeDetectionSchedulerImpl {
35428
35472
  force = true;
35429
35473
  break;
35430
35474
  }
35431
- case 10 /* NotificationSource.ViewDetachedFromDOM */:
35432
- case 9 /* NotificationSource.ViewAttached */:
35475
+ case 9 /* NotificationSource.ViewDetachedFromDOM */:
35476
+ case 8 /* NotificationSource.ViewAttached */:
35433
35477
  case 7 /* NotificationSource.RenderHook */:
35434
- case 11 /* NotificationSource.AsyncAnimationsLoaded */:
35478
+ case 10 /* NotificationSource.AsyncAnimationsLoaded */:
35435
35479
  default: {
35436
35480
  // These notifications only schedule a tick but do not change whether we should refresh
35437
35481
  // views. Instead, we only need to run render hooks unless another notification from the
@@ -40027,7 +40071,6 @@ function withDomHydration() {
40027
40071
  'thus hydration was not enabled. ' +
40028
40072
  'Make sure the `provideClientHydration()` is included into the list ' +
40029
40073
  'of providers in the server part of the application configuration.');
40030
- // tslint:disable-next-line:no-console
40031
40074
  console.warn(message);
40032
40075
  }
40033
40076
  },
@@ -40598,23 +40641,6 @@ function untracked(nonReactiveReadsFn) {
40598
40641
  }
40599
40642
  }
40600
40643
 
40601
- class ViewContext {
40602
- view;
40603
- node;
40604
- constructor(view, node) {
40605
- this.view = view;
40606
- this.node = node;
40607
- }
40608
- /**
40609
- * @internal
40610
- * @nocollapse
40611
- */
40612
- static __NG_ELEMENT_ID__ = injectViewContext;
40613
- }
40614
- function injectViewContext() {
40615
- return new ViewContext(getLView(), getCurrentTNode());
40616
- }
40617
-
40618
40644
  /**
40619
40645
  * Controls whether effects use the legacy `microtaskEffect` by default.
40620
40646
  */
@@ -40882,12 +40908,13 @@ const ROOT_EFFECT_NODE =
40882
40908
  ...BASE_EFFECT_NODE,
40883
40909
  consumerMarkedDirty() {
40884
40910
  this.scheduler.schedule(this);
40885
- this.notifier.notify(13 /* NotificationSource.RootEffect */);
40911
+ this.notifier.notify(12 /* NotificationSource.RootEffect */);
40886
40912
  },
40887
40913
  destroy() {
40888
40914
  consumerDestroy$1(this);
40889
40915
  this.onDestroyFn();
40890
40916
  this.maybeCleanup();
40917
+ this.scheduler.remove(this);
40891
40918
  },
40892
40919
  }))();
40893
40920
  const VIEW_EFFECT_NODE =
@@ -40896,7 +40923,7 @@ const VIEW_EFFECT_NODE =
40896
40923
  consumerMarkedDirty() {
40897
40924
  this.view[FLAGS] |= 8192 /* LViewFlags.HasChildViewsToRefresh */;
40898
40925
  markAncestorsForTraversal(this.view);
40899
- this.notifier.notify(14 /* NotificationSource.ViewEffect */);
40926
+ this.notifier.notify(13 /* NotificationSource.ViewEffect */);
40900
40927
  },
40901
40928
  destroy() {
40902
40929
  consumerDestroy$1(this);
@@ -40923,7 +40950,7 @@ function createRootEffect(fn, scheduler, notifier) {
40923
40950
  node.notifier = notifier;
40924
40951
  node.zone = typeof Zone !== 'undefined' ? Zone.current : null;
40925
40952
  node.scheduler.schedule(node);
40926
- node.notifier.notify(13 /* NotificationSource.RootEffect */);
40953
+ node.notifier.notify(12 /* NotificationSource.RootEffect */);
40927
40954
  return node;
40928
40955
  }
40929
40956
 
@@ -41014,10 +41041,10 @@ class AfterRenderEffectSequence extends AfterRenderSequence {
41014
41041
  * These are initialized to `undefined` but set in the constructor.
41015
41042
  */
41016
41043
  nodes = [undefined, undefined, undefined, undefined];
41017
- constructor(impl, effectHooks, scheduler, destroyRef, snapshot = null) {
41044
+ constructor(impl, effectHooks, view, scheduler, destroyRef, snapshot = null) {
41018
41045
  // Note that we also initialize the underlying `AfterRenderSequence` hooks to `undefined` and
41019
41046
  // populate them as we create reactive nodes below.
41020
- super(impl, [undefined, undefined, undefined, undefined], false, destroyRef, snapshot);
41047
+ super(impl, [undefined, undefined, undefined, undefined], view, false, destroyRef, snapshot);
41021
41048
  this.scheduler = scheduler;
41022
41049
  // Setup a reactive node for each phase.
41023
41050
  for (const phase of AFTER_RENDER_PHASES) {
@@ -41076,7 +41103,8 @@ function afterRenderEffect(callbackOrSpec, options) {
41076
41103
  if (typeof spec === 'function') {
41077
41104
  spec = { mixedReadWrite: callbackOrSpec };
41078
41105
  }
41079
- const sequence = new AfterRenderEffectSequence(manager.impl, [spec.earlyRead, spec.write, spec.mixedReadWrite, spec.read], scheduler, injector.get(DestroyRef), tracing?.snapshot(null));
41106
+ const viewContext = injector.get(ViewContext, null, { optional: true });
41107
+ const sequence = new AfterRenderEffectSequence(manager.impl, [spec.earlyRead, spec.write, spec.mixedReadWrite, spec.read], viewContext?.view, scheduler, injector.get(DestroyRef), tracing?.snapshot(null));
41080
41108
  manager.impl.register(sequence);
41081
41109
  return sequence;
41082
41110
  }