@multiplatform.one/router 5.0.21 → 5.0.22

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.
Files changed (144) hide show
  1. package/dist/cjs/router/emptyRouter.cjs +55 -0
  2. package/dist/cjs/router/emptyRouter.js +47 -0
  3. package/dist/cjs/router/emptyRouter.js.map +6 -0
  4. package/dist/cjs/router/emptyRouter.native.js +77 -0
  5. package/dist/cjs/router/emptyRouter.native.js.map +6 -0
  6. package/dist/cjs/router/index.cjs +38 -31
  7. package/dist/cjs/router/index.electron.cjs +4 -60
  8. package/dist/cjs/router/index.electron.js +3 -36
  9. package/dist/cjs/router/index.electron.js.map +2 -2
  10. package/dist/cjs/router/index.electron.native.js +4 -80
  11. package/dist/cjs/router/index.electron.native.js.map +2 -2
  12. package/dist/cjs/router/index.js +36 -21
  13. package/dist/cjs/router/index.js.map +2 -2
  14. package/dist/cjs/router/index.native.js +30 -33
  15. package/dist/cjs/router/index.native.js.map +2 -2
  16. package/dist/cjs/router/index.storybook-expo.cjs +4 -41
  17. package/dist/cjs/router/index.storybook-expo.js +3 -35
  18. package/dist/cjs/router/index.storybook-expo.js.map +1 -1
  19. package/dist/cjs/router/index.storybook-expo.native.js +4 -61
  20. package/dist/cjs/router/index.storybook-expo.native.js.map +2 -2
  21. package/dist/cjs/router/index.storybook.cjs +18 -0
  22. package/dist/cjs/router/index.storybook.js +15 -0
  23. package/dist/cjs/router/index.storybook.js.map +6 -0
  24. package/dist/cjs/router/index.storybook.native.js +20 -0
  25. package/dist/cjs/router/index.storybook.native.js.map +6 -0
  26. package/dist/cjs/router/index.webext.cjs +4 -60
  27. package/dist/cjs/router/index.webext.js +3 -36
  28. package/dist/cjs/router/index.webext.js.map +2 -2
  29. package/dist/cjs/router/index.webext.native.js +4 -80
  30. package/dist/cjs/router/index.webext.native.js.map +2 -2
  31. package/dist/cjs/router/reactRouter.cjs +74 -0
  32. package/dist/cjs/router/reactRouter.js +48 -0
  33. package/dist/cjs/router/reactRouter.js.map +6 -0
  34. package/dist/cjs/router/reactRouter.native.js +96 -0
  35. package/dist/cjs/router/reactRouter.native.js.map +6 -0
  36. package/dist/esm/router/emptyRouter.js +31 -0
  37. package/dist/esm/router/emptyRouter.js.map +6 -0
  38. package/dist/esm/router/emptyRouter.mjs +29 -0
  39. package/dist/esm/router/emptyRouter.mjs.map +1 -0
  40. package/dist/esm/router/emptyRouter.native.js +54 -0
  41. package/dist/esm/router/emptyRouter.native.js.map +6 -0
  42. package/dist/esm/router/index.electron.js +1 -37
  43. package/dist/esm/router/index.electron.js.map +1 -1
  44. package/dist/esm/router/index.electron.mjs +1 -47
  45. package/dist/esm/router/index.electron.mjs.map +1 -1
  46. package/dist/esm/router/index.electron.native.js +1 -73
  47. package/dist/esm/router/index.electron.native.js.map +2 -2
  48. package/dist/esm/router/index.js +39 -25
  49. package/dist/esm/router/index.js.map +1 -1
  50. package/dist/esm/router/index.mjs +38 -31
  51. package/dist/esm/router/index.mjs.map +1 -1
  52. package/dist/esm/router/index.native.js +31 -34
  53. package/dist/esm/router/index.native.js.map +2 -2
  54. package/dist/esm/router/index.storybook-expo.js +1 -30
  55. package/dist/esm/router/index.storybook-expo.js.map +1 -1
  56. package/dist/esm/router/index.storybook-expo.mjs +1 -28
  57. package/dist/esm/router/index.storybook-expo.mjs.map +1 -1
  58. package/dist/esm/router/index.storybook-expo.native.js +1 -53
  59. package/dist/esm/router/index.storybook-expo.native.js.map +2 -2
  60. package/dist/esm/router/index.storybook.js +2 -0
  61. package/dist/esm/router/index.storybook.js.map +6 -0
  62. package/dist/esm/router/index.storybook.mjs +2 -0
  63. package/dist/esm/router/index.storybook.mjs.map +1 -0
  64. package/dist/esm/router/index.storybook.native.js +2 -0
  65. package/dist/esm/router/index.storybook.native.js.map +6 -0
  66. package/dist/esm/router/index.webext.js +1 -37
  67. package/dist/esm/router/index.webext.js.map +1 -1
  68. package/dist/esm/router/index.webext.mjs +1 -47
  69. package/dist/esm/router/index.webext.mjs.map +1 -1
  70. package/dist/esm/router/index.webext.native.js +1 -73
  71. package/dist/esm/router/index.webext.native.js.map +2 -2
  72. package/dist/esm/router/reactRouter.js +38 -0
  73. package/dist/esm/router/reactRouter.js.map +6 -0
  74. package/dist/esm/router/reactRouter.mjs +48 -0
  75. package/dist/esm/router/reactRouter.mjs.map +1 -0
  76. package/dist/esm/router/reactRouter.native.js +74 -0
  77. package/dist/esm/router/reactRouter.native.js.map +6 -0
  78. package/dist/jsx/router/emptyRouter.js +31 -0
  79. package/dist/jsx/router/emptyRouter.js.map +6 -0
  80. package/dist/jsx/router/emptyRouter.mjs +29 -0
  81. package/dist/jsx/router/emptyRouter.mjs.map +1 -0
  82. package/dist/jsx/router/emptyRouter.native.js +54 -0
  83. package/dist/jsx/router/emptyRouter.native.js.map +6 -0
  84. package/dist/jsx/router/index.electron.js +1 -37
  85. package/dist/jsx/router/index.electron.js.map +1 -1
  86. package/dist/jsx/router/index.electron.mjs +1 -47
  87. package/dist/jsx/router/index.electron.mjs.map +1 -1
  88. package/dist/jsx/router/index.electron.native.js +1 -73
  89. package/dist/jsx/router/index.electron.native.js.map +2 -2
  90. package/dist/jsx/router/index.js +39 -25
  91. package/dist/jsx/router/index.js.map +1 -1
  92. package/dist/jsx/router/index.mjs +38 -31
  93. package/dist/jsx/router/index.mjs.map +1 -1
  94. package/dist/jsx/router/index.native.js +31 -34
  95. package/dist/jsx/router/index.native.js.map +2 -2
  96. package/dist/jsx/router/index.storybook-expo.js +1 -30
  97. package/dist/jsx/router/index.storybook-expo.js.map +1 -1
  98. package/dist/jsx/router/index.storybook-expo.mjs +1 -28
  99. package/dist/jsx/router/index.storybook-expo.mjs.map +1 -1
  100. package/dist/jsx/router/index.storybook-expo.native.js +1 -53
  101. package/dist/jsx/router/index.storybook-expo.native.js.map +2 -2
  102. package/dist/jsx/router/index.storybook.js +2 -0
  103. package/dist/jsx/router/index.storybook.js.map +6 -0
  104. package/dist/jsx/router/index.storybook.mjs +2 -0
  105. package/dist/jsx/router/index.storybook.mjs.map +1 -0
  106. package/dist/jsx/router/index.storybook.native.js +2 -0
  107. package/dist/jsx/router/index.storybook.native.js.map +6 -0
  108. package/dist/jsx/router/index.webext.js +1 -37
  109. package/dist/jsx/router/index.webext.js.map +1 -1
  110. package/dist/jsx/router/index.webext.mjs +1 -47
  111. package/dist/jsx/router/index.webext.mjs.map +1 -1
  112. package/dist/jsx/router/index.webext.native.js +1 -73
  113. package/dist/jsx/router/index.webext.native.js.map +2 -2
  114. package/dist/jsx/router/reactRouter.js +38 -0
  115. package/dist/jsx/router/reactRouter.js.map +6 -0
  116. package/dist/jsx/router/reactRouter.mjs +48 -0
  117. package/dist/jsx/router/reactRouter.mjs.map +1 -0
  118. package/dist/jsx/router/reactRouter.native.js +74 -0
  119. package/dist/jsx/router/reactRouter.native.js.map +6 -0
  120. package/package.json +2 -2
  121. package/src/router/emptyRouter.tsx +56 -0
  122. package/src/router/index.electron.tsx +1 -60
  123. package/src/router/index.storybook-expo.tsx +1 -35
  124. package/src/router/index.storybook.tsx +22 -0
  125. package/src/router/index.tsx +59 -38
  126. package/src/router/index.webext.tsx +1 -60
  127. package/src/router/reactRouter.tsx +84 -0
  128. package/src/types.tsx +4 -3
  129. package/types/router/emptyRouter.d.ts +26 -0
  130. package/types/router/emptyRouter.d.ts.map +1 -0
  131. package/types/router/index.d.ts +3 -3
  132. package/types/router/index.d.ts.map +1 -1
  133. package/types/router/index.electron.d.ts +1 -6
  134. package/types/router/index.electron.d.ts.map +1 -1
  135. package/types/router/index.storybook-expo.d.ts +1 -5
  136. package/types/router/index.storybook-expo.d.ts.map +1 -1
  137. package/types/router/index.storybook.d.ts +22 -0
  138. package/types/router/index.storybook.d.ts.map +1 -0
  139. package/types/router/index.webext.d.ts +1 -6
  140. package/types/router/index.webext.d.ts.map +1 -1
  141. package/types/router/reactRouter.d.ts +27 -0
  142. package/types/router/reactRouter.d.ts.map +1 -0
  143. package/types/types.d.ts +3 -1
  144. 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"}
