@prismicio/react 2.6.1 → 2.7.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.
- package/dist/PrismicImage.cjs +1 -1
- package/dist/PrismicImage.cjs.map +1 -1
- package/dist/PrismicImage.js +1 -1
- package/dist/PrismicImage.js.map +1 -1
- package/dist/PrismicRichText.d.ts +1 -1
- package/dist/PrismicText.cjs +1 -1
- package/dist/PrismicText.cjs.map +1 -1
- package/dist/PrismicText.js +1 -1
- package/dist/PrismicText.js.map +1 -1
- package/dist/PrismicToolbar.cjs +1 -1
- package/dist/PrismicToolbar.cjs.map +1 -1
- package/dist/PrismicToolbar.js +1 -1
- package/dist/PrismicToolbar.js.map +1 -1
- package/dist/SliceZone.cjs +27 -37
- package/dist/SliceZone.cjs.map +1 -1
- package/dist/SliceZone.d.ts +36 -33
- package/dist/SliceZone.js +27 -20
- package/dist/SliceZone.js.map +1 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.cjs +2 -2
- package/dist/_node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.js +2 -2
- package/dist/_node_modules/@prismicio/client/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.cjs +2 -2
- package/dist/_node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.js +2 -2
- package/dist/_node_modules/@prismicio/client/dist/helpers/asImageWidthSrcSet.js.map +1 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.cjs +12 -3
- package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.cjs.map +1 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.js +12 -3
- package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.js.map +1 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/asText.cjs +11 -2
- package/dist/_node_modules/@prismicio/client/dist/helpers/asText.cjs.map +1 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/asText.js +11 -2
- package/dist/_node_modules/@prismicio/client/dist/helpers/asText.js.map +1 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.cjs.map +1 -1
- package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.js.map +1 -1
- package/dist/clientHooks.cjs.map +1 -1
- package/dist/clientHooks.d.ts +44 -116
- package/dist/clientHooks.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/react-server/PrismicLink.cjs +1 -1
- package/dist/react-server/PrismicLink.cjs.map +1 -1
- package/dist/react-server/PrismicLink.js +1 -1
- package/dist/react-server/PrismicLink.js.map +1 -1
- package/dist/react-server/PrismicRichText.cjs +1 -1
- package/dist/react-server/PrismicRichText.cjs.map +1 -1
- package/dist/react-server/PrismicRichText.js +1 -1
- package/dist/react-server/PrismicRichText.js.map +1 -1
- package/package.json +30 -18
- package/src/PrismicImage.tsx +4 -1
- package/src/PrismicText.tsx +4 -1
- package/src/PrismicToolbar.tsx +1 -1
- package/src/SliceZone.tsx +111 -93
- package/src/clientHooks.ts +26 -26
- package/src/index.ts +0 -2
- package/src/react-server/PrismicLink.tsx +4 -1
- package/src/react-server/PrismicRichText.tsx +4 -1
- package/src/lib/processPolyfill.ts +0 -4
package/dist/SliceZone.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceZone.js","sources":["../../src/SliceZone.tsx"],"sourcesContent":["import * as React 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<Slice extends SliceLike> = Slice extends SliceLikeRestV2\n\t? Slice[\"slice_type\"]\n\t: Slice extends SliceLikeGraphQL\n\t? Slice[\"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 `<SliceZone>` component.\n *\n * If using Prismic's Rest API V2, use the `Slice` export from\n * `@prismicio/types` for a full interface.\n *\n * @typeParam SliceType - Type name of the Slice.\n */\nexport type SliceLikeRestV2<SliceType extends string = string> = {\n\tslice_type: prismic.Slice<SliceType>[\"slice_type\"];\n\tid?: string;\n};\n\n/**\n * The minimum required properties to represent a Prismic Slice from the Prismic\n * GraphQL API for the `<SliceZone>` component.\n *\n * @typeParam SliceType - Type name of the Slice.\n */\nexport type SliceLikeGraphQL<SliceType extends string = string> = {\n\ttype: prismic.Slice<SliceType>[\"slice_type\"];\n};\n\n/**\n * The minimum required properties to represent a Prismic Slice for the\n * `<SliceZone>` component.\n *\n * If using Prismic's Rest API V2, use the `Slice` export from\n * `@prismicio/types` for a full interface.\n *\n * @typeParam SliceType - Type name of the Slice.\n */\nexport type SliceLike<SliceType extends string = string> =\n\t| SliceLikeRestV2<SliceType>\n\t| SliceLikeGraphQL<SliceType>;\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/types` using\n * `SliceLike`.\n *\n * If using Prismic's Rest API V2, use the `SliceZone` export from\n * `@prismicio/types` 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 = any,\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<SliceLike>;\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 * 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, TContext>({\n\tslice,\n}: SliceComponentProps<TSlice, TContext>): JSX.Element | null => {\n\tif (process.env.NODE_ENV === \"development\") {\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 “{type}\n\t\t\t\t”\n\t\t\t</section>\n\t\t);\n\t} else {\n\t\treturn null;\n\t}\n};\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\tTContext = unknown,\n> = (args: SliceZoneResolverArgs<TSlice>) =>\n\t| SliceComponentType<\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\tany,\n\t\t\tTContext\n\t >\n\t| undefined\n\t| 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, SliceComponentType<any, TContext>>;\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, TContext>;\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?: SliceComponentType<any, TContext>;\n\n\t/**\n\t * Arbitrary data made available to all Slice components.\n\t */\n\tcontext?: TContext;\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 const SliceZone = <TContext,>({\n\tslices = [],\n\tcomponents = {},\n\tresolver,\n\tdefaultComponent = TODOSliceComponent,\n\tcontext = {} as TContext,\n}: SliceZoneProps<TContext>): JSX.Element => {\n\tconst renderedSlices = React.useMemo(() => {\n\t\treturn slices.map((slice, index) => {\n\t\t\tconst type = \"slice_type\" in slice ? slice.slice_type : slice.type;\n\n\t\t\tlet Comp =\n\t\t\t\tcomponents[type as keyof typeof components] || defaultComponent;\n\n\t\t\t// TODO: Remove `resolver` in v3 in favor of `components`.\n\t\t\tif (resolver) {\n\t\t\t\tconst resolvedComp = resolver({\n\t\t\t\t\tslice,\n\t\t\t\t\tsliceName: pascalCase(type),\n\t\t\t\t\ti: index,\n\t\t\t\t});\n\n\t\t\t\tif (resolvedComp) {\n\t\t\t\t\tComp = resolvedComp as typeof Comp;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst key =\n\t\t\t\t\"id\" in slice && slice.id\n\t\t\t\t\t? slice.id\n\t\t\t\t\t: `${index}-${JSON.stringify(slice)}`;\n\n\t\t\treturn (\n\t\t\t\t<Comp\n\t\t\t\t\tkey={key}\n\t\t\t\t\tslice={slice}\n\t\t\t\t\tindex={index}\n\t\t\t\t\tslices={slices}\n\t\t\t\t\tcontext={context}\n\t\t\t\t/>\n\t\t\t);\n\t\t});\n\t}, [components, context, defaultComponent, slices, resolver]);\n\n\treturn <>{renderedSlices}</>;\n};\n"],"names":[],"mappings":";;;AA0JO,MAAM,qBAAqB,CAAqC,EACtE,YAC+D;AAC3D,MAAA,QAAQ,IAAI,aAAa,eAAe;AAC3C,UAAM,OAAO,gBAAgB,QAAQ,MAAM,aAAa,MAAM;AAEtD,YAAA,KACP,0DAA0D,SAC1D,KAAK;AAGN,WACE,qBAAA,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;AA6GO,MAAM,YAAY,CAAY,EACpC,SAAS,CAAA,GACT,aAAa,CAAA,GACb,UACA,mBAAmB,oBACnB,UAAU,SACiC;AACrC,QAAA,iBAAiB,MAAM,QAAQ,MAAK;AACzC,WAAO,OAAO,IAAI,CAAC,OAAO,UAAS;AAClC,YAAM,OAAO,gBAAgB,QAAQ,MAAM,aAAa,MAAM;AAE1D,UAAA,OACH,WAAW,IAA+B,KAAK;AAGhD,UAAI,UAAU;AACb,cAAM,eAAe,SAAS;AAAA,UAC7B;AAAA,UACA,WAAW,WAAW,IAAI;AAAA,UAC1B,GAAG;AAAA,QAAA,CACH;AAED,YAAI,cAAc;AACV,iBAAA;AAAA,QACP;AAAA,MACD;AAEK,YAAA,MACL,QAAQ,SAAS,MAAM,KACpB,MAAM,KACN,GAAG,SAAS,KAAK,UAAU,KAAK;AAEpC,iCACE,MAEA,EAAA,OACA,OACA,QACA,WAJK,GAIY;AAAA,IAAA,CAGnB;AAAA,EAAA,GACC,CAAC,YAAY,SAAS,kBAAkB,QAAQ,QAAQ,CAAC;AAE5D,yCAAU,UAAe,eAAA,CAAA;AAC1B;"}
|
|
1
|
+
{"version":3,"file":"SliceZone.js","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, TContext>({\n\tslice,\n}: SliceComponentProps<TSlice, TContext>): 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 “{type}\n\t\t\t\t”\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 = TODOSliceComponent,\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 (slice.__mapped) {\n\t\t\tconst { __mapped, ...mappedProps } = slice;\n\n\t\t\treturn <Comp key={key} {...mappedProps} />;\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<Comp\n\t\t\t\t\tkey={key}\n\t\t\t\t\tslice={slice}\n\t\t\t\t\tindex={index}\n\t\t\t\t\tslices={slices}\n\t\t\t\t\tcontext={context}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t});\n\n\treturn <>{renderedSlices}</>;\n}\n"],"names":[],"mappings":";;AAyPO,MAAM,qBAAqB,CAAqC,EACtE,YAC+D;AAC/D,MACC,OAAO,YAAY,eACnB,QAAQ,IAAI,aAAa,eACxB;AACD,UAAM,OAAO,gBAAgB,QAAQ,MAAM,aAAa,MAAM;AAEtD,YAAA,KACP,0DAA0D,SAC1D,KAAK;AAGN,WACE,qBAAA,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;AAiBM,SAAU,UAAoB,EACnC,SAAS,IACT,aAAa,CAAA,GACb,UACA,mBAAmB,oBACnB,UAAU,MACgB;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,WAAW,WAAW,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,UAAU;AACnB,YAAM,EAAE,UAAU,GAAG,YAAA,IAAgB;AAErC,aAAQ,oBAAA,MAAA,EAAe,GAAI,YAAA,GAAT,GAAqB;AAAA,IAAA,OACjC;AACN,iCACE,MAEA,EAAA,OACA,OACA,QACA,WAJK,GAIY;AAAA,IAGnB;AAAA,EAAA,CACD;AAED,yCAAU,UAAe,eAAA,CAAA;AAC1B;"}
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const index = require("../../../../imgix-url-builder/dist/index.cjs");
|
|
4
4
|
const isFilled = require("./isFilled.cjs");
|
|
5
5
|
const DEFAULT_PIXEL_DENSITIES = [1, 2, 3];
|
|
6
|
-
const asImagePixelDensitySrcSet = (field,
|
|
6
|
+
const asImagePixelDensitySrcSet = (field, config = {}) => {
|
|
7
7
|
if (field && isFilled.imageThumbnail(field)) {
|
|
8
|
-
const { pixelDensities = DEFAULT_PIXEL_DENSITIES, ...imgixParams } =
|
|
8
|
+
const { pixelDensities = DEFAULT_PIXEL_DENSITIES, ...imgixParams } = config;
|
|
9
9
|
return {
|
|
10
10
|
src: index.buildURL(field.url, imgixParams),
|
|
11
11
|
srcset: index.buildPixelDensitySrcSet(field.url, {
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,MAAQ,SAAC,MAAM,KAAK,WAAW;AAAA,MACpC,QAAQC,MAAAA,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,9 +1,9 @@
|
|
|
1
1
|
import { buildURL, buildPixelDensitySrcSet } from "../../../../imgix-url-builder/dist/index.js";
|
|
2
2
|
import { imageThumbnail } from "./isFilled.js";
|
|
3
3
|
const DEFAULT_PIXEL_DENSITIES = [1, 2, 3];
|
|
4
|
-
const asImagePixelDensitySrcSet = (field,
|
|
4
|
+
const asImagePixelDensitySrcSet = (field, config = {}) => {
|
|
5
5
|
if (field && imageThumbnail(field)) {
|
|
6
|
-
const { pixelDensities = DEFAULT_PIXEL_DENSITIES, ...imgixParams } =
|
|
6
|
+
const { pixelDensities = DEFAULT_PIXEL_DENSITIES, ...imgixParams } = config;
|
|
7
7
|
return {
|
|
8
8
|
src: buildURL(field.url, imgixParams),
|
|
9
9
|
srcset: buildPixelDensitySrcSet(field.url, {
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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]}
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const index = require("../../../../imgix-url-builder/dist/index.cjs");
|
|
4
4
|
const isFilled = require("./isFilled.cjs");
|
|
5
5
|
const DEFAULT_WIDTHS = [640, 828, 1200, 2048, 3840];
|
|
6
|
-
const asImageWidthSrcSet = (field,
|
|
6
|
+
const asImageWidthSrcSet = (field, config = {}) => {
|
|
7
7
|
if (field && isFilled.imageThumbnail(field)) {
|
|
8
8
|
let {
|
|
9
9
|
widths = DEFAULT_WIDTHS,
|
|
10
10
|
// eslint-disable-next-line prefer-const
|
|
11
11
|
...imgixParams
|
|
12
|
-
} =
|
|
12
|
+
} = config;
|
|
13
13
|
const { url, dimensions, alt: _alt, copyright: _copyright, ...responsiveViews } = field;
|
|
14
14
|
const responsiveViewObjects = Object.values(responsiveViews);
|
|
15
15
|
if (widths === "thumbnails" && responsiveViewObjects.length < 1) {
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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, alt: _alt, copyright: _copyright, ...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,KAAK,MAAM,WAAW,YAAY,GAAG,gBAAiB,IAAG;AAClF,UAAM,wBAAwB,OAAO,OAAO,eAAe;AAC3D,QAAI,WAAW,gBAAgB,sBAAsB,SAAS,GAAG;AAC/D,eAAS;AAAA,IACV;AACD,WAAO;AAAA,MACL,KAAKC,MAAAA,SAAS,KAAK,WAAW;AAAA,MAC9B;AAAA;AAAA;AAAA,QAGE,WAAW,eAAe;AAAA,UACxBC,MAAAA,iBAAiB,KAAK;AAAA,YACpB,GAAG;AAAA,YACH,QAAQ,CAAC,WAAW,KAAK;AAAA,UACrC,CAAW;AAAA,UACD,GAAG,sBAAsB,IAAI,CAAC,cAAc;AAC1C,mBAAOA,MAAgB,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,MAAAA,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,13 +1,13 @@
|
|
|
1
1
|
import { buildURL, buildWidthSrcSet } from "../../../../imgix-url-builder/dist/index.js";
|
|
2
2
|
import { imageThumbnail } from "./isFilled.js";
|
|
3
3
|
const DEFAULT_WIDTHS = [640, 828, 1200, 2048, 3840];
|
|
4
|
-
const asImageWidthSrcSet = (field,
|
|
4
|
+
const asImageWidthSrcSet = (field, config = {}) => {
|
|
5
5
|
if (field && imageThumbnail(field)) {
|
|
6
6
|
let {
|
|
7
7
|
widths = DEFAULT_WIDTHS,
|
|
8
8
|
// eslint-disable-next-line prefer-const
|
|
9
9
|
...imgixParams
|
|
10
|
-
} =
|
|
10
|
+
} = config;
|
|
11
11
|
const { url, dimensions, alt: _alt, copyright: _copyright, ...responsiveViews } = field;
|
|
12
12
|
const responsiveViewObjects = Object.values(responsiveViews);
|
|
13
13
|
if (widths === "thumbnails" && responsiveViewObjects.length < 1) {
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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, alt: _alt, copyright: _copyright, ...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,KAAK,MAAM,WAAW,YAAY,GAAG,gBAAiB,IAAG;AAClF,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]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const link = require("../types/value/link.cjs");
|
|
4
4
|
const documentToLinkField = require("./documentToLinkField.cjs");
|
|
5
|
-
const asLink = (linkFieldOrDocument,
|
|
5
|
+
const asLink = (linkFieldOrDocument, ...configObjectOrTuple) => {
|
|
6
6
|
if (!linkFieldOrDocument) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
@@ -13,13 +13,22 @@ const asLink = (linkFieldOrDocument, linkResolver) => {
|
|
|
13
13
|
// TODO: Remove the `prettier-ignore` comment when this bug is fixed.
|
|
14
14
|
"link_type" in linkFieldOrDocument ? linkFieldOrDocument : documentToLinkField.documentToLinkField(linkFieldOrDocument)
|
|
15
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
|
+
}
|
|
16
25
|
switch (linkField.link_type) {
|
|
17
26
|
case link.LinkType.Media:
|
|
18
27
|
case link.LinkType.Web:
|
|
19
28
|
return "url" in linkField ? linkField.url : null;
|
|
20
29
|
case link.LinkType.Document: {
|
|
21
|
-
if ("id" in linkField && linkResolver) {
|
|
22
|
-
const resolvedURL = linkResolver(linkField);
|
|
30
|
+
if ("id" in linkField && config.linkResolver) {
|
|
31
|
+
const resolvedURL = config.linkResolver(linkField);
|
|
23
32
|
if (resolvedURL != null) {
|
|
24
33
|
return resolvedURL;
|
|
25
34
|
}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import { LinkType } from "../types/value/link.js";
|
|
2
2
|
import { documentToLinkField } from "./documentToLinkField.js";
|
|
3
|
-
const asLink = (linkFieldOrDocument,
|
|
3
|
+
const asLink = (linkFieldOrDocument, ...configObjectOrTuple) => {
|
|
4
4
|
if (!linkFieldOrDocument) {
|
|
5
5
|
return null;
|
|
6
6
|
}
|
|
@@ -11,13 +11,22 @@ const asLink = (linkFieldOrDocument, linkResolver) => {
|
|
|
11
11
|
// TODO: Remove the `prettier-ignore` comment when this bug is fixed.
|
|
12
12
|
"link_type" in linkFieldOrDocument ? linkFieldOrDocument : documentToLinkField(linkFieldOrDocument)
|
|
13
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
|
+
}
|
|
14
23
|
switch (linkField.link_type) {
|
|
15
24
|
case LinkType.Media:
|
|
16
25
|
case LinkType.Web:
|
|
17
26
|
return "url" in linkField ? linkField.url : null;
|
|
18
27
|
case LinkType.Document: {
|
|
19
|
-
if ("id" in linkField && linkResolver) {
|
|
20
|
-
const resolvedURL = linkResolver(linkField);
|
|
28
|
+
if ("id" in linkField && config.linkResolver) {
|
|
29
|
+
const resolvedURL = config.linkResolver(linkField);
|
|
21
30
|
if (resolvedURL != null) {
|
|
22
31
|
return resolvedURL;
|
|
23
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asLink.js","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,
|
|
1
|
+
{"version":3,"file":"asLink.js","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":[],"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,sBAAsB,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,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AACZ,aAAO,SAAS,YAAY,UAAU,MAAM;AAAA,IAC9C,KAAK,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,KAAK,SAAS;AAAA,IACd;AACE,aAAO;AAAA,EACV;AACH;","x_google_ignoreList":[0]}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const prismicR = require("@prismicio/richtext");
|
|
4
|
-
const asText = (richTextField,
|
|
4
|
+
const asText = (richTextField, ...configObjectOrTuple) => {
|
|
5
5
|
if (richTextField) {
|
|
6
|
-
|
|
6
|
+
const [configObjectOrSeparator] = configObjectOrTuple;
|
|
7
|
+
let config;
|
|
8
|
+
if (typeof configObjectOrSeparator === "string") {
|
|
9
|
+
config = {
|
|
10
|
+
separator: configObjectOrSeparator
|
|
11
|
+
};
|
|
12
|
+
} else {
|
|
13
|
+
config = { ...configObjectOrSeparator };
|
|
14
|
+
}
|
|
15
|
+
return prismicR.asText(richTextField, config.separator);
|
|
7
16
|
} else {
|
|
8
17
|
return null;
|
|
9
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asText.cjs","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/asText.js"],"sourcesContent":["import { asText as asText$1 } from \"@prismicio/richtext\";\nconst asText = (richTextField,
|
|
1
|
+
{"version":3,"file":"asText.cjs","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/asText.js"],"sourcesContent":["import { asText as asText$1 } from \"@prismicio/richtext\";\nconst asText = (richTextField, ...configObjectOrTuple) => {\n if (richTextField) {\n const [configObjectOrSeparator] = configObjectOrTuple;\n let config;\n if (typeof configObjectOrSeparator === \"string\") {\n config = {\n separator: configObjectOrSeparator\n };\n } else {\n config = { ...configObjectOrSeparator };\n }\n return asText$1(richTextField, config.separator);\n } else {\n return null;\n }\n};\nexport {\n asText\n};\n//# sourceMappingURL=asText.js.map\n"],"names":["asText$1"],"mappings":";;;AACK,MAAC,SAAS,CAAC,kBAAkB,wBAAwB;AACxD,MAAI,eAAe;AACjB,UAAM,CAAC,uBAAuB,IAAI;AAClC,QAAI;AACJ,QAAI,OAAO,4BAA4B,UAAU;AAC/C,eAAS;AAAA,QACP,WAAW;AAAA,MACnB;AAAA,IACA,OAAW;AACL,eAAS,EAAE,GAAG;IACf;AACD,WAAOA,gBAAS,eAAe,OAAO,SAAS;AAAA,EACnD,OAAS;AACL,WAAO;AAAA,EACR;AACH;;","x_google_ignoreList":[0]}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { asText as asText$1 } from "@prismicio/richtext";
|
|
2
|
-
const asText = (richTextField,
|
|
2
|
+
const asText = (richTextField, ...configObjectOrTuple) => {
|
|
3
3
|
if (richTextField) {
|
|
4
|
-
|
|
4
|
+
const [configObjectOrSeparator] = configObjectOrTuple;
|
|
5
|
+
let config;
|
|
6
|
+
if (typeof configObjectOrSeparator === "string") {
|
|
7
|
+
config = {
|
|
8
|
+
separator: configObjectOrSeparator
|
|
9
|
+
};
|
|
10
|
+
} else {
|
|
11
|
+
config = { ...configObjectOrSeparator };
|
|
12
|
+
}
|
|
13
|
+
return asText$1(richTextField, config.separator);
|
|
5
14
|
} else {
|
|
6
15
|
return null;
|
|
7
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asText.js","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/asText.js"],"sourcesContent":["import { asText as asText$1 } from \"@prismicio/richtext\";\nconst asText = (richTextField,
|
|
1
|
+
{"version":3,"file":"asText.js","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/asText.js"],"sourcesContent":["import { asText as asText$1 } from \"@prismicio/richtext\";\nconst asText = (richTextField, ...configObjectOrTuple) => {\n if (richTextField) {\n const [configObjectOrSeparator] = configObjectOrTuple;\n let config;\n if (typeof configObjectOrSeparator === \"string\") {\n config = {\n separator: configObjectOrSeparator\n };\n } else {\n config = { ...configObjectOrSeparator };\n }\n return asText$1(richTextField, config.separator);\n } else {\n return null;\n }\n};\nexport {\n asText\n};\n//# sourceMappingURL=asText.js.map\n"],"names":[],"mappings":";AACK,MAAC,SAAS,CAAC,kBAAkB,wBAAwB;AACxD,MAAI,eAAe;AACjB,UAAM,CAAC,uBAAuB,IAAI;AAClC,QAAI;AACJ,QAAI,OAAO,4BAA4B,UAAU;AAC/C,eAAS;AAAA,QACP,WAAW;AAAA,MACnB;AAAA,IACA,OAAW;AACL,eAAS,EAAE,GAAG;IACf;AACD,WAAO,SAAS,eAAe,OAAO,SAAS;AAAA,EACnD,OAAS;AACL,WAAO;AAAA,EACR;AACH;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isFilled.cjs","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/isFilled.js"],"sourcesContent":["const isNonNullish = (input) => {\n return input != null;\n};\nconst isNonEmptyArray = (input) => {\n return !!input.length;\n};\nconst richText = (field) => {\n if (!isNonNullish(field)) {\n return false;\n } else if (field.length === 1 && \"text\" in field[0]) {\n return !!field[0].text;\n } else {\n return !!field.length;\n }\n};\nconst title = richText;\nconst imageThumbnail = (thumbnail) => {\n return isNonNullish(thumbnail) && !!thumbnail.url;\n};\nconst image = imageThumbnail;\nconst link = (field) => {\n return isNonNullish(field) && (\"id\" in field || \"url\" in field);\n};\nconst linkToMedia = link;\nconst contentRelationship = link;\nconst date = isNonNullish;\nconst timestamp = isNonNullish;\nconst color = isNonNullish;\nconst number = isNonNullish;\nconst keyText = (field) => {\n return isNonNullish(keyText) && !!field;\n};\nconst select = isNonNullish;\nconst embed = (field) => {\n return isNonNullish(field) && !!field.embed_url;\n};\nconst geoPoint = (field) => {\n return isNonNullish(field) && \"longitude\" in field;\n};\nconst
|
|
1
|
+
{"version":3,"file":"isFilled.cjs","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/isFilled.js"],"sourcesContent":["const isNonNullish = (input) => {\n return input != null;\n};\nconst isNonEmptyArray = (input) => {\n return !!input.length;\n};\nconst richText = (field) => {\n if (!isNonNullish(field)) {\n return false;\n } else if (field.length === 1 && \"text\" in field[0]) {\n return !!field[0].text;\n } else {\n return !!field.length;\n }\n};\nconst title = richText;\nconst imageThumbnail = (thumbnail) => {\n return isNonNullish(thumbnail) && !!thumbnail.url;\n};\nconst image = imageThumbnail;\nconst link = (field) => {\n return isNonNullish(field) && (\"id\" in field || \"url\" in field);\n};\nconst linkToMedia = link;\nconst contentRelationship = link;\nconst date = isNonNullish;\nconst timestamp = isNonNullish;\nconst color = isNonNullish;\nconst number = isNonNullish;\nconst keyText = (field) => {\n return isNonNullish(keyText) && !!field;\n};\nconst select = isNonNullish;\nconst embed = (field) => {\n return isNonNullish(field) && !!field.embed_url;\n};\nconst geoPoint = (field) => {\n return isNonNullish(field) && \"longitude\" in field;\n};\nconst integrationField = isNonNullish;\nconst integrationFields = integrationField;\nconst group = (group2) => {\n return isNonNullish(group2) && isNonEmptyArray(group2);\n};\nconst sliceZone = (slices) => {\n return isNonNullish(slices) && isNonEmptyArray(slices);\n};\nexport {\n color,\n contentRelationship,\n date,\n embed,\n geoPoint,\n group,\n image,\n imageThumbnail,\n integrationField,\n integrationFields,\n keyText,\n link,\n linkToMedia,\n number,\n richText,\n select,\n sliceZone,\n timestamp,\n title\n};\n//# sourceMappingURL=isFilled.js.map\n"],"names":[],"mappings":";;AAAA,MAAM,eAAe,CAAC,UAAU;AAC9B,SAAO,SAAS;AAClB;AAIK,MAAC,WAAW,CAAC,UAAU;AAC1B,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,WAAO;AAAA,EACX,WAAa,MAAM,WAAW,KAAK,UAAU,MAAM,CAAC,GAAG;AACnD,WAAO,CAAC,CAAC,MAAM,CAAC,EAAE;AAAA,EACtB,OAAS;AACL,WAAO,CAAC,CAAC,MAAM;AAAA,EAChB;AACH;AAEK,MAAC,iBAAiB,CAAC,cAAc;AACpC,SAAO,aAAa,SAAS,KAAK,CAAC,CAAC,UAAU;AAChD;AAEK,MAAC,OAAO,CAAC,UAAU;AACtB,SAAO,aAAa,KAAK,MAAM,QAAQ,SAAS,SAAS;AAC3D;;;;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isFilled.js","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/isFilled.js"],"sourcesContent":["const isNonNullish = (input) => {\n return input != null;\n};\nconst isNonEmptyArray = (input) => {\n return !!input.length;\n};\nconst richText = (field) => {\n if (!isNonNullish(field)) {\n return false;\n } else if (field.length === 1 && \"text\" in field[0]) {\n return !!field[0].text;\n } else {\n return !!field.length;\n }\n};\nconst title = richText;\nconst imageThumbnail = (thumbnail) => {\n return isNonNullish(thumbnail) && !!thumbnail.url;\n};\nconst image = imageThumbnail;\nconst link = (field) => {\n return isNonNullish(field) && (\"id\" in field || \"url\" in field);\n};\nconst linkToMedia = link;\nconst contentRelationship = link;\nconst date = isNonNullish;\nconst timestamp = isNonNullish;\nconst color = isNonNullish;\nconst number = isNonNullish;\nconst keyText = (field) => {\n return isNonNullish(keyText) && !!field;\n};\nconst select = isNonNullish;\nconst embed = (field) => {\n return isNonNullish(field) && !!field.embed_url;\n};\nconst geoPoint = (field) => {\n return isNonNullish(field) && \"longitude\" in field;\n};\nconst
|
|
1
|
+
{"version":3,"file":"isFilled.js","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/isFilled.js"],"sourcesContent":["const isNonNullish = (input) => {\n return input != null;\n};\nconst isNonEmptyArray = (input) => {\n return !!input.length;\n};\nconst richText = (field) => {\n if (!isNonNullish(field)) {\n return false;\n } else if (field.length === 1 && \"text\" in field[0]) {\n return !!field[0].text;\n } else {\n return !!field.length;\n }\n};\nconst title = richText;\nconst imageThumbnail = (thumbnail) => {\n return isNonNullish(thumbnail) && !!thumbnail.url;\n};\nconst image = imageThumbnail;\nconst link = (field) => {\n return isNonNullish(field) && (\"id\" in field || \"url\" in field);\n};\nconst linkToMedia = link;\nconst contentRelationship = link;\nconst date = isNonNullish;\nconst timestamp = isNonNullish;\nconst color = isNonNullish;\nconst number = isNonNullish;\nconst keyText = (field) => {\n return isNonNullish(keyText) && !!field;\n};\nconst select = isNonNullish;\nconst embed = (field) => {\n return isNonNullish(field) && !!field.embed_url;\n};\nconst geoPoint = (field) => {\n return isNonNullish(field) && \"longitude\" in field;\n};\nconst integrationField = isNonNullish;\nconst integrationFields = integrationField;\nconst group = (group2) => {\n return isNonNullish(group2) && isNonEmptyArray(group2);\n};\nconst sliceZone = (slices) => {\n return isNonNullish(slices) && isNonEmptyArray(slices);\n};\nexport {\n color,\n contentRelationship,\n date,\n embed,\n geoPoint,\n group,\n image,\n imageThumbnail,\n integrationField,\n integrationFields,\n keyText,\n link,\n linkToMedia,\n number,\n richText,\n select,\n sliceZone,\n timestamp,\n title\n};\n//# sourceMappingURL=isFilled.js.map\n"],"names":[],"mappings":"AAAA,MAAM,eAAe,CAAC,UAAU;AAC9B,SAAO,SAAS;AAClB;AAIK,MAAC,WAAW,CAAC,UAAU;AAC1B,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,WAAO;AAAA,EACX,WAAa,MAAM,WAAW,KAAK,UAAU,MAAM,CAAC,GAAG;AACnD,WAAO,CAAC,CAAC,MAAM,CAAC,EAAE;AAAA,EACtB,OAAS;AACL,WAAO,CAAC,CAAC,MAAM;AAAA,EAChB;AACH;AAEK,MAAC,iBAAiB,CAAC,cAAc;AACpC,SAAO,aAAa,SAAS,KAAK,CAAC,CAAC,UAAU;AAChD;AAEK,MAAC,OAAO,CAAC,UAAU;AACtB,SAAO,aAAa,KAAK,MAAM,QAAQ,SAAS,SAAS;AAC3D;","x_google_ignoreList":[0]}
|
package/dist/clientHooks.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientHooks.cjs","sources":["../../src/clientHooks.ts"],"sourcesContent":["import type * as prismicT from \"@prismicio/types\";\n\nimport {\n\tClientHookReturnType,\n\tClientMethodParameters,\n\tHookOnlyParameters,\n\tuseStatefulPrismicClientMethod,\n} from \"./useStatefulPrismicClientMethod\";\n\n/**\n * A hook that queries content from the Prismic repository.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.get}\n */\nexport const usePrismicDocuments = <TDocument extends prismicT.PrismicDocument>(\n\t...args: [params?: ClientMethodParameters<\"get\">[0] & HookOnlyParameters]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"get\", args);\n\n/**\n * A hook that queries content from the Prismic repository and returns only the\n * first result, if any.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getFirst}\n */\nexport const useFirstPrismicDocument = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [params?: ClientMethodParameters<\"getFirst\">[0] & HookOnlyParameters]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getFirst\", args);\n\n/**\n * A hook that queries content from the Prismic repository and returns all\n * matching content. If no predicates are provided, all documents will be\n * fetched.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAll}\n */\nexport const useAllPrismicDocumentsDangerously = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tparams?: ClientMethodParameters<\"dangerouslyGetAll\">[0] &\n\t\t\tHookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"dangerouslyGetAll\", args);\n\n/**\n * A hook that queries a document from the Prismic repository with a specific\n * ID.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param id - ID of the document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByID}\n */\nexport const usePrismicDocumentByID = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getByID\">[0],\n\t\tparams?: ClientMethodParameters<\"getByID\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByID\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific IDs.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param ids - A list of document IDs\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByIDs}\n */\nexport const usePrismicDocumentsByIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getByIDs\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByIDs\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * IDs.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param ids - A list of document IDs\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByIDs}\n */\nexport const useAllPrismicDocumentsByIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getAllByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByIDs\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByIDs\", args);\n\n/**\n * A hook that queries a document from the Prismic repository with a specific\n * UID and Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uid - UID of the document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const usePrismicDocumentByUID = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUID\">[0],\n\t\tuid: ClientMethodParameters<\"getByUID\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUID\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByUID\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific UIDs\n * of a Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uids - A list of document UIDs.\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const usePrismicDocumentsByUIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUIDs\">[0],\n\t\tuids: ClientMethodParameters<\"getByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUIDs\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByUIDs\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * UIDs of a Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uids - A list of document UIDs.\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const useAllPrismicDocumentsByUIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUIDs\">[0],\n\t\tuids: ClientMethodParameters<\"getByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUIDs\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByUIDs\", args);\n\n/**\n * A hook that queries a singleton document from the Prismic repository for a\n * specific Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the singleton Custom Type\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getSingle}\n */\nexport const useSinglePrismicDocument = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getSingle\">[0],\n\t\tparams?: ClientMethodParameters<\"getSingle\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getSingle\", args);\n\n/**\n * A hook that queries documents from the Prismic repository for a specific\n * Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param documentType - The API ID of the Custom Type\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByType}\n */\nexport const usePrismicDocumentsByType = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getByType\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByType\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository for a specific\n * Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param documentType - The API ID of the Custom Type\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByType}\n */\nexport const useAllPrismicDocumentsByType = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getAllByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByType\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByType\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with a specific\n * tag.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tag - The tag that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTag}\n */\nexport const usePrismicDocumentsByTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByTag\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with a specific\n * tag.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tag - The tag that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTag}\n */\nexport const useAllPrismicDocumentsByTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByTag\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific tags.\n * A document must be tagged with at least one of the queried tags to be\n * included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTags}\n */\nexport const usePrismicDocumentsBySomeTags = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getBySomeTags\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getBySomeTags\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * tags. A document must be tagged with at least one of the queried tags to be\n * included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTags}\n */\nexport const useAllPrismicDocumentsBySomeTags = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllBySomeTags\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllBySomeTags\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific tags.\n * A document must be tagged with all of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTags}\n */\nexport const usePrismicDocumentsByEveryTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByEveryTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByEveryTag\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * tags. A document must be tagged with all of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTags}\n */\nexport const useAllPrismicDocumentsByEveryTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByEveryTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByEveryTag\", args);\n"],"names":["useStatefulPrismicClientMethod"],"mappings":";;;AAuBO,MAAM,sBAAsB,IAC/B,SAEHA,+BAAAA,+BAA+B,OAAO,IAAI;AAiBpC,MAAM,0BAA0B,IAGnC,SAEHA,+BAAAA,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,oCAAoC,IAG7C,SAKHA,+BAAAA,+BAA+B,qBAAqB,IAAI;AAkBlD,MAAM,yBAAyB,IAGlC,SAKHA,+BAAAA,+BAA+B,WAAW,IAAI;AAiBxC,MAAM,2BAA2B,IAGpC,SAKHA,+BAAAA,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,8BAA8B,IAGvC,SAKHA,+BAAAA,+BAA+B,eAAe,IAAI;AAmB5C,MAAM,0BAA0B,IAGnC,SAMHA,+BAAAA,+BAA+B,YAAY,IAAI;AAmBzC,MAAM,4BAA4B,IAGrC,SAMHA,+BAAAA,+BAA+B,aAAa,IAAI;AAmB1C,MAAM,+BAA+B,IAGxC,SAMHA,+BAAAA,+BAA+B,gBAAgB,IAAI;AAkB7C,MAAM,2BAA2B,IAGpC,SAKHA,+BAAAA,+BAA+B,aAAa,IAAI;AAkB1C,MAAM,4BAA4B,IAGrC,SAKHA,+BAAAA,+BAA+B,aAAa,IAAI;AAkB1C,MAAM,+BAA+B,IAGxC,SAKHA,+BAAAA,+BAA+B,gBAAgB,IAAI;AAkB7C,MAAM,2BAA2B,IAGpC,SAKHA,+BAAAA,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,8BAA8B,IAGvC,SAKHA,+BAAAA,+BAA+B,eAAe,IAAI;AAmB5C,MAAM,gCAAgC,IAGzC,SAKHA,+BAAAA,+BAA+B,iBAAiB,IAAI;AAmB9C,MAAM,mCAAmC,IAG5C,SAKHA,+BAAAA,+BAA+B,oBAAoB,IAAI;AAkBjD,MAAM,gCAAgC,IAGzC,SAKHA,+BAAAA,+BAA+B,iBAAiB,IAAI;AAkB9C,MAAM,mCAAmC,IAG5C,SAKHA,+BAAA,+BAA+B,oBAAoB,IAAI;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"clientHooks.cjs","sources":["../../src/clientHooks.ts"],"sourcesContent":["import type * as prismic from \"@prismicio/client\";\n\nimport {\n\tClientHookReturnType,\n\tClientMethodParameters,\n\tHookOnlyParameters,\n\tuseStatefulPrismicClientMethod,\n} from \"./useStatefulPrismicClientMethod\";\n\n/**\n * A hook that queries content from the Prismic repository.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.get}\n */\nexport const usePrismicDocuments = <TDocument extends prismic.PrismicDocument>(\n\t...args: [params?: ClientMethodParameters<\"get\">[0] & HookOnlyParameters]\n): ClientHookReturnType<prismic.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"get\", args);\n\n/**\n * A hook that queries content from the Prismic repository and returns only the\n * first result, if any.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getFirst}\n */\nexport const useFirstPrismicDocument = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [params?: ClientMethodParameters<\"getFirst\">[0] & HookOnlyParameters]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getFirst\", args);\n\n/**\n * A hook that queries content from the Prismic repository and returns all\n * matching content. If no predicates are provided, all documents will be\n * fetched.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAll}\n */\nexport const useAllPrismicDocumentsDangerously = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\tparams?: ClientMethodParameters<\"dangerouslyGetAll\">[0] &\n\t\t\tHookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"dangerouslyGetAll\", args);\n\n/**\n * A hook that queries a document from the Prismic repository with a specific\n * ID.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param id - ID of the document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByID}\n */\nexport const usePrismicDocumentByID = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getByID\">[0],\n\t\tparams?: ClientMethodParameters<\"getByID\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByID\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific IDs.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param ids - A list of document IDs\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByIDs}\n */\nexport const usePrismicDocumentsByIDs = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getByIDs\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismic.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByIDs\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * IDs.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param ids - A list of document IDs\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByIDs}\n */\nexport const useAllPrismicDocumentsByIDs = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getAllByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByIDs\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByIDs\", args);\n\n/**\n * A hook that queries a document from the Prismic repository with a specific\n * UID and Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uid - UID of the document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const usePrismicDocumentByUID = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUID\">[0],\n\t\tuid: ClientMethodParameters<\"getByUID\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUID\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByUID\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific UIDs\n * of a Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uids - A list of document UIDs.\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const usePrismicDocumentsByUIDs = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUIDs\">[0],\n\t\tuids: ClientMethodParameters<\"getByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUIDs\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismic.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByUIDs\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * UIDs of a Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uids - A list of document UIDs.\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const useAllPrismicDocumentsByUIDs = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUIDs\">[0],\n\t\tuids: ClientMethodParameters<\"getByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUIDs\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByUIDs\", args);\n\n/**\n * A hook that queries a singleton document from the Prismic repository for a\n * specific Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the singleton Custom Type\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getSingle}\n */\nexport const useSinglePrismicDocument = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getSingle\">[0],\n\t\tparams?: ClientMethodParameters<\"getSingle\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getSingle\", args);\n\n/**\n * A hook that queries documents from the Prismic repository for a specific\n * Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param documentType - The API ID of the Custom Type\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByType}\n */\nexport const usePrismicDocumentsByType = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getByType\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismic.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByType\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository for a specific\n * Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param documentType - The API ID of the Custom Type\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByType}\n */\nexport const useAllPrismicDocumentsByType = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getAllByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByType\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByType\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with a specific\n * tag.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tag - The tag that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTag}\n */\nexport const usePrismicDocumentsByTag = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismic.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByTag\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with a specific\n * tag.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tag - The tag that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTag}\n */\nexport const useAllPrismicDocumentsByTag = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByTag\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific tags.\n * A document must be tagged with at least one of the queried tags to be\n * included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTags}\n */\nexport const usePrismicDocumentsBySomeTags = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getBySomeTags\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismic.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getBySomeTags\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * tags. A document must be tagged with at least one of the queried tags to be\n * included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTags}\n */\nexport const useAllPrismicDocumentsBySomeTags = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllBySomeTags\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllBySomeTags\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific tags.\n * A document must be tagged with all of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTags}\n */\nexport const usePrismicDocumentsByEveryTag = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByEveryTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismic.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByEveryTag\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * tags. A document must be tagged with all of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTags}\n */\nexport const useAllPrismicDocumentsByEveryTag = <\n\tTDocument extends prismic.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByEveryTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByEveryTag\", args);\n"],"names":["useStatefulPrismicClientMethod"],"mappings":";;;AAuBO,MAAM,sBAAsB,IAC/B,SAEHA,+BAAAA,+BAA+B,OAAO,IAAI;AAiBpC,MAAM,0BAA0B,IAGnC,SAEHA,+BAAAA,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,oCAAoC,IAG7C,SAKHA,+BAAAA,+BAA+B,qBAAqB,IAAI;AAkBlD,MAAM,yBAAyB,IAGlC,SAKHA,+BAAAA,+BAA+B,WAAW,IAAI;AAiBxC,MAAM,2BAA2B,IAGpC,SAKHA,+BAAAA,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,8BAA8B,IAGvC,SAKHA,+BAAAA,+BAA+B,eAAe,IAAI;AAmB5C,MAAM,0BAA0B,IAGnC,SAMHA,+BAAAA,+BAA+B,YAAY,IAAI;AAmBzC,MAAM,4BAA4B,IAGrC,SAMHA,+BAAAA,+BAA+B,aAAa,IAAI;AAmB1C,MAAM,+BAA+B,IAGxC,SAMHA,+BAAAA,+BAA+B,gBAAgB,IAAI;AAkB7C,MAAM,2BAA2B,IAGpC,SAKHA,+BAAAA,+BAA+B,aAAa,IAAI;AAkB1C,MAAM,4BAA4B,IAGrC,SAKHA,+BAAAA,+BAA+B,aAAa,IAAI;AAkB1C,MAAM,+BAA+B,IAGxC,SAKHA,+BAAAA,+BAA+B,gBAAgB,IAAI;AAkB7C,MAAM,2BAA2B,IAGpC,SAKHA,+BAAAA,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,8BAA8B,IAGvC,SAKHA,+BAAAA,+BAA+B,eAAe,IAAI;AAmB5C,MAAM,gCAAgC,IAGzC,SAKHA,+BAAAA,+BAA+B,iBAAiB,IAAI;AAmB9C,MAAM,mCAAmC,IAG5C,SAKHA,+BAAAA,+BAA+B,oBAAoB,IAAI;AAkBjD,MAAM,gCAAgC,IAGzC,SAKHA,+BAAAA,+BAA+B,iBAAiB,IAAI;AAkB9C,MAAM,mCAAmC,IAG5C,SAKHA,+BAAA,+BAA+B,oBAAoB,IAAI;;;;;;;;;;;;;;;;;;;"}
|