@cedarjs/web 5.0.4-next.167 → 5.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/dist/apollo/fragmentRegistry.d.ts +0 -25
- package/dist/apollo/fragmentRegistry.d.ts.map +1 -1
- package/dist/apollo/fragmentRegistry.js +1 -19
- package/dist/apollo/index.d.ts +70 -50
- package/dist/apollo/index.d.ts.map +1 -1
- package/dist/apollo/index.js +184 -2
- package/dist/apollo/suspense.d.ts +7 -16
- package/dist/apollo/suspense.d.ts.map +1 -1
- package/dist/apollo/suspense.js +26 -9
- package/dist/apollo/typeOverride.d.ts +21 -0
- package/dist/apollo/typeOverride.d.ts.map +1 -0
- package/dist/bundled/apollo-upload-client.js +1 -2899
- 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 +76 -0
- package/dist/cjs/apollo/index.d.ts.map +1 -0
- package/dist/cjs/apollo/index.js +218 -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/{apollo/apolloLinkTypes.d.ts → cjs/apollo/suspense.d.ts} +22 -22
- 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/cedar.d.ts +9 -0
- package/dist/cjs/bins/cedar.d.ts.map +1 -0
- package/dist/cjs/bins/cedar.js +36 -0
- package/dist/cjs/bins/cfw.d.ts +3 -0
- package/dist/cjs/bins/cfw.d.ts.map +1 -0
- package/dist/cjs/bins/cfw.js +36 -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/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 +2925 -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 +552 -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 +68 -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 +94 -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 +57 -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/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 +23 -0
- package/dist/cjs/graphql.d.ts.map +1 -0
- package/dist/cjs/graphql.js +36 -0
- package/dist/cjs/index.d.ts +19 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +69 -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/FetchConfigProvider.d.ts +2 -3
- package/dist/components/FetchConfigProvider.d.ts.map +1 -1
- 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/cell/CellErrorBoundary.d.ts +2 -3
- package/dist/components/cell/CellErrorBoundary.d.ts.map +1 -1
- package/dist/components/cell/cellTypes.d.ts +4 -17
- package/dist/components/cell/cellTypes.d.ts.map +1 -1
- package/dist/components/cell/createCell.d.ts +7 -1
- package/dist/components/cell/createCell.d.ts.map +1 -1
- package/dist/components/cell/createCell.js +3 -22
- package/dist/components/cell/createCell.test.js +328 -0
- package/dist/components/cell/createSuspendingCell.d.ts.map +1 -1
- package/dist/components/cell/createSuspendingCell.js +3 -12
- package/dist/components/cell/createSuspendingCell.test.js +92 -0
- package/dist/global.web-auto-imports.d.ts +16 -0
- package/dist/global.web-auto-imports.d.ts.map +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -5
- package/dist/package.json +1 -0
- package/package.json +106 -48
- package/dist/apollo/ApolloProviderWithFetchConfig.d.ts +0 -15
- package/dist/apollo/ApolloProviderWithFetchConfig.d.ts.map +0 -1
- package/dist/apollo/ApolloProviderWithFetchConfig.js +0 -134
- package/dist/apollo/CedarApolloProvider.d.ts +0 -14
- package/dist/apollo/CedarApolloProvider.d.ts.map +0 -1
- package/dist/apollo/CedarApolloProvider.js +0 -35
- package/dist/apollo/ErrorBoundary.d.ts +0 -13
- package/dist/apollo/ErrorBoundary.d.ts.map +0 -1
- package/dist/apollo/ErrorBoundary.js +0 -13
- package/dist/apollo/apolloLinkTypes.d.ts.map +0 -1
- package/dist/bins/cedar.js +0 -14
- package/dist/bins/cfw.js +0 -14
- package/dist/bins/cross-env.js +0 -8
- package/dist/bins/msw.js +0 -6
- package/dist/bins/redwood.js +0 -14
- package/dist/bins/storybook.js +0 -27
- package/dist/bins/tsc.js +0 -8
- package/dist/components/cell/createFragmentCell.d.ts +0 -19
- package/dist/components/cell/createFragmentCell.d.ts.map +0 -1
- package/dist/components/cell/createFragmentCell.js +0 -73
- /package/dist/apollo/{apolloLinkTypes.js → typeOverride.js} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { UseAuth } from '@cedarjs/auth';
|
|
3
|
+
export declare const getApiGraphQLUrl: () => string;
|
|
4
|
+
export interface FetchConfig {
|
|
5
|
+
uri: string;
|
|
6
|
+
headers?: {
|
|
7
|
+
'auth-provider'?: string;
|
|
8
|
+
authorization?: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare const FetchConfigContext: React.Context<FetchConfig>;
|
|
12
|
+
interface Props {
|
|
13
|
+
useAuth?: UseAuth;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The `FetchConfigProvider` understands Redwood's Auth and determines the
|
|
18
|
+
* correct request-headers based on a user's authentication state.
|
|
19
|
+
* Note that the auth bearer token is now passed in packages/web/src/apollo/index.tsx
|
|
20
|
+
* as the token is retrieved async
|
|
21
|
+
*/
|
|
22
|
+
export declare const FetchConfigProvider: React.FC<Props>;
|
|
23
|
+
export declare const useFetchConfig: () => FetchConfig;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=FetchConfigProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchConfigProvider.d.ts","sourceRoot":"","sources":["../../../src/components/FetchConfigProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAG5C,eAAO,MAAM,gBAAgB,cAE5B,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC/D;AAED,eAAO,MAAM,kBAAkB,4BAE7B,CAAA;AAEF,UAAU,KAAK;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA+B/C,CAAA;AAED,eAAO,MAAM,cAAc,mBAA6C,CAAA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
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 FetchConfigProvider_exports = {};
|
|
30
|
+
__export(FetchConfigProvider_exports, {
|
|
31
|
+
FetchConfigContext: () => FetchConfigContext,
|
|
32
|
+
FetchConfigProvider: () => FetchConfigProvider,
|
|
33
|
+
getApiGraphQLUrl: () => getApiGraphQLUrl,
|
|
34
|
+
useFetchConfig: () => useFetchConfig
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(FetchConfigProvider_exports);
|
|
37
|
+
var import_react = __toESM(require("react"), 1);
|
|
38
|
+
var import_auth = require("@cedarjs/auth");
|
|
39
|
+
const getApiGraphQLUrl = () => {
|
|
40
|
+
return globalThis.RWJS_API_GRAPHQL_URL;
|
|
41
|
+
};
|
|
42
|
+
const FetchConfigContext = import_react.default.createContext({
|
|
43
|
+
uri: getApiGraphQLUrl()
|
|
44
|
+
});
|
|
45
|
+
const FetchConfigProvider = ({
|
|
46
|
+
useAuth = import_auth.useNoAuth,
|
|
47
|
+
...rest
|
|
48
|
+
}) => {
|
|
49
|
+
const { isAuthenticated, type } = useAuth();
|
|
50
|
+
if (!isAuthenticated) {
|
|
51
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
52
|
+
FetchConfigContext.Provider,
|
|
53
|
+
{
|
|
54
|
+
value: { uri: getApiGraphQLUrl() },
|
|
55
|
+
...rest
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
const headers = {
|
|
60
|
+
"auth-provider": type
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
63
|
+
FetchConfigContext.Provider,
|
|
64
|
+
{
|
|
65
|
+
value: {
|
|
66
|
+
uri: getApiGraphQLUrl(),
|
|
67
|
+
headers
|
|
68
|
+
},
|
|
69
|
+
...rest
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
const useFetchConfig = () => import_react.default.useContext(FetchConfigContext);
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
FetchConfigContext,
|
|
77
|
+
FetchConfigProvider,
|
|
78
|
+
getApiGraphQLUrl,
|
|
79
|
+
useFetchConfig
|
|
80
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { OperationVariables, useBackgroundQuery as apolloUseBackgroundQuery, useReadQuery as apolloUseReadQuery } from '@apollo/client';
|
|
3
|
+
import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
4
|
+
import type { DocumentNode } from 'graphql';
|
|
5
|
+
export type { TypedDocumentNode };
|
|
6
|
+
/**
|
|
7
|
+
* @NOTE
|
|
8
|
+
* The types QueryOperationResult, MutationOperationResult, SubscriptionOperationResult, and SuspenseQueryOperationResult
|
|
9
|
+
* are overridden in packages/web/src/apollo/typeOverride.ts. This was originally so that you could bring your own gql client.
|
|
10
|
+
*
|
|
11
|
+
* The default (empty) types are defined in packages/web/src/global.web-auto-imports.ts
|
|
12
|
+
*
|
|
13
|
+
* Do not import types for hooks directly from Apollo here, unless it is an Apollo specific hook.
|
|
14
|
+
*/
|
|
15
|
+
type DefaultUseQueryType = <TData = any, TVariables extends OperationVariables = GraphQLOperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLQueryHookOptions<TData, TVariables>) => QueryOperationResult<TData, TVariables>;
|
|
16
|
+
type DefaultUseMutationType = <TData = any, TVariables = GraphQLOperationVariables>(mutation: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLMutationHookOptions<TData, TVariables>) => MutationOperationResult<TData, TVariables>;
|
|
17
|
+
type DefaultUseSubscriptionType = <TData = any, TVariables extends OperationVariables = GraphQLOperationVariables>(subscription: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLSubscriptionHookOptions<TData, TVariables>) => SubscriptionOperationResult<TData, TVariables>;
|
|
18
|
+
type DefaultUseSuspenseType = <TData = any, TVariables extends OperationVariables = GraphQLOperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLSuspenseQueryHookOptions<TData, TVariables>) => SuspenseQueryOperationResult<TData, TVariables>;
|
|
19
|
+
export interface GraphQLHooks<TuseQuery = DefaultUseQueryType, TuseMutation = DefaultUseMutationType, TuseSubscription = DefaultUseSubscriptionType, TuseSuspenseQuery = DefaultUseSuspenseType> {
|
|
20
|
+
useQuery: TuseQuery;
|
|
21
|
+
useMutation: TuseMutation;
|
|
22
|
+
useSubscription: TuseSubscription;
|
|
23
|
+
useSuspenseQuery: TuseSuspenseQuery;
|
|
24
|
+
useBackgroundQuery: typeof apolloUseBackgroundQuery;
|
|
25
|
+
useReadQuery: typeof apolloUseReadQuery;
|
|
26
|
+
}
|
|
27
|
+
export declare const GraphQLHooksContext: React.Context<GraphQLHooks<DefaultUseQueryType, DefaultUseMutationType, DefaultUseSubscriptionType, DefaultUseSuspenseType>>;
|
|
28
|
+
interface GraphQlHooksProviderProps<TuseQuery = DefaultUseQueryType, TuseMutation = DefaultUseMutationType, TuseSubscription = DefaultUseSubscriptionType, TuseSuspenseQuery = DefaultUseSuspenseType> extends GraphQLHooks<TuseQuery, TuseMutation, TuseSubscription, TuseSuspenseQuery> {
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* GraphQLHooksProvider stores standard `useQuery` and `useMutation` hooks for Redwood
|
|
33
|
+
* that can be mapped to your GraphQL library of choice's own `useQuery`
|
|
34
|
+
* and `useMutation` implementation.
|
|
35
|
+
*
|
|
36
|
+
* @todo Let the user pass in the additional type for options.
|
|
37
|
+
*/
|
|
38
|
+
export declare const GraphQLHooksProvider: <TuseQuery extends DefaultUseQueryType, TuseMutation extends DefaultUseMutationType>({ useQuery, useMutation, useSubscription, useSuspenseQuery, useBackgroundQuery, useReadQuery, children, }: GraphQlHooksProviderProps<TuseQuery, TuseMutation>) => React.JSX.Element;
|
|
39
|
+
export declare function useQuery<TData = any, TVariables extends OperationVariables = GraphQLOperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLQueryHookOptions<TData, TVariables>): QueryOperationResult<TData, TVariables>;
|
|
40
|
+
export declare function useMutation<TData = any, TVariables = GraphQLOperationVariables>(mutation: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLMutationHookOptions<TData, TVariables>): MutationOperationResult<TData, TVariables>;
|
|
41
|
+
export declare function useSubscription<TData = any, TVariables extends OperationVariables = GraphQLOperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLSubscriptionHookOptions<TData, TVariables>): SubscriptionOperationResult<TData, TVariables>;
|
|
42
|
+
export declare function useSuspenseQuery<TData = any, TVariables extends OperationVariables = GraphQLOperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: GraphQLSuspenseQueryHookOptions<TData, TVariables>): SuspenseQueryOperationResult<TData, TVariables>;
|
|
43
|
+
export declare const useBackgroundQuery: typeof apolloUseBackgroundQuery<any>;
|
|
44
|
+
export declare const useReadQuery: typeof apolloUseReadQuery;
|
|
45
|
+
//# sourceMappingURL=GraphQLHooksProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphQLHooksProvider.d.ts","sourceRoot":"","sources":["../../../src/components/GraphQLHooksProvider.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,135 @@
|
|
|
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 GraphQLHooksProvider_exports = {};
|
|
30
|
+
__export(GraphQLHooksProvider_exports, {
|
|
31
|
+
GraphQLHooksContext: () => GraphQLHooksContext,
|
|
32
|
+
GraphQLHooksProvider: () => GraphQLHooksProvider,
|
|
33
|
+
useBackgroundQuery: () => useBackgroundQuery,
|
|
34
|
+
useMutation: () => useMutation,
|
|
35
|
+
useQuery: () => useQuery,
|
|
36
|
+
useReadQuery: () => useReadQuery,
|
|
37
|
+
useSubscription: () => useSubscription,
|
|
38
|
+
useSuspenseQuery: () => useSuspenseQuery
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(GraphQLHooksProvider_exports);
|
|
41
|
+
var import_react = __toESM(require("react"), 1);
|
|
42
|
+
const GraphQLHooksContext = import_react.default.createContext({
|
|
43
|
+
useQuery: () => {
|
|
44
|
+
throw new Error(
|
|
45
|
+
"You must register a useQuery hook via the `GraphQLHooksProvider`"
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
useMutation: () => {
|
|
49
|
+
throw new Error(
|
|
50
|
+
"You must register a useMutation hook via the `GraphQLHooksProvider`"
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
useSubscription: () => {
|
|
54
|
+
throw new Error(
|
|
55
|
+
"You must register a useSubscription hook via the `GraphQLHooksProvider`"
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
useSuspenseQuery: () => {
|
|
59
|
+
throw new Error(
|
|
60
|
+
"You must register a useSuspenseQuery hook via the `GraphQLHooksProvider`."
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
// These are apollo specific hooks!
|
|
64
|
+
useBackgroundQuery: () => {
|
|
65
|
+
throw new Error(
|
|
66
|
+
"You must register a useBackgroundQuery hook via the `GraphQLHooksProvider`."
|
|
67
|
+
);
|
|
68
|
+
},
|
|
69
|
+
useReadQuery: () => {
|
|
70
|
+
throw new Error(
|
|
71
|
+
"You must register a useReadQuery hook via the `GraphQLHooksProvider`."
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const GraphQLHooksProvider = ({
|
|
76
|
+
useQuery: useQuery2,
|
|
77
|
+
useMutation: useMutation2,
|
|
78
|
+
useSubscription: useSubscription2,
|
|
79
|
+
useSuspenseQuery: useSuspenseQuery2,
|
|
80
|
+
useBackgroundQuery: useBackgroundQuery2,
|
|
81
|
+
useReadQuery: useReadQuery2,
|
|
82
|
+
children
|
|
83
|
+
}) => {
|
|
84
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
85
|
+
GraphQLHooksContext.Provider,
|
|
86
|
+
{
|
|
87
|
+
value: {
|
|
88
|
+
useQuery: useQuery2,
|
|
89
|
+
useMutation: useMutation2,
|
|
90
|
+
useSubscription: useSubscription2,
|
|
91
|
+
useSuspenseQuery: useSuspenseQuery2,
|
|
92
|
+
useBackgroundQuery: useBackgroundQuery2,
|
|
93
|
+
useReadQuery: useReadQuery2
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
children
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
function useQuery(query, options) {
|
|
100
|
+
return import_react.default.useContext(GraphQLHooksContext).useQuery(
|
|
101
|
+
query,
|
|
102
|
+
options
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
function useMutation(mutation, options) {
|
|
106
|
+
return import_react.default.useContext(GraphQLHooksContext).useMutation(
|
|
107
|
+
mutation,
|
|
108
|
+
options
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
function useSubscription(query, options) {
|
|
112
|
+
return import_react.default.useContext(GraphQLHooksContext).useSubscription(query, options);
|
|
113
|
+
}
|
|
114
|
+
function useSuspenseQuery(query, options) {
|
|
115
|
+
return import_react.default.useContext(GraphQLHooksContext).useSuspenseQuery(query, options);
|
|
116
|
+
}
|
|
117
|
+
const useBackgroundQuery = (...args) => {
|
|
118
|
+
return import_react.default.useContext(GraphQLHooksContext).useBackgroundQuery(
|
|
119
|
+
...args
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
const useReadQuery = (...args) => {
|
|
123
|
+
return import_react.default.useContext(GraphQLHooksContext).useReadQuery(...args);
|
|
124
|
+
};
|
|
125
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
126
|
+
0 && (module.exports = {
|
|
127
|
+
GraphQLHooksContext,
|
|
128
|
+
GraphQLHooksProvider,
|
|
129
|
+
useBackgroundQuery,
|
|
130
|
+
useMutation,
|
|
131
|
+
useQuery,
|
|
132
|
+
useReadQuery,
|
|
133
|
+
useSubscription,
|
|
134
|
+
useSuspenseQuery
|
|
135
|
+
});
|
|
@@ -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;AAQzB,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,GAAI,OAAO,aAAa,sBAoG5C,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 MetaTags_exports = {};
|
|
30
|
+
__export(MetaTags_exports, {
|
|
31
|
+
MetaTags: () => MetaTags
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(MetaTags_exports);
|
|
34
|
+
var import_react = __toESM(require("react"), 1);
|
|
35
|
+
var import_react_helmet = require("@dr.pogodin/react-helmet");
|
|
36
|
+
var import_PortalHead = __toESM(require("./PortalHead.js"), 1);
|
|
37
|
+
const MetaTags = (props) => {
|
|
38
|
+
const {
|
|
39
|
+
tag = "og:image",
|
|
40
|
+
ogType = "website",
|
|
41
|
+
ogContentUrl,
|
|
42
|
+
robots,
|
|
43
|
+
contentType,
|
|
44
|
+
ogWidth,
|
|
45
|
+
ogHeight,
|
|
46
|
+
ogUrl,
|
|
47
|
+
title,
|
|
48
|
+
locale,
|
|
49
|
+
description,
|
|
50
|
+
author,
|
|
51
|
+
children
|
|
52
|
+
} = props;
|
|
53
|
+
let Head = import_react_helmet.Helmet;
|
|
54
|
+
if (RWJS_ENV.RWJS_EXP_STREAMING_SSR) {
|
|
55
|
+
Head = import_PortalHead.default;
|
|
56
|
+
}
|
|
57
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, title && /* @__PURE__ */ import_react.default.createElement(Head, null, /* @__PURE__ */ import_react.default.createElement("title", null, title), /* @__PURE__ */ import_react.default.createElement("meta", { property: "og:title", content: title, key: "title" }), /* @__PURE__ */ import_react.default.createElement("meta", { property: "twitter:title", content: title })), description && /* @__PURE__ */ import_react.default.createElement(Head, null, /* @__PURE__ */ import_react.default.createElement("meta", { name: "description", content: description }), /* @__PURE__ */ import_react.default.createElement("meta", { name: "twitter:description", content: description }), /* @__PURE__ */ import_react.default.createElement("meta", { property: "og:description", content: description })), author && /* @__PURE__ */ import_react.default.createElement(Head, null, /* @__PURE__ */ import_react.default.createElement("meta", { name: "author", content: author }), /* @__PURE__ */ import_react.default.createElement("meta", { name: "twitter:site", content: author }), /* @__PURE__ */ import_react.default.createElement("meta", { name: "twitter:creator", content: author })), ogUrl && /* @__PURE__ */ import_react.default.createElement(Head, null, /* @__PURE__ */ import_react.default.createElement("meta", { property: "og:url", content: ogUrl })), locale && /* @__PURE__ */ import_react.default.createElement(Head, null, /* @__PURE__ */ import_react.default.createElement("html", { lang: locale }), /* @__PURE__ */ import_react.default.createElement("meta", { property: "og:locale", content: locale })), /* @__PURE__ */ import_react.default.createElement(Head, null, /* @__PURE__ */ import_react.default.createElement("meta", { property: "og:type", content: ogType })), ogContentUrl && /* @__PURE__ */ import_react.default.createElement(Head, null, /* @__PURE__ */ import_react.default.createElement("meta", { property: tag, content: ogContentUrl })), contentType && /* @__PURE__ */ import_react.default.createElement(Head, null, /* @__PURE__ */ import_react.default.createElement("meta", { property: `${tag}:type`, content: contentType })), tag === "og:image" && /* @__PURE__ */ import_react.default.createElement(Head, null, ogWidth && /* @__PURE__ */ import_react.default.createElement("meta", { property: "image:width", content: ogWidth }), ogHeight && /* @__PURE__ */ import_react.default.createElement("meta", { property: "image:height", content: ogHeight }), /* @__PURE__ */ import_react.default.createElement("meta", { property: "twitter:card", content: "summary_large_image" }), /* @__PURE__ */ import_react.default.createElement("meta", { property: "twitter:image", content: ogContentUrl })), robots && /* @__PURE__ */ import_react.default.createElement(Head, null, /* @__PURE__ */ import_react.default.createElement(
|
|
58
|
+
"meta",
|
|
59
|
+
{
|
|
60
|
+
name: "robots",
|
|
61
|
+
content: Array.isArray(robots) ? robots.join(", ") : robots
|
|
62
|
+
}
|
|
63
|
+
)), children);
|
|
64
|
+
};
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
MetaTags
|
|
68
|
+
});
|
|
@@ -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;AAwCzB;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,sBAgElD,CAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var Metadata_exports = {};
|
|
31
|
+
__export(Metadata_exports, {
|
|
32
|
+
Metadata: () => Metadata
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Metadata_exports);
|
|
35
|
+
var import_react = __toESM(require("react"), 1);
|
|
36
|
+
var import_react_helmet = require("@dr.pogodin/react-helmet");
|
|
37
|
+
var import_PortalHead = __toESM(require("./PortalHead.js"), 1);
|
|
38
|
+
const EXCLUDE_PROPS = ["charSet"];
|
|
39
|
+
const propToMetaTag = (parentKey, parentValue, options) => {
|
|
40
|
+
if (Array.isArray(parentValue)) {
|
|
41
|
+
return parentValue.flatMap((value) => {
|
|
42
|
+
return propToMetaTag(parentKey, value, options);
|
|
43
|
+
});
|
|
44
|
+
} else if (typeof parentValue === "object") {
|
|
45
|
+
return Object.entries(parentValue).filter(([_, v]) => v !== null).flatMap(([key, value]) => {
|
|
46
|
+
return propToMetaTag(`${parentKey}:${key}`, value, { attr: "property" });
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
const attributes = {
|
|
50
|
+
[options["attr"]]: parentKey,
|
|
51
|
+
content: parentValue
|
|
52
|
+
};
|
|
53
|
+
return /* @__PURE__ */ import_react.default.createElement("meta", { ...attributes });
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const Metadata = (props) => {
|
|
57
|
+
const { children, ...metaProps } = props;
|
|
58
|
+
let Head = import_react_helmet.Helmet;
|
|
59
|
+
if (RWJS_ENV.RWJS_EXP_STREAMING_SSR) {
|
|
60
|
+
Head = import_PortalHead.default;
|
|
61
|
+
}
|
|
62
|
+
const tags = Object.entries(metaProps).filter(
|
|
63
|
+
([key, value]) => !EXCLUDE_PROPS.includes(key) && value !== null && (key !== "og" || value !== true)
|
|
64
|
+
).flatMap(([key, value]) => {
|
|
65
|
+
return propToMetaTag(key, value, { attr: "name" });
|
|
66
|
+
}).filter((tag) => !!tag);
|
|
67
|
+
if (metaProps.title) {
|
|
68
|
+
;
|
|
69
|
+
[metaProps.title].flat().reverse().map((title) => {
|
|
70
|
+
tags.unshift(/* @__PURE__ */ import_react.default.createElement("title", null, title));
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (metaProps.charSet) {
|
|
74
|
+
tags.push(/* @__PURE__ */ import_react.default.createElement("meta", { charSet: metaProps.charSet }));
|
|
75
|
+
}
|
|
76
|
+
if (metaProps.og) {
|
|
77
|
+
if (metaProps.title && !metaProps.og.title && metaProps.og.title !== null) {
|
|
78
|
+
tags.push(/* @__PURE__ */ import_react.default.createElement("meta", { property: "og:title", content: metaProps.title }));
|
|
79
|
+
}
|
|
80
|
+
if (metaProps.description && !metaProps.og.description && metaProps.og.description !== null) {
|
|
81
|
+
tags.push(
|
|
82
|
+
/* @__PURE__ */ import_react.default.createElement("meta", { property: "og:description", content: metaProps.description })
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
if (!metaProps.og.type && metaProps.og.type !== null) {
|
|
86
|
+
tags.push(/* @__PURE__ */ import_react.default.createElement("meta", { property: "og:type", content: "website" }));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return /* @__PURE__ */ import_react.default.createElement(Head, null, tags.map((tag, i) => import_react.default.cloneElement(tag, { key: i })), children);
|
|
90
|
+
};
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
Metadata
|
|
94
|
+
});
|
|
@@ -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,59 @@
|
|
|
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 PortalHead_exports = {};
|
|
30
|
+
__export(PortalHead_exports, {
|
|
31
|
+
default: () => PortalHead_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(PortalHead_exports);
|
|
34
|
+
var import_react = __toESM(require("react"), 1);
|
|
35
|
+
var import_react_dom = require("react-dom");
|
|
36
|
+
var import_ServerInject = require("./ServerInject.js");
|
|
37
|
+
function addDataAttributeMarker(children, marker = "data-rwjs-head") {
|
|
38
|
+
return import_react.default.Children.toArray(children).map((child, i) => {
|
|
39
|
+
return import_react.default.cloneElement(child, {
|
|
40
|
+
[marker]: true,
|
|
41
|
+
key: `${marker}-` + i
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const PortalHead = ({ children }) => {
|
|
46
|
+
const isServerRendering = typeof window === "undefined";
|
|
47
|
+
(0, import_ServerInject.useServerInsertedHTML)(() => {
|
|
48
|
+
return addDataAttributeMarker(children);
|
|
49
|
+
});
|
|
50
|
+
const shouldPortal = import_react.default.useRef(
|
|
51
|
+
isServerRendering ? false : document.readyState === "complete"
|
|
52
|
+
);
|
|
53
|
+
if (isServerRendering) {
|
|
54
|
+
return null;
|
|
55
|
+
} else {
|
|
56
|
+
return shouldPortal.current ? (0, import_react_dom.createPortal)(children, document.head) : null;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var PortalHead_default = PortalHead;
|
|
@@ -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;AAKzB,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,eAAO,MAAM,eAAe,GAAI,8BAG7B,oBAAoB,sBAuBtB,CAAA;AAED,OAAO,CAAC,MAAM,CAAC,GAAE"}
|