@kitbag/router 0.20.10 → 0.20.12
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/contextRejectionError.d.ts +1 -2
- package/dist/errors/missingRouteContextError.d.ts +10 -0
- package/dist/kitbag-router.js +1480 -1352
- package/dist/kitbag-router.umd.cjs +3 -3
- package/dist/main.d.ts +1 -0
- package/dist/models/RouteHooks.d.ts +3 -0
- package/dist/models/RouterRouteHooks.d.ts +9 -10
- 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 -20
- 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 +14 -5
- package/dist/types/hooks.d.ts +79 -7
- 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 +14 -58
- 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 +11 -14
- package/package.json +8 -8
|
@@ -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;
|
|
@@ -16,7 +15,7 @@ export declare const routes: readonly [import('../main').Route<"parentA", import
|
|
|
16
15
|
id: string;
|
|
17
16
|
props: undefined;
|
|
18
17
|
meta: Readonly<{}>;
|
|
19
|
-
}]>, import('../main').Route<"parentA.childA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]/childA/[?paramB]", {
|
|
18
|
+
}], []> & import('../main').InternalRouteHooks<unknown>, import('../main').Route<"parentA.childA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]/childA/[?paramB]", {
|
|
20
19
|
paramA: StringConstructor;
|
|
21
20
|
} & {
|
|
22
21
|
paramB: StringConstructor;
|
|
@@ -35,14 +34,14 @@ export declare const routes: readonly [import('../main').Route<"parentA", import
|
|
|
35
34
|
id: string;
|
|
36
35
|
props: undefined;
|
|
37
36
|
meta: Readonly<{}>;
|
|
38
|
-
}]>;
|
|
37
|
+
}], []> & import('../main').InternalRouteHooks<unknown>;
|
|
39
38
|
readonly name: "parentA.childA";
|
|
40
39
|
readonly path: "/childA/[?paramB]";
|
|
41
40
|
}, "meta" | "props"> & {
|
|
42
41
|
id: string;
|
|
43
42
|
props: undefined;
|
|
44
43
|
meta: Readonly<{}>;
|
|
45
|
-
}]>, import('../main').Route<"parentA.childB", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]/childB/[paramD]", {
|
|
44
|
+
}], []> & import('../main').InternalRouteHooks<unknown>, import('../main').Route<"parentA.childB", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]/childB/[paramD]", {
|
|
46
45
|
paramA: StringConstructor;
|
|
47
46
|
} & {
|
|
48
47
|
paramD: StringConstructor;
|
|
@@ -61,7 +60,7 @@ export declare const routes: readonly [import('../main').Route<"parentA", import
|
|
|
61
60
|
id: string;
|
|
62
61
|
props: undefined;
|
|
63
62
|
meta: Readonly<{}>;
|
|
64
|
-
}]>;
|
|
63
|
+
}], []> & import('../main').InternalRouteHooks<unknown>;
|
|
65
64
|
readonly name: "parentA.childB";
|
|
66
65
|
readonly path: "/childB/[paramD]";
|
|
67
66
|
readonly component: {
|
|
@@ -71,7 +70,7 @@ export declare const routes: readonly [import('../main').Route<"parentA", import
|
|
|
71
70
|
id: string;
|
|
72
71
|
props: undefined;
|
|
73
72
|
meta: Readonly<{}>;
|
|
74
|
-
}]>, import('../main').Route<"parentA.childA.grandChildA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]/childA/[?paramB]/[paramC]", {
|
|
73
|
+
}], []> & import('../main').InternalRouteHooks<unknown>, import('../main').Route<"parentA.childA.grandChildA", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentA/[paramA]/childA/[?paramB]/[paramC]", {
|
|
75
74
|
paramA: StringConstructor;
|
|
76
75
|
paramB: StringConstructor;
|
|
77
76
|
} & {
|
|
@@ -91,7 +90,7 @@ export declare const routes: readonly [import('../main').Route<"parentA", import
|
|
|
91
90
|
id: string;
|
|
92
91
|
props: undefined;
|
|
93
92
|
meta: Readonly<{}>;
|
|
94
|
-
}]>;
|
|
93
|
+
}], []> & import('../main').InternalRouteHooks<unknown>;
|
|
95
94
|
readonly name: "parentA.childA";
|
|
96
95
|
readonly path: "/childA/[?paramB]";
|
|
97
96
|
}, "meta" | "props"> & {
|
|
@@ -118,14 +117,14 @@ export declare const routes: readonly [import('../main').Route<"parentA", import
|
|
|
118
117
|
id: string;
|
|
119
118
|
props: undefined;
|
|
120
119
|
meta: Readonly<{}>;
|
|
121
|
-
}]>;
|
|
120
|
+
}], []> & import('../main').InternalRouteHooks<unknown>;
|
|
122
121
|
readonly name: "parentA.childA";
|
|
123
122
|
readonly path: "/childA/[?paramB]";
|
|
124
123
|
}, "meta" | "props"> & {
|
|
125
124
|
id: string;
|
|
126
125
|
props: undefined;
|
|
127
126
|
meta: Readonly<{}>;
|
|
128
|
-
}]>;
|
|
127
|
+
}], []> & import('../main').InternalRouteHooks<unknown>;
|
|
129
128
|
readonly name: "parentA.childA.grandChildA";
|
|
130
129
|
readonly path: "/[paramC]";
|
|
131
130
|
readonly component: {
|
|
@@ -135,7 +134,7 @@ export declare const routes: readonly [import('../main').Route<"parentA", import
|
|
|
135
134
|
id: string;
|
|
136
135
|
props: undefined;
|
|
137
136
|
meta: Readonly<{}>;
|
|
138
|
-
}]>, import('../main').Route<"parentB", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/parentB", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, Readonly<{}>, {}, [Omit<{
|
|
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<{
|
|
139
138
|
readonly name: "parentB";
|
|
140
139
|
readonly path: "/parentB";
|
|
141
140
|
readonly component: {
|
|
@@ -145,7 +144,7 @@ export declare const routes: readonly [import('../main').Route<"parentA", import
|
|
|
145
144
|
id: string;
|
|
146
145
|
props: undefined;
|
|
147
146
|
meta: Readonly<{}>;
|
|
148
|
-
}]>, import('../main').Route<"parentC", import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"/", {}>, import('../services/withParams').WithParams<"", {}>, import('../services/withParams').WithParams<"", {}>, Readonly<{}>, {}, [Omit<{
|
|
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<{
|
|
149
148
|
readonly name: "parentC";
|
|
150
149
|
readonly path: "/";
|
|
151
150
|
readonly component: {
|
|
@@ -155,6 +154,4 @@ export declare const routes: readonly [import('../main').Route<"parentA", import
|
|
|
155
154
|
id: string;
|
|
156
155
|
props: undefined;
|
|
157
156
|
meta: Readonly<{}>;
|
|
158
|
-
}]>];
|
|
159
|
-
export declare function mockRoute(name: string): ResolvedRoute['matched'];
|
|
160
|
-
export declare function mockResolvedRoute(matched: ResolvedRoute['matched'], matches: ResolvedRoute['matched'][]): ResolvedRoute;
|
|
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.12",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/kitbagjs/router/issues"
|
|
7
7
|
},
|
|
@@ -41,9 +41,9 @@
|
|
|
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
48
|
"happy-dom": "^20.0.11",
|
|
49
49
|
"typedoc": "^0.28.15",
|
|
@@ -51,16 +51,16 @@
|
|
|
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
|
|
59
|
-
"zod": "
|
|
57
|
+
"vitest": "^4.0.16",
|
|
58
|
+
"vue-tsc": "^3.2.1",
|
|
59
|
+
"zod": "4.0.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"vue": "^3.5.0",
|
|
63
|
-
"zod": "
|
|
63
|
+
"zod": "4.0.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependenciesMeta": {
|
|
66
66
|
"zod": {
|