@@ -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 { useParams as useReactParams } from "react-router-dom";
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: () => string;
25
- export declare const useParams: typeof useReactParams;
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,EAIL,SAAS,IAAI,cAAc,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAQ,aAAa,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAE5D,eAAO,MAAM,SAAS,QAAO,MAkC5B,CAAC;AAEF,eAAO,MAAM,WAAW,QAAO,MAAgC,CAAC;AAEhE,eAAO,MAAM,SAAS,uBAAiB,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,aAIlB,CAAC"}
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
- 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;
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;AAGH,OAAO,EAIL,SAAS,IAAI,cAAc,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAQ,aAAa,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAE5D,eAAO,MAAM,SAAS,QAAO,MAsC5B,CAAC;AAEF,eAAO,MAAM,WAAW,QAAO,MAAgC,CAAC;AAEhE,eAAO,MAAM,SAAS,uBAAiB,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,aAIlB,CAAC"}
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
- 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;
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,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"}
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
- 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;
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;AAGH,OAAO,EAIL,SAAS,IAAI,cAAc,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAQ,aAAa,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAE5D,eAAO,MAAM,SAAS,QAAO,MAsC5B,CAAC;AAEF,eAAO,MAAM,WAAW,QAAO,MAAgC,CAAC;AAEhE,eAAO,MAAM,SAAS,uBAAiB,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,aAIlB,CAAC"}
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 "" ? OneRouter.InputRouteParamsBlank : OneRouter.InputRouteParams<T>) => void;
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
  }
@@ -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,SAAS,GAAG,OAAO,CAAC;AAC9C,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAC7D,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;AAEjE,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC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