@angular/core 19.1.0-rc.0 → 19.1.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 (36) hide show
  1. package/fesm2022/core.mjs +177 -211
  2. package/fesm2022/core.mjs.map +1 -1
  3. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  4. package/fesm2022/primitives/signals.mjs +1 -1
  5. package/fesm2022/rxjs-interop.mjs +1 -1
  6. package/fesm2022/rxjs-interop.mjs.map +1 -1
  7. package/fesm2022/testing.mjs +5 -5
  8. package/index.d.ts +45 -46
  9. package/package.json +1 -1
  10. package/primitives/event-dispatch/index.d.ts +1 -1
  11. package/primitives/signals/index.d.ts +1 -1
  12. package/rxjs-interop/index.d.ts +1 -1
  13. package/schematics/bundles/{apply_import_manager-6508401d.js → apply_import_manager-5082ccea.js} +3 -3
  14. package/schematics/bundles/{checker-24b68d23.js → checker-aa999c96.js} +20 -19
  15. package/schematics/bundles/cleanup-unused-imports.js +7 -7
  16. package/schematics/bundles/{compiler_host-5f693799.js → compiler_host-f0b570c8.js} +2 -2
  17. package/schematics/bundles/control-flow-migration.js +3 -3
  18. package/schematics/bundles/explicit-standalone-flag.js +5 -5
  19. package/schematics/bundles/{imports-abe29092.js → imports-31a38653.js} +1 -1
  20. package/schematics/bundles/{index-b1033cf0.js → index-02a11f43.js} +4 -4
  21. package/schematics/bundles/{index-767e341d.js → index-15b61bae.js} +4 -4
  22. package/schematics/bundles/inject-migration.js +6 -6
  23. package/schematics/bundles/{leading_space-d190b83b.js → leading_space-6e7a8ec6.js} +1 -1
  24. package/schematics/bundles/{migrate_ts_type_references-bc7d8784.js → migrate_ts_type_references-042ca765.js} +6 -6
  25. package/schematics/bundles/{nodes-a9f0b985.js → nodes-88c2157f.js} +2 -2
  26. package/schematics/bundles/output-migration.js +6 -6
  27. package/schematics/bundles/pending-tasks.js +5 -5
  28. package/schematics/bundles/{program-c810a4c2.js → program-393ca8f3.js} +40 -21
  29. package/schematics/bundles/{project_tsconfig_paths-e9ccccbf.js → project_tsconfig_paths-6c9cde78.js} +1 -1
  30. package/schematics/bundles/provide-initializer.js +5 -5
  31. package/schematics/bundles/route-lazy-loading.js +4 -4
  32. package/schematics/bundles/signal-input-migration.js +8 -8
  33. package/schematics/bundles/signal-queries-migration.js +14 -8
  34. package/schematics/bundles/signals.js +8 -8
  35. package/schematics/bundles/standalone-migration.js +8 -8
  36. package/testing/index.d.ts +1 -1
package/fesm2022/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v19.1.0-rc.0
2
+ * @license Angular v19.1.0
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -2902,7 +2902,6 @@ const ON_DESTROY_HOOKS = 21;
2902
2902
  const EFFECTS_TO_SCHEDULE = 22;
2903
2903
  const EFFECTS = 23;
2904
2904
  const REACTIVE_TEMPLATE_CONSUMER = 24;
2905
- const AFTER_RENDER_SEQUENCES_TO_ADD = 25;
2906
2905
  /**
2907
2906
  * Size of LView's header. Necessary to adjust for it when setting slots.
2908
2907
  *
@@ -2910,7 +2909,7 @@ const AFTER_RENDER_SEQUENCES_TO_ADD = 25;
2910
2909
  * instruction index into `LView` index. All other indexes should be in the `LView` index space and
2911
2910
  * there should be no need to refer to `HEADER_OFFSET` anywhere else.
2912
2911
  */
2913
- const HEADER_OFFSET = 26;
2912
+ const HEADER_OFFSET = 25;
2914
2913
 
2915
2914
  /**
2916
2915
  * Special location which allows easy identification of type. If we have an array which was
@@ -2936,18 +2935,6 @@ const MOVED_VIEWS = 9;
2936
2935
  * remove views from the DOM when they are no longer required.
2937
2936
  */
2938
2937
  const CONTAINER_HEADER_OFFSET = 10;
2939
- /** Flags associated with an LContainer (saved in LContainer[FLAGS]) */
2940
- var LContainerFlags;
2941
- (function (LContainerFlags) {
2942
- LContainerFlags[LContainerFlags["None"] = 0] = "None";
2943
- /**
2944
- * Flag to signify that this `LContainer` may have transplanted views which need to be change
2945
- * detected. (see: `LView[DECLARATION_COMPONENT_VIEW])`.
2946
- *
2947
- * This flag, once set, is never unset for the `LContainer`.
2948
- */
2949
- LContainerFlags[LContainerFlags["HasTransplantedViews"] = 2] = "HasTransplantedViews";
2950
- })(LContainerFlags || (LContainerFlags = {}));
2951
2938
 
2952
2939
  /**
2953
2940
  * True if `value` is `LView`.
@@ -3431,7 +3418,7 @@ function requiresRefreshOrTraversal(lView) {
3431
3418
  * parents above.
3432
3419
  */
