@rxdi/router 0.7.221 → 0.7.223
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/dist/helpers.d.ts +1 -1
- package/dist/helpers.js +5 -10
- package/dist/injection.tokens.d.ts +3 -2
- package/dist/outlet.d.ts +1 -1
- package/dist/outlet.js +2 -2
- package/package.json +3 -3
- package/types/@vaadin/router.d.ts +0 -30
package/dist/helpers.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { BehaviorSubject } from 'rxjs';
|
|
|
2
2
|
import { Route } from './injection.tokens';
|
|
3
3
|
export declare const ChildRoutesObservable: BehaviorSubject<Route[]>;
|
|
4
4
|
export declare function loadRoutes(routes: Route[]): Route<any>[];
|
|
5
|
-
export declare function getQueryParams<T>(
|
|
5
|
+
export declare function getQueryParams<T>(): T;
|
package/dist/helpers.js
CHANGED
|
@@ -22,7 +22,6 @@ function assignChildren(route) {
|
|
|
22
22
|
const lazyModule = route.children;
|
|
23
23
|
route.children = function (context, commands) {
|
|
24
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
console.log('Lazy loading route:', route.path);
|
|
26
25
|
const loadedModule = yield lazyModule(context, commands);
|
|
27
26
|
let routes = exports.ChildRoutesObservable.getValue();
|
|
28
27
|
if (loadedModule && Array.isArray(loadedModule.ROUTES)) {
|
|
@@ -41,7 +40,7 @@ function assignChildren(route) {
|
|
|
41
40
|
function activateGuard(result, commands, route) {
|
|
42
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
42
|
if ((0, rxjs_1.isObservable)(result)) {
|
|
44
|
-
result =
|
|
43
|
+
result = (0, rxjs_1.lastValueFrom)(result);
|
|
45
44
|
}
|
|
46
45
|
if (yield result) {
|
|
47
46
|
return result;
|
|
@@ -112,14 +111,10 @@ function loadRoutes(routes) {
|
|
|
112
111
|
routes.splice(routes.indexOf(notFoundRoute), 1);
|
|
113
112
|
routes.push(notFoundRoute);
|
|
114
113
|
}
|
|
115
|
-
const
|
|
114
|
+
const loadedRoutes = [...routes].map((route) => assignStaticIs(assignAction(assignChildren(route))));
|
|
116
115
|
exports.ChildRoutesObservable.next(null);
|
|
117
|
-
return
|
|
116
|
+
return loadedRoutes;
|
|
118
117
|
}
|
|
119
|
-
function getQueryParams(
|
|
120
|
-
|
|
121
|
-
return params.reduce((prev, curr) => {
|
|
122
|
-
prev[curr] = uriParams.get(curr);
|
|
123
|
-
return prev;
|
|
124
|
-
}, {});
|
|
118
|
+
function getQueryParams() {
|
|
119
|
+
return [...new URLSearchParams(location.search)].reduce((prev, [key, value]) => (Object.assign(Object.assign({}, prev), { [key]: value })), {});
|
|
125
120
|
}
|
|
@@ -32,8 +32,9 @@ export interface RouteContext extends Route {
|
|
|
32
32
|
path?: string | string[];
|
|
33
33
|
} | null;
|
|
34
34
|
}
|
|
35
|
+
export type CanActiveResolverResponse = CanActivateRedirectResult | Promise<CanActivateRedirectResult> | boolean | Promise<boolean> | Observable<boolean>;
|
|
35
36
|
export interface CanActivateResolver {
|
|
36
|
-
canActivate(context: CanActivateContext, commands: CanActivateCommands):
|
|
37
|
+
canActivate(context: CanActivateContext, commands: CanActivateCommands): CanActiveResolverResponse;
|
|
37
38
|
}
|
|
38
39
|
export interface CanActivateRedirectResult {
|
|
39
40
|
redirect: {
|
|
@@ -56,7 +57,7 @@ export interface CanActivateContext {
|
|
|
56
57
|
}
|
|
57
58
|
export interface CanActivateCommands {
|
|
58
59
|
component: (component: string) => HTMLElement;
|
|
59
|
-
redirect: (path: string) => CanActivateRedirectResult;
|
|
60
|
+
redirect: (path: string | string[]) => CanActivateRedirectResult;
|
|
60
61
|
}
|
|
61
62
|
export declare const RouterRoutlet = "router-outlet";
|
|
62
63
|
export declare const Routes = "router-routes";
|
package/dist/outlet.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare class Outlet extends Router {
|
|
|
17
17
|
onSnapshotChange(): Observable<Detail>;
|
|
18
18
|
freezeRouter(): void;
|
|
19
19
|
unfreezeRouter(): void;
|
|
20
|
-
getQueryParams<T>(
|
|
20
|
+
getQueryParams<T>(): T;
|
|
21
21
|
/**
|
|
22
22
|
* Triggers navigation to a new path. Returns a boolean without waiting until the navigation is complete. Returns true if at least one Router has handled the navigation (was subscribed and had baseUrl matching the pathname argument), otherwise returns false.
|
|
23
23
|
* @param pathnamea new in-app path
|
package/dist/outlet.js
CHANGED
|
@@ -28,8 +28,8 @@ class Outlet extends lib_1.Router {
|
|
|
28
28
|
unfreezeRouter() {
|
|
29
29
|
this.freeze = false;
|
|
30
30
|
}
|
|
31
|
-
getQueryParams(
|
|
32
|
-
return (0, helpers_1.getQueryParams)(
|
|
31
|
+
getQueryParams() {
|
|
32
|
+
return (0, helpers_1.getQueryParams)();
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Triggers navigation to a new path. Returns a boolean without waiting until the navigation is complete. Returns true if at least one Router has handled the navigation (was subscribed and had baseUrl matching the pathname argument), otherwise returns false.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdi/router",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.223",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"author": "Kristiyan Tachev",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"router-slot": "^1.5.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@rxdi/core": "^0.7.
|
|
19
|
-
"@rxdi/lit-html": "^0.7.
|
|
18
|
+
"@rxdi/core": "^0.7.222",
|
|
19
|
+
"@rxdi/lit-html": "^0.7.222"
|
|
20
20
|
},
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"module": "./dist/index.js",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface Route<C> {
|
|
2
|
-
path: string;
|
|
3
|
-
component?: C;
|
|
4
|
-
action?: () => Promise<any>;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface RouterOptions {
|
|
8
|
-
baseUrl: string;
|
|
9
|
-
}
|
|
10
|
-
export interface NavigationTrigger {}
|
|
11
|
-
export declare class Router {
|
|
12
|
-
public static go(path): boolean;
|
|
13
|
-
static setTriggers(triggers: NavigationTrigger): void
|
|
14
|
-
constructor(element: any, options: { baseUrl?: string; });
|
|
15
|
-
setRoutes(routes: Route[]): void;
|
|
16
|
-
setOutlet(outlet: Node): void;
|
|
17
|
-
urlForName(url: string, params: any): string;
|
|
18
|
-
urlForPath(url: string, params: any): string;
|
|
19
|
-
getOutlet(): Node;
|
|
20
|
-
getRoutes(): any;
|
|
21
|
-
render(pathnameOrContext: string | { pathname: string; }, shouldUpdateHistory): Promise<Node>;
|
|
22
|
-
removeRoutes(): void;
|
|
23
|
-
subscribe(): void;
|
|
24
|
-
unsubscribe(): void;
|
|
25
|
-
addRoutes(routes: Route<C> | Route<C>[]): Route[];
|
|
26
|
-
location: {
|
|
27
|
-
routes: Route<C>[];
|
|
28
|
-
params: any
|
|
29
|
-
}
|
|
30
|
-
}
|