@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,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;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,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var 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 helmetPkg = __toESM(require("react-helmet-async"), 1);
|
|
36
|
+
var import_PortalHead = __toESM(require("./PortalHead.js"), 1);
|
|
37
|
+
const { Helmet: HelmetHead } = helmetPkg;
|
|
38
|
+
const MetaTags = (props) => {
|
|
39
|
+
const {
|
|
40
|
+
tag = "og:image",
|
|
41
|
+
ogType = "website",
|
|
42
|
+
ogContentUrl,
|
|
43
|
+
robots,
|
|
44
|
+
contentType,
|
|
45
|
+
ogWidth,
|
|
46
|
+
ogHeight,
|
|
47
|
+
ogUrl,
|
|
48
|
+
title,
|
|
49
|
+
locale,
|
|
50
|
+
description,
|
|
51
|
+
author,
|
|
52
|
+
children
|
|
53
|
+
} = props;
|
|
54
|
+
let Head = HelmetHead;
|
|
55
|
+
if (RWJS_ENV.RWJS_EXP_STREAMING_SSR) {
|
|
56
|
+
Head = import_PortalHead.default;
|
|
57
|
+
}
|
|
58
|
+
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(
|
|
59
|
+
"meta",
|
|
60
|
+
{
|
|
61
|
+
name: "robots",
|
|
62
|
+
content: Array.isArray(robots) ? robots.join(", ") : robots
|
|
63
|
+
}
|
|
64
|
+
)), children);
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
MetaTags
|
|
69
|
+
});
|
|
@@ -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,95 @@
|
|
|
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 helmetPkg = __toESM(require("react-helmet-async"), 1);
|
|
37
|
+
var import_PortalHead = __toESM(require("./PortalHead.js"), 1);
|
|
38
|
+
const { Helmet: HelmetHead } = helmetPkg;
|
|
39
|
+
const EXCLUDE_PROPS = ["charSet"];
|
|
40
|
+
const propToMetaTag = (parentKey, parentValue, options) => {
|
|
41
|
+
if (Array.isArray(parentValue)) {
|
|
42
|
+
return parentValue.flatMap((value) => {
|
|
43
|
+
return propToMetaTag(parentKey, value, options);
|
|
44
|
+
});
|
|
45
|
+
} else if (typeof parentValue === "object") {
|
|
46
|
+
return Object.entries(parentValue).filter(([_, v]) => v !== null).flatMap(([key, value]) => {
|
|
47
|
+
return propToMetaTag(`${parentKey}:${key}`, value, { attr: "property" });
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
const attributes = {
|
|
51
|
+
[options["attr"]]: parentKey,
|
|
52
|
+
content: parentValue
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ import_react.default.createElement("meta", { ...attributes });
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const Metadata = (props) => {
|
|
58
|
+
const { children, ...metaProps } = props;
|
|
59
|
+
let Head = HelmetHead;
|
|
60
|
+
if (RWJS_ENV.RWJS_EXP_STREAMING_SSR) {
|
|
61
|
+
Head = import_PortalHead.default;
|
|
62
|
+
}
|
|
63
|
+
const tags = Object.entries(metaProps).filter(
|
|
64
|
+
([key, value]) => !EXCLUDE_PROPS.includes(key) && value !== null && (key !== "og" || value !== true)
|
|
65
|
+
).flatMap(([key, value]) => {
|
|
66
|
+
return propToMetaTag(key, value, { attr: "name" });
|
|
67
|
+
}).filter((tag) => !!tag);
|
|
68
|
+
if (metaProps.title) {
|
|
69
|
+
;
|
|
70
|
+
[metaProps.title].flat().reverse().map((title) => {
|
|
71
|
+
tags.unshift(/* @__PURE__ */ import_react.default.createElement("title", null, title));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (metaProps.charSet) {
|
|
75
|
+
tags.push(/* @__PURE__ */ import_react.default.createElement("meta", { charSet: metaProps.charSet }));
|
|
76
|
+
}
|
|
77
|
+
if (metaProps.og) {
|
|
78
|
+
if (metaProps.title && !metaProps.og.title && metaProps.og.title !== null) {
|
|
79
|
+
tags.push(/* @__PURE__ */ import_react.default.createElement("meta", { property: "og:title", content: metaProps.title }));
|
|
80
|
+
}
|
|
81
|
+
if (metaProps.description && !metaProps.og.description && metaProps.og.description !== null) {
|
|
82
|
+
tags.push(
|
|
83
|
+
/* @__PURE__ */ import_react.default.createElement("meta", { property: "og:description", content: metaProps.description })
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
if (!metaProps.og.type && metaProps.og.type !== null) {
|
|
87
|
+
tags.push(/* @__PURE__ */ import_react.default.createElement("meta", { property: "og:type", content: "website" }));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return /* @__PURE__ */ import_react.default.createElement(Head, null, tags.map((tag, i) => import_react.default.cloneElement(tag, { key: i })), children);
|
|
91
|
+
};
|
|
92
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
93
|
+
0 && (module.exports = {
|
|
94
|
+
Metadata
|
|
95
|
+
});
|
|
@@ -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;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,58 @@
|
|
|
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 RedwoodProvider_exports = {};
|
|
30
|
+
__export(RedwoodProvider_exports, {
|
|
31
|
+
RedwoodProvider: () => RedwoodProvider
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(RedwoodProvider_exports);
|
|
34
|
+
var import_react = __toESM(require("react"), 1);
|
|
35
|
+
var helmetPkg = __toESM(require("react-helmet-async"), 1);
|
|
36
|
+
const { Helmet, HelmetProvider } = helmetPkg;
|
|
37
|
+
const RedwoodProvider = ({
|
|
38
|
+
children,
|
|
39
|
+
titleTemplate
|
|
40
|
+
}) => {
|
|
41
|
+
const appTitle = globalThis.__REDWOOD__APP_TITLE;
|
|
42
|
+
const template = () => {
|
|
43
|
+
if (titleTemplate) {
|
|
44
|
+
let template2 = titleTemplate.replace(/%AppTitle/g, appTitle);
|
|
45
|
+
template2 = template2.replace(/%PageTitle/g, "%s");
|
|
46
|
+
return template2;
|
|
47
|
+
}
|
|
48
|
+
return "";
|
|
49
|
+
};
|
|
50
|
+
if (RWJS_ENV.RWJS_EXP_STREAMING_SSR) {
|
|
51
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, children);
|
|
52
|
+
}
|
|
53
|
+
return /* @__PURE__ */ import_react.default.createElement(HelmetProvider, { context: globalThis.__REDWOOD__HELMET_CONTEXT }, /* @__PURE__ */ import_react.default.createElement(Helmet, { titleTemplate: template(), defaultTitle: appTitle }, /* @__PURE__ */ import_react.default.createElement("title", null, appTitle)), children);
|
|
54
|
+
};
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
RedwoodProvider
|
|
58
|
+
});
|
|
@@ -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"}
|