@angular/router 17.0.0-next.2 → 17.0.0-next.4

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/esm2022/src/apply_redirects.mjs +8 -3
  2. package/esm2022/src/components/empty_outlet.mjs +3 -3
  3. package/esm2022/src/directives/router_link.mjs +3 -3
  4. package/esm2022/src/directives/router_link_active.mjs +3 -3
  5. package/esm2022/src/directives/router_outlet.mjs +6 -6
  6. package/esm2022/src/index.mjs +2 -2
  7. package/esm2022/src/navigation_transition.mjs +24 -11
  8. package/esm2022/src/operators/resolve_data.mjs +2 -5
  9. package/esm2022/src/page_title_strategy.mjs +6 -6
  10. package/esm2022/src/provide_router.mjs +33 -1
  11. package/esm2022/src/recognize.mjs +34 -50
  12. package/esm2022/src/route_reuse_strategy.mjs +6 -6
  13. package/esm2022/src/router.mjs +57 -226
  14. package/esm2022/src/router_config.mjs +1 -1
  15. package/esm2022/src/router_config_loader.mjs +3 -3
  16. package/esm2022/src/router_module.mjs +7 -6
  17. package/esm2022/src/router_outlet_context.mjs +3 -3
  18. package/esm2022/src/router_preloader.mjs +9 -9
  19. package/esm2022/src/router_scroller.mjs +3 -3
  20. package/esm2022/src/state_manager.mjs +244 -0
  21. package/esm2022/src/url_handling_strategy.mjs +6 -6
  22. package/esm2022/src/url_tree.mjs +3 -3
  23. package/esm2022/src/utils/collection.mjs +9 -3
  24. package/esm2022/src/utils/view_transition.mjs +42 -0
  25. package/esm2022/src/version.mjs +1 -1
  26. package/esm2022/testing/src/router_testing_harness.mjs +6 -6
  27. package/esm2022/testing/src/router_testing_module.mjs +4 -4
  28. package/fesm2022/router.mjs +498 -369
  29. package/fesm2022/router.mjs.map +1 -1
  30. package/fesm2022/testing.mjs +11 -11
  31. package/fesm2022/upgrade.mjs +1 -1
  32. package/index.d.ts +67 -65
  33. package/package.json +4 -4
  34. package/testing/index.d.ts +1 -1
  35. package/upgrade/index.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.0.0-next.2
2
+ * @license Angular v17.0.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -109,16 +109,16 @@ class RouterTestingModule {
109
109
  ]
110
110
  };
111
111
  }
112
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.2", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
113
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.0-next.2", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] }); }
114
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.0-next.2", ngImport: i0, type: RouterTestingModule, providers: [
112
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.4", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
113
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.0-next.4", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] }); }
114
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.0-next.4", ngImport: i0, type: RouterTestingModule, providers: [
115
115
  ɵROUTER_PROVIDERS,
116
116
  provideLocationMocks(),
117
117
  withPreloading(NoPreloading).ɵproviders,
118
118
  { provide: ROUTES, multi: true, useValue: [] },
119
119
  ], imports: [RouterModule] }); }
120
120
  }
121
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.2", ngImport: i0, type: RouterTestingModule, decorators: [{
121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.4", ngImport: i0, type: RouterTestingModule, decorators: [{
122
122
  type: NgModule,
123
123
  args: [{
124
124
  exports: [RouterModule],
@@ -147,18 +147,18 @@ class RootFixtureService {
147
147
  this.fixture.detectChanges();
148
148
  return this.fixture;
149
149
  }
150
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.2", ngImport: i0, type: RootFixtureService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
151
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.2", ngImport: i0, type: RootFixtureService, providedIn: 'root' }); }
150
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.4", ngImport: i0, type: RootFixtureService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
151
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.4", ngImport: i0, type: RootFixtureService, providedIn: 'root' }); }
152
152
  }
153
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.2", ngImport: i0, type: RootFixtureService, decorators: [{
153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.4", ngImport: i0, type: RootFixtureService, decorators: [{
154
154
  type: Injectable,
155
155
  args: [{ providedIn: 'root' }]
156
156
  }] });
157
157
  class RootCmp {
158
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.2", ngImport: i0, type: RootCmp, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
159
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.0-next.2", type: RootCmp, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "outlet", first: true, predicate: RouterOutlet, descendants: true }], ngImport: i0, template: '<router-outlet></router-outlet>', isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
158
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.4", ngImport: i0, type: RootCmp, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
159
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.0-next.4", type: RootCmp, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "outlet", first: true, predicate: RouterOutlet, descendants: true }], ngImport: i0, template: '<router-outlet></router-outlet>', isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
160
160
  }
161
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.2", ngImport: i0, type: RootCmp, decorators: [{
161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.4", ngImport: i0, type: RootCmp, decorators: [{
162
162
  type: Component,
163
163
  args: [{
164
164
  standalone: true,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.0.0-next.2
2
+ * @license Angular v17.0.0-next.4
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 v17.0.0-next.2
2
+ * @license Angular v17.0.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -27,6 +27,7 @@ import { Provider } from '@angular/core';
27
27
  import { ProviderToken } from '@angular/core';
28
28
  import { QueryList } from '@angular/core';
29
29
  import { Renderer2 } from '@angular/core';
30
+ import { RouterState as RouterState_2 } from '@angular/router';
30
31
  import { SimpleChanges } from '@angular/core';
31
32
  import { Title } from '@angular/platform-browser';
32
33
  import { Type } from '@angular/core';
@@ -1029,6 +1030,15 @@ export declare interface ExtraOptions extends InMemoryScrollingOptions, RouterCo
1029
1030
  * component in `Route` configurations.
1030
1031
  */
1031
1032
  bindToComponentInputs?: boolean;
1033
+ /**
1034
+ * When true, enables view transitions in the Router by running the route activation and
1035
+ * deactivation inside of `document.startViewTransition`.
1036
+ *
1037
+ * @see https://developer.chrome.com/docs/web-platform/view-transitions/
1038
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
1039
+ * @experimental
1040
+ */
1041
+ enableViewTransitions?: boolean;
1032
1042
  /**
1033
1043
  * A custom error handler for failed navigations.
1034
1044
  * If the handler returns a value, the navigation Promise is resolved with this value.
@@ -2698,26 +2708,21 @@ declare class RoutedComponentInputBinder {
2698
2708
  * @publicApi
2699
2709
  */
2700
2710
  export declare class Router {
2711
+ private get currentUrlTree();
2712
+ private get rawUrlTree();
2713
+ private get browserUrlTree();
2701
2714
  private disposed;
2702
2715
  private locationSubscription?;
2703
- private get navigationId();
2704
- /**
2705
- * The id of the currently active page in the router.
2706
- * Updated to the transition's target id on a successful navigation.
2707
- *
2708
- * This is used to track what page the router last activated. When an attempted navigation fails,
2709
- * the router can then use this to compute how to restore the state back to the previously active
2710
- * page.
2711
- */
2712
- private currentPageId;
2713
- /**
2714
- * The ɵrouterPageId of whatever page is currently active in the browser history. This is
2715
- * important for computing the target page id for new navigations because we need to ensure each
2716
- * page id in the browser history is 1 more than the previous entry.
2717
- */
2718
- private get browserPageId();
2719
- private console;
2720
2716
  private isNgZoneEnabled;
2717
+ private readonly console;
2718
+ private readonly stateManager;
2719
+ private readonly options;
2720
+ private readonly pendingTasks;
2721
+ private readonly urlUpdateStrategy;
2722
+ private readonly navigationTransitions;
2723
+ private readonly urlSerializer;
2724
+ private readonly location;
2725
+ private readonly urlHandlingStrategy;
2721
2726
  /**
2722
2727
  * The private `Subject` type for the public events exposed in the getter. This is used internally
2723
2728
  * to push events to. The separate field allows us to expose separate types in the public API
@@ -2731,9 +2736,7 @@ export declare class Router {
2731
2736
  /**
2732
2737
  * The current state of routing in this NgModule.
2733
2738
  */
2734
- readonly routerState: RouterState;
2735
- private options;
2736
- private pendingTasks;
2739
+ get routerState(): RouterState_2;
2737
2740
  /**
2738
2741
  * A handler for navigation errors in this NgModule.
2739
2742
  *
@@ -2756,15 +2759,6 @@ export declare class Router {
2756
2759
  * false otherwise.
2757
2760
  */
2758
2761
  navigated: boolean;
2759
- private lastSuccessfulId;
2760
- /**
2761
- * A strategy for extracting and merging URLs.
2762
- * Used for AngularJS to Angular migrations.
2763
- *
2764
- * @deprecated Configure using `providers` instead:
2765
- * `{provide: UrlHandlingStrategy, useClass: MyStrategy}`.
2766
- */
2767
- urlHandlingStrategy: UrlHandlingStrategy;
2768
2762
  /**
2769
2763
  * A strategy for re-using routes.
2770
2764
  *
@@ -2782,37 +2776,7 @@ export declare class Router {
2782
2776
  * @see {@link RouterModule}
2783
2777
  */
2784
2778
  onSameUrlNavigation: OnSameUrlNavigation;
2785
- private urlUpdateStrategy;
2786
- /**
2787
- * Configures how the Router attempts to restore state when a navigation is cancelled.
2788
- *
2789
- * 'replace' - Always uses `location.replaceState` to set the browser state to the state of the
2790
- * router before the navigation started. This means that if the URL of the browser is updated
2791
- * _before_ the navigation is canceled, the Router will simply replace the item in history rather
2792
- * than trying to restore to the previous location in the session history. This happens most
2793
- * frequently with `urlUpdateStrategy: 'eager'` and navigations with the browser back/forward
2794
- * buttons.
2795
- *
2796
- * 'computed' - Will attempt to return to the same index in the session history that corresponds
2797
- * to the Angular route when the navigation gets cancelled. For example, if the browser back
2798
- * button is clicked and the navigation is cancelled, the Router will trigger a forward navigation
2799
- * and vice versa.
2800
- *
2801
- * Note: the 'computed' option is incompatible with any `UrlHandlingStrategy` which only
2802
- * handles a portion of the URL because the history restoration navigates to the previous place in
2803
- * the browser history rather than simply resetting a portion of the URL.
2804
- *
2805
- * The default value is `replace`.
2806
- *
2807
- * @see {@link withRouterConfig}
2808
- * @see {@link provideRouter}
2809
- * @see {@link RouterModule}
2810
- */
2811
- private canceledNavigationResolution;
2812
2779
  config: Routes;
2813
- private readonly navigationTransitions;
2814
- private readonly urlSerializer;
2815
- private readonly location;
2816
2780
  /**
2817
2781
  * Indicates whether the application has opted in to binding Router data to component inputs.
2818
2782
  *
@@ -3000,9 +2964,7 @@ export declare class Router {
3000
2964
  */
3001
2965
  isActive(url: string | UrlTree, matchOptions: IsActiveMatchOptions): boolean;
3002
2966
  private removeEmptyProps;
3003
- private resetState;
3004
- private resetUrlToCurrentUrlTree;
3005
- private generateNgRouterState;
2967
+ private scheduleNavigation;
3006
2968
  static ɵfac: i0.ɵɵFactoryDeclaration<Router, never>;
3007
2969
  static ɵprov: i0.ɵɵInjectableDeclaration<Router>;
3008
2970
  }
@@ -3190,7 +3152,8 @@ declare const enum RouterFeatureKind {
3190
3152
  RouterConfigurationFeature = 5,
3191
3153
  RouterHashLocationFeature = 6,
3192
3154
  NavigationErrorHandlerFeature = 7,
3193
- ComponentInputBindingFeature = 8
3155
+ ComponentInputBindingFeature = 8,
3156
+ ViewTransitionsFeature = 9
3194
3157
  }
3195
3158
 
3196
3159
  /**
@@ -3203,7 +3166,7 @@ declare const enum RouterFeatureKind {
3203
3166
  *
3204
3167
  * @publicApi
3205
3168
  */
3206
- export declare type RouterFeatures = PreloadingFeature | DebugTracingFeature | InitialNavigationFeature | InMemoryScrollingFeature | RouterConfigurationFeature | NavigationErrorHandlerFeature | ComponentInputBindingFeature;
3169
+ export declare type RouterFeatures = PreloadingFeature | DebugTracingFeature | InitialNavigationFeature | InMemoryScrollingFeature | RouterConfigurationFeature | NavigationErrorHandlerFeature | ComponentInputBindingFeature | ViewTransitionsFeature;
3207
3170
 
3208
3171
  /**
3209
3172
  * A type alias for providers returned by `withHashLocation` for use with `provideRouter`.
@@ -4381,6 +4344,16 @@ export declare class UrlTree {
4381
4344
  */
4382
4345
  export declare const VERSION: Version;
4383
4346
 
4347
+ /**
4348
+ * A type alias for providers returned by `withViewTransitions` for use with `provideRouter`.
4349
+ *
4350
+ * @see {@link withViewTransitions}
4351
+ * @see {@link provideRouter}
4352
+ *
4353
+ * @publicApi
4354
+ */
4355
+ export declare type ViewTransitionsFeature = RouterFeature<RouterFeatureKind.ViewTransitionsFeature>;
4356
+
4384
4357
  /**
4385
4358
  * Enables binding information from the `Router` state directly to the inputs of the component in
4386
4359
  * `Route` configurations.
@@ -4626,6 +4599,35 @@ export declare function withPreloading(preloadingStrategy: Type<PreloadingStrate
4626
4599
  */
4627
4600
  export declare function withRouterConfig(options: RouterConfigOptions): RouterConfigurationFeature;
4628
4601
 
4602
+ /**
4603
+ * Enables view transitions in the Router by running the route activation and deactivation inside of
4604
+ * `document.startViewTransition`.
4605
+ *
4606
+ * Note: The View Transitions API is not available in all browsers. If the browser does not support
4607
+ * view transitions, the Router will not attempt to start a view transition and continue processing
4608
+ * the navigation as usual.
4609
+ *
4610
+ * @usageNotes
4611
+ *
4612
+ * Basic example of how you can enable the feature:
4613
+ * ```
4614
+ * const appRoutes: Routes = [];
4615
+ * bootstrapApplication(AppComponent,
4616
+ * {
4617
+ * providers: [
4618
+ * provideRouter(appRoutes, withViewTransitions())
4619
+ * ]
4620
+ * }
4621
+ * );
4622
+ * ```
4623
+ *
4624
+ * @returns A set of providers for use with `provideRouter`.
4625
+ * @see https://developer.chrome.com/docs/web-platform/view-transitions/
4626
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
4627
+ * @experimental
4628
+ */
4629
+ export declare function withViewTransitions(): ViewTransitionsFeature;
4630
+
4629
4631
  /**
4630
4632
  * Performs the given action once the router finishes its next/current navigation.
4631
4633
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/router",
3
- "version": "17.0.0-next.2",
3
+ "version": "17.0.0-next.4",
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": "17.0.0-next.2",
28
- "@angular/common": "17.0.0-next.2",
29
- "@angular/platform-browser": "17.0.0-next.2",
27
+ "@angular/core": "17.0.0-next.4",
28
+ "@angular/common": "17.0.0-next.4",
29
+ "@angular/platform-browser": "17.0.0-next.4",
30
30
  "rxjs": "^6.5.3 || ^7.4.0"
31
31
  },
32
32
  "ng-update": {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.0.0-next.2
2
+ * @license Angular v17.0.0-next.4
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 v17.0.0-next.2
2
+ * @license Angular v17.0.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */