@prismicio/react 2.9.0 → 3.0.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 (191) hide show
  1. package/README.md +10 -11
  2. package/dist/PrismicImage.d.ts +18 -633
  3. package/dist/PrismicImage.js +32 -33
  4. package/dist/PrismicImage.js.map +1 -1
  5. package/dist/PrismicLink.d.ts +77 -6
  6. package/dist/PrismicLink.js +42 -7
  7. package/dist/PrismicLink.js.map +1 -1
  8. package/dist/PrismicRichText.d.ts +117 -4
  9. package/dist/PrismicRichText.js +74 -8
  10. package/dist/PrismicRichText.js.map +1 -1
  11. package/dist/PrismicText.d.ts +8 -13
  12. package/dist/PrismicText.js +15 -16
  13. package/dist/PrismicText.js.map +1 -1
  14. package/dist/PrismicToolbar.d.ts +2 -12
  15. package/dist/PrismicToolbar.js +8 -10
  16. package/dist/PrismicToolbar.js.map +1 -1
  17. package/dist/SliceZone.d.ts +16 -70
  18. package/dist/SliceZone.js +16 -37
  19. package/dist/SliceZone.js.map +1 -1
  20. package/dist/index.d.ts +13 -21
  21. package/dist/index.js +2 -29
  22. package/dist/index.js.map +1 -1
  23. package/dist/lib/devMsg.d.ts +2 -2
  24. package/dist/lib/devMsg.js +2 -2
  25. package/dist/lib/devMsg.js.map +1 -1
  26. package/dist/package.json.js +1 -1
  27. package/package.json +53 -70
  28. package/src/PrismicImage.tsx +80 -65
  29. package/src/PrismicLink.tsx +196 -26
  30. package/src/PrismicRichText.tsx +333 -33
  31. package/src/PrismicText.tsx +25 -30
  32. package/src/PrismicToolbar.tsx +10 -30
  33. package/src/SliceZone.tsx +58 -150
  34. package/src/index.ts +17 -53
  35. package/src/lib/devMsg.ts +3 -3
  36. package/dist/PrismicImage.cjs +0 -68
  37. package/dist/PrismicImage.cjs.map +0 -1
  38. package/dist/PrismicLink.cjs +0 -29
  39. package/dist/PrismicLink.cjs.map +0 -1
  40. package/dist/PrismicProvider.cjs +0 -41
  41. package/dist/PrismicProvider.cjs.map +0 -1
  42. package/dist/PrismicProvider.d.ts +0 -83
  43. package/dist/PrismicProvider.js +0 -24
  44. package/dist/PrismicProvider.js.map +0 -1
  45. package/dist/PrismicRichText.cjs +0 -30
  46. package/dist/PrismicRichText.cjs.map +0 -1
  47. package/dist/PrismicText.cjs +0 -44
  48. package/dist/PrismicText.cjs.map +0 -1
  49. package/dist/PrismicToolbar.cjs +0 -43
  50. package/dist/PrismicToolbar.cjs.map +0 -1
  51. package/dist/SliceZone.cjs +0 -53
  52. package/dist/SliceZone.cjs.map +0 -1
  53. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.cjs +0 -16
  54. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.cjs.map +0 -1
  55. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.js +0 -16
  56. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.js.map +0 -1
  57. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.cjs +0 -13
  58. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.cjs.map +0 -1
  59. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.js +0 -13
  60. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.js.map +0 -1
  61. package/dist/_node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.cjs +0 -22
  62. package/dist/_node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.cjs.map +0 -1
  63. package/dist/_node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.js +0 -22
  64. package/dist/_node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.js.map +0 -1
  65. package/dist/_node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.cjs +0 -46
  66. package/dist/_node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.cjs.map +0 -1
  67. package/dist/_node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.js +0 -46
  68. package/dist/_node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.js.map +0 -1
  69. package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.cjs +0 -47
  70. package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.cjs.map +0 -1
  71. package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.js +0 -47
  72. package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.js.map +0 -1
  73. package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.cjs +0 -28
  74. package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.cjs.map +0 -1
  75. package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.js +0 -28
  76. package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.js.map +0 -1
  77. package/dist/_node_modules/@prismicio/client/dist/helpers/asText.cjs +0 -21
  78. package/dist/_node_modules/@prismicio/client/dist/helpers/asText.cjs.map +0 -1
  79. package/dist/_node_modules/@prismicio/client/dist/helpers/asText.js +0 -21
  80. package/dist/_node_modules/@prismicio/client/dist/helpers/asText.js.map +0 -1
  81. package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.cjs +0 -27
  82. package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.cjs.map +0 -1
  83. package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.js +0 -27
  84. package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.js.map +0 -1
  85. package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.cjs +0 -24
  86. package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.cjs.map +0 -1
  87. package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.js +0 -24
  88. package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.js.map +0 -1
  89. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.cjs +0 -7
  90. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.cjs.map +0 -1
  91. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.js +0 -7
  92. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.js.map +0 -1
  93. package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.cjs +0 -9
  94. package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.cjs.map +0 -1
  95. package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.js +0 -9
  96. package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.js.map +0 -1
  97. package/dist/_node_modules/@prismicio/client/dist/richtext/asText.cjs +0 -13
  98. package/dist/_node_modules/@prismicio/client/dist/richtext/asText.cjs.map +0 -1
  99. package/dist/_node_modules/@prismicio/client/dist/richtext/asText.js +0 -13
  100. package/dist/_node_modules/@prismicio/client/dist/richtext/asText.js.map +0 -1
  101. package/dist/_node_modules/@prismicio/client/dist/types/value/link.cjs +0 -10
  102. package/dist/_node_modules/@prismicio/client/dist/types/value/link.cjs.map +0 -1
  103. package/dist/_node_modules/@prismicio/client/dist/types/value/link.js +0 -10
  104. package/dist/_node_modules/@prismicio/client/dist/types/value/link.js.map +0 -1
  105. package/dist/_node_modules/imgix-url-builder/dist/buildPixelDensitySrcSet.cjs +0 -10
  106. package/dist/_node_modules/imgix-url-builder/dist/buildPixelDensitySrcSet.cjs.map +0 -1
  107. package/dist/_node_modules/imgix-url-builder/dist/buildPixelDensitySrcSet.js +0 -10
  108. package/dist/_node_modules/imgix-url-builder/dist/buildPixelDensitySrcSet.js.map +0 -1
  109. package/dist/_node_modules/imgix-url-builder/dist/buildURL.cjs +0 -29
  110. package/dist/_node_modules/imgix-url-builder/dist/buildURL.cjs.map +0 -1
  111. package/dist/_node_modules/imgix-url-builder/dist/buildURL.js +0 -29
  112. package/dist/_node_modules/imgix-url-builder/dist/buildURL.js.map +0 -1
  113. package/dist/_node_modules/imgix-url-builder/dist/buildWidthSrcSet.cjs +0 -10
  114. package/dist/_node_modules/imgix-url-builder/dist/buildWidthSrcSet.cjs.map +0 -1
  115. package/dist/_node_modules/imgix-url-builder/dist/buildWidthSrcSet.js +0 -10
  116. package/dist/_node_modules/imgix-url-builder/dist/buildWidthSrcSet.js.map +0 -1
  117. package/dist/clientHooks.cjs +0 -40
  118. package/dist/clientHooks.cjs.map +0 -1
  119. package/dist/clientHooks.d.ts +0 -321
  120. package/dist/clientHooks.js +0 -40
  121. package/dist/clientHooks.js.map +0 -1
  122. package/dist/index.cjs +0 -48
  123. package/dist/index.cjs.map +0 -1
  124. package/dist/lib/devMsg.cjs +0 -8
  125. package/dist/lib/devMsg.cjs.map +0 -1
  126. package/dist/lib/isInternalURL.cjs +0 -9
  127. package/dist/lib/isInternalURL.cjs.map +0 -1
  128. package/dist/lib/isInternalURL.d.ts +0 -8
  129. package/dist/lib/isInternalURL.js +0 -9
  130. package/dist/lib/isInternalURL.js.map +0 -1
  131. package/dist/lib/pascalCase.cjs +0 -10
  132. package/dist/lib/pascalCase.cjs.map +0 -1
  133. package/dist/lib/pascalCase.d.ts +0 -26
  134. package/dist/lib/pascalCase.js +0 -10
  135. package/dist/lib/pascalCase.js.map +0 -1
  136. package/dist/package.json.cjs +0 -5
  137. package/dist/package.json.cjs.map +0 -1
  138. package/dist/react-server/PrismicLink.cjs +0 -59
  139. package/dist/react-server/PrismicLink.cjs.map +0 -1
  140. package/dist/react-server/PrismicLink.d.ts +0 -77
  141. package/dist/react-server/PrismicLink.js +0 -42
  142. package/dist/react-server/PrismicLink.js.map +0 -1
  143. package/dist/react-server/PrismicRichText.cjs +0 -97
  144. package/dist/react-server/PrismicRichText.cjs.map +0 -1
  145. package/dist/react-server/PrismicRichText.d.ts +0 -104
  146. package/dist/react-server/PrismicRichText.js +0 -79
  147. package/dist/react-server/PrismicRichText.js.map +0 -1
  148. package/dist/react-server/index.d.ts +0 -4
  149. package/dist/react-server/unsupported.cjs +0 -97
  150. package/dist/react-server/unsupported.cjs.map +0 -1
  151. package/dist/react-server/unsupported.d.ts +0 -22
  152. package/dist/react-server/unsupported.js +0 -97
  153. package/dist/react-server/unsupported.js.map +0 -1
  154. package/dist/react-server.cjs +0 -44
  155. package/dist/react-server.cjs.map +0 -1
  156. package/dist/react-server.js +0 -41
  157. package/dist/react-server.js.map +0 -1
  158. package/dist/types.d.ts +0 -19
  159. package/dist/usePrismicClient.cjs +0 -13
  160. package/dist/usePrismicClient.cjs.map +0 -1
  161. package/dist/usePrismicClient.d.ts +0 -11
  162. package/dist/usePrismicClient.js +0 -13
  163. package/dist/usePrismicClient.js.map +0 -1
  164. package/dist/usePrismicContext.cjs +0 -26
  165. package/dist/usePrismicContext.cjs.map +0 -1
  166. package/dist/usePrismicContext.d.ts +0 -8
  167. package/dist/usePrismicContext.js +0 -9
  168. package/dist/usePrismicContext.js.map +0 -1
  169. package/dist/usePrismicPreviewResolver.cjs +0 -44
  170. package/dist/usePrismicPreviewResolver.cjs.map +0 -1
  171. package/dist/usePrismicPreviewResolver.d.ts +0 -45
  172. package/dist/usePrismicPreviewResolver.js +0 -27
  173. package/dist/usePrismicPreviewResolver.js.map +0 -1
  174. package/dist/useStatefulPrismicClientMethod.cjs +0 -91
  175. package/dist/useStatefulPrismicClientMethod.cjs.map +0 -1
  176. package/dist/useStatefulPrismicClientMethod.d.ts +0 -44
  177. package/dist/useStatefulPrismicClientMethod.js +0 -74
  178. package/dist/useStatefulPrismicClientMethod.js.map +0 -1
  179. package/src/PrismicProvider.tsx +0 -132
  180. package/src/clientHooks.ts +0 -472
  181. package/src/lib/isInternalURL.ts +0 -14
  182. package/src/lib/pascalCase.ts +0 -79
  183. package/src/react-server/PrismicLink.tsx +0 -197
  184. package/src/react-server/PrismicRichText.tsx +0 -283
  185. package/src/react-server/index.ts +0 -38
  186. package/src/react-server/unsupported.ts +0 -184
  187. package/src/types.ts +0 -23
  188. package/src/usePrismicClient.ts +0 -30
  189. package/src/usePrismicContext.ts +0 -13
  190. package/src/usePrismicPreviewResolver.ts +0 -93
  191. package/src/useStatefulPrismicClientMethod.ts +0 -196
