@angular/router 14.0.0-next.13 → 14.0.0-next.14

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 (34) hide show
  1. package/esm2020/src/apply_redirects.mjs +56 -46
  2. package/esm2020/src/components/empty_outlet.mjs +3 -3
  3. package/esm2020/src/directives/router_link.mjs +6 -6
  4. package/esm2020/src/directives/router_link_active.mjs +3 -3
  5. package/esm2020/src/directives/router_outlet.mjs +24 -15
  6. package/esm2020/src/models.mjs +2 -7
  7. package/esm2020/src/operators/activate_routes.mjs +7 -14
  8. package/esm2020/src/operators/apply_redirects.mjs +3 -3
  9. package/esm2020/src/operators/resolve_data.mjs +5 -12
  10. package/esm2020/src/page_title_strategy.mjs +3 -3
  11. package/esm2020/src/recognize.mjs +2 -2
  12. package/esm2020/src/router.mjs +9 -6
  13. package/esm2020/src/router_config_loader.mjs +29 -18
  14. package/esm2020/src/router_module.mjs +10 -9
  15. package/esm2020/src/router_outlet_context.mjs +6 -1
  16. package/esm2020/src/router_preloader.mjs +31 -24
  17. package/esm2020/src/router_scroller.mjs +3 -3
  18. package/esm2020/src/router_state.mjs +1 -2
  19. package/esm2020/src/utils/config.mjs +44 -1
  20. package/esm2020/src/utils/preactivation.mjs +5 -14
  21. package/esm2020/src/version.mjs +1 -1
  22. package/esm2020/testing/src/router_testing_module.mjs +4 -4
  23. package/fesm2015/router.mjs +667 -613
  24. package/fesm2015/router.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +5 -5
  26. package/fesm2015/upgrade.mjs +1 -1
  27. package/fesm2020/router.mjs +661 -613
  28. package/fesm2020/router.mjs.map +1 -1
  29. package/fesm2020/testing.mjs +5 -5
  30. package/fesm2020/upgrade.mjs +1 -1
  31. package/package.json +4 -4
  32. package/router.d.ts +53 -13
  33. package/testing/testing.d.ts +1 -1
  34. package/upgrade/upgrade.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.13
2
+ * @license Angular v14.0.0-next.14
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -101,9 +101,9 @@ class RouterTestingModule {
101
101
  };
102
102
  }
103
103
  }
104
- RouterTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.13", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
105
- RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "14.0.0-next.13", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] });
106
- RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-next.13", ngImport: i0, type: RouterTestingModule, providers: [
104
+ RouterTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-next.14", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
105
+ RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "14.0.0-next.14", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] });
106
+ RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-next.14", ngImport: i0, type: RouterTestingModule, providers: [
107
107
  ɵROUTER_PROVIDERS,
108
108
  EXTRA_ROUTER_TESTING_PROVIDERS,
109
109
  { provide: Location, useClass: SpyLocation },
@@ -128,7 +128,7 @@ RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
128
128
  { provide: PreloadingStrategy, useExisting: NoPreloading },
129
129
  provideRoutes([]),
130
130
  ], imports: [RouterModule] });
131
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.13", ngImport: i0, type: RouterTestingModule, decorators: [{
131
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.14", ngImport: i0, type: RouterTestingModule, decorators: [{
132
132
  type: NgModule,
