@angular/router 15.1.0-next.0 → 15.1.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/esm2020/src/components/empty_outlet.mjs +3 -3
  2. package/esm2020/src/deprecated_load_children.mjs +3 -1
  3. package/esm2020/src/directives/router_link.mjs +3 -3
  4. package/esm2020/src/directives/router_link_active.mjs +3 -3
  5. package/esm2020/src/directives/router_outlet.mjs +3 -3
  6. package/esm2020/src/index.mjs +1 -1
  7. package/esm2020/src/models.mjs +1 -1
  8. package/esm2020/src/navigation_transition.mjs +145 -84
  9. package/esm2020/src/page_title_strategy.mjs +6 -6
  10. package/esm2020/src/private_export.mjs +1 -1
  11. package/esm2020/src/provide_router.mjs +6 -3
  12. package/esm2020/src/route_reuse_strategy.mjs +6 -6
  13. package/esm2020/src/router.mjs +34 -93
  14. package/esm2020/src/router_config.mjs +1 -1
  15. package/esm2020/src/router_config_loader.mjs +3 -3
  16. package/esm2020/src/router_module.mjs +9 -7
  17. package/esm2020/src/router_outlet_context.mjs +3 -3
  18. package/esm2020/src/router_preloader.mjs +9 -9
  19. package/esm2020/src/router_scroller.mjs +20 -21
  20. package/esm2020/src/router_state.mjs +1 -1
  21. package/esm2020/src/url_handling_strategy.mjs +6 -6
  22. package/esm2020/src/url_tree.mjs +4 -4
  23. package/esm2020/src/version.mjs +1 -1
  24. package/esm2020/testing/src/router_testing_module.mjs +4 -4
  25. package/fesm2015/router.mjs +392 -387
  26. package/fesm2015/router.mjs.map +1 -1
  27. package/fesm2015/testing.mjs +5 -5
  28. package/fesm2015/upgrade.mjs +1 -1
  29. package/fesm2020/router.mjs +386 -386
  30. package/fesm2020/router.mjs.map +1 -1
  31. package/fesm2020/testing.mjs +5 -5
  32. package/fesm2020/upgrade.mjs +1 -1
  33. package/index.d.ts +75 -49
  34. package/package.json +4 -4
  35. package/testing/index.d.ts +1 -1
  36. package/upgrade/index.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.1.0-next.0
2
+ * @license Angular v15.1.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -87,16 +87,16 @@ class RouterTestingModule {
87
87
  };
88
88
  }
89
89
  }
90
- RouterTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
91
- RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] });
92
- RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterTestingModule, providers: [
90
+ RouterTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.1", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
91
+ RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0-next.1", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] });
92
+ RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0-next.1", ngImport: i0, type: RouterTestingModule, providers: [
93
93
  ɵROUTER_PROVIDERS,
94
94
  EXTRA_ROUTER_TESTING_PROVIDERS,
95
95
  provideLocationMocks(),
96
96
  ɵwithPreloading(NoPreloading).ɵproviders,
97
97
  { provide: ROUTES, multi: true, useValue: [] },
98
98
  ], imports: [RouterModule] });
