@angular/router 7.2.0-beta.0 → 7.2.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.
- package/bundles/router-testing.umd.js +1 -1
- package/bundles/router-testing.umd.js.map +1 -1
- package/bundles/router-testing.umd.min.js +1 -1
- package/bundles/router-testing.umd.min.js.map +1 -1
- package/bundles/router-upgrade.umd.js +1 -1
- package/bundles/router-upgrade.umd.js.map +1 -1
- package/bundles/router-upgrade.umd.min.js +1 -1
- package/bundles/router-upgrade.umd.min.js.map +1 -1
- package/bundles/router.umd.js +87 -18
- package/bundles/router.umd.js.map +1 -1
- package/bundles/router.umd.min.js +6 -6
- package/bundles/router.umd.min.js.map +1 -1
- package/esm2015/index.js +2 -3
- package/esm2015/public_api.js +2 -4
- package/esm2015/router.externs.js +7 -3
- package/esm2015/router.js +1 -2
- package/esm2015/src/apply_redirects.js +60 -21
- package/esm2015/src/components/empty_outlet.js +2 -3
- package/esm2015/src/config.js +40 -66
- package/esm2015/src/create_router_state.js +3 -4
- package/esm2015/src/create_url_tree.js +3 -6
- package/esm2015/src/directives/router_link.js +71 -13
- package/esm2015/src/directives/router_link_active.js +30 -10
- package/esm2015/src/directives/router_outlet.js +46 -15
- package/esm2015/src/events.js +47 -35
- package/esm2015/src/index.js +2 -3
- package/esm2015/src/interfaces.js +44 -25
- package/esm2015/src/operators/activate_routes.js +31 -9
- package/esm2015/src/operators/apply_redirects.js +2 -3
- package/esm2015/src/operators/check_guards.js +8 -9
- package/esm2015/src/operators/prioritized_guard_value.js +4 -6
- package/esm2015/src/operators/recognize.js +2 -3
- package/esm2015/src/operators/resolve_data.js +3 -4
- package/esm2015/src/operators/switch_tap.js +2 -3
- package/esm2015/src/private_export.js +2 -3
- package/esm2015/src/recognize.js +41 -21
- package/esm2015/src/route_reuse_strategy.js +2 -9
- package/esm2015/src/router.js +304 -199
- package/esm2015/src/router_config_loader.js +24 -10
- package/esm2015/src/router_module.js +202 -188
- package/esm2015/src/router_outlet_context.js +7 -4
- package/esm2015/src/router_preloader.js +27 -8
- package/esm2015/src/router_scroller.js +37 -11
- package/esm2015/src/router_state.js +12 -19
- package/esm2015/src/shared.js +42 -34
- package/esm2015/src/url_handling_strategy.js +2 -3
- package/esm2015/src/url_tree.js +31 -7
- package/esm2015/src/utils/collection.js +2 -3
- package/esm2015/src/utils/preactivation.js +10 -5
- package/esm2015/src/utils/tree.js +5 -3
- package/esm2015/src/utils/type_guards.js +2 -3
- package/esm2015/src/version.js +11 -6
- package/esm2015/testing/index.js +2 -3
- package/esm2015/testing/public_api.js +2 -4
- package/esm2015/testing/src/router_testing_module.js +9 -6
- package/esm2015/testing/src/testing.js +2 -3
- package/esm2015/testing/testing.js +1 -2
- package/esm2015/upgrade/index.js +2 -3
- package/esm2015/upgrade/public_api.js +2 -4
- package/esm2015/upgrade/src/upgrade.js +9 -8
- package/esm2015/upgrade/upgrade.js +1 -2
- package/esm5/index.js +1 -2
- package/esm5/public_api.js +1 -2
- package/esm5/router.js +1 -2
- package/esm5/src/apply_redirects.js +1 -2
- package/esm5/src/components/empty_outlet.js +1 -2
- package/esm5/src/config.js +1 -2
- package/esm5/src/create_router_state.js +1 -2
- package/esm5/src/create_url_tree.js +1 -2
- package/esm5/src/directives/router_link.js +31 -2
- package/esm5/src/directives/router_link_active.js +1 -2
- package/esm5/src/directives/router_outlet.js +1 -2
- package/esm5/src/events.js +1 -2
- package/esm5/src/index.js +1 -2
- package/esm5/src/interfaces.js +1 -2
- package/esm5/src/operators/activate_routes.js +1 -2
- package/esm5/src/operators/apply_redirects.js +1 -2
- package/esm5/src/operators/check_guards.js +1 -2
- package/esm5/src/operators/prioritized_guard_value.js +1 -2
- package/esm5/src/operators/recognize.js +1 -2
- package/esm5/src/operators/resolve_data.js +1 -2
- package/esm5/src/operators/switch_tap.js +1 -2
- package/esm5/src/private_export.js +1 -2
- package/esm5/src/recognize.js +1 -2
- package/esm5/src/route_reuse_strategy.js +1 -2
- package/esm5/src/router.js +50 -18
- package/esm5/src/router_config_loader.js +1 -2
- package/esm5/src/router_module.js +1 -2
- package/esm5/src/router_outlet_context.js +1 -2
- package/esm5/src/router_preloader.js +1 -2
- package/esm5/src/router_scroller.js +1 -2
- package/esm5/src/router_state.js +1 -2
- package/esm5/src/shared.js +1 -2
- package/esm5/src/url_handling_strategy.js +1 -2
- package/esm5/src/url_tree.js +1 -2
- package/esm5/src/utils/collection.js +1 -2
- package/esm5/src/utils/preactivation.js +7 -2
- package/esm5/src/utils/tree.js +1 -2
- package/esm5/src/utils/type_guards.js +1 -2
- package/esm5/src/version.js +2 -3
- package/esm5/testing/index.js +1 -2
- package/esm5/testing/public_api.js +1 -2
- package/esm5/testing/src/router_testing_module.js +1 -2
- package/esm5/testing/src/testing.js +1 -2
- package/esm5/testing/testing.js +1 -2
- package/esm5/upgrade/index.js +1 -2
- package/esm5/upgrade/public_api.js +1 -2
- package/esm5/upgrade/src/upgrade.js +1 -2
- package/esm5/upgrade/upgrade.js +1 -2
- package/fesm2015/router.js +387 -202
- package/fesm2015/router.js.map +1 -1
- package/fesm2015/testing.js +7 -8
- package/fesm2015/testing.js.map +1 -1
- package/fesm2015/upgrade.js +11 -10
- package/fesm2015/upgrade.js.map +1 -1
- package/fesm5/router.js +87 -18
- package/fesm5/router.js.map +1 -1
- package/fesm5/testing.js +1 -1
- package/fesm5/testing.js.map +1 -1
- package/fesm5/upgrade.js +1 -1
- package/fesm5/upgrade.js.map +1 -1
- package/package.json +4 -4
- package/router.metadata.json +1 -1
- package/src/config.d.ts +9 -2
- package/src/directives/router_link.d.ts +27 -0
- package/src/events.d.ts +6 -2
- package/src/index.d.ts +1 -1
- package/src/router.d.ts +74 -3
- package/testing.d.ts +5 -0
- package/upgrade.d.ts +5 -0
package/src/router.d.ts
CHANGED
|
@@ -125,6 +125,20 @@ export interface NavigationExtras {
|
|
|
125
125
|
* ```
|
|
126
126
|
*/
|
|
127
127
|
replaceUrl?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* State passed to any navigation. This value will be accessible through the `extras` object
|
|
130
|
+
* returned from `router.getCurrentNavigation()` while a navigation is executing. Once a
|
|
131
|
+
* navigation completes, this value will be written to `history.state` when the `location.go`
|
|
132
|
+
* or `location.replaceState` method is called before activating of this route. Note that
|
|
133
|
+
* `history.state` will not pass an object equality test because the `navigationId` will be
|
|
134
|
+
* added to the state before being written.
|
|
135
|
+
*
|
|
136
|
+
* While `history.state` can accept any type of value, because the router adds the `navigationId`
|
|
137
|
+
* on each navigation, the `state` must always be an object.
|
|
138
|
+
*/
|
|
139
|
+
state?: {
|
|
140
|
+
[k: string]: any;
|
|
141
|
+
};
|
|
128
142
|
}
|
|
129
143
|
/**
|
|
130
144
|
* @description
|
|
@@ -138,6 +152,56 @@ export interface NavigationExtras {
|
|
|
138
152
|
* @publicApi
|
|
139
153
|
*/
|
|
140
154
|
export declare type ErrorHandler = (error: any) => any;
|
|
155
|
+
export declare type RestoredState = {
|
|
156
|
+
[k: string]: any;
|
|
157
|
+
navigationId: number;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* @description
|
|
161
|
+
*
|
|
162
|
+
* Information about any given navigation. This information can be gotten from the router at
|
|
163
|
+
* any time using the `router.getCurrentNavigation()` method.
|
|
164
|
+
*
|
|
165
|
+
* @publicApi
|
|
166
|
+
*/
|
|
167
|
+
export declare type Navigation = {
|
|
168
|
+
/**
|
|
169
|
+
* The ID of the current navigation.
|
|
170
|
+
*/
|
|
171
|
+
id: number;
|
|
172
|
+
/**
|
|
173
|
+
* Target URL passed into the {@link Router#navigateByUrl} call before navigation. This is
|
|
174
|
+
* the value before the router has parsed or applied redirects to it.
|
|
175
|
+
*/
|
|
176
|
+
initialUrl: string | UrlTree;
|
|
177
|
+
/**
|
|
178
|
+
* The initial target URL after being parsed with {@link UrlSerializer.extract()}.
|
|
179
|
+
*/
|
|
180
|
+
extractedUrl: UrlTree;
|
|
181
|
+
/**
|
|
182
|
+
* Extracted URL after redirects have been applied. This URL may not be available immediately,
|
|
183
|
+
* therefore this property can be `undefined`. It is guaranteed to be set after the
|
|
184
|
+
* {@link RoutesRecognized} event fires.
|
|
185
|
+
*/
|
|
186
|
+
finalUrl?: UrlTree;
|
|
187
|
+
/**
|
|
188
|
+
* Identifies the trigger of the navigation.
|
|
189
|
+
*
|
|
190
|
+
* * 'imperative'--triggered by `router.navigateByUrl` or `router.navigate`.
|
|
191
|
+
* * 'popstate'--triggered by a popstate event
|
|
192
|
+
* * 'hashchange'--triggered by a hashchange event
|
|
193
|
+
*/
|
|
194
|
+
trigger: 'imperative' | 'popstate' | 'hashchange';
|
|
195
|
+
/**
|
|
196
|
+
* The NavigationExtras used in this navigation. See {@link NavigationExtras} for more info.
|
|
197
|
+
*/
|
|
198
|
+
extras: NavigationExtras;
|
|
199
|
+
/**
|
|
200
|
+
* Previously successful Navigation object. Only a single previous Navigation is available,
|
|
201
|
+
* therefore this previous Navigation will always have a `null` value for `previousNavigation`.
|
|
202
|
+
*/
|
|
203
|
+
previousNavigation: Navigation | null;
|
|
204
|
+
};
|
|
141
205
|
export declare type NavigationTransition = {
|
|
142
206
|
id: number;
|
|
143
207
|
currentUrlTree: UrlTree;
|
|
@@ -150,9 +214,7 @@ export declare type NavigationTransition = {
|
|
|
150
214
|
reject: any;
|
|
151
215
|
promise: Promise<boolean>;
|
|
152
216
|
source: NavigationTrigger;
|
|
153
|
-
|
|
154
|
-
navigationId: number;
|
|
155
|
-
} | null;
|
|
217
|
+
restoredState: RestoredState | null;
|
|
156
218
|
currentSnapshot: RouterStateSnapshot;
|
|
157
219
|
targetSnapshot: RouterStateSnapshot | null;
|
|
158
220
|
currentRouterState: RouterState;
|
|
@@ -181,6 +243,8 @@ export declare class Router {
|
|
|
181
243
|
private rawUrlTree;
|
|
182
244
|
private readonly transitions;
|
|
183
245
|
private navigations;
|
|
246
|
+
private lastSuccessfulNavigation;
|
|
247
|
+
private currentNavigation;
|
|
184
248
|
private locationSubscription;
|
|
185
249
|
private navigationId;
|
|
186
250
|
private configLoader;
|
|
@@ -259,6 +323,8 @@ export declare class Router {
|
|
|
259
323
|
setUpLocationChangeListener(): void;
|
|
260
324
|
/** The current url */
|
|
261
325
|
readonly url: string;
|
|
326
|
+
/** The current Navigation object if one exists */
|
|
327
|
+
getCurrentNavigation(): Navigation | null;
|
|
262
328
|
/**
|
|
263
329
|
* Resets the configuration used for navigation and generating links.
|
|
264
330
|
*
|
|
@@ -372,6 +438,11 @@ export declare class Router {
|
|
|
372
438
|
* The first parameter of `navigate()` is a delta to be applied to the current URL
|
|
373
439
|
* or the one provided in the `relativeTo` property of the second parameter (the
|
|
374
440
|
* `NavigationExtras`).
|
|
441
|
+
*
|
|
442
|
+
* In order to affect this browser's `history.state` entry, the `state`
|
|
443
|
+
* parameter can be passed. This must be an object because the router
|
|
444
|
+
* will add the `navigationId` property to this object before creating
|
|
445
|
+
* the new history item.
|
|
375
446
|
*/
|
|
376
447
|
navigate(commands: any[], extras?: NavigationExtras): Promise<boolean>;
|
|
377
448
|
/** Serializes a `UrlTree` into a string */
|
package/testing.d.ts
CHANGED