133
133
  args: [{
134
134
  exports: [RouterModule],
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.13
2
+ * @license Angular v14.0.0-next.14
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/router",
3
- "version": "14.0.0-next.13",
3
+ "version": "14.0.0-next.14",
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": "14.0.0-next.13",
28
- "@angular/common": "14.0.0-next.13",
29
- "@angular/platform-browser": "14.0.0-next.13",
27
+ "@angular/core": "14.0.0-next.14",
28
+ "@angular/common": "14.0.0-next.14",
29
+ "@angular/platform-browser": "14.0.0-next.14",
30
30
  "rxjs": "^6.5.3 || ^7.4.0"
31
31
  },
32
32
  "ng-update": {
package/router.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.13
2
+ * @license Angular v14.0.0-next.14
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -10,6 +10,7 @@ import { Compiler } from '@angular/core';
10
10
  import { ComponentFactoryResolver } from '@angular/core';
11
11
  import { ComponentRef } from '@angular/core';
12
12
  import { ElementRef } from '@angular/core';
13
+ import { EnvironmentInjector } from '@angular/core';
13
14
  import { EventEmitter } from '@angular/core';
14
15
  import * as i0 from '@angular/core';
15
16
  import { InjectionToken } from '@angular/core';
@@ -64,7 +65,7 @@ export declare class ActivatedRoute {
64
65
  /** The outlet name of the route, a constant. */
65
66
  outlet: string;
66
67
  /** The component of the route, a constant. */
67
- component: Type<any> | string | null;
68
+ component: Type<any> | null;
68
69
  /** The current snapshot of this route */
69
70
  snapshot: ActivatedRouteSnapshot;
70
71
  /** The configuration used to match this route. */
@@ -148,7 +149,7 @@ export declare class ActivatedRouteSnapshot {
148
149
  /** The outlet name of the route */
149
150
  outlet: string;
150
151
  /** The component of the route */
151
- component: Type<any> | string | null;
152
+ component: Type<any> | null;
152
153
  /** The configuration used to match this route **/
153
154
  readonly routeConfig: Route | null;
154
155
  /** The root of the router state */
@@ -1131,6 +1132,11 @@ export declare type LoadChildren = LoadChildrenCallback;
1131
1132
  */
1132
1133
  export declare type LoadChildrenCallback = () => Type<any> | NgModuleFactory<any> | Observable<Type<any>> | Promise<NgModuleFactory<any> | Type<any>>;
1133
1134
 
1135
+ declare interface LoadedRouterConfig {
1136
+ routes: Route[];
1137
+ injector: EnvironmentInjector | undefined;
1138
+ }
1139
+
1134
1140
  /**
1135
1141
  * Information about a navigation operation.
1136
1142
  * Retrieve the most recent navigation object with the
@@ -1411,7 +1417,12 @@ export declare class NoPreloading implements PreloadingStrategy {
1411
1417
  export declare class OutletContext {
1412
1418
  outlet: RouterOutletContract | null;
1413
1419
  route: ActivatedRoute | null;
1420
+ /**
1421
+ * @deprecated Passing a resolver to retrieve a component factory is not required and is
1422
+ * deprecated since v14.
1423
+ */
1414
1424
  resolver: ComponentFactoryResolver | null;
1425
+ injector: EnvironmentInjector | null;
1415
1426
  children: ChildrenOutletContexts;
1416
1427
  attachRef: ComponentRef<any> | null;
1417
1428
  }
@@ -2050,6 +2061,15 @@ export declare interface Route {
2050
2061
  * parameters of the route change.
2051
2062
  */
2052
2063
  runGuardsAndResolvers?: RunGuardsAndResolvers;
2064
+ /**
2065
+ * A `Provider` array to use for this `Route` and its `children`.
2066
+ *
2067
+ * The `Router` will create a new `EnvironmentInjector` for this
2068
+ * `Route` and use it for this `Route` and its `children`. If this
2069
+ * route also has a `loadChildren` function which returns an `NgModuleRef`, this injector will be
2070
+ * used as the parent of the lazy loaded module.
2071
+ */
2072
+ providers?: Provider[];
2053
2073
  }
2054
2074
 
2055
2075
  /**
@@ -2466,6 +2486,19 @@ export declare const ROUTER_CONFIGURATION: InjectionToken<ExtraOptions>;
2466
2486
  */
2467
2487
  export declare const ROUTER_INITIALIZER: InjectionToken<(compRef: ComponentRef<any>) => void>;
2468
2488
 
2489
+ declare class RouterConfigLoader {
2490
+ private injector;
2491
+ private compiler;
2492
+ private routeLoaders;
2493
+ onLoadStartListener?: (r: Route) => void;
2494
+ onLoadEndListener?: (r: Route) => void;
2495
+ constructor(injector: Injector, compiler: Compiler);
2496
+ load(parentInjector: Injector, route: Route): Observable<LoadedRouterConfig>;
2497
+ private loadModuleFactory;
2498
+ static ɵfac: i0.ɵɵFactoryDeclaration<RouterConfigLoader, never>;
2499
+ static ɵprov: i0.ɵɵInjectableDeclaration<RouterConfigLoader>;
2500
+ }
2501
+
2469
2502
  /**
2470
2503
  * @description
2471
2504
  *
@@ -2711,7 +2744,7 @@ export declare class RouterLink implements OnChanges {
2711
2744
  onClick(): boolean;
2712
2745
  get urlTree(): UrlTree | null;
2713
2746
  static ɵfac: i0.ɵɵFactoryDeclaration<RouterLink, [null, null, { attribute: "tabindex"; }, null, null]>;
2714
- static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLink, ":not(a):not(area)[routerLink]", never, { "queryParams": "queryParams"; "fragment": "fragment"; "queryParamsHandling": "queryParamsHandling"; "preserveFragment": "preserveFragment"; "skipLocationChange": "skipLocationChange"; "replaceUrl": "replaceUrl"; "state": "state"; "relativeTo": "relativeTo"; "routerLink": "routerLink"; }, {}, never>;
2747
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLink, ":not(a):not(area)[routerLink]", never, { "queryParams": "queryParams"; "fragment": "fragment"; "queryParamsHandling": "queryParamsHandling"; "preserveFragment": "preserveFragment"; "skipLocationChange": "skipLocationChange"; "replaceUrl": "replaceUrl"; "state": "state"; "relativeTo": "relativeTo"; "routerLink": "routerLink"; }, {}, never, never, false>;
2715
2748
  }
2716
2749
 
2717
2750
  /**
@@ -2826,7 +2859,7 @@ export declare class RouterLinkActive implements OnChanges, OnDestroy, AfterCont
2826
2859
  private isLinkActive;
2827
2860
  private hasActiveLinks;
2828
2861
  static ɵfac: i0.ɵɵFactoryDeclaration<RouterLinkActive, [null, null, null, null, { optional: true; }, { optional: true; }]>;
2829
- static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLinkActive, "[routerLinkActive]", ["routerLinkActive"], { "routerLinkActiveOptions": "routerLinkActiveOptions"; "routerLinkActive": "routerLinkActive"; }, { "isActiveChange": "isActiveChange"; }, ["links", "linksWithHrefs"]>;
2862
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLinkActive, "[routerLinkActive]", ["routerLinkActive"], { "routerLinkActiveOptions": "routerLinkActiveOptions"; "routerLinkActive": "routerLinkActive"; }, { "isActiveChange": "isActiveChange"; }, ["links", "linksWithHrefs"], never, false>;
2830
2863
  }
2831
2864
 
2832
2865
  /**
@@ -2927,7 +2960,7 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
2927
2960
  private updateTargetUrlAndHref;
2928
2961
  get urlTree(): UrlTree | null;
2929
2962
  static ɵfac: i0.ɵɵFactoryDeclaration<RouterLinkWithHref, never>;
2930
- static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLinkWithHref, "a[routerLink],area[routerLink]", never, { "target": "target"; "queryParams": "queryParams"; "fragment": "fragment"; "queryParamsHandling": "queryParamsHandling"; "preserveFragment": "preserveFragment"; "skipLocationChange": "skipLocationChange"; "replaceUrl": "replaceUrl"; "state": "state"; "relativeTo": "relativeTo"; "routerLink": "routerLink"; }, {}, never>;
2963
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLinkWithHref, "a[routerLink],area[routerLink]", never, { "target": "target"; "queryParams": "queryParams"; "fragment": "fragment"; "queryParamsHandling": "queryParamsHandling"; "preserveFragment": "preserveFragment"; "skipLocationChange": "skipLocationChange"; "replaceUrl": "replaceUrl"; "state": "state"; "relativeTo": "relativeTo"; "routerLink": "routerLink"; }, {}, never, never, false>;
2931
2964
  }
2932
2965
 
2933
2966
  /**
@@ -3048,8 +3081,8 @@ export declare class RouterModule {
3048
3081
  export declare class RouterOutlet implements OnDestroy, OnInit, RouterOutletContract {
3049
3082
  private parentContexts;
3050
3083
  private location;
3051
- private resolver;
3052
3084
  private changeDetector;
3085
+ private environmentInjector;
3053
3086
  private activated;
3054
3087
  private _activatedRoute;
3055
3088
  private name;
@@ -3065,7 +3098,7 @@ export declare class RouterOutlet implements OnDestroy, OnInit, RouterOutletCont
3065
3098
  * subtree.
3066
3099
  */
3067
3100
  detachEvents: EventEmitter<unknown>;
3068
- constructor(parentContexts: ChildrenOutletContexts, location: ViewContainerRef, resolver: ComponentFactoryResolver, name: string, changeDetector: ChangeDetectorRef);
3101
+ constructor(parentContexts: ChildrenOutletContexts, location: ViewContainerRef, name: string, changeDetector: ChangeDetectorRef, environmentInjector: EnvironmentInjector);
3069
3102
  /** @nodoc */
3070
3103
  ngOnDestroy(): void;
3071
3104
  /** @nodoc */
@@ -3087,9 +3120,9 @@ export declare class RouterOutlet implements OnDestroy, OnInit, RouterOutletCont
3087
3120
  */
3088
3121
  attach(ref: ComponentRef<any>, activatedRoute: ActivatedRoute): void;
3089
3122
  deactivate(): void;
3090
- activateWith(activatedRoute: ActivatedRoute, resolver: ComponentFactoryResolver | null): void;
3091
- static ɵfac: i0.ɵɵFactoryDeclaration<RouterOutlet, [null, null, null, { attribute: "name"; }, null]>;
3092
- static ɵdir: i0.ɵɵDirectiveDeclaration<RouterOutlet, "router-outlet", ["outlet"], {}, { "activateEvents": "activate"; "deactivateEvents": "deactivate"; "attachEvents": "attach"; "detachEvents": "detach"; }, never>;
3123
+ activateWith(activatedRoute: ActivatedRoute, resolverOrInjector?: ComponentFactoryResolver | EnvironmentInjector | null): void;
3124
+ static ɵfac: i0.ɵɵFactoryDeclaration<RouterOutlet, [null, null, { attribute: "name"; }, null, null]>;
3125
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RouterOutlet, "router-outlet", ["outlet"], {}, { "activateEvents": "activate"; "deactivateEvents": "deactivate"; "attachEvents": "attach"; "detachEvents": "detach"; }, never, never, false>;
3093
3126
  }
3094
3127
 
3095
3128
  /**
@@ -3125,6 +3158,13 @@ export declare interface RouterOutletContract {
3125
3158
  /**
3126
3159
  * Called by the `Router` when the outlet should activate (create a component).
3127
3160
  */
3161
+ activateWith(activatedRoute: ActivatedRoute, environmnetInjector: EnvironmentInjector | null): void;
3162
+ /**
3163
+ * Called by the `Router` when the outlet should activate (create a component).
3164
+ *
3165
+ * @deprecated Passing a resolver to retrieve a component factory is not required and is
3166
+ * deprecated since v14.
3167
+ */
3128
3168
  activateWith(activatedRoute: ActivatedRoute, resolver: ComponentFactoryResolver | null): void;
3129
3169
  /**
3130
3170
  * A request to destroy the currently activated component.
@@ -3182,7 +3222,7 @@ export declare class RouterPreloader implements OnDestroy {
3182
3222
  private preloadingStrategy;
3183
3223
  private loader;
3184
3224
  private subscription?;
3185
- constructor(router: Router, compiler: Compiler, injector: Injector, preloadingStrategy: PreloadingStrategy);
3225
+ constructor(router: Router, compiler: Compiler, injector: EnvironmentInjector, preloadingStrategy: PreloadingStrategy, loader: RouterConfigLoader);
3186
3226
  setUpPreloading(): void;
3187
3227
  preload(): Observable<any>;
3188
3228
  /** @nodoc */
@@ -3720,7 +3760,7 @@ export declare function ɵassignExtraOptionsToRouter(opts: ExtraOptions, router:
3720
3760
  */
3721
3761
  export declare class ɵEmptyOutletComponent {
3722
3762
  static ɵfac: i0.ɵɵFactoryDeclaration<ɵEmptyOutletComponent, never>;
3723
- static ɵcmp: i0.ɵɵComponentDeclaration<ɵEmptyOutletComponent, "ng-component", never, {}, {}, never, never>;
3763
+ static ɵcmp: i0.ɵɵComponentDeclaration<ɵEmptyOutletComponent, "ng-component", never, {}, {}, never, never, false>;
3724
3764
  }
3725
3765
 
3726
3766
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.13
2
+ * @license Angular v14.0.0-next.14
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 v14.0.0-next.13
2
+ * @license Angular v14.0.0-next.14
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */