@angular/router 21.1.0-next.0 → 21.1.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.1.0-next.0
2
+ * @license Angular v21.1.0-next.2
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -8,7 +8,7 @@ import * as i3 from '@angular/common';
8
8
  import { ViewportScroller, PlatformNavigation, PlatformLocation, Location, ɵNavigationAdapterForLocation as _NavigationAdapterForLocation, LOCATION_INITIALIZED, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common';
9
9
  import * as i0 from '@angular/core';
10
10
  import { signal, untracked, inject, ɵINTERNAL_APPLICATION_ERROR_HANDLER as _INTERNAL_APPLICATION_ERROR_HANDLER, HostAttributeToken, ɵRuntimeError as _RuntimeError, booleanAttribute, Directive, Attribute, HostBinding, Input, HostListener, EventEmitter, ContentChildren, Output, Injectable, createEnvironmentInjector, InjectionToken, NgZone, EnvironmentInjector, DestroyRef, afterNextRender, ɵpromiseWithResolvers as _promiseWithResolvers, ɵpublishExternalGlobalUtil as _publishExternalGlobalUtil, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, provideEnvironmentInitializer, Injector, ApplicationRef, ɵIS_ENABLED_BLOCKING_INITIAL_NAVIGATION as _IS_ENABLED_BLOCKING_INITIAL_NAVIGATION, provideAppInitializer, ɵperformanceMarkFeature as _performanceMarkFeature, ENVIRONMENT_INITIALIZER, NgModule } from '@angular/core';
11
- import { ROUTER_CONFIGURATION, NavigationEnd, isUrlTree, Router, ActivatedRoute, RouterConfigLoader, IMPERATIVE_NAVIGATION, UrlSerializer, NavigationTransitions, NavigationStart, NavigationSkipped, NavigationSkippedCode, Scroll, StateManager, RoutesRecognized, BeforeActivateRoutes, NavigationCancel, NavigationError, NavigationCancellationCode, ROUTES, afterNextNavigation, stringifyEvent, NAVIGATION_ERROR_HANDLER, RoutedComponentInputBinder, INPUT_BINDER, CREATE_VIEW_TRANSITION, createViewTransition, VIEW_TRANSITION_OPTIONS, DefaultUrlSerializer, ChildrenOutletContexts, RouterOutlet, ɵEmptyOutletComponent as _EmptyOutletComponent } from './_router-chunk.mjs';
11
+ import { ROUTER_CONFIGURATION, NavigationEnd, isUrlTree, Router, ActivatedRoute, RouterConfigLoader, IMPERATIVE_NAVIGATION, UrlSerializer, NavigationTransitions, NavigationStart, NavigationSkipped, NavigationSkippedCode, Scroll, StateManager, RoutesRecognized, BeforeActivateRoutes, NavigationCancel, NavigationError, isRedirectingEvent, NavigationCancellationCode, ROUTES, afterNextNavigation, stringifyEvent, NAVIGATION_ERROR_HANDLER, RoutedComponentInputBinder, INPUT_BINDER, CREATE_VIEW_TRANSITION, createViewTransition, VIEW_TRANSITION_OPTIONS, DefaultUrlSerializer, ChildrenOutletContexts, RouterOutlet, ɵEmptyOutletComponent as _EmptyOutletComponent } from './_router-chunk.mjs';
12
12
  import { Subject, of, from } from 'rxjs';
13
13
  import { mergeAll, catchError, filter, concatMap, mergeMap } from 'rxjs/operators';
14
14
 
@@ -19,11 +19,9 @@ class RouterLink {
19
19
  renderer;
20
20
  el;
21
21
  locationStrategy;
22
- reactiveHref = signal(null, {
23
- ...(ngDevMode ? {
24
- debugName: "reactiveHref"
25
- } : {})
26
- });
22
+ reactiveHref = signal(null, ...(ngDevMode ? [{
23
+ debugName: "reactiveHref"
24
+ }] : []));
27
25
  get href() {
28
26
  return untracked(this.reactiveHref);
29
27
  }
@@ -168,7 +166,7 @@ class RouterLink {
168
166
  }
169
167
  static ɵfac = i0.ɵɵngDeclareFactory({
170
168
  minVersion: "12.0.0",
171
- version: "21.1.0-next.0",
169
+ version: "21.1.0-next.2",
172
170
  ngImport: i0,
173
171
  type: RouterLink,
174
172
  deps: [{
@@ -189,7 +187,7 @@ class RouterLink {
189
187
  });
190
188
  static ɵdir = i0.ɵɵngDeclareDirective({
191
189
  minVersion: "16.1.0",
192
- version: "21.1.0-next.0",
190
+ version: "21.1.0-next.2",
193
191
  type: RouterLink,
194
192
  isStandalone: true,
195
193
  selector: "[routerLink]",
@@ -221,7 +219,7 @@ class RouterLink {
221
219
  }
222
220
  i0.ɵɵngDeclareClassMetadata({
223
221
  minVersion: "12.0.0",
224
- version: "21.1.0-next.0",
222
+ version: "21.1.0-next.2",
225
223
  ngImport: i0,
226
224
  type: RouterLink,
227
225
  decorators: [{
@@ -397,7 +395,7 @@ class RouterLinkActive {
397
395
  }
398
396
  static ɵfac = i0.ɵɵngDeclareFactory({
399
397
  minVersion: "12.0.0",
400
- version: "21.1.0-next.0",
398
+ version: "21.1.0-next.2",
401
399
  ngImport: i0,
402
400
  type: RouterLinkActive,
403
401
  deps: [{
@@ -413,7 +411,7 @@ class RouterLinkActive {
413
411
  });
414
412
  static ɵdir = i0.ɵɵngDeclareDirective({
415
413
  minVersion: "14.0.0",
416
- version: "21.1.0-next.0",
414
+ version: "21.1.0-next.2",
417
415
  type: RouterLinkActive,
418
416
  isStandalone: true,
419
417
  selector: "[routerLinkActive]",
@@ -437,7 +435,7 @@ class RouterLinkActive {
437
435
  }
438
436
  i0.ɵɵngDeclareClassMetadata({
439
437
  minVersion: "12.0.0",
440
- version: "21.1.0-next.0",
438
+ version: "21.1.0-next.2",
441
439
  ngImport: i0,
442
440
  type: RouterLinkActive,
443
441
  decorators: [{
@@ -488,7 +486,7 @@ class PreloadAllModules {
488
486
  }
489
487
  static ɵfac = i0.ɵɵngDeclareFactory({
490
488
  minVersion: "12.0.0",
491
- version: "21.1.0-next.0",
489
+ version: "21.1.0-next.2",
492
490
  ngImport: i0,
493
491
  type: PreloadAllModules,
494
492
  deps: [],
@@ -496,7 +494,7 @@ class PreloadAllModules {
496
494
  });
497
495
  static ɵprov = i0.ɵɵngDeclareInjectable({
498
496
  minVersion: "12.0.0",
499
- version: "21.1.0-next.0",
497
+ version: "21.1.0-next.2",
500
498
  ngImport: i0,
501
499
  type: PreloadAllModules,
502
500
  providedIn: 'root'
@@ -504,7 +502,7 @@ class PreloadAllModules {
504
502
  }
505
503
  i0.ɵɵngDeclareClassMetadata({
506
504
  minVersion: "12.0.0",
507
- version: "21.1.0-next.0",
505
+ version: "21.1.0-next.2",
508
506
  ngImport: i0,
509
507
  type: PreloadAllModules,
510
508
  decorators: [{
@@ -520,7 +518,7 @@ class NoPreloading {
520
518
  }
521
519
  static ɵfac = i0.ɵɵngDeclareFactory({
522
520
  minVersion: "12.0.0",
523
- version: "21.1.0-next.0",
521
+ version: "21.1.0-next.2",
524
522
  ngImport: i0,
525
523
  type: NoPreloading,
526
524
  deps: [],
@@ -528,7 +526,7 @@ class NoPreloading {
528
526
  });
529
527
  static ɵprov = i0.ɵɵngDeclareInjectable({
530
528
  minVersion: "12.0.0",
531
- version: "21.1.0-next.0",
529
+ version: "21.1.0-next.2",
532
530
  ngImport: i0,
533
531
  type: NoPreloading,
534
532
  providedIn: 'root'
@@ -536,7 +534,7 @@ class NoPreloading {
536
534
  }
537
535
  i0.ɵɵngDeclareClassMetadata({
538
536
  minVersion: "12.0.0",
539
- version: "21.1.0-next.0",
537
+ version: "21.1.0-next.2",
540
538
  ngImport: i0,
541
539
  type: NoPreloading,
542
540
  decorators: [{
@@ -612,7 +610,7 @@ class RouterPreloader {
612
610
  }
613
611
  static ɵfac = i0.ɵɵngDeclareFactory({
614
612
  minVersion: "12.0.0",
615
- version: "21.1.0-next.0",
613
+ version: "21.1.0-next.2",
616
614
  ngImport: i0,
617
615
  type: RouterPreloader,
618
616
  deps: [{
@@ -628,7 +626,7 @@ class RouterPreloader {
628
626
  });
629
627
  static ɵprov = i0.ɵɵngDeclareInjectable({
630
628
  minVersion: "12.0.0",
631
- version: "21.1.0-next.0",
629
+ version: "21.1.0-next.2",
632
630
  ngImport: i0,
633
631
  type: RouterPreloader,
634
632
  providedIn: 'root'
@@ -636,7 +634,7 @@ class RouterPreloader {
636
634
  }
637
635
  i0.ɵɵngDeclareClassMetadata({
638
636
  minVersion: "12.0.0",
639
- version: "21.1.0-next.0",
637
+ version: "21.1.0-next.2",
640
638
  ngImport: i0,
641
639
  type: RouterPreloader,
642
640
  decorators: [{
@@ -738,7 +736,7 @@ class RouterScroller {
738
736
  }
739
737
  static ɵfac = i0.ɵɵngDeclareFactory({
740
738
  minVersion: "12.0.0",
741
- version: "21.1.0-next.0",
739
+ version: "21.1.0-next.2",
742
740
  ngImport: i0,
743
741
  type: RouterScroller,
744
742
  deps: "invalid",
@@ -746,14 +744,14 @@ class RouterScroller {
746
744
  });
747
745
  static ɵprov = i0.ɵɵngDeclareInjectable({
748
746
  minVersion: "12.0.0",
749
- version: "21.1.0-next.0",
747
+ version: "21.1.0-next.2",
750
748
  ngImport: i0,
751
749
  type: RouterScroller
752
750
  });
753
751
  }
754
752
  i0.ɵɵngDeclareClassMetadata({
755
753
  minVersion: "12.0.0",
756
- version: "21.1.0-next.0",
754
+ version: "21.1.0-next.2",
757
755
  ngImport: i0,
758
756
  type: RouterScroller,
759
757
  decorators: [{
@@ -849,6 +847,12 @@ class NavigationStateManager extends StateManager {
849
847
  }
850
848
  }
851
849
  createNavigationForTransition(transition) {
850
+ const {
851
+ navigationEvent
852
+ } = this.currentNavigation;
853
+ if (navigationEvent && (navigationEvent.navigationType === 'traverse' || navigationEvent.navigationType === 'reload') && this.eventAndRouterDestinationsMatch(navigationEvent, transition)) {
854
+ return;
855
+ }
852
856
  this.currentNavigation.removeAbortListener?.();
853
857
  const path = this.createBrowserPath(transition);
854
858
  this.navigate(path, transition);
@@ -864,6 +868,9 @@ class NavigationStateManager extends StateManager {
864
868
  intercept: true
865
869
  }
866
870
  };
871
+ if (!this.navigation.transition && this.currentNavigation.navigationEvent) {
872
+ transition.extras.replaceUrl = false;
873
+ }
867
874
  const history = this.location.isCurrentPathEqualTo(path) || transition.extras.replaceUrl || transition.extras.skipLocationChange ? 'replace' : 'push';
868
875
  handleResultRejections(this.navigation.navigate(path, {
869
876
  state,
@@ -879,7 +886,7 @@ class NavigationStateManager extends StateManager {
879
886
  this.currentNavigation.rejectNavigateEvent?.();
880
887
  const clearedState = {};
881
888
  this.currentNavigation = clearedState;
882
- if (cause instanceof NavigationCancel && (cause.code === NavigationCancellationCode.SupersededByNewNavigation || cause.code === NavigationCancellationCode.Redirect)) {
889
+ if (isRedirectingEvent(cause)) {
883
890
  return;
884
891
  }
885
892
  const isTraversalReset = this.canceledNavigationResolution === 'computed' && this.navigation.currentEntry.key !== this.activeHistoryEntry.key;
@@ -887,7 +894,7 @@ class NavigationStateManager extends StateManager {
887
894
  if (this.navigation.currentEntry.id === this.activeHistoryEntry.id) {
888
895
  return;
889
896
  }
890
- if (cause instanceof NavigationCancel && cause.code !== NavigationCancellationCode.GuardRejected && cause.code !== NavigationCancellationCode.NoDataFromResolver) {
897
+ if (cause instanceof NavigationCancel && cause.code === NavigationCancellationCode.Aborted) {
891
898
  await Promise.resolve();
892
899
  if (this.currentNavigation !== clearedState) {
893
900
  return;
@@ -939,6 +946,7 @@ class NavigationStateManager extends StateManager {
939
946
  this.currentNavigation = {
940
947
  ...this.currentNavigation
941
948
  };
949
+ this.currentNavigation.navigationEvent = event;
942
950
  const abortHandler = () => {
943
951
  this.currentNavigation.routerTransition?.abort();
944
952
  };
@@ -976,9 +984,15 @@ class NavigationStateManager extends StateManager {
976
984
  state
977
985
  });
978
986
  }
987
+ eventAndRouterDestinationsMatch(navigateEvent, transition) {
988
+ const internalPath = this.createBrowserPath(transition);
989
+ const eventDestination = new URL(navigateEvent.destination.url);
990
+ const routerDestination = this.location.prepareExternalUrl(internalPath);
991
+ return new URL(routerDestination, eventDestination.origin).href === eventDestination.href;
992
+ }
979
993
  static ɵfac = i0.ɵɵngDeclareFactory({
980
994
  minVersion: "12.0.0",
981
- version: "21.1.0-next.0",
995
+ version: "21.1.0-next.2",
982
996
  ngImport: i0,
983
997
  type: NavigationStateManager,
984
998
  deps: [],
@@ -986,7 +1000,7 @@ class NavigationStateManager extends StateManager {
986
1000
  });
987
1001
  static ɵprov = i0.ɵɵngDeclareInjectable({
988
1002
  minVersion: "12.0.0",
989
- version: "21.1.0-next.0",
1003
+ version: "21.1.0-next.2",
990
1004
  ngImport: i0,
991
1005
  type: NavigationStateManager,
992
1006
  providedIn: 'root'
@@ -994,7 +1008,7 @@ class NavigationStateManager extends StateManager {
994
1008
  }
995
1009
  i0.ɵɵngDeclareClassMetadata({
996
1010
  minVersion: "12.0.0",
997
- version: "21.1.0-next.0",
1011
+ version: "21.1.0-next.2",
998
1012
  ngImport: i0,
999
1013
  type: NavigationStateManager,
1000
1014
  decorators: [{
@@ -1287,7 +1301,7 @@ class RouterModule {
1287
1301
  }
1288
1302
  static ɵfac = i0.ɵɵngDeclareFactory({
1289
1303
  minVersion: "12.0.0",
1290
- version: "21.1.0-next.0",
1304
+ version: "21.1.0-next.2",
1291
1305
  ngImport: i0,
1292
1306
  type: RouterModule,
1293
1307
  deps: [],
@@ -1295,7 +1309,7 @@ class RouterModule {
1295
1309
  });
1296
1310
  static ɵmod = i0.ɵɵngDeclareNgModule({
1297
1311
  minVersion: "14.0.0",
1298
- version: "21.1.0-next.0",
1312
+ version: "21.1.0-next.2",
1299
1313
  ngImport: i0,
1300
1314
  type: RouterModule,
1301
1315
  imports: [RouterOutlet, RouterLink, RouterLinkActive, _EmptyOutletComponent],
@@ -1303,14 +1317,14 @@ class RouterModule {
1303
1317
  });
1304
1318
  static ɵinj = i0.ɵɵngDeclareInjector({
1305
1319
  minVersion: "12.0.0",
1306
- version: "21.1.0-next.0",
1320
+ version: "21.1.0-next.2",
1307
1321
  ngImport: i0,
1308
1322
  type: RouterModule
1309
1323
  });
1310
1324
  }
1311
1325
  i0.ɵɵngDeclareClassMetadata({
1312
1326
  minVersion: "12.0.0",
1313
- version: "21.1.0-next.0",
1327
+ version: "21.1.0-next.2",
1314
1328
  ngImport: i0,
1315
1329
  type: RouterModule,
1316
1330
  decorators: [{