3433
3420
  function updateAncestorTraversalFlagsOnAttach(lView) {
3434
- lView[ENVIRONMENT].changeDetectionScheduler?.notify(8 /* NotificationSource.ViewAttached */);
3421
+ lView[ENVIRONMENT].changeDetectionScheduler?.notify(9 /* NotificationSource.ViewAttached */);
3435
3422
  if (lView[FLAGS] & 64 /* LViewFlags.Dirty */) {
3436
3423
  lView[FLAGS] |= 1024 /* LViewFlags.RefreshView */;
3437
3424
  }
@@ -4411,7 +4398,7 @@ class NodeInjectorFactory {
4411
4398
  * Example:
4412
4399
  *
4413
4400
  * If we have a component and directive active an a single element as declared here
4414
- * ```
4401
+ * ```ts
4415
4402
  * component:
4416
4403
  * providers: [ {provide: String, useValue: 'component', multi: true} ],
4417
4404
  * viewProviders: [ {provide: String, useValue: 'componentView', multi: true} ],
@@ -4422,7 +4409,7 @@ class NodeInjectorFactory {
4422
4409
  *
4423
4410
  * Then the expected results are:
4424
4411
  *
4425
- * ```
4412
+ * ```ts
4426
4413
  * providers: ['component', 'directive']
4427
4414
  * viewProviders: ['component', 'componentView', 'directive']
4428
4415
  * ```
@@ -4445,7 +4432,7 @@ class NodeInjectorFactory {
4445
4432
  * Example:
4446
4433
  *
4447
4434
  * Given:
4448
- * ```
4435
+ * ```ts
4449
4436
  * providers: [ {provide: String, useValue: 'all', multi: true} ],
4450
4437
  * viewProviders: [ {provide: String, useValue: 'viewOnly', multi: true} ],
4451
4438
  * ```
@@ -6140,14 +6127,14 @@ class PendingTasks {
6140
6127
  return;
6141
6128
  }
6142
6129
  // Notifying the scheduler will hold application stability open until the next tick.
6143
- this.scheduler.notify(11 /* NotificationSource.PendingTaskRemoved */);
6130
+ this.scheduler.notify(12 /* NotificationSource.PendingTaskRemoved */);
6144
6131
  this.internalPendingTasks.remove(taskId);
6145
6132
  };
6146
6133
  }
6147
6134
  /**
6148
6135
  * Runs an asynchronous function and blocks the application's stability until the function completes.
6149
6136
  *
6150
- * ```
6137
+ * ```ts
6151
6138
  * pendingTasks.run(async () => {
6152
6139
  * const userData = await fetch('/api/user');
6153
6140
  * this.userData.set(userData);
@@ -6157,7 +6144,7 @@ class PendingTasks {
6157
6144
  * Application stability is at least delayed until the next tick after the `run` method resolves
6158
6145
  * so it is safe to make additional updates to application state that would require UI synchronization:
6159
6146
  *
6160
- * ```
6147
+ * ```ts
6161
6148
  * const userData = await pendingTasks.run(() => fetch('/api/user'));
6162
6149
  * this.userData.set(userData);
6163
6150
  * ```
@@ -8476,15 +8463,8 @@ function retrieveTransferredState(doc, appId) {
8476
8463
  const REFERENCE_NODE_HOST = 'h';
8477
8464
  /** Encodes that the node lookup should start from the document body node. */
8478
8465
  const REFERENCE_NODE_BODY = 'b';
8479
- /**
8480
- * Describes navigation steps that the runtime logic need to perform,
8481
- * starting from a given (known) element.
8482
- */
8483
- var NodeNavigationStep;
8484
- (function (NodeNavigationStep) {
8485
- NodeNavigationStep["FirstChild"] = "f";
8486
- NodeNavigationStep["NextSibling"] = "n";
8487
- })(NodeNavigationStep || (NodeNavigationStep = {}));
8466
+ const NODE_NAVIGATION_STEP_FIRST_CHILD = 'f';
8467
+ const NODE_NAVIGATION_STEP_NEXT_SIBLING = 'n';
8488
8468
  /**
8489
8469
  * Keys within serialized view data structure to represent various
8490
8470
  * parts. See the `SerializedView` interface below for additional information.
@@ -8589,23 +8569,6 @@ function assertNotInReactiveContext(debugFn, extraContext) {
8589
8569
  }
8590
8570
  }
8591
8571
 
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
-
8609
8572
  /**
8610
8573
  * The phase to run an `afterRender` or `afterNextRender` callback in.
8611
8574
  *
@@ -8736,32 +8699,21 @@ class AfterRenderImpl {
8736
8699
  this.sequences.add(sequence);
8737
8700
  }
8738
8701
  if (this.deferredRegistrations.size > 0) {
8739
- this.scheduler.notify(7 /* NotificationSource.RenderHook */);
8702
+ this.scheduler.notify(8 /* NotificationSource.DeferredRenderHook */);
8740
8703
  }
8741
8704
  this.deferredRegistrations.clear();
8742
8705
  }
8743
8706
  register(sequence) {
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);
8707
+ if (!this.executing) {
8708
+ this.sequences.add(sequence);
8709
+ // Trigger an `ApplicationRef.tick()` if one is not already pending/running, because we have a
8710
+ // new render hook that needs to run.
8711
+ this.scheduler.notify(7 /* NotificationSource.RenderHook */);
8754
8712
  }
8755
8713
  else {
8756
8714
  this.deferredRegistrations.add(sequence);
8757
8715
  }
