@angular/router 14.1.0-next.2 → 14.1.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.
Files changed (38) hide show
  1. package/esm2020/src/apply_redirects.mjs +14 -8
  2. package/esm2020/src/components/empty_outlet.mjs +3 -3
  3. package/esm2020/src/create_url_tree.mjs +6 -4
  4. package/esm2020/src/directives/router_link.mjs +6 -6
  5. package/esm2020/src/directives/router_link_active.mjs +3 -3
  6. package/esm2020/src/directives/router_outlet.mjs +14 -10
  7. package/esm2020/src/errors.mjs +2 -0
  8. package/esm2020/src/events.mjs +22 -4
  9. package/esm2020/src/index.mjs +1 -1
  10. package/esm2020/src/models.mjs +1 -1
  11. package/esm2020/src/navigation_canceling_error.mjs +32 -0
  12. package/esm2020/src/operators/check_guards.mjs +16 -49
  13. package/esm2020/src/operators/prioritized_guard_value.mjs +22 -27
  14. package/esm2020/src/page_title_strategy.mjs +3 -3
  15. package/esm2020/src/recognize.mjs +4 -3
  16. package/esm2020/src/router.mjs +27 -27
  17. package/esm2020/src/router_config_loader.mjs +3 -3
  18. package/esm2020/src/router_module.mjs +46 -12
  19. package/esm2020/src/router_preloader.mjs +9 -9
  20. package/esm2020/src/router_scroller.mjs +3 -3
  21. package/esm2020/src/shared.mjs +1 -10
  22. package/esm2020/src/url_tree.mjs +9 -4
  23. package/esm2020/src/utils/config.mjs +17 -17
  24. package/esm2020/src/utils/type_guards.mjs +9 -5
  25. package/esm2020/src/version.mjs +1 -1
  26. package/esm2020/testing/src/router_testing_module.mjs +4 -4
  27. package/fesm2015/router.mjs +241 -188
  28. package/fesm2015/router.mjs.map +1 -1
  29. package/fesm2015/testing.mjs +5 -5
  30. package/fesm2015/upgrade.mjs +1 -1
  31. package/fesm2020/router.mjs +239 -188
  32. package/fesm2020/router.mjs.map +1 -1
  33. package/fesm2020/testing.mjs +5 -5
  34. package/fesm2020/upgrade.mjs +1 -1
  35. package/index.d.ts +77 -7
  36. package/package.json +4 -4
  37. package/testing/index.d.ts +1 -1
  38. package/upgrade/index.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.1.0-next.2
2
+ * @license Angular v14.1.0-rc.0
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.1.0-next.2", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
105
- RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] });
106
- RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterTestingModule, providers: [
104
+ RouterTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
105
+ RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-rc.0", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] });
106
+ RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-rc.0", 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
  ɵprovidePreloading(NoPreloading),
129
129
  provideRoutes([]),
130
130
  ], imports: [RouterModule] });
131
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.2", ngImport: i0, type: RouterTestingModule, decorators: [{
131
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-rc.0", 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.1.0-next.2
2
+ * @license Angular v14.1.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 v14.1.0-next.2
2
+ * @license Angular v14.1.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1463,20 +1463,63 @@ export declare interface NavigationBehaviorOptions {
1463
1463
  * @publicApi
1464
1464
  */
1465
1465
  export declare class NavigationCancel extends RouterEvent {
1466
- /** @docsNotRequired */
1466
+ /**
1467
+ * A description of why the navigation was cancelled. For debug purposes only. Use `code`
1468
+ * instead for a stable cancellation reason that can be used in production.
1469
+ */
1467
1470
  reason: string;
1471
+ /**
1472
+ * A code to indicate why the navigation was canceled. This cancellation code is stable for
1473
+ * the reason and can be relied on whereas the `reason` string could change and should not be
1474
+ * used in production.
1475
+ */
1476
+ readonly code?: NavigationCancellationCode | undefined;
1468
1477
  readonly type = EventType.NavigationCancel;
1469
1478
  constructor(
1470
1479
  /** @docsNotRequired */
1471
1480
  id: number,
1472
1481
  /** @docsNotRequired */
1473
1482
  url: string,
1474
- /** @docsNotRequired */
1475
- reason: string);
1483
+ /**
1484
+ * A description of why the navigation was cancelled. For debug purposes only. Use `code`
1485
+ * instead for a stable cancellation reason that can be used in production.
1486
+ */
1487
+ reason: string,
1488
+ /**
1489
+ * A code to indicate why the navigation was canceled. This cancellation code is stable for
1490
+ * the reason and can be relied on whereas the `reason` string could change and should not be
1491
+ * used in production.
1492
+ */
1493
+ code?: NavigationCancellationCode | undefined);
1476
1494
  /** @docsNotRequired */
1477
1495
  toString(): string;
1478
1496
  }
1479
1497
 
1498
+ /**
1499
+ * A code for the `NavigationCancel` event of the `Router` to indicate the
1500
+ * reason a navigation failed.
1501
+ *
1502
+ * @publicApi
1503
+ */
1504
+ export declare const enum NavigationCancellationCode {
1505
+ /**
1506
+ * A navigation failed because a guard returned a `UrlTree` to redirect.
1507
+ */
1508
+ Redirect = 0,
1509
+ /**
1510
+ * A navigation failed because a more recent navigation started.
1511
+ */
1512
+ SupersededByNewNavigation = 1,
1513
+ /**
1514
+ * A navigation failed because one of the resolvers completed without emiting a value.
1515
+ */
1516
+ NoDataFromResolver = 2,
1517
+ /**
1518
+ * A navigation failed because a guard returned `false`.
1519
+ */
1520
+ GuardRejected = 3
1521
+ }
1522
+
1480
1523
  /**
1481
1524
  * An event triggered when a navigation ends successfully.
1482
1525
  *
@@ -1513,6 +1556,13 @@ export declare class NavigationEnd extends RouterEvent {
1513
1556
  export declare class NavigationError extends RouterEvent {
1514
1557
  /** @docsNotRequired */
1515
1558
  error: any;
1559
+ /**
1560
+ * The target of the navigation when the error occurred.
1561
+ *
1562
+ * Note that this can be `undefined` because an error could have occurred before the
1563
+ * `RouterStateSnapshot` was created for the navigation.
1564
+ */
1565
+ readonly target?: RouterStateSnapshot | undefined;
1516
1566
  readonly type = EventType.NavigationError;
1517
1567
  constructor(
1518
1568
  /** @docsNotRequired */
@@ -1520,7 +1570,14 @@ export declare class NavigationError extends RouterEvent {
1520
1570
  /** @docsNotRequired */
1521
1571
  url: string,
1522
1572
  /** @docsNotRequired */
1523
- error: any);
1573
+ error: any,
1574
+ /**
1575
+ * The target of the navigation when the error occurred.
1576
+ *
1577
+ * Note that this can be `undefined` because an error could have occurred before the
1578
+ * `RouterStateSnapshot` was created for the navigation.
1579
+ */
1580
+ target?: RouterStateSnapshot | undefined);
1524
1581
  /** @docsNotRequired */
1525
1582
  toString(): string;
1526
1583
  }
@@ -2288,6 +2345,8 @@ export declare interface Route {
2288
2345
  * - `always` : Run on every execution.
2289
2346
  * By default, guards and resolvers run only when the matrix
2290
2347
  * parameters of the route change.
2348
+ *
2349
+ * @see RunGuardsAndResolvers
2291
2350
  */
2292
2351
  runGuardsAndResolvers?: RunGuardsAndResolvers;
2293
2352
  /**
@@ -3409,7 +3468,7 @@ export declare interface RouterOutletContract {
3409
3468
  /**
3410
3469
  * Called by the `Router` when the outlet should activate (create a component).
3411
3470
  */
3412
- activateWith(activatedRoute: ActivatedRoute, environmnetInjector: EnvironmentInjector | null): void;
3471
+ activateWith(activatedRoute: ActivatedRoute, environmentInjector: EnvironmentInjector | null): void;
3413
3472
  /**
3414
3473
  * Called by the `Router` when the outlet should activate (create a component).
3415
3474
  *
@@ -3603,9 +3662,20 @@ export declare class RoutesRecognized extends RouterEvent {
3603
3662
  }
3604
3663
 
3605
3664
  /**
3606
- *
3607
3665
  * A policy for when to run guards and resolvers on a route.
3608
3666
  *
3667
+ * Guards and/or resolvers will always run when a route is activated or deactivated. When a route is
3668
+ * unchanged, the default behavior is the same as `paramsChange`.
3669
+ *
3670
+ * `paramsChange` : Rerun the guards and resolvers when path or
3671
+ * path param changes. This does not include query parameters. This option is the default.
3672
+ * - `always` : Run on every execution.
3673
+ * - `pathParamsChange` : Rerun guards and resolvers when the path params
3674
+ * change. This does not compare matrix or query parameters.
3675
+ * - `paramsOrQueryParamsChange` : Run when path, matrix, or query parameters change.
3676
+ * - `pathParamsOrQueryParamsChange` : Rerun guards and resolvers when the path params
3677
+ * change or query params have changed. This does not include matrix parameters.
3678
+ *
3609
3679
  * @see [Route.runGuardsAndResolvers](api/router/Route#runGuardsAndResolvers)
3610
3680
  * @publicApi
3611
3681
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/router",
3
- "version": "14.1.0-next.2",
3
+ "version": "14.1.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": "14.1.0-next.2",
28
- "@angular/common": "14.1.0-next.2",
29
- "@angular/platform-browser": "14.1.0-next.2",
27
+ "@angular/core": "14.1.0-rc.0",
28
+ "@angular/common": "14.1.0-rc.0",
29
+ "@angular/platform-browser": "14.1.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 v14.1.0-next.2
2
+ * @license Angular v14.1.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 v14.1.0-next.2
2
+ * @license Angular v14.1.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */