@prismicio/vue 3.1.1 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/components/PrismicEmbed.cjs +36 -0
  2. package/dist/components/PrismicEmbed.cjs.map +1 -0
  3. package/dist/components/PrismicEmbed.d.ts +63 -0
  4. package/dist/components/PrismicEmbed.js +36 -0
  5. package/dist/components/PrismicEmbed.js.map +1 -0
  6. package/dist/components/PrismicImage.cjs +122 -0
  7. package/dist/components/PrismicImage.cjs.map +1 -0
  8. package/dist/components/PrismicImage.d.ts +162 -0
  9. package/dist/components/PrismicImage.js +122 -0
  10. package/dist/components/PrismicImage.js.map +1 -0
  11. package/dist/components/PrismicLink.cjs +115 -0
  12. package/dist/components/PrismicLink.cjs.map +1 -0
  13. package/dist/components/PrismicLink.d.ts +191 -0
  14. package/dist/components/PrismicLink.js +115 -0
  15. package/dist/components/PrismicLink.js.map +1 -0
  16. package/dist/components/PrismicRichText.cjs +103 -0
  17. package/dist/components/PrismicRichText.cjs.map +1 -0
  18. package/dist/components/PrismicRichText.d.ts +139 -0
  19. package/dist/components/PrismicRichText.js +103 -0
  20. package/dist/components/PrismicRichText.js.map +1 -0
  21. package/dist/components/PrismicText.cjs +57 -0
  22. package/dist/components/PrismicText.cjs.map +1 -0
  23. package/dist/components/PrismicText.d.ts +117 -0
  24. package/dist/components/PrismicText.js +57 -0
  25. package/dist/components/PrismicText.js.map +1 -0
  26. package/dist/components/SliceZone.cjs +134 -0
  27. package/dist/components/SliceZone.cjs.map +1 -0
  28. package/dist/components/SliceZone.d.ts +359 -0
  29. package/dist/components/SliceZone.js +134 -0
  30. package/dist/components/SliceZone.js.map +1 -0
  31. package/dist/components/index.d.ts +12 -0
  32. package/dist/composables.cjs +40 -0
  33. package/dist/composables.cjs.map +1 -0
  34. package/dist/composables.d.ts +366 -0
  35. package/dist/composables.js +40 -0
  36. package/dist/composables.js.map +1 -0
  37. package/dist/createPrismic.cjs +91 -0
  38. package/dist/createPrismic.cjs.map +1 -0
  39. package/dist/createPrismic.d.ts +12 -0
  40. package/dist/createPrismic.js +69 -0
  41. package/dist/createPrismic.js.map +1 -0
  42. package/dist/globalExtensions.d.ts +11 -0
  43. package/dist/index.cjs +46 -764
  44. package/dist/index.cjs.map +1 -1
  45. package/dist/index.d.ts +10 -1439
  46. package/dist/index.js +45 -707
  47. package/dist/index.js.map +1 -1
  48. package/dist/injectionSymbols.cjs +5 -0
  49. package/dist/injectionSymbols.cjs.map +1 -0
  50. package/dist/injectionSymbols.d.ts +9 -0
  51. package/dist/injectionSymbols.js +5 -0
  52. package/dist/injectionSymbols.js.map +1 -0
  53. package/dist/lib/__PRODUCTION__.cjs +8 -0
  54. package/dist/lib/__PRODUCTION__.cjs.map +1 -0
  55. package/dist/lib/__PRODUCTION__.d.ts +7 -0
  56. package/dist/lib/__PRODUCTION__.js +8 -0
  57. package/dist/lib/__PRODUCTION__.js.map +1 -0
  58. package/dist/lib/getSlots.cjs +19 -0
  59. package/dist/lib/getSlots.cjs.map +1 -0
  60. package/dist/lib/getSlots.d.ts +14 -0
  61. package/dist/lib/getSlots.js +19 -0
  62. package/dist/lib/getSlots.js.map +1 -0
  63. package/dist/lib/isInternalURL.cjs +9 -0
  64. package/dist/lib/isInternalURL.cjs.map +1 -0
  65. package/dist/lib/isInternalURL.d.ts +8 -0
  66. package/dist/lib/isInternalURL.js +9 -0
  67. package/dist/lib/isInternalURL.js.map +1 -0
  68. package/dist/lib/simplyResolveComponent.cjs +8 -0
  69. package/dist/lib/simplyResolveComponent.cjs.map +1 -0
  70. package/dist/lib/simplyResolveComponent.d.ts +12 -0
  71. package/dist/lib/simplyResolveComponent.js +8 -0
  72. package/dist/lib/simplyResolveComponent.js.map +1 -0
  73. package/dist/types.d.ts +357 -0
  74. package/dist/usePrismic.cjs +9 -0
  75. package/dist/usePrismic.cjs.map +1 -0
  76. package/dist/usePrismic.d.ts +21 -0
  77. package/dist/usePrismic.js +9 -0
  78. package/dist/usePrismic.js.map +1 -0
  79. package/dist/useStatefulPrismicClientMethod.cjs +39 -0
  80. package/dist/useStatefulPrismicClientMethod.cjs.map +1 -0
  81. package/dist/useStatefulPrismicClientMethod.d.ts +64 -0
  82. package/dist/useStatefulPrismicClientMethod.js +39 -0
  83. package/dist/useStatefulPrismicClientMethod.js.map +1 -0
  84. package/package.json +26 -27
  85. package/src/components/PrismicImage.ts +2 -2
  86. package/src/components/PrismicLink.ts +5 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SliceZone.cjs","sources":["../../../src/components/SliceZone.ts"],"sourcesContent":["import {\n\tAllowedComponentProps,\n\tComponentCustomProps,\n\tcomputed,\n\tConcreteComponent,\n\tDefineComponent,\n\tdefineComponent,\n\tFunctionalComponent,\n\th,\n\tmarkRaw,\n\tPropType,\n\tVNodeProps,\n\twatchEffect,\n} from \"vue\";\n\nimport { Slice } from \"@prismicio/types\";\n\nimport { simplyResolveComponent } from \"../lib/simplyResolveComponent\";\nimport { __PRODUCTION__ } from \"../lib/__PRODUCTION__\";\nimport { usePrismic } from \"../usePrismic\";\n\n/**\n * Returns the type of a `SliceLike` type.\n *\n * @typeParam TSlice - The Slice from which the type will be extracted.\n */\ntype ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2\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 `<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 TSliceType - Type name of the Slice.\n */\nexport type SliceLikeRestV2<TSliceType extends string = string> = {\n\tslice_type: Slice<TSliceType>[\"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 TSliceType - Type name of the Slice.\n */\nexport type SliceLikeGraphQL<TSliceType extends string = string> = {\n\ttype: Slice<TSliceType>[\"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, use the `Slice` export from `@prismicio/types`\n * for a full interface.\n *\n * @typeParam TSliceType - Type name of the Slice\n */\nexport type SliceLike<TSliceType extends string = string> =\n\t| SliceLikeRestV2<TSliceType>\n\t| SliceLikeGraphQL<TSliceType>;\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/types` using\n * `SliceLike`.\n *\n * If using Prismic's REST API, use the `SliceZone` export from\n * `@prismicio/types` for the full type.\n *\n * @typeParam TSlice - The type(s) of slices in the Slice Zone\n */\nexport type SliceZoneLike<TSlice extends SliceLike = SliceLike> =\n\treadonly TSlice[];\n\n/**\n * Vue props for a component rendering content from a Prismic Slice using the\n * `<SliceZone />` component.\n *\n * @typeParam TSlice - The type(s) of slices in the Slice Zone\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 * Native Vue props for a component rendering content from a Prismic Slice using\n * the `<SliceZone />` component.\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made\n * available to all Slice components\n */\nexport type DefineComponentSliceComponentProps<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n\tTContext = unknown,\n> = {\n\tslice: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"slice\"]>;\n\t\trequired: true;\n\t};\n\tindex: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"index\"]>;\n\t\trequired: true;\n\t};\n\tslices: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"slices\"]>;\n\t\trequired: true;\n\t};\n\tcontext: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"context\"]>;\n\t\trequired: true;\n\t};\n};\n\n/**\n * Gets native Vue props for a component rendering content from a Prismic Slice\n * using the `<SliceZone />` component. Props are: `[\"slice\", \"index\", \"slices\",\n * \"context\"]`\n *\n * @example Defining a new slice component:\n *\n * ```javascript\n * import { getSliceComponentProps } from \"@prismicio/vue\";\n *\n * export default {\n * \tprops: getSliceComponentProps(),\n * };\n * ```\n *\n * @example Defining a new slice component with visual hint:\n *\n * ```javascript\n * import { getSliceComponentProps } from \"@prismicio/vue\";\n *\n * export default {\n * \tprops: getSliceComponentProps([\"slice\", \"index\", \"slices\", \"context\"]),\n * };\n * ```\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made\n * available to all Slice components\n * @param propsHint - An optional array of prop names used for the sole purpose\n * of having a visual hint of which props are made available to the slice,\n * this parameters doesn't have any effect\n *\n * @returns Props object to use with {@link defineComponent}\n */\nexport const getSliceComponentProps = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n\tTContext = unknown,\n>(\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tpropsHint?: [\"slice\", \"index\", \"slices\", \"context\"],\n): DefineComponentSliceComponentProps<TSlice, TContext> => ({\n\tslice: {\n\t\ttype: Object as PropType<SliceComponentProps<TSlice, TContext>[\"slice\"]>,\n\t\trequired: true,\n\t},\n\tindex: {\n\t\ttype: Number as PropType<SliceComponentProps<TSlice, TContext>[\"index\"]>,\n\t\trequired: true,\n\t},\n\tslices: {\n\t\ttype: Array as PropType<SliceComponentProps<TSlice, TContext>[\"slices\"]>,\n\t\trequired: true,\n\t},\n\tcontext: {\n\t\ttype: null as unknown as PropType<\n\t\t\tSliceComponentProps<TSlice, TContext>[\"context\"]\n\t\t>,\n\t\trequired: true,\n\t},\n});\n\n/**\n * A Vue component to be rendered for each instance of its Slice.\n *\n * @typeParam TSlice - The type(s) of slices 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> =\n\t| DefineComponent<SliceComponentProps<TSlice, TContext>>\n\t| FunctionalComponent<SliceComponentProps<TSlice, TContext>>;\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 Vue component rendered when a component mapping\n * cannot be found in `<SliceZone />`.\n */\nexport const TODOSliceComponent = __PRODUCTION__\n\t? ((() => null) as FunctionalComponent<SliceComponentProps>)\n\t: /*#__PURE__*/ (defineComponent({\n\t\t\tname: \"TODOSliceComponent\",\n\t\t\tprops: getSliceComponentProps(),\n\t\t\tsetup(props) {\n\t\t\t\tconst type = computed(() =>\n\t\t\t\t\t\"slice_type\" in props.slice\n\t\t\t\t\t\t? props.slice.slice_type\n\t\t\t\t\t\t: props.slice.type,\n\t\t\t\t);\n\n\t\t\t\twatchEffect(() => {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[SliceZone] Could not find a component for Slice type \"${type.value}\"`,\n\t\t\t\t\t\tprops.slice,\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\treturn () => {\n\t\t\t\t\treturn h(\n\t\t\t\t\t\t\"section\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"data-slice-zone-todo-component\": \"\",\n\t\t\t\t\t\t\t\"data-slice-type\": type.value,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[`Could not find a component for Slice type \"${type.value}\"`],\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t},\n\t }) as SliceComponentType);\n\n/**\n * A record of Slice types mapped to Vue components. Each components will be\n * rendered for each instance of their Slice type.\n *\n * @typeParam TSlice - The type(s) of slices 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>]:\n\t\t\t| SliceComponentType<Extract<TSlice, SliceLike<SliceType>>, TContext>\n\t\t\t| string;\n\t};\n\n/**\n * Gets an optimized record of Slice types mapped to Vue components. Each\n * components will be rendered for each instance of their Slice type.\n *\n * @remarks\n * This is essentially an helper function to ensure {@link markRaw} is correctly\n * applied on each components, improving performances.\n * @example Defining a slice components:\n *\n * ```javascript\n * import { defineSliceZoneComponents } from \"@prismicio/vue\";\n *\n * export default {\n * data() {\n * components: defineSliceZoneComponents({\n * foo: Foo,\n * bar: defineAsyncComponent(\n * () => new Promise((res) => res(Bar)),\n * ),\n * baz: \"Baz\",\n * }),\n * }\n * };\n * ```\n *\n * @typeParam TSlice - The type(s) of slices in the Slice Zone\n * @typeParam TContext - Arbitrary data made available to all Slice components\n *\n * @param components - {@link SliceZoneComponents}\n *\n * @returns A new optimized record of {@link SliceZoneComponents}\n */\nexport const defineSliceZoneComponents = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n\tTContext = unknown,\n>(\n\tcomponents: SliceZoneComponents<TSlice, TContext>,\n): SliceZoneComponents<TSlice, TContext> => {\n\tconst result = {} as SliceZoneComponents<TSlice, TContext>;\n\n\tlet type: keyof typeof components;\n\tfor (type in components) {\n\t\tconst component = components[type];\n\t\tresult[type] =\n\t\t\ttypeof component === \"string\"\n\t\t\t\t? component\n\t\t\t\t: markRaw(\n\t\t\t\t\t\tcomponent as SliceComponentType<\n\t\t\t\t\t\t\tExtract<TSlice, SliceLike<typeof type>>,\n\t\t\t\t\t\t\tTContext\n\t\t\t\t\t\t>,\n\t\t\t\t );\n\t}\n\n\treturn result;\n};\n\n/**\n * Arguments for a `<SliceZone>` `resolver` function.\n */\nexport type SliceZoneResolverArgs<TSlice extends SliceLike = SliceLike> = {\n\t/**\n\t * The Slice to resolve to a Vue component..\n\t */\n\tslice: TSlice;\n\n\t/**\n\t * The name of the Slice.\n\t */\n\tsliceName: 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 Vue 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 Vue 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> = (\n\targs: SliceZoneResolverArgs<TSlice>,\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => SliceComponentType<any, TContext> | string | undefined | null;\n\n/**\n * Props for `<SliceZone />`.\n *\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 Vue components.\n\t */\n\tcomponents?: SliceZoneComponents;\n\n\t/**\n\t * A function that determines the rendered Vue component for each Slice in the\n\t * 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 Vue 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 * Arbitrary data made available to all Slice components.\n\t */\n\tcontext?: TContext;\n\n\t/**\n\t * A component or a functional component rendered if a component mapping from\n\t * the `components` prop cannot be found.\n\t *\n\t * @remarks\n\t * Components will be rendered using the {@link SliceComponentProps} interface.\n\t *\n\t * @defaultValue The Slice Zone default component provided to `@prismicio/vue` plugin if configured, otherwise `null` when `process.env.NODE_ENV === \"production\"` else {@link TODOSliceComponent}.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>;\n\n\t/**\n\t * An HTML tag name, a component, or a functional component used to wrap the\n\t * output. The Slice Zone is not wrapped by default.\n\t */\n\twrapper?: string | ConcreteComponent;\n};\n\n/**\n * `<SliceZone />` implementation.\n *\n * @internal\n */\nexport const SliceZoneImpl = /*#__PURE__*/ defineComponent({\n\tname: \"SliceZone\",\n\tprops: {\n\t\tslices: {\n\t\t\ttype: Array as PropType<SliceZoneLike>,\n\t\t\trequired: true,\n\t\t},\n\t\tcomponents: {\n\t\t\ttype: Object as PropType<SliceZoneComponents>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\tresolver: {\n\t\t\ttype: Function as PropType<SliceZoneResolver>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\tcontext: {\n\t\t\ttype: null,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\tdefaultComponent: {\n\t\t\ttype: Object as PropType<SliceComponentType>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\twrapper: {\n\t\t\ttype: [String, Object, Function] as PropType<string | ConcreteComponent>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t},\n\tsetup(props) {\n\t\t// Prevent fatal if user didn't check for field, throws `Invalid prop` warn\n\t\tif (!props.slices) {\n\t\t\treturn () => null;\n\t\t}\n\n\t\tconst { options } = usePrismic();\n\n\t\tconst renderedSlices = computed(() => {\n\t\t\treturn props.slices.map((slice, index) => {\n\t\t\t\tconst type = \"slice_type\" in slice ? slice.slice_type : slice.type;\n\n\t\t\t\tlet component =\n\t\t\t\t\tprops.components && type in props.components\n\t\t\t\t\t\t? props.components[type]\n\t\t\t\t\t\t: props.defaultComponent ||\n\t\t\t\t\t\t options.components?.sliceZoneDefaultComponent ||\n\t\t\t\t\t\t TODOSliceComponent;\n\n\t\t\t\t// TODO: Remove `resolver` in v3 in favor of `components`.\n\t\t\t\tif (props.resolver) {\n\t\t\t\t\tconst resolvedComponent = props.resolver({\n\t\t\t\t\t\tslice,\n\t\t\t\t\t\tsliceName: type,\n\t\t\t\t\t\ti: index,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (resolvedComponent) {\n\t\t\t\t\t\tcomponent = resolvedComponent;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst key =\n\t\t\t\t\t\"id\" in slice && slice.id\n\t\t\t\t\t\t? slice.id\n\t\t\t\t\t\t: `${index}-${JSON.stringify(slice)}`;\n\n\t\t\t\tconst p = {\n\t\t\t\t\tkey,\n\t\t\t\t\tslice,\n\t\t\t\t\tindex,\n\t\t\t\t\tcontext: props.context,\n\t\t\t\t\tslices: props.slices,\n\t\t\t\t};\n\n\t\t\t\treturn h(simplyResolveComponent(component as ConcreteComponent), p);\n\t\t\t});\n\t\t});\n\n\t\treturn () => {\n\t\t\tif (props.wrapper) {\n\t\t\t\tconst parent = simplyResolveComponent(props.wrapper);\n\n\t\t\t\tif (typeof parent === \"string\") {\n\t\t\t\t\treturn h(parent, null, renderedSlices.value);\n\t\t\t\t} else {\n\t\t\t\t\treturn h(parent, null, { default: () => renderedSlices.value });\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn renderedSlices.value;\n\t\t\t}\n\t\t};\n\t},\n});\n\n// export the public type for h/tsx inference\n// also to avoid inline import() in generated d.ts files\n/**\n * Component to render a Prismic Slice Zone.\n *\n * @see Component props {@link SliceZoneProps}\n * @see Templating Slice Zones {@link https://prismic.io/docs/technologies/vue-template-content#slices-and-groups}\n */\nexport const SliceZone = SliceZoneImpl as unknown as {\n\tnew (): {\n\t\t$props: AllowedComponentProps &\n\t\t\tComponentCustomProps &\n\t\t\tVNodeProps &\n\t\t\tSliceZoneProps;\n\t};\n};\n"],"names":["__PRODUCTION__","defineComponent","computed","watchEffect","h","markRaw","usePrismic","simplyResolveComponent"],"mappings":"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"}
@@ -0,0 +1,359 @@
1
+ import { AllowedComponentProps, ComponentCustomProps, ConcreteComponent, DefineComponent, FunctionalComponent, PropType, VNodeProps } from "vue";
2
+ import { Slice } from "@prismicio/types";
3
+ /**
4
+ * Returns the type of a `SliceLike` type.
5
+ *
6
+ * @typeParam TSlice - The Slice from which the type will be extracted.
7
+ */
8
+ type ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2 ? TSlice["slice_type"] : TSlice extends SliceLikeGraphQL ? TSlice["type"] : never;
9
+ /**
10
+ * The minimum required properties to represent a Prismic Slice from the Prismic
11
+ * Rest API V2 for the `<SliceZone>` component.
12
+ *
13
+ * If using Prismic's Rest API V2, use the `Slice` export from
14
+ * `@prismicio/types` for a full interface.
15
+ *
16
+ * @typeParam TSliceType - Type name of the Slice.
17
+ */
18
+ export type SliceLikeRestV2<TSliceType extends string = string> = {
19
+ slice_type: Slice<TSliceType>["slice_type"];
20
+ id?: string;
21
+ };
22
+ /**
23
+ * The minimum required properties to represent a Prismic Slice from the Prismic
24
+ * GraphQL API for the `<SliceZone>` component.
25
+ *
26
+ * @typeParam TSliceType - Type name of the Slice.
27
+ */
28
+ export type SliceLikeGraphQL<TSliceType extends string = string> = {
29
+ type: Slice<TSliceType>["slice_type"];
30
+ };
31
+ /**
32
+ * The minimum required properties to represent a Prismic Slice for the
33
+ * `<SliceZone />` component.
34
+ *
35
+ * If using Prismic's REST API, use the `Slice` export from `@prismicio/types`
36
+ * for a full interface.
37
+ *
38
+ * @typeParam TSliceType - Type name of the Slice
39
+ */
40
+ export type SliceLike<TSliceType extends string = string> = SliceLikeRestV2<TSliceType> | SliceLikeGraphQL<TSliceType>;
41
+ /**
42
+ * A looser version of the `SliceZone` type from `@prismicio/types` using
43
+ * `SliceLike`.
44
+ *
45
+ * If using Prismic's REST API, use the `SliceZone` export from
46
+ * `@prismicio/types` for the full type.
47
+ *
48
+ * @typeParam TSlice - The type(s) of slices in the Slice Zone
49
+ */
50
+ export type SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[];
51
+ /**
52
+ * Vue props for a component rendering content from a Prismic Slice using the
53
+ * `<SliceZone />` component.
54
+ *
55
+ * @typeParam TSlice - The type(s) of slices in the Slice Zone
56
+ * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
57
+ * available to all Slice components
58
+ */
59
+ export type SliceComponentProps<TSlice extends SliceLike = any, TContext = unknown> = {
60
+ /**
61
+ * Slice data for this component.
62
+ */
63
+ slice: TSlice;
64
+ /**
65
+ * The index of the Slice in the Slice Zone.
66
+ */
67
+ index: number;
68
+ /**
69
+ * All Slices from the Slice Zone to which the Slice belongs.
70
+ */
71
+ slices: SliceZoneLike<SliceLike>;
72
+ /**
73
+ * Arbitrary data passed to `<SliceZone />` and made available to all Slice
74
+ * components.
75
+ */
76
+ context: TContext;
77
+ };
78
+ /**
79
+ * Native Vue props for a component rendering content from a Prismic Slice using
80
+ * the `<SliceZone />` component.
81
+ *
82
+ * @typeParam TSlice - The Slice type
83
+ * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
84
+ * available to all Slice components
85
+ */
86
+ export type DefineComponentSliceComponentProps<TSlice extends SliceLike = any, TContext = unknown> = {
87
+ slice: {
88
+ type: PropType<SliceComponentProps<TSlice, TContext>["slice"]>;
89
+ required: true;
90
+ };
91
+ index: {
92
+ type: PropType<SliceComponentProps<TSlice, TContext>["index"]>;
93
+ required: true;
94
+ };
95
+ slices: {
96
+ type: PropType<SliceComponentProps<TSlice, TContext>["slices"]>;
97
+ required: true;
98
+ };
99
+ context: {
100
+ type: PropType<SliceComponentProps<TSlice, TContext>["context"]>;
101
+ required: true;
102
+ };
103
+ };
104
+ /**
105
+ * Gets native Vue props for a component rendering content from a Prismic Slice
106
+ * using the `<SliceZone />` component. Props are: `["slice", "index", "slices",
107
+ * "context"]`
108
+ *
109
+ * @example Defining a new slice component:
110
+ *
111
+ * ```javascript
112
+ * import { getSliceComponentProps } from "@prismicio/vue";
113
+ *
114
+ * export default {
115
+ * props: getSliceComponentProps(),
116
+ * };
117
+ * ```
118
+ *
119
+ * @example Defining a new slice component with visual hint:
120
+ *
121
+ * ```javascript
122
+ * import { getSliceComponentProps } from "@prismicio/vue";
123
+ *
124
+ * export default {
125
+ * props: getSliceComponentProps(["slice", "index", "slices", "context"]),
126
+ * };
127
+ * ```
128
+ *
129
+ * @typeParam TSlice - The Slice type
130
+ * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
131
+ * available to all Slice components
132
+ * @param propsHint - An optional array of prop names used for the sole purpose
133
+ * of having a visual hint of which props are made available to the slice,
134
+ * this parameters doesn't have any effect
135
+ *
136
+ * @returns Props object to use with {@link defineComponent}
137
+ */
138
+ export declare const getSliceComponentProps: <TSlice extends SliceLike<string> = any, TContext = unknown>(propsHint?: ["slice", "index", "slices", "context"]) => DefineComponentSliceComponentProps<TSlice, TContext>;
139
+ /**
140
+ * A Vue component to be rendered for each instance of its Slice.
141
+ *
142
+ * @typeParam TSlice - The type(s) of slices in the Slice Zone
143
+ * @typeParam TContext - Arbitrary data made available to all Slice components
144
+ */
145
+ export type SliceComponentType<TSlice extends SliceLike = any, TContext = unknown> = DefineComponent<SliceComponentProps<TSlice, TContext>> | FunctionalComponent<SliceComponentProps<TSlice, TContext>>;
146
+ /**
147
+ * This Slice component can be used as a reminder to provide a proper
148
+ * implementation.
149
+ *
150
+ * This is also the default Vue component rendered when a component mapping
151
+ * cannot be found in `<SliceZone />`.
152
+ */
153
+ export declare const TODOSliceComponent: FunctionalComponent<SliceComponentProps<any, unknown>, {}> | DefineComponent<SliceComponentProps<any, unknown>, {}, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<SliceComponentProps<any, unknown>>, {
154
+ slice: any;
155
+ }>;
156
+ /**
157
+ * A record of Slice types mapped to Vue components. Each components will be
158
+ * rendered for each instance of their Slice type.
159
+ *
160
+ * @typeParam TSlice - The type(s) of slices in the Slice Zone
161
+ * @typeParam TContext - Arbitrary data made available to all Slice components
162
+ */
163
+ export type SliceZoneComponents<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
164
+ [SliceType in ExtractSliceType<TSlice>]: SliceComponentType<Extract<TSlice, SliceLike<SliceType>>, TContext> | string;
165
+ };
166
+ /**
167
+ * Gets an optimized record of Slice types mapped to Vue components. Each
168
+ * components will be rendered for each instance of their Slice type.
169
+ *
170
+ * @remarks
171
+ * This is essentially an helper function to ensure {@link markRaw} is correctly
172
+ * applied on each components, improving performances.
173
+ * @example Defining a slice components:
174
+ *
175
+ * ```javascript
176
+ * import { defineSliceZoneComponents } from "@prismicio/vue";
177
+ *
178
+ * export default {
179
+ * data() {
180
+ * components: defineSliceZoneComponents({
181
+ * foo: Foo,
182
+ * bar: defineAsyncComponent(
183
+ * () => new Promise((res) => res(Bar)),
184
+ * ),
185
+ * baz: "Baz",
186
+ * }),
187
+ * }
188
+ * };
189
+ * ```
190
+ *
191
+ * @typeParam TSlice - The type(s) of slices in the Slice Zone
192
+ * @typeParam TContext - Arbitrary data made available to all Slice components
193
+ *
194
+ * @param components - {@link SliceZoneComponents}
195
+ *
196
+ * @returns A new optimized record of {@link SliceZoneComponents}
197
+ */
198
+ export declare const defineSliceZoneComponents: <TSlice extends SliceLike<string> = any, TContext = unknown>(components: SliceZoneComponents<TSlice, TContext>) => SliceZoneComponents<TSlice, TContext>;
199
+ /**
200
+ * Arguments for a `<SliceZone>` `resolver` function.
201
+ */
202
+ export type SliceZoneResolverArgs<TSlice extends SliceLike = SliceLike> = {
203
+ /**
204
+ * The Slice to resolve to a Vue component..
205
+ */
206
+ slice: TSlice;
207
+ /**
208
+ * The name of the Slice.
209
+ */
210
+ sliceName: ExtractSliceType<TSlice>;
211
+ /**
212
+ * The index of the Slice in the Slice Zone.
213
+ */
214
+ i: number;
215
+ };
216
+ /**
217
+ * A function that determines the rendered Vue component for each Slice in the
218
+ * Slice Zone. If a nullish value is returned, the component will fallback to
219
+ * the `components` or `defaultComponent` props to determine the rendered
220
+ * component.
221
+ *
222
+ * @deprecated Use the `components` prop instead.
223
+ *
224
+ * @param args - Arguments for the resolver function.
225
+ *
226
+ * @returns The Vue component to render for a Slice.
227
+ */
228
+ export type SliceZoneResolver<TSlice extends SliceLike = any, TContext = unknown> = (args: SliceZoneResolverArgs<TSlice>) => SliceComponentType<any, TContext> | string | undefined | null;
229
+ /**
230
+ * Props for `<SliceZone />`.
231
+ *
232
+ * @typeParam TContext - Arbitrary data made available to all Slice components
233
+ */
234
+ export type SliceZoneProps<TContext = unknown> = {
235
+ /**
236
+ * List of Slice data from the Slice Zone.
237
+ */
238
+ slices: SliceZoneLike;
239
+ /**
240
+ * A record mapping Slice types to Vue components.
241
+ */
242
+ components?: SliceZoneComponents;
243
+ /**
244
+ * A function that determines the rendered Vue component for each Slice in the
245
+ * Slice Zone.
246
+ *
247
+ * @deprecated Use the `components` prop instead.
248
+ *
249
+ * @param args - Arguments for the resolver function.
250
+ *
251
+ * @returns The Vue component to render for a Slice.
252
+ */
253
+ resolver?: SliceZoneResolver<any, TContext>;
254
+ /**
255
+ * Arbitrary data made available to all Slice components.
256
+ */
257
+ context?: TContext;
258
+ /**
259
+ * A component or a functional component rendered if a component mapping from
260
+ * the `components` prop cannot be found.
261
+ *
262
+ * @remarks
263
+ * Components will be rendered using the {@link SliceComponentProps} interface.
264
+ *
265
+ * @defaultValue The Slice Zone default component provided to `@prismicio/vue` plugin if configured, otherwise `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}.
266
+ */
267
+ defaultComponent?: SliceComponentType<any, TContext>;
268
+ /**
269
+ * An HTML tag name, a component, or a functional component used to wrap the
270
+ * output. The Slice Zone is not wrapped by default.
271
+ */
272
+ wrapper?: string | ConcreteComponent;
273
+ };
274
+ /**
275
+ * `<SliceZone />` implementation.
276
+ *
277
+ * @internal
278
+ */
279
+ export declare const SliceZoneImpl: DefineComponent<{
280
+ slices: {
281
+ type: PropType<SliceZoneLike<SliceLike<string>>>;
282
+ required: true;
283
+ };
284
+ components: {
285
+ type: PropType<SliceZoneComponents<SliceLike<string>, unknown>>;
286
+ default: undefined;
287
+ required: false;
288
+ };
289
+ resolver: {
290
+ type: PropType<SliceZoneResolver<any, unknown>>;
291
+ default: undefined;
292
+ required: false;
293
+ };
294
+ context: {
295
+ type: null;
296
+ default: undefined;
297
+ required: false;
298
+ };
299
+ defaultComponent: {
300
+ type: PropType<SliceComponentType<any, unknown>>;
301
+ default: undefined;
302
+ required: false;
303
+ };
304
+ wrapper: {
305
+ type: PropType<string | ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>>;
306
+ default: undefined;
307
+ required: false;
308
+ };
309
+ }, (() => null) | (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
310
+ [key: string]: any;
311
+ }> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
312
+ [key: string]: any;
313
+ }>[]), unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
314
+ slices: {
315
+ type: PropType<SliceZoneLike<SliceLike<string>>>;
316
+ required: true;
317
+ };
318
+ components: {
319
+ type: PropType<SliceZoneComponents<SliceLike<string>, unknown>>;
320
+ default: undefined;
321
+ required: false;
322
+ };
323
+ resolver: {
324
+ type: PropType<SliceZoneResolver<any, unknown>>;
325
+ default: undefined;
326
+ required: false;
327
+ };
328
+ context: {
329
+ type: null;
330
+ default: undefined;
331
+ required: false;
332
+ };
333
+ defaultComponent: {
334
+ type: PropType<SliceComponentType<any, unknown>>;
335
+ default: undefined;
336
+ required: false;
337
+ };
338
+ wrapper: {
339
+ type: PropType<string | ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>>;
340
+ default: undefined;
341
+ required: false;
342
+ };
343
+ }>>, {
344
+ context: any;
345
+ components: SliceZoneComponents<SliceLike<string>, unknown>;
346
+ resolver: SliceZoneResolver<any, unknown>;
347
+ defaultComponent: SliceComponentType<any, unknown>;
348
+ wrapper: string | ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
349
+ }>;
350
+ /**
351
+ * Component to render a Prismic Slice Zone.
352
+ *
353
+ * @see Component props {@link SliceZoneProps}
354
+ * @see Templating Slice Zones {@link https://prismic.io/docs/technologies/vue-template-content#slices-and-groups}
355
+ */
356
+ export declare const SliceZone: new () => {
357
+ $props: AllowedComponentProps & ComponentCustomProps & VNodeProps & SliceZoneProps;
358
+ };
359
+ export {};
@@ -0,0 +1,134 @@
1
+ import { defineComponent, computed, watchEffect, h, markRaw } from "vue";
2
+ import { simplyResolveComponent } from "../lib/simplyResolveComponent.js";
3
+ import { __PRODUCTION__ } from "../lib/__PRODUCTION__.js";
4
+ import { usePrismic } from "../usePrismic.js";
5
+ const getSliceComponentProps = (propsHint) => ({
6
+ slice: {
7
+ type: Object,
8
+ required: true
9
+ },
10
+ index: {
11
+ type: Number,
12
+ required: true
13
+ },
14
+ slices: {
15
+ type: Array,
16
+ required: true
17
+ },
18
+ context: {
19
+ type: null,
20
+ required: true
21
+ }
22
+ });
23
+ const TODOSliceComponent = __PRODUCTION__ ? () => null : /* @__PURE__ */ defineComponent({
24
+ name: "TODOSliceComponent",
25
+ props: getSliceComponentProps(),
26
+ setup(props) {
27
+ const type = computed(() => "slice_type" in props.slice ? props.slice.slice_type : props.slice.type);
28
+ watchEffect(() => {
29
+ console.warn(`[SliceZone] Could not find a component for Slice type "${type.value}"`, props.slice);
30
+ });
31
+ return () => {
32
+ return h("section", {
33
+ "data-slice-zone-todo-component": "",
34
+ "data-slice-type": type.value
35
+ }, [`Could not find a component for Slice type "${type.value}"`]);
36
+ };
37
+ }
38
+ });
39
+ const defineSliceZoneComponents = (components) => {
40
+ const result = {};
41
+ let type;
42
+ for (type in components) {
43
+ const component = components[type];
44
+ result[type] = typeof component === "string" ? component : markRaw(component);
45
+ }
46
+ return result;
47
+ };
48
+ const SliceZoneImpl = /* @__PURE__ */ defineComponent({
49
+ name: "SliceZone",
50
+ props: {
51
+ slices: {
52
+ type: Array,
53
+ required: true
54
+ },
55
+ components: {
56
+ type: Object,
57
+ default: void 0,
58
+ required: false
59
+ },
60
+ resolver: {
61
+ type: Function,
62
+ default: void 0,
63
+ required: false
64
+ },
65
+ context: {
66
+ type: null,
67
+ default: void 0,
68
+ required: false
69
+ },
70
+ defaultComponent: {
71
+ type: Object,
72
+ default: void 0,
73
+ required: false
74
+ },
75
+ wrapper: {
76
+ type: [String, Object, Function],
77
+ default: void 0,
78
+ required: false
79
+ }
80
+ },
81
+ setup(props) {
82
+ if (!props.slices) {
83
+ return () => null;
84
+ }
85
+ const { options } = usePrismic();
86
+ const renderedSlices = computed(() => {
87
+ return props.slices.map((slice, index) => {
88
+ var _a;
89
+ const type = "slice_type" in slice ? slice.slice_type : slice.type;
90
+ let component = props.components && type in props.components ? props.components[type] : props.defaultComponent || ((_a = options.components) == null ? void 0 : _a.sliceZoneDefaultComponent) || TODOSliceComponent;
91
+ if (props.resolver) {
92
+ const resolvedComponent = props.resolver({
93
+ slice,
94
+ sliceName: type,
95
+ i: index
96
+ });
97
+ if (resolvedComponent) {
98
+ component = resolvedComponent;
99
+ }
100
+ }
101
+ const key = "id" in slice && slice.id ? slice.id : `${index}-${JSON.stringify(slice)}`;
102
+ const p = {
103
+ key,
104
+ slice,
105
+ index,
106
+ context: props.context,
107
+ slices: props.slices
108
+ };
109
+ return h(simplyResolveComponent(component), p);
110
+ });
111
+ });
112
+ return () => {
113
+ if (props.wrapper) {
114
+ const parent = simplyResolveComponent(props.wrapper);
115
+ if (typeof parent === "string") {
116
+ return h(parent, null, renderedSlices.value);
117
+ } else {
118
+ return h(parent, null, { default: () => renderedSlices.value });
119
+ }
120
+ } else {
121
+ return renderedSlices.value;
122
+ }
123
+ };
124
+ }
125
+ });
126
+ const SliceZone = SliceZoneImpl;
127
+ export {
128
+ SliceZone,
129
+ SliceZoneImpl,
130
+ TODOSliceComponent,
131
+ defineSliceZoneComponents,
132
+ getSliceComponentProps
133
+ };
134
+ //# sourceMappingURL=SliceZone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SliceZone.js","sources":["../../../src/components/SliceZone.ts"],"sourcesContent":["import {\n\tAllowedComponentProps,\n\tComponentCustomProps,\n\tcomputed,\n\tConcreteComponent,\n\tDefineComponent,\n\tdefineComponent,\n\tFunctionalComponent,\n\th,\n\tmarkRaw,\n\tPropType,\n\tVNodeProps,\n\twatchEffect,\n} from \"vue\";\n\nimport { Slice } from \"@prismicio/types\";\n\nimport { simplyResolveComponent } from \"../lib/simplyResolveComponent\";\nimport { __PRODUCTION__ } from \"../lib/__PRODUCTION__\";\nimport { usePrismic } from \"../usePrismic\";\n\n/**\n * Returns the type of a `SliceLike` type.\n *\n * @typeParam TSlice - The Slice from which the type will be extracted.\n */\ntype ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2\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 `<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 TSliceType - Type name of the Slice.\n */\nexport type SliceLikeRestV2<TSliceType extends string = string> = {\n\tslice_type: Slice<TSliceType>[\"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 TSliceType - Type name of the Slice.\n */\nexport type SliceLikeGraphQL<TSliceType extends string = string> = {\n\ttype: Slice<TSliceType>[\"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, use the `Slice` export from `@prismicio/types`\n * for a full interface.\n *\n * @typeParam TSliceType - Type name of the Slice\n */\nexport type SliceLike<TSliceType extends string = string> =\n\t| SliceLikeRestV2<TSliceType>\n\t| SliceLikeGraphQL<TSliceType>;\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/types` using\n * `SliceLike`.\n *\n * If using Prismic's REST API, use the `SliceZone` export from\n * `@prismicio/types` for the full type.\n *\n * @typeParam TSlice - The type(s) of slices in the Slice Zone\n */\nexport type SliceZoneLike<TSlice extends SliceLike = SliceLike> =\n\treadonly TSlice[];\n\n/**\n * Vue props for a component rendering content from a Prismic Slice using the\n * `<SliceZone />` component.\n *\n * @typeParam TSlice - The type(s) of slices in the Slice Zone\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 * Native Vue props for a component rendering content from a Prismic Slice using\n * the `<SliceZone />` component.\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made\n * available to all Slice components\n */\nexport type DefineComponentSliceComponentProps<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n\tTContext = unknown,\n> = {\n\tslice: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"slice\"]>;\n\t\trequired: true;\n\t};\n\tindex: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"index\"]>;\n\t\trequired: true;\n\t};\n\tslices: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"slices\"]>;\n\t\trequired: true;\n\t};\n\tcontext: {\n\t\ttype: PropType<SliceComponentProps<TSlice, TContext>[\"context\"]>;\n\t\trequired: true;\n\t};\n};\n\n/**\n * Gets native Vue props for a component rendering content from a Prismic Slice\n * using the `<SliceZone />` component. Props are: `[\"slice\", \"index\", \"slices\",\n * \"context\"]`\n *\n * @example Defining a new slice component:\n *\n * ```javascript\n * import { getSliceComponentProps } from \"@prismicio/vue\";\n *\n * export default {\n * \tprops: getSliceComponentProps(),\n * };\n * ```\n *\n * @example Defining a new slice component with visual hint:\n *\n * ```javascript\n * import { getSliceComponentProps } from \"@prismicio/vue\";\n *\n * export default {\n * \tprops: getSliceComponentProps([\"slice\", \"index\", \"slices\", \"context\"]),\n * };\n * ```\n *\n * @typeParam TSlice - The Slice type\n * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made\n * available to all Slice components\n * @param propsHint - An optional array of prop names used for the sole purpose\n * of having a visual hint of which props are made available to the slice,\n * this parameters doesn't have any effect\n *\n * @returns Props object to use with {@link defineComponent}\n */\nexport const getSliceComponentProps = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n\tTContext = unknown,\n>(\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tpropsHint?: [\"slice\", \"index\", \"slices\", \"context\"],\n): DefineComponentSliceComponentProps<TSlice, TContext> => ({\n\tslice: {\n\t\ttype: Object as PropType<SliceComponentProps<TSlice, TContext>[\"slice\"]>,\n\t\trequired: true,\n\t},\n\tindex: {\n\t\ttype: Number as PropType<SliceComponentProps<TSlice, TContext>[\"index\"]>,\n\t\trequired: true,\n\t},\n\tslices: {\n\t\ttype: Array as PropType<SliceComponentProps<TSlice, TContext>[\"slices\"]>,\n\t\trequired: true,\n\t},\n\tcontext: {\n\t\ttype: null as unknown as PropType<\n\t\t\tSliceComponentProps<TSlice, TContext>[\"context\"]\n\t\t>,\n\t\trequired: true,\n\t},\n});\n\n/**\n * A Vue component to be rendered for each instance of its Slice.\n *\n * @typeParam TSlice - The type(s) of slices 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> =\n\t| DefineComponent<SliceComponentProps<TSlice, TContext>>\n\t| FunctionalComponent<SliceComponentProps<TSlice, TContext>>;\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 Vue component rendered when a component mapping\n * cannot be found in `<SliceZone />`.\n */\nexport const TODOSliceComponent = __PRODUCTION__\n\t? ((() => null) as FunctionalComponent<SliceComponentProps>)\n\t: /*#__PURE__*/ (defineComponent({\n\t\t\tname: \"TODOSliceComponent\",\n\t\t\tprops: getSliceComponentProps(),\n\t\t\tsetup(props) {\n\t\t\t\tconst type = computed(() =>\n\t\t\t\t\t\"slice_type\" in props.slice\n\t\t\t\t\t\t? props.slice.slice_type\n\t\t\t\t\t\t: props.slice.type,\n\t\t\t\t);\n\n\t\t\t\twatchEffect(() => {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[SliceZone] Could not find a component for Slice type \"${type.value}\"`,\n\t\t\t\t\t\tprops.slice,\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\treturn () => {\n\t\t\t\t\treturn h(\n\t\t\t\t\t\t\"section\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"data-slice-zone-todo-component\": \"\",\n\t\t\t\t\t\t\t\"data-slice-type\": type.value,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[`Could not find a component for Slice type \"${type.value}\"`],\n\t\t\t\t\t);\n\t\t\t\t};\n\t\t\t},\n\t }) as SliceComponentType);\n\n/**\n * A record of Slice types mapped to Vue components. Each components will be\n * rendered for each instance of their Slice type.\n *\n * @typeParam TSlice - The type(s) of slices 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>]:\n\t\t\t| SliceComponentType<Extract<TSlice, SliceLike<SliceType>>, TContext>\n\t\t\t| string;\n\t};\n\n/**\n * Gets an optimized record of Slice types mapped to Vue components. Each\n * components will be rendered for each instance of their Slice type.\n *\n * @remarks\n * This is essentially an helper function to ensure {@link markRaw} is correctly\n * applied on each components, improving performances.\n * @example Defining a slice components:\n *\n * ```javascript\n * import { defineSliceZoneComponents } from \"@prismicio/vue\";\n *\n * export default {\n * data() {\n * components: defineSliceZoneComponents({\n * foo: Foo,\n * bar: defineAsyncComponent(\n * () => new Promise((res) => res(Bar)),\n * ),\n * baz: \"Baz\",\n * }),\n * }\n * };\n * ```\n *\n * @typeParam TSlice - The type(s) of slices in the Slice Zone\n * @typeParam TContext - Arbitrary data made available to all Slice components\n *\n * @param components - {@link SliceZoneComponents}\n *\n * @returns A new optimized record of {@link SliceZoneComponents}\n */\nexport const defineSliceZoneComponents = <\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSlice extends SliceLike = any,\n\tTContext = unknown,\n>(\n\tcomponents: SliceZoneComponents<TSlice, TContext>,\n): SliceZoneComponents<TSlice, TContext> => {\n\tconst result = {} as SliceZoneComponents<TSlice, TContext>;\n\n\tlet type: keyof typeof components;\n\tfor (type in components) {\n\t\tconst component = components[type];\n\t\tresult[type] =\n\t\t\ttypeof component === \"string\"\n\t\t\t\t? component\n\t\t\t\t: markRaw(\n\t\t\t\t\t\tcomponent as SliceComponentType<\n\t\t\t\t\t\t\tExtract<TSlice, SliceLike<typeof type>>,\n\t\t\t\t\t\t\tTContext\n\t\t\t\t\t\t>,\n\t\t\t\t );\n\t}\n\n\treturn result;\n};\n\n/**\n * Arguments for a `<SliceZone>` `resolver` function.\n */\nexport type SliceZoneResolverArgs<TSlice extends SliceLike = SliceLike> = {\n\t/**\n\t * The Slice to resolve to a Vue component..\n\t */\n\tslice: TSlice;\n\n\t/**\n\t * The name of the Slice.\n\t */\n\tsliceName: 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 Vue 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 Vue 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> = (\n\targs: SliceZoneResolverArgs<TSlice>,\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => SliceComponentType<any, TContext> | string | undefined | null;\n\n/**\n * Props for `<SliceZone />`.\n *\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 Vue components.\n\t */\n\tcomponents?: SliceZoneComponents;\n\n\t/**\n\t * A function that determines the rendered Vue component for each Slice in the\n\t * 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 Vue 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 * Arbitrary data made available to all Slice components.\n\t */\n\tcontext?: TContext;\n\n\t/**\n\t * A component or a functional component rendered if a component mapping from\n\t * the `components` prop cannot be found.\n\t *\n\t * @remarks\n\t * Components will be rendered using the {@link SliceComponentProps} interface.\n\t *\n\t * @defaultValue The Slice Zone default component provided to `@prismicio/vue` plugin if configured, otherwise `null` when `process.env.NODE_ENV === \"production\"` else {@link TODOSliceComponent}.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>;\n\n\t/**\n\t * An HTML tag name, a component, or a functional component used to wrap the\n\t * output. The Slice Zone is not wrapped by default.\n\t */\n\twrapper?: string | ConcreteComponent;\n};\n\n/**\n * `<SliceZone />` implementation.\n *\n * @internal\n */\nexport const SliceZoneImpl = /*#__PURE__*/ defineComponent({\n\tname: \"SliceZone\",\n\tprops: {\n\t\tslices: {\n\t\t\ttype: Array as PropType<SliceZoneLike>,\n\t\t\trequired: true,\n\t\t},\n\t\tcomponents: {\n\t\t\ttype: Object as PropType<SliceZoneComponents>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\tresolver: {\n\t\t\ttype: Function as PropType<SliceZoneResolver>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\tcontext: {\n\t\t\ttype: null,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\tdefaultComponent: {\n\t\t\ttype: Object as PropType<SliceComponentType>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t\twrapper: {\n\t\t\ttype: [String, Object, Function] as PropType<string | ConcreteComponent>,\n\t\t\tdefault: undefined,\n\t\t\trequired: false,\n\t\t},\n\t},\n\tsetup(props) {\n\t\t// Prevent fatal if user didn't check for field, throws `Invalid prop` warn\n\t\tif (!props.slices) {\n\t\t\treturn () => null;\n\t\t}\n\n\t\tconst { options } = usePrismic();\n\n\t\tconst renderedSlices = computed(() => {\n\t\t\treturn props.slices.map((slice, index) => {\n\t\t\t\tconst type = \"slice_type\" in slice ? slice.slice_type : slice.type;\n\n\t\t\t\tlet component =\n\t\t\t\t\tprops.components && type in props.components\n\t\t\t\t\t\t? props.components[type]\n\t\t\t\t\t\t: props.defaultComponent ||\n\t\t\t\t\t\t options.components?.sliceZoneDefaultComponent ||\n\t\t\t\t\t\t TODOSliceComponent;\n\n\t\t\t\t// TODO: Remove `resolver` in v3 in favor of `components`.\n\t\t\t\tif (props.resolver) {\n\t\t\t\t\tconst resolvedComponent = props.resolver({\n\t\t\t\t\t\tslice,\n\t\t\t\t\t\tsliceName: type,\n\t\t\t\t\t\ti: index,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (resolvedComponent) {\n\t\t\t\t\t\tcomponent = resolvedComponent;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst key =\n\t\t\t\t\t\"id\" in slice && slice.id\n\t\t\t\t\t\t? slice.id\n\t\t\t\t\t\t: `${index}-${JSON.stringify(slice)}`;\n\n\t\t\t\tconst p = {\n\t\t\t\t\tkey,\n\t\t\t\t\tslice,\n\t\t\t\t\tindex,\n\t\t\t\t\tcontext: props.context,\n\t\t\t\t\tslices: props.slices,\n\t\t\t\t};\n\n\t\t\t\treturn h(simplyResolveComponent(component as ConcreteComponent), p);\n\t\t\t});\n\t\t});\n\n\t\treturn () => {\n\t\t\tif (props.wrapper) {\n\t\t\t\tconst parent = simplyResolveComponent(props.wrapper);\n\n\t\t\t\tif (typeof parent === \"string\") {\n\t\t\t\t\treturn h(parent, null, renderedSlices.value);\n\t\t\t\t} else {\n\t\t\t\t\treturn h(parent, null, { default: () => renderedSlices.value });\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn renderedSlices.value;\n\t\t\t}\n\t\t};\n\t},\n});\n\n// export the public type for h/tsx inference\n// also to avoid inline import() in generated d.ts files\n/**\n * Component to render a Prismic Slice Zone.\n *\n * @see Component props {@link SliceZoneProps}\n * @see Templating Slice Zones {@link https://prismic.io/docs/technologies/vue-template-content#slices-and-groups}\n */\nexport const SliceZone = SliceZoneImpl as unknown as {\n\tnew (): {\n\t\t$props: AllowedComponentProps &\n\t\t\tComponentCustomProps &\n\t\t\tVNodeProps &\n\t\t\tSliceZoneProps;\n\t};\n};\n"],"names":[],"mappings":"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"}
@@ -0,0 +1,12 @@
1
+ export { PrismicEmbedImpl, PrismicEmbed } from "./PrismicEmbed";
2
+ export type { PrismicEmbedProps } from "./PrismicEmbed";
3
+ export { usePrismicImage, PrismicImageImpl, PrismicImage, } from "./PrismicImage";
4
+ export type { UsePrismicImageOptions, PrismicImageProps } from "./PrismicImage";
5
+ export { usePrismicLink, PrismicLinkImpl, PrismicLink } from "./PrismicLink";
6
+ export type { UsePrismicLinkOptions, PrismicLinkProps } from "./PrismicLink";
7
+ export { usePrismicText, PrismicTextImpl, PrismicText } from "./PrismicText";
8
+ export type { UsePrismicTextOptions, PrismicTextProps } from "./PrismicText";
9
+ export { usePrismicRichText, PrismicRichTextImpl, PrismicRichText, } from "./PrismicRichText";
10
+ export type { UsePrismicRichTextOptions, PrismicRichTextProps, } from "./PrismicRichText";
11
+ export { getSliceComponentProps, TODOSliceComponent, defineSliceZoneComponents, SliceZoneImpl, SliceZone, } from "./SliceZone";
12
+ export type { DefineComponentSliceComponentProps, SliceComponentProps, SliceComponentType, SliceLikeRestV2, SliceLikeGraphQL, SliceLike, SliceZoneComponents, SliceZoneResolverArgs, SliceZoneResolver, SliceZoneLike, SliceZoneProps, } from "./SliceZone";
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const useStatefulPrismicClientMethod = require("./useStatefulPrismicClientMethod.cjs");
4
+ const usePrismicDocuments = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("get", args);
5
+ const useFirstPrismicDocument = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getFirst", args);
6
+ const usePrismicDocumentByID = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getByID", args);
7
+ const usePrismicDocumentsByIDs = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getByIDs", args);
8
+ const useAllPrismicDocumentsByIDs = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getAllByIDs", args);
9
+ const usePrismicDocumentByUID = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getByUID", args);
10
+ const usePrismicDocumentsByUIDs = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getByUIDs", args);
11
+ const useAllPrismicDocumentsByUIDs = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getAllByUIDs", args);
12
+ const useSinglePrismicDocument = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getSingle", args);
13
+ const usePrismicDocumentsByType = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getByType", args);
14
+ const useAllPrismicDocumentsByType = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getAllByType", args);
15
+ const usePrismicDocumentsByTag = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getByTag", args);
16
+ const useAllPrismicDocumentsByTag = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getAllByTag", args);
17
+ const usePrismicDocumentsByEveryTag = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getByEveryTag", args);
18
+ const useAllPrismicDocumentsByEveryTag = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getAllByEveryTag", args);
19
+ const usePrismicDocumentsBySomeTags = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getBySomeTags", args);
20
+ const useAllPrismicDocumentsBySomeTags = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("getAllBySomeTags", args);
21
+ const dangerouslyUseAllPrismicDocuments = (...args) => useStatefulPrismicClientMethod.useStatefulPrismicClientMethod("dangerouslyGetAll", args);
22
+ exports.dangerouslyUseAllPrismicDocuments = dangerouslyUseAllPrismicDocuments;
23
+ exports.useAllPrismicDocumentsByEveryTag = useAllPrismicDocumentsByEveryTag;
24
+ exports.useAllPrismicDocumentsByIDs = useAllPrismicDocumentsByIDs;
25
+ exports.useAllPrismicDocumentsBySomeTags = useAllPrismicDocumentsBySomeTags;
26
+ exports.useAllPrismicDocumentsByTag = useAllPrismicDocumentsByTag;
27
+ exports.useAllPrismicDocumentsByType = useAllPrismicDocumentsByType;
28
+ exports.useAllPrismicDocumentsByUIDs = useAllPrismicDocumentsByUIDs;
29
+ exports.useFirstPrismicDocument = useFirstPrismicDocument;
30
+ exports.usePrismicDocumentByID = usePrismicDocumentByID;
31
+ exports.usePrismicDocumentByUID = usePrismicDocumentByUID;
32
+ exports.usePrismicDocuments = usePrismicDocuments;
33
+ exports.usePrismicDocumentsByEveryTag = usePrismicDocumentsByEveryTag;
34
+ exports.usePrismicDocumentsByIDs = usePrismicDocumentsByIDs;
35
+ exports.usePrismicDocumentsBySomeTags = usePrismicDocumentsBySomeTags;
36
+ exports.usePrismicDocumentsByTag = usePrismicDocumentsByTag;
37
+ exports.usePrismicDocumentsByType = usePrismicDocumentsByType;
38
+ exports.usePrismicDocumentsByUIDs = usePrismicDocumentsByUIDs;
39
+ exports.useSinglePrismicDocument = useSinglePrismicDocument;
40
+ //# sourceMappingURL=composables.cjs.map