@kitbag/router 0.20.9 → 0.20.11
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/components/routerLink.d.ts +1 -0
- package/dist/compositions/useRouterHooks.d.ts +2 -2
- package/dist/errors/{callbackContextAbortError.d.ts → contextAbortError.d.ts} +2 -1
- package/dist/errors/contextError.d.ts +2 -0
- package/dist/errors/{callbackContextPushError.d.ts → contextPushError.d.ts} +2 -1
- package/dist/errors/contextRejectionError.d.ts +6 -0
- package/dist/errors/missingRouteContextError.d.ts +10 -0
- package/dist/kitbag-router.js +1589 -1415
- package/dist/kitbag-router.umd.cjs +3 -3
- package/dist/main.d.ts +2 -1
- package/dist/models/RouteHooks.d.ts +3 -0
- package/dist/models/RouterRouteHooks.d.ts +9 -9
- package/dist/services/createCallbackContext.d.ts +2 -2
- package/dist/services/createComponentHooks.d.ts +4 -2
- package/dist/services/createExternalRoute.d.ts +3 -2
- package/dist/services/createRejection.d.ts +6 -0
- package/dist/services/createRoute.d.ts +4 -3
- package/dist/services/createRouteHooks.d.ts +15 -0
- package/dist/services/createRouter.d.ts +2 -2
- package/dist/services/createRouterAssets.d.ts +3 -2
- package/dist/services/createRouterCallbackContext.d.ts +8 -6
- package/dist/services/createRouterHooks.d.ts +17 -18
- package/dist/services/createRouterPlugin.d.ts +3 -3
- package/dist/services/createRouterPlugin.spec-d.d.ts +1 -0
- package/dist/services/createRouterReject.d.ts +4 -6
- package/dist/services/getGlobalRouteHooks.d.ts +2 -3
- package/dist/services/getRouteHooks.d.ts +3 -9
- package/dist/services/getRouteHooksDeprecated.d.ts +10 -0
- package/dist/services/routeMatchRules.d.ts +1 -0
- package/dist/services/routeRegex.d.ts +1 -0
- package/dist/services/zod.d.ts +3 -3
- package/dist/types/createRouteOptions.d.ts +19 -6
- package/dist/types/hooks.d.ts +79 -7
- package/dist/types/meta.d.ts +3 -1
- package/dist/types/props.d.ts +13 -7
- package/dist/types/register.d.ts +2 -1
- package/dist/types/rejection.d.ts +15 -0
- package/dist/types/resolved.d.ts +14 -1
- package/dist/types/route.d.ts +28 -2
- package/dist/types/routeContext.d.ts +9 -0
- package/dist/types/router.d.ts +18 -41
- package/dist/types/routerPlugin.d.ts +106 -10
- package/dist/types/routerReject.d.ts +2 -2
- package/dist/types/routerRoute.d.ts +27 -0
- package/dist/types/utilities.d.ts +0 -4
- package/dist/utilities/checkMissingContext.d.ts +2 -0
- package/dist/utilities/checkMissingContext.spec copy.d.ts +1 -0
- package/dist/utilities/testHelpers.d.ts +52 -39
- package/package.json +10 -9
- package/dist/errors/callbackContextRejectionError.d.ts +0 -6
|
@@ -2,12 +2,39 @@ import { RouteUpdate } from './routeUpdate';
|
|
|
2
2
|
import { ResolvedRoute } from './resolved';
|
|
3
3
|
import { QuerySource } from './querySource';
|
|
4
4
|
export type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = {
|
|
5
|
+
/**
|
|
6
|
+
* Unique identifier for the route, generated by router.
|
|
7
|
+
*/
|
|
5
8
|
readonly id: TRoute['id'];
|
|
9
|
+
/**
|
|
10
|
+
* Identifier for the route as defined by user. Name must be unique among named routes. Name is used for routing and for matching.
|
|
11
|
+
*/
|
|
6
12
|
readonly name: TRoute['name'];
|
|
13
|
+
/**
|
|
14
|
+
* The specific route properties that were matched in the current route.
|
|
15
|
+
*/
|
|
7
16
|
readonly matched: TRoute['matched'];
|
|
17
|
+
/**
|
|
18
|
+
* The specific route properties that were matched in the current route, including any ancestors.
|
|
19
|
+
* Order of routes will be from greatest ancestor to narrowest matched.
|
|
20
|
+
*/
|
|
8
21
|
readonly matches: TRoute['matches'];
|
|
22
|
+
/**
|
|
23
|
+
* The stores for routes including ancestors.
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
readonly hooks: TRoute['hooks'];
|
|
27
|
+
/**
|
|
28
|
+
* Hash value of the route.
|
|
29
|
+
*/
|
|
9
30
|
readonly hash: TRoute['hash'];
|
|
31
|
+
/**
|
|
32
|
+
* Update the route.
|
|
33
|
+
*/
|
|
10
34
|
readonly update: RouteUpdate<TRoute>;
|
|
35
|
+
/**
|
|
36
|
+
* String value of the resolved URL.
|
|
37
|
+
*/
|
|
11
38
|
readonly href: TRoute['href'];
|
|
12
39
|
params: TRoute['params'];
|
|
13
40
|
state: TRoute['state'];
|
|
@@ -15,8 +15,4 @@ export type AllPropertiesAreOptional<T> = Record<string, unknown> extends T ? tr
|
|
|
15
15
|
* rather than string | number | symbol.
|
|
16
16
|
*/
|
|
17
17
|
export type AsString<T> = T extends string ? T : never;
|
|
18
|
-
/**
|
|
19
|
-
* Extracts the keys of a union type.
|
|
20
|
-
*/
|
|
21
|
-
export type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
22
18
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ResolvedRoute } from '../types/resolved';
|
|
2
1
|
export declare const random: {
|
|
3
2
|
number(options?: {
|
|
4
3
|
min?: number;
|
|
@@ -9,136 +8,150 @@ export declare function getError(callback: () => any): unknown;
|
|
|
9
8
|
export declare const component: {
|
|
10
9
|
template: string;
|
|
11
10
|
};
|
|
12
|
-
export declare const routes: readonly [import('../main').Route<"parentA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, {}
|
|
11
|
+
export declare const routes: readonly [import('../main').Route<"parentA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, Readonly<{}>, {}, [Omit<{
|
|
13
12
|
readonly name: "parentA";
|
|
14
13
|
readonly path: "/parentA/[paramA]";
|
|
15
|
-
}, "props"> & {
|
|
14
|
+
}, "meta" | "props"> & {
|
|
16
15
|
id: string;
|
|
17
16
|
props: undefined;
|
|
18
|
-
|
|
17
|
+
meta: Readonly<{}>;
|
|
18
|
+
}], []> & import('../main').InternalRouteHooks<unknown>, import('../main').Route<"parentA.childA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]/childA/[?paramB]", {
|
|
19
19
|
paramA: StringConstructor;
|
|
20
20
|
} & {
|
|
21
21
|
paramB: StringConstructor;
|
|
22
|
-
}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, {}
|
|
22
|
+
}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, Readonly<{}>, {}, [Omit<{
|
|
23
23
|
readonly name: "parentA";
|
|
24
24
|
readonly path: "/parentA/[paramA]";
|
|
25
|
-
}, "props"> & {
|
|
25
|
+
}, "meta" | "props"> & {
|
|
26
26
|
id: string;
|
|
27
27
|
props: undefined;
|
|
28
|
+
meta: Readonly<{}>;
|
|
28
29
|
}, Omit<{
|
|
29
|
-
readonly parent: import('../main').Route<"parentA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, {}
|
|
30
|
+
readonly parent: import('../main').Route<"parentA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, Readonly<{}>, {}, [Omit<{
|
|
30
31
|
readonly name: "parentA";
|
|
31
32
|
readonly path: "/parentA/[paramA]";
|
|
32
|
-
}, "props"> & {
|
|
33
|
+
}, "meta" | "props"> & {
|
|
33
34
|
id: string;
|
|
34
35
|
props: undefined;
|
|
35
|
-
|
|
36
|
+
meta: Readonly<{}>;
|
|
37
|
+
}], []> & import('../main').InternalRouteHooks<unknown>;
|
|
36
38
|
readonly name: "parentA.childA";
|
|
37
39
|
readonly path: "/childA/[?paramB]";
|
|
38
|
-
}, "props"> & {
|
|
40
|
+
}, "meta" | "props"> & {
|
|
39
41
|
id: string;
|
|
40
42
|
props: undefined;
|
|
41
|
-
|
|
43
|
+
meta: Readonly<{}>;
|
|
44
|
+
}], []> & import('../main').InternalRouteHooks<unknown>, import('../main').Route<"parentA.childB", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]/childB/[paramD]", {
|
|
42
45
|
paramA: StringConstructor;
|
|
43
46
|
} & {
|
|
44
47
|
paramD: StringConstructor;
|
|
45
|
-
}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, {}
|
|
48
|
+
}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, Readonly<{}>, {}, [Omit<{
|
|
46
49
|
readonly name: "parentA";
|
|
47
50
|
readonly path: "/parentA/[paramA]";
|
|
48
|
-
}, "props"> & {
|
|
51
|
+
}, "meta" | "props"> & {
|
|
49
52
|
id: string;
|
|
50
53
|
props: undefined;
|
|
54
|
+
meta: Readonly<{}>;
|
|
51
55
|
}, Omit<{
|
|
52
|
-
readonly parent: import('../main').Route<"parentA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, {}
|
|
56
|
+
readonly parent: import('../main').Route<"parentA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, Readonly<{}>, {}, [Omit<{
|
|
53
57
|
readonly name: "parentA";
|
|
54
58
|
readonly path: "/parentA/[paramA]";
|
|
55
|
-
}, "props"> & {
|
|
59
|
+
}, "meta" | "props"> & {
|
|
56
60
|
id: string;
|
|
57
61
|
props: undefined;
|
|
58
|
-
|
|
62
|
+
meta: Readonly<{}>;
|
|
63
|
+
}], []> & import('../main').InternalRouteHooks<unknown>;
|
|
59
64
|
readonly name: "parentA.childB";
|
|
60
65
|
readonly path: "/childB/[paramD]";
|
|
61
66
|
readonly component: {
|
|
62
67
|
template: string;
|
|
63
68
|
};
|
|
64
|
-
}, "props"> & {
|
|
69
|
+
}, "meta" | "props"> & {
|
|
65
70
|
id: string;
|
|
66
71
|
props: undefined;
|
|
67
|
-
|
|
72
|
+
meta: Readonly<{}>;
|
|
73
|
+
}], []> & import('../main').InternalRouteHooks<unknown>, import('../main').Route<"parentA.childA.grandChildA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]/childA/[?paramB]/[paramC]", {
|
|
68
74
|
paramA: StringConstructor;
|
|
69
75
|
paramB: StringConstructor;
|
|
70
76
|
} & {
|
|
71
77
|
paramC: StringConstructor;
|
|
72
|
-
}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, {}
|
|
78
|
+
}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, Readonly<{}>, {}, [Omit<{
|
|
73
79
|
readonly name: "parentA";
|
|
74
80
|
readonly path: "/parentA/[paramA]";
|
|
75
|
-
}, "props"> & {
|
|
81
|
+
}, "meta" | "props"> & {
|
|
76
82
|
id: string;
|
|
77
83
|
props: undefined;
|
|
84
|
+
meta: Readonly<{}>;
|
|
78
85
|
}, Omit<{
|
|
79
|
-
readonly parent: import('../main').Route<"parentA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, {}
|
|
86
|
+
readonly parent: import('../main').Route<"parentA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, Readonly<{}>, {}, [Omit<{
|
|
80
87
|
readonly name: "parentA";
|
|
81
88
|
readonly path: "/parentA/[paramA]";
|
|
82
|
-
}, "props"> & {
|
|
89
|
+
}, "meta" | "props"> & {
|
|
83
90
|
id: string;
|
|
84
91
|
props: undefined;
|
|
85
|
-
|
|
92
|
+
meta: Readonly<{}>;
|
|
93
|
+
}], []> & import('../main').InternalRouteHooks<unknown>;
|
|
86
94
|
readonly name: "parentA.childA";
|
|
87
95
|
readonly path: "/childA/[?paramB]";
|
|
88
|
-
}, "props"> & {
|
|
96
|
+
}, "meta" | "props"> & {
|
|
89
97
|
id: string;
|
|
90
98
|
props: undefined;
|
|
99
|
+
meta: Readonly<{}>;
|
|
91
100
|
}, Omit<{
|
|
92
101
|
readonly parent: import('../main').Route<"parentA.childA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]/childA/[?paramB]", {
|
|
93
102
|
paramA: StringConstructor;
|
|
94
103
|
} & {
|
|
95
104
|
paramB: StringConstructor;
|
|
96
|
-
}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, {}
|
|
105
|
+
}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, Readonly<{}>, {}, [Omit<{
|
|
97
106
|
readonly name: "parentA";
|
|
98
107
|
readonly path: "/parentA/[paramA]";
|
|
99
|
-
}, "props"> & {
|
|
108
|
+
}, "meta" | "props"> & {
|
|
100
109
|
id: string;
|
|
101
110
|
props: undefined;
|
|
111
|
+
meta: Readonly<{}>;
|
|
102
112
|
}, Omit<{
|
|
103
|
-
readonly parent: import('../main').Route<"parentA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, {}
|
|
113
|
+
readonly parent: import('../main').Route<"parentA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, Readonly<{}>, {}, [Omit<{
|
|
104
114
|
readonly name: "parentA";
|
|
105
115
|
readonly path: "/parentA/[paramA]";
|
|
106
|
-
}, "props"> & {
|
|
116
|
+
}, "meta" | "props"> & {
|
|
107
117
|
id: string;
|
|
108
118
|
props: undefined;
|
|
109
|
-
|
|
119
|
+
meta: Readonly<{}>;
|
|
120
|
+
}], []> & import('../main').InternalRouteHooks<unknown>;
|
|
110
121
|
readonly name: "parentA.childA";
|
|
111
122
|
readonly path: "/childA/[?paramB]";
|
|
112
|
-
}, "props"> & {
|
|
123
|
+
}, "meta" | "props"> & {
|
|
113
124
|
id: string;
|
|
114
125
|
props: undefined;
|
|
115
|
-
|
|
126
|
+
meta: Readonly<{}>;
|
|
127
|
+
}], []> & import('../main').InternalRouteHooks<unknown>;
|
|
116
128
|
readonly name: "parentA.childA.grandChildA";
|
|
117
129
|
readonly path: "/[paramC]";
|
|
118
130
|
readonly component: {
|
|
119
131
|
template: string;
|
|
120
132
|
};
|
|
121
|
-
}, "props"> & {
|
|
133
|
+
}, "meta" | "props"> & {
|
|
122
134
|
id: string;
|
|
123
135
|
props: undefined;
|
|
124
|
-
|
|
136
|
+
meta: Readonly<{}>;
|
|
137
|
+
}], []> & import('../main').InternalRouteHooks<unknown>, import('../main').Route<"parentB", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentB", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, Readonly<{}>, {}, [Omit<{
|
|
125
138
|
readonly name: "parentB";
|
|
126
139
|
readonly path: "/parentB";
|
|
127
140
|
readonly component: {
|
|
128
141
|
template: string;
|
|
129
142
|
};
|
|
130
|
-
}, "props"> & {
|
|
143
|
+
}, "meta" | "props"> & {
|
|
131
144
|
id: string;
|
|
132
145
|
props: undefined;
|
|
133
|
-
|
|
146
|
+
meta: Readonly<{}>;
|
|
147
|
+
}], []> & import('../main').InternalRouteHooks<unknown>, import('../main').Route<"parentC", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, Readonly<{}>, {}, [Omit<{
|
|
134
148
|
readonly name: "parentC";
|
|
135
149
|
readonly path: "/";
|
|
136
150
|
readonly component: {
|
|
137
151
|
template: string;
|
|
138
152
|
};
|
|
139
|
-
}, "props"> & {
|
|
153
|
+
}, "meta" | "props"> & {
|
|
140
154
|
id: string;
|
|
141
155
|
props: undefined;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export declare function mockResolvedRoute(matched: ResolvedRoute['matched'], matches: ResolvedRoute['matched'][]): ResolvedRoute;
|
|
156
|
+
meta: Readonly<{}>;
|
|
157
|
+
}], []> & import('../main').InternalRouteHooks<unknown>];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitbag/router",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.20.
|
|
4
|
+
"version": "0.20.11",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/kitbagjs/router/issues"
|
|
7
7
|
},
|
|
@@ -41,25 +41,26 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@kitbag/eslint-config": "1.0.2",
|
|
44
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
44
|
+
"@vitejs/plugin-vue": "^6.0.3",
|
|
45
45
|
"@vue/test-utils": "^2.4.6",
|
|
46
|
-
"eslint": "^9.39.
|
|
46
|
+
"eslint": "^9.39.2",
|
|
47
47
|
"globals": "^16.5.0",
|
|
48
|
-
"happy-dom": "^20.0.
|
|
49
|
-
"typedoc": "^0.28.
|
|
48
|
+
"happy-dom": "^20.0.11",
|
|
49
|
+
"typedoc": "^0.28.15",
|
|
50
50
|
"typedoc-plugin-markdown": "^4.9.0",
|
|
51
51
|
"typedoc-vitepress-theme": "^1.1.2",
|
|
52
52
|
"typescript": "^5.9.3",
|
|
53
53
|
"valibot": "^1.0.0",
|
|
54
|
-
"vite": "^7.
|
|
54
|
+
"vite": "^7.3.0",
|
|
55
55
|
"vite-plugin-dts": "^4.5.4",
|
|
56
56
|
"vitepress": "^1.6.4",
|
|
57
|
-
"vitest": "^4.0.
|
|
58
|
-
"vue-tsc": "^3.1
|
|
57
|
+
"vitest": "^4.0.16",
|
|
58
|
+
"vue-tsc": "^3.2.1",
|
|
59
|
+
"zod": "4.0.0"
|
|
59
60
|
},
|
|
60
61
|
"peerDependencies": {
|
|
61
62
|
"vue": "^3.5.0",
|
|
62
|
-
"zod": "
|
|
63
|
+
"zod": "4.0.0"
|
|
63
64
|
},
|
|
64
65
|
"peerDependenciesMeta": {
|
|
65
66
|
"zod": {
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { RegisteredRejectionType } from '../types/register';
|
|
2
|
-
import { CallbackRejectResponse } from '../services/createCallbackContext';
|
|
3
|
-
export declare class CallbackContextRejectionError extends Error {
|
|
4
|
-
response: CallbackRejectResponse;
|
|
5
|
-
constructor(type: RegisteredRejectionType);
|
|
6
|
-
}
|