@esmx/router 3.0.0-rc.17 → 3.0.0-rc.18
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/history/abstract.d.ts +1 -1
- package/dist/history/base.d.ts +1 -1
- package/dist/history/html.d.ts +9 -1
- package/dist/history/index.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/matcher/create-matcher.mjs +3 -3
- package/dist/router.d.ts +1 -1
- package/dist/router.mjs +1 -1
- package/dist/task-pipe/task.mjs +1 -1
- package/dist/types/index.d.ts +694 -0
- package/dist/types/index.mjs +6 -0
- package/dist/utils/guards.d.ts +1 -1
- package/dist/utils/path.mjs +2 -1
- package/package.json +3 -3
- package/src/matcher/create-matcher.ts +3 -4
- package/src/task-pipe/task.ts +1 -1
- package/src/types/index.ts +858 -0
- package/src/utils/path.ts +2 -1
|
@@ -9,7 +9,7 @@ export declare class AbstractHistory extends BaseRouterHistory {
|
|
|
9
9
|
}): Promise<void>;
|
|
10
10
|
destroy(): void;
|
|
11
11
|
setupListeners(): void;
|
|
12
|
-
isSameHost(location: RouterRawLocation, route: Route):
|
|
12
|
+
isSameHost(location: RouterRawLocation, route: Route): boolean;
|
|
13
13
|
handleOutside(location: RouterRawLocation, replace?: boolean, isTriggerWithWindow?: boolean): boolean;
|
|
14
14
|
push(location: RouterRawLocation): Promise<void>;
|
|
15
15
|
/**
|
package/dist/history/base.d.ts
CHANGED
package/dist/history/html.d.ts
CHANGED
|
@@ -2,7 +2,15 @@ import type { RouterInstance, RouterRawLocation } from '../types';
|
|
|
2
2
|
import { BaseRouterHistory } from './base';
|
|
3
3
|
export declare class HtmlHistory extends BaseRouterHistory {
|
|
4
4
|
constructor(router: RouterInstance);
|
|
5
|
-
getCurrentLocation():
|
|
5
|
+
getCurrentLocation(): {
|
|
6
|
+
state: any;
|
|
7
|
+
query?: Record<string, string | undefined>;
|
|
8
|
+
queryArray: Record<string, string[]>;
|
|
9
|
+
params?: Record<string, string>;
|
|
10
|
+
hash?: string;
|
|
11
|
+
path: string;
|
|
12
|
+
base: string;
|
|
13
|
+
};
|
|
6
14
|
onPopState: (e: PopStateEvent) => void;
|
|
7
15
|
init({ replace }?: {
|
|
8
16
|
replace?: boolean;
|
package/dist/history/index.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -131,7 +131,7 @@ function createRouteMatches(routes, parent) {
|
|
|
131
131
|
...createRouteMatch(
|
|
132
132
|
{
|
|
133
133
|
...route,
|
|
134
|
-
path: route.path
|
|
134
|
+
path: Array.isArray(route.path) ? route.path : [route.path]
|
|
135
135
|
},
|
|
136
136
|
parent
|
|
137
137
|
)
|
|
@@ -140,7 +140,7 @@ function createRouteMatches(routes, parent) {
|
|
|
140
140
|
return routeMatches;
|
|
141
141
|
}
|
|
142
142
|
function createRouteMatch(route, parent) {
|
|
143
|
-
const pathList = route.path
|
|
143
|
+
const pathList = Array.isArray(route.path) ? route.path : [route.path];
|
|
144
144
|
const routeMatches = pathList.reduce(
|
|
145
145
|
(acc, item, index) => {
|
|
146
146
|
const { children } = route;
|
|
@@ -214,5 +214,5 @@ function createRouteMatch(route, parent) {
|
|
|
214
214
|
},
|
|
215
215
|
[]
|
|
216
216
|
);
|
|
217
|
-
return route.path
|
|
217
|
+
return Array.isArray(route.path) ? routeMatches : routeMatches[routeMatches.length - 1];
|
|
218
218
|
}
|
package/dist/router.d.ts
CHANGED
|
@@ -106,6 +106,6 @@ export declare class Router implements RouterInstance {
|
|
|
106
106
|
go(delta?: number): void;
|
|
107
107
|
forward(): void;
|
|
108
108
|
back(): void;
|
|
109
|
-
getRoutes():
|
|
109
|
+
getRoutes(): import("./types").RouteMatch[];
|
|
110
110
|
}
|
|
111
111
|
export declare function createRouter(options: RouterOptions): RouterInstance;
|
package/dist/router.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { createRouterMatcher } from "./matcher/index.mjs";
|
|
|
4
4
|
import {
|
|
5
5
|
RouterMode,
|
|
6
6
|
StateLayerConfigKey
|
|
7
|
-
} from "./types";
|
|
7
|
+
} from "./types/index.mjs";
|
|
8
8
|
import { inBrowser, normalizePath, regexDomain } from "./utils/index.mjs";
|
|
9
9
|
const baseValue = Number(Date.now());
|
|
10
10
|
let layerIdOffset = 0;
|
package/dist/task-pipe/task.mjs
CHANGED
|
@@ -10,7 +10,7 @@ export var TaskStatus = /* @__PURE__ */ ((TaskStatus2) => {
|
|
|
10
10
|
export class Tasks {
|
|
11
11
|
handlers = [];
|
|
12
12
|
add(handler) {
|
|
13
|
-
const params = handler
|
|
13
|
+
const params = Array.isArray(handler) ? handler : [handler];
|
|
14
14
|
this.handlers.push(...params);
|
|
15
15
|
}
|
|
16
16
|
reset() {
|