@cedarjs/router 0.0.4

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 (275) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/dist/ActivePageContext.d.ts +15 -0
  4. package/dist/ActivePageContext.d.ts.map +1 -0
  5. package/dist/ActivePageContext.js +17 -0
  6. package/dist/AuthenticatedRoute.d.ts +11 -0
  7. package/dist/AuthenticatedRoute.d.ts.map +1 -0
  8. package/dist/AuthenticatedRoute.js +49 -0
  9. package/dist/PageLoadingContext.d.ts +14 -0
  10. package/dist/PageLoadingContext.d.ts.map +1 -0
  11. package/dist/PageLoadingContext.js +29 -0
  12. package/dist/Route.d.ts +32 -0
  13. package/dist/Route.d.ts.map +1 -0
  14. package/dist/Route.js +7 -0
  15. package/dist/Set.d.ts +58 -0
  16. package/dist/Set.d.ts.map +1 -0
  17. package/dist/Set.js +28 -0
  18. package/dist/a11yUtils.d.ts +14 -0
  19. package/dist/a11yUtils.d.ts.map +1 -0
  20. package/dist/a11yUtils.js +35 -0
  21. package/dist/active-route-loader.d.ts +12 -0
  22. package/dist/active-route-loader.d.ts.map +1 -0
  23. package/dist/active-route-loader.js +82 -0
  24. package/dist/analyzeRoutes.d.ts +44 -0
  25. package/dist/analyzeRoutes.d.ts.map +1 -0
  26. package/dist/analyzeRoutes.js +128 -0
  27. package/dist/cjs/ActivePageContext.d.ts +15 -0
  28. package/dist/cjs/ActivePageContext.d.ts.map +1 -0
  29. package/dist/cjs/ActivePageContext.js +42 -0
  30. package/dist/cjs/AuthenticatedRoute.d.ts +11 -0
  31. package/dist/cjs/AuthenticatedRoute.d.ts.map +1 -0
  32. package/dist/cjs/AuthenticatedRoute.js +83 -0
  33. package/dist/cjs/PageLoadingContext.d.ts +14 -0
  34. package/dist/cjs/PageLoadingContext.d.ts.map +1 -0
  35. package/dist/cjs/PageLoadingContext.js +64 -0
  36. package/dist/cjs/Route.d.ts +32 -0
  37. package/dist/cjs/Route.d.ts.map +1 -0
  38. package/dist/cjs/Route.js +41 -0
  39. package/dist/cjs/Set.d.ts +58 -0
  40. package/dist/cjs/Set.d.ts.map +1 -0
  41. package/dist/cjs/Set.js +67 -0
  42. package/dist/cjs/a11yUtils.d.ts +14 -0
  43. package/dist/cjs/a11yUtils.d.ts.map +1 -0
  44. package/dist/cjs/a11yUtils.js +61 -0
  45. package/dist/cjs/active-route-loader.d.ts +12 -0
  46. package/dist/cjs/active-route-loader.d.ts.map +1 -0
  47. package/dist/cjs/active-route-loader.js +116 -0
  48. package/dist/cjs/analyzeRoutes.d.ts +44 -0
  49. package/dist/cjs/analyzeRoutes.d.ts.map +1 -0
  50. package/dist/cjs/analyzeRoutes.js +143 -0
  51. package/dist/cjs/createNamedContext.d.ts +3 -0
  52. package/dist/cjs/createNamedContext.d.ts.map +1 -0
  53. package/dist/cjs/createNamedContext.js +33 -0
  54. package/dist/cjs/dummyComponent.d.ts +3 -0
  55. package/dist/cjs/dummyComponent.d.ts.map +1 -0
  56. package/dist/cjs/dummyComponent.js +24 -0
  57. package/dist/cjs/history.d.ts +24 -0
  58. package/dist/cjs/history.d.ts.map +1 -0
  59. package/dist/cjs/history.js +146 -0
  60. package/dist/cjs/index.d.ts +35 -0
  61. package/dist/cjs/index.d.ts.map +1 -0
  62. package/dist/cjs/index.js +110 -0
  63. package/dist/cjs/link.d.ts +9 -0
  64. package/dist/cjs/link.d.ts.map +1 -0
  65. package/dist/cjs/link.js +62 -0
  66. package/dist/cjs/location.d.ts +28 -0
  67. package/dist/cjs/location.d.ts.map +1 -0
  68. package/dist/cjs/location.js +110 -0
  69. package/dist/cjs/namedRoutes.d.ts +3 -0
  70. package/dist/cjs/namedRoutes.d.ts.map +1 -0
  71. package/dist/cjs/namedRoutes.js +28 -0
  72. package/dist/cjs/navLink.d.ts +11 -0
  73. package/dist/cjs/navLink.d.ts.map +1 -0
  74. package/dist/cjs/navLink.js +70 -0
  75. package/dist/cjs/package.json +1 -0
  76. package/dist/cjs/page.d.ts +28 -0
  77. package/dist/cjs/page.d.ts.map +1 -0
  78. package/dist/cjs/page.js +42 -0
  79. package/dist/cjs/params.d.ts +13 -0
  80. package/dist/cjs/params.d.ts.map +1 -0
  81. package/dist/cjs/params.js +64 -0
  82. package/dist/cjs/react-util.d.ts +3 -0
  83. package/dist/cjs/react-util.d.ts.map +1 -0
  84. package/dist/cjs/react-util.js +37 -0
  85. package/dist/cjs/redirect.d.ts +12 -0
  86. package/dist/cjs/redirect.d.ts.map +1 -0
  87. package/dist/cjs/redirect.js +35 -0
  88. package/dist/cjs/route-announcement.d.ts +13 -0
  89. package/dist/cjs/route-announcement.d.ts.map +1 -0
  90. package/dist/cjs/route-announcement.js +61 -0
  91. package/dist/cjs/route-focus.d.ts +12 -0
  92. package/dist/cjs/route-focus.d.ts.map +1 -0
  93. package/dist/cjs/route-focus.js +36 -0
  94. package/dist/cjs/route-validators.d.ts +21 -0
  95. package/dist/cjs/route-validators.d.ts.map +1 -0
  96. package/dist/cjs/route-validators.js +71 -0
  97. package/dist/cjs/routeParamsTypes.d.ts +49 -0
  98. package/dist/cjs/routeParamsTypes.d.ts.map +1 -0
  99. package/dist/cjs/routeParamsTypes.js +16 -0
  100. package/dist/cjs/router-context.d.ts +21 -0
  101. package/dist/cjs/router-context.d.ts.map +1 -0
  102. package/dist/cjs/router-context.js +69 -0
  103. package/dist/cjs/router.d.ts +11 -0
  104. package/dist/cjs/router.d.ts.map +1 -0
  105. package/dist/cjs/router.js +207 -0
  106. package/dist/cjs/rsc/ClientRouter.d.ts +4 -0
  107. package/dist/cjs/rsc/ClientRouter.d.ts.map +1 -0
  108. package/dist/cjs/rsc/ClientRouter.js +90 -0
  109. package/dist/cjs/rsc/RscCache.d.ts +23 -0
  110. package/dist/cjs/rsc/RscCache.d.ts.map +1 -0
  111. package/dist/cjs/rsc/RscCache.js +110 -0
  112. package/dist/cjs/rsc/RscRoutes.d.ts +7 -0
  113. package/dist/cjs/rsc/RscRoutes.d.ts.map +1 -0
  114. package/dist/cjs/rsc/RscRoutes.js +124 -0
  115. package/dist/cjs/rsc/ServerRouteLoader.d.ts +12 -0
  116. package/dist/cjs/rsc/ServerRouteLoader.d.ts.map +1 -0
  117. package/dist/cjs/rsc/ServerRouteLoader.js +65 -0
  118. package/dist/cjs/rsc/ServerRouter.d.ts +11 -0
  119. package/dist/cjs/rsc/ServerRouter.d.ts.map +1 -0
  120. package/dist/cjs/rsc/ServerRouter.js +170 -0
  121. package/dist/cjs/rsc/SsrRouter.d.ts +4 -0
  122. package/dist/cjs/rsc/SsrRouter.d.ts.map +1 -0
  123. package/dist/cjs/rsc/SsrRouter.js +56 -0
  124. package/dist/cjs/rsc/clientSsr.d.ts +2 -0
  125. package/dist/cjs/rsc/clientSsr.d.ts.map +1 -0
  126. package/dist/cjs/rsc/clientSsr.js +114 -0
  127. package/dist/cjs/rsc/rscCss.d.ts +2 -0
  128. package/dist/cjs/rsc/rscCss.d.ts.map +1 -0
  129. package/dist/cjs/rsc/rscCss.js +94 -0
  130. package/dist/cjs/rsc/ssrModuleMap.d.ts +14 -0
  131. package/dist/cjs/rsc/ssrModuleMap.d.ts.map +1 -0
  132. package/dist/cjs/rsc/ssrModuleMap.js +49 -0
  133. package/dist/cjs/rsc/utils.d.ts +20 -0
  134. package/dist/cjs/rsc/utils.d.ts.map +1 -0
  135. package/dist/cjs/rsc/utils.js +68 -0
  136. package/dist/cjs/rsc-link.d.ts +6 -0
  137. package/dist/cjs/rsc-link.d.ts.map +1 -0
  138. package/dist/cjs/rsc-link.js +41 -0
  139. package/dist/cjs/skipNav.d.ts +81 -0
  140. package/dist/cjs/skipNav.d.ts.map +1 -0
  141. package/dist/cjs/skipNav.js +69 -0
  142. package/dist/cjs/splash-page.d.ts +12 -0
  143. package/dist/cjs/splash-page.d.ts.map +1 -0
  144. package/dist/cjs/splash-page.js +515 -0
  145. package/dist/cjs/useBlocker.d.ts +11 -0
  146. package/dist/cjs/useBlocker.d.ts.map +1 -0
  147. package/dist/cjs/useBlocker.js +65 -0
  148. package/dist/cjs/useIsMounted.d.ts +2 -0
  149. package/dist/cjs/useIsMounted.d.ts.map +1 -0
  150. package/dist/cjs/useIsMounted.js +37 -0
  151. package/dist/cjs/useMatch.d.ts +43 -0
  152. package/dist/cjs/useMatch.d.ts.map +1 -0
  153. package/dist/cjs/useMatch.js +72 -0
  154. package/dist/cjs/useRouteName.d.ts +3 -0
  155. package/dist/cjs/useRouteName.d.ts.map +1 -0
  156. package/dist/cjs/useRouteName.js +40 -0
  157. package/dist/cjs/useRoutePaths.d.ts +4 -0
  158. package/dist/cjs/useRoutePaths.d.ts.map +1 -0
  159. package/dist/cjs/useRoutePaths.js +50 -0
  160. package/dist/cjs/util.d.ts +121 -0
  161. package/dist/cjs/util.d.ts.map +1 -0
  162. package/dist/cjs/util.js +214 -0
  163. package/dist/createNamedContext.d.ts +3 -0
  164. package/dist/createNamedContext.d.ts.map +1 -0
  165. package/dist/createNamedContext.js +9 -0
  166. package/dist/dummyComponent.d.ts +3 -0
  167. package/dist/dummyComponent.d.ts.map +1 -0
  168. package/dist/dummyComponent.js +4 -0
  169. package/dist/history.d.ts +24 -0
  170. package/dist/history.d.ts.map +1 -0
  171. package/dist/history.js +118 -0
  172. package/dist/index.d.ts +35 -0
  173. package/dist/index.d.ts.map +1 -0
  174. package/dist/index.js +49 -0
  175. package/dist/link.d.ts +9 -0
  176. package/dist/link.d.ts.map +1 -0
  177. package/dist/link.js +28 -0
  178. package/dist/location.d.ts +28 -0
  179. package/dist/location.d.ts.map +1 -0
  180. package/dist/location.js +74 -0
  181. package/dist/namedRoutes.d.ts +3 -0
  182. package/dist/namedRoutes.d.ts.map +1 -0
  183. package/dist/namedRoutes.js +4 -0
  184. package/dist/navLink.d.ts +11 -0
  185. package/dist/navLink.d.ts.map +1 -0
  186. package/dist/navLink.js +36 -0
  187. package/dist/page.d.ts +28 -0
  188. package/dist/page.d.ts.map +1 -0
  189. package/dist/page.js +17 -0
  190. package/dist/params.d.ts +13 -0
  191. package/dist/params.d.ts.map +1 -0
  192. package/dist/params.js +28 -0
  193. package/dist/react-util.d.ts +3 -0
  194. package/dist/react-util.d.ts.map +1 -0
  195. package/dist/react-util.js +13 -0
  196. package/dist/redirect.d.ts +12 -0
  197. package/dist/redirect.d.ts.map +1 -0
  198. package/dist/redirect.js +11 -0
  199. package/dist/route-announcement.d.ts +13 -0
  200. package/dist/route-announcement.d.ts.map +1 -0
  201. package/dist/route-announcement.js +31 -0
  202. package/dist/route-focus.d.ts +12 -0
  203. package/dist/route-focus.d.ts.map +1 -0
  204. package/dist/route-focus.js +6 -0
  205. package/dist/route-validators.d.ts +21 -0
  206. package/dist/route-validators.d.ts.map +1 -0
  207. package/dist/route-validators.js +44 -0
  208. package/dist/routeParamsTypes.d.ts +49 -0
  209. package/dist/routeParamsTypes.d.ts.map +1 -0
  210. package/dist/routeParamsTypes.js +0 -0
  211. package/dist/router-context.d.ts +21 -0
  212. package/dist/router-context.d.ts.map +1 -0
  213. package/dist/router-context.js +34 -0
  214. package/dist/router.d.ts +11 -0
  215. package/dist/router.d.ts.map +1 -0
  216. package/dist/router.js +173 -0
  217. package/dist/rsc/ClientRouter.d.ts +4 -0
  218. package/dist/rsc/ClientRouter.d.ts.map +1 -0
  219. package/dist/rsc/ClientRouter.js +56 -0
  220. package/dist/rsc/RscCache.d.ts +23 -0
  221. package/dist/rsc/RscCache.d.ts.map +1 -0
  222. package/dist/rsc/RscCache.js +86 -0
  223. package/dist/rsc/RscRoutes.d.ts +7 -0
  224. package/dist/rsc/RscRoutes.d.ts.map +1 -0
  225. package/dist/rsc/RscRoutes.js +100 -0
  226. package/dist/rsc/ServerRouteLoader.d.ts +12 -0
  227. package/dist/rsc/ServerRouteLoader.d.ts.map +1 -0
  228. package/dist/rsc/ServerRouteLoader.js +31 -0
  229. package/dist/rsc/ServerRouter.d.ts +11 -0
  230. package/dist/rsc/ServerRouter.d.ts.map +1 -0
  231. package/dist/rsc/ServerRouter.js +136 -0
  232. package/dist/rsc/SsrRouter.d.ts +4 -0
  233. package/dist/rsc/SsrRouter.d.ts.map +1 -0
  234. package/dist/rsc/SsrRouter.js +22 -0
  235. package/dist/rsc/clientSsr.d.ts +2 -0
  236. package/dist/rsc/clientSsr.d.ts.map +1 -0
  237. package/dist/rsc/clientSsr.js +80 -0
  238. package/dist/rsc/rscCss.d.ts +2 -0
  239. package/dist/rsc/rscCss.d.ts.map +1 -0
  240. package/dist/rsc/rscCss.js +60 -0
  241. package/dist/rsc/ssrModuleMap.d.ts +14 -0
  242. package/dist/rsc/ssrModuleMap.d.ts.map +1 -0
  243. package/dist/rsc/ssrModuleMap.js +25 -0
  244. package/dist/rsc/utils.d.ts +20 -0
  245. package/dist/rsc/utils.d.ts.map +1 -0
  246. package/dist/rsc/utils.js +31 -0
  247. package/dist/rsc-link.d.ts +6 -0
  248. package/dist/rsc-link.d.ts.map +1 -0
  249. package/dist/rsc-link.js +7 -0
  250. package/dist/skipNav.d.ts +81 -0
  251. package/dist/skipNav.d.ts.map +1 -0
  252. package/dist/skipNav.js +34 -0
  253. package/dist/splash-page.d.ts +12 -0
  254. package/dist/splash-page.d.ts.map +1 -0
  255. package/dist/splash-page.js +481 -0
  256. package/dist/useBlocker.d.ts +11 -0
  257. package/dist/useBlocker.d.ts.map +1 -0
  258. package/dist/useBlocker.js +41 -0
  259. package/dist/useIsMounted.d.ts +2 -0
  260. package/dist/useIsMounted.d.ts.map +1 -0
  261. package/dist/useIsMounted.js +13 -0
  262. package/dist/useMatch.d.ts +43 -0
  263. package/dist/useMatch.d.ts.map +1 -0
  264. package/dist/useMatch.js +48 -0
  265. package/dist/useRouteName.d.ts +3 -0
  266. package/dist/useRouteName.d.ts.map +1 -0
  267. package/dist/useRouteName.js +16 -0
  268. package/dist/useRoutePaths.d.ts +4 -0
  269. package/dist/useRoutePaths.d.ts.map +1 -0
  270. package/dist/useRoutePaths.js +25 -0
  271. package/dist/util.d.ts +121 -0
  272. package/dist/util.d.ts.map +1 -0
  273. package/dist/util.js +183 -0
  274. package/package.json +127 -0
  275. package/skip-nav.css +31 -0
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
+ Link: () => import_link.Link,
33
+ LocationProvider: () => import_location.LocationProvider,
34
+ NavLink: () => import_navLink.NavLink,
35
+ PageLoadingContextProvider: () => import_PageLoadingContext.PageLoadingContextProvider,
36
+ ParamsContext: () => import_params.ParamsContext,
37
+ ParamsProvider: () => import_params.ParamsProvider,
38
+ Redirect: () => import_redirect.Redirect,
39
+ Route: () => import_Route.Route,
40
+ RouteAnnouncement: () => import_route_announcement.default,
41
+ RouteFocus: () => import_route_focus.default,
42
+ Router: () => import_router.Router,
43
+ SkipNavContent: () => import_skipNav.SkipNavContent,
44
+ SkipNavLink: () => import_skipNav.SkipNavLink,
45
+ back: () => import_history.back,
46
+ getRouteRegexAndParams: () => import_util.getRouteRegexAndParams,
47
+ matchPath: () => import_util.matchPath,
48
+ navigate: () => import_history.navigate,
49
+ parseSearch: () => import_util.parseSearch,
50
+ routes: () => import_namedRoutes.namedRoutes,
51
+ useLocation: () => import_location.useLocation,
52
+ usePageLoadingContext: () => import_PageLoadingContext.usePageLoadingContext,
53
+ useParams: () => import_params.useParams
54
+ });
55
+ module.exports = __toCommonJS(index_exports);
56
+ var import_history = require("./history.js");
57
+ var import_navLink = require("./navLink.js");
58
+ var import_link = require("./link.js");
59
+ var import_location = require("./location.js");
60
+ var import_redirect = require("./redirect.js");
61
+ var import_PageLoadingContext = require("./PageLoadingContext.js");
62
+ var import_params = require("./params.js");
63
+ var import_router = require("./router.js");
64
+ var import_Route = require("./Route.js");
65
+ var import_namedRoutes = require("./namedRoutes.js");
66
+ __reExport(index_exports, require("./Set.js"), module.exports);
67
+ var import_route_announcement = __toESM(require("./route-announcement.js"), 1);
68
+ __reExport(index_exports, require("./route-announcement.js"), module.exports);
69
+ var import_route_focus = __toESM(require("./route-focus.js"), 1);
70
+ __reExport(index_exports, require("./route-focus.js"), module.exports);
71
+ __reExport(index_exports, require("./useRouteName.js"), module.exports);
72
+ __reExport(index_exports, require("./useRoutePaths.js"), module.exports);
73
+ __reExport(index_exports, require("./useMatch.js"), module.exports);
74
+ __reExport(index_exports, require("./useBlocker.js"), module.exports);
75
+ var import_util = require("./util.js");
76
+ var import_skipNav = require("./skipNav.js");
77
+ __reExport(index_exports, require("./routeParamsTypes.js"), module.exports);
78
+ // Annotate the CommonJS export names for ESM import in node:
79
+ 0 && (module.exports = {
80
+ Link,
81
+ LocationProvider,
82
+ NavLink,
83
+ PageLoadingContextProvider,
84
+ ParamsContext,
85
+ ParamsProvider,
86
+ Redirect,
87
+ Route,
88
+ RouteAnnouncement,
89
+ RouteFocus,
90
+ Router,
91
+ SkipNavContent,
92
+ SkipNavLink,
93
+ back,
94
+ getRouteRegexAndParams,
95
+ matchPath,
96
+ navigate,
97
+ parseSearch,
98
+ routes,
99
+ useLocation,
100
+ usePageLoadingContext,
101
+ useParams,
102
+ ...require("./Set.js"),
103
+ ...require("./route-announcement.js"),
104
+ ...require("./route-focus.js"),
105
+ ...require("./useRouteName.js"),
106
+ ...require("./useRoutePaths.js"),
107
+ ...require("./useMatch.js"),
108
+ ...require("./useBlocker.js"),
109
+ ...require("./routeParamsTypes.js")
110
+ });
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { NavigateOptions } from './history.js';
3
+ export interface LinkProps {
4
+ to: string;
5
+ onClick?: React.MouseEventHandler<HTMLAnchorElement>;
6
+ options?: NavigateOptions;
7
+ }
8
+ export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>;
9
+ //# sourceMappingURL=link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/link.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAGzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;IACpD,OAAO,CAAC,EAAE,eAAe,CAAA;CAC1B;AAED,eAAO,MAAM,IAAI,qIA+Bf,CAAA"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var link_exports = {};
31
+ __export(link_exports, {
32
+ Link: () => Link
33
+ });
34
+ module.exports = __toCommonJS(link_exports);
35
+ var import_react = __toESM(require("react"), 1);
36
+ var import_history = require("./history.js");
37
+ const Link = (0, import_react.forwardRef)(({ to, onClick, options, ...rest }, ref) => /* @__PURE__ */ import_react.default.createElement(
38
+ "a",
39
+ {
40
+ href: to,
41
+ ref,
42
+ ...rest,
43
+ onClick: (event) => {
44
+ if (event.button !== 0 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
45
+ return;
46
+ }
47
+ event.preventDefault();
48
+ if (onClick) {
49
+ const result = onClick(event);
50
+ if (typeof result !== "boolean" || result) {
51
+ (0, import_history.navigate)(to, options);
52
+ }
53
+ } else {
54
+ (0, import_history.navigate)(to, options);
55
+ }
56
+ }
57
+ }
58
+ ));
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ Link
62
+ });
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import type { TrailingSlashesTypes } from './util.js';
3
+ export interface LocationContextType extends URL {
4
+ }
5
+ declare const LocationContext: React.Context<LocationContextType | undefined>;
6
+ interface Location extends URL {
7
+ }
8
+ interface LocationProviderProps {
9
+ location?: Location;
10
+ trailingSlashes?: TrailingSlashesTypes;
11
+ children?: React.ReactNode;
12
+ }
13
+ interface LocationProviderState {
14
+ context: Location | undefined;
15
+ }
16
+ declare class LocationProvider extends React.Component<LocationProviderProps, LocationProviderState> {
17
+ static contextType: React.Context<LocationContextType | undefined>;
18
+ context: React.ContextType<typeof LocationContext>;
19
+ HISTORY_LISTENER_ID: string | undefined;
20
+ state: LocationProviderState;
21
+ getContext(): URL | undefined;
22
+ componentDidMount(): void;
23
+ componentWillUnmount(): void;
24
+ render(): React.JSX.Element;
25
+ }
26
+ declare const useLocation: () => LocationContextType;
27
+ export { LocationProvider, LocationContext, useLocation };
28
+ //# sourceMappingURL=location.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../src/location.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGrD,MAAM,WAAW,mBAAoB,SAAQ,GAAG;CAAG;AAEnD,QAAA,MAAM,eAAe,gDAAsD,CAAA;AAG3E,UAAU,QAAS,SAAQ,GAAG;CAAG;AAEjC,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,eAAe,CAAC,EAAE,oBAAoB,CAAA;IACtC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED,UAAU,qBAAqB;IAC7B,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAA;CAC9B;AAED,cAAM,gBAAiB,SAAQ,KAAK,CAAC,SAAS,CAC5C,qBAAqB,EACrB,qBAAqB,CACtB;IAIC,MAAM,CAAC,WAAW,iDAAkB;IAE5B,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,OAAO,eAAe,CAAC,CAAA;IAC1D,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAY;IAEnD,KAAK,EAAE,qBAAqB,CAE3B;IAED,UAAU;IA0CV,iBAAiB;IAiBjB,oBAAoB;IAMpB,MAAM;CAOP;AAED,QAAA,MAAM,WAAW,2BAQhB,CAAA;AAED,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAAE,CAAA"}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var location_exports = {};
31
+ __export(location_exports, {
32
+ LocationContext: () => LocationContext,
33
+ LocationProvider: () => LocationProvider,
34
+ useLocation: () => useLocation
35
+ });
36
+ module.exports = __toCommonJS(location_exports);
37
+ var import_react = __toESM(require("react"), 1);
38
+ var import_createNamedContext = require("./createNamedContext.js");
39
+ var import_history = require("./history.js");
40
+ const LocationContext = (0, import_createNamedContext.createNamedContext)("Location");
41
+ class LocationProvider extends import_react.default.Component {
42
+ // When prerendering, there might be more than one level of location
43
+ // providers. Use the values from the one above.
44
+ // (this is basically the class component version of `useLocation()`)
45
+ static contextType = LocationContext;
46
+ HISTORY_LISTENER_ID = void 0;
47
+ state = {
48
+ context: this.getContext()
49
+ };
50
+ getContext() {
51
+ let windowLocation;
52
+ if (typeof window !== "undefined") {
53
+ const { pathname } = window.location;
54
+ switch (this.props.trailingSlashes) {
55
+ case "never":
56
+ if (pathname.endsWith("/")) {
57
+ window.history.replaceState(
58
+ {},
59
+ "",
60
+ pathname.substr(0, pathname.length - 1)
61
+ );
62
+ }
63
+ break;
64
+ case "always":
65
+ if (!pathname.endsWith("/")) {
66
+ window.history.replaceState({}, "", pathname + "/");
67
+ }
68
+ break;
69
+ default:
70
+ break;
71
+ }
72
+ windowLocation = new URL(window.location.href);
73
+ }
74
+ return this.props.location || this.context || windowLocation;
75
+ }
76
+ // componentDidMount() is not called during server rendering (aka SSR and
77
+ // prerendering)
78
+ componentDidMount() {
79
+ this.HISTORY_LISTENER_ID = import_history.gHistory.listen((_, options) => {
80
+ const context = this.getContext();
81
+ this.setState((lastState) => {
82
+ if ((context?.pathname !== lastState?.context?.pathname || context?.search !== lastState?.context?.search) && options?.scroll === true) {
83
+ globalThis?.scrollTo(0, 0);
84
+ }
85
+ return { context };
86
+ });
87
+ });
88
+ }
89
+ componentWillUnmount() {
90
+ if (this.HISTORY_LISTENER_ID) {
91
+ import_history.gHistory.remove(this.HISTORY_LISTENER_ID);
92
+ }
93
+ }
94
+ render() {
95
+ return /* @__PURE__ */ import_react.default.createElement(LocationContext.Provider, { value: this.state.context }, this.props.children);
96
+ }
97
+ }
98
+ const useLocation = () => {
99
+ const location = import_react.default.useContext(LocationContext);
100
+ if (location === void 0) {
101
+ throw new Error("useLocation must be used within a LocationProvider");
102
+ }
103
+ return location;
104
+ };
105
+ // Annotate the CommonJS export names for ESM import in node:
106
+ 0 && (module.exports = {
107
+ LocationContext,
108
+ LocationProvider,
109
+ useLocation
110
+ });
@@ -0,0 +1,3 @@
1
+ import type { AvailableRoutes } from './index.js';
2
+ export declare const namedRoutes: AvailableRoutes;
3
+ //# sourceMappingURL=namedRoutes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namedRoutes.d.ts","sourceRoot":"","sources":["../../src/namedRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAMjD,eAAO,MAAM,WAAW,EAAE,eAAoB,CAAA"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var namedRoutes_exports = {};
20
+ __export(namedRoutes_exports, {
21
+ namedRoutes: () => namedRoutes
22
+ });
23
+ module.exports = __toCommonJS(namedRoutes_exports);
24
+ const namedRoutes = {};
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ namedRoutes
28
+ });
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { LinkProps } from './link.js';
3
+ import type { FlattenSearchParams } from './util.js';
4
+ interface NavLinkProps extends LinkProps {
5
+ activeClassName: string;
6
+ activeMatchParams?: FlattenSearchParams;
7
+ matchSubPaths?: boolean;
8
+ }
9
+ export declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>;
10
+ export {};
11
+ //# sourceMappingURL=navLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navLink.d.ts","sourceRoot":"","sources":["../../src/navLink.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAGzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAG1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAEpD,UAAU,YAAa,SAAQ,SAAS;IACtC,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,mBAAmB,CAAA;IACvC,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,eAAO,MAAM,OAAO,wIAkCnB,CAAA"}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var navLink_exports = {};
31
+ __export(navLink_exports, {
32
+ NavLink: () => NavLink
33
+ });
34
+ module.exports = __toCommonJS(navLink_exports);
35
+ var import_react = __toESM(require("react"), 1);
36
+ var import_link = require("./link.js");
37
+ var import_useMatch = require("./useMatch.js");
38
+ var import_util = require("./util.js");
39
+ const NavLink = (0, import_react.forwardRef)(
40
+ ({
41
+ to,
42
+ activeClassName,
43
+ activeMatchParams,
44
+ matchSubPaths,
45
+ className,
46
+ onClick,
47
+ ...rest
48
+ }, ref) => {
49
+ const [pathname, queryString] = to.split("?");
50
+ const searchParams = activeMatchParams || (0, import_util.flattenSearchParams)(queryString);
51
+ const matchInfo = (0, import_useMatch.useMatch)(pathname, {
52
+ searchParams,
53
+ matchSubPaths
54
+ });
55
+ return /* @__PURE__ */ import_react.default.createElement(
56
+ import_link.Link,
57
+ {
58
+ ref,
59
+ to,
60
+ onClick,
61
+ className: matchInfo.match ? activeClassName : className,
62
+ ...rest
63
+ }
64
+ );
65
+ }
66
+ );
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {
69
+ NavLink
70
+ });
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,28 @@
1
+ export interface Spec {
2
+ name: string;
3
+ prerenderLoader: (name?: string) => {
4
+ default: React.ComponentType<unknown>;
5
+ };
6
+ LazyComponent: React.LazyExoticComponent<React.ComponentType<unknown>> | React.ComponentType<unknown>;
7
+ }
8
+ export declare function isSpec(specOrPage: Spec | React.ComponentType): specOrPage is Spec;
9
+ /**
10
+ * Pages can be imported automatically or manually. Automatic imports are actually
11
+ * objects and take the following form (which we call a 'spec'):
12
+ *
13
+ * const WhateverPage = {
14
+ * name: 'WhateverPage',
15
+ * LazyComponent: lazy(() => import('src/pages/WhateverPage'))
16
+ * prerenderLoader: ...
17
+ * }
18
+ *
19
+ * Manual imports simply load the page:
20
+ *
21
+ * import WhateverPage from 'src/pages/WhateverPage'
22
+ *
23
+ * Before passing a "page" to the PageLoader, we will normalize the manually
24
+ * imported version into a spec.
25
+ */
26
+ export declare function normalizePage(specOrPage: Spec | React.ComponentType<unknown>): Spec;
27
+ export type PageType = Spec | React.ComponentType<any> | ((props: any) => JSX.Element);
28
+ //# sourceMappingURL=page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/page.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK;QAAE,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;KAAE,CAAA;IAC7E,aAAa,EACT,KAAK,CAAC,mBAAmB,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,GACvD,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;CACjC;AAED,wBAAgB,MAAM,CACpB,UAAU,EAAE,IAAI,GAAG,KAAK,CAAC,aAAa,GACrC,UAAU,IAAI,IAAI,CAEpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,GAC9C,IAAI,CAaN;AAED,MAAM,MAAM,QAAQ,GAChB,IAAI,GACJ,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,GACxB,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC,OAAO,CAAC,CAAA"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var page_exports = {};
20
+ __export(page_exports, {
21
+ isSpec: () => isSpec,
22
+ normalizePage: () => normalizePage
23
+ });
24
+ module.exports = __toCommonJS(page_exports);
25
+ function isSpec(specOrPage) {
26
+ return specOrPage.LazyComponent !== void 0;
27
+ }
28
+ function normalizePage(specOrPage) {
29
+ if (isSpec(specOrPage)) {
30
+ return specOrPage;
31
+ }
32
+ return {
33
+ name: specOrPage.name,
34
+ prerenderLoader: () => ({ default: specOrPage }),
35
+ LazyComponent: specOrPage
36
+ };
37
+ }
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ isSpec,
41
+ normalizePage
42
+ });
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export interface ParamsContextProps {
3
+ params: Record<string, string>;
4
+ }
5
+ export declare const ParamsContext: React.Context<ParamsContextProps | undefined>;
6
+ interface Props {
7
+ allParams?: Record<any, any>;
8
+ children?: React.ReactNode;
9
+ }
10
+ export declare const ParamsProvider: React.FC<Props>;
11
+ export declare const useParams: () => Record<string, string>;
12
+ export {};
13
+ //# sourceMappingURL=params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../src/params.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B;AAED,eAAO,MAAM,aAAa,+CAAmD,CAAA;AAE7E,UAAU,KAAK;IACb,SAAS,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAY1C,CAAA;AAED,eAAO,MAAM,SAAS,8BAQrB,CAAA"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var params_exports = {};
30
+ __export(params_exports, {
31
+ ParamsContext: () => ParamsContext,
32
+ ParamsProvider: () => ParamsProvider,
33
+ useParams: () => useParams
34
+ });
35
+ module.exports = __toCommonJS(params_exports);
36
+ var import_react = __toESM(require("react"), 1);
37
+ var import_createNamedContext = require("./createNamedContext.js");
38
+ const ParamsContext = (0, import_createNamedContext.createNamedContext)("Params");
39
+ const ParamsProvider = ({ allParams, children }) => {
40
+ return /* @__PURE__ */ import_react.default.createElement(
41
+ ParamsContext.Provider,
42
+ {
43
+ value: {
44
+ params: {
45
+ ...allParams
46
+ }
47
+ }
48
+ },
49
+ children
50
+ );
51
+ };
52
+ const useParams = () => {
53
+ const paramsContext = (0, import_react.useContext)(ParamsContext);
54
+ if (paramsContext === void 0) {
55
+ throw new Error("useParams must be used within a ParamsProvider");
56
+ }
57
+ return paramsContext.params;
58
+ };
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ ParamsContext,
62
+ ParamsProvider,
63
+ useParams
64
+ });
@@ -0,0 +1,3 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare function flattenAll(children: ReactNode): ReactNode[];
3
+ //# sourceMappingURL=react-util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-util.d.ts","sourceRoot":"","sources":["../../src/react-util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,wBAAgB,UAAU,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,CAU3D"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var react_util_exports = {};
20
+ __export(react_util_exports, {
21
+ flattenAll: () => flattenAll
22
+ });
23
+ module.exports = __toCommonJS(react_util_exports);
24
+ var import_react = require("react");
25
+ function flattenAll(children) {
26
+ const childrenArray = import_react.Children.toArray(children);
27
+ return childrenArray.flatMap((child) => {
28
+ if ((0, import_react.isValidElement)(child) && child.props.children) {
29
+ return [child, ...flattenAll(child.props.children)];
30
+ }
31
+ return [child];
32
+ });
33
+ }
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ flattenAll
37
+ });