@cedarjs/web 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.
- package/LICENSE +21 -0
- package/README.md +33 -0
- package/apollo/index.js +2 -0
- package/apollo/package.json +4 -0
- package/dist/apollo/fragmentRegistry.d.ts +43 -0
- package/dist/apollo/fragmentRegistry.d.ts.map +1 -0
- package/dist/apollo/fragmentRegistry.js +39 -0
- package/dist/apollo/index.d.ts +77 -0
- package/dist/apollo/index.d.ts.map +1 -0
- package/dist/apollo/index.js +198 -0
- package/dist/apollo/links.d.ts +27 -0
- package/dist/apollo/links.d.ts.map +1 -0
- package/dist/apollo/links.js +94 -0
- package/dist/apollo/sseLink.d.ts +29 -0
- package/dist/apollo/sseLink.d.ts.map +1 -0
- package/dist/apollo/sseLink.js +94 -0
- package/dist/apollo/suspense.d.ts +59 -0
- package/dist/apollo/suspense.d.ts.map +1 -0
- package/dist/apollo/suspense.js +113 -0
- package/dist/apollo/typeOverride.d.ts +21 -0
- package/dist/apollo/typeOverride.d.ts.map +1 -0
- package/dist/apollo/typeOverride.js +0 -0
- package/dist/apollo/useCache.d.ts +22 -0
- package/dist/apollo/useCache.d.ts.map +1 -0
- package/dist/apollo/useCache.js +25 -0
- package/dist/bins/cross-env.d.ts +3 -0
- package/dist/bins/cross-env.d.ts.map +1 -0
- package/dist/bins/msw.d.ts +3 -0
- package/dist/bins/msw.d.ts.map +1 -0
- package/dist/bins/redwood.d.ts +9 -0
- package/dist/bins/redwood.d.ts.map +1 -0
- package/dist/bins/rwfw.d.ts +3 -0
- package/dist/bins/rwfw.d.ts.map +1 -0
- package/dist/bins/storybook.d.ts +3 -0
- package/dist/bins/storybook.d.ts.map +1 -0
- package/dist/bins/tsc.d.ts +3 -0
- package/dist/bins/tsc.d.ts.map +1 -0
- package/dist/bundled/apollo-upload-client.d.ts +3 -0
- package/dist/bundled/apollo-upload-client.d.ts.map +1 -0
- package/dist/bundled/apollo-upload-client.js +4 -0
- package/dist/cjs/apollo/fragmentRegistry.d.ts +43 -0
- package/dist/cjs/apollo/fragmentRegistry.d.ts.map +1 -0
- package/dist/cjs/apollo/fragmentRegistry.js +75 -0
- package/dist/cjs/apollo/index.d.ts +77 -0
- package/dist/cjs/apollo/index.d.ts.map +1 -0
- package/dist/cjs/apollo/index.js +216 -0
- package/dist/cjs/apollo/links.d.ts +27 -0
- package/dist/cjs/apollo/links.d.ts.map +1 -0
- package/dist/cjs/apollo/links.js +122 -0
- package/dist/cjs/apollo/sseLink.d.ts +29 -0
- package/dist/cjs/apollo/sseLink.d.ts.map +1 -0
- package/dist/cjs/apollo/sseLink.js +120 -0
- package/dist/cjs/apollo/suspense.d.ts +59 -0
- package/dist/cjs/apollo/suspense.d.ts.map +1 -0
- package/dist/cjs/apollo/suspense.js +127 -0
- package/dist/cjs/apollo/typeOverride.d.ts +21 -0
- package/dist/cjs/apollo/typeOverride.d.ts.map +1 -0
- package/dist/cjs/apollo/typeOverride.js +16 -0
- package/dist/cjs/apollo/useCache.d.ts +22 -0
- package/dist/cjs/apollo/useCache.d.ts.map +1 -0
- package/dist/cjs/apollo/useCache.js +49 -0
- package/dist/cjs/bins/cross-env.d.ts +3 -0
- package/dist/cjs/bins/cross-env.d.ts.map +1 -0
- package/dist/cjs/bins/cross-env.js +30 -0
- package/dist/cjs/bins/msw.d.ts +3 -0
- package/dist/cjs/bins/msw.d.ts.map +1 -0
- package/dist/cjs/bins/msw.js +28 -0
- package/dist/cjs/bins/redwood.d.ts +9 -0
- package/dist/cjs/bins/redwood.d.ts.map +1 -0
- package/dist/cjs/bins/redwood.js +36 -0
- package/dist/cjs/bins/rwfw.d.ts +3 -0
- package/dist/cjs/bins/rwfw.d.ts.map +1 -0
- package/dist/cjs/bins/rwfw.js +36 -0
- package/dist/cjs/bins/storybook.d.ts +3 -0
- package/dist/cjs/bins/storybook.d.ts.map +1 -0
- package/dist/cjs/bins/storybook.js +49 -0
- package/dist/cjs/bins/tsc.d.ts +3 -0
- package/dist/cjs/bins/tsc.d.ts.map +1 -0
- package/dist/cjs/bins/tsc.js +30 -0
- package/dist/cjs/bundled/apollo-upload-client.d.ts +3 -0
- package/dist/cjs/bundled/apollo-upload-client.d.ts.map +1 -0
- package/dist/cjs/bundled/apollo-upload-client.js +2474 -0
- package/dist/cjs/components/DevFatalErrorPage.d.ts +21 -0
- package/dist/cjs/components/DevFatalErrorPage.d.ts.map +1 -0
- package/dist/cjs/components/DevFatalErrorPage.js +436 -0
- package/dist/cjs/components/FatalErrorBoundary.d.ts +24 -0
- package/dist/cjs/components/FatalErrorBoundary.d.ts.map +1 -0
- package/dist/cjs/components/FatalErrorBoundary.js +63 -0
- package/dist/cjs/components/FetchConfigProvider.d.ts +25 -0
- package/dist/cjs/components/FetchConfigProvider.d.ts.map +1 -0
- package/dist/cjs/components/FetchConfigProvider.js +80 -0
- package/dist/cjs/components/GraphQLHooksProvider.d.ts +45 -0
- package/dist/cjs/components/GraphQLHooksProvider.d.ts.map +1 -0
- package/dist/cjs/components/GraphQLHooksProvider.js +135 -0
- package/dist/cjs/components/MetaTags.d.ts +52 -0
- package/dist/cjs/components/MetaTags.d.ts.map +1 -0
- package/dist/cjs/components/MetaTags.js +69 -0
- package/dist/cjs/components/Metadata.d.ts +9 -0
- package/dist/cjs/components/Metadata.d.ts.map +1 -0
- package/dist/cjs/components/Metadata.js +95 -0
- package/dist/cjs/components/PortalHead.d.ts +4 -0
- package/dist/cjs/components/PortalHead.d.ts.map +1 -0
- package/dist/cjs/components/PortalHead.js +59 -0
- package/dist/cjs/components/RedwoodProvider.d.ts +9 -0
- package/dist/cjs/components/RedwoodProvider.d.ts.map +1 -0
- package/dist/cjs/components/RedwoodProvider.js +58 -0
- package/dist/cjs/components/ServerInject.d.ts +26 -0
- package/dist/cjs/components/ServerInject.d.ts.map +1 -0
- package/dist/cjs/components/ServerInject.js +75 -0
- package/dist/cjs/components/cell/CellCacheContext.d.ts +20 -0
- package/dist/cjs/components/cell/CellCacheContext.d.ts.map +1 -0
- package/dist/cjs/components/cell/CellCacheContext.js +53 -0
- package/dist/cjs/components/cell/CellErrorBoundary.d.ts +25 -0
- package/dist/cjs/components/cell/CellErrorBoundary.d.ts.map +1 -0
- package/dist/cjs/components/cell/CellErrorBoundary.js +66 -0
- package/dist/cjs/components/cell/cellTypes.d.ts +152 -0
- package/dist/cjs/components/cell/cellTypes.d.ts.map +1 -0
- package/dist/cjs/components/cell/cellTypes.js +16 -0
- package/dist/cjs/components/cell/createCell.d.ts +10 -0
- package/dist/cjs/components/cell/createCell.d.ts.map +1 -0
- package/dist/cjs/components/cell/createCell.js +165 -0
- package/dist/cjs/components/cell/createCell.test.js +351 -0
- package/dist/cjs/components/cell/createServerCell.d.ts +15 -0
- package/dist/cjs/components/cell/createServerCell.d.ts.map +1 -0
- package/dist/cjs/components/cell/createServerCell.js +91 -0
- package/dist/cjs/components/cell/createSuspendingCell.d.ts +11 -0
- package/dist/cjs/components/cell/createSuspendingCell.d.ts.map +1 -0
- package/dist/cjs/components/cell/createSuspendingCell.js +152 -0
- package/dist/cjs/components/cell/createSuspendingCell.test.js +115 -0
- package/dist/cjs/components/cell/isCellEmpty.d.ts +41 -0
- package/dist/cjs/components/cell/isCellEmpty.d.ts.map +1 -0
- package/dist/cjs/components/cell/isCellEmpty.js +35 -0
- package/dist/cjs/components/htmlTags.d.ts +52 -0
- package/dist/cjs/components/htmlTags.d.ts.map +1 -0
- package/dist/cjs/components/htmlTags.js +88 -0
- package/dist/cjs/config.d.ts +2 -0
- package/dist/cjs/config.d.ts.map +1 -0
- package/dist/cjs/config.js +6 -0
- package/dist/cjs/entry/index.js +39 -0
- package/dist/cjs/global.web-auto-imports.d.ts +30 -0
- package/dist/cjs/global.web-auto-imports.d.ts.map +1 -0
- package/dist/cjs/global.web-auto-imports.js +16 -0
- package/dist/cjs/graphql.d.ts +24 -0
- package/dist/cjs/graphql.d.ts.map +1 -0
- package/dist/cjs/graphql.js +36 -0
- package/dist/cjs/index.d.ts +20 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +80 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/routeHooks.types.d.ts +12 -0
- package/dist/cjs/routeHooks.types.d.ts.map +1 -0
- package/dist/cjs/routeHooks.types.js +16 -0
- package/dist/cjs/server/MiddlewareRequest.d.ts +28 -0
- package/dist/cjs/server/MiddlewareRequest.d.ts.map +1 -0
- package/dist/cjs/server/MiddlewareRequest.js +71 -0
- package/dist/cjs/server/MiddlewareResponse.d.ts +44 -0
- package/dist/cjs/server/MiddlewareResponse.d.ts.map +1 -0
- package/dist/cjs/server/MiddlewareResponse.js +130 -0
- package/dist/cjs/server/middleware.d.ts +17 -0
- package/dist/cjs/server/middleware.d.ts.map +1 -0
- package/dist/cjs/server/middleware.js +24 -0
- package/dist/cjs/server/request.d.ts +2 -0
- package/dist/cjs/server/request.d.ts.map +1 -0
- package/dist/cjs/server/request.js +34 -0
- package/dist/cjs/streamUtils/useDocumentReady.d.ts +11 -0
- package/dist/cjs/streamUtils/useDocumentReady.d.ts.map +1 -0
- package/dist/cjs/streamUtils/useDocumentReady.js +41 -0
- package/dist/cjs/toast/index.d.ts +3 -0
- package/dist/cjs/toast/index.d.ts.map +1 -0
- package/dist/cjs/toast/index.js +41 -0
- package/dist/components/DevFatalErrorPage.d.ts +21 -0
- package/dist/components/DevFatalErrorPage.d.ts.map +1 -0
- package/dist/components/DevFatalErrorPage.js +402 -0
- package/dist/components/FatalErrorBoundary.d.ts +24 -0
- package/dist/components/FatalErrorBoundary.d.ts.map +1 -0
- package/dist/components/FatalErrorBoundary.js +29 -0
- package/dist/components/FetchConfigProvider.d.ts +25 -0
- package/dist/components/FetchConfigProvider.d.ts.map +1 -0
- package/dist/components/FetchConfigProvider.js +43 -0
- package/dist/components/GraphQLHooksProvider.d.ts +45 -0
- package/dist/components/GraphQLHooksProvider.d.ts.map +1 -0
- package/dist/components/GraphQLHooksProvider.js +94 -0
- package/dist/components/MetaTags.d.ts +52 -0
- package/dist/components/MetaTags.d.ts.map +1 -0
- package/dist/components/MetaTags.js +35 -0
- package/dist/components/Metadata.d.ts +9 -0
- package/dist/components/Metadata.d.ts.map +1 -0
- package/dist/components/Metadata.js +61 -0
- package/dist/components/PortalHead.d.ts +4 -0
- package/dist/components/PortalHead.d.ts.map +1 -0
- package/dist/components/PortalHead.js +29 -0
- package/dist/components/RedwoodProvider.d.ts +9 -0
- package/dist/components/RedwoodProvider.d.ts.map +1 -0
- package/dist/components/RedwoodProvider.js +24 -0
- package/dist/components/ServerInject.d.ts +26 -0
- package/dist/components/ServerInject.d.ts.map +1 -0
- package/dist/components/ServerInject.js +37 -0
- package/dist/components/cell/CellCacheContext.d.ts +20 -0
- package/dist/components/cell/CellCacheContext.d.ts.map +1 -0
- package/dist/components/cell/CellCacheContext.js +18 -0
- package/dist/components/cell/CellErrorBoundary.d.ts +25 -0
- package/dist/components/cell/CellErrorBoundary.d.ts.map +1 -0
- package/dist/components/cell/CellErrorBoundary.js +32 -0
- package/dist/components/cell/cellTypes.d.ts +152 -0
- package/dist/components/cell/cellTypes.d.ts.map +1 -0
- package/dist/components/cell/cellTypes.js +0 -0
- package/dist/components/cell/createCell.d.ts +10 -0
- package/dist/components/cell/createCell.d.ts.map +1 -0
- package/dist/components/cell/createCell.js +131 -0
- package/dist/components/cell/createCell.test.js +328 -0
- package/dist/components/cell/createServerCell.d.ts +15 -0
- package/dist/components/cell/createServerCell.d.ts.map +1 -0
- package/dist/components/cell/createServerCell.js +57 -0
- package/dist/components/cell/createSuspendingCell.d.ts +11 -0
- package/dist/components/cell/createSuspendingCell.d.ts.map +1 -0
- package/dist/components/cell/createSuspendingCell.js +118 -0
- package/dist/components/cell/createSuspendingCell.test.js +92 -0
- package/dist/components/cell/isCellEmpty.d.ts +41 -0
- package/dist/components/cell/isCellEmpty.d.ts.map +1 -0
- package/dist/components/cell/isCellEmpty.js +11 -0
- package/dist/components/htmlTags.d.ts +52 -0
- package/dist/components/htmlTags.d.ts.map +1 -0
- package/dist/components/htmlTags.js +53 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +5 -0
- package/dist/entry/index.d.ts +1 -0
- package/dist/entry/index.js +16 -0
- package/dist/global.web-auto-imports.d.ts +30 -0
- package/dist/global.web-auto-imports.d.ts.map +1 -0
- package/dist/global.web-auto-imports.js +0 -0
- package/dist/graphql.d.ts +24 -0
- package/dist/graphql.d.ts.map +1 -0
- package/dist/graphql.js +12 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/package.json +1 -0
- package/dist/routeHooks.types.d.ts +12 -0
- package/dist/routeHooks.types.d.ts.map +1 -0
- package/dist/routeHooks.types.js +0 -0
- package/dist/server/MiddlewareRequest.d.ts +28 -0
- package/dist/server/MiddlewareRequest.d.ts.map +1 -0
- package/dist/server/MiddlewareRequest.js +46 -0
- package/dist/server/MiddlewareResponse.d.ts +44 -0
- package/dist/server/MiddlewareResponse.d.ts.map +1 -0
- package/dist/server/MiddlewareResponse.js +95 -0
- package/dist/server/middleware.d.ts +17 -0
- package/dist/server/middleware.d.ts.map +1 -0
- package/dist/server/middleware.js +2 -0
- package/dist/server/request.d.ts +2 -0
- package/dist/server/request.d.ts.map +1 -0
- package/dist/server/request.js +12 -0
- package/dist/streamUtils/useDocumentReady.d.ts +11 -0
- package/dist/streamUtils/useDocumentReady.d.ts.map +1 -0
- package/dist/streamUtils/useDocumentReady.js +17 -0
- package/dist/toast/index.d.ts +3 -0
- package/dist/toast/index.d.ts.map +1 -0
- package/dist/toast/index.js +5 -0
- package/package.json +193 -0
- package/src/entry/index.jsx +29 -0
- package/toast/index.js +2 -0
- package/toast/package.json +4 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const GraphQLHooksContext = React.createContext({
|
|
3
|
+
useQuery: () => {
|
|
4
|
+
throw new Error(
|
|
5
|
+
"You must register a useQuery hook via the `GraphQLHooksProvider`"
|
|
6
|
+
);
|
|
7
|
+
},
|
|
8
|
+
useMutation: () => {
|
|
9
|
+
throw new Error(
|
|
10
|
+
"You must register a useMutation hook via the `GraphQLHooksProvider`"
|
|
11
|
+
);
|
|
12
|
+
},
|
|
13
|
+
useSubscription: () => {
|
|
14
|
+
throw new Error(
|
|
15
|
+
"You must register a useSubscription hook via the `GraphQLHooksProvider`"
|
|
16
|
+
);
|
|
17
|
+
},
|
|
18
|
+
useSuspenseQuery: () => {
|
|
19
|
+
throw new Error(
|
|
20
|
+
"You must register a useSuspenseQuery hook via the `GraphQLHooksProvider`."
|
|
21
|
+
);
|
|
22
|
+
},
|
|
23
|
+
// These are apollo specific hooks!
|
|
24
|
+
useBackgroundQuery: () => {
|
|
25
|
+
throw new Error(
|
|
26
|
+
"You must register a useBackgroundQuery hook via the `GraphQLHooksProvider`."
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
useReadQuery: () => {
|
|
30
|
+
throw new Error(
|
|
31
|
+
"You must register a useReadQuery hook via the `GraphQLHooksProvider`."
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const GraphQLHooksProvider = ({
|
|
36
|
+
useQuery: useQuery2,
|
|
37
|
+
useMutation: useMutation2,
|
|
38
|
+
useSubscription: useSubscription2,
|
|
39
|
+
useSuspenseQuery: useSuspenseQuery2,
|
|
40
|
+
useBackgroundQuery: useBackgroundQuery2,
|
|
41
|
+
useReadQuery: useReadQuery2,
|
|
42
|
+
children
|
|
43
|
+
}) => {
|
|
44
|
+
return /* @__PURE__ */ React.createElement(
|
|
45
|
+
GraphQLHooksContext.Provider,
|
|
46
|
+
{
|
|
47
|
+
value: {
|
|
48
|
+
useQuery: useQuery2,
|
|
49
|
+
useMutation: useMutation2,
|
|
50
|
+
useSubscription: useSubscription2,
|
|
51
|
+
useSuspenseQuery: useSuspenseQuery2,
|
|
52
|
+
useBackgroundQuery: useBackgroundQuery2,
|
|
53
|
+
useReadQuery: useReadQuery2
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
children
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
function useQuery(query, options) {
|
|
60
|
+
return React.useContext(GraphQLHooksContext).useQuery(
|
|
61
|
+
query,
|
|
62
|
+
options
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
function useMutation(mutation, options) {
|
|
66
|
+
return React.useContext(GraphQLHooksContext).useMutation(
|
|
67
|
+
mutation,
|
|
68
|
+
options
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
function useSubscription(query, options) {
|
|
72
|
+
return React.useContext(GraphQLHooksContext).useSubscription(query, options);
|
|
73
|
+
}
|
|
74
|
+
function useSuspenseQuery(query, options) {
|
|
75
|
+
return React.useContext(GraphQLHooksContext).useSuspenseQuery(query, options);
|
|
76
|
+
}
|
|
77
|
+
const useBackgroundQuery = (...args) => {
|
|
78
|
+
return React.useContext(GraphQLHooksContext).useBackgroundQuery(
|
|
79
|
+
...args
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
const useReadQuery = (...args) => {
|
|
83
|
+
return React.useContext(GraphQLHooksContext).useReadQuery(...args);
|
|
84
|
+
};
|
|
85
|
+
export {
|
|
86
|
+
GraphQLHooksContext,
|
|
87
|
+
GraphQLHooksProvider,
|
|
88
|
+
useBackgroundQuery,
|
|
89
|
+
useMutation,
|
|
90
|
+
useQuery,
|
|
91
|
+
useReadQuery,
|
|
92
|
+
useSubscription,
|
|
93
|
+
useSuspenseQuery
|
|
94
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type RobotsParams = 'noindex' | 'index' | 'follow' | 'nofollow' | 'none' | 'noarchive' | 'nocache' | 'nosnippet';
|
|
3
|
+
interface MetaTagsProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description
|
|
6
|
+
* og:image by default
|
|
7
|
+
*/
|
|
8
|
+
tag?: `og:${string}`;
|
|
9
|
+
/**
|
|
10
|
+
* @description
|
|
11
|
+
* website by default. See https://ogp.me/#types
|
|
12
|
+
*/
|
|
13
|
+
ogType?: string;
|
|
14
|
+
ogWidth?: string;
|
|
15
|
+
ogHeight?: string;
|
|
16
|
+
locale?: string;
|
|
17
|
+
/**
|
|
18
|
+
* @description
|
|
19
|
+
* Link to image/video to display when unfurled
|
|
20
|
+
**/
|
|
21
|
+
ogContentUrl?: string;
|
|
22
|
+
/**
|
|
23
|
+
* @description
|
|
24
|
+
* The url to link back to. This must be a canonical (absolute) URL.
|
|
25
|
+
* Use `ogContentUrl` to set the actual image to be displayed
|
|
26
|
+
**/
|
|
27
|
+
ogUrl?: `${'http://' | 'https://'}${string}`;
|
|
28
|
+
contentType?: string;
|
|
29
|
+
/**
|
|
30
|
+
* @description
|
|
31
|
+
* String or array of strings to provide crawlers instructions for how to crawl or index web page content.
|
|
32
|
+
**/
|
|
33
|
+
robots?: RobotsParams | RobotsParams[];
|
|
34
|
+
title?: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
author?: string;
|
|
37
|
+
/**
|
|
38
|
+
* @description
|
|
39
|
+
* Any additional metatags
|
|
40
|
+
*/
|
|
41
|
+
children?: React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Add commonly used `<meta>` tags for unfurling/seo purposes
|
|
45
|
+
* using the open graph protocol https://ogp.me/
|
|
46
|
+
* @example
|
|
47
|
+
* <MetaTags title="About Page" ogContentUrl="/static/about-og.png"/>
|
|
48
|
+
* @deprecated Please use `<Metadata>` instead
|
|
49
|
+
*/
|
|
50
|
+
export declare const MetaTags: (props: MetaTagsProps) => React.JSX.Element;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=MetaTags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetaTags.d.ts","sourceRoot":"","sources":["../../src/components/MetaTags.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,KAAK,YAAY,GACb,SAAS,GACT,OAAO,GACP,QAAQ,GACR,UAAU,GACV,MAAM,GACN,WAAW,GACX,SAAS,GACT,WAAW,CAAA;AACf,UAAU,aAAa;IACrB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,MAAM,EAAE,CAAA;IAEpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;QAGI;IACJ,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;;QAII;IACJ,KAAK,CAAC,EAAE,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,EAAE,CAAA;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;QAGI;IACJ,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,UAAW,aAAa,sBAoG5C,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import * as helmetPkg from "react-helmet-async";
|
|
3
|
+
const { Helmet: HelmetHead } = helmetPkg;
|
|
4
|
+
import PortalHead from "./PortalHead.js";
|
|
5
|
+
const MetaTags = (props) => {
|
|
6
|
+
const {
|
|
7
|
+
tag = "og:image",
|
|
8
|
+
ogType = "website",
|
|
9
|
+
ogContentUrl,
|
|
10
|
+
robots,
|
|
11
|
+
contentType,
|
|
12
|
+
ogWidth,
|
|
13
|
+
ogHeight,
|
|
14
|
+
ogUrl,
|
|
15
|
+
title,
|
|
16
|
+
locale,
|
|
17
|
+
description,
|
|
18
|
+
author,
|
|
19
|
+
children
|
|
20
|
+
} = props;
|
|
21
|
+
let Head = HelmetHead;
|
|
22
|
+
if (RWJS_ENV.RWJS_EXP_STREAMING_SSR) {
|
|
23
|
+
Head = PortalHead;
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, title && /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement("title", null, title), /* @__PURE__ */ React.createElement("meta", { property: "og:title", content: title, key: "title" }), /* @__PURE__ */ React.createElement("meta", { property: "twitter:title", content: title })), description && /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement("meta", { name: "description", content: description }), /* @__PURE__ */ React.createElement("meta", { name: "twitter:description", content: description }), /* @__PURE__ */ React.createElement("meta", { property: "og:description", content: description })), author && /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement("meta", { name: "author", content: author }), /* @__PURE__ */ React.createElement("meta", { name: "twitter:site", content: author }), /* @__PURE__ */ React.createElement("meta", { name: "twitter:creator", content: author })), ogUrl && /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement("meta", { property: "og:url", content: ogUrl })), locale && /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement("html", { lang: locale }), /* @__PURE__ */ React.createElement("meta", { property: "og:locale", content: locale })), /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement("meta", { property: "og:type", content: ogType })), ogContentUrl && /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement("meta", { property: tag, content: ogContentUrl })), contentType && /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement("meta", { property: `${tag}:type`, content: contentType })), tag === "og:image" && /* @__PURE__ */ React.createElement(Head, null, ogWidth && /* @__PURE__ */ React.createElement("meta", { property: "image:width", content: ogWidth }), ogHeight && /* @__PURE__ */ React.createElement("meta", { property: "image:height", content: ogHeight }), /* @__PURE__ */ React.createElement("meta", { property: "twitter:card", content: "summary_large_image" }), /* @__PURE__ */ React.createElement("meta", { property: "twitter:image", content: ogContentUrl })), robots && /* @__PURE__ */ React.createElement(Head, null, /* @__PURE__ */ React.createElement(
|
|
26
|
+
"meta",
|
|
27
|
+
{
|
|
28
|
+
name: "robots",
|
|
29
|
+
content: Array.isArray(robots) ? robots.join(", ") : robots
|
|
30
|
+
}
|
|
31
|
+
)), children);
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
MetaTags
|
|
35
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Add commonly used `<meta>` tags for unfurling/seo purposes
|
|
4
|
+
* using the open graph protocol https://ogp.me/
|
|
5
|
+
* @example
|
|
6
|
+
* <Metadata title="About Page" og={{ image: "/static/about-og.png" }} />
|
|
7
|
+
*/
|
|
8
|
+
export declare const Metadata: (props: Record<string, any>) => React.JSX.Element;
|
|
9
|
+
//# sourceMappingURL=Metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Metadata.d.ts","sourceRoot":"","sources":["../../src/components/Metadata.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AA0CzB;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,UAAW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,sBAgElD,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import * as helmetPkg from "react-helmet-async";
|
|
4
|
+
const { Helmet: HelmetHead } = helmetPkg;
|
|
5
|
+
import PortalHead from "./PortalHead.js";
|
|
6
|
+
const EXCLUDE_PROPS = ["charSet"];
|
|
7
|
+
const propToMetaTag = (parentKey, parentValue, options) => {
|
|
8
|
+
if (Array.isArray(parentValue)) {
|
|
9
|
+
return parentValue.flatMap((value) => {
|
|
10
|
+
return propToMetaTag(parentKey, value, options);
|
|
11
|
+
});
|
|
12
|
+
} else if (typeof parentValue === "object") {
|
|
13
|
+
return Object.entries(parentValue).filter(([_, v]) => v !== null).flatMap(([key, value]) => {
|
|
14
|
+
return propToMetaTag(`${parentKey}:${key}`, value, { attr: "property" });
|
|
15
|
+
});
|
|
16
|
+
} else {
|
|
17
|
+
const attributes = {
|
|
18
|
+
[options["attr"]]: parentKey,
|
|
19
|
+
content: parentValue
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ React.createElement("meta", { ...attributes });
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const Metadata = (props) => {
|
|
25
|
+
const { children, ...metaProps } = props;
|
|
26
|
+
let Head = HelmetHead;
|
|
27
|
+
if (RWJS_ENV.RWJS_EXP_STREAMING_SSR) {
|
|
28
|
+
Head = PortalHead;
|
|
29
|
+
}
|
|
30
|
+
const tags = Object.entries(metaProps).filter(
|
|
31
|
+
([key, value]) => !EXCLUDE_PROPS.includes(key) && value !== null && (key !== "og" || value !== true)
|
|
32
|
+
).flatMap(([key, value]) => {
|
|
33
|
+
return propToMetaTag(key, value, { attr: "name" });
|
|
34
|
+
}).filter((tag) => !!tag);
|
|
35
|
+
if (metaProps.title) {
|
|
36
|
+
;
|
|
37
|
+
[metaProps.title].flat().reverse().map((title) => {
|
|
38
|
+
tags.unshift(/* @__PURE__ */ React.createElement("title", null, title));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (metaProps.charSet) {
|
|
42
|
+
tags.push(/* @__PURE__ */ React.createElement("meta", { charSet: metaProps.charSet }));
|
|
43
|
+
}
|
|
44
|
+
if (metaProps.og) {
|
|
45
|
+
if (metaProps.title && !metaProps.og.title && metaProps.og.title !== null) {
|
|
46
|
+
tags.push(/* @__PURE__ */ React.createElement("meta", { property: "og:title", content: metaProps.title }));
|
|
47
|
+
}
|
|
48
|
+
if (metaProps.description && !metaProps.og.description && metaProps.og.description !== null) {
|
|
49
|
+
tags.push(
|
|
50
|
+
/* @__PURE__ */ React.createElement("meta", { property: "og:description", content: metaProps.description })
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
if (!metaProps.og.type && metaProps.og.type !== null) {
|
|
54
|
+
tags.push(/* @__PURE__ */ React.createElement("meta", { property: "og:type", content: "website" }));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return /* @__PURE__ */ React.createElement(Head, null, tags.map((tag, i) => React.cloneElement(tag, { key: i })), children);
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
Metadata
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalHead.d.ts","sourceRoot":"","sources":["../../src/components/PortalHead.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAkBzB,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CA4BjD,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
3
|
+
import { useServerInsertedHTML } from "./ServerInject.js";
|
|
4
|
+
function addDataAttributeMarker(children, marker = "data-rwjs-head") {
|
|
5
|
+
return React.Children.toArray(children).map((child, i) => {
|
|
6
|
+
return React.cloneElement(child, {
|
|
7
|
+
[marker]: true,
|
|
8
|
+
key: `${marker}-` + i
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
const PortalHead = ({ children }) => {
|
|
13
|
+
const isServerRendering = typeof window === "undefined";
|
|
14
|
+
useServerInsertedHTML(() => {
|
|
15
|
+
return addDataAttributeMarker(children);
|
|
16
|
+
});
|
|
17
|
+
const shouldPortal = React.useRef(
|
|
18
|
+
isServerRendering ? false : document.readyState === "complete"
|
|
19
|
+
);
|
|
20
|
+
if (isServerRendering) {
|
|
21
|
+
return null;
|
|
22
|
+
} else {
|
|
23
|
+
return shouldPortal.current ? createPortal(children, document.head) : null;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var PortalHead_default = PortalHead;
|
|
27
|
+
export {
|
|
28
|
+
PortalHead_default as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface RedwoodProviderProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
titleTemplate?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const RedwoodProvider: ({ children, titleTemplate, }: RedwoodProviderProps) => React.JSX.Element;
|
|
7
|
+
declare global { }
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=RedwoodProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedwoodProvider.d.ts","sourceRoot":"","sources":["../../src/components/RedwoodProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,eAAO,MAAM,eAAe,iCAGzB,oBAAoB,sBAuBtB,CAAA;AAED,OAAO,CAAC,MAAM,CAAC,GAAE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import * as helmetPkg from "react-helmet-async";
|
|
3
|
+
const { Helmet, HelmetProvider } = helmetPkg;
|
|
4
|
+
const RedwoodProvider = ({
|
|
5
|
+
children,
|
|
6
|
+
titleTemplate
|
|
7
|
+
}) => {
|
|
8
|
+
const appTitle = globalThis.__REDWOOD__APP_TITLE;
|
|
9
|
+
const template = () => {
|
|
10
|
+
if (titleTemplate) {
|
|
11
|
+
let template2 = titleTemplate.replace(/%AppTitle/g, appTitle);
|
|
12
|
+
template2 = template2.replace(/%PageTitle/g, "%s");
|
|
13
|
+
return template2;
|
|
14
|
+
}
|
|
15
|
+
return "";
|
|
16
|
+
};
|
|
17
|
+
if (RWJS_ENV.RWJS_EXP_STREAMING_SSR) {
|
|
18
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ React.createElement(HelmetProvider, { context: globalThis.__REDWOOD__HELMET_CONTEXT }, /* @__PURE__ */ React.createElement(Helmet, { titleTemplate: template(), defaultTitle: appTitle }, /* @__PURE__ */ React.createElement("title", null, appTitle)), children);
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
RedwoodProvider
|
|
24
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Inspired by Next's useServerInsertedHTML, originally designed for CSS-in-JS
|
|
4
|
+
* for now it seems the only way to inject html with streaming is to use a context
|
|
5
|
+
*
|
|
6
|
+
* We use this for <head> tags, and for apollo cache hydration
|
|
7
|
+
*
|
|
8
|
+
* Until https://github.com/reactjs/rfcs/pull/219 makes it into react
|
|
9
|
+
*/
|
|
10
|
+
export type RenderCallback = () => React.ReactNode;
|
|
11
|
+
export declare const ServerHtmlContext: React.Context<(callback: RenderCallback) => void>;
|
|
12
|
+
/**
|
|
13
|
+
* Use this factory, once per request.
|
|
14
|
+
* This is to ensure that injectionState is isolated to the request
|
|
15
|
+
* and not shared between requests.
|
|
16
|
+
*/
|
|
17
|
+
export declare const createInjector: () => {
|
|
18
|
+
injectToPage: (renderCallback: RenderCallback) => void;
|
|
19
|
+
injectionState: Set<RenderCallback>;
|
|
20
|
+
};
|
|
21
|
+
export declare const ServerHtmlProvider: React.Provider<(callback: RenderCallback) => void>;
|
|
22
|
+
export declare const ServerInjectedHtml: ({ injectionState, }: {
|
|
23
|
+
injectionState: Set<RenderCallback>;
|
|
24
|
+
}) => React.JSX.Element[];
|
|
25
|
+
export declare function useServerInsertedHTML(callback: () => React.ReactNode): void;
|
|
26
|
+
//# sourceMappingURL=ServerInject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerInject.d.ts","sourceRoot":"","sources":["../../src/components/ServerInject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAA;AAEzE;;;;;;;GAOG;AAEH,MAAM,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,SAAS,CAAA;AAElD,eAAO,MAAM,iBAAiB,2BACjB,cAAc,KAAK,IAAI,CACzB,CAAA;AAEX;;;;GAIG;AACH,eAAO,MAAM,cAAc;mCAGa,cAAc;;CAKrD,CAAA;AAKD,eAAO,MAAM,kBAAkB,4BArBlB,cAAc,KAAK,IAAI,CAqBwB,CAAA;AAE5D,eAAO,MAAM,kBAAkB,wBAE5B;IACD,cAAc,EAAE,GAAG,CAAC,cAAc,CAAC,CAAA;CACpC,wBAgBA,CAAA;AAGD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,KAAK,CAAC,SAAS,GAAG,IAAI,CAO3E"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { Fragment, createContext, useContext, useId } from "react";
|
|
2
|
+
const ServerHtmlContext = createContext(() => {
|
|
3
|
+
});
|
|
4
|
+
const createInjector = () => {
|
|
5
|
+
const injectionState = /* @__PURE__ */ new Set([]);
|
|
6
|
+
const injectToPage = (renderCallback) => {
|
|
7
|
+
injectionState.add(renderCallback);
|
|
8
|
+
};
|
|
9
|
+
return { injectToPage, injectionState };
|
|
10
|
+
};
|
|
11
|
+
const ServerHtmlProvider = ServerHtmlContext.Provider;
|
|
12
|
+
const ServerInjectedHtml = ({
|
|
13
|
+
injectionState
|
|
14
|
+
}) => {
|
|
15
|
+
const serverInsertedHtml = [];
|
|
16
|
+
for (const callback of injectionState) {
|
|
17
|
+
serverInsertedHtml.push(callback());
|
|
18
|
+
injectionState.delete(callback);
|
|
19
|
+
}
|
|
20
|
+
const fragmentId = useId();
|
|
21
|
+
return serverInsertedHtml.map((html, i) => {
|
|
22
|
+
return /* @__PURE__ */ React.createElement(Fragment, { key: `rw-server-inserted-${fragmentId}-${i}` }, html);
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
function useServerInsertedHTML(callback) {
|
|
26
|
+
const addInsertedServerHTMLCallback = useContext(ServerHtmlContext);
|
|
27
|
+
if (addInsertedServerHTMLCallback) {
|
|
28
|
+
addInsertedServerHTMLCallback(callback);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
ServerHtmlContext,
|
|
33
|
+
ServerHtmlProvider,
|
|
34
|
+
ServerInjectedHtml,
|
|
35
|
+
createInjector,
|
|
36
|
+
useServerInsertedHTML
|
|
37
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DocumentNode } from 'graphql';
|
|
3
|
+
export interface QueryInfo {
|
|
4
|
+
query: DocumentNode;
|
|
5
|
+
variables?: Record<string, unknown>;
|
|
6
|
+
renderLoading?: boolean;
|
|
7
|
+
hasProcessed: boolean;
|
|
8
|
+
data?: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface CellCacheState {
|
|
11
|
+
queryCache: Record<string, QueryInfo | undefined>;
|
|
12
|
+
}
|
|
13
|
+
interface Props {
|
|
14
|
+
queryCache: Record<string, QueryInfo | undefined>;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export declare const CellCacheContextProvider: ({ queryCache, children }: Props) => React.JSX.Element;
|
|
18
|
+
export declare function useCellCacheContext(): CellCacheState;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=CellCacheContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CellCacheContext.d.ts","sourceRoot":"","sources":["../../../src/components/cell/CellCacheContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,YAAY,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACnC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,YAAY,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC,CAAA;CAClD;AAID,UAAU,KAAK;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC,CAAA;IACjD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED,eAAO,MAAM,wBAAwB,6BAA8B,KAAK,sBAMvE,CAAA;AAED,wBAAgB,mBAAmB,mBAUlC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { createContext, useContext } from "react";
|
|
2
|
+
const CellCacheContext = createContext(void 0);
|
|
3
|
+
const CellCacheContextProvider = ({ queryCache, children }) => {
|
|
4
|
+
return /* @__PURE__ */ React.createElement(CellCacheContext.Provider, { value: { queryCache } }, children);
|
|
5
|
+
};
|
|
6
|
+
function useCellCacheContext() {
|
|
7
|
+
const context = useContext(CellCacheContext);
|
|
8
|
+
if (!context) {
|
|
9
|
+
throw new Error(
|
|
10
|
+
"useCellCacheContext must be used within a CellCacheContextProvider"
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
CellCacheContextProvider,
|
|
17
|
+
useCellCacheContext
|
|
18
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CellFailureProps } from './cellTypes.js';
|
|
3
|
+
export type FallbackProps = {
|
|
4
|
+
error: QueryOperationResult['error'];
|
|
5
|
+
resetErrorBoundary: () => void;
|
|
6
|
+
};
|
|
7
|
+
export type CellErrorBoundaryProps = {
|
|
8
|
+
renderFallback: (fbProps: FallbackProps) => React.ReactElement<CellFailureProps>;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
interface ErrState {
|
|
12
|
+
hasError: boolean;
|
|
13
|
+
error?: QueryOperationResult['error'];
|
|
14
|
+
}
|
|
15
|
+
export declare class CellErrorBoundary extends React.Component<CellErrorBoundaryProps, ErrState> {
|
|
16
|
+
constructor(props: CellErrorBoundaryProps);
|
|
17
|
+
static getDerivedStateFromError(error: Error): {
|
|
18
|
+
hasError: boolean;
|
|
19
|
+
error: Error;
|
|
20
|
+
};
|
|
21
|
+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
22
|
+
render(): React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=CellErrorBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CellErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/cell/CellErrorBoundary.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAA;IACpC,kBAAkB,EAAE,MAAM,IAAI,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IAGnC,cAAc,EAAE,CACd,OAAO,EAAE,aAAa,KACnB,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAA;IACzC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED,UAAU,QAAQ;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAA;CACtC;AAED,qBAAa,iBAAkB,SAAQ,KAAK,CAAC,SAAS,CACpD,sBAAsB,EACtB,QAAQ,CACT;gBACa,KAAK,EAAE,sBAAsB;IAKzC,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK;;;;IAI5C,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS;IAQ1D,MAAM;CAgBP"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
class CellErrorBoundary extends React.Component {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
super(props);
|
|
6
|
+
this.state = { hasError: false };
|
|
7
|
+
}
|
|
8
|
+
static getDerivedStateFromError(error) {
|
|
9
|
+
return { hasError: true, error };
|
|
10
|
+
}
|
|
11
|
+
componentDidCatch(error, errorInfo) {
|
|
12
|
+
console.log("Cell failure: ", {
|
|
13
|
+
error,
|
|
14
|
+
errorInfo
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
const { renderFallback } = this.props;
|
|
19
|
+
if (this.state.hasError) {
|
|
20
|
+
return renderFallback({
|
|
21
|
+
error: this.state.error,
|
|
22
|
+
resetErrorBoundary: () => {
|
|
23
|
+
this.setState({ hasError: false, error: void 0 });
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return this.props.children;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
CellErrorBoundary
|
|
32
|
+
};
|