@cedarjs/router 6.0.0-canary.2779 → 6.0.0-canary.2781

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 (137) hide show
  1. package/package.json +22 -64
  2. package/dist/cjs/ActivePageContext.d.ts +0 -15
  3. package/dist/cjs/ActivePageContext.d.ts.map +0 -1
  4. package/dist/cjs/ActivePageContext.js +0 -42
  5. package/dist/cjs/AuthenticatedRoute.d.ts +0 -11
  6. package/dist/cjs/AuthenticatedRoute.d.ts.map +0 -1
  7. package/dist/cjs/AuthenticatedRoute.js +0 -83
  8. package/dist/cjs/PageLoadingContext.d.ts +0 -14
  9. package/dist/cjs/PageLoadingContext.d.ts.map +0 -1
  10. package/dist/cjs/PageLoadingContext.js +0 -64
  11. package/dist/cjs/Route.d.ts +0 -32
  12. package/dist/cjs/Route.d.ts.map +0 -1
  13. package/dist/cjs/Route.js +0 -41
  14. package/dist/cjs/Set.d.ts +0 -58
  15. package/dist/cjs/Set.d.ts.map +0 -1
  16. package/dist/cjs/Set.js +0 -67
  17. package/dist/cjs/a11yUtils.d.ts +0 -14
  18. package/dist/cjs/a11yUtils.d.ts.map +0 -1
  19. package/dist/cjs/a11yUtils.js +0 -61
  20. package/dist/cjs/active-route-loader.d.ts +0 -12
  21. package/dist/cjs/active-route-loader.d.ts.map +0 -1
  22. package/dist/cjs/active-route-loader.js +0 -116
  23. package/dist/cjs/analyzeRoutes.d.ts +0 -44
  24. package/dist/cjs/analyzeRoutes.d.ts.map +0 -1
  25. package/dist/cjs/analyzeRoutes.js +0 -143
  26. package/dist/cjs/createNamedContext.d.ts +0 -3
  27. package/dist/cjs/createNamedContext.d.ts.map +0 -1
  28. package/dist/cjs/createNamedContext.js +0 -33
  29. package/dist/cjs/dummyComponent.d.ts +0 -3
  30. package/dist/cjs/dummyComponent.d.ts.map +0 -1
  31. package/dist/cjs/dummyComponent.js +0 -24
  32. package/dist/cjs/history.d.ts +0 -24
  33. package/dist/cjs/history.d.ts.map +0 -1
  34. package/dist/cjs/history.js +0 -145
  35. package/dist/cjs/index.d.ts +0 -35
  36. package/dist/cjs/index.d.ts.map +0 -1
  37. package/dist/cjs/index.js +0 -110
  38. package/dist/cjs/link.d.ts +0 -9
  39. package/dist/cjs/link.d.ts.map +0 -1
  40. package/dist/cjs/link.js +0 -62
  41. package/dist/cjs/location.d.ts +0 -28
  42. package/dist/cjs/location.d.ts.map +0 -1
  43. package/dist/cjs/location.js +0 -110
  44. package/dist/cjs/namedRoutes.d.ts +0 -3
  45. package/dist/cjs/namedRoutes.d.ts.map +0 -1
  46. package/dist/cjs/namedRoutes.js +0 -28
  47. package/dist/cjs/navLink.d.ts +0 -11
  48. package/dist/cjs/navLink.d.ts.map +0 -1
  49. package/dist/cjs/navLink.js +0 -70
  50. package/dist/cjs/package.json +0 -1
  51. package/dist/cjs/page.d.ts +0 -28
  52. package/dist/cjs/page.d.ts.map +0 -1
  53. package/dist/cjs/page.js +0 -42
  54. package/dist/cjs/params.d.ts +0 -13
  55. package/dist/cjs/params.d.ts.map +0 -1
  56. package/dist/cjs/params.js +0 -64
  57. package/dist/cjs/react-util.d.ts +0 -3
  58. package/dist/cjs/react-util.d.ts.map +0 -1
  59. package/dist/cjs/react-util.js +0 -37
  60. package/dist/cjs/redirect.d.ts +0 -12
  61. package/dist/cjs/redirect.d.ts.map +0 -1
  62. package/dist/cjs/redirect.js +0 -35
  63. package/dist/cjs/route-announcement.d.ts +0 -13
  64. package/dist/cjs/route-announcement.d.ts.map +0 -1
  65. package/dist/cjs/route-announcement.js +0 -61
  66. package/dist/cjs/route-focus.d.ts +0 -12
  67. package/dist/cjs/route-focus.d.ts.map +0 -1
  68. package/dist/cjs/route-focus.js +0 -36
  69. package/dist/cjs/route-validators.d.ts +0 -21
  70. package/dist/cjs/route-validators.d.ts.map +0 -1
  71. package/dist/cjs/route-validators.js +0 -71
  72. package/dist/cjs/routeParamsTypes.d.ts +0 -49
  73. package/dist/cjs/routeParamsTypes.d.ts.map +0 -1
  74. package/dist/cjs/routeParamsTypes.js +0 -16
  75. package/dist/cjs/router-context.d.ts +0 -23
  76. package/dist/cjs/router-context.d.ts.map +0 -1
  77. package/dist/cjs/router-context.js +0 -69
  78. package/dist/cjs/router.d.ts +0 -11
  79. package/dist/cjs/router.d.ts.map +0 -1
  80. package/dist/cjs/router.js +0 -207
  81. package/dist/cjs/rsc/ClientRouter.d.ts +0 -4
  82. package/dist/cjs/rsc/ClientRouter.d.ts.map +0 -1
  83. package/dist/cjs/rsc/ClientRouter.js +0 -90
  84. package/dist/cjs/rsc/RscCache.d.ts +0 -23
  85. package/dist/cjs/rsc/RscCache.d.ts.map +0 -1
  86. package/dist/cjs/rsc/RscCache.js +0 -120
  87. package/dist/cjs/rsc/RscRoutes.d.ts +0 -7
  88. package/dist/cjs/rsc/RscRoutes.d.ts.map +0 -1
  89. package/dist/cjs/rsc/RscRoutes.js +0 -124
  90. package/dist/cjs/rsc/ServerRouteLoader.d.ts +0 -12
  91. package/dist/cjs/rsc/ServerRouteLoader.d.ts.map +0 -1
  92. package/dist/cjs/rsc/ServerRouteLoader.js +0 -65
  93. package/dist/cjs/rsc/ServerRouter.d.ts +0 -11
  94. package/dist/cjs/rsc/ServerRouter.d.ts.map +0 -1
  95. package/dist/cjs/rsc/ServerRouter.js +0 -170
  96. package/dist/cjs/rsc/SsrRouter.d.ts +0 -4
  97. package/dist/cjs/rsc/SsrRouter.d.ts.map +0 -1
  98. package/dist/cjs/rsc/SsrRouter.js +0 -56
  99. package/dist/cjs/rsc/clientSsr.d.ts +0 -9
  100. package/dist/cjs/rsc/clientSsr.d.ts.map +0 -1
  101. package/dist/cjs/rsc/clientSsr.js +0 -162
  102. package/dist/cjs/rsc/rscCss.d.ts +0 -2
  103. package/dist/cjs/rsc/rscCss.d.ts.map +0 -1
  104. package/dist/cjs/rsc/rscCss.js +0 -94
  105. package/dist/cjs/rsc/ssrModuleMap.d.ts +0 -14
  106. package/dist/cjs/rsc/ssrModuleMap.d.ts.map +0 -1
  107. package/dist/cjs/rsc/ssrModuleMap.js +0 -49
  108. package/dist/cjs/rsc/utils.d.ts +0 -22
  109. package/dist/cjs/rsc/utils.d.ts.map +0 -1
  110. package/dist/cjs/rsc/utils.js +0 -83
  111. package/dist/cjs/rsc-link.d.ts +0 -6
  112. package/dist/cjs/rsc-link.d.ts.map +0 -1
  113. package/dist/cjs/rsc-link.js +0 -41
  114. package/dist/cjs/skipNav.d.ts +0 -81
  115. package/dist/cjs/skipNav.d.ts.map +0 -1
  116. package/dist/cjs/skipNav.js +0 -69
  117. package/dist/cjs/splash-page.d.ts +0 -12
  118. package/dist/cjs/splash-page.d.ts.map +0 -1
  119. package/dist/cjs/splash-page.js +0 -503
  120. package/dist/cjs/useBlocker.d.ts +0 -11
  121. package/dist/cjs/useBlocker.d.ts.map +0 -1
  122. package/dist/cjs/useBlocker.js +0 -65
  123. package/dist/cjs/useIsMounted.d.ts +0 -2
  124. package/dist/cjs/useIsMounted.d.ts.map +0 -1
  125. package/dist/cjs/useIsMounted.js +0 -37
  126. package/dist/cjs/useMatch.d.ts +0 -43
  127. package/dist/cjs/useMatch.d.ts.map +0 -1
  128. package/dist/cjs/useMatch.js +0 -72
  129. package/dist/cjs/useRouteName.d.ts +0 -3
  130. package/dist/cjs/useRouteName.d.ts.map +0 -1
  131. package/dist/cjs/useRouteName.js +0 -40
  132. package/dist/cjs/useRoutePaths.d.ts +0 -4
  133. package/dist/cjs/useRoutePaths.d.ts.map +0 -1
  134. package/dist/cjs/useRoutePaths.js +0 -50
  135. package/dist/cjs/util.d.ts +0 -121
  136. package/dist/cjs/util.d.ts.map +0 -1
  137. package/dist/cjs/util.js +0 -214
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/router",
3
- "version": "6.0.0-canary.2779",
3
+ "version": "6.0.0-canary.2781",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -10,69 +10,28 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
- "import": {
14
- "types": "./dist/index.d.ts",
15
- "default": "./dist/index.js"
16
- },
17
- "require": {
18
- "types": "./dist/cjs/index.d.ts",
19
- "default": "./dist/cjs/index.js"
20
- }
21
- },
22
- "./Route": {
23
- "import": "./dist/Route.js",
24
- "require": "./dist/cjs/Route.js"
25
- },
26
- "./Set": {
27
- "import": "./dist/Set.js",
28
- "require": "./dist/cjs/Set.js"
29
- },
30
- "./Link": {
31
- "import": "./dist/link.js",
32
- "require": "./dist/cjs/link.js"
33
- },
34
- "./NavLink": {
35
- "import": "./dist/navLink.js",
36
- "require": "./dist/cjs/navLink.js"
37
- },
38
- "./location": {
39
- "import": "./dist/location.js",
40
- "require": "./dist/cjs/location.js"
41
- },
42
- "./namedRoutes": {
43
- "import": "./dist/namedRoutes.js",
44
- "require": "./dist/cjs/namedRoutes.js"
45
- },
46
- "./util": {
47
- "import": "./dist/util.js",
48
- "require": "./dist/cjs/util.js"
49
- },
50
- "./react-util": {
51
- "import": "./dist/react-util.js",
52
- "require": "./dist/cjs/react-util.js"
53
- },
54
- "./rscCss": {
55
- "require": "./dist/cjs/rsc/rscCss.js",
56
- "import": "./dist/rsc/rscCss.js"
57
- },
58
- "./serverRouter": {
59
- "import": "./dist/rsc/ServerRouter.js",
60
- "require": "./dist/cjs/rsc/ServerRouter.js"
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
61
15
  },
16
+ "./Route": "./dist/Route.js",
17
+ "./Set": "./dist/Set.js",
18
+ "./Link": "./dist/link.js",
19
+ "./NavLink": "./dist/navLink.js",
20
+ "./location": "./dist/location.js",
21
+ "./namedRoutes": "./dist/namedRoutes.js",
22
+ "./util": "./dist/util.js",
23
+ "./react-util": "./dist/react-util.js",
24
+ "./rscCss": "./dist/rsc/rscCss.js",
25
+ "./serverRouter": "./dist/rsc/ServerRouter.js",
62
26
  "./RscRouter": {
63
27
  "react-server": "./dist/rsc/ServerRouter.js",
64
- "require": "./dist/cjs/rsc/ClientRouter.js",
65
- "import": "./dist/rsc/ClientRouter.js"
28
+ "default": "./dist/rsc/ClientRouter.js"
66
29
  },
67
30
  "./SsrRouter": {
68
31
  "react-server": "./dist/rsc/ServerRouter.js",
69
- "require": "./dist/cjs/rsc/SsrRouter.js",
70
- "import": "./dist/rsc/SsrRouter.js"
32
+ "default": "./dist/rsc/SsrRouter.js"
71
33
  },
72
- "./dist/*": {
73
- "require": "./dist/cjs/*.js",
74
- "import": "./dist/*.js"
75
- }
34
+ "./dist/*": "./dist/*.js"
76
35
  },