8758
8716
  }
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
- }
8765
8717
  unregister(sequence) {
8766
8718
  if (this.executing && this.sequences.has(sequence)) {
8767
8719
  // We can't remove an `AfterRenderSequence` in the middle of iteration.
@@ -8791,7 +8743,6 @@ class AfterRenderImpl {
8791
8743
  class AfterRenderSequence {
8792
8744
  impl;
8793
8745
  hooks;
8794
- view;
8795
8746
  once;
8796
8747
  snapshot;
8797
8748
  /**
@@ -8805,10 +8756,9 @@ class AfterRenderSequence {
8805
8756
  */
8806
8757
  pipelinedValue = undefined;
8807
8758
  unregisterOnDestroy;
8808
- constructor(impl, hooks, view, once, destroyRef, snapshot = null) {
8759
+ constructor(impl, hooks, once, destroyRef, snapshot = null) {
8809
8760
  this.impl = impl;
8810
8761
  this.hooks = hooks;
8811
- this.view = view;
8812
8762
  this.once = once;
8813
8763
  this.snapshot = snapshot;
8814
8764
  this.unregisterOnDestroy = destroyRef?.onDestroy(() => this.destroy());
@@ -8826,10 +8776,6 @@ class AfterRenderSequence {
8826
8776
  destroy() {
8827
8777
  this.impl.unregister(this);
8828
8778
  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
- }
8833
8779
  }
8834
8780
  }
8835
8781
 
@@ -8880,8 +8826,7 @@ function afterRenderImpl(callbackOrSpec, injector, options, once) {
8880
8826
  const tracing = injector.get(TracingService, null, { optional: true });
8881
8827
  const hooks = options?.phase ?? AfterRenderPhase.MixedReadWrite;
8882
8828
  const destroyRef = options?.manualCleanup !== true ? injector.get(DestroyRef) : 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));
8829
+ const sequence = new AfterRenderSequence(manager.impl, getHooks(callbackOrSpec, hooks), once, destroyRef, tracing?.snapshot(null));
8885
8830
  manager.impl.register(sequence);
8886
8831
  return sequence;
8887
8832
  }
@@ -9353,11 +9298,9 @@ function getTriggerElement(triggerLView, triggerIndex) {
9353
9298
  function registerDomTrigger(initialLView, tNode, triggerIndex, walkUpTimes, registerFn, callback, type) {
9354
9299
  const injector = initialLView[INJECTOR];
9355
9300
  const zone = injector.get(NgZone);
9356
- let poll;
9357
9301
  function pollDomTrigger() {
9358
9302
  // If the initial view was destroyed, we don't need to do anything.
9359
9303
  if (isDestroyed(initialLView)) {
9360
- poll.destroy();
9361
9304
  return;
9362
9305
  }
9363
9306
  const lDetails = getLDeferBlockDetails(initialLView, tNode);
@@ -9365,16 +9308,14 @@ function registerDomTrigger(initialLView, tNode, triggerIndex, walkUpTimes, regi
9365
9308
  // If the block was loaded before the trigger was resolved, we don't need to do anything.
9366
9309
  if (renderedState !== DeferBlockInternalState.Initial &&
9367
9310
  renderedState !== DeferBlockState.Placeholder) {
9368
- poll.destroy();
9369
9311
  return;
9370
9312
  }
9371
9313
  const triggerLView = getTriggerLView(initialLView, tNode, walkUpTimes);
9372
9314
  // Keep polling until we resolve the trigger's LView.
9373
9315
  if (!triggerLView) {
9374
- // Keep polling.
9316
+ afterNextRender({ read: pollDomTrigger }, { injector });
9375
9317
  return;
9376
9318
  }
9377
- poll.destroy();
9378
9319
  // It's possible that the trigger's view was destroyed before we resolved the trigger element.
9379
9320
  if (isDestroyed(triggerLView)) {
9380
9321
  return;
@@ -9401,7 +9342,7 @@ function registerDomTrigger(initialLView, tNode, triggerIndex, walkUpTimes, regi
9401
9342
  storeTriggerCleanupFn(type, lDetails, cleanup);
9402
9343
  }
9403
9344
  // Begin polling for the trigger.
9404
- poll = afterRender({ read: pollDomTrigger }, { injector });
9345
+ afterNextRender({ read: pollDomTrigger }, { injector });
9405
9346
  }
9406
9347
 
9407
9348
  const DEFER_BLOCK_SSR_ID_ATTRIBUTE = 'ngb';
@@ -11715,7 +11656,7 @@ function detachViewFromDOM(tView, lView) {
11715
11656
  // When we remove a view from the DOM, we need to rerun afterRender hooks
11716
11657
  // We don't necessarily needs to run change detection. DOM removal only requires
11717
11658
  // change detection if animations are enabled (this notification is handled by animations).
11718
- lView[ENVIRONMENT].changeDetectionScheduler?.notify(9 /* NotificationSource.ViewDetachedFromDOM */);
11659
+ lView[ENVIRONMENT].changeDetectionScheduler?.notify(10 /* NotificationSource.ViewDetachedFromDOM */);
11719
11660
  applyView(tView, lView, lView[RENDERER], 2 /* WalkTNodeTreeAction.Detach */, null, null);
11720
11661
  }
11721
11662
  /**
@@ -11825,7 +11766,7 @@ function trackMovedView(declarationContainer, lView) {
11825
11766
  const parent = lView[PARENT];
11826
11767
  ngDevMode && assertDefined(parent, 'missing parent');
11827
11768
  if (isLView(parent)) {
11828
- declarationContainer[FLAGS] |= LContainerFlags.HasTransplantedViews;
11769
+ declarationContainer[FLAGS] |= 2 /* LContainerFlags.HasTransplantedViews */;
11829
11770
  }
11830
11771
  else {
11831
11772
  const insertedComponentLView = parent[PARENT][DECLARATION_COMPONENT_VIEW];
@@ -11836,7 +11777,7 @@ function trackMovedView(declarationContainer, lView) {
11836
11777
  // At this point the declaration-component is not same as insertion-component; this means that
11837
11778
  // this is a transplanted view. Mark the declared lView as having transplanted views so that
11838
11779
  // those views can participate in CD.
11839
- declarationContainer[FLAGS] |= LContainerFlags.HasTransplantedViews;
11780
+ declarationContainer[FLAGS] |= 2 /* LContainerFlags.HasTransplantedViews */;
11840
11781
  }
11841
11782
  }
11842
11783
  if (movedViews === null) {
@@ -14702,15 +14643,6 @@ function collectNativeNodesInLContainer(lContainer, result) {
14702
14643
  }
14703
14644
  }
14704
14645
 
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
-
14714
14646
  let freeConsumers = [];
14715
14647
  /**
14716
14648
  * Create a new template consumer pointing at the specified LView.
@@ -15056,7 +14988,6 @@ function refreshView(tView, lView, templateFn, context) {
15056
14988
  // no changes cycle, the component would be not be dirty for the next update pass. This would
15057
14989
  // be different in production mode where the component dirty state is not reset.
15058
14990
  if (!isInCheckNoChangesPass) {
15059
- addAfterRenderSequencesForView(lView);
15060
14991
  lView[FLAGS] &= ~(64 /* LViewFlags.Dirty */ | 8 /* LViewFlags.FirstLViewPass */);
15061
14992
  }
15062
14993
  }
@@ -15099,7 +15030,7 @@ function detectChangesInEmbeddedViews(lView, mode) {
15099
15030
  */
15100
15031
  function markTransplantedViewsForRefresh(lView) {
15101
15032
  for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
15102
- if (!(lContainer[FLAGS] & LContainerFlags.HasTransplantedViews))
15033
+ if (!(lContainer[FLAGS] & 2 /* LContainerFlags.HasTransplantedViews */))
15103
15034
  continue;
15104
15035
  const movedViews = lContainer[MOVED_VIEWS];
15105
15036
  ngDevMode && assertDefined(movedViews, 'Transplanted View flags set but missing MOVED_VIEWS');
@@ -15172,17 +15103,12 @@ function detectChangesInView(lView, mode) {
15172
15103
  refreshView(tView, lView, tView.template, lView[CONTEXT]);
15173
15104
  }
15174
15105
  else if (flags & 8192 /* LViewFlags.HasChildViewsToRefresh */) {
15175
- if (!isInCheckNoChangesPass) {
15176
- runEffectsInView(lView);
15177
- }
15106
+ runEffectsInView(lView);
15178
15107
  detectChangesInEmbeddedViews(lView, 1 /* ChangeDetectionMode.Targeted */);
15179
15108
  const components = tView.components;
15180
15109
  if (components !== null) {
15181
15110
  detectChangesInChildComponents(lView, components, 1 /* ChangeDetectionMode.Targeted */);
15182
15111
  }
15183
- if (!isInCheckNoChangesPass) {
15184
- addAfterRenderSequencesForView(lView);
15185
- }
15186
15112
  }
15187
15113
  }
15188
15114
  /** Refreshes child components in the current view (update mode). */
@@ -16285,7 +16211,7 @@ function loadIcuContainerVisitor() {
16285
16211
  * to determine which root belong to the ICU.
16286
16212
  *
16287
16213
  * Example of usage.
16288
- * ```
16214
+ * ```ts
16289
16215
  * const nextRNode = icuContainerIteratorStart(tIcuContainerNode, lView);
16290
16216
  * let rNode: RNode|null;
16291
16217
  * while(rNode = nextRNode()) {
@@ -16516,7 +16442,7 @@ function stringifyNavigationInstructions(instructions) {
16516
16442
  const step = instructions[i];
16517
16443
  const repeat = instructions[i + 1];
16518
16444
  for (let r = 0; r < repeat; r++) {
16519
- container.push(step === NodeNavigationStep.FirstChild ? 'firstChild' : 'nextSibling');
16445
+ container.push(step === NODE_NAVIGATION_STEP_FIRST_CHILD ? 'firstChild' : 'nextSibling');
16520
16446
  }
16521
16447
  }
16522
16448
  return container.join('.');
@@ -16535,10 +16461,10 @@ function navigateToNode(from, instructions) {
16535
16461
  throw nodeNotFoundAtPathError(from, stringifyNavigationInstructions(instructions));
16536
16462
  }
16537
16463
  switch (step) {
16538
- case NodeNavigationStep.FirstChild:
16464
+ case NODE_NAVIGATION_STEP_FIRST_CHILD:
16539
16465
  node = node.firstChild;
16540
16466
  break;
16541
- case NodeNavigationStep.NextSibling:
16467
+ case NODE_NAVIGATION_STEP_NEXT_SIBLING:
16542
16468
  node = node.nextSibling;
16543
16469
  break;
16544
16470
  }
@@ -16596,7 +16522,7 @@ function navigateBetween(start, finish) {
16596
16522
  // First navigate to `finish`'s parent
16597
16523
  ...parentPath,
16598
16524
  // Then to its first child.
16599
- NodeNavigationStep.FirstChild,
16525
+ NODE_NAVIGATION_STEP_FIRST_CHILD,
16600
16526
  // And finally from that node to `finish` (maybe a no-op if we're already there).
16601
16527
  ...childPath,
16602
16528
  ];
@@ -16610,7 +16536,7 @@ function navigateBetweenSiblings(start, finish) {
16610
16536
  const nav = [];
16611
16537
  let node = null;
16612
16538
  for (node = start; node != null && node !== finish; node = node.nextSibling) {
16613
- nav.push(NodeNavigationStep.NextSibling);
16539
+ nav.push(NODE_NAVIGATION_STEP_NEXT_SIBLING);
16614
16540
  }
16615
16541
  // If the `node` becomes `null` or `undefined` at the end, that means that we
16616
16542
  // didn't find the `end` node, thus return `null` (which would trigger serialization
@@ -18167,7 +18093,7 @@ function createRootComponent(componentView, rootComponentDef, rootDirectives, ho
18167
18093
  function setRootNodeAttributes(hostRenderer, componentDef, hostRNode, rootSelectorOrNode) {
18168
18094
  if (rootSelectorOrNode) {
18169
18095
  // The placeholder will be replaced with the actual version at build time.
18170
- setUpAttributes(hostRenderer, hostRNode, ['ng-version', '19.1.0-rc.0']);
18096
+ setUpAttributes(hostRenderer, hostRNode, ['ng-version', '19.1.0']);
18171
18097
  }
18172
18098
  else {
18173
18099
  // If host element is created as a part of this function call (i.e. `rootSelectorOrNode`
@@ -23102,77 +23028,6 @@ function isSubscribable(obj) {
23102
23028
  return !!obj && typeof obj.subscribe === 'function';
23103
23029
  }
23104
23030
 
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
-
23176
23031
  /**
23177
23032
  * A DI token that you can use to provide
23178
23033
  * one or more initialization functions.
@@ -23417,6 +23272,77 @@ class ApplicationInitStatus {
23417
23272
  args: [{ providedIn: 'root' }]
23418
23273
  }], () => [], null); })();
23419
23274
 
23275
+ /**
23276
+ * A scheduler which manages the execution of effects.
23277
+ */
23278
+ class EffectScheduler {
23279
+ /** @nocollapse */
23280
+ static ɵprov = /** @pureOrBreakMyCode */ /* @__PURE__ */ ɵɵdefineInjectable({
23281
+ token: EffectScheduler,
23282
+ providedIn: 'root',
23283
+ factory: () => new ZoneAwareEffectScheduler(),
23284
+ });
23285
+ }
23286
+ /**
23287
+ * A wrapper around `ZoneAwareQueueingScheduler` that schedules flushing via the microtask queue
23288
+ * when.
23289
+ */
23290
+ class ZoneAwareEffectScheduler {
23291
+ queuedEffectCount = 0;
23292
+ queues = new Map();
23293
+ schedule(handle) {
23294
+ this.enqueue(handle);
23295
+ }
23296
+ remove(handle) {
23297
+ const zone = handle.zone;
23298
+ const queue = this.queues.get(zone);
23299
+ if (!queue.has(handle)) {
23300
+ return;
23301
+ }
23302
+ queue.delete(handle);
23303
+ this.queuedEffectCount--;
23304
+ }
23305
+ enqueue(handle) {
23306
+ const zone = handle.zone;
23307
+ if (!this.queues.has(zone)) {
23308
+ this.queues.set(zone, new Set());
23309
+ }
23310
+ const queue = this.queues.get(zone);
23311
+ if (queue.has(handle)) {
23312
+ return;
23313
+ }
23314
+ this.queuedEffectCount++;
23315
+ queue.add(handle);
23316
+ }
23317
+ /**
23318
+ * Run all scheduled effects.
23319
+ *
23320
+ * Execution order of effects within the same zone is guaranteed to be FIFO, but there is no
23321
+ * ordering guarantee between effects scheduled in different zones.
23322
+ */
23323
+ flush() {
23324
+ while (this.queuedEffectCount > 0) {
23325
+ for (const [zone, queue] of this.queues) {
23326
+ // `zone` here must be defined.
23327
+ if (zone === null) {
23328
+ this.flushQueue(queue);
23329
+ }
23330
+ else {
23331
+ zone.run(() => this.flushQueue(queue));
23332
+ }
23333
+ }
23334
+ }
23335
+ }
23336
+ flushQueue(queue) {
23337
+ for (const handle of queue) {
23338
+ queue.delete(handle);
23339
+ this.queuedEffectCount--;
23340
+ // TODO: what happens if this throws an error?
23341
+ handle.run();
23342
+ }
23343
+ }
23344
+ }
23345
+
23420
23346
  /**
23421
23347
  * A DI token that provides a set of callbacks to
23422
23348
  * be called for every component that is bootstrapped.
@@ -23594,6 +23520,12 @@ class ApplicationRef {
23594
23520
  * @internal
23595
23521
  */
23596
23522
  dirtyFlags = 0 /* ApplicationRefDirtyFlags.None */;
23523
+ /**
23524
+ * Like `dirtyFlags` but don't cause `tick()` to loop.
23525
+ *
23526
+ * @internal
23527
+ */
23528
+ deferredDirtyFlags = 0 /* ApplicationRefDirtyFlags.None */;
23597
23529
  /**
23598
23530
  * Most recent snapshot from the `TracingService`, if any.
23599
23531
  *
@@ -23800,6 +23732,9 @@ class ApplicationRef {
23800
23732
  if (this._rendererFactory === null && !this._injector.destroyed) {
23801
23733
  this._rendererFactory = this._injector.get(RendererFactory2, null, { optional: true });
23802
23734
  }
23735
+ // When beginning synchronization, all deferred dirtiness becomes active dirtiness.
23736
+ this.dirtyFlags |= this.deferredDirtyFlags;
23737
+ this.deferredDirtyFlags = 0 /* ApplicationRefDirtyFlags.None */;
23803
23738
  let runs = 0;
23804
23739
  while (this.dirtyFlags !== 0 /* ApplicationRefDirtyFlags.None */ && runs++ < MAXIMUM_REFRESH_RERUNS) {
23805
23740
  this.synchronizeOnce();
@@ -23815,6 +23750,9 @@ class ApplicationRef {
23815
23750
  * Perform a single synchronization pass.
23816
23751
  */
23817
23752
  synchronizeOnce() {
23753
+ // If we happened to loop, deferred dirtiness can be processed as active dirtiness again.
23754
+ this.dirtyFlags |= this.deferredDirtyFlags;
23755
+ this.deferredDirtyFlags = 0 /* ApplicationRefDirtyFlags.None */;
23818
23756
  // First, process any dirty root effects.
23819
23757
  if (this.dirtyFlags & 16 /* ApplicationRefDirtyFlags.RootEffects */) {
23820
23758
  this.dirtyFlags &= ~16 /* ApplicationRefDirtyFlags.RootEffects */;
@@ -33524,29 +33462,29 @@ function ɵɵreplaceMetadata(type, applyMetadata, namespaces, locals) {
33524
33462
  }
33525
33463
  /**
33526
33464
  * Finds all LViews matching a specific component definition and recreates them.
33527
- * @param def Component definition to search for.
33465
+ * @param oldDef Component definition to search for.
33528
33466
  * @param rootLView View from which to start the search.
33529
33467
  */
33530
- function recreateMatchingLViews(def, rootLView) {
33468
+ function recreateMatchingLViews(oldDef, rootLView) {
33531
33469
  ngDevMode &&
33532
- assertDefined(def.tView, 'Expected a component definition that has been instantiated at least once');
33470
+ assertDefined(oldDef.tView, 'Expected a component definition that has been instantiated at least once');
33533
33471
  const tView = rootLView[TVIEW];
33534
33472
  // Use `tView` to match the LView since `instanceof` can
33535
33473
  // produce false positives when using inheritance.
33536
- if (tView === def.tView) {
33537
- ngDevMode && assertComponentDef(def.type);
33538
- recreateLView(getComponentDef(def.type), rootLView);
33474
+ if (tView === oldDef.tView) {
33475
+ ngDevMode && assertComponentDef(oldDef.type);
33476
+ recreateLView(getComponentDef(oldDef.type), oldDef, rootLView);
33539
33477
  return;
33540
33478
  }
33541
33479
  for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
33542
33480
  const current = rootLView[i];
33543
33481
  if (isLContainer(current)) {
33544
33482
  for (let i = CONTAINER_HEADER_OFFSET; i < current.length; i++) {
33545
- recreateMatchingLViews(def, current[i]);
33483
+ recreateMatchingLViews(oldDef, current[i]);
33546
33484
  }
33547
33485
  }
33548
33486
  else if (isLView(current)) {
33549
- recreateMatchingLViews(def, current);
33487
+ recreateMatchingLViews(oldDef, current);
33550
33488
  }
33551
33489
  }
33552
33490
  }
@@ -33565,10 +33503,11 @@ function clearRendererCache(factory, def) {
33565
33503
  }
33566
33504
  /**
33567
33505
  * Recreates an LView in-place from a new component definition.
33568
- * @param def Definition from which to recreate the view.
33506
+ * @param newDef Definition from which to recreate the view.
33507
+ * @param oldDef Previous component definition being swapped out.
33569
33508
  * @param lView View to be recreated.
33570
33509
  */
33571
- function recreateLView(def, lView) {
33510
+ function recreateLView(newDef, oldDef, lView) {
33572
33511
  const instance = lView[CONTEXT];
33573
33512
  const host = lView[HOST];
33574
33513
  // In theory the parent can also be an LContainer, but it appears like that's
@@ -33577,14 +33516,15 @@ function recreateLView(def, lView) {
33577
33516
  ngDevMode && assertLView(parentLView);
33578
33517
  const tNode = lView[T_HOST];
33579
33518
  ngDevMode && assertTNodeType(tNode, 2 /* TNodeType.Element */);
33519
+ ngDevMode && assertNotEqual(newDef, oldDef, 'Expected different component definition');
33580
33520
  // Recreate the TView since the template might've changed.
33581
- const newTView = getOrCreateComponentTView(def);
33521
+ const newTView = getOrCreateComponentTView(newDef);
33582
33522
  // Always force the creation of a new renderer to ensure state captured during construction
33583
33523
  // stays consistent with the new component definition by clearing any old cached factories.
33584
33524
  const rendererFactory = lView[ENVIRONMENT].rendererFactory;
33585
- clearRendererCache(rendererFactory, def);
33525
+ clearRendererCache(rendererFactory, oldDef);
33586
33526
  // Create a new LView from the new TView, but reusing the existing TNode and DOM node.
33587
- const newLView = createLView(parentLView, newTView, instance, getInitialLViewFlagsFromDef(def), host, tNode, null, rendererFactory.createRenderer(host, def), null, null, null);
33527
+ const newLView = createLView(parentLView, newTView, instance, getInitialLViewFlagsFromDef(newDef), host, tNode, null, rendererFactory.createRenderer(host, newDef), null, null, null);
33588
33528
  // Detach the LView from its current place in the tree so we don't
33589
33529
  // start traversing any siblings and modifying their structure.
33590
33530
  replaceLViewInTree(parentLView, lView, newLView, tNode.index);
@@ -35027,7 +34967,7 @@ class Version {
35027
34967
  /**
35028
34968
  * @publicApi
35029
34969
  */
35030
- const VERSION = new Version('19.1.0-rc.0');
34970
+ const VERSION = new Version('19.1.0');
35031
34971
 
35032
34972
  /**
35033
34973
  * Combination of NgModuleFactory and ComponentFactories.
@@ -35437,6 +35377,13 @@ class ChangeDetectionSchedulerImpl {
35437
35377
  this.appRef.dirtyFlags |= 4 /* ApplicationRefDirtyFlags.ViewTreeCheck */;
35438
35378
  break;
35439
35379
  }
35380
+ case 8 /* NotificationSource.DeferredRenderHook */: {
35381
+ // Render hooks are "deferred" when they're triggered from other render hooks. Using the
35382
+ // deferred dirty flags ensures that adding new hooks doesn't automatically trigger a loop
35383
+ // inside tick().
35384
+ this.appRef.deferredDirtyFlags |= 8 /* ApplicationRefDirtyFlags.AfterRender */;
35385
+ break;
35386
+ }
35440
35387
  case 6 /* NotificationSource.CustomElement */: {
35441
35388
  // We use `ViewTreeTraversal` to ensure we refresh the element even if this is triggered
35442
35389
  // during CD. In practice this is a no-op since the elements code also calls via a
@@ -35445,7 +35392,7 @@ class ChangeDetectionSchedulerImpl {
35445
35392
  force = true;
35446
35393
  break;
35447
35394
  }
35448
- case 12 /* NotificationSource.RootEffect */: {
35395
+ case 13 /* NotificationSource.RootEffect */: {
35449
35396
  this.appRef.dirtyFlags |= 16 /* ApplicationRefDirtyFlags.RootEffects */;
35450
35397
  // Root effects still force a CD, even if the scheduler is disabled. This ensures that
35451
35398
  // effects always run, even when triggered from outside the zone when the scheduler is
@@ -35453,7 +35400,7 @@ class ChangeDetectionSchedulerImpl {
35453
35400
  force = true;
35454
35401
  break;
35455
35402
  }
35456
- case 13 /* NotificationSource.ViewEffect */: {
35403
+ case 14 /* NotificationSource.ViewEffect */: {
35457
35404
  // This is technically a no-op, since view effects will also send a
35458
35405
  // `MarkAncestorsForTraversal` notification. Still, we set this for logical consistency.
35459
35406
  this.appRef.dirtyFlags |= 2 /* ApplicationRefDirtyFlags.ViewTreeTraversal */;
@@ -35463,7 +35410,7 @@ class ChangeDetectionSchedulerImpl {
35463
35410
  force = true;
35464
35411
  break;
35465
35412
  }
35466
- case 11 /* NotificationSource.PendingTaskRemoved */: {
35413
+ case 12 /* NotificationSource.PendingTaskRemoved */: {
35467
35414
  // Removing a pending task via the public API forces a scheduled tick, ensuring that
35468
35415
  // stability is async and delayed until there was at least an opportunity to run
35469
35416
  // application synchronization. This prevents some footguns when working with the
@@ -35472,10 +35419,10 @@ class ChangeDetectionSchedulerImpl {
35472
35419
  force = true;
35473
35420
  break;
35474
35421
  }
35475
- case 9 /* NotificationSource.ViewDetachedFromDOM */:
35476
- case 8 /* NotificationSource.ViewAttached */:
35422
+ case 10 /* NotificationSource.ViewDetachedFromDOM */:
35423
+ case 9 /* NotificationSource.ViewAttached */:
35477
35424
  case 7 /* NotificationSource.RenderHook */:
35478
- case 10 /* NotificationSource.AsyncAnimationsLoaded */:
35425
+ case 11 /* NotificationSource.AsyncAnimationsLoaded */:
35479
35426
  default: {
35480
35427
  // These notifications only schedule a tick but do not change whether we should refresh
35481
35428
  // views. Instead, we only need to run render hooks unless another notification from the
@@ -38293,7 +38240,7 @@ class IterableDiffers {
38293
38240
  * which will only be applied to the injector for this component and its children.
38294
38241
  * This step is all that's required to make a new {@link IterableDiffer} available.
38295
38242
  *
38296
- * ```
38243
+ * ```ts
38297
38244
  * @Component({
38298
38245
  * viewProviders: [
38299
38246
  * IterableDiffers.extend([new ImmutableListDiffer()])
@@ -38367,7 +38314,7 @@ class KeyValueDiffers {
38367
38314
  * which will only be applied to the injector for this component and its children.
38368
38315
  * This step is all that's required to make a new {@link KeyValueDiffer} available.
38369
38316
  *
38370
- * ```
38317
+ * ```ts
38371
38318
  * @Component({
38372
38319
  * viewProviders: [
38373
38320
  * KeyValueDiffers.extend([new ImmutableMapDiffer()])
@@ -39489,7 +39436,6 @@ function serializeLContainer(lContainer, tNode, lView, parentDeferBlockId, conte
39489
39436
  collectNativeNodesInLContainer(lContainer, rootNodes);
39490
39437
  // Add defer block into info context.deferBlocks
39491
39438
  const deferBlockInfo = {
39492
- [DEFER_PARENT_BLOCK_ID]: parentDeferBlockId,
39493
39439
  [NUM_ROOT_NODES]: rootNodes.length,
39494
39440
  [DEFER_BLOCK_STATE$1]: lDetails[DEFER_BLOCK_STATE],
39495
39441
  };
@@ -39497,6 +39443,10 @@ function serializeLContainer(lContainer, tNode, lView, parentDeferBlockId, conte
39497
39443
  if (serializedTriggers.length > 0) {
39498
39444
  deferBlockInfo[DEFER_HYDRATE_TRIGGERS] = serializedTriggers;
39499
39445
  }
39446
+ if (parentDeferBlockId !== null) {
39447
+ // Serialize parent id only when it's present.
39448
+ deferBlockInfo[DEFER_PARENT_BLOCK_ID] = parentDeferBlockId;
39449
+ }
39500
39450
  context.deferBlocks.set(deferBlockId, deferBlockInfo);
39501
39451
  const node = unwrapRNode(lContainer);
39502
39452
  if (node !== undefined) {
@@ -40641,6 +40591,23 @@ function untracked(nonReactiveReadsFn) {
40641
40591
  }
40642
40592
  }
40643
40593
 
40594
+ class ViewContext {
40595
+ view;
40596
+ node;
40597
+ constructor(view, node) {
40598
+ this.view = view;
40599
+ this.node = node;
40600
+ }
40601
+ /**
40602
+ * @internal
40603
+ * @nocollapse
40604
+ */
40605
+ static __NG_ELEMENT_ID__ = injectViewContext;
40606
+ }
40607
+ function injectViewContext() {
40608
+ return new ViewContext(getLView(), getCurrentTNode());
40609
+ }
40610
+
40644
40611
  /**
40645
40612
  * Controls whether effects use the legacy `microtaskEffect` by default.
40646
40613
  */
@@ -40908,7 +40875,7 @@ const ROOT_EFFECT_NODE =
40908
40875
  ...BASE_EFFECT_NODE,
40909
40876
  consumerMarkedDirty() {
40910
40877
  this.scheduler.schedule(this);
40911
- this.notifier.notify(12 /* NotificationSource.RootEffect */);
40878
+ this.notifier.notify(13 /* NotificationSource.RootEffect */);
40912
40879
  },
40913
40880
  destroy() {
40914
40881
  consumerDestroy$1(this);
@@ -40923,7 +40890,7 @@ const VIEW_EFFECT_NODE =
40923
40890
  consumerMarkedDirty() {
40924
40891
  this.view[FLAGS] |= 8192 /* LViewFlags.HasChildViewsToRefresh */;
40925
40892
  markAncestorsForTraversal(this.view);
40926
- this.notifier.notify(13 /* NotificationSource.ViewEffect */);
40893
+ this.notifier.notify(14 /* NotificationSource.ViewEffect */);
40927
40894
  },
40928
40895
  destroy() {
40929
40896
  consumerDestroy$1(this);
@@ -40950,7 +40917,7 @@ function createRootEffect(fn, scheduler, notifier) {
40950
40917
  node.notifier = notifier;
40951
40918
  node.zone = typeof Zone !== 'undefined' ? Zone.current : null;
40952
40919
  node.scheduler.schedule(node);
40953
- node.notifier.notify(12 /* NotificationSource.RootEffect */);
40920
+ node.notifier.notify(13 /* NotificationSource.RootEffect */);
40954
40921
  return node;
40955
40922
  }
40956
40923
 
@@ -41041,10 +41008,10 @@ class AfterRenderEffectSequence extends AfterRenderSequence {
41041
41008
  * These are initialized to `undefined` but set in the constructor.
41042
41009
  */
41043
41010
  nodes = [undefined, undefined, undefined, undefined];
41044
- constructor(impl, effectHooks, view, scheduler, destroyRef, snapshot = null) {
41011
+ constructor(impl, effectHooks, scheduler, destroyRef, snapshot = null) {
41045
41012
  // Note that we also initialize the underlying `AfterRenderSequence` hooks to `undefined` and
41046
41013
  // populate them as we create reactive nodes below.
41047
- super(impl, [undefined, undefined, undefined, undefined], view, false, destroyRef, snapshot);
41014
+ super(impl, [undefined, undefined, undefined, undefined], false, destroyRef, snapshot);
41048
41015
  this.scheduler = scheduler;
41049
41016
  // Setup a reactive node for each phase.
41050
41017
  for (const phase of AFTER_RENDER_PHASES) {
@@ -41103,8 +41070,7 @@ function afterRenderEffect(callbackOrSpec, options) {
41103
41070
  if (typeof spec === 'function') {
41104
41071
  spec = { mixedReadWrite: callbackOrSpec };
41105
41072
  }
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));
41073
+ const sequence = new AfterRenderEffectSequence(manager.impl, [spec.earlyRead, spec.write, spec.mixedReadWrite, spec.read], scheduler, injector.get(DestroyRef), tracing?.snapshot(null));
41108
41074
  manager.impl.register(sequence);
41109
41075
  return sequence;
41110
41076
  }
@@ -41520,7 +41486,7 @@ function mergeApplicationConfig(...configs) {
41520
41486
  *
41521
41487
  * @developerPreview
41522
41488
  */
41523
- const REQUEST = new InjectionToken('REQUEST', {
41489
+ const REQUEST = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'REQUEST' : '', {
41524
41490
  providedIn: 'platform',
41525
41491
  factory: () => null,
41526
41492
  });
@@ -41542,7 +41508,7 @@ const REQUEST = new InjectionToken('REQUEST', {
41542
41508
  *
41543
41509
  * @developerPreview
41544
41510
  */
41545
- const RESPONSE_INIT = new InjectionToken('RESPONSE_INIT', {
41511
+ const RESPONSE_INIT = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'RESPONSE_INIT' : '', {
41546
41512
  providedIn: 'platform',
41547
41513
  factory: () => null,
41548
41514
  });
@@ -41556,7 +41522,7 @@ const RESPONSE_INIT = new InjectionToken('RESPONSE_INIT', {
41556
41522
  *
41557
41523
  * @developerPreview
41558
41524
  */
41559
- const REQUEST_CONTEXT = new InjectionToken('REQUEST_CONTEXT', {
41525
+ const REQUEST_CONTEXT = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'REQUEST_CONTEXT' : '', {
41560
41526
  providedIn: 'platform',
41561
41527
  factory: () => null,
41562
41528
  });