@esmx/router 3.0.0-rc.77 → 3.0.0-rc.79
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/index.d.ts +3 -3
- package/dist/index.mjs +8 -8
- package/dist/navigation.d.ts +1 -1
- package/dist/route-transition.d.ts +1 -1
- package/dist/route-transition.mjs +2 -2
- package/dist/route.mjs +1 -1
- package/dist/router.d.ts +1 -1
- package/dist/router.mjs +1 -1
- package/package.json +4 -4
- package/src/index.ts +29 -30
- package/src/navigation.ts +1 -1
- package/src/options.ts +1 -1
- package/src/route-transition.ts +4 -6
- package/src/route.ts +3 -3
- package/src/router.ts +3 -3
- package/src/scroll.ts +0 -2
- package/src/util.ts +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { RouteError, RouteNavigationAbortedError, RouteSelfRedirectionError, RouteTaskCancelledError, RouteTaskExecutionError } from './error';
|
|
2
2
|
export { Route } from './route';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { Router } from './router';
|
|
4
|
+
export { type RouteConfig, type RouteConfirmHook, type RouteConfirmHookResult, type RouteHandleHook, type RouteHandleResult, type RouteLayerOptions, type RouteLayerResult, type RouteLocation, type RouteLocationInput, type RouteMatcher, type RouteMatchResult, type RouteMatchType, type RouteMeta, type RouteNotifyHook, type RouteOptions, type RouteParsedConfig, type RouterLayerOptions, type RouterLinkAttributes, type RouterLinkProps, type RouterLinkResolved, type RouterLinkType, type RouterMicroApp, type RouterMicroAppCallback, type RouterMicroAppOptions, RouterMode, type RouterOptions, type RouterParsedOptions, type RouteState, RouteType, type RouteVerifyHook } from './types';
|
|
5
5
|
import type { Router } from './router';
|
|
6
6
|
import type { Route, RouteLocation, RouteLocationInput } from './types';
|
|
7
7
|
/** @deprecated Use `Router` directly instead of `RouterInstance`. */
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {
|
|
2
|
+
RouteError,
|
|
3
|
+
RouteNavigationAbortedError,
|
|
4
|
+
RouteSelfRedirectionError,
|
|
5
|
+
RouteTaskCancelledError,
|
|
6
|
+
RouteTaskExecutionError
|
|
7
|
+
} from "./error.mjs";
|
|
2
8
|
export { Route } from "./route.mjs";
|
|
9
|
+
export { Router } from "./router.mjs";
|
|
3
10
|
export {
|
|
4
11
|
RouterMode,
|
|
5
12
|
RouteType
|
|
6
13
|
} from "./types.mjs";
|
|
7
|
-
export {
|
|
8
|
-
RouteError,
|
|
9
|
-
RouteTaskCancelledError,
|
|
10
|
-
RouteTaskExecutionError,
|
|
11
|
-
RouteNavigationAbortedError,
|
|
12
|
-
RouteSelfRedirectionError
|
|
13
|
-
} from "./error.mjs";
|
package/dist/navigation.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Route } from './route';
|
|
2
2
|
import type { Router } from './router';
|
|
3
|
-
import { RouteType } from './types';
|
|
4
3
|
import type { RouteConfirmHook, RouteConfirmHookResult, RouteLocationInput, RouteNotifyHook } from './types';
|
|
4
|
+
import { RouteType } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* Route transition hooks responsible for handling different stages of the navigation process.
|
|
7
7
|
* Each hook is responsible for a specific aspect of route transition.
|
|
@@ -3,8 +3,8 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { Route } from "./route.mjs";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
createRouteTask,
|
|
7
|
+
RouteTaskController
|
|
8
8
|
} from "./route-task.mjs";
|
|
9
9
|
import {
|
|
10
10
|
getSavedScrollPosition,
|
package/dist/route.mjs
CHANGED
|
@@ -88,7 +88,7 @@ export class Route {
|
|
|
88
88
|
const to = options.normalizeURL(parseLocation(toInput, base), from);
|
|
89
89
|
let match = null;
|
|
90
90
|
if (to.origin === base.origin && to.pathname.startsWith(base.pathname)) {
|
|
91
|
-
const isLayer = toType === RouteType.pushLayer;
|
|
91
|
+
const isLayer = toType === RouteType.pushLayer || options.layer;
|
|
92
92
|
match = options.matcher(to, base, (config) => {
|
|
93
93
|
if (isLayer) {
|
|
94
94
|
return config.layer !== false;
|
package/dist/router.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { MicroApp } from './micro-app';
|
|
|
2
2
|
import { Navigation } from './navigation';
|
|
3
3
|
import { Route } from './route';
|
|
4
4
|
import { RouteTransition } from './route-transition';
|
|
5
|
-
import { RouteType, RouterMode } from './types';
|
|
6
5
|
import type { RouteConfirmHook, RouteLayerResult, RouteLocationInput, RouteMatchType, RouteNotifyHook, RouterLinkProps, RouterLinkResolved, RouterOptions, RouterParsedOptions } from './types';
|
|
6
|
+
import { RouterMode, RouteType } from './types';
|
|
7
7
|
export declare class Router {
|
|
8
8
|
readonly options: RouterOptions;
|
|
9
9
|
readonly parsedOptions: RouterParsedOptions;
|
package/dist/router.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { parsedOptions } from "./options.mjs";
|
|
|
8
8
|
import { Route } from "./route.mjs";
|
|
9
9
|
import { RouteTransition } from "./route-transition.mjs";
|
|
10
10
|
import { createLinkResolver } from "./router-link.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { RouterMode, RouteType } from "./types.mjs";
|
|
12
12
|
import { isNotNullish, isPlainObject, isRouteMatched } from "./util.mjs";
|
|
13
13
|
export class Router {
|
|
14
14
|
constructor(options) {
|
package/package.json
CHANGED
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
"path-to-regexp": "^6.2.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@biomejs/biome": "
|
|
35
|
-
"@types/node": "^24.
|
|
34
|
+
"@biomejs/biome": "2.3.7",
|
|
35
|
+
"@types/node": "^24.0.0",
|
|
36
36
|
"@vitest/coverage-v8": "3.2.4",
|
|
37
37
|
"happy-dom": "^20.0.10",
|
|
38
38
|
"typescript": "5.9.3",
|
|
39
39
|
"unbuild": "3.6.1",
|
|
40
40
|
"vitest": "3.2.4"
|
|
41
41
|
},
|
|
42
|
-
"version": "3.0.0-rc.
|
|
42
|
+
"version": "3.0.0-rc.79",
|
|
43
43
|
"type": "module",
|
|
44
44
|
"private": false,
|
|
45
45
|
"exports": {
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"template",
|
|
59
59
|
"public"
|
|
60
60
|
],
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "29c95da5062140daffe10ba135ba66bae6e65fc6"
|
|
62
62
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,55 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
// Error types
|
|
2
|
+
export {
|
|
3
|
+
RouteError,
|
|
4
|
+
RouteNavigationAbortedError,
|
|
5
|
+
RouteSelfRedirectionError,
|
|
6
|
+
RouteTaskCancelledError,
|
|
7
|
+
RouteTaskExecutionError
|
|
8
|
+
} from './error';
|
|
2
9
|
export { Route } from './route';
|
|
10
|
+
export { Router } from './router';
|
|
3
11
|
export {
|
|
4
|
-
|
|
5
|
-
RouterMode,
|
|
6
|
-
RouteType,
|
|
12
|
+
type RouteConfig,
|
|
7
13
|
// Hook function types
|
|
8
14
|
type RouteConfirmHook,
|
|
9
15
|
type RouteConfirmHookResult,
|
|
10
|
-
type RouteVerifyHook,
|
|
11
16
|
type RouteHandleHook,
|
|
12
|
-
type RouteNotifyHook,
|
|
13
|
-
// Basic data types
|
|
14
|
-
type RouteMeta,
|
|
15
|
-
type RouteState,
|
|
16
17
|
type RouteHandleResult,
|
|
17
|
-
|
|
18
|
+
// Router Layer types
|
|
19
|
+
type RouteLayerOptions,
|
|
20
|
+
type RouteLayerResult,
|
|
18
21
|
// Route location and config types
|
|
19
22
|
type RouteLocation,
|
|
20
23
|
type RouteLocationInput,
|
|
21
|
-
type RouteConfig,
|
|
22
|
-
type RouteParsedConfig,
|
|
23
|
-
type RouteMatchResult,
|
|
24
24
|
type RouteMatcher,
|
|
25
|
+
type RouteMatchResult,
|
|
26
|
+
type RouteMatchType,
|
|
27
|
+
// Basic data types
|
|
28
|
+
type RouteMeta,
|
|
29
|
+
type RouteNotifyHook,
|
|
25
30
|
type RouteOptions,
|
|
26
|
-
|
|
27
|
-
type RouteLayerOptions,
|
|
28
|
-
type RouteLayerResult,
|
|
31
|
+
type RouteParsedConfig,
|
|
29
32
|
type RouterLayerOptions,
|
|
33
|
+
type RouterLinkAttributes,
|
|
34
|
+
type RouterLinkProps,
|
|
35
|
+
type RouterLinkResolved,
|
|
36
|
+
// RouterLink types
|
|
37
|
+
type RouterLinkType,
|
|
30
38
|
// Router MicroApp types
|
|
31
39
|
type RouterMicroApp,
|
|
32
40
|
type RouterMicroAppCallback,
|
|
33
41
|
type RouterMicroAppOptions,
|
|
42
|
+
// Core enums
|
|
43
|
+
RouterMode,
|
|
34
44
|
// Router core types
|
|
35
45
|
type RouterOptions,
|
|
36
46
|
type RouterParsedOptions,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
type
|
|
40
|
-
type RouterLinkProps,
|
|
41
|
-
type RouterLinkResolved
|
|
47
|
+
type RouteState,
|
|
48
|
+
RouteType,
|
|
49
|
+
type RouteVerifyHook
|
|
42
50
|
} from './types';
|
|
43
51
|
|
|
44
|
-
// Error types
|
|
45
|
-
export {
|
|
46
|
-
RouteError,
|
|
47
|
-
RouteTaskCancelledError,
|
|
48
|
-
RouteTaskExecutionError,
|
|
49
|
-
RouteNavigationAbortedError,
|
|
50
|
-
RouteSelfRedirectionError
|
|
51
|
-
} from './error';
|
|
52
|
-
|
|
53
52
|
// =================== Re-exporting deprecated types ===================
|
|
54
53
|
|
|
55
54
|
import type { Router } from './router';
|
package/src/navigation.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PAGE_ID } from './increment-id';
|
|
2
|
+
import type { RouterParsedOptions, RouteState } from './types';
|
|
2
3
|
import { RouterMode } from './types';
|
|
3
|
-
import type { RouteState, RouterParsedOptions } from './types';
|
|
4
4
|
|
|
5
5
|
type NavigationSubscribe = (url: string, state: RouteState) => void;
|
|
6
6
|
type NavigationGoResult = null | {
|
package/src/options.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createMatcher, createRouteMatches } from './matcher';
|
|
2
2
|
import type { Router } from './router';
|
|
3
|
-
import { RouterMode } from './types';
|
|
4
3
|
import type { Route, RouterOptions, RouterParsedOptions } from './types';
|
|
4
|
+
import { RouterMode } from './types';
|
|
5
5
|
import { isBrowser } from './util';
|
|
6
6
|
|
|
7
7
|
/**
|
package/src/route-transition.ts
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { Route } from './route';
|
|
2
2
|
import {
|
|
3
|
+
createRouteTask,
|
|
3
4
|
type RouteTask,
|
|
4
|
-
RouteTaskController
|
|
5
|
-
createRouteTask
|
|
5
|
+
RouteTaskController
|
|
6
6
|
} from './route-task';
|
|
7
7
|
import type { Router } from './router';
|
|
8
8
|
import {
|
|
9
9
|
getSavedScrollPosition,
|
|
10
10
|
saveScrollPosition,
|
|
11
|
-
scrollToPosition
|
|
12
|
-
winScrollPos
|
|
11
|
+
scrollToPosition
|
|
13
12
|
} from './scroll';
|
|
14
|
-
import { RouteType } from './types';
|
|
15
|
-
|
|
16
13
|
import type {
|
|
17
14
|
RouteConfirmHook,
|
|
18
15
|
RouteConfirmHookResult,
|
|
@@ -20,6 +17,7 @@ import type {
|
|
|
20
17
|
RouteLocationInput,
|
|
21
18
|
RouteNotifyHook
|
|
22
19
|
} from './types';
|
|
20
|
+
import { RouteType } from './types';
|
|
23
21
|
import {
|
|
24
22
|
isBrowser,
|
|
25
23
|
isRouteMatched,
|
package/src/route.ts
CHANGED
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
type RouteMeta,
|
|
14
14
|
type RouteOptions,
|
|
15
15
|
type RouteParsedConfig,
|
|
16
|
+
type RouterParsedOptions,
|
|
16
17
|
type RouteState,
|
|
17
|
-
RouteType
|
|
18
|
-
type RouterParsedOptions
|
|
18
|
+
RouteType
|
|
19
19
|
} from './types';
|
|
20
20
|
import { decodeParams, isNonEmptyPlainObject, isPlainObject } from './util';
|
|
21
21
|
|
|
@@ -162,7 +162,7 @@ export class Route {
|
|
|
162
162
|
to.origin === base.origin &&
|
|
163
163
|
to.pathname.startsWith(base.pathname)
|
|
164
164
|
) {
|
|
165
|
-
const isLayer = toType === RouteType.pushLayer;
|
|
165
|
+
const isLayer = toType === RouteType.pushLayer || options.layer;
|
|
166
166
|
match = options.matcher(to, base, (config) => {
|
|
167
167
|
if (isLayer) {
|
|
168
168
|
return config.layer !== false;
|
package/src/router.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { parsedOptions } from './options';
|
|
|
5
5
|
import { Route } from './route';
|
|
6
6
|
import { RouteTransition } from './route-transition';
|
|
7
7
|
import { createLinkResolver } from './router-link';
|
|
8
|
-
import { RouteType, RouterMode } from './types';
|
|
9
8
|
import type {
|
|
10
9
|
RouteConfirmHook,
|
|
11
10
|
RouteLayerOptions,
|
|
@@ -13,12 +12,13 @@ import type {
|
|
|
13
12
|
RouteLocationInput,
|
|
14
13
|
RouteMatchType,
|
|
15
14
|
RouteNotifyHook,
|
|
16
|
-
RouteState,
|
|
17
15
|
RouterLinkProps,
|
|
18
16
|
RouterLinkResolved,
|
|
19
17
|
RouterOptions,
|
|
20
|
-
RouterParsedOptions
|
|
18
|
+
RouterParsedOptions,
|
|
19
|
+
RouteState
|
|
21
20
|
} from './types';
|
|
21
|
+
import { RouterMode, RouteType } from './types';
|
|
22
22
|
import { isNotNullish, isPlainObject, isRouteMatched } from './util';
|
|
23
23
|
|
|
24
24
|
export class Router {
|
package/src/scroll.ts
CHANGED
package/src/util.ts
CHANGED
|
@@ -72,9 +72,7 @@ export function isUrlEqual(url1: URL, url2?: URL | null): boolean {
|
|
|
72
72
|
(url1 = new URL(url1)).searchParams.sort();
|
|
73
73
|
(url2 = new URL(url2)).searchParams.sort();
|
|
74
74
|
// Avoid trailing hash symbol impact from empty hash
|
|
75
|
-
// biome-ignore lint/correctness/noSelfAssign:
|
|
76
75
|
url1.hash = url1.hash;
|
|
77
|
-
// biome-ignore lint/correctness/noSelfAssign:
|
|
78
76
|
url2.hash = url2.hash;
|
|
79
77
|
return url1.href === url2.href;
|
|
80
78
|
}
|