@esmx/router 3.0.0-rc.16 → 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.
@@ -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): any;
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
  /**
@@ -8,7 +8,7 @@ export declare abstract class BaseRouterHistory implements RouterHistory {
8
8
  /**
9
9
  * 路由是否冻结
10
10
  */
11
- get isFrozen(): any;
11
+ get isFrozen(): boolean;
12
12
  /**
13
13
  * 匹配的当前路由
14
14
  */
@@ -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(): any;
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;
@@ -1,4 +1,4 @@
1
- import { RouterMode } from "../types";
1
+ import { RouterMode } from "../types/index.mjs";
2
2
  import { AbstractHistory } from "./abstract.mjs";
3
3
  import { HtmlHistory } from "./html.mjs";
4
4
  export function createHistory({
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  export { createRouter } from "./router.mjs";
2
- export * from "./types";
2
+ export * from "./types/index.mjs";
3
3
  export * from "./utils/index.mjs";
@@ -131,7 +131,7 @@ function createRouteMatches(routes, parent) {
131
131
  ...createRouteMatch(
132
132
  {
133
133
  ...route,
134
- path: route.path instanceof Array ? route.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 instanceof Array ? route.path : [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 instanceof Array ? routeMatches : routeMatches[routeMatches.length - 1];
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(): any;
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;
@@ -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 instanceof Array ? handler : [handler];
13
+ const params = Array.isArray(handler) ? handler : [handler];
14
14
  this.handlers.push(...params);
15
15
  }
16
16
  reset() {