@angular/router 14.1.0-rc.0 → 14.2.0-next.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 (35) hide show
  1. package/esm2020/src/components/empty_outlet.mjs +10 -6
  2. package/esm2020/src/directives/router_link.mjs +12 -9
  3. package/esm2020/src/directives/router_link_active.mjs +5 -4
  4. package/esm2020/src/directives/router_outlet.mjs +9 -5
  5. package/esm2020/src/index.mjs +4 -3
  6. package/esm2020/src/operators/recognize.mjs +1 -1
  7. package/esm2020/src/operators/resolve_data.mjs +4 -9
  8. package/esm2020/src/page_title_strategy.mjs +13 -8
  9. package/esm2020/src/private_export.mjs +3 -2
  10. package/esm2020/src/router.mjs +128 -72
  11. package/esm2020/src/router_config.mjs +19 -0
  12. package/esm2020/src/router_config_loader.mjs +6 -5
  13. package/esm2020/src/router_module.mjs +22 -79
  14. package/esm2020/src/router_outlet_context.mjs +9 -1
  15. package/esm2020/src/router_preloader.mjs +19 -11
  16. package/esm2020/src/router_scroller.mjs +3 -3
  17. package/esm2020/src/router_state.mjs +7 -3
  18. package/esm2020/src/shared.mjs +22 -2
  19. package/esm2020/src/url_tree.mjs +9 -2
  20. package/esm2020/src/version.mjs +1 -1
  21. package/esm2020/testing/src/router_testing_module.mjs +10 -12
  22. package/fesm2015/router.mjs +371 -286
  23. package/fesm2015/router.mjs.map +1 -1
  24. package/fesm2015/testing.mjs +10 -12
  25. package/fesm2015/testing.mjs.map +1 -1
  26. package/fesm2015/upgrade.mjs +1 -1
  27. package/fesm2020/router.mjs +363 -288
  28. package/fesm2020/router.mjs.map +1 -1
  29. package/fesm2020/testing.mjs +10 -12
  30. package/fesm2020/testing.mjs.map +1 -1
  31. package/fesm2020/upgrade.mjs +1 -1
  32. package/index.d.ts +37 -13
  33. package/package.json +4 -4
  34. package/testing/index.d.ts +2 -3
  35. package/upgrade/index.d.ts +1 -1
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v14.1.0-rc.0
2
+ * @license Angular v14.2.0-next.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i0 from '@angular/core';
8
- import { ɵisObservable, ɵisPromise, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, Inject, ApplicationRef, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
8
+ import { ɵisObservable, ɵisPromise, Injectable, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, inject, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, NgProbeToken, SkipSelf, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, Inject, ApplicationRef, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
9
9
  import { from, of, BehaviorSubject, combineLatest, concat, defer, pipe, throwError, EmptyError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
10
10
  import * as i3 from '@angular/common';
11
11
  import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
@@ -25,6 +25,12 @@ import * as i1 from '@angular/platform-browser';
25
25
  * @publicApi
26
26
  */
27
27
  const PRIMARY_OUTLET = 'primary';
28
+ /**
29
+ * A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a
30
+ * static string or `Route.resolve` if anything else. This allows us to reuse the existing route
31
+ * data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.
32
+ */
33
+ const RouteTitleKey = Symbol('RouteTitle');
28
34
  class ParamsAsMap {
29
35
  constructor(params) {
30
36
  this.params = params || {};
@@ -60,7 +66,21 @@ class ParamsAsMap {
60
66
  function convertToParamMap(params) {
61
67
  return new ParamsAsMap(params);
62
68
  }
63
- // Matches the route configuration (`route`) against the actual URL (`segments`).
69
+ /**
70
+ * Matches the route configuration (`route`) against the actual URL (`segments`).
71
+ *
72
+ * When no matcher is defined on a `Route`, this is the matcher used by the Router by default.
73
+ *
74
+ * @param segments The remaining unmatched segments in the current navigation
75
+ * @param segmentGroup The current segment group being matched
76
+ * @param route The `Route` to match against.
77
+ *
78
+ * @see UrlMatchResult
79
+ * @see Route
80
+ *
81
+ * @returns The resulting match information or `null` if the `route` should not match.
82
+ * @publicApi
83
+ */
64
84
  function defaultUrlMatcher(segments, segmentGroup, route) {
65
85
  const parts = route.path.split('/');
66
86
  if (parts.length > segments.length) {
@@ -182,7 +202,7 @@ function wrapIntoObservable(value) {
182
202
  * Use of this source code is governed by an MIT-style license that can be
183
203
  * found in the LICENSE file at https://angular.io/license
184
204
  */
185
- const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
205
+ const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
186
206
  function createEmptyUrlTree() {
187
207
  return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
188
208
  }
@@ -439,6 +459,12 @@ function mapChildrenIntoArray(segment, fn) {
439
459
  */
440
460
  class UrlSerializer {
441
461
  }
462
+ UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
463
+ UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: UrlSerializer, decorators: [{
465
+ type: Injectable,
466
+ args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
467
+ }] });
442
468
  /**
443
469
  * @description
444
470
  *
@@ -647,7 +673,7 @@ class UrlParser {
647
673
  parseSegment() {
648
674
  const path = matchSegments(this.remaining);
649
675
  if (path === '' && this.peekStartsWith(';')) {
650
- throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$7 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
676
+ throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$8 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
651
677
  }
652
678
  this.capture(path);
653
679
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -716,7 +742,7 @@ class UrlParser {
716
742
  // if is is not one of these characters, then the segment was unescaped
717
743
  // or the group was not closed
718
744
  if (next !== '/' && next !== ')' && next !== ';') {
719
- throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$7 && `Cannot parse url '${this.url}'`);
745
+ throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$8 && `Cannot parse url '${this.url}'`);
720
746
  }
721
747
  let outletName = undefined;
722
748
  if (path.indexOf(':') > -1) {
@@ -747,7 +773,7 @@ class UrlParser {
747
773
  }
748
774
  capture(str) {
749
775
  if (!this.consumeOptional(str)) {
750
- throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$7 && `Expected "${str}".`);
776
+ throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$8 && `Expected "${str}".`);
751
777
  }
752
778
  }
753
779
  }
@@ -800,7 +826,7 @@ function isUrlTree(v) {
800
826
  * Use of this source code is governed by an MIT-style license that can be
801
827
  * found in the LICENSE file at https://angular.io/license
802
828
  */
803
- const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
829
+ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
804
830
  /**
805
831
  * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
806
832
  *
@@ -976,11 +1002,11 @@ class Navigation {
976
1002
  this.numberOfDoubleDots = numberOfDoubleDots;
977
1003
  this.commands = commands;
978
1004
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
979
- throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$6 && 'Root segment cannot have matrix parameters');
1005
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$7 && 'Root segment cannot have matrix parameters');
980
1006
  }
981
1007
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
982
1008
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
983
- throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$6 && '{outlets:{}} has to be the last command');
1009
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$7 && '{outlets:{}} has to be the last command');
984
1010
  }
985
1011
  }
986
1012
  toRoot() {
@@ -1079,7 +1105,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1079
1105
  dd -= ci;
1080
1106
  g = g.parent;
1081
1107
  if (!g) {
1082
- throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$6 && 'Invalid number of \'../\'');
1108
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$7 && 'Invalid number of \'../\'');
1083
1109
  }
1084
1110
  ci = g.segments.length;
1085
1111
  }
@@ -1909,6 +1935,8 @@ class ActivatedRoute {
1909
1935
  this.data = data;
1910
1936
  this.outlet = outlet;
1911
1937
  this.component = component;
1938
+ /** An Observable of the resolved route title */
1939
+ this.title = this.data?.pipe(map((d) => d[RouteTitleKey])) ?? of(undefined);
1912
1940
  this._futureSnapshot = futureSnapshot;
1913
1941
  }
1914
1942
  /** The configuration used to match this route. */
@@ -2063,6 +2091,8 @@ class ActivatedRouteSnapshot {
2063
2091
  this.data = data;
2064
2092
  this.outlet = outlet;
2065
2093
  this.component = component;
2094
+ /** The resolved route title */
2095
+ this.title = this.data?.[RouteTitleKey];
2066
2096
  this.routeConfig = routeConfig;
2067
2097
  this._urlSegment = urlSegment;
2068
2098
  this._lastPathIndex = lastPathIndex;
@@ -2352,6 +2382,12 @@ class ChildrenOutletContexts {
2352
2382
  return this.contexts.get(childName) || null;
2353
2383
  }
2354
2384
  }
2385
+ ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2386
+ ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2387
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2388
+ type: Injectable,
2389
+ args: [{ providedIn: 'root' }]
2390
+ }] });
2355
2391
 
2356
2392
  /**
2357
2393
  * @license
@@ -2360,7 +2396,7 @@ class ChildrenOutletContexts {
2360
2396
  * Use of this source code is governed by an MIT-style license that can be
2361
2397
  * found in the LICENSE file at https://angular.io/license
2362
2398
  */
2363
- const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
2399
+ const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
2364
2400
  /**
2365
2401
  * @description
2366
2402
  *
@@ -2469,12 +2505,12 @@ class RouterOutlet {
2469
2505
  */
2470
2506
  get component() {
2471
2507
  if (!this.activated)
2472
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2508
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2473
2509
  return this.activated.instance;
2474
2510
  }
2475
2511
  get activatedRoute() {
2476
2512
  if (!this.activated)
2477
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2513
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2478
2514
  return this._activatedRoute;
2479
2515
  }
2480
2516
  get activatedRouteData() {
@@ -2488,7 +2524,7 @@ class RouterOutlet {
2488
2524
  */
2489
2525
  detach() {
2490
2526
  if (!this.activated)
2491
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2527
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2492
2528
  this.location.detach();
2493
2529
  const cmp = this.activated;
2494
2530
  this.activated = null;
@@ -2516,7 +2552,7 @@ class RouterOutlet {
2516
2552
  }
2517
2553
  activateWith(activatedRoute, resolverOrInjector) {
2518
2554
  if (this.isActivated) {
2519
- throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$5 && 'Cannot activate an already activated outlet');
2555
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$6 && 'Cannot activate an already activated outlet');
2520
2556
  }
2521
2557
  this._activatedRoute = activatedRoute;
2522
2558
  const location = this.location;
@@ -2538,11 +2574,15 @@ class RouterOutlet {
2538
2574
  this.activateEvents.emit(this.activated.instance);
2539
2575
  }
2540
2576
  }
2541
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2542
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-rc.0", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2543
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterOutlet, decorators: [{
2577
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2578
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterOutlet, isStandalone: true, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2579
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterOutlet, decorators: [{
2544
2580
  type: Directive,
2545
- args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2581
+ args: [{
2582
+ selector: 'router-outlet',
2583
+ exportAs: 'outlet',
2584
+ standalone: true,
2585
+ }]
2546
2586
  }], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
2547
2587
  type: Attribute,
2548
2588
  args: ['name']
@@ -2597,11 +2637,15 @@ function isComponentFactoryResolver(item) {
2597
2637
  */
2598
2638
  class ɵEmptyOutletComponent {
2599
2639
  }
2600
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2601
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0-rc.0", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2602
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2640
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2641
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0-next.0", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2642
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2603
2643
  type: Component,
2604
- args: [{ template: `<router-outlet></router-outlet>` }]
2644
+ args: [{
2645
+ template: `<router-outlet></router-outlet>`,
2646
+ imports: [RouterOutlet],
2647
+ standalone: true,
2648
+ }]
2605
2649
  }] });
2606
2650
 
2607
2651
  /**
@@ -3493,7 +3537,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3493
3537
  * Use of this source code is governed by an MIT-style license that can be
3494
3538
  * found in the LICENSE file at https://angular.io/license
3495
3539
  */
3496
- const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
3540
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
3497
3541
  class NoMatch$1 {
3498
3542
  constructor(segmentGroup) {
3499
3543
  this.segmentGroup = segmentGroup || null;
@@ -3511,11 +3555,11 @@ function absoluteRedirect(newTree) {
3511
3555
  return throwError(new AbsoluteRedirect(newTree));
3512
3556
  }
3513
3557
  function namedOutletsRedirect(redirectTo) {
3514
- return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$4 &&
3558
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$5 &&
3515
3559
  `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3516
3560
  }
3517
3561
  function canLoadFails(route) {
3518
- return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
3562
+ return throwError(navigationCancelingError(NG_DEV_MODE$5 &&
3519
3563
  `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
3520
3564
  }
3521
3565
  /**
@@ -3575,7 +3619,7 @@ class ApplyRedirects {
3575
3619
  }));
3576
3620
  }
3577
3621
  noMatchError(e) {
3578
- return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$4 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3622
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$5 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3579
3623
  }
3580
3624
  createUrlTree(rootCandidate, queryParams, fragment) {
3581
3625
  const root = createRoot(rootCandidate);
@@ -3790,7 +3834,7 @@ class ApplyRedirects {
3790
3834
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3791
3835
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3792
3836
  if (!pos)
3793
- throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
3837
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$5 &&
3794
3838
  `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3795
3839
  return pos;
3796
3840
  }
@@ -3826,7 +3870,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
3826
3870
  * Use of this source code is governed by an MIT-style license that can be
3827
3871
  * found in the LICENSE file at https://angular.io/license
3828
3872
  */
3829
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3873
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3830
3874
  class NoMatch {
3831
3875
  }
3832
3876
  function newObservableError(e) {
@@ -3915,7 +3959,7 @@ class Recognizer {
3915
3959
  // multiple activated results for the same outlet. We should merge the children of
3916
3960
  // these results so the final return value is only one `TreeNode` per outlet.
3917
3961
  const mergedChildren = mergeEmptyPathMatches(children);
3918
- if (NG_DEV_MODE$3) {
3962
+ if (NG_DEV_MODE$4) {
3919
3963
  // This should really never happen - we are only taking the first match for each
3920
3964
  // outlet and merge the empty path matches.
3921
3965
  checkOutletNameUniqueness(mergedChildren);
@@ -3948,7 +3992,7 @@ class Recognizer {
3948
3992
  // NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
3949
3993
  // production bundle size. This value is intended only to surface a warning to users
3950
3994
  // depending on `relativeLinkResolution: 'legacy'` in dev mode.
3951
- (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3995
+ (NG_DEV_MODE$4 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3952
3996
  pathIndexShift));
3953
3997
  matchResult = of({
3954
3998
  snapshot,
@@ -3964,7 +4008,7 @@ class Recognizer {
3964
4008
  return null;
3965
4009
  }
3966
4010
  const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
3967
- const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$3 ?
4011
+ const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$4 ?
3968
4012
  getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3969
4013
  pathIndexShift));
3970
4014
  return { snapshot, consumedSegments, remainingSegments };
@@ -4077,7 +4121,7 @@ function checkOutletNameUniqueness(nodes) {
4077
4121
  if (routeWithSameOutletName) {
4078
4122
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4079
4123
  const c = n.value.url.map(s => s.toString()).join('/');
4080
- throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$3 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4124
+ throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$4 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4081
4125
  }
4082
4126
  names[n.value.outlet] = n.value;
4083
4127
  });
@@ -4133,12 +4177,6 @@ function recognize(injector, rootComponentType, config, serializer, paramsInheri
4133
4177
  * Use of this source code is governed by an MIT-style license that can be
4134
4178
  * found in the LICENSE file at https://angular.io/license
4135
4179
  */
4136
- /**
4137
- * A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a
4138
- * static string or `Route.resolve` if anything else. This allows us to reuse the existing route
4139
- * data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.
4140
- */
4141
- const RouteTitle = Symbol('RouteTitle');
4142
4180
  function resolveData(paramsInheritanceStrategy, moduleInjector) {
4143
4181
  return mergeMap(t => {
4144
4182
  const { targetSnapshot, guards: { canActivateChecks } } = t;
@@ -4154,14 +4192,14 @@ function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, moduleInjec
4154
4192
  const config = futureARS.routeConfig;
4155
4193
  const resolve = futureARS._resolve;
4156
4194
  if (config?.title !== undefined && !hasStaticTitle(config)) {
4157
- resolve[RouteTitle] = config.title;
4195
+ resolve[RouteTitleKey] = config.title;
4158
4196
  }
4159
4197
  return resolveNode(resolve, futureARS, futureRSS, moduleInjector)
4160
4198
  .pipe(map((resolvedData) => {
4161
4199
  futureARS._resolvedData = resolvedData;
4162
4200
  futureARS.data = inheritedParamsDataResolve(futureARS, paramsInheritanceStrategy).resolve;
4163
4201
  if (config && hasStaticTitle(config)) {
4164
- futureARS.data[RouteTitle] = config.title;
4202
+ futureARS.data[RouteTitleKey] = config.title;
4165
4203
  }
4166
4204
  return null;
4167
4205
  }));
@@ -4212,6 +4250,90 @@ function switchTap(next) {
4212
4250
  });
4213
4251
  }
4214
4252
 
4253
+ /**
4254
+ * @license
4255
+ * Copyright Google LLC All Rights Reserved.
4256
+ *
4257
+ * Use of this source code is governed by an MIT-style license that can be
4258
+ * found in the LICENSE file at https://angular.io/license
4259
+ */
4260
+ /**
4261
+ * Provides a strategy for setting the page title after a router navigation.
4262
+ *
4263
+ * The built-in implementation traverses the router state snapshot and finds the deepest primary
4264
+ * outlet with `title` property. Given the `Routes` below, navigating to
4265
+ * `/base/child(popup:aux)` would result in the document title being set to "child".
4266
+ * ```
4267
+ * [
4268
+ * {path: 'base', title: 'base', children: [
4269
+ * {path: 'child', title: 'child'},
4270
+ * ],
4271
+ * {path: 'aux', outlet: 'popup', title: 'popupTitle'}
4272
+ * ]
4273
+ * ```
4274
+ *
4275
+ * This class can be used as a base class for custom title strategies. That is, you can create your
4276
+ * own class that extends the `TitleStrategy`. Note that in the above example, the `title`
4277
+ * from the named outlet is never used. However, a custom strategy might be implemented to
4278
+ * incorporate titles in named outlets.
4279
+ *
4280
+ * @publicApi
4281
+ * @see [Page title guide](guide/router#setting-the-page-title)
4282
+ */
4283
+ class TitleStrategy {
4284
+ /**
4285
+ * @returns The `title` of the deepest primary route.
4286
+ */
4287
+ buildTitle(snapshot) {
4288
+ let pageTitle;
4289
+ let route = snapshot.root;
4290
+ while (route !== undefined) {
4291
+ pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;
4292
+ route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
4293
+ }
4294
+ return pageTitle;
4295
+ }
4296
+ /**
4297
+ * Given an `ActivatedRouteSnapshot`, returns the final value of the
4298
+ * `Route.title` property, which can either be a static string or a resolved value.
4299
+ */
4300
+ getResolvedTitleForRoute(snapshot) {
4301
+ return snapshot.data[RouteTitleKey];
4302
+ }
4303
+ }
4304
+ TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4305
+ TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4306
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: TitleStrategy, decorators: [{
4307
+ type: Injectable,
4308
+ args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4309
+ }] });
4310
+ /**
4311
+ * The default `TitleStrategy` used by the router that updates the title using the `Title` service.
4312
+ */
4313
+ class DefaultTitleStrategy extends TitleStrategy {
4314
+ constructor(title) {
4315
+ super();
4316
+ this.title = title;
4317
+ }
4318
+ /**
4319
+ * Sets the title of the browser to the given value.
4320
+ *
4321
+ * @param title The `pageTitle` from the deepest primary route.
4322
+ */
4323
+ updateTitle(snapshot) {
4324
+ const title = this.buildTitle(snapshot);
4325
+ if (title !== undefined) {
4326
+ this.title.setTitle(title);
4327
+ }
4328
+ }
4329
+ }
4330
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4331
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4332
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4333
+ type: Injectable,
4334
+ args: [{ providedIn: 'root' }]
4335
+ }], ctorParameters: function () { return [{ type: i1.Title }]; } });
4336
+
4215
4337
  /**
4216
4338
  * @license
4217
4339
  * Copyright Google LLC All Rights Reserved.
@@ -4277,6 +4399,24 @@ class BaseRouteReuseStrategy {
4277
4399
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4278
4400
  }
4279
4401
 
4402
+ /**
4403
+ * @license
4404
+ * Copyright Google LLC All Rights Reserved.
4405
+ *
4406
+ * Use of this source code is governed by an MIT-style license that can be
4407
+ * found in the LICENSE file at https://angular.io/license
4408
+ */
4409
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4410
+ /**
4411
+ * A [DI token](guide/glossary/#di-token) for the router service.
4412
+ *
4413
+ * @publicApi
4414
+ */
4415
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
4416
+ providedIn: 'root',
4417
+ factory: () => ({}),
4418
+ });
4419
+
4280
4420
  /**
4281
4421
  * @license
4282
4422
  * Copyright Google LLC All Rights Reserved.
@@ -4383,10 +4523,11 @@ class RouterConfigLoader {
4383
4523
  }));
4384
4524
  }
4385
4525
  }
4386
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4387
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterConfigLoader });
4388
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4389
- type: Injectable
4526
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4527
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4528
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4529
+ type: Injectable,
4530
+ args: [{ providedIn: 'root' }]
4390
4531
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4391
4532
 
4392
4533
  /**
@@ -4454,6 +4595,52 @@ const subsetMatchOptions = {
4454
4595
  matrixParams: 'ignored',
4455
4596
  queryParams: 'subset'
4456
4597
  };
4598
+ function assignExtraOptionsToRouter(opts, router) {
4599
+ if (opts.errorHandler) {
4600
+ router.errorHandler = opts.errorHandler;
4601
+ }
4602
+ if (opts.malformedUriErrorHandler) {
4603
+ router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
4604
+ }
4605
+ if (opts.onSameUrlNavigation) {
4606
+ router.onSameUrlNavigation = opts.onSameUrlNavigation;
4607
+ }
4608
+ if (opts.paramsInheritanceStrategy) {
4609
+ router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
4610
+ }
4611
+ if (opts.relativeLinkResolution) {
4612
+ router.relativeLinkResolution = opts.relativeLinkResolution;
4613
+ }
4614
+ if (opts.urlUpdateStrategy) {
4615
+ router.urlUpdateStrategy = opts.urlUpdateStrategy;
4616
+ }
4617
+ if (opts.canceledNavigationResolution) {
4618
+ router.canceledNavigationResolution = opts.canceledNavigationResolution;
4619
+ }
4620
+ }
4621
+ function setupRouter() {
4622
+ const urlSerializer = inject(UrlSerializer);
4623
+ const contexts = inject(ChildrenOutletContexts);
4624
+ const location = inject(Location);
4625
+ const injector = inject(Injector);
4626
+ const compiler = inject(Compiler);
4627
+ const config = inject(ROUTES, { optional: true }) ?? [];
4628
+ const opts = inject(ROUTER_CONFIGURATION, { optional: true }) ?? {};
4629
+ const defaultTitleStrategy = inject(DefaultTitleStrategy);
4630
+ const titleStrategy = inject(TitleStrategy, { optional: true });
4631
+ const urlHandlingStrategy = inject(UrlHandlingStrategy, { optional: true });
4632
+ const routeReuseStrategy = inject(RouteReuseStrategy, { optional: true });
4633
+ const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
4634
+ if (urlHandlingStrategy) {
4635
+ router.urlHandlingStrategy = urlHandlingStrategy;
4636
+ }
4637
+ if (routeReuseStrategy) {
4638
+ router.routeReuseStrategy = routeReuseStrategy;
4639
+ }
4640
+ router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
4641
+ assignExtraOptionsToRouter(opts, router);
4642
+ return router;
4643
+ }
4457
4644
  /**
4458
4645
  * @description
4459
4646
  *
@@ -4642,10 +4829,11 @@ class Router {
4642
4829
  // Extract URL
4643
4830
  map(t => ({ ...t, extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl) })),
4644
4831
  // Using switchMap so we cancel executing navigations when a new one comes in
4645
- switchMap(t => {
4832
+ switchMap(overallTransitionState => {
4646
4833
  let completed = false;
4647
4834
  let errored = false;
4648
- return of(t).pipe(
4835
+ return of(overallTransitionState)
4836
+ .pipe(
4649
4837
  // Store the Navigation object
4650
4838
  tap(t => {
4651
4839
  this.currentNavigation = {
@@ -4664,8 +4852,8 @@ class Router {
4664
4852
  t.extractedUrl.toString() !== browserUrlTree ||
4665
4853
  // Navigations which succeed or ones which fail and are cleaned up
4666
4854
  // correctly should result in `browserUrlTree` and `currentUrlTree`
4667
- // matching. If this is not the case, assume something went wrong and try
4668
- // processing the URL again.
4855
+ // matching. If this is not the case, assume something went wrong and
4856
+ // try processing the URL again.
4669
4857
  browserUrlTree !== this.currentUrlTree.toString();
4670
4858
  const processCurrentUrl = (this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
4671
4859
  this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
@@ -4696,11 +4884,13 @@ class Router {
4696
4884
  ...this.currentNavigation,
4697
4885
  finalUrl: t.urlAfterRedirects
4698
4886
  };
4887
+ overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4699
4888
  }),
4700
4889
  // Recognize
4701
4890
  recognize(this.ngModule.injector, this.rootComponentType, this.config, this.urlSerializer, this.paramsInheritanceStrategy, this.relativeLinkResolution),
4702
4891
  // Update URL if in `eager` update mode
4703
4892
  tap(t => {
4893
+ overallTransitionState.targetSnapshot = t.targetSnapshot;
4704
4894
  if (this.urlUpdateStrategy === 'eager') {
4705
4895
  if (!t.extras.skipLocationChange) {
4706
4896
  const rawUrl = this.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
@@ -4716,26 +4906,27 @@ class Router {
4716
4906
  else {
4717
4907
  const processPreviousUrl = urlTransition && this.rawUrlTree &&
4718
4908
  this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree);
4719
- /* When the current URL shouldn't be processed, but the previous one was,
4720
- * we handle this "error condition" by navigating to the previously
4721
- * successful URL, but leaving the URL intact.*/
4909
+ /* When the current URL shouldn't be processed, but the previous one
4910
+ * was, we handle this "error condition" by navigating to the
4911
+ * previously successful URL, but leaving the URL intact.*/
4722
4912
  if (processPreviousUrl) {
4723
4913
  const { id, extractedUrl, source, restoredState, extras } = t;
4724
4914
  const navStart = new NavigationStart(id, this.serializeUrl(extractedUrl), source, restoredState);
4725
4915
  eventsSubject.next(navStart);
4726
4916
  const targetSnapshot = createEmptyState(extractedUrl, this.rootComponentType).snapshot;
4727
- return of({
4917
+ overallTransitionState = {
4728
4918
  ...t,
4729
4919
  targetSnapshot,
4730
4920
  urlAfterRedirects: extractedUrl,
4731
4921
  extras: { ...extras, skipLocationChange: false, replaceUrl: false },
4732
- });
4922
+ };
4923
+ return of(overallTransitionState);
4733
4924
  }
4734
4925
  else {
4735
- /* When neither the current or previous URL can be processed, do nothing
4736
- * other than update router's internal reference to the current "settled"
4737
- * URL. This way the next navigation will be coming from the current URL
4738
- * in the browser.
4926
+ /* When neither the current or previous URL can be processed, do
4927
+ * nothing other than update router's internal reference to the
4928
+ * current "settled" URL. This way the next navigation will be coming
4929
+ * from the current URL in the browser.
4739
4930
  */
4740
4931
  this.rawUrlTree = t.rawUrl;
4741
4932
  t.resolve(null);
@@ -4747,10 +4938,14 @@ class Router {
4747
4938
  tap(t => {
4748
4939
  const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4749
4940
  this.triggerEvent(guardsStart);
4750
- }), map(t => ({
4751
- ...t,
4752
- guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
4753
- })), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
4941
+ }), map(t => {
4942
+ overallTransitionState = {
4943
+ ...t,
4944
+ guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
4945
+ };
4946
+ return overallTransitionState;
4947
+ }), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
4948
+ overallTransitionState.guardsResult = t.guardsResult;
4754
4949
  if (isUrlTree(t.guardsResult)) {
4755
4950
  throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
4756
4951
  }
@@ -4810,13 +5005,14 @@ class Router {
4810
5005
  .pipe(defaultIfEmpty(), take(1));
4811
5006
  }), switchTap(() => this.afterPreactivation()), map((t) => {
4812
5007
  const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4813
- return ({ ...t, targetRouterState });
5008
+ overallTransitionState = { ...t, targetRouterState };
5009
+ return (overallTransitionState);
4814
5010
  }),
4815
- /* Once here, we are about to activate synchronously. The assumption is this
4816
- will succeed, and user code may read from the Router service. Therefore
4817
- before activation, we need to update router properties storing the current
4818
- URL and the RouterState, as well as updated the browser URL. All this should
4819
- happen *before* activating. */
5011
+ /* Once here, we are about to activate synchronously. The assumption is
5012
+ this will succeed, and user code may read from the Router service.
5013
+ Therefore before activation, we need to update router properties storing
5014
+ the current URL and the RouterState, as well as updated the browser URL.
5015
+ All this should happen *before* activating. */
4820
5016
  tap((t) => {
4821
5017
  this.currentUrlTree = t.urlAfterRedirects;
4822
5018
  this.rawUrlTree =
@@ -4836,81 +5032,75 @@ class Router {
4836
5032
  completed = true;
4837
5033
  }
4838
5034
  }), finalize(() => {
4839
- /* When the navigation stream finishes either through error or success, we
4840
- * set the `completed` or `errored` flag. However, there are some situations
4841
- * where we could get here without either of those being set. For instance, a
4842
- * redirect during NavigationStart. Therefore, this is a catch-all to make
4843
- * sure the NavigationCancel
4844
- * event is fired when a navigation gets cancelled but not caught by other
4845
- * means. */
5035
+ /* When the navigation stream finishes either through error or success,
5036
+ * we set the `completed` or `errored` flag. However, there are some
5037
+ * situations where we could get here without either of those being set.
5038
+ * For instance, a redirect during NavigationStart. Therefore, this is a
5039
+ * catch-all to make sure the NavigationCancel event is fired when a
5040
+ * navigation gets cancelled but not caught by other means. */
4846
5041
  if (!completed && !errored) {
4847
5042
  const cancelationReason = NG_DEV_MODE$1 ?
4848
- `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}` :
5043
+ `Navigation ID ${overallTransitionState
5044
+ .id} is not equal to the current navigation id ${this.navigationId}` :
4849
5045
  '';
4850
- this.cancelNavigationTransition(t, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
5046
+ this.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
4851
5047
  }
4852
5048
  // Only clear current navigation if it is still set to the one that
4853
5049
  // finalized.
4854
- if (this.currentNavigation?.id === t.id) {
5050
+ if (this.currentNavigation?.id === overallTransitionState.id) {
4855
5051
  this.currentNavigation = null;
4856
5052
  }
4857
5053
  }), catchError((e) => {
4858
- // TODO(atscott): The NavigationTransition `t` used here does not accurately
4859
- // reflect the current state of the whole transition because some operations
4860
- // return a new object rather than modifying the one in the outermost
4861
- // `switchMap`.
4862
- // The fix can likely be to:
4863
- // 1. Rename the outer `t` variable so it's not shadowed all the time and
4864
- // confusing
4865
- // 2. Keep reassigning to the outer variable after each stage to ensure it
4866
- // gets updated. Or change the implementations to not return a copy.
4867
- // Not changed yet because it affects existing code and would need to be
4868
- // tested more thoroughly.
4869
5054
  errored = true;
4870
5055
  /* This error type is issued during Redirect, and is handled as a
4871
5056
  * cancellation rather than an error. */
4872
5057
  if (isNavigationCancelingError$1(e)) {
4873
5058
  if (!isRedirectingNavigationCancelingError$1(e)) {
4874
- // Set property only if we're not redirecting. If we landed on a page and
4875
- // redirect to `/` route, the new navigation is going to see the `/`
4876
- // isn't a change from the default currentUrlTree and won't navigate.
4877
- // This is only applicable with initial navigation, so setting
4878
- // `navigated` only when not redirecting resolves this scenario.
5059
+ // Set property only if we're not redirecting. If we landed on a page
5060
+ // and redirect to `/` route, the new navigation is going to see the
5061
+ // `/` isn't a change from the default currentUrlTree and won't
5062
+ // navigate. This is only applicable with initial navigation, so
5063
+ // setting `navigated` only when not redirecting resolves this
5064
+ // scenario.
4879
5065
  this.navigated = true;
4880
- this.restoreHistory(t, true);
5066
+ this.restoreHistory(overallTransitionState, true);
4881
5067
  }
4882
- const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message, e.cancellationCode);
5068
+ const navCancel = new NavigationCancel(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4883
5069
  eventsSubject.next(navCancel);
4884
5070
  // When redirecting, we need to delay resolving the navigation
4885
5071
  // promise and push it to the redirect navigation
4886
5072
  if (!isRedirectingNavigationCancelingError$1(e)) {
4887
- t.resolve(false);
5073
+ overallTransitionState.resolve(false);
4888
5074
  }
4889
5075
  else {
4890
5076
  const mergedTree = this.urlHandlingStrategy.merge(e.url, this.rawUrlTree);
4891
5077
  const extras = {
4892
- skipLocationChange: t.extras.skipLocationChange,
5078
+ skipLocationChange: overallTransitionState.extras.skipLocationChange,
4893
5079
  // The URL is already updated at this point if we have 'eager' URL
4894
5080
  // updates or if the navigation was triggered by the browser (back
4895
- // button, URL bar, etc). We want to replace that item in history if
4896
- // the navigation is rejected.
5081
+ // button, URL bar, etc). We want to replace that item in history
5082
+ // if the navigation is rejected.
4897
5083
  replaceUrl: this.urlUpdateStrategy === 'eager' ||
4898
- isBrowserTriggeredNavigation(t.source)
5084
+ isBrowserTriggeredNavigation(overallTransitionState.source)
4899
5085
  };
4900
- this.scheduleNavigation(mergedTree, 'imperative', null, extras, { resolve: t.resolve, reject: t.reject, promise: t.promise });
5086
+ this.scheduleNavigation(mergedTree, 'imperative', null, extras, {
5087
+ resolve: overallTransitionState.resolve,
5088
+ reject: overallTransitionState.reject,
5089
+ promise: overallTransitionState.promise
5090
+ });
4901
5091
  }
4902
- /* All other errors should reset to the router's internal URL reference to
4903
- * the pre-error state. */
5092
+ /* All other errors should reset to the router's internal URL reference
5093
+ * to the pre-error state. */
4904
5094
  }
4905
5095
  else {
4906
- this.restoreHistory(t, true);
4907
- const navError = new NavigationError(t.id, this.serializeUrl(t.extractedUrl), e, t.targetSnapshot ?? undefined);
5096
+ this.restoreHistory(overallTransitionState, true);
5097
+ const navError = new NavigationError(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? undefined);
4908
5098
  eventsSubject.next(navError);
4909
5099
  try {
4910
- t.resolve(this.errorHandler(e));
5100
+ overallTransitionState.resolve(this.errorHandler(e));
4911
5101
  }
4912
5102
  catch (ee) {
4913
- t.reject(ee);
5103
+ overallTransitionState.reject(ee);
4914
5104
  }
4915
5105
  }
4916
5106
  return EMPTY;
@@ -5362,10 +5552,14 @@ class Router {
5362
5552
  return { navigationId };
5363
5553
  }
5364
5554
  }
5365
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5366
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: Router });
5367
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: Router, decorators: [{
5368
- type: Injectable
5555
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5556
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5557
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: Router, decorators: [{
5558
+ type: Injectable,
5559
+ args: [{
5560
+ providedIn: 'root',
5561
+ useFactory: setupRouter,
5562
+ }]
5369
5563
  }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5370
5564
  function validateCommands(commands) {
5371
5565
  for (let i = 0; i < commands.length; i++) {
@@ -5563,11 +5757,14 @@ class RouterLink {
5563
5757
  });
5564
5758
  }
5565
5759
  }
5566
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5567
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-rc.0", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5568
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLink, decorators: [{
5760
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5761
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterLink, isStandalone: true, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5762
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLink, decorators: [{
5569
5763
  type: Directive,
5570
- args: [{ selector: ':not(a):not(area)[routerLink]' }]
5764
+ args: [{
5765
+ selector: ':not(a):not(area)[routerLink]',
5766
+ standalone: true,
5767
+ }]
5571
5768
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
5572
5769
  type: Attribute,
5573
5770
  args: ['tabindex']
@@ -5682,11 +5879,11 @@ class RouterLinkWithHref {
5682
5879
  });
5683
5880
  }
5684
5881
  }
5685
- RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5686
- RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-rc.0", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5687
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5882
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5883
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterLinkWithHref, isStandalone: true, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5884
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5688
5885
  type: Directive,
5689
- args: [{ selector: 'a[routerLink],area[routerLink]' }]
5886
+ args: [{ selector: 'a[routerLink],area[routerLink]', standalone: true }]
5690
5887
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
5691
5888
  type: HostBinding,
5692
5889
  args: ['attr.target']
@@ -5909,13 +6106,14 @@ class RouterLinkActive {
5909
6106
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5910
6107
  }
5911
6108
  }
5912
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
5913
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-rc.0", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
5914
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterLinkActive, decorators: [{
6109
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6110
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6111
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkActive, decorators: [{
5915
6112
  type: Directive,
5916
6113
  args: [{
5917
6114
  selector: '[routerLinkActive]',
5918
6115
  exportAs: 'routerLinkActive',
6116
+ standalone: true,
5919
6117
  }]
5920
6118
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: RouterLink, decorators: [{
5921
6119
  type: Optional
@@ -5943,84 +6141,6 @@ function isActiveMatchOptions(options) {
5943
6141
  return !!options.paths;
5944
6142
  }
5945
6143
 
5946
- /**
5947
- * @license
5948
- * Copyright Google LLC All Rights Reserved.
5949
- *
5950
- * Use of this source code is governed by an MIT-style license that can be
5951
- * found in the LICENSE file at https://angular.io/license
5952
- */
5953
- /**
5954
- * Provides a strategy for setting the page title after a router navigation.
5955
- *
5956
- * The built-in implementation traverses the router state snapshot and finds the deepest primary
5957
- * outlet with `title` property. Given the `Routes` below, navigating to
5958
- * `/base/child(popup:aux)` would result in the document title being set to "child".
5959
- * ```
5960
- * [
5961
- * {path: 'base', title: 'base', children: [
5962
- * {path: 'child', title: 'child'},
5963
- * ],
5964
- * {path: 'aux', outlet: 'popup', title: 'popupTitle'}
5965
- * ]
5966
- * ```
5967
- *
5968
- * This class can be used as a base class for custom title strategies. That is, you can create your
5969
- * own class that extends the `TitleStrategy`. Note that in the above example, the `title`
5970
- * from the named outlet is never used. However, a custom strategy might be implemented to
5971
- * incorporate titles in named outlets.
5972
- *
5973
- * @publicApi
5974
- * @see [Page title guide](guide/router#setting-the-page-title)
5975
- */
5976
- class TitleStrategy {
5977
- /**
5978
- * @returns The `title` of the deepest primary route.
5979
- */
5980
- buildTitle(snapshot) {
5981
- let pageTitle;
5982
- let route = snapshot.root;
5983
- while (route !== undefined) {
5984
- pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;
5985
- route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
5986
- }
5987
- return pageTitle;
5988
- }
5989
- /**
5990
- * Given an `ActivatedRouteSnapshot`, returns the final value of the
5991
- * `Route.title` property, which can either be a static string or a resolved value.
5992
- */
5993
- getResolvedTitleForRoute(snapshot) {
5994
- return snapshot.data[RouteTitle];
5995
- }
5996
- }
5997
- /**
5998
- * The default `TitleStrategy` used by the router that updates the title using the `Title` service.
5999
- */
6000
- class DefaultTitleStrategy extends TitleStrategy {
6001
- constructor(title) {
6002
- super();
6003
- this.title = title;
6004
- }
6005
- /**
6006
- * Sets the title of the browser to the given value.
6007
- *
6008
- * @param title The `pageTitle` from the deepest primary route.
6009
- */
6010
- updateTitle(snapshot) {
6011
- const title = this.buildTitle(snapshot);
6012
- if (title !== undefined) {
6013
- this.title.setTitle(title);
6014
- }
6015
- }
6016
- }
6017
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
6018
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
6019
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
6020
- type: Injectable,
6021
- args: [{ providedIn: 'root' }]
6022
- }], ctorParameters: function () { return [{ type: i1.Title }]; } });
6023
-
6024
6144
  /**
6025
6145
  * @license
6026
6146
  * Copyright Google LLC All Rights Reserved.
@@ -6053,9 +6173,9 @@ class PreloadAllModules {
6053
6173
  return fn().pipe(catchError(() => of(null)));
6054
6174
  }
6055
6175
  }
6056
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6057
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6058
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: PreloadAllModules, decorators: [{
6176
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6177
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: PreloadAllModules, decorators: [{
6059
6179
  type: Injectable,
6060
6180
  args: [{ providedIn: 'root' }]
6061
6181
  }] });
@@ -6073,9 +6193,9 @@ class NoPreloading {
6073
6193
  return of(null);
6074
6194
  }
6075
6195
  }
6076
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6077
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6078
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: NoPreloading, decorators: [{
6196
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6197
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6198
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: NoPreloading, decorators: [{
6079
6199
  type: Injectable,
6080
6200
  args: [{ providedIn: 'root' }]
6081
6201
  }] });
@@ -6122,7 +6242,15 @@ class RouterPreloader {
6122
6242
  }
6123
6243
  const injectorForCurrentRoute = route._injector ?? injector;
6124
6244
  const injectorForChildren = route._loadedInjector ?? injectorForCurrentRoute;
6125
- if ((route.loadChildren && !route._loadedRoutes) ||
6245
+ // Note that `canLoad` is only checked as a condition that prevents `loadChildren` and not
6246
+ // `loadComponent`. `canLoad` guards only block loading of child routes by design. This
6247
+ // happens as a consequence of needing to descend into children for route matching immediately
6248
+ // while component loading is deferred until route activation. Because `canLoad` guards can
6249
+ // have side effects, we cannot execute them here so we instead skip preloading altogether
6250
+ // when present. Lastly, it remains to be decided whether `canLoad` should behave this way
6251
+ // at all. Code splitting and lazy loading is separate from client-side authorization checks
6252
+ // and should not be used as a security measure to prevent loading of code.
6253
+ if ((route.loadChildren && !route._loadedRoutes && route.canLoad === undefined) ||
6126
6254
  (route.loadComponent && !route._loadedComponent)) {
6127
6255
  res.push(this.preloadConfig(injectorForCurrentRoute, route));
6128
6256
  }
@@ -6161,9 +6289,9 @@ class RouterPreloader {
6161
6289
  });
6162
6290
  }
6163
6291
  }
6164
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6165
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterPreloader });
6166
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterPreloader, decorators: [{
6292
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6293
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterPreloader });
6294
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterPreloader, decorators: [{
6167
6295
  type: Injectable
6168
6296
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6169
6297
 
@@ -6250,9 +6378,9 @@ class RouterScroller {
6250
6378
  }
6251
6379
  }
6252
6380
  }
6253
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6254
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterScroller });
6255
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterScroller, decorators: [{
6381
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6382
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterScroller });
6383
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterScroller, decorators: [{
6256
6384
  type: Injectable
6257
6385
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6258
6386
 
@@ -6268,36 +6396,26 @@ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
6268
6396
  * The directives defined in the `RouterModule`.
6269
6397
  */
6270
6398
  const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent];
6271
- /**
6272
- * A [DI token](guide/glossary/#di-token) for the router service.
6273
- *
6274
- * @publicApi
6275
- */
6276
- const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE ? 'router config' : 'ROUTER_CONFIGURATION', {
6277
- providedIn: 'root',
6278
- factory: () => ({}),
6279
- });
6280
6399
  /**
6281
6400
  * @docsNotRequired
6282
6401
  */
6283
6402
  const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
6284
6403
  const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
6404
+ // TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
6405
+ // here to avoid a breaking change whereby the provider order matters based on where the
6406
+ // `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
6407
+ // change in a major version.
6285
6408
  const ROUTER_PROVIDERS = [
6286
6409
  Location,
6287
6410
  { provide: UrlSerializer, useClass: DefaultUrlSerializer },
6288
- {
6289
- provide: Router,
6290
- useFactory: setupRouter,
6291
- deps: [
6292
- UrlSerializer, ChildrenOutletContexts, Location, Injector, Compiler, ROUTES,
6293
- ROUTER_CONFIGURATION, DefaultTitleStrategy, [TitleStrategy, new Optional()],
6294
- [UrlHandlingStrategy, new Optional()], [RouteReuseStrategy, new Optional()]
6295
- ]
6296
- },
6411
+ { provide: Router, useFactory: setupRouter },
6297
6412
  ChildrenOutletContexts,
6298
6413
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6299
6414
  RouterConfigLoader,
6300
6415
  ];
6416
+ function rootRoute(router) {
6417
+ return router.routerState.root;
6418
+ }
6301
6419
  function routerNgProbeToken() {
6302
6420
  return new NgProbeToken('Router', Router);
6303
6421
  }
@@ -6323,8 +6441,7 @@ function routerNgProbeToken() {
6323
6441
  * @publicApi
6324
6442
  */
6325
6443
  class RouterModule {
6326
- // Note: We are injecting the Router so it gets created eagerly...
6327
- constructor(guard, router) { }
6444
+ constructor(guard) { }
6328
6445
  /**
6329
6446
  * Creates and configures a module with all the router providers and directives.
6330
6447
  * Optionally sets up an application listener to perform an initial navigation.
@@ -6385,13 +6502,13 @@ class RouterModule {
6385
6502
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6386
6503
  }
6387
6504
  }
6388
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6389
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6390
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterModule });
6391
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterModule, decorators: [{
6505
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6506
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6507
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
6508
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, decorators: [{
6392
6509
  type: NgModule,
6393
6510
  args: [{
6394
- declarations: ROUTER_DIRECTIVES,
6511
+ imports: ROUTER_DIRECTIVES,
6395
6512
  exports: ROUTER_DIRECTIVES,
6396
6513
  }]
6397
6514
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
@@ -6399,8 +6516,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", ng
6399
6516
  }, {
6400
6517
  type: Inject,
6401
6518
  args: [ROUTER_FORROOT_GUARD]
6402
- }] }, { type: Router, decorators: [{
6403
- type: Optional
6404
6519
  }] }]; } });
6405
6520
  function provideRouterScroller() {
6406
6521
  return {
@@ -6446,48 +6561,9 @@ function provideForRootGuard(router) {
6446
6561
  */
6447
6562
  function provideRoutes(routes) {
6448
6563
  return [
6449
- { provide: ANALYZE_FOR_ENTRY_COMPONENTS, multi: true, useValue: routes },
6450
6564
  { provide: ROUTES, multi: true, useValue: routes },
6451
6565
  ];
6452
6566
  }
6453
- function setupRouter(urlSerializer, contexts, location, injector, compiler, config, opts = {}, defaultTitleStrategy, titleStrategy, urlHandlingStrategy, routeReuseStrategy) {
6454
- const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
6455
- if (urlHandlingStrategy) {
6456
- router.urlHandlingStrategy = urlHandlingStrategy;
6457
- }
6458
- if (routeReuseStrategy) {
6459
- router.routeReuseStrategy = routeReuseStrategy;
6460
- }
6461
- router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
6462
- assignExtraOptionsToRouter(opts, router);
6463
- return router;
6464
- }
6465
- function assignExtraOptionsToRouter(opts, router) {
6466
- if (opts.errorHandler) {
6467
- router.errorHandler = opts.errorHandler;
6468
- }
6469
- if (opts.malformedUriErrorHandler) {
6470
- router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
6471
- }
6472
- if (opts.onSameUrlNavigation) {
6473
- router.onSameUrlNavigation = opts.onSameUrlNavigation;
6474
- }
6475
- if (opts.paramsInheritanceStrategy) {
6476
- router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
6477
- }
6478
- if (opts.relativeLinkResolution) {
6479
- router.relativeLinkResolution = opts.relativeLinkResolution;
6480
- }
6481
- if (opts.urlUpdateStrategy) {
6482
- router.urlUpdateStrategy = opts.urlUpdateStrategy;
6483
- }
6484
- if (opts.canceledNavigationResolution) {
6485
- router.canceledNavigationResolution = opts.canceledNavigationResolution;
6486
- }
6487
- }
6488
- function rootRoute(router) {
6489
- return router.routerState.root;
6490
- }
6491
6567
  function getBootstrapListener() {
6492
6568
  const injector = inject(Injector);
6493
6569
  return (bootstrappedComponentRef) => {
@@ -6497,8 +6573,7 @@ function getBootstrapListener() {
6497
6573
  }
6498
6574
  const router = injector.get(Router);
6499
6575
  const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6500
- // Default case
6501
- if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
6576
+ if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
6502
6577
  router.initialNavigation();
6503
6578
  }
6504
6579
  injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
@@ -6542,7 +6617,7 @@ const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicato
6542
6617
  });
6543
6618
  function provideEnabledBlockingInitialNavigation() {
6544
6619
  return [
6545
- { provide: INITIAL_NAVIGATION, useValue: 'enabledBlocking' },
6620
+ { provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
6546
6621
  {
6547
6622
  provide: APP_INITIALIZER,
6548
6623
  multi: true,
@@ -6608,7 +6683,7 @@ function provideEnabledBlockingInitialNavigation() {
6608
6683
  },
6609
6684
  ];
6610
6685
  }
6611
- const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
6686
+ const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
6612
6687
  function provideDisabledInitialNavigation() {
6613
6688
  return [
6614
6689
  {
@@ -6621,7 +6696,7 @@ function provideDisabledInitialNavigation() {
6621
6696
  };
6622
6697
  }
6623
6698
  },
6624
- { provide: INITIAL_NAVIGATION, useValue: 'disabled' }
6699
+ { provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
6625
6700
  ];
6626
6701
  }
6627
6702
  function provideTracing() {
@@ -6664,7 +6739,7 @@ function providePreloading(preloadingStrategy) {
6664
6739
  /**
6665
6740
  * @publicApi
6666
6741
  */
6667
- const VERSION = new Version('14.1.0-rc.0');
6742
+ const VERSION = new Version('14.2.0-next.0');
6668
6743
 
6669
6744
  /**
6670
6745
  * @license
@@ -6703,5 +6778,5 @@ const VERSION = new Version('14.1.0-rc.0');
6703
6778
  * Generated bundle index. Do not edit.
6704
6779
  */
6705
6780
 
6706
- export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
6781
+ export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
6707
6782
  //# sourceMappingURL=router.mjs.map