@multiplatform.one/router 5.0.21 → 5.0.23
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/router/emptyRouter.cjs +55 -0
- package/dist/cjs/router/emptyRouter.js +47 -0
- package/dist/cjs/router/emptyRouter.js.map +6 -0
- package/dist/cjs/router/emptyRouter.native.js +77 -0
- package/dist/cjs/router/emptyRouter.native.js.map +6 -0
- package/dist/cjs/router/index.cjs +38 -31
- package/dist/cjs/router/index.electron.cjs +4 -60
- package/dist/cjs/router/index.electron.js +3 -36
- package/dist/cjs/router/index.electron.js.map +2 -2
- package/dist/cjs/router/index.electron.native.js +4 -80
- package/dist/cjs/router/index.electron.native.js.map +2 -2
- package/dist/cjs/router/index.js +36 -21
- package/dist/cjs/router/index.js.map +2 -2
- package/dist/cjs/router/index.native.js +30 -33
- package/dist/cjs/router/index.native.js.map +2 -2
- package/dist/cjs/router/index.storybook-expo.cjs +4 -41
- package/dist/cjs/router/index.storybook-expo.js +3 -35
- package/dist/cjs/router/index.storybook-expo.js.map +1 -1
- package/dist/cjs/router/index.storybook-expo.native.js +4 -61
- package/dist/cjs/router/index.storybook-expo.native.js.map +2 -2
- package/dist/cjs/router/index.storybook.cjs +18 -0
- package/dist/cjs/router/index.storybook.js +15 -0
- package/dist/cjs/router/index.storybook.js.map +6 -0
- package/dist/cjs/router/index.storybook.native.js +20 -0
- package/dist/cjs/router/index.storybook.native.js.map +6 -0
- package/dist/cjs/router/index.webext.cjs +4 -60
- package/dist/cjs/router/index.webext.js +3 -36
- package/dist/cjs/router/index.webext.js.map +2 -2
- package/dist/cjs/router/index.webext.native.js +4 -80
- package/dist/cjs/router/index.webext.native.js.map +2 -2
- package/dist/cjs/router/reactRouter.cjs +74 -0
- package/dist/cjs/router/reactRouter.js +48 -0
- package/dist/cjs/router/reactRouter.js.map +6 -0
- package/dist/cjs/router/reactRouter.native.js +96 -0
- package/dist/cjs/router/reactRouter.native.js.map +6 -0
- package/dist/esm/router/emptyRouter.js +31 -0
- package/dist/esm/router/emptyRouter.js.map +6 -0
- package/dist/esm/router/emptyRouter.mjs +29 -0
- package/dist/esm/router/emptyRouter.mjs.map +1 -0
- package/dist/esm/router/emptyRouter.native.js +54 -0
- package/dist/esm/router/emptyRouter.native.js.map +6 -0
- package/dist/esm/router/index.electron.js +1 -37
- package/dist/esm/router/index.electron.js.map +1 -1
- package/dist/esm/router/index.electron.mjs +1 -47
- package/dist/esm/router/index.electron.mjs.map +1 -1
- package/dist/esm/router/index.electron.native.js +1 -73
- package/dist/esm/router/index.electron.native.js.map +2 -2
- package/dist/esm/router/index.js +39 -25
- package/dist/esm/router/index.js.map +1 -1
- package/dist/esm/router/index.mjs +38 -31
- package/dist/esm/router/index.mjs.map +1 -1
- package/dist/esm/router/index.native.js +31 -34
- package/dist/esm/router/index.native.js.map +2 -2
- package/dist/esm/router/index.storybook-expo.js +1 -30
- package/dist/esm/router/index.storybook-expo.js.map +1 -1
- package/dist/esm/router/index.storybook-expo.mjs +1 -28
- package/dist/esm/router/index.storybook-expo.mjs.map +1 -1
- package/dist/esm/router/index.storybook-expo.native.js +1 -53
- package/dist/esm/router/index.storybook-expo.native.js.map +2 -2
- package/dist/esm/router/index.storybook.js +2 -0
- package/dist/esm/router/index.storybook.js.map +6 -0
- package/dist/esm/router/index.storybook.mjs +2 -0
- package/dist/esm/router/index.storybook.mjs.map +1 -0
- package/dist/esm/router/index.storybook.native.js +2 -0
- package/dist/esm/router/index.storybook.native.js.map +6 -0
- package/dist/esm/router/index.webext.js +1 -37
- package/dist/esm/router/index.webext.js.map +1 -1
- package/dist/esm/router/index.webext.mjs +1 -47
- package/dist/esm/router/index.webext.mjs.map +1 -1
- package/dist/esm/router/index.webext.native.js +1 -73
- package/dist/esm/router/index.webext.native.js.map +2 -2
- package/dist/esm/router/reactRouter.js +38 -0
- package/dist/esm/router/reactRouter.js.map +6 -0
- package/dist/esm/router/reactRouter.mjs +48 -0
- package/dist/esm/router/reactRouter.mjs.map +1 -0
- package/dist/esm/router/reactRouter.native.js +74 -0
- package/dist/esm/router/reactRouter.native.js.map +6 -0
- package/dist/jsx/router/emptyRouter.js +31 -0
- package/dist/jsx/router/emptyRouter.js.map +6 -0
- package/dist/jsx/router/emptyRouter.mjs +29 -0
- package/dist/jsx/router/emptyRouter.mjs.map +1 -0
- package/dist/jsx/router/emptyRouter.native.js +54 -0
- package/dist/jsx/router/emptyRouter.native.js.map +6 -0
- package/dist/jsx/router/index.electron.js +1 -37
- package/dist/jsx/router/index.electron.js.map +1 -1
- package/dist/jsx/router/index.electron.mjs +1 -47
- package/dist/jsx/router/index.electron.mjs.map +1 -1
- package/dist/jsx/router/index.electron.native.js +1 -73
- package/dist/jsx/router/index.electron.native.js.map +2 -2
- package/dist/jsx/router/index.js +39 -25
- package/dist/jsx/router/index.js.map +1 -1
- package/dist/jsx/router/index.mjs +38 -31
- package/dist/jsx/router/index.mjs.map +1 -1
- package/dist/jsx/router/index.native.js +31 -34
- package/dist/jsx/router/index.native.js.map +2 -2
- package/dist/jsx/router/index.storybook-expo.js +1 -30
- package/dist/jsx/router/index.storybook-expo.js.map +1 -1
- package/dist/jsx/router/index.storybook-expo.mjs +1 -28
- package/dist/jsx/router/index.storybook-expo.mjs.map +1 -1
- package/dist/jsx/router/index.storybook-expo.native.js +1 -53
- package/dist/jsx/router/index.storybook-expo.native.js.map +2 -2
- package/dist/jsx/router/index.storybook.js +2 -0
- package/dist/jsx/router/index.storybook.js.map +6 -0
- package/dist/jsx/router/index.storybook.mjs +2 -0
- package/dist/jsx/router/index.storybook.mjs.map +1 -0
- package/dist/jsx/router/index.storybook.native.js +2 -0
- package/dist/jsx/router/index.storybook.native.js.map +6 -0
- package/dist/jsx/router/index.webext.js +1 -37
- package/dist/jsx/router/index.webext.js.map +1 -1
- package/dist/jsx/router/index.webext.mjs +1 -47
- package/dist/jsx/router/index.webext.mjs.map +1 -1
- package/dist/jsx/router/index.webext.native.js +1 -73
- package/dist/jsx/router/index.webext.native.js.map +2 -2
- package/dist/jsx/router/reactRouter.js +38 -0
- package/dist/jsx/router/reactRouter.js.map +6 -0
- package/dist/jsx/router/reactRouter.mjs +48 -0
- package/dist/jsx/router/reactRouter.mjs.map +1 -0
- package/dist/jsx/router/reactRouter.native.js +74 -0
- package/dist/jsx/router/reactRouter.native.js.map +6 -0
- package/package.json +2 -2
- package/src/router/emptyRouter.tsx +56 -0
- package/src/router/index.electron.tsx +1 -60
- package/src/router/index.storybook-expo.tsx +1 -35
- package/src/router/index.storybook.tsx +22 -0
- package/src/router/index.tsx +59 -38
- package/src/router/index.webext.tsx +1 -60
- package/src/router/reactRouter.tsx +84 -0
- package/src/types.tsx +4 -3
- package/types/router/emptyRouter.d.ts +26 -0
- package/types/router/emptyRouter.d.ts.map +1 -0
- package/types/router/index.d.ts +3 -3
- package/types/router/index.d.ts.map +1 -1
- package/types/router/index.electron.d.ts +1 -6
- package/types/router/index.electron.d.ts.map +1 -1
- package/types/router/index.storybook-expo.d.ts +1 -5
- package/types/router/index.storybook-expo.d.ts.map +1 -1
- package/types/router/index.storybook.d.ts +22 -0
- package/types/router/index.storybook.d.ts.map +1 -0
- package/types/router/index.webext.d.ts +1 -6
- package/types/router/index.webext.d.ts.map +1 -1
- package/types/router/reactRouter.d.ts +27 -0
- package/types/router/reactRouter.d.ts.map +1 -0
- package/types/types.d.ts +3 -1
- package/types/types.d.ts.map +1 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File: /src/router/reactRouter.tsx
|
|
3
|
+
* Project: @multiplatform.one/router
|
|
4
|
+
* File Created: 24-01-2025 16:56:40
|
|
5
|
+
* Author: Clay Risser
|
|
6
|
+
* -----
|
|
7
|
+
* BitSpur (c) Copyright 2021 - 2025
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License.
|
|
11
|
+
* You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
Link as ReactRouterLink,
|
|
24
|
+
useLocation,
|
|
25
|
+
useNavigate,
|
|
26
|
+
useParams as useReactParams,
|
|
27
|
+
} from "react-router-dom";
|
|
28
|
+
import type {
|
|
29
|
+
Href,
|
|
30
|
+
InputRouteParams,
|
|
31
|
+
InputRouteParamsBlank,
|
|
32
|
+
LinkComponent,
|
|
33
|
+
Router,
|
|
34
|
+
} from "../types";
|
|
35
|
+
|
|
36
|
+
export const useRouter = (): Router => {
|
|
37
|
+
const location = useLocation();
|
|
38
|
+
const navigate = useNavigate();
|
|
39
|
+
return {
|
|
40
|
+
back: () => navigate(-1),
|
|
41
|
+
canGoBack: () => true,
|
|
42
|
+
push: (href: Href) => navigate(href as string, { replace: false }),
|
|
43
|
+
navigate: (href: Href) => navigate(href as string, { replace: false }),
|
|
44
|
+
replace: (href: Href) => navigate(href as string, { replace: true }),
|
|
45
|
+
dismiss: (count?: number) => navigate(-1 * (count || 1)),
|
|
46
|
+
dismissAll: () => navigate("/"),
|
|
47
|
+
canDismiss: () => true,
|
|
48
|
+
setParams: <T extends string = "">(
|
|
49
|
+
params?: T extends "" ? InputRouteParamsBlank : InputRouteParams<T>,
|
|
50
|
+
) => {
|
|
51
|
+
const searchParams = new URLSearchParams(location.search);
|
|
52
|
+
if (params) {
|
|
53
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
54
|
+
if (value === undefined || value === null) {
|
|
55
|
+
searchParams.delete(key);
|
|
56
|
+
} else {
|
|
57
|
+
searchParams.set(key, String(value));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
navigate({ search: searchParams.toString() });
|
|
62
|
+
},
|
|
63
|
+
subscribe: (listener) => {
|
|
64
|
+
listener("success");
|
|
65
|
+
return () => {};
|
|
66
|
+
},
|
|
67
|
+
onLoadState: (listener) => {
|
|
68
|
+
listener("loaded");
|
|
69
|
+
return () => {};
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const usePathname = (): string => useLocation().pathname;
|
|
75
|
+
|
|
76
|
+
export const useParams = useReactParams;
|
|
77
|
+
|
|
78
|
+
export const Link: LinkComponent = ({ href, replace, children, ...props }) => (
|
|
79
|
+
<ReactRouterLink to={href as string} replace={replace} {...props}>
|
|
80
|
+
{children}
|
|
81
|
+
</ReactRouterLink>
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
Link.resolveHref = (href: Href) => href.toString();
|
package/src/types.tsx
CHANGED
|
@@ -28,6 +28,9 @@ export type ResultState = "success" | "error";
|
|
|
28
28
|
export type RootStateListener = (state: ResultState) => void;
|
|
29
29
|
export type LoadingStateListener = (state: LoadingState) => void;
|
|
30
30
|
|
|
31
|
+
export type InputRouteParamsBlank = OneRouter.InputRouteParamsBlank;
|
|
32
|
+
export type InputRouteParams<T extends string> = OneRouter.InputRouteParams<T>;
|
|
33
|
+
|
|
31
34
|
export interface Router {
|
|
32
35
|
back: () => void;
|
|
33
36
|
canGoBack: () => boolean;
|
|
@@ -38,9 +41,7 @@ export interface Router {
|
|
|
38
41
|
dismissAll: () => void;
|
|
39
42
|
canDismiss: () => boolean;
|
|
40
43
|
setParams: <T extends string = "">(
|
|
41
|
-
params?: T extends ""
|
|
42
|
-
? OneRouter.InputRouteParamsBlank
|
|
43
|
-
: OneRouter.InputRouteParams<T>,
|
|
44
|
+
params?: T extends "" ? InputRouteParamsBlank : InputRouteParams<T>,
|
|
44
45
|
) => void;
|
|
45
46
|
subscribe: (listener: RootStateListener) => () => void;
|
|
46
47
|
onLoadState: (listener: LoadingStateListener) => () => void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File: /src/router/emptyRouter.tsx
|
|
3
|
+
* Project: @multiplatform.one/router
|
|
4
|
+
* File Created: 24-01-2025 16:56:49
|
|
5
|
+
* Author: Clay Risser
|
|
6
|
+
* -----
|
|
7
|
+
* BitSpur (c) Copyright 2021 - 2025
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License.
|
|
11
|
+
* You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
import type { LinkComponent, Router } from "../types";
|
|
22
|
+
export declare const useRouter: () => Router;
|
|
23
|
+
export declare const usePathname: () => string;
|
|
24
|
+
export declare const useParams: () => {};
|
|
25
|
+
export declare const Link: LinkComponent;
|
|
26
|
+
//# sourceMappingURL=emptyRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emptyRouter.d.ts","sourceRoot":"","sources":["../../src/router/emptyRouter.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAQ,aAAa,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAE5D,eAAO,MAAM,SAAS,QAAO,MAoB5B,CAAC;AAEF,eAAO,MAAM,WAAW,QAAO,MAAa,CAAC;AAE7C,eAAO,MAAM,SAAS,UAAa,CAAC;AAEpC,eAAO,MAAM,IAAI,EAAE,aAIlB,CAAC"}
|
package/types/router/index.d.ts
CHANGED
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
* See the License for the specific language governing permissions and
|
|
19
19
|
* limitations under the License.
|
|
20
20
|
*/
|
|
21
|
-
import {
|
|
21
|
+
import { usePathname as useOnePathname } from "one";
|
|
22
22
|
import type { LinkComponent, Router } from "../types";
|
|
23
23
|
export declare const useRouter: () => Router;
|
|
24
|
-
export declare const usePathname:
|
|
25
|
-
export declare const useParams:
|
|
24
|
+
export declare const usePathname: typeof useOnePathname;
|
|
25
|
+
export declare const useParams: () => Record<string, string>;
|
|
26
26
|
export declare const Link: LinkComponent;
|
|
27
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAEL,WAAW,IAAI,cAAc,EAE9B,MAAM,KAAK,CAAC;AACb,OAAO,KAAK,EAEV,aAAa,EAGb,MAAM,EACP,MAAM,UAAU,CAAC;AAYlB,eAAO,MAAM,SAAS,QAAO,MAyB5B,CAAC;AAEF,eAAO,MAAM,WAAW,uBAAiB,CAAC;AAE1C,eAAO,MAAM,SAAS,8BAQrB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,aAWlB,CAAC"}
|
|
@@ -18,10 +18,5 @@
|
|
|
18
18
|
* See the License for the specific language governing permissions and
|
|
19
19
|
* limitations under the License.
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
import type { LinkComponent, Router } from "../types";
|
|
23
|
-
export declare const useRouter: () => Router;
|
|
24
|
-
export declare const usePathname: () => string;
|
|
25
|
-
export declare const useParams: typeof useReactParams;
|
|
26
|
-
export declare const Link: LinkComponent;
|
|
21
|
+
export * from "./reactRouter";
|
|
27
22
|
//# sourceMappingURL=index.electron.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.electron.d.ts","sourceRoot":"","sources":["../../src/router/index.electron.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"index.electron.d.ts","sourceRoot":"","sources":["../../src/router/index.electron.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,eAAe,CAAC"}
|
|
@@ -18,9 +18,5 @@
|
|
|
18
18
|
* See the License for the specific language governing permissions and
|
|
19
19
|
* limitations under the License.
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
export declare const useRouter: () => Router;
|
|
23
|
-
export declare const usePathname: () => string;
|
|
24
|
-
export declare const useParams: () => {};
|
|
25
|
-
export declare const Link: LinkComponent;
|
|
21
|
+
export * from "./emptyRouter";
|
|
26
22
|
//# sourceMappingURL=index.storybook-expo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.storybook-expo.d.ts","sourceRoot":"","sources":["../../src/router/index.storybook-expo.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.storybook-expo.d.ts","sourceRoot":"","sources":["../../src/router/index.storybook-expo.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File: /src/router/index.storybook.tsx
|
|
3
|
+
* Project: @multiplatform.one/router
|
|
4
|
+
* File Created: 23-01-2025 15:12:32
|
|
5
|
+
* Author: Clay Risser
|
|
6
|
+
* -----
|
|
7
|
+
* BitSpur (c) Copyright 2021 - 2025
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License.
|
|
11
|
+
* You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
export * from "./emptyRouter";
|
|
22
|
+
//# sourceMappingURL=index.storybook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.storybook.d.ts","sourceRoot":"","sources":["../../src/router/index.storybook.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,eAAe,CAAC"}
|
|
@@ -18,10 +18,5 @@
|
|
|
18
18
|
* See the License for the specific language governing permissions and
|
|
19
19
|
* limitations under the License.
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
import type { LinkComponent, Router } from "../types";
|
|
23
|
-
export declare const useRouter: () => Router;
|
|
24
|
-
export declare const usePathname: () => string;
|
|
25
|
-
export declare const useParams: typeof useReactParams;
|
|
26
|
-
export declare const Link: LinkComponent;
|
|
21
|
+
export * from "./reactRouter";
|
|
27
22
|
//# sourceMappingURL=index.webext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.webext.d.ts","sourceRoot":"","sources":["../../src/router/index.webext.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"index.webext.d.ts","sourceRoot":"","sources":["../../src/router/index.webext.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File: /src/router/reactRouter.tsx
|
|
3
|
+
* Project: @multiplatform.one/router
|
|
4
|
+
* File Created: 24-01-2025 16:56:40
|
|
5
|
+
* Author: Clay Risser
|
|
6
|
+
* -----
|
|
7
|
+
* BitSpur (c) Copyright 2021 - 2025
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License.
|
|
11
|
+
* You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
import { useParams as useReactParams } from "react-router-dom";
|
|
22
|
+
import type { LinkComponent, Router } from "../types";
|
|
23
|
+
export declare const useRouter: () => Router;
|
|
24
|
+
export declare const usePathname: () => string;
|
|
25
|
+
export declare const useParams: typeof useReactParams;
|
|
26
|
+
export declare const Link: LinkComponent;
|
|
27
|
+
//# sourceMappingURL=reactRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactRouter.d.ts","sourceRoot":"","sources":["../../src/router/reactRouter.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAIL,SAAS,IAAI,cAAc,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAIV,aAAa,EACb,MAAM,EACP,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,SAAS,QAAO,MAoC5B,CAAC;AAEF,eAAO,MAAM,WAAW,QAAO,MAAgC,CAAC;AAEhE,eAAO,MAAM,SAAS,uBAAiB,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,aAIlB,CAAC"}
|
package/types/types.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export type LoadingState = "loading" | "loaded" | "error";
|
|
|
27
27
|
export type ResultState = "success" | "error";
|
|
28
28
|
export type RootStateListener = (state: ResultState) => void;
|
|
29
29
|
export type LoadingStateListener = (state: LoadingState) => void;
|
|
30
|
+
export type InputRouteParamsBlank = OneRouter.InputRouteParamsBlank;
|
|
31
|
+
export type InputRouteParams<T extends string> = OneRouter.InputRouteParams<T>;
|
|
30
32
|
export interface Router {
|
|
31
33
|
back: () => void;
|
|
32
34
|
canGoBack: () => boolean;
|
|
@@ -36,7 +38,7 @@ export interface Router {
|
|
|
36
38
|
dismiss: (count?: number) => void;
|
|
37
39
|
dismissAll: () => void;
|
|
38
40
|
canDismiss: () => boolean;
|
|
39
|
-
setParams: <T extends string = "">(params?: T extends "" ?
|
|
41
|
+
setParams: <T extends string = "">(params?: T extends "" ? InputRouteParamsBlank : InputRouteParams<T>) => void;
|
|
40
42
|
subscribe: (listener: RootStateListener) => () => void;
|
|
41
43
|
onLoadState: (listener: LoadingStateListener) => () => void;
|
|
42
44
|
}
|
package/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;IAAE,WAAW,EAAE,GAAG,CAAA;CAAE,CAAC,CAAC;AACxD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAC1D,MAAM,MAAM,WAAW,GAAG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