@real-router/svelte 0.3.1 → 0.4.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/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { NavigationOptions, Navigator, Params, State } from "@real-router/core";
|
|
2
|
-
export interface RouteContext {
|
|
2
|
+
export interface RouteContext<P extends Params = Params> {
|
|
3
3
|
readonly navigator: Navigator;
|
|
4
4
|
readonly route: {
|
|
5
|
-
readonly current: State | undefined;
|
|
5
|
+
readonly current: State<P> | undefined;
|
|
6
6
|
};
|
|
7
7
|
readonly previousRoute: {
|
|
8
8
|
readonly current: State | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@real-router/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Svelte 5 integration for Real-Router",
|
|
6
6
|
"svelte": "./dist/index.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@real-router/core": "^0.48.0",
|
|
48
48
|
"@real-router/route-utils": "^0.2.1",
|
|
49
|
-
"@real-router/sources": "^0.
|
|
49
|
+
"@real-router/sources": "^0.7.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@sveltejs/package": "2.5.7",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ROUTE_KEY, getContextOrThrow } from "../context";
|
|
2
2
|
|
|
3
3
|
import type { RouteContext } from "../types";
|
|
4
|
+
import type { Params } from "@real-router/core";
|
|
4
5
|
|
|
5
|
-
export const useRoute = (): RouteContext =>
|
|
6
|
-
getContextOrThrow<RouteContext>(ROUTE_KEY, "useRoute")
|
|
6
|
+
export const useRoute = <P extends Params = Params>(): RouteContext<P> =>
|
|
7
|
+
getContextOrThrow<RouteContext>(ROUTE_KEY, "useRoute") as RouteContext<P>;
|
package/src/types.ts
CHANGED
|
@@ -5,9 +5,9 @@ import type {
|
|
|
5
5
|
State,
|
|
6
6
|
} from "@real-router/core";
|
|
7
7
|
|
|
8
|
-
export interface RouteContext {
|
|
8
|
+
export interface RouteContext<P extends Params = Params> {
|
|
9
9
|
readonly navigator: Navigator;
|
|
10
|
-
readonly route: { readonly current: State | undefined };
|
|
10
|
+
readonly route: { readonly current: State<P> | undefined };
|
|
11
11
|
readonly previousRoute: { readonly current: State | undefined };
|
|
12
12
|
}
|
|
13
13
|
|