77
36
  "main": "dist/index.js",
78
37
  "types": "dist/index.d.ts",
@@ -84,9 +43,8 @@
84
43
  "build": "node ./build.ts",
85
44
  "build:pack": "yarn pack -o cedarjs-router.tgz",
86
45
  "build:types": "tsc --build --verbose tsconfig.build.json",
87
- "build:types-cjs": "tsc --build --verbose tsconfig.cjs.json",
88
46
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build\"",
89
- "check:attw": "node ./attw.ts",
47
+ "check:attw": "yarn cedar-fwtools-attw",
90
48
  "check:package": "concurrently npm:check:attw yarn publint",
91
49
  "prepublishOnly": "NODE_ENV=production yarn build",
92
50
  "test": "vitest run",
@@ -94,8 +52,8 @@
94
52
  "test:watch": "vitest watch"
95
53
  },
96
54
  "dependencies": {
97
- "@cedarjs/project-config": "6.0.0-canary.2779",
98
- "@cedarjs/server-store": "6.0.0-canary.2779",
55
+ "@cedarjs/project-config": "6.0.0-canary.2781",
56
+ "@cedarjs/server-store": "6.0.0-canary.2781",
99
57
  "react": "19.2.3",
100
58
  "react-dom": "19.2.3",
101
59
  "react-server-dom-webpack": "19.2.7",
@@ -103,8 +61,8 @@
103
61
  },
104
62
  "devDependencies": {
105
63
  "@arethetypeswrong/cli": "0.18.5",
106
- "@cedarjs/auth": "6.0.0-canary.2779",
107
- "@cedarjs/framework-tools": "6.0.0-canary.2779",
64
+ "@cedarjs/auth": "6.0.0-canary.2781",
65
+ "@cedarjs/framework-tools": "6.0.0-canary.2781",
108
66
  "@testing-library/jest-dom": "6.9.1",
109
67
  "@types/react": "^18.2.55",
110
68
  "@types/react-dom": "^18.2.19",
@@ -116,7 +74,7 @@
116
74
  "vitest": "4.1.10"
117
75
  },
118
76
  "peerDependencies": {
119
- "@cedarjs/auth": "6.0.0-canary.2779",
77
+ "@cedarjs/auth": "6.0.0-canary.2781",
120
78
  "react": "19.2.3",
121
79
  "react-dom": "19.2.3"
122
80
  },
@@ -1,15 +0,0 @@
1
- import type { LocationContextType } from './location.js';
2
- export type LoadingState = 'PRE_SHOW' | 'SHOW_LOADING' | 'DONE';
3
- export type LoadingStateRecord = Record<string, {
4
- specName: string;
5
- state: LoadingState;
6
- page: React.ComponentType<unknown>;
7
- location: LocationContextType;
8
- } | undefined>;
9
- interface ActivePageState {
10
- loadingState: LoadingStateRecord;
11
- }
12
- export declare const ActivePageContextProvider: import("react").Provider<ActivePageState | undefined>;
13
- export declare const useActivePageContext: () => ActivePageState;
14
- export {};
15
- //# sourceMappingURL=ActivePageContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ActivePageContext.d.ts","sourceRoot":"","sources":["../../src/ActivePageContext.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAExD,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,cAAc,GAAG,MAAM,CAAA;AAC/D,MAAM,MAAM,kBAAkB,GAAG,MAAM,CACrC,MAAM,EACJ;IACE,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,YAAY,CAAA;IACnB,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAClC,QAAQ,EAAE,mBAAmB,CAAA;CAC9B,GACD,SAAS,CACZ,CAAA;AAED,UAAU,eAAe;IACvB,YAAY,EAAE,kBAAkB,CAAA;CACjC;AAID,eAAO,MAAM,yBAAyB,uDAA6B,CAAA;AAEnE,eAAO,MAAM,oBAAoB,uBAUhC,CAAA"}
@@ -1,42 +0,0 @@
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 ActivePageContext_exports = {};
20
- __export(ActivePageContext_exports, {
21
- ActivePageContextProvider: () => ActivePageContextProvider,
22
- useActivePageContext: () => useActivePageContext
23
- });
24
- module.exports = __toCommonJS(ActivePageContext_exports);
25
- var import_react = require("react");
26
- var import_createNamedContext = require("./createNamedContext.js");
27
- const ActivePageContext = (0, import_createNamedContext.createNamedContext)("ActivePage");
28
- const ActivePageContextProvider = ActivePageContext.Provider;
29
- const useActivePageContext = () => {
30
- const activePageContext = (0, import_react.useContext)(ActivePageContext);
31
- if (!activePageContext) {
32
- throw new Error(
33
- "useActivePageContext must be used within a ActivePageContext provider"
34
- );
35
- }
36
- return activePageContext;
37
- };
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- ActivePageContextProvider,
41
- useActivePageContext
42
- });
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import type { GeneratedRoutesMap } from './analyzeRoutes.js';
3
- interface AuthenticatedRouteProps {
4
- children: React.ReactNode | Thenable<React.ReactNode>;
5
- roles?: string | string[];
6
- unauthenticated: keyof GeneratedRoutesMap;
7
- whileLoadingAuth?: () => React.ReactElement | null;
8
- }
9
- export declare const AuthenticatedRoute: React.FC<AuthenticatedRouteProps>;
10
- export {};
11
- //# sourceMappingURL=AuthenticatedRoute.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AuthenticatedRoute.d.ts","sourceRoot":"","sources":["../../src/AuthenticatedRoute.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAK5D,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACrD,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACzB,eAAe,EAAE,MAAM,kBAAkB,CAAA;IACzC,gBAAgB,CAAC,EAAE,MAAM,KAAK,CAAC,YAAY,GAAG,IAAI,CAAA;CACnD;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA6DhE,CAAA"}
@@ -1,83 +0,0 @@
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 AuthenticatedRoute_exports = {};
30
- __export(AuthenticatedRoute_exports, {
31
- AuthenticatedRoute: () => AuthenticatedRoute
32
- });
33
- module.exports = __toCommonJS(AuthenticatedRoute_exports);
34
- var import_react = __toESM(require("react"), 1);
35
- var import_namedRoutes = require("./namedRoutes.js");
36
- var import_redirect = require("./redirect.js");
37
- var import_router_context = require("./router-context.js");
38
- const AuthenticatedRoute = ({
39
- unauthenticated,
40
- roles,
41
- whileLoadingAuth,
42
- children
43
- }) => {
44
- const routerState = (0, import_router_context.useRouterState)();
45
- const {
46
- loading: authLoading,
47
- isAuthenticated,
48
- hasRole
49
- } = routerState.useAuth();
50
- const unauthorized = (0, import_react.useCallback)(() => {
51
- return !(isAuthenticated && (!roles || hasRole(roles)));
52
- }, [isAuthenticated, roles, hasRole]);
53
- if (unauthorized()) {
54
- if (authLoading) {
55
- return whileLoadingAuth?.() || null;
56
- } else {
57
- const currentLocation = globalThis.location.pathname + encodeURIComponent(globalThis.location.search);
58
- const generatedRoutesMap = import_namedRoutes.namedRoutes;
59
- if (!generatedRoutesMap[unauthenticated]) {
60
- throw new Error(`We could not find a route named ${unauthenticated}`);
61
- }
62
- let unauthenticatedPath;
63
- try {
64
- unauthenticatedPath = generatedRoutesMap[unauthenticated]();
65
- } catch (e) {
66
- if (e instanceof Error && /Missing parameter .* for route/.test(e.message)) {
67
- throw new Error(
68
- `Redirecting to route "${unauthenticated}" would require route parameters, which currently is not supported. Please choose a different route`
69
- );
70
- }
71
- throw new Error(
72
- `Could not redirect to the route named ${unauthenticated}`
73
- );
74
- }
75
- return /* @__PURE__ */ import_react.default.createElement(import_redirect.Redirect, { to: `${unauthenticatedPath}?redirectTo=${currentLocation}` });
76
- }
77
- }
78
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, children);
79
- };
80
- // Annotate the CommonJS export names for ESM import in node:
81
- 0 && (module.exports = {
82
- AuthenticatedRoute
83
- });
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- export interface PageLoadingContextInterface {
3
- loading: boolean;
4
- setPageLoadingContext: (loading: boolean) => void;
5
- delay?: number;
6
- }
7
- interface Props {
8
- children: React.ReactNode;
9
- delay?: number;
10
- }
11
- export declare const PageLoadingContextProvider: React.FC<Props>;
12
- export declare const usePageLoadingContext: () => PageLoadingContextInterface;
13
- export {};
14
- //# sourceMappingURL=PageLoadingContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PageLoadingContext.d.ts","sourceRoot":"","sources":["../../src/PageLoadingContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAInD,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,OAAO,CAAA;IAChB,qBAAqB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACjD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAKD,UAAU,KAAK;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAatD,CAAA;AAED,eAAO,MAAM,qBAAqB,mCAUjC,CAAA"}
@@ -1,64 +0,0 @@
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 PageLoadingContext_exports = {};
30
- __export(PageLoadingContext_exports, {
31
- PageLoadingContextProvider: () => PageLoadingContextProvider,
32
- usePageLoadingContext: () => usePageLoadingContext
33
- });
34
- module.exports = __toCommonJS(PageLoadingContext_exports);
35
- var import_react = __toESM(require("react"), 1);
36
- var import_createNamedContext = require("./createNamedContext.js");
37
- const PageLoadingContext = (0, import_createNamedContext.createNamedContext)("PageLoading");
38
- const PageLoadingContextProvider = ({
39
- children,
40
- delay = 1e3
41
- }) => {
42
- const [loading, setPageLoadingContext] = (0, import_react.useState)(false);
43
- return /* @__PURE__ */ import_react.default.createElement(
44
- PageLoadingContext.Provider,
45
- {
46
- value: { loading, setPageLoadingContext, delay }
47
- },
48
- children
49
- );
50
- };
51
- const usePageLoadingContext = () => {
52
- const pageLoadingContext = (0, import_react.useContext)(PageLoadingContext);
53
- if (!pageLoadingContext) {
54
- throw new Error(
55
- "usePageLoadingContext must be used within a PageLoadingContext provider"
56
- );
57
- }
58
- return pageLoadingContext;
59
- };
60
- // Annotate the CommonJS export names for ESM import in node:
61
- 0 && (module.exports = {
62
- PageLoadingContextProvider,
63
- usePageLoadingContext
64
- });
@@ -1,32 +0,0 @@
1
- import type { ReactElement } from 'react';
2
- import type { PageType } from './page.js';
3
- export type RenderMode = 'stream' | 'html';
4
- export interface RedirectRouteProps {
5
- redirect: string;
6
- path: string;
7
- name?: string;
8
- }
9
- export interface NotFoundRouteProps {
10
- notfound: boolean;
11
- page: PageType;
12
- prerender?: boolean;
13
- renderMode?: RenderMode;
14
- }
15
- export interface RouteProps {
16
- path: string;
17
- page: PageType;
18
- name: string;
19
- prerender?: boolean;
20
- renderMode?: RenderMode;
21
- whileLoadingPage?: () => ReactElement | null;
22
- }
23
- export type InternalRouteProps = Partial<RouteProps & RedirectRouteProps & NotFoundRouteProps>;
24
- /**
25
- * Route is now a "virtual" component
26
- * it is actually never rendered. All the page loading logic happens in active-route-loader
27
- * and all the validation happens within utility functions called from the Router
28
- */
29
- export declare function Route(props: RouteProps): JSX.Element;
30
- export declare function Route(props: RedirectRouteProps): JSX.Element;
31
- export declare function Route(props: NotFoundRouteProps): JSX.Element;
32
- //# sourceMappingURL=Route.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../../src/Route.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEzC,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE1C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,UAAU,CAAA;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,gBAAgB,CAAC,EAAE,MAAM,YAAY,GAAG,IAAI,CAAA;CAC7C;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,UAAU,GAAG,kBAAkB,GAAG,kBAAkB,CACrD,CAAA;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAAA;AACrD,wBAAgB,KAAK,CAAC,KAAK,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAAA;AAC7D,wBAAgB,KAAK,CAAC,KAAK,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAAA"}
package/dist/cjs/Route.js DELETED
@@ -1,41 +0,0 @@
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_exports = {};
30
- __export(Route_exports, {
31
- Route: () => Route
32
- });
33
- module.exports = __toCommonJS(Route_exports);
34
- var import_react = __toESM(require("react"), 1);
35
- function Route(_props) {
36
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null);
37
- }
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- Route
41
- });
package/dist/cjs/Set.d.ts DELETED
@@ -1,58 +0,0 @@
1
- import type { ReactElement, ReactNode } from 'react';
2
- import React from 'react';
3
- export type WrapperType<WTProps> = (props: Omit<WTProps, 'wrap' | 'children'> & {
4
- children: ReactNode;
5
- }) => ReactElement | null;
6
- type SetProps<P> = P & {
7
- /**
8
- * P is the interface for the props that are forwarded to the wrapper
9
- * components. TypeScript will most likely infer this for you, but if you
10
- * need to you can specify it yourself in your JSX like so:
11
- * <Set<{theme: string}> wrap={ThemableLayout} theme="dark">
12
- */
13
- wrap?: WrapperType<P> | WrapperType<P>[];
14
- /**
15
- *`Routes` nested in a `<Set>` with `private` specified require
16
- * authentication. When a user is not authenticated and attempts to visit
17
- * the wrapped route they will be redirected to `unauthenticated` route.
18
- *
19
- * @deprecated Please use `<PrivateSet>` instead
20
- */
21
- private?: boolean;
22
- /**
23
- * The page name where a user will be redirected when not authenticated
24
- *
25
- * @deprecated Please use `<PrivateSet>` instead and specify this prop there
26
- */
27
- unauthenticated?: string;
28
- /**
29
- * Route is permitted when authenticated and user has any of the provided
30
- * roles such as "admin" or ["admin", "editor"]
31
- */
32
- roles?: string | string[];
33
- /** Prerender all pages in the set */
34
- prerender?: boolean;
35
- children: ReactNode;
36
- /** Loading state for auth to distinguish with whileLoading */
37
- whileLoadingAuth?: () => ReactElement | null;
38
- whileLoadingPage?: () => ReactElement | null;
39
- };
40
- /**
41
- * TypeScript will often infer the type of the props you can forward to the
42
- * wrappers for you, but if you need to you can specify it yourself in your
43
- * JSX like so:
44
- * <Set<{theme: string}> wrap={ThemeableLayout} theme="dark">
45
- */
46
- export declare function Set<WrapperProps>(props: SetProps<WrapperProps>): React.JSX.Element;
47
- type PrivateSetProps<P> = P & Omit<SetProps<P>, 'private' | 'unauthenticated'> & {
48
- /** The page name where a user will be redirected when not authenticated */
49
- unauthenticated: string;
50
- };
51
- /** @deprecated Please use `<PrivateSet>` instead */
52
- export declare function Private<WrapperProps>(props: PrivateSetProps<WrapperProps>): React.JSX.Element;
53
- export declare function PrivateSet<WrapperProps>(props: PrivateSetProps<WrapperProps>): React.JSX.Element;
54
- export declare const isSetNode: (node: ReactNode) => node is ReactElement<SetProps<any>>;
55
- export declare const isPrivateSetNode: (node: ReactNode) => node is ReactElement<PrivateSetProps<unknown>>;
56
- export declare const isPrivateNode: (node: ReactNode) => node is ReactElement<SetProps<any>>;
57
- export {};
58
- //# sourceMappingURL=Set.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Set.d.ts","sourceRoot":"","sources":["../../src/Set.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,MAAM,WAAW,CAAC,OAAO,IAAI,CACjC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC,GAAG;IAC1C,QAAQ,EAAE,SAAS,CAAA;CACpB,KACE,YAAY,GAAG,IAAI,CAAA;AAExB,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,CAAA;IACxC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACzB,qCAAqC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,SAAS,CAAA;IACnB,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,MAAM,YAAY,GAAG,IAAI,CAAA;IAC5C,gBAAgB,CAAC,EAAE,MAAM,YAAY,GAAG,IAAI,CAAA;CAC7C,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,YAAY,EAAE,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,qBAI9D;AAED,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,GACzB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,iBAAiB,CAAC,GAAG;IACjD,2EAA2E;IAC3E,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAEH,oDAAoD;AACpD,wBAAgB,OAAO,CAAC,YAAY,EAAE,KAAK,EAAE,eAAe,CAAC,YAAY,CAAC,qBAIzE;AAED,wBAAgB,UAAU,CAAC,YAAY,EAAE,KAAK,EAAE,eAAe,CAAC,YAAY,CAAC,qBAI5E;AAED,eAAO,MAAM,SAAS,GACpB,MAAM,SAAS,KACd,IAAI,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAOpC,CAAA;AAED,eAAO,MAAM,gBAAgB,GAC3B,MAAM,SAAS,KACd,IAAI,IAAI,YAAY,CAAC,eAAe,CAAC,OAAO,CAAC,CAE/C,CAAA;AAGD,eAAO,MAAM,aAAa,GACxB,MAAM,SAAS,KACd,IAAI,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAEpC,CAAA"}
package/dist/cjs/Set.js DELETED
@@ -1,67 +0,0 @@
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 Set_exports = {};
30
- __export(Set_exports, {
31
- Private: () => Private,
32
- PrivateSet: () => PrivateSet,
33
- Set: () => Set,
34
- isPrivateNode: () => isPrivateNode,
35
- isPrivateSetNode: () => isPrivateSetNode,
36
- isSetNode: () => isSetNode
37
- });
38
- module.exports = __toCommonJS(Set_exports);
39
- var import_react = __toESM(require("react"), 1);
40
- function Set(props) {
41
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, props.children);
42
- }
43
- function Private(props) {
44
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, props.children);
45
- }
46
- function PrivateSet(props) {
47
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, props.children);
48
- }
49
- const isSetNode = (node) => {
50
- return import_react.default.isValidElement(node) && (node.type === Set || node.type === PrivateSet || node.type === Private) && // Don't even bother including Sets without children. They're useless.
51
- node.props.children;
52
- };
53
- const isPrivateSetNode = (node) => {
54
- return import_react.default.isValidElement(node) && node.type === PrivateSet;
55
- };
56
- const isPrivateNode = (node) => {
57
- return import_react.default.isValidElement(node) && node.type === Private;
58
- };
59
- // Annotate the CommonJS export names for ESM import in node:
60
- 0 && (module.exports = {
61
- Private,
62
- PrivateSet,
63
- Set,
64
- isPrivateNode,
65
- isPrivateSetNode,
66
- isSetNode
67
- });
@@ -1,14 +0,0 @@
1
- /**
2
- * gets the announcement for the new page.
3
- * called in one of active-route-loader's `useEffect`.
4
- *
5
- * the order of priority is:
6
- * 1. RouteAnnouncement (the most specific one)
7
- * 2. h1
8
- * 3. document.title
9
- * 4. location.pathname
10
- */
11
- export declare const getAnnouncement: () => string;
12
- export declare const getFocus: () => HTMLElement | null;
13
- export declare const resetFocus: () => void;
14
- //# sourceMappingURL=a11yUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"a11yUtils.d.ts","sourceRoot":"","sources":["../../src/a11yUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,cAkB3B,CAAA;AAED,eAAO,MAAM,QAAQ,0BAapB,CAAA;AAGD,eAAO,MAAM,UAAU,YAItB,CAAA"}