@angular/router 17.3.0-next.0 → 17.3.0-rc.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.3.0-next.0
2
+ * @license Angular v17.3.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -59,16 +59,16 @@ class RouterTestingModule {
59
59
  ],
60
60
  };
61
61
  }
62
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0-next.0", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
63
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.0-next.0", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] }); }
64
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.0-next.0", ngImport: i0, type: RouterTestingModule, providers: [
62
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0-rc.0", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
63
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.0-rc.0", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] }); }
64
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.0-rc.0", ngImport: i0, type: RouterTestingModule, providers: [
65
65
  ɵROUTER_PROVIDERS,
66
66
  provideLocationMocks(),
67
67
  withPreloading(NoPreloading).ɵproviders,
68
68
  { provide: ROUTES, multi: true, useValue: [] },
69
69
  ], imports: [RouterModule] }); }
70
70
  }
71
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0-next.0", ngImport: i0, type: RouterTestingModule, decorators: [{
71
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0-rc.0", ngImport: i0, type: RouterTestingModule, decorators: [{
72
72
  type: NgModule,
73
73
  args: [{
74
74
  exports: [RouterModule],
@@ -97,18 +97,18 @@ class RootFixtureService {
97
97
  this.fixture.detectChanges();
98
98
  return this.fixture;
99
99
  }
100
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0-next.0", ngImport: i0, type: RootFixtureService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
101
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.0-next.0", ngImport: i0, type: RootFixtureService, providedIn: 'root' }); }
100
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0-rc.0", ngImport: i0, type: RootFixtureService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
101
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.0-rc.0", ngImport: i0, type: RootFixtureService, providedIn: 'root' }); }
102
102
  }
103
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0-next.0", ngImport: i0, type: RootFixtureService, decorators: [{
103
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0-rc.0", ngImport: i0, type: RootFixtureService, decorators: [{
104
104
  type: Injectable,
105
105
  args: [{ providedIn: 'root' }]
106
106
  }] });
107
107
  class RootCmp {
108
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0-next.0", ngImport: i0, type: RootCmp, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
109
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.0-next.0", 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"] }] }); }
108
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0-rc.0", ngImport: i0, type: RootCmp, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
109
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.0-rc.0", 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"] }] }); }
110
110
  }
111
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0-next.0", ngImport: i0, type: RootCmp, decorators: [{
111
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0-rc.0", ngImport: i0, type: RootCmp, decorators: [{
112
112
  type: Component,
113
113
  args: [{
114
114
  standalone: true,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v17.3.0-next.0
2
+ * @license Angular v17.3.0-rc.0
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.3.0-next.0
2
+ * @license Angular v17.3.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -273,7 +273,7 @@ export declare abstract class BaseRouteReuseStrategy implements RouteReuseStrate
273
273
  * canActivate(
274
274
  * route: ActivatedRouteSnapshot,
275
275
  * state: RouterStateSnapshot
276
- * ): Observable<boolean|UrlTree>|Promise<boolean|UrlTree>|boolean|UrlTree {
276
+ * ): MaybeAsync<GuardResult> {
277
277
  * return this.permissions.canActivate(this.currentUser, route.params.id);
278
278
  * }
279
279
  * }
@@ -305,7 +305,7 @@ export declare abstract class BaseRouteReuseStrategy implements RouteReuseStrate
305
305
  * @see {@link CanActivateFn}
306
306
  */
307
307
  export declare interface CanActivate {
308
- canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
308
+ canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): MaybeAsync<GuardResult>;
309
309
  }
310
310
 
311
311
  /**
@@ -334,7 +334,7 @@ export declare interface CanActivate {
334
334
  * canActivateChild(
335
335
  * route: ActivatedRouteSnapshot,
336
336
  * state: RouterStateSnapshot
337
- * ): Observable<boolean|UrlTree>|Promise<boolean|UrlTree>|boolean|UrlTree {
337
+ * ): MaybeAsync<GuardResult> {
338
338
  * return this.permissions.canActivate(this.currentUser, route.params.id);
339
339
  * }
340
340
  * }
@@ -371,7 +371,7 @@ export declare interface CanActivate {
371
371
  * @see {@link CanActivateChildFn}
372
372
  */
373
373
  export declare interface CanActivateChild {
374
- canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
374
+ canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): MaybeAsync<GuardResult>;
375
375
  }
376
376
 
377
377
  /**
@@ -389,7 +389,7 @@ export declare interface CanActivateChild {
389
389
  * @publicApi
390
390
  * @see {@link Route}
391
391
  */
392
- export declare type CanActivateChildFn = (childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
392
+ export declare type CanActivateChildFn = (childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot) => MaybeAsync<GuardResult>;
393
393
 
394
394
  /**
395
395
  * The signature of a function used as a `canActivate` guard on a `Route`.
@@ -411,7 +411,7 @@ export declare type CanActivateChildFn = (childRoute: ActivatedRouteSnapshot, st
411
411
  * @publicApi
412
412
  * @see {@link Route}
413
413
  */
414
- export declare type CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
414
+ export declare type CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => MaybeAsync<GuardResult>;
415
415
 
416
416
  /**
417
417
  * @description
@@ -447,7 +447,7 @@ export declare type CanActivateFn = (route: ActivatedRouteSnapshot, state: Route
447
447
  * currentRoute: ActivatedRouteSnapshot,
448
448
  * currentState: RouterStateSnapshot,
449
449
  * nextState: RouterStateSnapshot
450
- * ): Observable<boolean|UrlTree>|Promise<boolean|UrlTree>|boolean|UrlTree {
450
+ * ): MaybeAsync<GuardResult> {
451
451
  * return this.permissions.canDeactivate(this.currentUser, route.params.id);
452
452
  * }
453
453
  * }
@@ -474,7 +474,7 @@ export declare type CanActivateFn = (route: ActivatedRouteSnapshot, state: Route
474
474
  * @see {@link CanDeactivateFn}
475
475
  */
476
476
  export declare interface CanDeactivate<T> {
477
- canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
477
+ canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot): MaybeAsync<GuardResult>;
478
478
  }
479
479
 
480
480
  /**
@@ -492,7 +492,7 @@ export declare interface CanDeactivate<T> {
492
492
  * @publicApi
493
493
  * @see {@link Route}
494
494
  */
495
- export declare type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
495
+ export declare type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot) => MaybeAsync<GuardResult>;
496
496
 
497
497
  /**
498
498
  * @description
@@ -549,7 +549,7 @@ export declare type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedR
549
549
  * @deprecated Use {@link CanMatchFn} instead
550
550
  */
551
551
  export declare interface CanLoad {
552
- canLoad(route: Route, segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
552
+ canLoad(route: Route, segments: UrlSegment[]): MaybeAsync<GuardResult>;
553
553
  }
554
554
 
555
555
  /**
@@ -561,7 +561,7 @@ export declare interface CanLoad {
561
561
  * @see {@link CanMatchFn}
562
562
  * @deprecated Use `Route.canMatch` and `CanMatchFn` instead
563
563
  */
564
- export declare type CanLoadFn = (route: Route, segments: UrlSegment[]) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
564
+ export declare type CanLoadFn = (route: Route, segments: UrlSegment[]) => MaybeAsync<GuardResult>;
565
565
 
566
566
  /**
567
567
  * @description
@@ -629,7 +629,7 @@ export declare type CanLoadFn = (route: Route, segments: UrlSegment[]) => Observ
629
629
  * @see {@link CanMatchFn}
630
630
  */
631
631
  export declare interface CanMatch {
632
- canMatch(route: Route, segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
632
+ canMatch(route: Route, segments: UrlSegment[]): MaybeAsync<GuardResult>;
633
633
  }
634
634
 
635
635
  /**
@@ -647,7 +647,7 @@ export declare interface CanMatch {
647
647
  * @publicApi
648
648
  * @see {@link Route}
649
649
  */
650
- export declare type CanMatchFn = (route: Route, segments: UrlSegment[]) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
650
+ export declare type CanMatchFn = (route: Route, segments: UrlSegment[]) => MaybeAsync<GuardResult>;
651
651
 
652
652
  /**
653
653
  * An event triggered at the end of the child-activation part
@@ -1067,6 +1067,14 @@ export declare interface ExtraOptions extends InMemoryScrollingOptions, RouterCo
1067
1067
  scrollOffset?: [number, number] | (() => [number, number]);
1068
1068
  }
1069
1069
 
1070
+ /**
1071
+ * The supported types that can be returned from a `Router` guard.
1072
+ *
1073
+ * @see [Routing tutorial](guide/router-tutorial-toh#milestone-5-route-guards)
1074
+ * @publicApi
1075
+ */
1076
+ export declare type GuardResult = boolean | UrlTree;
1077
+
1070
1078
  /**
1071
1079
  * An event triggered at the end of the Guard phase of routing.
1072
1080
  *
@@ -1411,6 +1419,13 @@ export declare function mapToResolve<T>(provider: Type<{
1411
1419
  resolve: ResolveFn<T>;
1412
1420
  }>): ResolveFn<T>;
1413
1421
 
1422
+ /**
1423
+ * Type used to represent a value which may be synchronous or async.
1424
+ *
1425
+ * @publicApi
1426
+ */
1427
+ export declare type MaybeAsync<T> = T | Observable<T> | Promise<T>;
1428
+
1414
1429
  /**
1415
1430
  * Information about a navigation operation.
1416
1431
  * Retrieve the most recent navigation object with the
@@ -2163,7 +2178,7 @@ export declare type QueryParamsHandling = 'merge' | 'preserve' | '';
2163
2178
  * @see {@link ResolveFn}
2164
2179
  */
2165
2180
  export declare interface Resolve<T> {
2166
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<T> | Promise<T> | T;
2181
+ resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): MaybeAsync<T>;
2167
2182
  }
2168
2183
 
2169
2184
  /**
@@ -2243,7 +2258,7 @@ export declare class ResolveEnd extends RouterEvent {
2243
2258
  * @publicApi
2244
2259
  * @see {@link Route}
2245
2260
  */
2246
- export declare type ResolveFn<T> = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => Observable<T> | Promise<T> | T;
2261
+ export declare type ResolveFn<T> = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => MaybeAsync<T>;
2247
2262
 
2248
2263
  /**
2249
2264
  * An event triggered at the start of the Resolve phase of routing.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/router",
3
- "version": "17.3.0-next.0",
3
+ "version": "17.3.0-rc.0",
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.3.0-next.0",
28
- "@angular/common": "17.3.0-next.0",
29
- "@angular/platform-browser": "17.3.0-next.0",
27
+ "@angular/core": "17.3.0-rc.0",
28
+ "@angular/common": "17.3.0-rc.0",
29
+ "@angular/platform-browser": "17.3.0-rc.0",
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.3.0-next.0
2
+ * @license Angular v17.3.0-rc.0
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.3.0-next.0
2
+ * @license Angular v17.3.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */