@prismicio/react 2.5.1 → 2.6.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/PrismicImage.cjs +7 -11
  2. package/dist/PrismicImage.cjs.map +1 -1
  3. package/dist/PrismicImage.d.ts +162 -163
  4. package/dist/PrismicImage.js +6 -10
  5. package/dist/PrismicImage.js.map +1 -1
  6. package/dist/PrismicLink.cjs +4 -66
  7. package/dist/PrismicLink.cjs.map +1 -1
  8. package/dist/PrismicLink.d.ts +6 -105
  9. package/dist/PrismicLink.js +4 -65
  10. package/dist/PrismicLink.js.map +1 -1
  11. package/dist/PrismicProvider.cjs.map +1 -1
  12. package/dist/PrismicProvider.d.ts +83 -84
  13. package/dist/PrismicProvider.js.map +1 -1
  14. package/dist/PrismicRichText.cjs +4 -71
  15. package/dist/PrismicRichText.cjs.map +1 -1
  16. package/dist/PrismicRichText.d.ts +4 -116
  17. package/dist/PrismicRichText.js +5 -70
  18. package/dist/PrismicRichText.js.map +1 -1
  19. package/dist/PrismicText.cjs +4 -4
  20. package/dist/PrismicText.cjs.map +1 -1
  21. package/dist/PrismicText.d.ts +39 -39
  22. package/dist/PrismicText.js +3 -3
  23. package/dist/PrismicText.js.map +1 -1
  24. package/dist/PrismicToolbar.cjs +6 -4
  25. package/dist/PrismicToolbar.cjs.map +1 -1
  26. package/dist/PrismicToolbar.d.ts +23 -21
  27. package/dist/PrismicToolbar.js +6 -4
  28. package/dist/PrismicToolbar.js.map +1 -1
  29. package/dist/SliceZone.cjs +4 -17
  30. package/dist/SliceZone.cjs.map +1 -1
  31. package/dist/SliceZone.d.ts +127 -188
  32. package/dist/SliceZone.js +4 -17
  33. package/dist/SliceZone.js.map +1 -1
  34. package/dist/clientHooks.d.ts +357 -357
  35. package/dist/index.cjs +0 -2
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.ts +21 -46
  38. package/dist/index.js +1 -4
  39. package/dist/index.js.map +1 -1
  40. package/dist/lib/__PRODUCTION__.d.ts +7 -7
  41. package/dist/lib/devMsg.d.ts +16 -16
  42. package/dist/lib/invariant.d.ts +24 -24
  43. package/dist/lib/isInternalURL.d.ts +8 -8
  44. package/dist/lib/pascalCase.d.ts +26 -26
  45. package/dist/package.json.cjs +1 -1
  46. package/dist/package.json.js +1 -1
  47. package/dist/react-server/PrismicLink.cjs +59 -0
  48. package/dist/react-server/PrismicLink.cjs.map +1 -0
  49. package/dist/react-server/PrismicLink.d.ts +72 -0
  50. package/dist/react-server/PrismicLink.js +42 -0
  51. package/dist/react-server/PrismicLink.js.map +1 -0
  52. package/dist/react-server/PrismicRichText.cjs +92 -0
  53. package/dist/react-server/PrismicRichText.cjs.map +1 -0
  54. package/dist/react-server/PrismicRichText.d.ts +104 -0
  55. package/dist/react-server/PrismicRichText.js +73 -0
  56. package/dist/react-server/PrismicRichText.js.map +1 -0
  57. package/dist/react-server/index.d.ts +4 -0
  58. package/dist/react-server/unsupported.cjs +97 -0
  59. package/dist/react-server/unsupported.cjs.map +1 -0
  60. package/dist/react-server/unsupported.d.ts +22 -0
  61. package/dist/react-server/unsupported.js +97 -0
  62. package/dist/react-server/unsupported.js.map +1 -0
  63. package/dist/react-server.cjs +44 -0
  64. package/dist/react-server.cjs.map +1 -0
  65. package/dist/react-server.js +41 -0
  66. package/dist/react-server.js.map +1 -0
  67. package/dist/types.d.ts +19 -19
  68. package/dist/usePrismicClient.d.ts +11 -11
  69. package/dist/usePrismicContext.d.ts +8 -8
  70. package/dist/usePrismicPreviewResolver.d.ts +45 -45
  71. package/dist/useStatefulPrismicClientMethod.cjs +6 -0
  72. package/dist/useStatefulPrismicClientMethod.cjs.map +1 -1
  73. package/dist/useStatefulPrismicClientMethod.d.ts +44 -44
  74. package/dist/useStatefulPrismicClientMethod.js +6 -0
  75. package/dist/useStatefulPrismicClientMethod.js.map +1 -1
  76. package/package.json +42 -47
  77. package/src/PrismicImage.tsx +30 -37
  78. package/src/PrismicLink.tsx +29 -259
  79. package/src/PrismicProvider.tsx +9 -8
  80. package/src/PrismicRichText.tsx +28 -275
  81. package/src/PrismicText.tsx +4 -5
  82. package/src/PrismicToolbar.tsx +7 -6
  83. package/src/SliceZone.tsx +8 -129
  84. package/src/index.ts +1 -9
  85. package/src/react-server/PrismicLink.tsx +179 -0
  86. package/src/react-server/PrismicRichText.tsx +267 -0
  87. package/src/react-server/index.ts +38 -0
  88. package/src/react-server/unsupported.ts +98 -0
  89. package/dist/lib/pascalCase.cjs +0 -10
  90. package/dist/lib/pascalCase.cjs.map +0 -1
  91. package/dist/lib/pascalCase.js +0 -10
  92. package/dist/lib/pascalCase.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicRichText.cjs","sources":["../../../src/react-server/PrismicRichText.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as prismic from \"@prismicio/client\";\nimport * as prismicR from \"@prismicio/richtext\";\n\nimport { JSXFunctionSerializer, JSXMapSerializer } from \"../types\";\nimport { LinkProps, PrismicLink } from \"./PrismicLink\";\n\n/**\n * Props for `<PrismicRichText>`.\n */\nexport type PrismicRichTextProps<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tLinkResolverFunction extends prismic.LinkResolverFunction<any> = prismic.LinkResolverFunction,\n> = {\n\t/**\n\t * The Prismic Rich Text field to render.\n\t */\n\tfield: prismic.RichTextField | null | undefined;\n\n\t/**\n\t * The Link Resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses Route Resolvers when querying for your Prismic\n\t * repository's content, a Link Resolver does not need to be provided.\n\t * @see Learn about Link Resolvers and Route Resolvers {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction;\n\n\t/**\n\t * A map or function that maps a Rich Text block to a React component.\n\t *\n\t * @remarks\n\t * Prefer using a map serializer over the function serializer when possible.\n\t * The map serializer is simpler to maintain.\n\t * @example A map serializer.\n\t *\n\t * ```jsx\n\t * {\n\t * heading1: ({children}) => <Heading>{children}</Heading>\n\t * }\n\t * ```\n\t *\n\t * @example A function serializer.\n\t *\n\t * ```jsx\n\t * (type, node, content, children) => {\n\t * \tswitch (type) {\n\t * \t\tcase \"heading1\": {\n\t * \t\t\treturn <Heading>{children}</Heading>;\n\t * \t\t}\n\t * \t}\n\t * };\n\t * ```\n\t */\n\tcomponents?: JSXMapSerializer | JSXFunctionSerializer;\n\n\t/**\n\t * The React component rendered for links when the URL is internal.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\tinternalLinkComponent?: React.ComponentType<LinkProps>;\n\n\t/**\n\t * The React component rendered for links when the URL is external.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\texternalLinkComponent?: React.ComponentType<LinkProps>;\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` will be rendered.\n\t */\n\tfallback?: React.ReactNode;\n};\n\ntype CreateDefaultSerializerArgs<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tLinkResolverFunction extends prismic.LinkResolverFunction<any> = prismic.LinkResolverFunction,\n> = {\n\tlinkResolver: LinkResolverFunction | undefined;\n\tinternalLinkComponent?: React.ComponentType<LinkProps>;\n\texternalLinkComponent?: React.ComponentType<LinkProps>;\n};\n\nconst createDefaultSerializer = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tLinkResolverFunction extends prismic.LinkResolverFunction<any>,\n>(\n\targs: CreateDefaultSerializerArgs<LinkResolverFunction>,\n): JSXFunctionSerializer =>\n\tprismicR.wrapMapSerializer({\n\t\theading1: ({ children, key }) => <h1 key={key}>{children}</h1>,\n\t\theading2: ({ children, key }) => <h2 key={key}>{children}</h2>,\n\t\theading3: ({ children, key }) => <h3 key={key}>{children}</h3>,\n\t\theading4: ({ children, key }) => <h4 key={key}>{children}</h4>,\n\t\theading5: ({ children, key }) => <h5 key={key}>{children}</h5>,\n\t\theading6: ({ children, key }) => <h6 key={key}>{children}</h6>,\n\t\tparagraph: ({ children, key }) => <p key={key}>{children}</p>,\n\t\tpreformatted: ({ node, key }) => <pre key={key}>{node.text}</pre>,\n\t\tstrong: ({ children, key }) => <strong key={key}>{children}</strong>,\n\t\tem: ({ children, key }) => <em key={key}>{children}</em>,\n\t\tlistItem: ({ children, key }) => <li key={key}>{children}</li>,\n\t\toListItem: ({ children, key }) => <li key={key}>{children}</li>,\n\t\tlist: ({ children, key }) => <ul key={key}>{children}</ul>,\n\t\toList: ({ children, key }) => <ol key={key}>{children}</ol>,\n\t\timage: ({ node, key }) => {\n\t\t\tconst img = (\n\t\t\t\t<img\n\t\t\t\t\tsrc={node.url}\n\t\t\t\t\talt={node.alt ?? undefined}\n\t\t\t\t\tdata-copyright={node.copyright ? node.copyright : undefined}\n\t\t\t\t/>\n\t\t\t);\n\n\t\t\treturn (\n\t\t\t\t<p key={key} className=\"block-img\">\n\t\t\t\t\t{node.linkTo ? (\n\t\t\t\t\t\t<PrismicLink\n\t\t\t\t\t\t\tlinkResolver={args.linkResolver}\n\t\t\t\t\t\t\tinternalComponent={args.internalLinkComponent}\n\t\t\t\t\t\t\texternalComponent={args.externalLinkComponent}\n\t\t\t\t\t\t\tfield={node.linkTo}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{img}\n\t\t\t\t\t\t</PrismicLink>\n\t\t\t\t\t) : (\n\t\t\t\t\t\timg\n\t\t\t\t\t)}\n\t\t\t\t</p>\n\t\t\t);\n\t\t},\n\t\tembed: ({ node, key }) => (\n\t\t\t<div\n\t\t\t\tkey={key}\n\t\t\t\tdata-oembed={node.oembed.embed_url}\n\t\t\t\tdata-oembed-type={node.oembed.type}\n\t\t\t\tdata-oembed-provider={node.oembed.provider_name}\n\t\t\t\tdangerouslySetInnerHTML={{ __html: node.oembed.html ?? \"\" }}\n\t\t\t/>\n\t\t),\n\t\thyperlink: ({ node, children, key }) => (\n\t\t\t<PrismicLink\n\t\t\t\tkey={key}\n\t\t\t\tfield={node.data}\n\t\t\t\tlinkResolver={args.linkResolver}\n\t\t\t\tinternalComponent={args.internalLinkComponent}\n\t\t\t\texternalComponent={args.externalLinkComponent}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</PrismicLink>\n\t\t),\n\t\tlabel: ({ node, children, key }) => (\n\t\t\t<span key={key} className={node.data.label}>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t),\n\t\tspan: ({ text, key }) => {\n\t\t\tconst result: React.ReactNode[] = [];\n\n\t\t\tlet i = 0;\n\t\t\tfor (const line of text.split(\"\\n\")) {\n\t\t\t\tif (i > 0) {\n\t\t\t\t\tresult.push(<br key={`${i}__break`} />);\n\t\t\t\t}\n\n\t\t\t\tresult.push(<React.Fragment key={`${i}__line`}>{line}</React.Fragment>);\n\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\treturn <React.Fragment key={key}>{result}</React.Fragment>;\n\t\t},\n\t});\n\n/**\n * React component that renders content from a Prismic Rich Text field. By\n * default, HTML elements are rendered for each piece of content. A `heading1`\n * block will render an `<h1>` HTML element, for example. Links will use\n * `<PrismicLink>` by default which can be customized using the\n * `internalLinkComponent` and `externalLinkComponent` props.\n *\n * To customize the components that are rendered, provide a map or function\n * serializer to the `components` prop.\n *\n * @remarks\n * This component returns a React fragment with no wrapping element around the\n * content. If you need a wrapper, add a component around `<PrismicRichText>`.\n * @example Rendering a Rich Text field using the default HTMl elements.\n *\n * ```jsx\n * <PrismicRichText field={document.data.content} />;\n * ```\n *\n * @example Rendering a Rich Text field using a custom set of React components.\n *\n * ```jsx\n * <PrismicRichText\n * \tfield={document.data.content}\n * \tcomponents={{\n * \t\theading1: ({ children }) => <Heading>{children}</Heading>,\n * \t}}\n * />;\n * ```\n *\n * @param props - Props for the component.\n *\n * @returns The Rich Text field's content as React components.\n *\n * @see Learn about Rich Text fields {@link https://prismic.io/docs/core-concepts/rich-text-title}\n * @see Learn about Rich Text serializers {@link https://prismic.io/docs/core-concepts/html-serializer}\n */\nexport function PrismicRichText<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tLinkResolverFunction extends prismic.LinkResolverFunction<any>,\n>({\n\tlinkResolver,\n\tfield,\n\tfallback,\n\tcomponents,\n\texternalLinkComponent,\n\tinternalLinkComponent,\n}: PrismicRichTextProps<LinkResolverFunction>): JSX.Element | null {\n\treturn React.useMemo(() => {\n\t\tif (prismic.isFilled.richText(field)) {\n\t\t\tconst serializer = prismicR.composeSerializers(\n\t\t\t\ttypeof components === \"object\"\n\t\t\t\t\t? prismicR.wrapMapSerializer(components)\n\t\t\t\t\t: components,\n\t\t\t\tcreateDefaultSerializer({\n\t\t\t\t\tlinkResolver,\n\t\t\t\t\tinternalLinkComponent,\n\t\t\t\t\texternalLinkComponent,\n\t\t\t\t}),\n\t\t\t);\n\n\t\t\t// The serializer is wrapped in a higher-order function\n\t\t\t// that automatically applies a key to React Elements\n\t\t\t// if one is not already given.\n\t\t\tconst serialized = prismicR.serialize<JSX.Element>(\n\t\t\t\tfield,\n\t\t\t\t(type, node, text, children, key) => {\n\t\t\t\t\tconst result = serializer(type, node, text, children, key);\n\n\t\t\t\t\tif (React.isValidElement(result) && result.key == null) {\n\t\t\t\t\t\treturn React.cloneElement(result, { key });\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn <>{serialized}</>;\n\t\t} else {\n\t\t\treturn fallback != null ? <>{fallback}</> : null;\n\t\t}\n\t}, [\n\t\tfield,\n\t\tinternalLinkComponent,\n\t\texternalLinkComponent,\n\t\tcomponents,\n\t\tlinkResolver,\n\t\tfallback,\n\t]);\n}\n"],"names":["prismicR","jsx","PrismicLink","React","prismic","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuFA,MAAM,0BAA0B,CAI/B,SAEAA,oBAAS,kBAAkB;AAAA,EAC1B,UAAU,CAAC,EAAE,UAAU,IAAU,MAAAC,2BAAA,IAAC,MAAc,EAAA,SAAA,GAAN,GAAe;AAAA,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A,IAAAE,iBAAM,UAAN,EAA0B,oBAAN,GAAa;AAAA,EAC1C;AACA,CAAA;AAuCc,SAAA,gBAGd,EACD,cACA,OACA,UACA,YACA,uBACA,yBAC4C;AACrC,SAAAA,iBAAM,QAAQ,MAAK;AACzB,QAAIC,mBAAQ,SAAS,SAAS,KAAK,GAAG;AAC/B,YAAA,aAAaJ,oBAAS,mBAC3B,OAAO,eAAe,WACnBA,oBAAS,kBAAkB,UAAU,IACrC,YACH,wBAAwB;AAAA,QACvB;AAAA,QACA;AAAA,QACA;AAAA,MACA,CAAA,CAAC;AAMG,YAAA,aAAaA,oBAAS,UAC3B,OACA,CAAC,MAAM,MAAM,MAAM,UAAU,QAAO;AACnC,cAAM,SAAS,WAAW,MAAM,MAAM,MAAM,UAAU,GAAG;AAEzD,YAAIG,iBAAM,eAAe,MAAM,KAAK,OAAO,OAAO,MAAM;AACvD,iBAAOA,iBAAM,aAAa,QAAQ,EAAE,IAAK,CAAA;AAAA,QAAA,OACnC;AACC,iBAAA;AAAA,QACP;AAAA,MAAA,CACD;AAGF,mEAAU,UAAW,WAAA,CAAA;AAAA,IAAA,OACf;AACN,aAAO,YAAY,OAAUF,+BAAAI,WAAAA,UAAA,EAAA,UAAA,UAAS,IAAM;AAAA,IAC5C;AAAA,EAAA,GACC;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACA;AACF;;"}
@@ -0,0 +1,104 @@
1
+ import * as React from "react";
2
+ import * as prismic from "@prismicio/client";
3
+ import { JSXFunctionSerializer, JSXMapSerializer } from "../types";
4
+ import { LinkProps } from "./PrismicLink";
5
+ /**
6
+ * Props for `<PrismicRichText>`.
7
+ */
8
+ export type PrismicRichTextProps<LinkResolverFunction extends prismic.LinkResolverFunction<any> = prismic.LinkResolverFunction> = {
9
+ /**
10
+ * The Prismic Rich Text field to render.
11
+ */
12
+ field: prismic.RichTextField | null | undefined;
13
+ /**
14
+ * The Link Resolver used to resolve links.
15
+ *
16
+ * @remarks
17
+ * If your app uses Route Resolvers when querying for your Prismic
18
+ * repository's content, a Link Resolver does not need to be provided.
19
+ * @see Learn about Link Resolvers and Route Resolvers {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}
20
+ */
21
+ linkResolver?: LinkResolverFunction;
22
+ /**
23
+ * A map or function that maps a Rich Text block to a React component.
24
+ *
25
+ * @remarks
26
+ * Prefer using a map serializer over the function serializer when possible.
27
+ * The map serializer is simpler to maintain.
28
+ * @example A map serializer.
29
+ *
30
+ * ```jsx
31
+ * {
32
+ * heading1: ({children}) => <Heading>{children}</Heading>
33
+ * }
34
+ * ```
35
+ *
36
+ * @example A function serializer.
37
+ *
38
+ * ```jsx
39
+ * (type, node, content, children) => {
40
+ * switch (type) {
41
+ * case "heading1": {
42
+ * return <Heading>{children}</Heading>;
43
+ * }
44
+ * }
45
+ * };
46
+ * ```
47
+ */
48
+ components?: JSXMapSerializer | JSXFunctionSerializer;
49
+ /**
50
+ * The React component rendered for links when the URL is internal.
51
+ *
52
+ * @defaultValue `<a>`
53
+ */
54
+ internalLinkComponent?: React.ComponentType<LinkProps>;
55
+ /**
56
+ * The React component rendered for links when the URL is external.
57
+ *
58
+ * @defaultValue `<a>`
59
+ */
60
+ externalLinkComponent?: React.ComponentType<LinkProps>;
61
+ /**
62
+ * The value to be rendered when the field is empty. If a fallback is not
63
+ * given, `null` will be rendered.
64
+ */
65
+ fallback?: React.ReactNode;
66
+ };
67
+ /**
68
+ * React component that renders content from a Prismic Rich Text field. By
69
+ * default, HTML elements are rendered for each piece of content. A `heading1`
70
+ * block will render an `<h1>` HTML element, for example. Links will use
71
+ * `<PrismicLink>` by default which can be customized using the
72
+ * `internalLinkComponent` and `externalLinkComponent` props.
73
+ *
74
+ * To customize the components that are rendered, provide a map or function
75
+ * serializer to the `components` prop.
76
+ *
77
+ * @remarks
78
+ * This component returns a React fragment with no wrapping element around the
79
+ * content. If you need a wrapper, add a component around `<PrismicRichText>`.
80
+ * @example Rendering a Rich Text field using the default HTMl elements.
81
+ *
82
+ * ```jsx
83
+ * <PrismicRichText field={document.data.content} />;
84
+ * ```
85
+ *
86
+ * @example Rendering a Rich Text field using a custom set of React components.
87
+ *
88
+ * ```jsx
89
+ * <PrismicRichText
90
+ * field={document.data.content}
91
+ * components={{
92
+ * heading1: ({ children }) => <Heading>{children}</Heading>,
93
+ * }}
94
+ * />;
95
+ * ```
96
+ *
97
+ * @param props - Props for the component.
98
+ *
99
+ * @returns The Rich Text field's content as React components.
100
+ *
101
+ * @see Learn about Rich Text fields {@link https://prismic.io/docs/core-concepts/rich-text-title}
102
+ * @see Learn about Rich Text serializers {@link https://prismic.io/docs/core-concepts/html-serializer}
103
+ */
104
+ export declare function PrismicRichText<LinkResolverFunction extends prismic.LinkResolverFunction<any>>({ linkResolver, field, fallback, components, externalLinkComponent, internalLinkComponent, }: PrismicRichTextProps<LinkResolverFunction>): JSX.Element | null;
@@ -0,0 +1,73 @@
1
+ import { jsx, Fragment } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import * as prismic from "@prismicio/client";
4
+ import * as prismicR from "@prismicio/richtext";
5
+ import { PrismicLink } from "./PrismicLink.js";
6
+ const createDefaultSerializer = (args) => prismicR.wrapMapSerializer({
7
+ heading1: ({ children, key }) => /* @__PURE__ */ jsx("h1", { children }, key),
8
+ heading2: ({ children, key }) => /* @__PURE__ */ jsx("h2", { children }, key),
9
+ heading3: ({ children, key }) => /* @__PURE__ */ jsx("h3", { children }, key),
10
+ heading4: ({ children, key }) => /* @__PURE__ */ jsx("h4", { children }, key),
11
+ heading5: ({ children, key }) => /* @__PURE__ */ jsx("h5", { children }, key),
12
+ heading6: ({ children, key }) => /* @__PURE__ */ jsx("h6", { children }, key),
13
+ paragraph: ({ children, key }) => /* @__PURE__ */ jsx("p", { children }, key),
14
+ preformatted: ({ node, key }) => /* @__PURE__ */ jsx("pre", { children: node.text }, key),
15
+ strong: ({ children, key }) => /* @__PURE__ */ jsx("strong", { children }, key),
16
+ em: ({ children, key }) => /* @__PURE__ */ jsx("em", { children }, key),
17
+ listItem: ({ children, key }) => /* @__PURE__ */ jsx("li", { children }, key),
18
+ oListItem: ({ children, key }) => /* @__PURE__ */ jsx("li", { children }, key),
19
+ list: ({ children, key }) => /* @__PURE__ */ jsx("ul", { children }, key),
20
+ oList: ({ children, key }) => /* @__PURE__ */ jsx("ol", { children }, key),
21
+ image: ({ node, key }) => {
22
+ const img = /* @__PURE__ */ jsx("img", { src: node.url, alt: node.alt ?? void 0, "data-copyright": node.copyright ? node.copyright : void 0 });
23
+ return /* @__PURE__ */ jsx("p", { className: "block-img", children: node.linkTo ? /* @__PURE__ */ jsx(PrismicLink, { linkResolver: args.linkResolver, internalComponent: args.internalLinkComponent, externalComponent: args.externalLinkComponent, field: node.linkTo, children: img }) : img }, key);
24
+ },
25
+ embed: ({ node, key }) => /* @__PURE__ */ jsx("div", { "data-oembed": node.oembed.embed_url, "data-oembed-type": node.oembed.type, "data-oembed-provider": node.oembed.provider_name, dangerouslySetInnerHTML: { __html: node.oembed.html ?? "" } }, key),
26
+ hyperlink: ({ node, children, key }) => /* @__PURE__ */ jsx(PrismicLink, { field: node.data, linkResolver: args.linkResolver, internalComponent: args.internalLinkComponent, externalComponent: args.externalLinkComponent, children }, key),
27
+ label: ({ node, children, key }) => /* @__PURE__ */ jsx("span", { className: node.data.label, children }, key),
28
+ span: ({ text, key }) => {
29
+ const result = [];
30
+ let i = 0;
31
+ for (const line of text.split("\n")) {
32
+ if (i > 0) {
33
+ result.push(/* @__PURE__ */ jsx("br", {}, `${i}__break`));
34
+ }
35
+ result.push(/* @__PURE__ */ jsx(React.Fragment, { children: line }, `${i}__line`));
36
+ i++;
37
+ }
38
+ return /* @__PURE__ */ jsx(React.Fragment, { children: result }, key);
39
+ }
40
+ });
41
+ function PrismicRichText({ linkResolver, field, fallback, components, externalLinkComponent, internalLinkComponent }) {
42
+ return React.useMemo(() => {
43
+ if (prismic.isFilled.richText(field)) {
44
+ const serializer = prismicR.composeSerializers(typeof components === "object" ? prismicR.wrapMapSerializer(components) : components, createDefaultSerializer({
45
+ linkResolver,
46
+ internalLinkComponent,
47
+ externalLinkComponent
48
+ }));
49
+ const serialized = prismicR.serialize(field, (type, node, text, children, key) => {
50
+ const result = serializer(type, node, text, children, key);
51
+ if (React.isValidElement(result) && result.key == null) {
52
+ return React.cloneElement(result, { key });
53
+ } else {
54
+ return result;
55
+ }
56
+ });
57
+ return /* @__PURE__ */ jsx(Fragment, { children: serialized });
58
+ } else {
59
+ return fallback != null ? /* @__PURE__ */ jsx(Fragment, { children: fallback }) : null;
60
+ }
61
+ }, [
62
+ field,
63
+ internalLinkComponent,
64
+ externalLinkComponent,
65
+ components,
66
+ linkResolver,
67
+ fallback
68
+ ]);
69
+ }
70
+ export {
71
+ PrismicRichText
72
+ };
73
+ //# sourceMappingURL=PrismicRichText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicRichText.js","sources":["../../../src/react-server/PrismicRichText.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as prismic from \"@prismicio/client\";\nimport * as prismicR from \"@prismicio/richtext\";\n\nimport { JSXFunctionSerializer, JSXMapSerializer } from \"../types\";\nimport { LinkProps, PrismicLink } from \"./PrismicLink\";\n\n/**\n * Props for `<PrismicRichText>`.\n */\nexport type PrismicRichTextProps<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tLinkResolverFunction extends prismic.LinkResolverFunction<any> = prismic.LinkResolverFunction,\n> = {\n\t/**\n\t * The Prismic Rich Text field to render.\n\t */\n\tfield: prismic.RichTextField | null | undefined;\n\n\t/**\n\t * The Link Resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses Route Resolvers when querying for your Prismic\n\t * repository's content, a Link Resolver does not need to be provided.\n\t * @see Learn about Link Resolvers and Route Resolvers {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction;\n\n\t/**\n\t * A map or function that maps a Rich Text block to a React component.\n\t *\n\t * @remarks\n\t * Prefer using a map serializer over the function serializer when possible.\n\t * The map serializer is simpler to maintain.\n\t * @example A map serializer.\n\t *\n\t * ```jsx\n\t * {\n\t * heading1: ({children}) => <Heading>{children}</Heading>\n\t * }\n\t * ```\n\t *\n\t * @example A function serializer.\n\t *\n\t * ```jsx\n\t * (type, node, content, children) => {\n\t * \tswitch (type) {\n\t * \t\tcase \"heading1\": {\n\t * \t\t\treturn <Heading>{children}</Heading>;\n\t * \t\t}\n\t * \t}\n\t * };\n\t * ```\n\t */\n\tcomponents?: JSXMapSerializer | JSXFunctionSerializer;\n\n\t/**\n\t * The React component rendered for links when the URL is internal.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\tinternalLinkComponent?: React.ComponentType<LinkProps>;\n\n\t/**\n\t * The React component rendered for links when the URL is external.\n\t *\n\t * @defaultValue `<a>`\n\t */\n\texternalLinkComponent?: React.ComponentType<LinkProps>;\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` will be rendered.\n\t */\n\tfallback?: React.ReactNode;\n};\n\ntype CreateDefaultSerializerArgs<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tLinkResolverFunction extends prismic.LinkResolverFunction<any> = prismic.LinkResolverFunction,\n> = {\n\tlinkResolver: LinkResolverFunction | undefined;\n\tinternalLinkComponent?: React.ComponentType<LinkProps>;\n\texternalLinkComponent?: React.ComponentType<LinkProps>;\n};\n\nconst createDefaultSerializer = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tLinkResolverFunction extends prismic.LinkResolverFunction<any>,\n>(\n\targs: CreateDefaultSerializerArgs<LinkResolverFunction>,\n): JSXFunctionSerializer =>\n\tprismicR.wrapMapSerializer({\n\t\theading1: ({ children, key }) => <h1 key={key}>{children}</h1>,\n\t\theading2: ({ children, key }) => <h2 key={key}>{children}</h2>,\n\t\theading3: ({ children, key }) => <h3 key={key}>{children}</h3>,\n\t\theading4: ({ children, key }) => <h4 key={key}>{children}</h4>,\n\t\theading5: ({ children, key }) => <h5 key={key}>{children}</h5>,\n\t\theading6: ({ children, key }) => <h6 key={key}>{children}</h6>,\n\t\tparagraph: ({ children, key }) => <p key={key}>{children}</p>,\n\t\tpreformatted: ({ node, key }) => <pre key={key}>{node.text}</pre>,\n\t\tstrong: ({ children, key }) => <strong key={key}>{children}</strong>,\n\t\tem: ({ children, key }) => <em key={key}>{children}</em>,\n\t\tlistItem: ({ children, key }) => <li key={key}>{children}</li>,\n\t\toListItem: ({ children, key }) => <li key={key}>{children}</li>,\n\t\tlist: ({ children, key }) => <ul key={key}>{children}</ul>,\n\t\toList: ({ children, key }) => <ol key={key}>{children}</ol>,\n\t\timage: ({ node, key }) => {\n\t\t\tconst img = (\n\t\t\t\t<img\n\t\t\t\t\tsrc={node.url}\n\t\t\t\t\talt={node.alt ?? undefined}\n\t\t\t\t\tdata-copyright={node.copyright ? node.copyright : undefined}\n\t\t\t\t/>\n\t\t\t);\n\n\t\t\treturn (\n\t\t\t\t<p key={key} className=\"block-img\">\n\t\t\t\t\t{node.linkTo ? (\n\t\t\t\t\t\t<PrismicLink\n\t\t\t\t\t\t\tlinkResolver={args.linkResolver}\n\t\t\t\t\t\t\tinternalComponent={args.internalLinkComponent}\n\t\t\t\t\t\t\texternalComponent={args.externalLinkComponent}\n\t\t\t\t\t\t\tfield={node.linkTo}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{img}\n\t\t\t\t\t\t</PrismicLink>\n\t\t\t\t\t) : (\n\t\t\t\t\t\timg\n\t\t\t\t\t)}\n\t\t\t\t</p>\n\t\t\t);\n\t\t},\n\t\tembed: ({ node, key }) => (\n\t\t\t<div\n\t\t\t\tkey={key}\n\t\t\t\tdata-oembed={node.oembed.embed_url}\n\t\t\t\tdata-oembed-type={node.oembed.type}\n\t\t\t\tdata-oembed-provider={node.oembed.provider_name}\n\t\t\t\tdangerouslySetInnerHTML={{ __html: node.oembed.html ?? \"\" }}\n\t\t\t/>\n\t\t),\n\t\thyperlink: ({ node, children, key }) => (\n\t\t\t<PrismicLink\n\t\t\t\tkey={key}\n\t\t\t\tfield={node.data}\n\t\t\t\tlinkResolver={args.linkResolver}\n\t\t\t\tinternalComponent={args.internalLinkComponent}\n\t\t\t\texternalComponent={args.externalLinkComponent}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</PrismicLink>\n\t\t),\n\t\tlabel: ({ node, children, key }) => (\n\t\t\t<span key={key} className={node.data.label}>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t),\n\t\tspan: ({ text, key }) => {\n\t\t\tconst result: React.ReactNode[] = [];\n\n\t\t\tlet i = 0;\n\t\t\tfor (const line of text.split(\"\\n\")) {\n\t\t\t\tif (i > 0) {\n\t\t\t\t\tresult.push(<br key={`${i}__break`} />);\n\t\t\t\t}\n\n\t\t\t\tresult.push(<React.Fragment key={`${i}__line`}>{line}</React.Fragment>);\n\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\treturn <React.Fragment key={key}>{result}</React.Fragment>;\n\t\t},\n\t});\n\n/**\n * React component that renders content from a Prismic Rich Text field. By\n * default, HTML elements are rendered for each piece of content. A `heading1`\n * block will render an `<h1>` HTML element, for example. Links will use\n * `<PrismicLink>` by default which can be customized using the\n * `internalLinkComponent` and `externalLinkComponent` props.\n *\n * To customize the components that are rendered, provide a map or function\n * serializer to the `components` prop.\n *\n * @remarks\n * This component returns a React fragment with no wrapping element around the\n * content. If you need a wrapper, add a component around `<PrismicRichText>`.\n * @example Rendering a Rich Text field using the default HTMl elements.\n *\n * ```jsx\n * <PrismicRichText field={document.data.content} />;\n * ```\n *\n * @example Rendering a Rich Text field using a custom set of React components.\n *\n * ```jsx\n * <PrismicRichText\n * \tfield={document.data.content}\n * \tcomponents={{\n * \t\theading1: ({ children }) => <Heading>{children}</Heading>,\n * \t}}\n * />;\n * ```\n *\n * @param props - Props for the component.\n *\n * @returns The Rich Text field's content as React components.\n *\n * @see Learn about Rich Text fields {@link https://prismic.io/docs/core-concepts/rich-text-title}\n * @see Learn about Rich Text serializers {@link https://prismic.io/docs/core-concepts/html-serializer}\n */\nexport function PrismicRichText<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tLinkResolverFunction extends prismic.LinkResolverFunction<any>,\n>({\n\tlinkResolver,\n\tfield,\n\tfallback,\n\tcomponents,\n\texternalLinkComponent,\n\tinternalLinkComponent,\n}: PrismicRichTextProps<LinkResolverFunction>): JSX.Element | null {\n\treturn React.useMemo(() => {\n\t\tif (prismic.isFilled.richText(field)) {\n\t\t\tconst serializer = prismicR.composeSerializers(\n\t\t\t\ttypeof components === \"object\"\n\t\t\t\t\t? prismicR.wrapMapSerializer(components)\n\t\t\t\t\t: components,\n\t\t\t\tcreateDefaultSerializer({\n\t\t\t\t\tlinkResolver,\n\t\t\t\t\tinternalLinkComponent,\n\t\t\t\t\texternalLinkComponent,\n\t\t\t\t}),\n\t\t\t);\n\n\t\t\t// The serializer is wrapped in a higher-order function\n\t\t\t// that automatically applies a key to React Elements\n\t\t\t// if one is not already given.\n\t\t\tconst serialized = prismicR.serialize<JSX.Element>(\n\t\t\t\tfield,\n\t\t\t\t(type, node, text, children, key) => {\n\t\t\t\t\tconst result = serializer(type, node, text, children, key);\n\n\t\t\t\t\tif (React.isValidElement(result) && result.key == null) {\n\t\t\t\t\t\treturn React.cloneElement(result, { key });\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn <>{serialized}</>;\n\t\t} else {\n\t\t\treturn fallback != null ? <>{fallback}</> : null;\n\t\t}\n\t}, [\n\t\tfield,\n\t\tinternalLinkComponent,\n\t\texternalLinkComponent,\n\t\tcomponents,\n\t\tlinkResolver,\n\t\tfallback,\n\t]);\n}\n"],"names":[],"mappings":";;;;;AAuFA,MAAM,0BAA0B,CAI/B,SAEA,SAAS,kBAAkB;AAAA,EAC1B,UAAU,CAAC,EAAE,UA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YACA,uBACA,yBAC4C;AACrC,SAAA,MAAM,QAAQ,MAAK;AACzB,QAAI,QAAQ,SAAS,SAAS,KAAK,GAAG;AAC/B,YAAA,aAAa,SAAS,mBAC3B,OAAO,eAAe,WACnB,SAAS,kBAAkB,UAAU,IACrC,YACH,wBAAwB;AAAA,QACvB;AAAA,QACA;AAAA,QACA;AAAA,MACA,CAAA,CAAC;AAMG,YAAA,aAAa,SAAS,UAC3B,OACA,CAAC,MAAM,MAAM,MAAM,UAAU,QAAO;AACnC,cAAM,SAAS,WAAW,MAAM,MAAM,MAAM,UAAU,GAAG;AAEzD,YAAI,MAAM,eAAe,MAAM,KAAK,OAAO,OAAO,MAAM;AACvD,iBAAO,MAAM,aAAa,QAAQ,EAAE,IAAK,CAAA;AAAA,QAAA,OACnC;AACC,iBAAA;AAAA,QACP;AAAA,MAAA,CACD;AAGF,6CAAU,UAAW,WAAA,CAAA;AAAA,IAAA,OACf;AACN,aAAO,YAAY,OAAU,oBAAA,UAAA,EAAA,UAAA,UAAS,IAAM;AAAA,IAC5C;AAAA,EAAA,GACC;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACA;AACF;"}
@@ -0,0 +1,4 @@
1
+ export { PrismicLink } from "./PrismicLink";
2
+ export { PrismicRichText } from "./PrismicRichText";
3
+ export { PrismicProvider, useAllPrismicDocumentsByEveryTag, useAllPrismicDocumentsByIDs, useAllPrismicDocumentsBySomeTags, useAllPrismicDocumentsByTag, useAllPrismicDocumentsByType, useAllPrismicDocumentsByUIDs, useAllPrismicDocumentsDangerously, useFirstPrismicDocument, usePrismicClient, usePrismicContext, usePrismicDocumentByID, usePrismicDocumentByUID, usePrismicDocuments, usePrismicDocumentsByEveryTag, usePrismicDocumentsByIDs, usePrismicDocumentsBySomeTags, usePrismicDocumentsByTag, usePrismicDocumentsByType, usePrismicDocumentsByUIDs, usePrismicPreviewResolver, useSinglePrismicDocument, } from "./unsupported";
4
+ export { Element, PrismicImage, PrismicText, PrismicToolbar, SliceZone, TODOSliceComponent, } from "..";
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ function buildErrorMessage(fnName) {
4
+ return `${fnName} is not supported in Server Components. Remove all uses of ${fnName} in Server Components.`;
5
+ }
6
+ function buildHookErrorMessage(fnName) {
7
+ return `${fnName} is not supported in Server Components. Replace all uses of ${fnName} in Server Components with direct use of \`@prismicio/client\`.`;
8
+ }
9
+ function PrismicProvider() {
10
+ throw new Error(buildErrorMessage("<PrismicProvider>"));
11
+ }
12
+ function usePrismicContext() {
13
+ throw new Error(buildErrorMessage("usePrismicContext()"));
14
+ }
15
+ function usePrismicClient() {
16
+ throw new Error(buildHookErrorMessage("usePrismicClient()"));
17
+ }
18
+ function usePrismicPreviewResolver() {
19
+ throw new Error(buildHookErrorMessage("usePrismicPreviewResolver()"));
20
+ }
21
+ function useAllPrismicDocumentsDangerously() {
22
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsDangerously()"));
23
+ }
24
+ function useAllPrismicDocumentsByEveryTag() {
25
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByEveryTag()"));
26
+ }
27
+ function useAllPrismicDocumentsByIDs() {
28
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByIDs()"));
29
+ }
30
+ function useAllPrismicDocumentsBySomeTags() {
31
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsBySomeTags()"));
32
+ }
33
+ function useAllPrismicDocumentsByTag() {
34
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByTag()"));
35
+ }
36
+ function useAllPrismicDocumentsByType() {
37
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByType()"));
38
+ }
39
+ function useAllPrismicDocumentsByUIDs() {
40
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByUIDs()"));
41
+ }
42
+ function useFirstPrismicDocument() {
43
+ throw new Error(buildHookErrorMessage("useFirstPrismicDocument()"));
44
+ }
45
+ function usePrismicDocumentByID() {
46
+ throw new Error(buildHookErrorMessage("usePrismicDocumentByID()"));
47
+ }
48
+ function usePrismicDocumentByUID() {
49
+ throw new Error(buildHookErrorMessage("usePrismicDocumentByUID()"));
50
+ }
51
+ function usePrismicDocuments() {
52
+ throw new Error(buildHookErrorMessage("usePrismicDocuments()"));
53
+ }
54
+ function usePrismicDocumentsByEveryTag() {
55
+ throw new Error(buildHookErrorMessage("usePrismicDocumentsByEveryTag()"));
56
+ }
57
+ function usePrismicDocumentsByIDs() {
58
+ throw new Error(buildHookErrorMessage("usePrismicDocumentsByIDs()"));
59
+ }
60
+ function usePrismicDocumentsBySomeTags() {
61
+ throw new Error(buildHookErrorMessage("usePrismicDocumentsBySomeTags()"));
62
+ }
63
+ function usePrismicDocumentsByTag() {
64
+ throw new Error(buildHookErrorMessage("usePrismicDocumentsByTag()"));
65
+ }
66
+ function usePrismicDocumentsByType() {
67
+ throw new Error(buildHookErrorMessage("usePrismicDocumentsByType()"));
68
+ }
69
+ function usePrismicDocumentsByUIDs() {
70
+ throw new Error(buildHookErrorMessage("usePrismicDocumentsByUIDs()"));
71
+ }
72
+ function useSinglePrismicDocument() {
73
+ throw new Error(buildHookErrorMessage("useSinglePrismicDocument()"));
74
+ }
75
+ exports.PrismicProvider = PrismicProvider;
76
+ exports.useAllPrismicDocumentsByEveryTag = useAllPrismicDocumentsByEveryTag;
77
+ exports.useAllPrismicDocumentsByIDs = useAllPrismicDocumentsByIDs;
78
+ exports.useAllPrismicDocumentsBySomeTags = useAllPrismicDocumentsBySomeTags;
79
+ exports.useAllPrismicDocumentsByTag = useAllPrismicDocumentsByTag;
80
+ exports.useAllPrismicDocumentsByType = useAllPrismicDocumentsByType;
81
+ exports.useAllPrismicDocumentsByUIDs = useAllPrismicDocumentsByUIDs;
82
+ exports.useAllPrismicDocumentsDangerously = useAllPrismicDocumentsDangerously;
83
+ exports.useFirstPrismicDocument = useFirstPrismicDocument;
84
+ exports.usePrismicClient = usePrismicClient;
85
+ exports.usePrismicContext = usePrismicContext;
86
+ exports.usePrismicDocumentByID = usePrismicDocumentByID;
87
+ exports.usePrismicDocumentByUID = usePrismicDocumentByUID;
88
+ exports.usePrismicDocuments = usePrismicDocuments;
89
+ exports.usePrismicDocumentsByEveryTag = usePrismicDocumentsByEveryTag;
90
+ exports.usePrismicDocumentsByIDs = usePrismicDocumentsByIDs;
91
+ exports.usePrismicDocumentsBySomeTags = usePrismicDocumentsBySomeTags;
92
+ exports.usePrismicDocumentsByTag = usePrismicDocumentsByTag;
93
+ exports.usePrismicDocumentsByType = usePrismicDocumentsByType;
94
+ exports.usePrismicDocumentsByUIDs = usePrismicDocumentsByUIDs;
95
+ exports.usePrismicPreviewResolver = usePrismicPreviewResolver;
96
+ exports.useSinglePrismicDocument = useSinglePrismicDocument;
97
+ //# sourceMappingURL=unsupported.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsupported.cjs","sources":["../../../src/react-server/unsupported.ts"],"sourcesContent":["// Exports in this file are unsupported in the react-server environment.\n// All environments should export the same functions to maintian API compatability.\n\nfunction buildErrorMessage(fnName: string) {\n\treturn `${fnName} is not supported in Server Components. Remove all uses of ${fnName} in Server Components.`;\n}\n\nfunction buildHookErrorMessage(fnName: string) {\n\treturn `${fnName} is not supported in Server Components. Replace all uses of ${fnName} in Server Components with direct use of \\`@prismicio/client\\`.`;\n}\n\nexport function PrismicProvider(): JSX.Element {\n\tthrow new Error(buildErrorMessage(\"<PrismicProvider>\"));\n}\n\nexport function usePrismicContext() {\n\tthrow new Error(buildErrorMessage(\"usePrismicContext()\"));\n}\n\nexport function usePrismicClient() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicClient()\"));\n}\n\nexport function usePrismicPreviewResolver() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicPreviewResolver()\"));\n}\n\nexport function useAllPrismicDocumentsDangerously() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsDangerously()\"));\n}\n\nexport function useAllPrismicDocumentsByEveryTag() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByEveryTag()\"));\n}\n\nexport function useAllPrismicDocumentsByIDs() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByIDs()\"));\n}\n\nexport function useAllPrismicDocumentsBySomeTags() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsBySomeTags()\"));\n}\n\nexport function useAllPrismicDocumentsByTag() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByTag()\"));\n}\n\nexport function useAllPrismicDocumentsByType() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByType()\"));\n}\n\nexport function useAllPrismicDocumentsByUIDs() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByUIDs()\"));\n}\n\nexport function useFirstPrismicDocument() {\n\tthrow new Error(buildHookErrorMessage(\"useFirstPrismicDocument()\"));\n}\n\nexport function usePrismicDocumentByID() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentByID()\"));\n}\n\nexport function usePrismicDocumentByUID() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentByUID()\"));\n}\n\nexport function usePrismicDocuments() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocuments()\"));\n}\n\nexport function usePrismicDocumentsByEveryTag() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByEveryTag()\"));\n}\n\nexport function usePrismicDocumentsByIDs() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByIDs()\"));\n}\n\nexport function usePrismicDocumentsBySomeTags() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsBySomeTags()\"));\n}\n\nexport function usePrismicDocumentsByTag() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByTag()\"));\n}\n\nexport function usePrismicDocumentsByType() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByType()\"));\n}\n\nexport function usePrismicDocumentsByUIDs() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByUIDs()\"));\n}\n\nexport function useSinglePrismicDocument() {\n\tthrow new Error(buildHookErrorMessage(\"useSinglePrismicDocument()\"));\n}\n"],"names":[],"mappings":";;AAGA,SAAS,kBAAkB,QAAc;AACxC,SAAO,GAAG,oEAAoE;AAC/E;AAEA,SAAS,sBAAsB,QAAc;AAC5C,SAAO,GAAG,qEAAqE;AAChF;SAEgB,kBAAe;AAC9B,QAAM,IAAI,MAAM,kBAAkB,mBAAmB,CAAC;AACvD;SAEgB,oBAAiB;AAChC,QAAM,IAAI,MAAM,kBAAkB,qBAAqB,CAAC;AACzD;SAEgB,mBAAgB;AAC/B,QAAM,IAAI,MAAM,sBAAsB,oBAAoB,CAAC;AAC5D;SAEgB,4BAAyB;AACxC,QAAM,IAAI,MAAM,sBAAsB,6BAA6B,CAAC;AACrE;SAEgB,oCAAiC;AAChD,QAAM,IAAI,MAAM,sBAAsB,qCAAqC,CAAC;AAC7E;SAEgB,mCAAgC;AAC/C,QAAM,IAAI,MAAM,sBAAsB,oCAAoC,CAAC;AAC5E;SAEgB,8BAA2B;AAC1C,QAAM,IAAI,MAAM,sBAAsB,+BAA+B,CAAC;AACvE;SAEgB,mCAAgC;AAC/C,QAAM,IAAI,MAAM,sBAAsB,oCAAoC,CAAC;AAC5E;SAEgB,8BAA2B;AAC1C,QAAM,IAAI,MAAM,sBAAsB,+BAA+B,CAAC;AACvE;SAEgB,+BAA4B;AAC3C,QAAM,IAAI,MAAM,sBAAsB,gCAAgC,CAAC;AACxE;SAEgB,+BAA4B;AAC3C,QAAM,IAAI,MAAM,sBAAsB,gCAAgC,CAAC;AACxE;SAEgB,0BAAuB;AACtC,QAAM,IAAI,MAAM,sBAAsB,2BAA2B,CAAC;AACnE;SAEgB,yBAAsB;AACrC,QAAM,IAAI,MAAM,sBAAsB,0BAA0B,CAAC;AAClE;SAEgB,0BAAuB;AACtC,QAAM,IAAI,MAAM,sBAAsB,2BAA2B,CAAC;AACnE;SAEgB,sBAAmB;AAClC,QAAM,IAAI,MAAM,sBAAsB,uBAAuB,CAAC;AAC/D;SAEgB,gCAA6B;AAC5C,QAAM,IAAI,MAAM,sBAAsB,iCAAiC,CAAC;AACzE;SAEgB,2BAAwB;AACvC,QAAM,IAAI,MAAM,sBAAsB,4BAA4B,CAAC;AACpE;SAEgB,gCAA6B;AAC5C,QAAM,IAAI,MAAM,sBAAsB,iCAAiC,CAAC;AACzE;SAEgB,2BAAwB;AACvC,QAAM,IAAI,MAAM,sBAAsB,4BAA4B,CAAC;AACpE;SAEgB,4BAAyB;AACxC,QAAM,IAAI,MAAM,sBAAsB,6BAA6B,CAAC;AACrE;SAEgB,4BAAyB;AACxC,QAAM,IAAI,MAAM,sBAAsB,6BAA6B,CAAC;AACrE;SAEgB,2BAAwB;AACvC,QAAM,IAAI,MAAM,sBAAsB,4BAA4B,CAAC;AACpE;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,22 @@
1
+ export declare function PrismicProvider(): JSX.Element;
2
+ export declare function usePrismicContext(): void;
3
+ export declare function usePrismicClient(): void;
4
+ export declare function usePrismicPreviewResolver(): void;
5
+ export declare function useAllPrismicDocumentsDangerously(): void;
6
+ export declare function useAllPrismicDocumentsByEveryTag(): void;
7
+ export declare function useAllPrismicDocumentsByIDs(): void;
8
+ export declare function useAllPrismicDocumentsBySomeTags(): void;
9
+ export declare function useAllPrismicDocumentsByTag(): void;
10
+ export declare function useAllPrismicDocumentsByType(): void;
11
+ export declare function useAllPrismicDocumentsByUIDs(): void;
12
+ export declare function useFirstPrismicDocument(): void;
13
+ export declare function usePrismicDocumentByID(): void;
14
+ export declare function usePrismicDocumentByUID(): void;
15
+ export declare function usePrismicDocuments(): void;
16
+ export declare function usePrismicDocumentsByEveryTag(): void;
17
+ export declare function usePrismicDocumentsByIDs(): void;
18
+ export declare function usePrismicDocumentsBySomeTags(): void;
19
+ export declare function usePrismicDocumentsByTag(): void;
20
+ export declare function usePrismicDocumentsByType(): void;
21
+ export declare function usePrismicDocumentsByUIDs(): void;
22
+ export declare function useSinglePrismicDocument(): void;
@@ -0,0 +1,97 @@
1
+ function buildErrorMessage(fnName) {
2
+ return `${fnName} is not supported in Server Components. Remove all uses of ${fnName} in Server Components.`;
3
+ }
4
+ function buildHookErrorMessage(fnName) {
5
+ return `${fnName} is not supported in Server Components. Replace all uses of ${fnName} in Server Components with direct use of \`@prismicio/client\`.`;
6
+ }
7
+ function PrismicProvider() {
8
+ throw new Error(buildErrorMessage("<PrismicProvider>"));
9
+ }
10
+ function usePrismicContext() {
11
+ throw new Error(buildErrorMessage("usePrismicContext()"));
12
+ }
13
+ function usePrismicClient() {
14
+ throw new Error(buildHookErrorMessage("usePrismicClient()"));
15
+ }
16
+ function usePrismicPreviewResolver() {
17
+ throw new Error(buildHookErrorMessage("usePrismicPreviewResolver()"));
18
+ }
19
+ function useAllPrismicDocumentsDangerously() {
20
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsDangerously()"));
21
+ }
22
+ function useAllPrismicDocumentsByEveryTag() {
23
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByEveryTag()"));
24
+ }
25
+ function useAllPrismicDocumentsByIDs() {
26
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByIDs()"));
27
+ }
28
+ function useAllPrismicDocumentsBySomeTags() {
29
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsBySomeTags()"));
30
+ }
31
+ function useAllPrismicDocumentsByTag() {
32
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByTag()"));
33
+ }
34
+ function useAllPrismicDocumentsByType() {
35
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByType()"));
36
+ }
37
+ function useAllPrismicDocumentsByUIDs() {
38
+ throw new Error(buildHookErrorMessage("useAllPrismicDocumentsByUIDs()"));
39
+ }
40
+ function useFirstPrismicDocument() {
41
+ throw new Error(buildHookErrorMessage("useFirstPrismicDocument()"));
42
+ }
43
+ function usePrismicDocumentByID() {
44
+ throw new Error(buildHookErrorMessage("usePrismicDocumentByID()"));
45
+ }
46
+ function usePrismicDocumentByUID() {
47
+ throw new Error(buildHookErrorMessage("usePrismicDocumentByUID()"));
48
+ }
49
+ function usePrismicDocuments() {
50
+ throw new Error(buildHookErrorMessage("usePrismicDocuments()"));
51
+ }
52
+ function usePrismicDocumentsByEveryTag() {
53
+ throw new Error(buildHookErrorMessage("usePrismicDocumentsByEveryTag()"));
54
+ }
55
+ function usePrismicDocumentsByIDs() {
56
+ throw new Error(buildHookErrorMessage("usePrismicDocumentsByIDs()"));
57
+ }
58
+ function usePrismicDocumentsBySomeTags() {
59
+ throw new Error(buildHookErrorMessage("usePrismicDocumentsBySomeTags()"));
60
+ }
61
+ function usePrismicDocumentsByTag() {
62
+ throw new Error(buildHookErrorMessage("usePrismicDocumentsByTag()"));
63
+ }
64
+ function usePrismicDocumentsByType() {
65
+ throw new Error(buildHookErrorMessage("usePrismicDocumentsByType()"));
66
+ }
67
+ function usePrismicDocumentsByUIDs() {
68
+ throw new Error(buildHookErrorMessage("usePrismicDocumentsByUIDs()"));
69
+ }
70
+ function useSinglePrismicDocument() {
71
+ throw new Error(buildHookErrorMessage("useSinglePrismicDocument()"));
72
+ }
73
+ export {
74
+ PrismicProvider,
75
+ useAllPrismicDocumentsByEveryTag,
76
+ useAllPrismicDocumentsByIDs,
77
+ useAllPrismicDocumentsBySomeTags,
78
+ useAllPrismicDocumentsByTag,
79
+ useAllPrismicDocumentsByType,
80
+ useAllPrismicDocumentsByUIDs,
81
+ useAllPrismicDocumentsDangerously,
82
+ useFirstPrismicDocument,
83
+ usePrismicClient,
84
+ usePrismicContext,
85
+ usePrismicDocumentByID,
86
+ usePrismicDocumentByUID,
87
+ usePrismicDocuments,
88
+ usePrismicDocumentsByEveryTag,
89
+ usePrismicDocumentsByIDs,
90
+ usePrismicDocumentsBySomeTags,
91
+ usePrismicDocumentsByTag,
92
+ usePrismicDocumentsByType,
93
+ usePrismicDocumentsByUIDs,
94
+ usePrismicPreviewResolver,
95
+ useSinglePrismicDocument
96
+ };
97
+ //# sourceMappingURL=unsupported.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsupported.js","sources":["../../../src/react-server/unsupported.ts"],"sourcesContent":["// Exports in this file are unsupported in the react-server environment.\n// All environments should export the same functions to maintian API compatability.\n\nfunction buildErrorMessage(fnName: string) {\n\treturn `${fnName} is not supported in Server Components. Remove all uses of ${fnName} in Server Components.`;\n}\n\nfunction buildHookErrorMessage(fnName: string) {\n\treturn `${fnName} is not supported in Server Components. Replace all uses of ${fnName} in Server Components with direct use of \\`@prismicio/client\\`.`;\n}\n\nexport function PrismicProvider(): JSX.Element {\n\tthrow new Error(buildErrorMessage(\"<PrismicProvider>\"));\n}\n\nexport function usePrismicContext() {\n\tthrow new Error(buildErrorMessage(\"usePrismicContext()\"));\n}\n\nexport function usePrismicClient() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicClient()\"));\n}\n\nexport function usePrismicPreviewResolver() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicPreviewResolver()\"));\n}\n\nexport function useAllPrismicDocumentsDangerously() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsDangerously()\"));\n}\n\nexport function useAllPrismicDocumentsByEveryTag() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByEveryTag()\"));\n}\n\nexport function useAllPrismicDocumentsByIDs() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByIDs()\"));\n}\n\nexport function useAllPrismicDocumentsBySomeTags() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsBySomeTags()\"));\n}\n\nexport function useAllPrismicDocumentsByTag() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByTag()\"));\n}\n\nexport function useAllPrismicDocumentsByType() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByType()\"));\n}\n\nexport function useAllPrismicDocumentsByUIDs() {\n\tthrow new Error(buildHookErrorMessage(\"useAllPrismicDocumentsByUIDs()\"));\n}\n\nexport function useFirstPrismicDocument() {\n\tthrow new Error(buildHookErrorMessage(\"useFirstPrismicDocument()\"));\n}\n\nexport function usePrismicDocumentByID() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentByID()\"));\n}\n\nexport function usePrismicDocumentByUID() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentByUID()\"));\n}\n\nexport function usePrismicDocuments() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocuments()\"));\n}\n\nexport function usePrismicDocumentsByEveryTag() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByEveryTag()\"));\n}\n\nexport function usePrismicDocumentsByIDs() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByIDs()\"));\n}\n\nexport function usePrismicDocumentsBySomeTags() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsBySomeTags()\"));\n}\n\nexport function usePrismicDocumentsByTag() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByTag()\"));\n}\n\nexport function usePrismicDocumentsByType() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByType()\"));\n}\n\nexport function usePrismicDocumentsByUIDs() {\n\tthrow new Error(buildHookErrorMessage(\"usePrismicDocumentsByUIDs()\"));\n}\n\nexport function useSinglePrismicDocument() {\n\tthrow new Error(buildHookErrorMessage(\"useSinglePrismicDocument()\"));\n}\n"],"names":[],"mappings":"AAGA,SAAS,kBAAkB,QAAc;AACxC,SAAO,GAAG,oEAAoE;AAC/E;AAEA,SAAS,sBAAsB,QAAc;AAC5C,SAAO,GAAG,qEAAqE;AAChF;SAEgB,kBAAe;AAC9B,QAAM,IAAI,MAAM,kBAAkB,mBAAmB,CAAC;AACvD;SAEgB,oBAAiB;AAChC,QAAM,IAAI,MAAM,kBAAkB,qB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I,MAAM,sBAAsB,6BAA6B,CAAC;AACrE;SAEgB,4BAAyB;AACxC,QAAM,IAAI,MAAM,sBAAsB,6BAA6B,CAAC;AACrE;SAEgB,2BAAwB;AACvC,QAAM,IAAI,MAAM,sBAAsB,4BAA4B,CAAC;AACpE;"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const PrismicLink = require("./react-server/PrismicLink.cjs");
4
+ const PrismicRichText = require("./react-server/PrismicRichText.cjs");
5
+ const unsupported = require("./react-server/unsupported.cjs");
6
+ const PrismicText = require("./PrismicText.cjs");
7
+ const prismicR = require("@prismicio/richtext");
8
+ const PrismicImage = require("./PrismicImage.cjs");
9
+ const SliceZone = require("./SliceZone.cjs");
10
+ const PrismicToolbar = require("./PrismicToolbar.cjs");
11
+ exports.PrismicLink = PrismicLink.PrismicLink;
12
+ exports.PrismicRichText = PrismicRichText.PrismicRichText;
13
+ exports.PrismicProvider = unsupported.PrismicProvider;
14
+ exports.useAllPrismicDocumentsByEveryTag = unsupported.useAllPrismicDocumentsByEveryTag;
15
+ exports.useAllPrismicDocumentsByIDs = unsupported.useAllPrismicDocumentsByIDs;
16
+ exports.useAllPrismicDocumentsBySomeTags = unsupported.useAllPrismicDocumentsBySomeTags;
17
+ exports.useAllPrismicDocumentsByTag = unsupported.useAllPrismicDocumentsByTag;
18
+ exports.useAllPrismicDocumentsByType = unsupported.useAllPrismicDocumentsByType;
19
+ exports.useAllPrismicDocumentsByUIDs = unsupported.useAllPrismicDocumentsByUIDs;
20
+ exports.useAllPrismicDocumentsDangerously = unsupported.useAllPrismicDocumentsDangerously;
21
+ exports.useFirstPrismicDocument = unsupported.useFirstPrismicDocument;
22
+ exports.usePrismicClient = unsupported.usePrismicClient;
23
+ exports.usePrismicContext = unsupported.usePrismicContext;
24
+ exports.usePrismicDocumentByID = unsupported.usePrismicDocumentByID;
25
+ exports.usePrismicDocumentByUID = unsupported.usePrismicDocumentByUID;
26
+ exports.usePrismicDocuments = unsupported.usePrismicDocuments;
27
+ exports.usePrismicDocumentsByEveryTag = unsupported.usePrismicDocumentsByEveryTag;
28
+ exports.usePrismicDocumentsByIDs = unsupported.usePrismicDocumentsByIDs;
29
+ exports.usePrismicDocumentsBySomeTags = unsupported.usePrismicDocumentsBySomeTags;
30
+ exports.usePrismicDocumentsByTag = unsupported.usePrismicDocumentsByTag;
31
+ exports.usePrismicDocumentsByType = unsupported.usePrismicDocumentsByType;
32
+ exports.usePrismicDocumentsByUIDs = unsupported.usePrismicDocumentsByUIDs;
33
+ exports.usePrismicPreviewResolver = unsupported.usePrismicPreviewResolver;
34
+ exports.useSinglePrismicDocument = unsupported.useSinglePrismicDocument;
35
+ exports.PrismicText = PrismicText.PrismicText;
36
+ Object.defineProperty(exports, "Element", {
37
+ enumerable: true,
38
+ get: () => prismicR.Element
39
+ });
40
+ exports.PrismicImage = PrismicImage.PrismicImage;
41
+ exports.SliceZone = SliceZone.SliceZone;
42
+ exports.TODOSliceComponent = SliceZone.TODOSliceComponent;
43
+ exports.PrismicToolbar = PrismicToolbar.PrismicToolbar;
44
+ //# sourceMappingURL=react-server.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-server.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,41 @@
1
+ import { PrismicLink } from "./react-server/PrismicLink.js";
2
+ import { PrismicRichText } from "./react-server/PrismicRichText.js";
3
+ import { PrismicProvider, useAllPrismicDocumentsByEveryTag, useAllPrismicDocumentsByIDs, useAllPrismicDocumentsBySomeTags, useAllPrismicDocumentsByTag, useAllPrismicDocumentsByType, useAllPrismicDocumentsByUIDs, useAllPrismicDocumentsDangerously, useFirstPrismicDocument, usePrismicClient, usePrismicContext, usePrismicDocumentByID, usePrismicDocumentByUID, usePrismicDocuments, usePrismicDocumentsByEveryTag, usePrismicDocumentsByIDs, usePrismicDocumentsBySomeTags, usePrismicDocumentsByTag, usePrismicDocumentsByType, usePrismicDocumentsByUIDs, usePrismicPreviewResolver, useSinglePrismicDocument } from "./react-server/unsupported.js";
4
+ import { PrismicText } from "./PrismicText.js";
5
+ import { Element } from "@prismicio/richtext";
6
+ import { PrismicImage } from "./PrismicImage.js";
7
+ import { SliceZone, TODOSliceComponent } from "./SliceZone.js";
8
+ import { PrismicToolbar } from "./PrismicToolbar.js";
9
+ export {
10
+ Element,
11
+ PrismicImage,
12
+ PrismicLink,
13
+ PrismicProvider,
14
+ PrismicRichText,
15
+ PrismicText,
16
+ PrismicToolbar,
17
+ SliceZone,
18
+ TODOSliceComponent,
19
+ useAllPrismicDocumentsByEveryTag,
20
+ useAllPrismicDocumentsByIDs,
21
+ useAllPrismicDocumentsBySomeTags,
22
+ useAllPrismicDocumentsByTag,
23
+ useAllPrismicDocumentsByType,
24
+ useAllPrismicDocumentsByUIDs,
25
+ useAllPrismicDocumentsDangerously,
26
+ useFirstPrismicDocument,
27
+ usePrismicClient,
28
+ usePrismicContext,
29
+ usePrismicDocumentByID,
30
+ usePrismicDocumentByUID,
31
+ usePrismicDocuments,
32
+ usePrismicDocumentsByEveryTag,
33
+ usePrismicDocumentsByIDs,
34
+ usePrismicDocumentsBySomeTags,
35
+ usePrismicDocumentsByTag,
36
+ usePrismicDocumentsByType,
37
+ usePrismicDocumentsByUIDs,
38
+ usePrismicPreviewResolver,
39
+ useSinglePrismicDocument
40
+ };
41
+ //# sourceMappingURL=react-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-server.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
package/dist/types.d.ts CHANGED
@@ -1,19 +1,19 @@
1
- import * as prismicR from "@prismicio/richtext";
2
- /**
3
- * A function mapping Rich Text block types to React Components. It is used to
4
- * render Rich Text or Title fields.
5
- *
6
- * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript}
7
- */
8
- export type JSXFunctionSerializer = prismicR.RichTextFunctionSerializer<JSX.Element>;
9
- /**
10
- * A map of Rich Text block types to React Components. It is used to render Rich
11
- * Text or Title fields.
12
- *
13
- * @see Templating Rich Text and Title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript}
14
- */
15
- export type JSXMapSerializer = prismicR.RichTextMapSerializer<JSX.Element>;
16
- /**
17
- * States of a `@prismicio/client` hook.
18
- */
19
- export type PrismicClientHookState = "idle" | "loading" | "loaded" | "failed";
1
+ import * as prismicR from "@prismicio/richtext";
2
+ /**
3
+ * A function mapping Rich Text block types to React Components. It is used to
4
+ * render Rich Text or Title fields.
5
+ *
6
+ * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript}
7
+ */
8
+ export type JSXFunctionSerializer = prismicR.RichTextFunctionSerializer<JSX.Element>;
9
+ /**
10
+ * A map of Rich Text block types to React Components. It is used to render Rich
11
+ * Text or Title fields.
12
+ *
13
+ * @see Templating Rich Text and Title fields from Prismic {@link https://prismic.io/docs/technologies/templating-rich-text-and-title-fields-javascript}
14
+ */
15
+ export type JSXMapSerializer = prismicR.RichTextMapSerializer<JSX.Element>;
16
+ /**
17
+ * States of a `@prismicio/client` hook.
18
+ */
19
+ export type PrismicClientHookState = "idle" | "loading" | "loaded" | "failed";