@real-router/solid 0.4.1 → 0.5.0
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/cjs/index.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ declare const useNavigator: () => Navigator;
|
|
|
79
79
|
|
|
80
80
|
declare const useRouteUtils: () => RouteUtils;
|
|
81
81
|
|
|
82
|
-
declare const useRoute: () => Accessor<RouteState
|
|
82
|
+
declare const useRoute: <P extends Params = Params>() => Accessor<RouteState<P>>;
|
|
83
83
|
|
|
84
84
|
declare function useRouteNode(nodeName: string): Accessor<RouteState>;
|
|
85
85
|
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -79,7 +79,7 @@ declare const useNavigator: () => Navigator;
|
|
|
79
79
|
|
|
80
80
|
declare const useRouteUtils: () => RouteUtils;
|
|
81
81
|
|
|
82
|
-
declare const useRoute: () => Accessor<RouteState
|
|
82
|
+
declare const useRoute: <P extends Params = Params>() => Accessor<RouteState<P>>;
|
|
83
83
|
|
|
84
84
|
declare function useRouteNode(nodeName: string): Accessor<RouteState>;
|
|
85
85
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RouteState } from "../types";
|
|
2
|
+
import type { Params } from "@real-router/core";
|
|
2
3
|
import type { Accessor } from "solid-js";
|
|
3
|
-
export declare const useRoute: () => Accessor<RouteState
|
|
4
|
+
export declare const useRoute: <P extends Params = Params>() => Accessor<RouteState<P>>;
|
|
4
5
|
//# sourceMappingURL=useRoute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRoute.d.ts","sourceRoot":"","sources":["../../../src/hooks/useRoute.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"useRoute.d.ts","sourceRoot":"","sources":["../../../src/hooks/useRoute.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,OAAK,QAAQ,CAC7D,UAAU,CAAC,CAAC,CAAC,CASd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@real-router/solid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "Solid.js integration for Real-Router",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@real-router/core": "^0.48.0",
|
|
55
55
|
"@real-router/route-utils": "^0.2.1",
|
|
56
|
-
"@real-router/sources": "^0.
|
|
56
|
+
"@real-router/sources": "^0.7.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@babel/core": "7.29.0",
|
package/src/hooks/useRoute.tsx
CHANGED
|
@@ -3,14 +3,17 @@ import { useContext } from "solid-js";
|
|
|
3
3
|
import { RouteContext } from "../context";
|
|
4
4
|
|
|
5
5
|
import type { RouteState } from "../types";
|
|
6
|
+
import type { Params } from "@real-router/core";
|
|
6
7
|
import type { Accessor } from "solid-js";
|
|
7
8
|
|
|
8
|
-
export const useRoute = (): Accessor<
|
|
9
|
+
export const useRoute = <P extends Params = Params>(): Accessor<
|
|
10
|
+
RouteState<P>
|
|
11
|
+
> => {
|
|
9
12
|
const routeSignal = useContext(RouteContext);
|
|
10
13
|
|
|
11
14
|
if (!routeSignal) {
|
|
12
15
|
throw new Error("useRoute must be used within a RouterProvider");
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
return routeSignal
|
|
18
|
+
return routeSignal as Accessor<RouteState<P>>;
|
|
16
19
|
};
|