99
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterTestingModule, decorators: [{
99
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.1", ngImport: i0, type: RouterTestingModule, decorators: [{
100
100
  type: NgModule,
101
101
  args: [{
102
102
  exports: [RouterModule],
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.1.0-next.0
2
+ * @license Angular v15.1.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.1.0-next.0
2
+ * @license Angular v15.1.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -580,6 +580,7 @@ export declare type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedR
580
580
  * ```
581
581
  *
582
582
  * @publicApi
583
+ * @deprecated Use `CanMatch` instead
583
584
  */
584
585
  export declare interface CanLoad {
585
586
  canLoad(route: Route, segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
@@ -591,6 +592,8 @@ export declare interface CanLoad {
591
592
  * @publicApi
592
593
  * @see `CanLoad`
593
594
  * @see `Route`
595
+ * @see `CanMatchFn`
596
+ * @deprecated Use `Route.canMatch` and `CanMatchFn` instead
594
597
  */
595
598
  export declare type CanLoadFn = (route: Route, segments: UrlSegment[]) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
596
599
 
@@ -1313,7 +1316,7 @@ export declare interface IsActiveMatchOptions {
1313
1316
  * @see `LoadChildrenCallback`
1314
1317
  * @publicApi
1315
1318
  */
1316
- export declare type LoadChildren = LoadChildrenCallback | ɵDeprecatedLoadChildren;
1319
+ export declare type LoadChildren = LoadChildrenCallback;
1317
1320
 
1318
1321
  /**
1319
1322
  *
@@ -1435,6 +1438,16 @@ export declare interface Navigation {
1435
1438
  * @publicApi
1436
1439
  */
1437
1440
  export declare interface NavigationBehaviorOptions {
1441
+ /**
1442
+ * How to handle a navigation request to the current URL.
1443
+ *
1444
+ * This value is a subset of the options available in `OnSameUrlNavigation` and
1445
+ * will take precedence over the default value set for the `Router`.
1446
+ *
1447
+ * @see `OnSameUrlNavigation`
1448
+ * @see `RouterConfigOptions`
1449
+ */
1450
+ onSameUrlNavigation?: Extract<OnSameUrlNavigation, 'reload'>;
1438
1451
  /**
1439
1452
  * When true, navigates without pushing a new state into history.
1440
1453
  *
@@ -1761,6 +1774,32 @@ export declare class NoPreloading implements PreloadingStrategy {
1761
1774
  static ɵprov: i0.ɵɵInjectableDeclaration<NoPreloading>;
1762
1775
  }
1763
1776
 
1777
+ /**
1778
+ * How to handle a navigation request to the current URL. One of:
1779
+ *
1780
+ * - `'ignore'` : The router ignores the request it is the same as the current state.
1781
+ * - `'reload'` : The router processes the URL even if it is not different from the current state.
1782
+ * One example of when you might want this option is if a `canMatch` guard depends on
1783
+ * application state and initially rejects navigation to a route. After fixing the state, you want
1784
+ * to re-navigate to the same URL so the route with the `canMatch` guard can activate.
1785
+ *
1786
+ * Note that this only configures whether the Route reprocesses the URL and triggers related
1787
+ * action and events like redirects, guards, and resolvers. By default, the router re-uses a
1788
+ * component instance when it re-navigates to the same component type without visiting a different
1789
+ * component first. This behavior is configured by the `RouteReuseStrategy`. In order to reload
1790
+ * routed components on same url navigation, you need to set `onSameUrlNavigation` to `'reload'`
1791
+ * _and_ provide a `RouteReuseStrategy` which returns `false` for `shouldReuseRoute`. Additionally,
1792
+ * resolvers and most guards for routes do not run unless the path or path params changed
1793
+ * (configured by `runGuardsAndResolvers`).
1794
+ *
1795
+ * @publicApi
1796
+ * @see RouteReuseStrategy
1797
+ * @see RunGuardsAndResolvers
1798
+ * @see NavigationBehaviorOptions
1799
+ * @see RouterConfigOptions
1800
+ */
1801
+ export declare type OnSameUrlNavigation = 'reload' | 'ignore';
1802
+
1764
1803
  /**
1765
1804
  * Store contextual information about a `RouterOutlet`
1766
1805
  *
@@ -2466,6 +2505,7 @@ export declare interface Route {
2466
2505
  *
2467
2506
  * When using a function rather than DI tokens, the function can call `inject` to get any required
2468
2507
  * dependencies. This `inject` call must be done in a synchronous context.
2508
+ * @deprecated Use `canMatch` instead
2469
2509
  */
2470
2510
  canLoad?: Array<CanLoadFn | any>;
2471
2511
  /**
@@ -2487,11 +2527,19 @@ export declare interface Route {
2487
2527
  */
2488
2528
  loadChildren?: LoadChildren;
2489
2529
  /**
2490
- * Defines when guards and resolvers will be run. One of
2491
- * - `paramsOrQueryParamsChange` : Run when query parameters change.
2530
+ * A policy for when to run guards and resolvers on a route.
2531
+ *
2532
+ * Guards and/or resolvers will always run when a route is activated or deactivated. When a route
2533
+ * is unchanged, the default behavior is the same as `paramsChange`.
2534
+ *
2535
+ * `paramsChange` : Rerun the guards and resolvers when path or
2536
+ * path param changes. This does not include query parameters. This option is the default.
2492
2537
  * - `always` : Run on every execution.
2493
- * By default, guards and resolvers run only when the matrix
2494
- * parameters of the route change.
2538
+ * - `pathParamsChange` : Rerun guards and resolvers when the path params
2539
+ * change. This does not compare matrix or query parameters.
2540
+ * - `paramsOrQueryParamsChange` : Run when path, matrix, or query parameters change.
2541
+ * - `pathParamsOrQueryParamsChange` : Rerun guards and resolvers when the path params
2542
+ * change or query params have changed. This does not include matrix parameters.
2495
2543
  *
2496
2544
  * @see RunGuardsAndResolvers
2497
2545
  */
@@ -2554,10 +2602,13 @@ export declare class RouteConfigLoadStart {
2554
2602
  * @publicApi
2555
2603
  */
2556
2604
  export declare class Router {
2605
+ private readonly urlSerializer;
2606
+ private readonly rootContexts;
2607
+ private readonly location;
2557
2608
  config: Routes;
2558
- private navigations;
2559
2609
  private disposed;
2560
2610
  private locationSubscription?;
2611
+ private get navigationId();
2561
2612
  /**
2562
2613
  * The id of the currently active page in the router.
2563
2614
  * Updated to the transition's target id on a successful navigation.
@@ -2576,9 +2627,9 @@ export declare class Router {
2576
2627
  private console;
2577
2628
  private isNgZoneEnabled;
2578
2629
  /**
2579
- * An event stream for routing events in this NgModule.
2630
+ * An event stream for routing events.
2580
2631
  */
2581
- readonly events: Observable<Event_2>;
2632
+ get events(): Observable<Event_2>;
2582
2633
  /**
2583
2634
  * The current state of routing in this NgModule.
2584
2635
  */
@@ -2629,24 +2680,15 @@ export declare class Router {
2629
2680
  */
2630
2681
  titleStrategy?: TitleStrategy;
2631
2682
  /**
2632
- * How to handle a navigation request to the current URL. One of:
2683
+ * How to handle a navigation request to the current URL.
2633
2684
  *
2634
- * - `'ignore'` : The router ignores the request.
2635
- * - `'reload'` : The router reloads the URL. Use to implement a "refresh" feature.
2636
- *
2637
- * Note that this only configures whether the Route reprocesses the URL and triggers related
2638
- * action and events like redirects, guards, and resolvers. By default, the router re-uses a
2639
- * component instance when it re-navigates to the same component type without visiting a different
2640
- * component first. This behavior is configured by the `RouteReuseStrategy`. In order to reload
2641
- * routed components on same url navigation, you need to set `onSameUrlNavigation` to `'reload'`
2642
- * _and_ provide a `RouteReuseStrategy` which returns `false` for `shouldReuseRoute`.
2643
2685
  *
2644
2686
  * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.
2645
2687
  * @see `withRouterConfig`
2646
2688
  * @see `provideRouter`
2647
2689
  * @see `RouterModule`
2648
2690
  */
2649
- onSameUrlNavigation: 'reload' | 'ignore';
2691
+ onSameUrlNavigation: OnSameUrlNavigation;
2650
2692
  /**
2651
2693
  * How to merge parameters, data, resolved data, and title from parent to child
2652
2694
  * routes. One of:
@@ -2708,14 +2750,7 @@ export declare class Router {
2708
2750
  */
2709
2751
  constructor(
2710
2752
  /** @internal */
2711
- rootComponentType: Type<any> | null,
2712
- /** @internal */
2713
- urlSerializer: UrlSerializer,
2714
- /** @internal */
2715
- rootContexts: ChildrenOutletContexts,
2716
- /** @internal */
2717
- location: Location_2, injector: Injector, compiler: Compiler, config: Routes);
2718
- private setTransition;
2753
+ rootComponentType: Type<any> | null, urlSerializer: UrlSerializer, rootContexts: ChildrenOutletContexts, location: Location_2, injector: Injector, compiler: Compiler, config: Routes);
2719
2754
  /**
2720
2755
  * Sets up the location change listener and performs the initial navigation.
2721
2756
  */
@@ -2880,7 +2915,6 @@ export declare class Router {
2880
2915
  */
2881
2916
  isActive(url: string | UrlTree, matchOptions: IsActiveMatchOptions): boolean;
2882
2917
  private removeEmptyProps;
2883
- private processNavigations;
2884
2918
  private resetState;
2885
2919
  private resetUrlToCurrentUrlTree;
2886
2920
  private generateNgRouterState;
@@ -2947,13 +2981,13 @@ export declare interface RouterConfigOptions {
2947
2981
  */
2948
2982
  canceledNavigationResolution?: 'replace' | 'computed';
2949
2983
  /**
2950
- * Define what the router should do if it receives a navigation request to the current URL.
2951
- * Default is `ignore`, which causes the router ignores the navigation.
2952
- * This can disable features such as a "refresh" button.
2953
- * Use this option to configure the behavior when navigating to the
2954
- * current URL. Default is 'ignore'.
2984
+ * Configures the default for handling a navigation request to the current URL.
2985
+ *
2986
+ * If unset, the `Router` will use `'ignore'`.
2987
+ *
2988
+ * @see `OnSameUrlNavigation`
2955
2989
  */
2956
- onSameUrlNavigation?: 'reload' | 'ignore';
2990
+ onSameUrlNavigation?: OnSameUrlNavigation;
2957
2991
  /**
2958
2992
  * Defines how the router merges parameters, data, and resolved data from parent to child
2959
2993
  * routes. By default ('emptyOnly'), inherits parent parameters only for
@@ -3964,7 +3998,7 @@ export declare interface UrlCreationOptions {
3964
3998
  * constructor(private router: Router, private route: ActivatedRoute) {}
3965
3999
  *
3966
4000
  * go() {
3967
- * this.router.navigate(['../list'], { relativeTo: this.route });
4001
+ * router.navigate(['../list'], { relativeTo: this.route });
3968
4002
  * }
3969
4003
  * }
3970
4004
  * ```
@@ -3978,7 +4012,7 @@ export declare interface UrlCreationOptions {
3978
4012
  *
3979
4013
  * ```
3980
4014
  * // Navigate to /results?page=1
3981
- * this.router.navigate(['/results'], { queryParams: { page: 1 } });
4015
+ * router.navigate(['/results'], { queryParams: { page: 1 } });
3982
4016
  * ```
3983
4017
  */
3984
4018
  queryParams?: Params | null;
@@ -3987,7 +4021,7 @@ export declare interface UrlCreationOptions {
3987
4021
  *
3988
4022
  * ```
3989
4023
  * // Navigate to /results#top
3990
- * this.router.navigate(['/results'], { fragment: 'top' });
4024
+ * router.navigate(['/results'], { fragment: 'top' });
3991
4025
  * ```
3992
4026
  */
3993
4027
  fragment?: string;
@@ -4000,13 +4034,13 @@ export declare interface UrlCreationOptions {
4000
4034
  * The "preserve" option discards any new query params:
4001
4035
  * ```
4002
4036
  * // from /view1?page=1 to/view2?page=1
4003
- * this.router.navigate(['/view2'], { queryParams: { page: 2 }, queryParamsHandling: "preserve"
4037
+ * router.navigate(['/view2'], { queryParams: { page: 2 }, queryParamsHandling: "preserve"
4004
4038
  * });
4005
4039
  * ```
4006
4040
  * The "merge" option appends new query params to the params from the current URL:
4007
4041
  * ```
4008
4042
  * // from /view1?page=1 to/view2?page=1&otherKey=2
4009
- * this.router.navigate(['/view2'], { queryParams: { otherKey: 2 }, queryParamsHandling: "merge"
4043
+ * router.navigate(['/view2'], { queryParams: { otherKey: 2 }, queryParamsHandling: "merge"
4010
4044
  * });
4011
4045
  * ```
4012
4046
  * In case of a key collision between current parameters and those in the `queryParams` object,
@@ -4019,7 +4053,7 @@ export declare interface UrlCreationOptions {
4019
4053
  *
4020
4054
  * ```
4021
4055
  * // Preserve fragment from /results#top to /view#top
4022
- * this.router.navigate(['/view'], { preserveFragment: true });
4056
+ * router.navigate(['/view'], { preserveFragment: true });
4023
4057
  * ```
4024
4058
  */
4025
4059
  preserveFragment?: boolean;
@@ -4417,14 +4451,6 @@ export declare function withRouterConfig(options: RouterConfigOptions): RouterCo
4417
4451
 
4418
4452
  export declare function ɵassignExtraOptionsToRouter(opts: ExtraOptions, router: Router): void;
4419
4453
 
4420
- /**
4421
- * Deprecated `loadChildren` value types.
4422
- *
4423
- * @publicApi
4424
- * @deprecated represents the deprecated type side of `LoadChildren`.
4425
- */
4426
- export declare type ɵDeprecatedLoadChildren = never;
4427
-
4428
4454
  /**
4429
4455
  * This component is used internally within the router to be a placeholder when an empty
4430
4456
  * router-outlet is needed. For example, with a config such as:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/router",
3
- "version": "15.1.0-next.0",
3
+ "version": "15.1.0-next.1",
4
4
  "description": "Angular - the routing library",
5
5
  "keywords": [
6
6
  "angular",
@@ -24,9 +24,9 @@
24
24
  "tslib": "^2.3.0"
25
25
  },
26
26
  "peerDependencies": {
27
- "@angular/core": "15.1.0-next.0",
28
- "@angular/common": "15.1.0-next.0",
29
- "@angular/platform-browser": "15.1.0-next.0",
27
+ "@angular/core": "15.1.0-next.1",
28
+ "@angular/common": "15.1.0-next.1",
29
+ "@angular/platform-browser": "15.1.0-next.1",
30
30
  "rxjs": "^6.5.3 || ^7.4.0"
31
31
  },
32
32
  "ng-update": {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.1.0-next.0
2
+ * @license Angular v15.1.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.1.0-next.0
2
+ * @license Angular v15.1.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */