@angular/router 13.2.0-rc.1 → 13.2.3
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.
- package/esm2020/src/components/empty_outlet.mjs +3 -3
- package/esm2020/src/config.mjs +1 -1
- package/esm2020/src/directives/router_link.mjs +6 -6
- package/esm2020/src/directives/router_link_active.mjs +3 -3
- package/esm2020/src/directives/router_outlet.mjs +3 -3
- package/esm2020/src/interfaces.mjs +1 -1
- package/esm2020/src/private_export.mjs +1 -1
- package/esm2020/src/router.mjs +4 -4
- package/esm2020/src/router_module.mjs +7 -7
- package/esm2020/src/router_preloader.mjs +3 -3
- package/esm2020/src/router_scroller.mjs +3 -3
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/router_testing_module.mjs +4 -4
- package/esm2020/upgrade/src/upgrade.mjs +15 -5
- package/fesm2015/router.mjs +33 -33
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +5 -5
- package/fesm2015/upgrade.mjs +16 -5
- package/fesm2015/upgrade.mjs.map +1 -1
- package/fesm2020/router.mjs +33 -33
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +5 -5
- package/fesm2020/upgrade.mjs +15 -5
- package/fesm2020/upgrade.mjs.map +1 -1
- package/package.json +4 -4
- package/router.d.ts +9 -3
- package/testing/testing.d.ts +1 -1
- package/upgrade/upgrade.d.ts +1 -1
package/fesm2020/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.2.
|
|
2
|
+
* @license Angular v13.2.3
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -93,9 +93,9 @@ class RouterTestingModule {
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
RouterTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.
|
|
97
|
-
RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.
|
|
98
|
-
RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.
|
|
96
|
+
RouterTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
97
|
+
RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] });
|
|
98
|
+
RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: RouterTestingModule, providers: [
|
|
99
99
|
ɵROUTER_PROVIDERS,
|
|
100
100
|
EXTRA_ROUTER_TESTING_PROVIDERS,
|
|
101
101
|
{ provide: Location, useClass: SpyLocation },
|
|
@@ -112,7 +112,7 @@ RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
|
|
|
112
112
|
{ provide: PreloadingStrategy, useExisting: NoPreloading },
|
|
113
113
|
provideRoutes([]),
|
|
114
114
|
], imports: [RouterModule] });
|
|
115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.
|
|
115
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: RouterTestingModule, decorators: [{
|
|
116
116
|
type: NgModule,
|
|
117
117
|
args: [{
|
|
118
118
|
exports: [RouterModule],
|
package/fesm2020/upgrade.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.2.
|
|
2
|
+
* @license Angular v13.2.3
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -75,15 +75,25 @@ function setUpLocationSync(ngUpgrade, urlType = 'path') {
|
|
|
75
75
|
const router = ngUpgrade.injector.get(Router);
|
|
76
76
|
const location = ngUpgrade.injector.get(Location);
|
|
77
77
|
ngUpgrade.$injector.get('$rootScope')
|
|
78
|
-
.$on('$locationChangeStart', (
|
|
78
|
+
.$on('$locationChangeStart', (event, newUrl, oldUrl, newState, oldState) => {
|
|
79
|
+
// Navigations coming from Angular router have a navigationId state
|
|
80
|
+
// property. Don't trigger Angular router navigation again if it is
|
|
81
|
+
// caused by a URL change from the current Angular router
|
|
82
|
+
// navigation.
|
|
83
|
+
const currentNavigationId = router.getCurrentNavigation()?.id;
|
|
84
|
+
const newStateNavigationId = newState?.navigationId;
|
|
85
|
+
if (newStateNavigationId !== undefined &&
|
|
86
|
+
newStateNavigationId === currentNavigationId) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
79
89
|
let url;
|
|
80
90
|
if (urlType === 'path') {
|
|
81
|
-
url = resolveUrl(
|
|
91
|
+
url = resolveUrl(newUrl);
|
|
82
92
|
}
|
|
83
93
|
else if (urlType === 'hash') {
|
|
84
94
|
// Remove the first hash from the URL
|
|
85
|
-
const hashIdx =
|
|
86
|
-
url = resolveUrl(
|
|
95
|
+
const hashIdx = newUrl.indexOf('#');
|
|
96
|
+
url = resolveUrl(newUrl.substring(0, hashIdx) + newUrl.substring(hashIdx + 1));
|
|
87
97
|
}
|
|
88
98
|
else {
|
|
89
99
|
throw 'Invalid URLType passed to setUpLocationSync: ' + urlType;
|
package/fesm2020/upgrade.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.mjs","sources":["../../../../../../packages/router/upgrade/src/upgrade.ts","../../../../../../packages/router/upgrade/public_api.ts","../../../../../../packages/router/upgrade/index.ts","../../../../../../packages/router/upgrade/upgrade.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Location} from '@angular/common';\nimport {APP_BOOTSTRAP_LISTENER, ComponentRef, InjectionToken} from '@angular/core';\nimport {Router} from '@angular/router';\nimport {UpgradeModule} from '@angular/upgrade/static';\n\n/**\n * Creates an initializer that sets up `ngRoute` integration\n * along with setting up the Angular router.\n *\n * @usageNotes\n *\n * <code-example language=\"typescript\">\n * @NgModule({\n * imports: [\n * RouterModule.forRoot(SOME_ROUTES),\n * UpgradeModule\n * ],\n * providers: [\n * RouterUpgradeInitializer\n * ]\n * })\n * export class AppModule {\n * ngDoBootstrap() {}\n * }\n * </code-example>\n *\n * @publicApi\n */\nexport const RouterUpgradeInitializer = {\n provide: APP_BOOTSTRAP_LISTENER,\n multi: true,\n useFactory: locationSyncBootstrapListener as (ngUpgrade: UpgradeModule) => () => void,\n deps: [UpgradeModule]\n};\n\n/**\n * @internal\n */\nexport function locationSyncBootstrapListener(ngUpgrade: UpgradeModule) {\n return () => {\n setUpLocationSync(ngUpgrade);\n };\n}\n\n/**\n * Sets up a location change listener to trigger `history.pushState`.\n * Works around the problem that `onPopState` does not trigger `history.pushState`.\n * Must be called *after* calling `UpgradeModule.bootstrap`.\n *\n * @param ngUpgrade The upgrade NgModule.\n * @param urlType The location strategy.\n * @see `HashLocationStrategy`\n * @see `PathLocationStrategy`\n *\n * @publicApi\n */\nexport function setUpLocationSync(ngUpgrade: UpgradeModule, urlType: 'path'|'hash' = 'path') {\n if (!ngUpgrade.$injector) {\n throw new Error(`\n RouterUpgradeInitializer can be used only after UpgradeModule.bootstrap has been called.\n Remove RouterUpgradeInitializer and call setUpLocationSync after UpgradeModule.bootstrap.\n `);\n }\n\n const router: Router = ngUpgrade.injector.get(Router);\n const location: Location = ngUpgrade.injector.get(Location);\n\n ngUpgrade.$injector.get('$rootScope')\n .$on('$locationChangeStart'
|
|
1
|
+
{"version":3,"file":"upgrade.mjs","sources":["../../../../../../packages/router/upgrade/src/upgrade.ts","../../../../../../packages/router/upgrade/public_api.ts","../../../../../../packages/router/upgrade/index.ts","../../../../../../packages/router/upgrade/upgrade.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Location} from '@angular/common';\nimport {APP_BOOTSTRAP_LISTENER, ComponentRef, InjectionToken} from '@angular/core';\nimport {Router, ɵRestoredState as RestoredState} from '@angular/router';\nimport {UpgradeModule} from '@angular/upgrade/static';\n\n/**\n * Creates an initializer that sets up `ngRoute` integration\n * along with setting up the Angular router.\n *\n * @usageNotes\n *\n * <code-example language=\"typescript\">\n * @NgModule({\n * imports: [\n * RouterModule.forRoot(SOME_ROUTES),\n * UpgradeModule\n * ],\n * providers: [\n * RouterUpgradeInitializer\n * ]\n * })\n * export class AppModule {\n * ngDoBootstrap() {}\n * }\n * </code-example>\n *\n * @publicApi\n */\nexport const RouterUpgradeInitializer = {\n provide: APP_BOOTSTRAP_LISTENER,\n multi: true,\n useFactory: locationSyncBootstrapListener as (ngUpgrade: UpgradeModule) => () => void,\n deps: [UpgradeModule]\n};\n\n/**\n * @internal\n */\nexport function locationSyncBootstrapListener(ngUpgrade: UpgradeModule) {\n return () => {\n setUpLocationSync(ngUpgrade);\n };\n}\n\n/**\n * Sets up a location change listener to trigger `history.pushState`.\n * Works around the problem that `onPopState` does not trigger `history.pushState`.\n * Must be called *after* calling `UpgradeModule.bootstrap`.\n *\n * @param ngUpgrade The upgrade NgModule.\n * @param urlType The location strategy.\n * @see `HashLocationStrategy`\n * @see `PathLocationStrategy`\n *\n * @publicApi\n */\nexport function setUpLocationSync(ngUpgrade: UpgradeModule, urlType: 'path'|'hash' = 'path') {\n if (!ngUpgrade.$injector) {\n throw new Error(`\n RouterUpgradeInitializer can be used only after UpgradeModule.bootstrap has been called.\n Remove RouterUpgradeInitializer and call setUpLocationSync after UpgradeModule.bootstrap.\n `);\n }\n\n const router: Router = ngUpgrade.injector.get(Router);\n const location: Location = ngUpgrade.injector.get(Location);\n\n ngUpgrade.$injector.get('$rootScope')\n .$on(\n '$locationChangeStart',\n (event: any, newUrl: string, oldUrl: string,\n newState?: {[k: string]: unknown}|RestoredState,\n oldState?: {[k: string]: unknown}|RestoredState) => {\n // Navigations coming from Angular router have a navigationId state\n // property. Don't trigger Angular router navigation again if it is\n // caused by a URL change from the current Angular router\n // navigation.\n const currentNavigationId = router.getCurrentNavigation()?.id;\n const newStateNavigationId = newState?.navigationId;\n if (newStateNavigationId !== undefined &&\n newStateNavigationId === currentNavigationId) {\n return;\n }\n\n let url;\n if (urlType === 'path') {\n url = resolveUrl(newUrl);\n } else if (urlType === 'hash') {\n // Remove the first hash from the URL\n const hashIdx = newUrl.indexOf('#');\n url = resolveUrl(newUrl.substring(0, hashIdx) + newUrl.substring(hashIdx + 1));\n } else {\n throw 'Invalid URLType passed to setUpLocationSync: ' + urlType;\n }\n const path = location.normalize(url.pathname);\n router.navigateByUrl(path + url.search + url.hash);\n });\n}\n\n/**\n * Normalizes and parses a URL.\n *\n * - Normalizing means that a relative URL will be resolved into an absolute URL in the context of\n * the application document.\n * - Parsing means that the anchor's `protocol`, `hostname`, `port`, `pathname` and related\n * properties are all populated to reflect the normalized URL.\n *\n * While this approach has wide compatibility, it doesn't work as expected on IE. On IE, normalizing\n * happens similar to other browsers, but the parsed components will not be set. (E.g. if you assign\n * `a.href = 'foo'`, then `a.protocol`, `a.host`, etc. will not be correctly updated.)\n * We work around that by performing the parsing in a 2nd step by taking a previously normalized URL\n * and assigning it again. This correctly populates all properties.\n *\n * See\n * https://github.com/angular/angular.js/blob/2c7400e7d07b0f6cec1817dab40b9250ce8ebce6/src/ng/urlUtils.js#L26-L33\n * for more info.\n */\nlet anchor: HTMLAnchorElement|undefined;\nfunction resolveUrl(url: string): {pathname: string, search: string, hash: string} {\n if (!anchor) {\n anchor = document.createElement('a');\n }\n\n anchor.setAttribute('href', url);\n anchor.setAttribute('href', anchor.href);\n\n return {\n // IE does not start `pathname` with `/` like other browsers.\n pathname: `/${anchor.pathname.replace(/^\\//, '')}`,\n search: anchor.search,\n hash: anchor.hash\n };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/upgrade';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;;AAaA;;;;;;;;;;;;;;;;;;;;;;;MAuBa,wBAAwB,GAAG;IACtC,OAAO,EAAE,sBAAsB;IAC/B,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,6BAAyE;IACrF,IAAI,EAAE,CAAC,aAAa,CAAC;EACrB;AAEF;;;SAGgB,6BAA6B,CAAC,SAAwB;IACpE,OAAO;QACL,iBAAiB,CAAC,SAAS,CAAC,CAAC;KAC9B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;SAYgB,iBAAiB,CAAC,SAAwB,EAAE,UAAyB,MAAM;IACzF,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;QACxB,MAAM,IAAI,KAAK,CAAC;;;OAGb,CAAC,CAAC;KACN;IAED,MAAM,MAAM,GAAW,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAa,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE5D,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,YA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AC,IAAI,CAAC,CAAC;IAEzC,OAAO;;QAEL,QAAQ,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE;QAClD,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,IAAI,EAAE,MAAM,CAAC,IAAI;KAClB,CAAC;AACJ;;AC5IA;;;;;;;AAeA;;ACfA;;;;;;;;ACAA;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/router",
|
|
3
|
-
"version": "13.2.
|
|
3
|
+
"version": "13.2.3",
|
|
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": "13.2.
|
|
28
|
-
"@angular/common": "13.2.
|
|
29
|
-
"@angular/platform-browser": "13.2.
|
|
27
|
+
"@angular/core": "13.2.3",
|
|
28
|
+
"@angular/common": "13.2.3",
|
|
29
|
+
"@angular/platform-browser": "13.2.3",
|
|
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 v13.2.
|
|
2
|
+
* @license Angular v13.2.3
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -1528,7 +1528,7 @@ export declare type QueryParamsHandling = 'merge' | 'preserve' | '';
|
|
|
1528
1528
|
* resolve(
|
|
1529
1529
|
* route: ActivatedRouteSnapshot,
|
|
1530
1530
|
* state: RouterStateSnapshot
|
|
1531
|
-
* ): Observable<
|
|
1531
|
+
* ): Observable<Hero>|Promise<Hero>|Hero {
|
|
1532
1532
|
* return this.service.getHero(route.paramMap.get('id'));
|
|
1533
1533
|
* }
|
|
1534
1534
|
* }
|
|
@@ -1918,7 +1918,7 @@ export declare interface Route {
|
|
|
1918
1918
|
* matches a given path and stops when there is a config match. Importantly there must still be a
|
|
1919
1919
|
* config match for each segment of the URL. For example, '/team/11/user' matches the prefix
|
|
1920
1920
|
* 'team/:id' if one of the route's children matches the segment 'user'. That is, the URL
|
|
1921
|
-
* '/team/11/user
|
|
1921
|
+
* '/team/11/user' matches the config
|
|
1922
1922
|
* `{path: 'team/:id', children: [{path: ':user', component: User}]}`
|
|
1923
1923
|
* but does not match when there are no children as in `{path: 'team/:id', component: Team}`.
|
|
1924
1924
|
*
|
|
@@ -3639,6 +3639,12 @@ export declare class ɵEmptyOutletComponent {
|
|
|
3639
3639
|
*/
|
|
3640
3640
|
export declare function ɵflatten<T>(arr: T[][]): T[];
|
|
3641
3641
|
|
|
3642
|
+
export declare type ɵRestoredState = {
|
|
3643
|
+
[k: string]: any;
|
|
3644
|
+
navigationId: number;
|
|
3645
|
+
ɵrouterPageId?: number;
|
|
3646
|
+
};
|
|
3647
|
+
|
|
3642
3648
|
export declare const ɵROUTER_PROVIDERS: Provider[];
|
|
3643
3649
|
|
|
3644
3650
|
export { }
|
package/testing/testing.d.ts
CHANGED
package/upgrade/upgrade.d.ts
CHANGED