@angular/core 20.2.1 → 20.2.3

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 (70) hide show
  1. package/api.d.d.ts +1 -1
  2. package/chrome_dev_tools_performance.d.d.ts +1 -1
  3. package/discovery.d.d.ts +14 -24
  4. package/{signal.d.d.ts → effect.d.d.ts} +13 -3
  5. package/event_dispatcher.d.d.ts +1 -1
  6. package/fesm2022/attribute.mjs +1 -1
  7. package/fesm2022/attribute.mjs.map +1 -1
  8. package/fesm2022/core.mjs +10 -12
  9. package/fesm2022/core.mjs.map +1 -1
  10. package/fesm2022/debug_node.mjs +72 -65
  11. package/fesm2022/debug_node.mjs.map +1 -1
  12. package/fesm2022/{untracked.mjs → effect.mjs} +29 -4
  13. package/fesm2022/effect.mjs.map +1 -0
  14. package/fesm2022/not_found.mjs +1 -1
  15. package/fesm2022/not_found.mjs.map +1 -1
  16. package/fesm2022/primitives/di.mjs +1 -1
  17. package/fesm2022/primitives/di.mjs.map +1 -1
  18. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  19. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  20. package/fesm2022/primitives/signals.mjs +2 -2
  21. package/fesm2022/primitives/signals.mjs.map +1 -1
  22. package/fesm2022/resource.mjs +18 -27
  23. package/fesm2022/resource.mjs.map +1 -1
  24. package/fesm2022/root_effect_scheduler.mjs +1 -1
  25. package/fesm2022/root_effect_scheduler.mjs.map +1 -1
  26. package/fesm2022/rxjs-interop.mjs +3 -3
  27. package/fesm2022/rxjs-interop.mjs.map +1 -1
  28. package/fesm2022/signal.mjs +1 -1
  29. package/fesm2022/signal.mjs.map +1 -1
  30. package/fesm2022/testing.mjs +4 -6
  31. package/fesm2022/testing.mjs.map +1 -1
  32. package/fesm2022/weak_ref.mjs +1 -1
  33. package/fesm2022/weak_ref.mjs.map +1 -1
  34. package/graph.d.d.ts +1 -1
  35. package/index.d.ts +3 -2
  36. package/package.json +2 -2
  37. package/primitives/di/index.d.ts +1 -1
  38. package/primitives/event-dispatch/index.d.ts +1 -1
  39. package/primitives/signals/index.d.ts +3 -3
  40. package/rxjs-interop/index.d.ts +1 -1
  41. package/schematics/bundles/{apply_import_manager-BvwNQhfG.cjs → apply_import_manager-BTXb3nRr.cjs} +3 -3
  42. package/schematics/bundles/cleanup-unused-imports.cjs +5 -5
  43. package/schematics/bundles/{compiler_host-DbXQvYKt.cjs → compiler_host-Btt7nH4b.cjs} +2 -2
  44. package/schematics/bundles/control-flow-migration.cjs +10 -9
  45. package/schematics/bundles/document-core.cjs +5 -5
  46. package/schematics/bundles/imports-CIX-JgAN.cjs +1 -1
  47. package/schematics/bundles/{index-Bcv0dPD8.cjs → index-CAfBb4YL.cjs} +12 -12
  48. package/schematics/bundles/{index-Bphk20D_.cjs → index-rL7rOVXa.cjs} +4 -4
  49. package/schematics/bundles/inject-flags.cjs +5 -5
  50. package/schematics/bundles/inject-migration.cjs +3 -3
  51. package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
  52. package/schematics/bundles/{migrate_ts_type_references-xcaijJqF.cjs → migrate_ts_type_references-Dyjkgb1x.cjs} +10 -9
  53. package/schematics/bundles/ng_decorators-B5HCqr20.cjs +1 -1
  54. package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
  55. package/schematics/bundles/output-migration.cjs +6 -6
  56. package/schematics/bundles/{project_paths-BaK5P5a5.cjs → project_paths-BUuKobrE.cjs} +3 -3
  57. package/schematics/bundles/{project_tsconfig_paths-COqholMT.cjs → project_tsconfig_paths-x7xrmbI9.cjs} +13 -7
  58. package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
  59. package/schematics/bundles/route-lazy-loading.cjs +3 -3
  60. package/schematics/bundles/router-current-navigation.cjs +4 -4
  61. package/schematics/bundles/self-closing-tags-migration.cjs +4 -4
  62. package/schematics/bundles/signal-input-migration.cjs +13 -12
  63. package/schematics/bundles/signal-queries-migration.cjs +8 -7
  64. package/schematics/bundles/signals.cjs +8 -7
  65. package/schematics/bundles/standalone-migration.cjs +4 -4
  66. package/schematics/bundles/symbol-VPWguRxr.cjs +1 -1
  67. package/schematics/bundles/test-bed-get.cjs +4 -4
  68. package/testing/index.d.ts +2 -2
  69. package/weak_ref.d.d.ts +1 -1
  70. package/fesm2022/untracked.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.2.1
2
+ * @license Angular v20.2.3
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -8398,7 +8398,13 @@ function handleUncaughtError(lView, error) {
8398
8398
  if (!injector) {
8399
8399
  return;
8400
8400
  }
8401
- const errorHandler = injector.get(INTERNAL_APPLICATION_ERROR_HANDLER, null);
8401
+ let errorHandler;
8402
+ try {
8403
+ errorHandler = injector.get(INTERNAL_APPLICATION_ERROR_HANDLER, null);
8404
+ }
8405
+ catch {
8406
+ errorHandler = null;
8407
+ }
8402
8408
  errorHandler?.(error);
8403
8409
  }
8404
8410
  /**
@@ -13515,7 +13521,7 @@ class ComponentFactory extends ComponentFactory$1 {
13515
13521
  }
13516
13522
  function createRootTView(rootSelectorOrNode, componentDef, componentBindings, directives) {
13517
13523
  const tAttributes = rootSelectorOrNode
13518
- ? ['ng-version', '20.2.1']
13524
+ ? ['ng-version', '20.2.3']
13519
13525
  : // Extract attributes and classes from the first selector only to match VE behavior.
13520
13526
  extractAttrsAndClassesFromSelector(componentDef.selectors[0]);
13521
13527
  let creationBindings = null;
@@ -21781,6 +21787,7 @@ class ElementRegistry {
21781
21787
  const details = this.outElements.get(el) ?? {
21782
21788
  classes: null,
21783
21789
  animateFn: () => { },
21790
+ isEventBinding: true,
21784
21791
  };
21785
21792
  details.animateFn = animateWrapperFn(el, value);
21786
21793
  this.outElements.set(el, details);
@@ -21790,6 +21797,7 @@ class ElementRegistry {
21790
21797
  const details = this.outElements.get(el) ?? {
21791
21798
  classes: new Set(),
21792
21799
  animateFn: () => { },
21800
+ isEventBinding: false,
21793
21801
  };
21794
21802
  if (typeof value === 'function') {
21795
21803
  this.trackResolver(details, value);
@@ -21825,8 +21833,11 @@ class ElementRegistry {
21825
21833
  };
21826
21834
  // this timeout is used to ensure elements actually get removed in the case
21827
21835
  // that the user forgot to call the remove callback. The timeout is cleared
21828
- // in the DOM renderer during the remove child process.
21829
- timeoutId = setTimeout(remove, maxAnimationTimeout);
21836
+ // in the DOM renderer during the remove child process. It only applies
21837
+ // to the event binding use case.
21838
+ if (details.isEventBinding) {
21839
+ timeoutId = setTimeout(remove, maxAnimationTimeout);
21840
+ }
21830
21841
  details.animateFn(remove);
21831
21842
  }
21832
21843
  }
@@ -21997,11 +22008,39 @@ const longestAnimations = new WeakMap();
21997
22008
  // used to prevent duplicate nodes from showing up when nodes have been toggled quickly
21998
22009
  // from an `@if` or `@for`.
21999
22010
  const leavingNodes = new WeakMap();
22000
- function clearLeavingNodes(tNode) {
22001
- if (leavingNodes.get(tNode)?.length === 0) {
22011
+ function clearLeavingNodes(tNode, el) {
22012
+ const nodes = leavingNodes.get(tNode);
22013
+ if (nodes && nodes.length > 0) {
22014
+ const ix = nodes.findIndex((node) => node === el);
22015
+ if (ix > -1)
22016
+ nodes.splice(ix, 1);
22017
+ }
22018
+ if (nodes?.length === 0) {
22002
22019
  leavingNodes.delete(tNode);
22003
22020
  }
22004
22021
  }
22022
+ /**
22023
+ * In the case that we have an existing node that's animating away, like when
22024
+ * an `@if` toggles quickly, we need to end the animation for the former node
22025
+ * and remove it right away to prevent duplicate nodes showing up.
22026
+ */
22027
+ function cancelLeavingNodes(tNode, lView) {
22028
+ const leavingEl = leavingNodes.get(tNode)?.shift();
22029
+ const lContainer = lView[DECLARATION_LCONTAINER];
22030
+ if (lContainer) {
22031
+ // this is the insertion point for the new TNode element.
22032
+ // it will be inserted before the declaring containers anchor.
22033
+ const beforeNode = getBeforeNodeForView(tNode.index, lContainer);
22034
+ // here we need to check the previous sibling of that anchor
22035
+ const previousNode = beforeNode?.previousSibling;
22036
+ // We really only want to cancel animations if the leaving node is the
22037
+ // same as the node before where the new node will be inserted. This is
22038
+ // the control flow scenario where an if was toggled.
22039
+ if (leavingEl && previousNode && leavingEl === previousNode) {
22040
+ leavingEl.dispatchEvent(new CustomEvent('animationend', { detail: { cancel: true } }));
22041
+ }
22042
+ }
22043
+ }
22005
22044
  function trackLeavingNodes(tNode, el) {
22006
22045
  // We need to track this tNode's element just to be sure we don't add
22007
22046
  // a new RNode for this TNode while this one is still animating away.
@@ -22033,6 +22072,7 @@ function ɵɵanimateEnter(value) {
22033
22072
  }
22034
22073
  const tNode = getCurrentTNode();
22035
22074
  const nativeElement = getNativeByTNode(tNode, lView);
22075
+ ngDevMode && assertElementNodes(nativeElement, 'animate.enter');
22036
22076
  const renderer = lView[RENDERER];
22037
22077
  const ngZone = lView[INJECTOR].get(NgZone);
22038
22078
  // Retrieve the actual class list from the value. This will resolve any resolver functions from
@@ -22044,7 +22084,6 @@ function ɵɵanimateEnter(value) {
22044
22084
  // This also allows us to setup cancellation of animations in progress if the
22045
22085
  // gets removed early.
22046
22086
  const handleAnimationStart = (event) => {
22047
- setupAnimationCancel(event, renderer);
22048
22087
  const eventName = event instanceof AnimationEvent ? 'animationend' : 'transitionend';
22049
22088
  ngZone.runOutsideAngular(() => {
22050
22089
  cleanupFns.push(renderer.listen(nativeElement, eventName, handleInAnimationEnd));
@@ -22060,14 +22099,7 @@ function ɵɵanimateEnter(value) {
22060
22099
  cleanupFns.push(renderer.listen(nativeElement, 'animationstart', handleAnimationStart));
22061
22100
  cleanupFns.push(renderer.listen(nativeElement, 'transitionstart', handleAnimationStart));
22062
22101
  });
22063
- // In the case that we have an existing node that's animating away, like when
22064
- // an `@if` toggles quickly or `@for` adds and removes elements quickly, we
22065
- // need to end the animation for the former node and remove it right away to
22066
- // prevent duplicate nodes showing up.
22067
- leavingNodes
22068
- .get(tNode)
22069
- ?.pop()
22070
- ?.dispatchEvent(new CustomEvent('animationend', { detail: { cancel: true } }));
22102
+ cancelLeavingNodes(tNode, lView);
22071
22103
  trackEnterClasses(nativeElement, activeClasses, cleanupFns);
22072
22104
  for (const klass of activeClasses) {
22073
22105
  renderer.addClass(nativeElement, klass);
@@ -22130,14 +22162,8 @@ function ɵɵanimateEnterListener(value) {
22130
22162
  }
22131
22163
  const tNode = getCurrentTNode();
22132
22164
  const nativeElement = getNativeByTNode(tNode, lView);
22133
- // In the case that we have an existing node that's animating away, like when
22134
- // an `@if` toggles quickly or `@for` adds and removes elements quickly, we
22135
- // need to end the animation for the former node and remove it right away to
22136
- // prevent duplicate nodes showing up.
22137
- leavingNodes
22138
- .get(tNode)
22139
- ?.pop()
22140
- ?.dispatchEvent(new CustomEvent('animationend', { detail: { cancel: true } }));
22165
+ ngDevMode && assertElementNodes(nativeElement, 'animate.enter');
22166
+ cancelLeavingNodes(tNode, lView);
22141
22167
  value.call(lView[CONTEXT], { target: nativeElement, animationComplete: noOpAnimationComplete });
22142
22168
  return ɵɵanimateEnterListener;
22143
22169
  }
@@ -22165,6 +22191,7 @@ function ɵɵanimateLeave(value) {
22165
22191
  const tView = getTView();
22166
22192
  const tNode = getCurrentTNode();
22167
22193
  const nativeElement = getNativeByTNode(tNode, lView);
22194
+ ngDevMode && assertElementNodes(nativeElement, 'animate.leave');
22168
22195
  // This instruction is called in the update pass.
22169
22196
  const renderer = lView[RENDERER];
22170
22197
  const elementRegistry = getAnimationElementRemovalRegistry();
@@ -22209,9 +22236,7 @@ function ɵɵanimateLeaveListener(value) {
22209
22236
  const tNode = getCurrentTNode();
22210
22237
  const tView = getTView();
22211
22238
  const nativeElement = getNativeByTNode(tNode, lView);
22212
- if (nativeElement.nodeType !== Node.ELEMENT_NODE) {
22213
- return ɵɵanimateLeaveListener;
22214
- }
22239
+ ngDevMode && assertElementNodes(nativeElement, 'animate.leave');
22215
22240
  const elementRegistry = getAnimationElementRemovalRegistry();
22216
22241
  ngDevMode &&
22217
22242
  assertDefined(elementRegistry.elements, 'Expected `ElementRegistry` to be present in animations subsystem');
@@ -22227,7 +22252,7 @@ function ɵɵanimateLeaveListener(value) {
22227
22252
  const event = {
22228
22253
  target: nativeElement,
22229
22254
  animationComplete: () => {
22230
- clearLeavingNodes(tNode);
22255
+ clearLeavingNodes(tNode, _el);
22231
22256
  removeFn();
22232
22257
  },
22233
22258
  };
@@ -22253,15 +22278,12 @@ function getClassList(value, resolvers) {
22253
22278
  const classList = new Set(value);
22254
22279
  if (resolvers && resolvers.length) {
22255
22280
  for (const resolverFn of resolvers) {
22256
- const resolvedValue = resolverFn();
22257
- if (resolvedValue instanceof Array) {
22281
+ const resolvedValue = getClassListFromValue(resolverFn);
22282
+ if (resolvedValue) {
22258
22283
  for (const rv of resolvedValue) {
22259
22284
  classList.add(rv);
22260
22285
  }
22261
22286
  }
22262
- else {
22263
- classList.add(resolvedValue);
22264
- }
22265
22287
  }
22266
22288
  }
22267
22289
  return classList;
@@ -22270,42 +22292,22 @@ function cancelAnimationsIfRunning(element, renderer) {
22270
22292
  if (!areAnimationSupported)
22271
22293
  return;
22272
22294
  const elementData = enterClassMap.get(element);
22273
- if (element.getAnimations().length > 0) {
22274
- for (const animation of element.getAnimations()) {
22275
- if (animation.playState === 'running') {
22276
- animation.cancel();
22277
- }
22278
- }
22279
- }
22280
- else {
22281
- if (elementData) {
22282
- for (const klass of elementData.classList) {
22283
- renderer.removeClass(element, klass);
22284
- }
22295
+ if (elementData &&
22296
+ elementData.classList.length > 0 &&
22297
+ elementHasClassList(element, elementData.classList)) {
22298
+ for (const klass of elementData.classList) {
22299
+ renderer.removeClass(element, klass);
22285
22300
  }
22286
22301
  }
22287
22302
  // We need to prevent any enter animation listeners from firing if they exist.
22288
22303
  cleanupEnterClassData(element);
22289
22304
  }
22290
- function setupAnimationCancel(event, renderer) {
22291
- if (!(event.target instanceof Element))
22292
- return;
22293
- const nativeElement = event.target;
22294
- if (areAnimationSupported) {
22295
- const elementData = enterClassMap.get(nativeElement);
22296
- const animations = nativeElement.getAnimations();
22297
- if (animations.length === 0)
22298
- return;
22299
- for (let animation of animations) {
22300
- animation.addEventListener('cancel', (event) => {
22301
- if (nativeElement === event.target && elementData?.classList) {
22302
- for (const klass of elementData.classList) {
22303
- renderer.removeClass(nativeElement, klass);
22304
- }
22305
- }
22306
- });
22307
- }
22305
+ function elementHasClassList(element, classList) {
22306
+ for (const className of classList) {
22307
+ if (element.classList.contains(className))
22308
+ return true;
22308
22309
  }
22310
+ return false;
22309
22311
  }
22310
22312
  function isLongestAnimation(event, nativeElement) {
22311
22313
  const longestAnimation = longestAnimations.get(nativeElement);
@@ -22337,6 +22339,11 @@ function assertAnimationTypes(value, instruction) {
22337
22339
  throw new RuntimeError(650 /* RuntimeErrorCode.ANIMATE_INVALID_VALUE */, `'${instruction}' value must be a string of CSS classes or an animation function, got ${stringify(value)}`);
22338
22340
  }
22339
22341
  }
22342
+ function assertElementNodes(nativeElement, instruction) {
22343
+ if (nativeElement.nodeType !== Node.ELEMENT_NODE) {
22344
+ throw new RuntimeError(650 /* RuntimeErrorCode.ANIMATE_INVALID_VALUE */, `'${instruction}' can only be used on an element node, got ${stringify(nativeElement.nodeType)}`);
22345
+ }
22346
+ }
22340
22347
  /**
22341
22348
  * This function actually adds the classes that animate element that's leaving the DOM.
22342
22349
  * Once it finishes, it calls the remove function that was provided by the DOM renderer.
@@ -22356,7 +22363,7 @@ function animateLeaveClassRunner(el, tNode, classList, finalRemoveFn, renderer,
22356
22363
  // affect any other animations on the page.
22357
22364
  event.stopImmediatePropagation();
22358
22365
  longestAnimations.delete(el);
22359
- clearLeavingNodes(tNode);
22366
+ clearLeavingNodes(tNode, el);
22360
22367
  finalRemoveFn();
22361
22368
  }
22362
22369
  };
@@ -22375,7 +22382,7 @@ function animateLeaveClassRunner(el, tNode, classList, finalRemoveFn, renderer,
22375
22382
  requestAnimationFrame(() => {
22376
22383
  determineLongestAnimation(el, longestAnimations, areAnimationSupported);
22377
22384
  if (!longestAnimations.has(el)) {
22378
- clearLeavingNodes(tNode);
22385
+ clearLeavingNodes(tNode, el);
22379
22386
  finalRemoveFn();
22380
22387
  }
22381
22388
  });