@@ -1,24 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import * as React from "react";
3
- const PrismicContext = React.createContext({});
4
- const PrismicProvider = ({ client, linkResolver, richTextComponents, internalLinkComponent, externalLinkComponent, children }) => {
5
- const value = React.useMemo(() => ({
6
- client,
7
- linkResolver,
8
- richTextComponents,
9
- internalLinkComponent,
10
- externalLinkComponent
11
- }), [
12
- client,
13
- linkResolver,
14
- richTextComponents,
15
- internalLinkComponent,
16
- externalLinkComponent
17
- ]);
18
- return /* @__PURE__ */ jsx(PrismicContext.Provider, { value, children });
19
- };
20
- export {
21
- PrismicContext,
22
- PrismicProvider
23
- };
24
- //# sourceMappingURL=PrismicProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrismicProvider.js","sources":["../../src/PrismicProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as prismic from \"@prismicio/client\";\n\nimport { JSXFunctionSerializer, JSXMapSerializer } from \"./types\";\nimport { LinkProps } from \"./PrismicLink\";\n\n/**\n * React context value containing shared configuration for `@prismicio/react`\n * components and hooks.\n */\nexport type PrismicContextValue<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tLinkResolverFunction extends prismic.LinkResolverFunction<any> = prismic.LinkResolverFunction,\n> = {\n\t/**\n\t * A `@prismicio/client` instance used to fetch content from a Prismic\n\t * repository. This is used by `@prismicio/react` hooks, such as\n\t * `usePrismicDocuments()`.\n\t */\n\tclient?: prismic.Client;\n\n\t/**\n\t * A Link Resolver used to resolve links for `<PrismicLink>` and\n\t * `<PrismicRichText>`.\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>{chidlren}</Heading>;\n\t * \t\t}\n\t * \t}\n\t * };\n\t * ```\n\t */\n\trichTextComponents?: JSXMapSerializer | JSXFunctionSerializer;\n\n\t/**\n\t * The component rendered by `<PrismicLink>` for internal URLs. Defaults to\n\t * `<a>`.\n\t */\n\tinternalLinkComponent?: React.ComponentType<LinkProps>;\n\n\t/**\n\t * The component rendered by `<PrismicLink>` for external URLs. Defaults to\n\t * `<a>`.\n\t */\n\texternalLinkComponent?: React.ComponentType<LinkProps>;\n\n\t/**\n\t * Children for the component.\n\t */\n\tchildren?: React.ReactNode;\n};\n\n/**\n * React context containing shared configuration for `@prismicio/react`\n * components and hooks.\n */\nexport const PrismicContext = React.createContext<PrismicContextValue>({});\n\n/**\n * Props for `<PrismicProvider>`.\n */\nexport type PrismicProviderProps<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tLinkResolverFunction extends prismic.LinkResolverFunction<any> = prismic.LinkResolverFunction<any>,\n> = PrismicContextValue<LinkResolverFunction>;\n\n/**\n * React context provider to share configuration for `@prismicio/react`\n * components and hooks.\n *\n * @returns A React context provider with shared configuration.\n */\nexport const PrismicProvider = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tLinkResolverFunction extends prismic.LinkResolverFunction<any>,\n>({\n\tclient,\n\tlinkResolver,\n\trichTextComponents,\n\tinternalLinkComponent,\n\texternalLinkComponent,\n\tchildren,\n}: PrismicProviderProps<LinkResolverFunction>): JSX.Element => {\n\tconst value = React.useMemo<PrismicContextValue<LinkResolverFunction>>(\n\t\t() => ({\n\t\t\tclient,\n\t\t\tlinkResolver,\n\t\t\trichTextComponents,\n\t\t\tinternalLinkComponent,\n\t\t\texternalLinkComponent,\n\t\t}),\n\t\t[\n\t\t\tclient,\n\t\t\tlinkResolver,\n\t\t\trichTextComponents,\n\t\t\tinternalLinkComponent,\n\t\t\texternalLinkComponent,\n\t\t],\n\t);\n\n\treturn (\n\t\t<PrismicContext.Provider value={value}>{children}</PrismicContext.Provider>\n\t);\n};\n"],"names":[],"mappings":";;AAoFO,MAAM,iBAAiB,MAAM,cAAmC,EAAE;AAgB5D,MAAA,kBAAkB,CAG7B,EACD,QACA,cACA,oBACA,uBACA,uBACA,eAC6D;AACvD,QAAA,QAAQ,MAAM,QACnB,OAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IAED;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACA;AAGF,SACE,oBAAA,eAAe,UAAf,EAAwB,OAAe,SAAS,CAAA;AAEnD;"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const prismicR = require("@prismicio/richtext");
5
- const PrismicRichText$1 = require("./react-server/PrismicRichText.cjs");
6
- const usePrismicContext = require("./usePrismicContext.cjs");
7
- function _interopNamespaceDefault(e) {
8
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
9
- if (e) {
10
- for (const k in e) {
11
- if (k !== "default") {
12
- const d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: () => e[k]
16
- });
17
- }
18
- }
19
- }
20
- n.default = e;
21
- return Object.freeze(n);
22
- }
23
- const prismicR__namespace = /* @__PURE__ */ _interopNamespaceDefault(prismicR);
24
- const PrismicRichText = function PrismicRichText2({ components, ...restProps }) {
25
- const context = usePrismicContext.usePrismicContext();
26
- const serializer = prismicR__namespace.composeSerializers(typeof components === "object" ? prismicR__namespace.wrapMapSerializer(components) : components, typeof context.richTextComponents === "object" ? prismicR__namespace.wrapMapSerializer(context.richTextComponents) : context.richTextComponents);
27
- return /* @__PURE__ */ jsxRuntime.jsx(PrismicRichText$1.PrismicRichText, { components: serializer, internalLinkComponent: context.internalLinkComponent, externalLinkComponent: context.externalLinkComponent, ...restProps });
28
- };
29
- exports.PrismicRichText = PrismicRichText;
30
- //# sourceMappingURL=PrismicRichText.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrismicRichText.cjs","sources":["../../src/PrismicRichText.tsx"],"sourcesContent":["\"use client\";\n\nimport * as prismic from \"@prismicio/client\";\nimport * as prismicR from \"@prismicio/richtext\";\n\nimport {\n\tPrismicRichText as ServerPrismicRichText,\n\tPrismicRichTextProps,\n} from \"./react-server/PrismicRichText\";\n\nimport { usePrismicContext } from \"./usePrismicContext\";\n\nexport type { PrismicRichTextProps };\n\nexport const PrismicRichText = function PrismicRichText<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tLinkResolverFunction extends prismic.LinkResolverFunction<any> = prismic.LinkResolverFunction,\n>({ components, ...restProps }: PrismicRichTextProps<LinkResolverFunction>) {\n\tconst context = usePrismicContext();\n\n\tconst serializer = prismicR.composeSerializers(\n\t\ttypeof components === \"object\"\n\t\t\t? prismicR.wrapMapSerializer(components)\n\t\t\t: components,\n\t\ttypeof context.richTextComponents === \"object\"\n\t\t\t? prismicR.wrapMapSerializer(context.richTextComponents)\n\t\t\t: context.richTextComponents,\n\t);\n\n\treturn (\n\t\t<ServerPrismicRichText\n\t\t\tcomponents={serializer}\n\t\t\tinternalLinkComponent={context.internalLinkComponent}\n\t\t\texternalLinkComponent={context.externalLinkComponent}\n\t\t\t{...restProps}\n\t\t/>\n\t);\n};\n"],"names":["PrismicRichText","usePrismicContext","prismicR","jsx","ServerPrismicRichText"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAcO,MAAM,kBAAkB,SAASA,iBAGtC,EAAE,YAAY,GAAG,aAAuD;AACzE,QAAM,UAAUC,kBAAAA;AAEV,QAAA,aAAaC,oBAAS,mBAC3B,OAAO,eAAe,WACnBA,oBAAS,kBAAkB,UAAU,IACrC,YACH,OAAO,QAAQ,uBAAuB,WACnCA,oBAAS,kBAAkB,QAAQ,kBAAkB,IACrD,QAAQ,kBAAkB;AAI7B,SAAAC,2BAAA,IAACC,kBACA,iBAAA,EAAA,YAAY,YACZ,uBAAuB,QAAQ,uBAC/B,uBAAuB,QAAQ,uBAC3B,GAAA,UAAU,CAAA;AAGjB;;"}
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
5
- const devMsg = require("./lib/devMsg.cjs");
6
- const isFilled = require('./_node_modules/@prismicio/client/dist/helpers/isFilled.cjs');
7
- const asText = require('./_node_modules/@prismicio/client/dist/helpers/asText.cjs');
8
- function _interopNamespaceDefault(e) {
9
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
10
- if (e) {
11
- for (const k in e) {
12
- if (k !== "default") {
13
- const d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: () => e[k]
17
- });
18
- }
19
- }
20
- }
21
- n.default = e;
22
- return Object.freeze(n);
23
- }
24
- const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
25
- const PrismicText = (props) => {
26
- if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
27
- if ("className" in props) {
28
- console.warn(`[PrismicText] className cannot be passed to <PrismicText> since it renders plain text without a wrapping component. For more details, see ${devMsg.devMsg("classname-is-not-a-valid-prop")}.`, props.field);
29
- }
30
- if (typeof props.field === "string") {
31
- throw new Error(`[PrismicText] The "field" prop only accepts a Rich Text or Title field's value but was provided a different type of field instead (e.g. a Key Text or Select field). You can resolve this error by rendering the field value inline without <PrismicText>. For more details, see ${devMsg.devMsg("prismictext-works-only-with-rich-text-and-title-fields")}`);
32
- }
33
- }
34
- return React__namespace.useMemo(() => {
35
- if (isFilled.richText(props.field)) {
36
- const text = asText.asText(props.field, props.separator);
37
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: text });
38
- } else {
39
- return props.fallback != null ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.fallback }) : null;
40
- }
41
- }, [props.field, props.fallback, props.separator]);
42
- };
43
- exports.PrismicText = PrismicText;
44
- //# sourceMappingURL=PrismicText.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrismicText.cjs","sources":["../../src/PrismicText.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as prismic from \"@prismicio/client\";\n\nimport { devMsg } from \"./lib/devMsg\";\n\n/**\n * Props for `<PrismicText>`.\n */\nexport type PrismicTextProps = {\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 string rendered when the field is empty. If a fallback is not given,\n\t * `null` will be rendered.\n\t */\n\tfallback?: string;\n\n\t/**\n\t * The separator used between blocks. Defaults to `\\n`.\n\t */\n\tseparator?: string;\n};\n\n/**\n * React component that renders content from a Prismic Rich Text field as plain\n * text.\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 `<PrismicText>`.\n * @example Rendering a Rich Text field as plain text.\n *\n * ```jsx\n * <PrismicText field={document.data.content} />;\n * ```\n *\n * @param props - Props for the component.\n *\n * @returns The Rich Text field's content as plain text.\n *\n * @see Learn about Rich Text fields {@link https://prismic.io/docs/core-concepts/rich-text-title}\n */\nexport const PrismicText = (props: PrismicTextProps): JSX.Element | null => {\n\tif (\n\t\ttypeof process !== \"undefined\" &&\n\t\tprocess.env.NODE_ENV === \"development\"\n\t) {\n\t\tif (\"className\" in props) {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicText] className cannot be passed to <PrismicText> since it renders plain text without a wrapping component. For more details, see ${devMsg(\n\t\t\t\t\t\"classname-is-not-a-valid-prop\",\n\t\t\t\t)}.`,\n\t\t\t\tprops.field,\n\t\t\t);\n\t\t}\n\n\t\tif (typeof props.field === \"string\") {\n\t\t\tthrow new Error(\n\t\t\t\t`[PrismicText] The \"field\" prop only accepts a Rich Text or Title field's value but was provided a different type of field instead (e.g. a Key Text or Select field). You can resolve this error by rendering the field value inline without <PrismicText>. For more details, see ${devMsg(\n\t\t\t\t\t\"prismictext-works-only-with-rich-text-and-title-fields\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\t}\n\n\treturn React.useMemo(() => {\n\t\tif (prismic.isFilled.richText(props.field)) {\n\t\t\tconst text = prismic.asText(props.field, props.separator);\n\n\t\t\treturn <>{text}</>;\n\t\t} else {\n\t\t\treturn props.fallback != null ? <>{props.fallback}</> : null;\n\t\t}\n\t}, [props.field, props.fallback, props.separator]);\n};\n"],"names":["devMsg","React","prismic.isFilled.richText","prismic.asText","jsx","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6Ca,MAAA,cAAc,CAAC,UAA+C;AAC1E,MACC,OAAO,YAAY,eACnB,QAAQ,IAAI,aAAa,eACxB;AACD,QAAI,eAAe,OAAO;AACzB,cAAQ,KACP,6IAA6IA,OAAA,OAC5I,+BAA+B,MAEhC,MAAM,KAAK;AAAA,IAEZ;AAEG,QAAA,OAAO,MAAM,UAAU,UAAU;AACpC,YAAM,IAAI,MACT,oRAAoRA,OAAA,OACnR,wDAAwD,GACtD;AAAA,IAEJ;AAAA,EACD;AAEM,SAAAC,iBAAM,QAAQ,MAAK;AACzB,QAAIC,SAA0B,SAAA,MAAM,KAAK,GAAG;AAC3C,YAAM,OAAOC,OAAAA,OAAe,MAAM,OAAO,MAAM,SAAS;AAExD,mEAAU,UAAK,KAAA,CAAA;AAAA,IAAA,OACT;AACN,aAAO,MAAM,YAAY,OAAUC,+BAAAC,WAAAA,UAAA,EAAA,UAAA,MAAM,SAAS,CAAA,IAAM;AAAA,IACxD;AAAA,EAAA,GACC,CAAC,MAAM,OAAO,MAAM,UAAU,MAAM,SAAS,CAAC;AAClD;;"}
@@ -1,43 +0,0 @@
1
- 'use client';
2
- 'use client';
3
- "use strict";
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
5
- const React = require("react");
6
- const getToolbarSrc = require('./_node_modules/@prismicio/client/dist/getToolbarSrc.cjs');
7
- function _interopNamespaceDefault(e) {
8
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
9
- if (e) {
10
- for (const k in e) {
11
- if (k !== "default") {
12
- const d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: () => e[k]
16
- });
17
- }
18
- }
19
- }
20
- n.default = e;
21
- return Object.freeze(n);
22
- }
23
- const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
24
- const PrismicToolbar = ({ repositoryName }) => {
25
- const src = getToolbarSrc.getToolbarSrc(repositoryName);
26
- React__namespace.useEffect(() => {
27
- const existingScript = document.querySelector(`script[src="${src}"]`);
28
- if (!existingScript) {
29
- const script = document.createElement("script");
30
- script.src = src;
31
- script.defer = true;
32
- script.dataset.prismicToolbar = "";
33
- script.dataset.repositoryName = repositoryName;
34
- if (typeof process !== "undefined" && process.env.NODE_ENV === "test") {
35
- script._evaluateScript = false;
36
- }
37
- document.body.appendChild(script);
38
- }
39
- }, [repositoryName, src]);
40
- return null;
41
- };
42
- exports.PrismicToolbar = PrismicToolbar;
43
- //# sourceMappingURL=PrismicToolbar.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrismicToolbar.cjs","sources":["../../src/PrismicToolbar.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { getToolbarSrc } from \"@prismicio/client\";\n\n/**\n * Props for `<PrismicToolbar>`.\n */\nexport type PrismicToolbarProps = {\n\t/**\n\t * The name of the Prismic repository. For example, `\"my-repo\"` if the\n\t * repository URL is `my-repo.prismic.io`.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * The type of toolbar needed for the repository. Defaults to `\"new\"`.\n\t *\n\t * @deprecated All repositories use the \"new\"-type toolbar. This option can be\n\t * removed.\n\t * @see To check which version you need, view the Prismic Toolbar documentation {@link https://prismic.io/docs/technologies/previews-and-the-prismic-toolbar-reactjs}\n\t */\n\ttype?: \"new\" | \"legacy\";\n};\n\n/**\n * React component that injects the Prismic Toolbar into the app. This component\n * can be placed anywhere in the React tree.\n */\nexport const PrismicToolbar = ({\n\trepositoryName,\n}: PrismicToolbarProps): null => {\n\tconst src = getToolbarSrc(repositoryName);\n\n\tReact.useEffect(() => {\n\t\tconst existingScript = document.querySelector(`script[src=\"${src}\"]`);\n\n\t\tif (!existingScript) {\n\t\t\tconst script = document.createElement(\"script\");\n\t\t\tscript.src = src;\n\t\t\tscript.defer = true;\n\n\t\t\t// Used to distinguish the toolbar element from other elements.\n\t\t\tscript.dataset.prismicToolbar = \"\";\n\t\t\tscript.dataset.repositoryName = repositoryName;\n\n\t\t\t// Disable Happy DOM `<script>` evaluation during\n\t\t\t// tests.\n\t\t\t//\n\t\t\t// This is a patch ONLY INCLUDED DURING TESTS. It will\n\t\t\t// be pruned during code minification in non-test\n\t\t\t// environments.\n\t\t\t//\n\t\t\t// @see https://github.com/capricorn86/happy-dom/blob/02ae081e36f990c06171eda44f9d885fd9413d73/packages/happy-dom/src/nodes/html-script-element/HTMLScriptElement.ts#L191-L209\n\t\t\tif (typeof process !== \"undefined\" && process.env.NODE_ENV === \"test\") {\n\t\t\t\t// @ts-expect-error - `_evaluateScript` is a Happy DOM-specific property.\n\t\t\t\tscript._evaluateScript = false;\n\t\t\t}\n\n\t\t\tdocument.body.appendChild(script);\n\t\t}\n\t}, [repositoryName, src]);\n\n\treturn null;\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6BO;AAGA;AAENA;AACC;AAEA;AACO;AACN;AACA;AAGA;AACA;AAUA;AAEC;AAAyB;AAGjB;AAAuB;AAChC;AAGK;AACR;;"}
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const pascalCase = require("./lib/pascalCase.cjs");
5
- const TODOSliceComponent = ({ slice }) => {
6
- if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
7
- const type = "slice_type" in slice ? slice.slice_type : slice.type;
8
- console.warn(`[SliceZone] Could not find a component for Slice type "${type}"`, slice);
9
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { "data-slice-zone-todo-component": "", "data-slice-type": type, children: [
10
- "Could not find a component for Slice type “",
11
- type,
12
- "”"
13
- ] });
14
- } else {
15
- return null;
16
- }
17
- };
18
- function SliceZone({ slices = [], components = {}, resolver, defaultComponent, context = {} }) {
19
- if (process.env.NODE_ENV === "development") {
20
- if (resolver) {
21
- console.warn("The `resolver` prop is deprecated. Please replace it with a components map using the `components` prop.");
22
- }
23
- }
24
- const renderedSlices = slices.map((slice, index) => {
25
- const type = "slice_type" in slice ? slice.slice_type : slice.type;
26
- let Comp = components[type] || defaultComponent;
27
- if (resolver) {
28
- const resolvedComp = resolver({
29
- slice,
30
- sliceName: pascalCase.pascalCase(type),
31
- i: index
32
- });
33
- if (resolvedComp) {
34
- Comp = resolvedComp;
35
- }
36
- }
37
- const key = "id" in slice && slice.id ? slice.id : `${index}-${JSON.stringify(slice)}`;
38
- if (Comp) {
39
- if (slice.__mapped) {
40
- const { __mapped, ...mappedProps } = slice;
41
- return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...mappedProps }, key);
42
- } else {
43
- return /* @__PURE__ */ jsxRuntime.jsx(Comp, { slice, index, slices, context }, key);
44
- }
45
- } else {
46
- return /* @__PURE__ */ jsxRuntime.jsx(TODOSliceComponent, { slice }, key);
47
- }
48
- });
49
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderedSlices });
50
- }
51
- exports.SliceZone = SliceZone;
52
- exports.TODOSliceComponent = TODOSliceComponent;
53
- //# sourceMappingURL=SliceZone.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SliceZone.cjs","sources":["../../src/SliceZone.tsx"],"sourcesContent":["import { ComponentType } from \"react\";\nimport * as prismic from \"@prismicio/client\";\n\nimport { pascalCase, PascalCase } from \"./lib/pascalCase\";\n\n/**\n * Returns the type of a `SliceLike` type.\n *\n * @typeParam Slice - The Slice from which the type will be extracted.\n */\ntype ExtractSliceType<TSlice extends SliceLike> = TSlice extends prismic.Slice\n\t? TSlice[\"slice_type\"]\n\t: TSlice extends SliceLikeGraphQL\n\t? TSlice[\"type\"]\n\t: never;\n\n/**\n * The minimum required properties to represent a Prismic Slice from the Prismic\n * Rest API V2 for the `unstable_mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the Slice.\n */\nexport type SliceLikeRestV2<TSliceType extends string = string> = Pick<\n\tprismic.Slice<TSliceType>,\n\t\"id\" | \"slice_type\"\n>;\n\n/**\n * The minimum required properties to represent a Prismic Slice from the Prismic\n * GraphQL API for the `unstable_mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the Slice.\n */\nexport type SliceLikeGraphQL<TSliceType extends string = string> = {\n\ttype: prismic.Slice<TSliceType>[\"slice_type\"];\n};\n\n/**\n * The minimum required properties to represent a Prismic Slice for the\n * `unstable_mapSliceZone()` helper.\n *\n * If using Prismic's Rest API V2, use the `Slice` export from\n * `@prismicio/client` for a full interface.\n *\n * @typeParam SliceType - Type name of the Slice.\n */\nexport type SliceLike<TSliceType extends string = string> = (\n\t| SliceLikeRestV2<TSliceType>\n\t| SliceLikeGraphQL<TSliceType>\n) & {\n\t/**\n\t * If `true`, this Slice has been modified from its original value using a\n\t * mapper and `@prismicio/client`'s `mapSliceZone()`.\n\t *\n\t * @internal\n\t */\n\t__mapped?: true;\n};\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/client` using\n * `SliceLike`.\n *\n * If using Prismic's Rest API V2, use the `SliceZone` export from\n * `@prismicio/client` for the full type.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n */\nexport type SliceZoneLike<TSlice extends SliceLike = SliceLike> =\n\treadonly TSlice[];\n\n/**\n * React props for a component rendering content from a Prismic Slice using the\n * `<SliceZone>` component.\n *\n * @typeParam TSlice - The Slice passed as a prop.\n * @typeParam TContext - Arbitrary data passed to `<SliceZone>` and made\n * available to all Slice components.\n */\nexport type SliceComponentProps<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> = {\n\t/**\n\t * Slice data for this component.\n\t */\n\tslice: TSlice;\n\n\t/**\n\t * The index of the Slice in the Slice Zone.\n\t */\n\tindex: number;\n\n\t/**\n\t * All Slices from the Slice Zone to which the Slice belongs.\n\t */\n\t// TODO: We have to keep this list of Slices general due to circular\n\t// reference limtiations. If we had another generic to determine the full\n\t// union of Slice types, it would include TSlice. This causes TypeScript to\n\t// throw a compilation error.\n\tslices: SliceZoneLike<\n\t\tTSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2\n\t>;\n\n\t/**\n\t * Arbitrary data passed to `<SliceZone>` and made available to all Slice\n\t * components.\n\t */\n\tcontext: TContext;\n};\n\n/**\n * A React component to be rendered for each instance of its Slice.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n * @typeParam TContext - Arbitrary data made available to all Slice components.\n */\nexport type SliceComponentType<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n\tTContext = unknown,\n> = React.ComponentType<SliceComponentProps<TSlice, TContext>>;\n\n/**\n * A record of Slice types mapped to a React component. The component will be\n * rendered for each instance of its Slice.\n *\n * @deprecated This type is no longer used by `@prismicio/react`. Prefer using\n * `Record<string, SliceComponentType<any>>` instead.\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n * @typeParam TContext - Arbitrary data made available to all Slice components.\n */\nexport type SliceZoneComponents<\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> =\n\t// This is purposely not wrapped in Partial to ensure a component is provided\n\t// for all Slice types. <SliceZone> will render a default component if one is\n\t// not provided, but it *should* be a type error if an explicit component is\n\t// missing.\n\t//\n\t// If a developer purposely does not want to provide a component, they can\n\t// assign it to the TODOSliceComponent exported from this package. This\n\t// signals to future developers that it is a placeholder and should be\n\t// implemented.\n\t{\n\t\t[SliceType in ExtractSliceType<TSlice>]: SliceComponentType<\n\t\t\tExtract<TSlice, SliceLike<SliceType>> extends never\n\t\t\t\t? SliceLike\n\t\t\t\t: Extract<TSlice, SliceLike<SliceType>>,\n\t\t\tTContext\n\t\t>;\n\t};\n\n/**\n * Arguments for a `<SliceZone>` `resolver` function.\n */\ntype SliceZoneResolverArgs<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n> = {\n\t/**\n\t * The Slice to resolve to a React component.\n\t */\n\tslice: TSlice;\n\n\t/**\n\t * The name of the Slice.\n\t */\n\tsliceName: PascalCase<ExtractSliceType<TSlice>>;\n\n\t/**\n\t * The index of the Slice in the Slice Zone.\n\t */\n\ti: number;\n};\n\n/**\n * A function that determines the rendered React component for each Slice in the\n * Slice Zone. If a nullish value is returned, the component will fallback to\n * the `components` or `defaultComponent` props to determine the rendered\n * component.\n *\n * @deprecated Use the `components` prop instead.\n *\n * @param args - Arguments for the resolver function.\n *\n * @returns The React component to render for a Slice.\n */\nexport type SliceZoneResolver<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n> = (\n\targs: SliceZoneResolverArgs<TSlice>,\n) => // eslint-disable-next-line @typescript-eslint/no-explicit-any\nComponentType<any> | undefined | null;\n\n/**\n * React props for the `<SliceZone>` component.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n * @typeParam TContext - Arbitrary data made available to all Slice components.\n */\nexport type SliceZoneProps<TContext = unknown> = {\n\t/**\n\t * List of Slice data from the Slice Zone.\n\t */\n\tslices?: SliceZoneLike;\n\n\t/**\n\t * A record mapping Slice types to React components.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tcomponents?: Record<string, ComponentType<any>>;\n\n\t/**\n\t * A function that determines the rendered React component for each Slice in\n\t * the Slice Zone.\n\t *\n\t * @deprecated Use the `components` prop instead.\n\t *\n\t * @param args - Arguments for the resolver function.\n\t *\n\t * @returns The React component to render for a Slice.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tresolver?: SliceZoneResolver<any>;\n\n\t/**\n\t * The React component rendered if a component mapping from the `components`\n\t * prop cannot be found.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: ComponentType<SliceComponentProps<any, TContext>>;\n\n\t/**\n\t * Arbitrary data made available to all Slice components.\n\t */\n\tcontext?: TContext;\n};\n\n/**\n * This Slice component can be used as a reminder to provide a proper\n * implementation.\n *\n * This is also the default React component rendered when a component mapping\n * cannot be found in `<SliceZone>`.\n */\nexport const TODOSliceComponent = <TSlice extends SliceLike>({\n\tslice,\n}: {\n\tslice: TSlice;\n}): JSX.Element | null => {\n\tif (\n\t\ttypeof process !== \"undefined\" &&\n\t\tprocess.env.NODE_ENV === \"development\"\n\t) {\n\t\tconst type = \"slice_type\" in slice ? slice.slice_type : slice.type;\n\n\t\tconsole.warn(\n\t\t\t`[SliceZone] Could not find a component for Slice type \"${type}\"`,\n\t\t\tslice,\n\t\t);\n\n\t\treturn (\n\t\t\t<section data-slice-zone-todo-component=\"\" data-slice-type={type}>\n\t\t\t\tCould not find a component for Slice type &ldquo;{type}\n\t\t\t\t&rdquo;\n\t\t\t</section>\n\t\t);\n\t} else {\n\t\treturn null;\n\t}\n};\n\n/**\n * Renders content from a Prismic Slice Zone using React components for each\n * type of Slice.\n *\n * If a component is not provided for a type of Slice, a default component can\n * be provided. A fallback component is provided by default that will not be\n * rendered in a production build of your app.\n *\n * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.\n * @typeParam TContext - Arbitrary data made available to all Slice components.\n *\n * @returns The Slice Zone's content as React components.\n *\n * @see Learn about Prismic Slices and Slice Zones {@link https://prismic.io/docs/core-concepts/slices}\n */\nexport function SliceZone<TContext>({\n\tslices = [],\n\tcomponents = {},\n\tresolver,\n\tdefaultComponent,\n\tcontext = {} as TContext,\n}: SliceZoneProps<TContext>) {\n\t// TODO: Remove in v3 when the `resolver` prop is removed.\n\tif (process.env.NODE_ENV === \"development\") {\n\t\tif (resolver) {\n\t\t\tconsole.warn(\n\t\t\t\t\"The `resolver` prop is deprecated. Please replace it with a components map using the `components` prop.\",\n\t\t\t);\n\t\t}\n\t}\n\n\tconst renderedSlices = slices.map((slice, index) => {\n\t\tconst type = \"slice_type\" in slice ? slice.slice_type : slice.type;\n\n\t\tlet Comp = components[type as keyof typeof components] || defaultComponent;\n\n\t\t// TODO: Remove `resolver` in v3 in favor of `components`.\n\t\tif (resolver) {\n\t\t\tconst resolvedComp = resolver({\n\t\t\t\tslice,\n\t\t\t\tsliceName: pascalCase(type),\n\t\t\t\ti: index,\n\t\t\t});\n\n\t\t\tif (resolvedComp) {\n\t\t\t\tComp = resolvedComp as typeof Comp;\n\t\t\t}\n\t\t}\n\n\t\tconst key =\n\t\t\t\"id\" in slice && slice.id\n\t\t\t\t? slice.id\n\t\t\t\t: `${index}-${JSON.stringify(slice)}`;\n\n\t\tif (Comp) {\n\t\t\tif (slice.__mapped) {\n\t\t\t\tconst { __mapped, ...mappedProps } = slice;\n\n\t\t\t\treturn <Comp key={key} {...mappedProps} />;\n\t\t\t} else {\n\t\t\t\treturn (\n\t\t\t\t\t<Comp\n\t\t\t\t\t\tkey={key}\n\t\t\t\t\t\tslice={slice}\n\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\tslices={slices}\n\t\t\t\t\t\tcontext={context}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\treturn <TODOSliceComponent key={key} slice={slice} />;\n\t\t}\n\t});\n\n\treturn <>{renderedSlices}</>;\n}\n"],"names":["jsxs","pascalCase","jsx"],"mappings":";;;;AAyPO,MAAM,qBAAqB,CAA2B,EAC5D,YAGwB;AACxB,MACC,OAAO,YAAY,eACnB,QAAQ,IAAI,aAAa,eACxB;AACD,UAAM,OAAO,gBAAgB,QAAQ,MAAM,aAAa,MAAM;AAEtD,YAAA,KACP,0DAA0D,SAC1D,KAAK;AAGN,WACEA,2BAAAA,KAAA,WAAA,EAAQ,kCAA+B,IAAG,mBAAiB,MAC3D,UAAA;AAAA,MAAA;AAAA,MAAkD;AAAA,MAClD;AAAA,IACD,EAAA,CAAA;AAAA,EAAA,OAEK;AACC,WAAA;AAAA,EACP;AACF;SAiBgB,UAAoB,EACnC,SAAS,CAAA,GACT,aAAa,IACb,UACA,kBACA,UAAU,CAAA,KACgB;AAEtB,MAAA,QAAQ,IAAI,aAAa,eAAe;AAC3C,QAAI,UAAU;AACb,cAAQ,KACP,yGAAyG;AAAA,IAE1G;AAAA,EACD;AAED,QAAM,iBAAiB,OAAO,IAAI,CAAC,OAAO,UAAS;AAClD,UAAM,OAAO,gBAAgB,QAAQ,MAAM,aAAa,MAAM;AAE1D,QAAA,OAAO,WAAW,IAA+B,KAAK;AAG1D,QAAI,UAAU;AACb,YAAM,eAAe,SAAS;AAAA,QAC7B;AAAA,QACA,WAAWC,sBAAW,IAAI;AAAA,QAC1B,GAAG;AAAA,MAAA,CACH;AAED,UAAI,cAAc;AACV,eAAA;AAAA,MACP;AAAA,IACD;AAEK,UAAA,MACL,QAAQ,SAAS,MAAM,KACpB,MAAM,KACN,GAAG,SAAS,KAAK,UAAU,KAAK;AAEpC,QAAI,MAAM;AACT,UAAI,MAAM,UAAU;AACnB,cAAM,EAAE,UAAU,GAAG,YAAA,IAAgB;AAErC,eAAQC,2BAAAA,IAAA,MAAA,EAAe,GAAI,YAAA,GAAT,GAAqB;AAAA,MAAA,OACjC;AACN,8CACE,MAEA,EAAA,OACA,OACA,QACA,WAJK,GAIY;AAAA,MAGnB;AAAA,IAAA,OACK;AACC,aAAAA,2BAAA,IAAC,oBAA6B,EAAA,MAAA,GAAL,GAAkB;AAAA,IAClD;AAAA,EAAA,CACD;AAED,+DAAU,UAAe,eAAA,CAAA;AAC1B;;;"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var __defProp = Object.defineProperty;
4
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
- class PrismicError extends Error {
7
- constructor(message = "An invalid API response was returned", url, response) {
8
- super(message);
9
- __publicField(this, "url");
10
- __publicField(this, "response");
11
- this.url = url;
12
- this.response = response;
13
- }
14
- }
15
- exports.PrismicError = PrismicError;
16
- //# sourceMappingURL=PrismicError.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrismicError.cjs","sources":["../../../../../../node_modules/@prismicio/client/dist/errors/PrismicError.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nclass PrismicError extends Error {\n constructor(message = \"An invalid API response was returned\", url, response) {\n super(message);\n __publicField(this, \"url\");\n __publicField(this, \"response\");\n this.url = url;\n this.response = response;\n }\n}\nexport {\n PrismicError\n};\n//# sourceMappingURL=PrismicError.js.map\n"],"names":[],"mappings":";;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU,gBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AAC7G,MAAM,qBAAqB,MAAM;AAAA,EAC/B,YAAY,UAAU,wCAAwC,KAAK,UAAU;AAC3E,UAAM,OAAO;AACb,kBAAc,MAAM,KAAK;AACzB,kBAAc,MAAM,UAAU;AAC9B,SAAK,MAAM;AACX,SAAK,WAAW;AAAA,EACjB;AACH;;","x_google_ignoreList":[0]}
@@ -1,16 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- class PrismicError extends Error {
5
- constructor(message = "An invalid API response was returned", url, response) {
6
- super(message);
7
- __publicField(this, "url");
8
- __publicField(this, "response");
9
- this.url = url;
10
- this.response = response;
11
- }
12
- }
13
- export {
14
- PrismicError
15
- };
16
- //# sourceMappingURL=PrismicError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrismicError.js","sources":["../../../../../../node_modules/@prismicio/client/dist/errors/PrismicError.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nclass PrismicError extends Error {\n constructor(message = \"An invalid API response was returned\", url, response) {\n super(message);\n __publicField(this, \"url\");\n __publicField(this, \"response\");\n this.url = url;\n this.response = response;\n }\n}\nexport {\n PrismicError\n};\n//# sourceMappingURL=PrismicError.js.map\n"],"names":[],"mappings":"AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU,gBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AAC7G,MAAM,qBAAqB,MAAM;AAAA,EAC/B,YAAY,UAAU,wCAAwC,KAAK,UAAU;AAC3E,UAAM,OAAO;AACb,kBAAc,MAAM,KAAK;AACzB,kBAAc,MAAM,UAAU;AAC9B,SAAK,MAAM;AACX,SAAK,WAAW;AAAA,EACjB;AACH;","x_google_ignoreList":[0]}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const PrismicError = require("./errors/PrismicError.cjs");
4
- const isRepositoryName = require("./isRepositoryName.cjs");
5
- const getToolbarSrc = (repositoryName) => {
6
- if (isRepositoryName.isRepositoryName(repositoryName)) {
7
- return `https://static.cdn.prismic.io/prismic.js?new=true&repo=${repositoryName}`;
8
- } else {
9
- throw new PrismicError.PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);
10
- }
11
- };
12
- exports.getToolbarSrc = getToolbarSrc;
13
- //# sourceMappingURL=getToolbarSrc.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getToolbarSrc.cjs","sources":["../../../../../node_modules/@prismicio/client/dist/getToolbarSrc.js"],"sourcesContent":["import { PrismicError } from \"./errors/PrismicError.js\";\nimport { isRepositoryName } from \"./isRepositoryName.js\";\nconst getToolbarSrc = (repositoryName) => {\n if (isRepositoryName(repositoryName)) {\n return `https://static.cdn.prismic.io/prismic.js?new=true&repo=${repositoryName}`;\n } else {\n throw new PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);\n }\n};\nexport {\n getToolbarSrc\n};\n//# sourceMappingURL=getToolbarSrc.js.map\n"],"names":["isRepositoryName","PrismicError"],"mappings":";;;;AAEK,MAAC,gBAAgB,CAAC,mBAAmB;AACxC,MAAIA,iBAAAA,iBAAiB,cAAc,GAAG;AACpC,WAAO,0DAA0D;AAAA,EACrE,OAAS;AACL,UAAM,IAAIC,aAAAA,aAAa,iDAAiD,kBAAkB,QAAQ,MAAM;AAAA,EACzG;AACH;;","x_google_ignoreList":[0]}
@@ -1,13 +0,0 @@
1
- import { PrismicError } from "./errors/PrismicError.js";
2
- import { isRepositoryName } from "./isRepositoryName.js";
3
- const getToolbarSrc = (repositoryName) => {
4
- if (isRepositoryName(repositoryName)) {
5
- return `https://static.cdn.prismic.io/prismic.js?new=true&repo=${repositoryName}`;
6
- } else {
7
- throw new PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);
8
- }
9
- };
10
- export {
11
- getToolbarSrc
12
- };
13
- //# sourceMappingURL=getToolbarSrc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getToolbarSrc.js","sources":["../../../../../node_modules/@prismicio/client/dist/getToolbarSrc.js"],"sourcesContent":["import { PrismicError } from \"./errors/PrismicError.js\";\nimport { isRepositoryName } from \"./isRepositoryName.js\";\nconst getToolbarSrc = (repositoryName) => {\n if (isRepositoryName(repositoryName)) {\n return `https://static.cdn.prismic.io/prismic.js?new=true&repo=${repositoryName}`;\n } else {\n throw new PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);\n }\n};\nexport {\n getToolbarSrc\n};\n//# sourceMappingURL=getToolbarSrc.js.map\n"],"names":[],"mappings":";;AAEK,MAAC,gBAAgB,CAAC,mBAAmB;AACxC,MAAI,iBAAiB,cAAc,GAAG;AACpC,WAAO,0DAA0D;AAAA,EACrE,OAAS;AACL,UAAM,IAAI,aAAa,iDAAiD,kBAAkB,QAAQ,MAAM;AAAA,EACzG;AACH;","x_google_ignoreList":[0]}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const buildURL = require("../../../../imgix-url-builder/dist/buildURL.cjs");
4
- const buildPixelDensitySrcSet = require("../../../../imgix-url-builder/dist/buildPixelDensitySrcSet.cjs");
5
- const isFilled = require("./isFilled.cjs");
6
- const DEFAULT_PIXEL_DENSITIES = [1, 2, 3];
7
- const asImagePixelDensitySrcSet = (field, config = {}) => {
8
- if (field && isFilled.imageThumbnail(field)) {
9
- const { pixelDensities = DEFAULT_PIXEL_DENSITIES, ...imgixParams } = config;
10
- return {
11
- src: buildURL.buildURL(field.url, imgixParams),
12
- srcset: buildPixelDensitySrcSet.buildPixelDensitySrcSet(field.url, {
13
- ...imgixParams,
14
- pixelDensities
15
- })
16
- };
17
- } else {
18
- return null;
19
- }
20
- };
21
- exports.asImagePixelDensitySrcSet = asImagePixelDensitySrcSet;
22
- //# sourceMappingURL=asImagePixelDensitySrcSet.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asImagePixelDensitySrcSet.cjs","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.js"],"sourcesContent":["import { buildURL, buildPixelDensitySrcSet } from \"imgix-url-builder\";\nimport { imageThumbnail } from \"./isFilled.js\";\nconst DEFAULT_PIXEL_DENSITIES = [1, 2, 3];\nconst asImagePixelDensitySrcSet = (field, config = {}) => {\n if (field && imageThumbnail(field)) {\n const { pixelDensities = DEFAULT_PIXEL_DENSITIES, ...imgixParams } = config;\n return {\n src: buildURL(field.url, imgixParams),\n srcset: buildPixelDensitySrcSet(field.url, {\n ...imgixParams,\n pixelDensities\n })\n };\n } else {\n return null;\n }\n};\nexport {\n asImagePixelDensitySrcSet\n};\n//# sourceMappingURL=asImagePixelDensitySrcSet.js.map\n"],"names":["imageThumbnail","buildURL","buildPixelDensitySrcSet"],"mappings":";;;;;AAEA,MAAM,0BAA0B,CAAC,GAAG,GAAG,CAAC;AACnC,MAAC,4BAA4B,CAAC,OAAO,SAAS,OAAO;AACxD,MAAI,SAASA,wBAAe,KAAK,GAAG;AAClC,UAAM,EAAE,iBAAiB,yBAAyB,GAAG,YAAW,IAAK;AACrE,WAAO;AAAA,MACL,KAAKC,SAAQ,SAAC,MAAM,KAAK,WAAW;AAAA,MACpC,QAAQC,wBAAAA,wBAAwB,MAAM,KAAK;AAAA,QACzC,GAAG;AAAA,QACH;AAAA,MACR,CAAO;AAAA,IACP;AAAA,EACA,OAAS;AACL,WAAO;AAAA,EACR;AACH;;","x_google_ignoreList":[0]}
@@ -1,22 +0,0 @@
1
- import { buildURL } from "../../../../imgix-url-builder/dist/buildURL.js";
2
- import { buildPixelDensitySrcSet } from "../../../../imgix-url-builder/dist/buildPixelDensitySrcSet.js";
3
- import { imageThumbnail } from "./isFilled.js";
4
- const DEFAULT_PIXEL_DENSITIES = [1, 2, 3];
5
- const asImagePixelDensitySrcSet = (field, config = {}) => {
6
- if (field && imageThumbnail(field)) {
7
- const { pixelDensities = DEFAULT_PIXEL_DENSITIES, ...imgixParams } = config;
8
- return {
9
- src: buildURL(field.url, imgixParams),
10
- srcset: buildPixelDensitySrcSet(field.url, {
11
- ...imgixParams,
12
- pixelDensities
13
- })
14
- };
15
- } else {
16
- return null;
17
- }
18
- };
19
- export {
20
- asImagePixelDensitySrcSet
21
- };
22
- //# sourceMappingURL=asImagePixelDensitySrcSet.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asImagePixelDensitySrcSet.js","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.js"],"sourcesContent":["import { buildURL, buildPixelDensitySrcSet } from \"imgix-url-builder\";\nimport { imageThumbnail } from \"./isFilled.js\";\nconst DEFAULT_PIXEL_DENSITIES = [1, 2, 3];\nconst asImagePixelDensitySrcSet = (field, config = {}) => {\n if (field && imageThumbnail(field)) {\n const { pixelDensities = DEFAULT_PIXEL_DENSITIES, ...imgixParams } = config;\n return {\n src: buildURL(field.url, imgixParams),\n srcset: buildPixelDensitySrcSet(field.url, {\n ...imgixParams,\n pixelDensities\n })\n };\n } else {\n return null;\n }\n};\nexport {\n asImagePixelDensitySrcSet\n};\n//# sourceMappingURL=asImagePixelDensitySrcSet.js.map\n"],"names":[],"mappings":";;;AAEA,MAAM,0BAA0B,CAAC,GAAG,GAAG,CAAC;AACnC,MAAC,4BAA4B,CAAC,OAAO,SAAS,OAAO;AACxD,MAAI,SAAS,eAAe,KAAK,GAAG;AAClC,UAAM,EAAE,iBAAiB,yBAAyB,GAAG,YAAW,IAAK;AACrE,WAAO;AAAA,MACL,KAAK,SAAS,MAAM,KAAK,WAAW;AAAA,MACpC,QAAQ,wBAAwB,MAAM,KAAK;AAAA,QACzC,GAAG;AAAA,QACH;AAAA,MACR,CAAO;AAAA,IACP;AAAA,EACA,OAAS;AACL,WAAO;AAAA,EACR;AACH;","x_google_ignoreList":[0]}
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const buildURL = require("../../../../imgix-url-builder/dist/buildURL.cjs");
4
- const buildWidthSrcSet = require("../../../../imgix-url-builder/dist/buildWidthSrcSet.cjs");
5
- const isFilled = require("./isFilled.cjs");
6
- const DEFAULT_WIDTHS = [640, 828, 1200, 2048, 3840];
7
- const asImageWidthSrcSet = (field, config = {}) => {
8
- if (field && isFilled.imageThumbnail(field)) {
9
- let {
10
- widths = DEFAULT_WIDTHS,
11
- // eslint-disable-next-line prefer-const
12
- ...imgixParams
13
- } = config;
14
- const { url, dimensions, id: _id, alt: _alt, copyright: _copyright, edit: _edit, ...responsiveViews } = field;
15
- const responsiveViewObjects = Object.values(responsiveViews);
16
- if (widths === "thumbnails" && responsiveViewObjects.length < 1) {
17
- widths = DEFAULT_WIDTHS;
18
- }
19
- return {
20
- src: buildURL.buildURL(url, imgixParams),
21
- srcset: (
22
- // By this point, we know `widths` can only be
23
- // `"thubmanils"` if the field has thumbnails.
24
- widths === "thumbnails" ? [
25
- buildWidthSrcSet.buildWidthSrcSet(url, {
26
- ...imgixParams,
27
- widths: [dimensions.width]
28
- }),
29
- ...responsiveViewObjects.map((thumbnail) => {
30
- return buildWidthSrcSet.buildWidthSrcSet(thumbnail.url, {
31
- ...imgixParams,
32
- widths: [thumbnail.dimensions.width]
33
- });
34
- })
35
- ].join(", ") : buildWidthSrcSet.buildWidthSrcSet(field.url, {
36
- ...imgixParams,
37
- widths
38
- })
39
- )
40
- };
41
- } else {
42
- return null;
43
- }
44
- };
45
- exports.asImageWidthSrcSet = asImageWidthSrcSet;
46
- //# sourceMappingURL=asImageWidthSrcSet.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asImageWidthSrcSet.cjs","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.js"],"sourcesContent":["import { buildURL, buildWidthSrcSet } from \"imgix-url-builder\";\nimport { imageThumbnail } from \"./isFilled.js\";\nconst DEFAULT_WIDTHS = [640, 828, 1200, 2048, 3840];\nconst asImageWidthSrcSet = (field, config = {}) => {\n if (field && imageThumbnail(field)) {\n let {\n widths = DEFAULT_WIDTHS,\n // eslint-disable-next-line prefer-const\n ...imgixParams\n } = config;\n const { url, dimensions, id: _id, alt: _alt, copyright: _copyright, edit: _edit, ...responsiveViews } = field;\n const responsiveViewObjects = Object.values(responsiveViews);\n if (widths === \"thumbnails\" && responsiveViewObjects.length < 1) {\n widths = DEFAULT_WIDTHS;\n }\n return {\n src: buildURL(url, imgixParams),\n srcset: (\n // By this point, we know `widths` can only be\n // `\"thubmanils\"` if the field has thumbnails.\n widths === \"thumbnails\" ? [\n buildWidthSrcSet(url, {\n ...imgixParams,\n widths: [dimensions.width]\n }),\n ...responsiveViewObjects.map((thumbnail) => {\n return buildWidthSrcSet(thumbnail.url, {\n ...imgixParams,\n widths: [thumbnail.dimensions.width]\n });\n })\n ].join(\", \") : buildWidthSrcSet(field.url, {\n ...imgixParams,\n widths\n })\n )\n };\n } else {\n return null;\n }\n};\nexport {\n asImageWidthSrcSet\n};\n//# sourceMappingURL=asImageWidthSrcSet.js.map\n"],"names":["imageThumbnail","buildURL","buildWidthSrcSet"],"mappings":";;;;;AAEA,MAAM,iBAAiB,CAAC,KAAK,KAAK,MAAM,MAAM,IAAI;AAC7C,MAAC,qBAAqB,CAAC,OAAO,SAAS,OAAO;AACjD,MAAI,SAASA,wBAAe,KAAK,GAAG;AAClC,QAAI;AAAA,MACF,SAAS;AAAA;AAAA,MAET,GAAG;AAAA,IACJ,IAAG;AACJ,UAAM,EAAE,KAAK,YAAY,IAAI,KAAK,KAAK,MAAM,WAAW,YAAY,MAAM,OAAO,GAAG,gBAAe,IAAK;AACxG,UAAM,wBAAwB,OAAO,OAAO,eAAe;AAC3D,QAAI,WAAW,gBAAgB,sBAAsB,SAAS,GAAG;AAC/D,eAAS;AAAA,IACV;AACD,WAAO;AAAA,MACL,KAAKC,SAAAA,SAAS,KAAK,WAAW;AAAA,MAC9B;AAAA;AAAA;AAAA,QAGE,WAAW,eAAe;AAAA,UACxBC,iBAAAA,iBAAiB,KAAK;AAAA,YACpB,GAAG;AAAA,YACH,QAAQ,CAAC,WAAW,KAAK;AAAA,UACrC,CAAW;AAAA,UACD,GAAG,sBAAsB,IAAI,CAAC,cAAc;AAC1C,mBAAOA,iBAAgB,iBAAC,UAAU,KAAK;AAAA,cACrC,GAAG;AAAA,cACH,QAAQ,CAAC,UAAU,WAAW,KAAK;AAAA,YACjD,CAAa;AAAA,UACb,CAAW;AAAA,QACF,EAAC,KAAK,IAAI,IAAIA,iBAAAA,iBAAiB,MAAM,KAAK;AAAA,UACzC,GAAG;AAAA,UACH;AAAA,QACV,CAAS;AAAA;AAAA,IAET;AAAA,EACA,OAAS;AACL,WAAO;AAAA,EACR;AACH;;","x_google_ignoreList":[0]}
@@ -1,46 +0,0 @@
1
- import { buildURL } from "../../../../imgix-url-builder/dist/buildURL.js";
2
- import { buildWidthSrcSet } from "../../../../imgix-url-builder/dist/buildWidthSrcSet.js";
3
- import { imageThumbnail } from "./isFilled.js";
4
- const DEFAULT_WIDTHS = [640, 828, 1200, 2048, 3840];
5
- const asImageWidthSrcSet = (field, config = {}) => {
6
- if (field && imageThumbnail(field)) {
7
- let {
8
- widths = DEFAULT_WIDTHS,
9
- // eslint-disable-next-line prefer-const
10
- ...imgixParams
11
- } = config;
12
- const { url, dimensions, id: _id, alt: _alt, copyright: _copyright, edit: _edit, ...responsiveViews } = field;
13
- const responsiveViewObjects = Object.values(responsiveViews);
14
- if (widths === "thumbnails" && responsiveViewObjects.length < 1) {
15
- widths = DEFAULT_WIDTHS;
16
- }
17
- return {
18
- src: buildURL(url, imgixParams),
19
- srcset: (
20
- // By this point, we know `widths` can only be
21
- // `"thubmanils"` if the field has thumbnails.
22
- widths === "thumbnails" ? [
23
- buildWidthSrcSet(url, {
24
- ...imgixParams,
25
- widths: [dimensions.width]
26
- }),
27
- ...responsiveViewObjects.map((thumbnail) => {
28
- return buildWidthSrcSet(thumbnail.url, {
29
- ...imgixParams,
30
- widths: [thumbnail.dimensions.width]
31
- });
32
- })
33
- ].join(", ") : buildWidthSrcSet(field.url, {
34
- ...imgixParams,
35
- widths
36
- })
37
- )
38
- };
39
- } else {
40
- return null;
41
- }
42
- };
43
- export {
44
- asImageWidthSrcSet
45
- };
46
- //# sourceMappingURL=asImageWidthSrcSet.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asImageWidthSrcSet.js","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.js"],"sourcesContent":["import { buildURL, buildWidthSrcSet } from \"imgix-url-builder\";\nimport { imageThumbnail } from \"./isFilled.js\";\nconst DEFAULT_WIDTHS = [640, 828, 1200, 2048, 3840];\nconst asImageWidthSrcSet = (field, config = {}) => {\n if (field && imageThumbnail(field)) {\n let {\n widths = DEFAULT_WIDTHS,\n // eslint-disable-next-line prefer-const\n ...imgixParams\n } = config;\n const { url, dimensions, id: _id, alt: _alt, copyright: _copyright, edit: _edit, ...responsiveViews } = field;\n const responsiveViewObjects = Object.values(responsiveViews);\n if (widths === \"thumbnails\" && responsiveViewObjects.length < 1) {\n widths = DEFAULT_WIDTHS;\n }\n return {\n src: buildURL(url, imgixParams),\n srcset: (\n // By this point, we know `widths` can only be\n // `\"thubmanils\"` if the field has thumbnails.\n widths === \"thumbnails\" ? [\n buildWidthSrcSet(url, {\n ...imgixParams,\n widths: [dimensions.width]\n }),\n ...responsiveViewObjects.map((thumbnail) => {\n return buildWidthSrcSet(thumbnail.url, {\n ...imgixParams,\n widths: [thumbnail.dimensions.width]\n });\n })\n ].join(\", \") : buildWidthSrcSet(field.url, {\n ...imgixParams,\n widths\n })\n )\n };\n } else {\n return null;\n }\n};\nexport {\n asImageWidthSrcSet\n};\n//# sourceMappingURL=asImageWidthSrcSet.js.map\n"],"names":[],"mappings":";;;AAEA,MAAM,iBAAiB,CAAC,KAAK,KAAK,MAAM,MAAM,IAAI;AAC7C,MAAC,qBAAqB,CAAC,OAAO,SAAS,OAAO;AACjD,MAAI,SAAS,eAAe,KAAK,GAAG;AAClC,QAAI;AAAA,MACF,SAAS;AAAA;AAAA,MAET,GAAG;AAAA,IACJ,IAAG;AACJ,UAAM,EAAE,KAAK,YAAY,IAAI,KAAK,KAAK,MAAM,WAAW,YAAY,MAAM,OAAO,GAAG,gBAAe,IAAK;AACxG,UAAM,wBAAwB,OAAO,OAAO,eAAe;AAC3D,QAAI,WAAW,gBAAgB,sBAAsB,SAAS,GAAG;AAC/D,eAAS;AAAA,IACV;AACD,WAAO;AAAA,MACL,KAAK,SAAS,KAAK,WAAW;AAAA,MAC9B;AAAA;AAAA;AAAA,QAGE,WAAW,eAAe;AAAA,UACxB,iBAAiB,KAAK;AAAA,YACpB,GAAG;AAAA,YACH,QAAQ,CAAC,WAAW,KAAK;AAAA,UACrC,CAAW;AAAA,UACD,GAAG,sBAAsB,IAAI,CAAC,cAAc;AAC1C,mBAAO,iBAAiB,UAAU,KAAK;AAAA,cACrC,GAAG;AAAA,cACH,QAAQ,CAAC,UAAU,WAAW,KAAK;AAAA,YACjD,CAAa;AAAA,UACb,CAAW;AAAA,QACF,EAAC,KAAK,IAAI,IAAI,iBAAiB,MAAM,KAAK;AAAA,UACzC,GAAG;AAAA,UACH;AAAA,QACV,CAAS;AAAA;AAAA,IAET;AAAA,EACA,OAAS;AACL,WAAO;AAAA,EACR;AACH;","x_google_ignoreList":[0]}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const link = require("../types/value/link.cjs");
4
- const documentToLinkField = require("./documentToLinkField.cjs");
5
- const asLink = (linkFieldOrDocument, ...configObjectOrTuple) => {
6
- if (!linkFieldOrDocument) {
7
- return null;
8
- }
9
- const linkField = (
10
- // prettier-ignore
11
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
12
- // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501
13
- // TODO: Remove the `prettier-ignore` comment when this bug is fixed.
14
- "link_type" in linkFieldOrDocument ? linkFieldOrDocument : documentToLinkField.documentToLinkField(linkFieldOrDocument)
15
- );
16
- const [configObjectOrLinkResolver] = configObjectOrTuple;
17
- let config;
18
- if (typeof configObjectOrLinkResolver === "function" || configObjectOrLinkResolver == null) {
19
- config = {
20
- linkResolver: configObjectOrLinkResolver
21
- };
22
- } else {
23
- config = { ...configObjectOrLinkResolver };
24
- }
25
- switch (linkField.link_type) {
26
- case link.LinkType.Media:
27
- case link.LinkType.Web:
28
- return "url" in linkField ? linkField.url : null;
29
- case link.LinkType.Document: {
30
- if ("id" in linkField && config.linkResolver) {
31
- const resolvedURL = config.linkResolver(linkField);
32
- if (resolvedURL != null) {
33
- return resolvedURL;
34
- }
35
- }
36
- if ("url" in linkField && linkField.url) {
37
- return linkField.url;
38
- }
39
- return null;
40
- }
41
- case link.LinkType.Any:
42
- default:
43
- return null;
44
- }
45
- };
46
- exports.asLink = asLink;
47
- //# sourceMappingURL=asLink.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asLink.cjs","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/asLink.js"],"sourcesContent":["import { LinkType } from \"../types/value/link.js\";\nimport { documentToLinkField } from \"./documentToLinkField.js\";\nconst asLink = (linkFieldOrDocument, ...configObjectOrTuple) => {\n if (!linkFieldOrDocument) {\n return null;\n }\n const linkField = (\n // prettier-ignore\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501\n // TODO: Remove the `prettier-ignore` comment when this bug is fixed.\n \"link_type\" in linkFieldOrDocument ? linkFieldOrDocument : documentToLinkField(linkFieldOrDocument)\n );\n const [configObjectOrLinkResolver] = configObjectOrTuple;\n let config;\n if (typeof configObjectOrLinkResolver === \"function\" || configObjectOrLinkResolver == null) {\n config = {\n linkResolver: configObjectOrLinkResolver\n };\n } else {\n config = { ...configObjectOrLinkResolver };\n }\n switch (linkField.link_type) {\n case LinkType.Media:\n case LinkType.Web:\n return \"url\" in linkField ? linkField.url : null;\n case LinkType.Document: {\n if (\"id\" in linkField && config.linkResolver) {\n const resolvedURL = config.linkResolver(linkField);\n if (resolvedURL != null) {\n return resolvedURL;\n }\n }\n if (\"url\" in linkField && linkField.url) {\n return linkField.url;\n }\n return null;\n }\n case LinkType.Any:\n default:\n return null;\n }\n};\nexport {\n asLink\n};\n//# sourceMappingURL=asLink.js.map\n"],"names":["documentToLinkField","LinkType"],"mappings":";;;;AAEK,MAAC,SAAS,CAAC,wBAAwB,wBAAwB;AAC9D,MAAI,CAAC,qBAAqB;AACxB,WAAO;AAAA,EACR;AACD,QAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAKJ,eAAe,sBAAsB,sBAAsBA,oBAAAA,oBAAoB,mBAAmB;AAAA;AAEpG,QAAM,CAAC,0BAA0B,IAAI;AACrC,MAAI;AACJ,MAAI,OAAO,+BAA+B,cAAc,8BAA8B,MAAM;AAC1F,aAAS;AAAA,MACP,cAAc;AAAA,IACpB;AAAA,EACA,OAAS;AACL,aAAS,EAAE,GAAG;EACf;AACD,UAAQ,UAAU,WAAS;AAAA,IACzB,KAAKC,KAAAA,SAAS;AAAA,IACd,KAAKA,KAAQ,SAAC;AACZ,aAAO,SAAS,YAAY,UAAU,MAAM;AAAA,IAC9C,KAAKA,KAAAA,SAAS,UAAU;AACtB,UAAI,QAAQ,aAAa,OAAO,cAAc;AAC5C,cAAM,cAAc,OAAO,aAAa,SAAS;AACjD,YAAI,eAAe,MAAM;AACvB,iBAAO;AAAA,QACR;AAAA,MACF;AACD,UAAI,SAAS,aAAa,UAAU,KAAK;AACvC,eAAO,UAAU;AAAA,MAClB;AACD,aAAO;AAAA,IACR;AAAA,IACD,KAAKA,KAAAA,SAAS;AAAA,IACd;AACE,aAAO;AAAA,EACV;AACH;;","x_google_ignoreList":[0]}
@@ -1,47 +0,0 @@
1
- import { LinkType } from "../types/value/link.js";
2
- import { documentToLinkField } from "./documentToLinkField.js";
3
- const asLink = (linkFieldOrDocument, ...configObjectOrTuple) => {
4
- if (!linkFieldOrDocument) {
5
- return null;
6
- }
7
- const linkField = (
8
- // prettier-ignore
9
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10
- // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501
11
- // TODO: Remove the `prettier-ignore` comment when this bug is fixed.
12
- "link_type" in linkFieldOrDocument ? linkFieldOrDocument : documentToLinkField(linkFieldOrDocument)
13
- );
14
- const [configObjectOrLinkResolver] = configObjectOrTuple;
15
- let config;
16
- if (typeof configObjectOrLinkResolver === "function" || configObjectOrLinkResolver == null) {
17
- config = {
18
- linkResolver: configObjectOrLinkResolver
19
- };
20
- } else {
21
- config = { ...configObjectOrLinkResolver };
22
- }
23
- switch (linkField.link_type) {
24
- case LinkType.Media:
25
- case LinkType.Web:
26
- return "url" in linkField ? linkField.url : null;
27
- case LinkType.Document: {
28
- if ("id" in linkField && config.linkResolver) {
29
- const resolvedURL = config.linkResolver(linkField);
30
- if (resolvedURL != null) {
31
- return resolvedURL;
32
- }
33
- }
34
- if ("url" in linkField && linkField.url) {
35
- return linkField.url;
36
- }
37
- return null;
38
- }
39
- case LinkType.Any:
40
- default:
41
- return null;
42
- }
43
- };
44
- export {
45
- asLink
46
- };
47
- //# sourceMappingURL=asLink.js.map