@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,12 @@
1
+ import type { NavigateOptions } from './history.js';
2
+ interface RedirectProps {
3
+ /** The path to redirect to */
4
+ to: string;
5
+ options?: NavigateOptions;
6
+ }
7
+ /**
8
+ * A declarative way to redirect to a route name
9
+ */
10
+ export declare const Redirect: ({ to, options }: RedirectProps) => null;
11
+ export {};
12
+ //# sourceMappingURL=redirect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../src/redirect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGnD,UAAU,aAAa;IACrB,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,CAAC,EAAE,eAAe,CAAA;CAC1B;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,oBAAqB,aAAa,SAMtD,CAAA"}
@@ -0,0 +1,35 @@
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 redirect_exports = {};
20
+ __export(redirect_exports, {
21
+ Redirect: () => Redirect
22
+ });
23
+ module.exports = __toCommonJS(redirect_exports);
24
+ var import_react = require("react");
25
+ var import_history = require("./history.js");
26
+ const Redirect = ({ to, options }) => {
27
+ (0, import_react.useEffect)(() => {
28
+ (0, import_history.navigate)(to, options);
29
+ }, [to, options]);
30
+ return null;
31
+ };
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ Redirect
35
+ });
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ /**
3
+ * this initial implementation borrows (heavily!) from madalyn's great work at gatsby:
4
+ * - issue: https://github.com/gatsbyjs/gatsby/issues/21059
5
+ * - PR: https://github.com/gatsbyjs/gatsby/pull/26376
6
+ */
7
+ declare const RouteAnnouncement: React.FC<RouteAnnouncementProps>;
8
+ export interface RouteAnnouncementProps {
9
+ children: React.ReactNode;
10
+ visuallyHidden?: boolean;
11
+ }
12
+ export default RouteAnnouncement;
13
+ //# sourceMappingURL=route-announcement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-announcement.d.ts","sourceRoot":"","sources":["../../src/route-announcement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;GAIG;AACH,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA0BvD,CAAA;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,eAAe,iBAAiB,CAAA"}
@@ -0,0 +1,61 @@
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 route_announcement_exports = {};
30
+ __export(route_announcement_exports, {
31
+ default: () => route_announcement_default
32
+ });
33
+ module.exports = __toCommonJS(route_announcement_exports);
34
+ var import_react = __toESM(require("react"), 1);
35
+ const RouteAnnouncement = ({
36
+ children,
37
+ visuallyHidden = false,
38
+ ...props
39
+ }) => {
40
+ const hiddenStyle = {
41
+ position: `absolute`,
42
+ top: `0`,
43
+ width: `1`,
44
+ height: `1`,
45
+ padding: `0`,
46
+ overflow: `hidden`,
47
+ clip: `rect(0, 0, 0, 0)`,
48
+ whiteSpace: `nowrap`,
49
+ border: `0`
50
+ };
51
+ return /* @__PURE__ */ import_react.default.createElement(
52
+ "div",
53
+ {
54
+ ...props,
55
+ "data-redwood-route-announcement": true,
56
+ style: visuallyHidden ? hiddenStyle : {}
57
+ },
58
+ children
59
+ );
60
+ };
61
+ var route_announcement_default = RouteAnnouncement;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ /**
3
+ * this initial implementation borrows (heavily!) from madalyn's great work at gatsby:
4
+ * - issue: https://github.com/gatsbyjs/gatsby/issues/21059
5
+ * - PR: https://github.com/gatsbyjs/gatsby/pull/26376
6
+ */
7
+ declare const RouteFocus: React.FC<RouteFocusProps>;
8
+ export interface RouteFocusProps {
9
+ children: React.ReactNode;
10
+ }
11
+ export default RouteFocus;
12
+ //# sourceMappingURL=route-focus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-focus.d.ts","sourceRoot":"","sources":["../../src/route-focus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;GAIG;AACH,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAIzC,CAAA;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,eAAe,UAAU,CAAA"}
@@ -0,0 +1,36 @@
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 route_focus_exports = {};
30
+ __export(route_focus_exports, {
31
+ default: () => route_focus_default
32
+ });
33
+ module.exports = __toCommonJS(route_focus_exports);
34
+ var import_react = __toESM(require("react"), 1);
35
+ const RouteFocus = ({ children, ...props }) => /* @__PURE__ */ import_react.default.createElement("div", { ...props, "data-redwood-route-focus": true }, children);
36
+ var route_focus_default = RouteFocus;
@@ -0,0 +1,21 @@
1
+ import type { ReactNode, ReactElement } from 'react';
2
+ import type { InternalRouteProps, NotFoundRouteProps, RedirectRouteProps, RouteProps } from './Route.js';
3
+ /**
4
+ * Narrows down the type of the Route element to RouteProps
5
+ *
6
+ * It means that it is not a notfound page or a redirected route
7
+ */
8
+ export declare function isStandardRoute(node: ReactElement<InternalRouteProps>): node is ReactElement<RouteProps>;
9
+ /** Checks if a Route element is a Redirect Route */
10
+ export declare function isRedirectRoute(node: ReactElement<InternalRouteProps>): node is ReactElement<RedirectRouteProps>;
11
+ /** Checks if a Route element is a NotFound Route */
12
+ export declare function isNotFoundRoute(node: ReactElement<InternalRouteProps>): node is ReactElement<NotFoundRouteProps>;
13
+ /**
14
+ * Check that the Route element is ok
15
+ * and that it could be one of the following:
16
+ * <Route redirect .../> (redirect Route)
17
+ * <Route notfound .../> (notfound Route)
18
+ * <Route .../> (standard Route)
19
+ */
20
+ export declare function isValidRoute(node: ReactNode): node is ReactElement<InternalRouteProps>;
21
+ //# sourceMappingURL=route-validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-validators.d.ts","sourceRoot":"","sources":["../../src/route-validators.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAGpD,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACX,MAAM,YAAY,CAAA;AAanB;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,YAAY,CAAC,kBAAkB,CAAC,GACrC,IAAI,IAAI,YAAY,CAAC,UAAU,CAAC,CAElC;AAED,oDAAoD;AACpD,wBAAgB,eAAe,CAC7B,IAAI,EAAE,YAAY,CAAC,kBAAkB,CAAC,GACrC,IAAI,IAAI,YAAY,CAAC,kBAAkB,CAAC,CAE1C;AAED,oDAAoD;AACpD,wBAAgB,eAAe,CAC7B,IAAI,EAAE,YAAY,CAAC,kBAAkB,CAAC,GACrC,IAAI,IAAI,YAAY,CAAC,kBAAkB,CAAC,CAE1C;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,SAAS,GACd,IAAI,IAAI,YAAY,CAAC,kBAAkB,CAAC,CA8B1C"}
@@ -0,0 +1,71 @@
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 route_validators_exports = {};
20
+ __export(route_validators_exports, {
21
+ isNotFoundRoute: () => isNotFoundRoute,
22
+ isRedirectRoute: () => isRedirectRoute,
23
+ isStandardRoute: () => isStandardRoute,
24
+ isValidRoute: () => isValidRoute
25
+ });
26
+ module.exports = __toCommonJS(route_validators_exports);
27
+ var import_react = require("react");
28
+ var import_Route = require("./Route.js");
29
+ function isNodeTypeRoute(node) {
30
+ return (0, import_react.isValidElement)(node) && node.type === import_Route.Route;
31
+ }
32
+ function isString(value) {
33
+ return typeof value === "string";
34
+ }
35
+ function isStandardRoute(node) {
36
+ return !node.props.notfound && !node.props.redirect;
37
+ }
38
+ function isRedirectRoute(node) {
39
+ return !!node.props.redirect;
40
+ }
41
+ function isNotFoundRoute(node) {
42
+ return !!node.props.notfound;
43
+ }
44
+ function isValidRoute(node) {
45
+ const isValidRouteElement = isNodeTypeRoute(node);
46
+ if (isValidRouteElement) {
47
+ const notFoundOrRedirect = node.props.notfound || node.props.redirect;
48
+ const requiredKeys = [
49
+ !node.props.notfound && "path",
50
+ // redirects don't need an actual page, but notfound and standard do
51
+ !node.props.redirect && "page",
52
+ // Redirects can have names, but aren't required to
53
+ !notFoundOrRedirect && "name"
54
+ ].filter(isString);
55
+ const missingKeys = requiredKeys.filter((key) => !(key in node.props));
56
+ if (missingKeys.length > 0) {
57
+ const stringToHelpIdentify = node.props.name || node.props.path ? `for "${node.props.name || node.props.path}" ` : "";
58
+ throw new Error(
59
+ `Route element ${stringToHelpIdentify}is missing required props: ` + missingKeys.join(", ")
60
+ );
61
+ }
62
+ }
63
+ return isValidRouteElement;
64
+ }
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ isNotFoundRoute,
68
+ isRedirectRoute,
69
+ isStandardRoute,
70
+ isValidRoute
71
+ });
@@ -0,0 +1,49 @@
1
+ import type { A } from 'ts-toolbelt';
2
+ export type GenericParams = Record<string | number, string | number | boolean>;
3
+ export type QueryParams = GenericParams;
4
+ export type RouteParams<Route> = Route extends `${string}/${infer Rest}` ? A.Compute<ParsedParams<Rest>> : GenericParams;
5
+ export type ParamType<match> = match extends 'Int' ? number : match extends 'Boolean' ? boolean : match extends 'Float' ? number : string;
6
+ type ParamsFromGreedyMatch<TParam extends string, TMatch extends string, TRest extends string> = {
7
+ [ParamName in TParam as RemoveGlobDots<ParamName>]: string;
8
+ } & ParsedParams<`${TRest}:${TMatch}}`> & ParsedParams<`${TRest}`>;
9
+ type TypedParamInFront<TParam extends string, TMatch extends string, TRest extends string> = TParam extends `${infer Param2}}/${infer Rest2}` ? ParamsFromGreedyMatch<Param2, TMatch, Rest2> : // Otherwise its a regular match
10
+ {
11
+ [ParamName in TParam]: ParamType<TMatch>;
12
+ } & ParsedParams<`${TRest}`>;
13
+ type TypedParamAtEnd<TParam extends string, TMatch extends string> = TParam extends `${infer Param2}}/${infer Rest2}` ? {
14
+ [ParamName in Param2]: string;
15
+ } & ParsedParams<`${Rest2}:${TMatch}}`> : {
16
+ [ParamName in TParam]: ParamType<TMatch>;
17
+ };
18
+ type RemoveGlobDots<Param> = Param extends `${infer GlobParamName}...` ? GlobParamName : Param;
19
+ type MultiParamsWithoutType<TParam extends string, TRest extends string> = {
20
+ [ParamName in TParam as RemoveGlobDots<ParamName>]: string;
21
+ } & ParsedParams<`${TRest}`>;
22
+ type JustParamNoType<TParam extends string> = {
23
+ [ParamName in TParam as RemoveGlobDots<ParamName>]: string;
24
+ };
25
+ type ParsedParams<PartialRoute> = PartialRoute extends `${string}{${infer Param}:${infer Match}}${string}/${infer Rest}` ? TypedParamInFront<Param, Match, Rest> : PartialRoute extends `${string}{${infer Param}:${infer Match}}${string}` ? TypedParamAtEnd<Param, Match> : PartialRoute extends `${string}{${infer Param}}${string}/${infer Rest}` ? MultiParamsWithoutType<Param, Rest> : PartialRoute extends `${string}{${infer Param}}${string}` ? JustParamNoType<Param> : PartialRoute extends `${string}/${infer Rest}` ? ParsedParams<`${Rest}`> : GenericParams;
26
+ export {};
27
+ /**
28
+ * Translation in pseudocode without ternaries
29
+ *
30
+ if ('he{c:Int}lo/...rest') {
31
+ checkForGreedyMatch()
32
+ } else if ('he{c:Int}lo') {
33
+ typedParamAtEnd()
34
+ } else if ('he{c}yo/...rest') {
35
+ multipleParamsNoTypes()
36
+ } else if('he{d}yo') {
37
+ justParamNoType()
38
+ } else if ('bazinga/..rest') {
39
+ // Call itself
40
+ parseParamsRecursiveCall(rest)
41
+ } else{
42
+ // fallback, because it doesn't match any of the above
43
+ GenericParams
44
+ }
45
+
46
+ Its a bit odd, but the he{d}llo is a form we support in the router
47
+ // e.g. /signedUp/e{status:Boolean}y
48
+ **/
49
+ //# sourceMappingURL=routeParamsTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routeParamsTypes.d.ts","sourceRoot":"","sources":["../../src/routeParamsTypes.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,16 @@
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 __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var routeParamsTypes_exports = {};
16
+ module.exports = __toCommonJS(routeParamsTypes_exports);
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import type { AuthContextInterface } from '@cedarjs/auth' with { 'resolution-mode': 'import' };
3
+ import type { analyzeRoutes } from './analyzeRoutes.js';
4
+ import type { ParamType } from './util.js';
5
+ type UseAuth = () => AuthContextInterface<unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown>;
6
+ export interface RouterState {
7
+ paramTypes?: Record<string, ParamType>;
8
+ useAuth: UseAuth;
9
+ routes: ReturnType<typeof analyzeRoutes>;
10
+ activeRouteName?: string | undefined | null;
11
+ }
12
+ export interface RouterContextProviderProps extends Omit<RouterState, 'useAuth'> {
13
+ useAuth?: UseAuth;
14
+ routes: ReturnType<typeof analyzeRoutes>;
15
+ activeRouteName?: string | undefined | null;
16
+ children: React.ReactNode;
17
+ }
18
+ export declare const RouterContextProvider: React.FC<RouterContextProviderProps>;
19
+ export declare const useRouterState: () => RouterState;
20
+ export {};
21
+ //# sourceMappingURL=router-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-context.d.ts","sourceRoot":"","sources":["../../src/router-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAA;AAEjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC,OAAO,iBAAiB,EAAE,QAAQ,EAAE,CAAA;AAG9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAE1C,KAAK,OAAO,GAAG,MAAM,oBAAoB,CACvC,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,CACR,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACtC,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;IACxC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;CAC5C;AAID,MAAM,WAAW,0BACf,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;IACxC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAsBtE,CAAA;AAED,eAAO,MAAM,cAAc,mBAU1B,CAAA"}
@@ -0,0 +1,69 @@
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 router_context_exports = {};
30
+ __export(router_context_exports, {
31
+ RouterContextProvider: () => RouterContextProvider,
32
+ useRouterState: () => useRouterState
33
+ });
34
+ module.exports = __toCommonJS(router_context_exports);
35
+ var import_react = __toESM(require("react"), 1);
36
+ var import_auth = require("@cedarjs/auth");
37
+ const RouterStateContext = (0, import_react.createContext)(void 0);
38
+ const RouterContextProvider = ({
39
+ useAuth,
40
+ paramTypes,
41
+ routes,
42
+ activeRouteName,
43
+ children
44
+ }) => {
45
+ const state = (0, import_react.useMemo)(
46
+ () => ({
47
+ useAuth: useAuth || import_auth.useNoAuth,
48
+ paramTypes,
49
+ routes,
50
+ activeRouteName
51
+ }),
52
+ [useAuth, paramTypes, routes, activeRouteName]
53
+ );
54
+ return /* @__PURE__ */ import_react.default.createElement(RouterStateContext.Provider, { value: state }, children);
55
+ };
56
+ const useRouterState = () => {
57
+ const context = (0, import_react.useContext)(RouterStateContext);
58
+ if (context === void 0) {
59
+ throw new Error(
60
+ "useRouterState must be used within a RouterContextProvider"
61
+ );
62
+ }
63
+ return context;
64
+ };
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ RouterContextProvider,
68
+ useRouterState
69
+ });
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ import React from 'react';
3
+ import type { RouterContextProviderProps } from './router-context.js';
4
+ import type { TrailingSlashesTypes } from './util.js';
5
+ export interface RouterProps extends Omit<RouterContextProviderProps, 'routes' | 'activeRouteName'> {
6
+ trailingSlashes?: TrailingSlashesTypes;
7
+ pageLoadingDelay?: number;
8
+ children: ReactNode;
9
+ }
10
+ export declare const Router: React.FC<RouterProps>;
11
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAwB,MAAM,OAAO,CAAA;AAY5C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAIrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAErD,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,0BAA0B,EAAE,QAAQ,GAAG,iBAAiB,CAAC;IACtE,eAAe,CAAC,EAAE,oBAAoB,CAAA;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAoBxC,CAAA"}