@prismicio/vue 4.3.1 → 5.0.0-alpha.1
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/README.md +4 -4
- package/dist/PrismicEmbed.vue.cjs +25 -0
- package/dist/PrismicEmbed.vue.cjs.map +1 -0
- package/dist/PrismicEmbed.vue.d.ts +19 -0
- package/dist/PrismicEmbed.vue.js +26 -0
- package/dist/PrismicEmbed.vue.js.map +1 -0
- package/dist/PrismicEmbed.vue2.cjs +4 -0
- package/dist/PrismicEmbed.vue2.cjs.map +1 -0
- package/dist/PrismicEmbed.vue2.js +5 -0
- package/dist/PrismicEmbed.vue2.js.map +1 -0
- package/dist/PrismicImage.vue.cjs +84 -0
- package/dist/PrismicImage.vue.cjs.map +1 -0
- package/dist/PrismicImage.vue.d.ts +224 -0
- package/dist/PrismicImage.vue.js +85 -0
- package/dist/PrismicImage.vue.js.map +1 -0
- package/dist/PrismicImage.vue2.cjs +4 -0
- package/dist/PrismicImage.vue2.cjs.map +1 -0
- package/dist/PrismicImage.vue2.js +5 -0
- package/dist/PrismicImage.vue2.js.map +1 -0
- package/dist/PrismicLink.vue.cjs +100 -0
- package/dist/PrismicLink.vue.cjs.map +1 -0
- package/dist/PrismicLink.vue.d.ts +279 -0
- package/dist/PrismicLink.vue.js +101 -0
- package/dist/PrismicLink.vue.js.map +1 -0
- package/dist/PrismicLink.vue2.cjs +4 -0
- package/dist/PrismicLink.vue2.cjs.map +1 -0
- package/dist/PrismicLink.vue2.js +5 -0
- package/dist/PrismicLink.vue2.js.map +1 -0
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.cjs +90 -0
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.cjs.map +1 -0
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.d.ts +8 -0
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.js +91 -0
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.js.map +1 -0
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue2.cjs +4 -0
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue2.cjs.map +1 -0
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue2.js +5 -0
- package/dist/PrismicRichText/DeprecatedPrismicRichText.vue2.js.map +1 -0
- package/dist/PrismicRichText/PrismicRichText.vue.cjs +85 -0
- package/dist/PrismicRichText/PrismicRichText.vue.cjs.map +1 -0
- package/dist/PrismicRichText/PrismicRichText.vue.d.ts +57 -0
- package/dist/PrismicRichText/PrismicRichText.vue.js +86 -0
- package/dist/PrismicRichText/PrismicRichText.vue.js.map +1 -0
- package/dist/PrismicRichText/PrismicRichText.vue2.cjs +4 -0
- package/dist/PrismicRichText/PrismicRichText.vue2.cjs.map +1 -0
- package/dist/PrismicRichText/PrismicRichText.vue2.js +5 -0
- package/dist/PrismicRichText/PrismicRichText.vue2.js.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.cjs +133 -0
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.cjs.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.d.ts +37 -0
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.js +134 -0
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.js.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue2.cjs +4 -0
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue2.cjs.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue2.js +5 -0
- package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue2.js.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue.cjs +47 -0
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue.cjs.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue.d.ts +10 -0
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue.js +48 -0
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue.js.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue2.cjs +4 -0
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue2.cjs.map +1 -0
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue2.js +5 -0
- package/dist/PrismicRichText/PrismicRichTextSerialize.vue2.js.map +1 -0
- package/dist/PrismicRichText/getRichTextComponentProps.cjs +10 -0
- package/dist/PrismicRichText/getRichTextComponentProps.cjs.map +1 -0
- package/dist/PrismicRichText/getRichTextComponentProps.d.ts +49 -0
- package/dist/PrismicRichText/getRichTextComponentProps.js +10 -0
- package/dist/PrismicRichText/getRichTextComponentProps.js.map +1 -0
- package/dist/PrismicRichText/index.d.ts +2 -0
- package/dist/PrismicRichText/types.d.ts +22 -0
- package/dist/PrismicText.vue.cjs +43 -0
- package/dist/PrismicText.vue.cjs.map +1 -0
- package/dist/PrismicText.vue.d.ts +31 -0
- package/dist/PrismicText.vue.js +44 -0
- package/dist/PrismicText.vue.js.map +1 -0
- package/dist/PrismicText.vue2.cjs +4 -0
- package/dist/PrismicText.vue2.cjs.map +1 -0
- package/dist/PrismicText.vue2.js +5 -0
- package/dist/PrismicText.vue2.js.map +1 -0
- package/dist/SliceZone/SliceZone.vue.cjs +63 -0
- package/dist/SliceZone/SliceZone.vue.cjs.map +1 -0
- package/dist/SliceZone/SliceZone.vue.d.ts +41 -0
- package/dist/SliceZone/SliceZone.vue.js +64 -0
- package/dist/SliceZone/SliceZone.vue.js.map +1 -0
- package/dist/SliceZone/SliceZone.vue2.cjs +4 -0
- package/dist/SliceZone/SliceZone.vue2.cjs.map +1 -0
- package/dist/SliceZone/SliceZone.vue2.js +5 -0
- package/dist/SliceZone/SliceZone.vue2.js.map +1 -0
- package/dist/SliceZone/TODOSliceComponent.cjs +29 -0
- package/dist/SliceZone/TODOSliceComponent.cjs.map +1 -0
- package/dist/SliceZone/TODOSliceComponent.d.ts +9 -0
- package/dist/SliceZone/TODOSliceComponent.js +29 -0
- package/dist/SliceZone/TODOSliceComponent.js.map +1 -0
- package/dist/SliceZone/defineSliceZoneComponents.cjs +14 -0
- package/dist/SliceZone/defineSliceZoneComponents.cjs.map +1 -0
- package/dist/SliceZone/defineSliceZoneComponents.d.ts +36 -0
- package/dist/SliceZone/defineSliceZoneComponents.js +14 -0
- package/dist/SliceZone/defineSliceZoneComponents.js.map +1 -0
- package/dist/SliceZone/getSliceComponentProps.cjs +22 -0
- package/dist/SliceZone/getSliceComponentProps.cjs.map +1 -0
- package/dist/SliceZone/getSliceComponentProps.d.ts +66 -0
- package/dist/SliceZone/getSliceComponentProps.js +22 -0
- package/dist/SliceZone/getSliceComponentProps.js.map +1 -0
- package/dist/SliceZone/index.d.ts +4 -0
- package/dist/SliceZone/types.d.ts +97 -0
- package/dist/createPrismic.cjs +17 -50
- package/dist/createPrismic.cjs.map +1 -1
- package/dist/createPrismic.d.ts +10 -0
- package/dist/createPrismic.js +16 -27
- package/dist/createPrismic.js.map +1 -1
- package/dist/index.cjs +21 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +19 -9
- package/dist/index.js +19 -38
- package/dist/index.js.map +1 -1
- package/dist/lib/Wrapper.vue.cjs +20 -0
- package/dist/lib/Wrapper.vue.cjs.map +1 -0
- package/dist/lib/Wrapper.vue.d.ts +28 -0
- package/dist/lib/Wrapper.vue.js +21 -0
- package/dist/lib/Wrapper.vue.js.map +1 -0
- package/dist/lib/Wrapper.vue2.cjs +4 -0
- package/dist/lib/Wrapper.vue2.cjs.map +1 -0
- package/dist/lib/Wrapper.vue2.js +5 -0
- package/dist/lib/Wrapper.vue2.js.map +1 -0
- package/dist/lib/devMsg.cjs +8 -0
- package/dist/lib/devMsg.cjs.map +1 -0
- package/dist/lib/devMsg.d.ts +16 -0
- package/dist/lib/devMsg.js +8 -0
- package/dist/lib/devMsg.js.map +1 -0
- package/dist/package.json.cjs +5 -0
- package/dist/package.json.cjs.map +1 -0
- package/dist/package.json.js +5 -0
- package/dist/package.json.js.map +1 -0
- package/dist/types.d.ts +32 -56
- package/dist/usePrismic.cjs +3 -2
- package/dist/usePrismic.cjs.map +1 -1
- package/dist/usePrismic.d.ts +8 -0
- package/dist/usePrismic.js +2 -1
- package/dist/usePrismic.js.map +1 -1
- package/package.json +21 -23
- package/src/PrismicEmbed.vue +42 -0
- package/src/PrismicImage.vue +160 -0
- package/src/PrismicLink.vue +191 -0
- package/src/PrismicRichText/DeprecatedPrismicRichText.vue +130 -0
- package/src/PrismicRichText/PrismicRichText.vue +157 -0
- package/src/PrismicRichText/PrismicRichTextDefaultComponent.vue +63 -0
- package/src/PrismicRichText/PrismicRichTextSerialize.vue +52 -0
- package/src/PrismicRichText/getRichTextComponentProps.ts +63 -0
- package/src/PrismicRichText/index.ts +3 -0
- package/src/PrismicRichText/types.ts +37 -0
- package/src/PrismicText.vue +63 -0
- package/src/SliceZone/SliceZone.vue +113 -0
- package/src/SliceZone/TODOSliceComponent.ts +49 -0
- package/src/SliceZone/defineSliceZoneComponents.ts +67 -0
- package/src/SliceZone/getSliceComponentProps.ts +98 -0
- package/src/SliceZone/index.ts +13 -0
- package/src/SliceZone/types.ts +163 -0
- package/src/createPrismic.ts +28 -33
- package/src/index.ts +32 -57
- package/src/lib/Wrapper.vue +22 -0
- package/src/lib/devMsg.ts +20 -0
- package/src/types.ts +39 -66
- package/src/usePrismic.ts +8 -1
- package/dist/components/PrismicEmbed.cjs +0 -36
- package/dist/components/PrismicEmbed.cjs.map +0 -1
- package/dist/components/PrismicEmbed.d.ts +0 -59
- package/dist/components/PrismicEmbed.js +0 -36
- package/dist/components/PrismicEmbed.js.map +0 -1
- package/dist/components/PrismicImage.cjs +0 -122
- package/dist/components/PrismicImage.cjs.map +0 -1
- package/dist/components/PrismicImage.d.ts +0 -165
- package/dist/components/PrismicImage.js +0 -122
- package/dist/components/PrismicImage.js.map +0 -1
- package/dist/components/PrismicLink.cjs +0 -120
- package/dist/components/PrismicLink.cjs.map +0 -1
- package/dist/components/PrismicLink.d.ts +0 -198
- package/dist/components/PrismicLink.js +0 -120
- package/dist/components/PrismicLink.js.map +0 -1
- package/dist/components/PrismicRichText.cjs +0 -108
- package/dist/components/PrismicRichText.cjs.map +0 -1
- package/dist/components/PrismicRichText.d.ts +0 -161
- package/dist/components/PrismicRichText.js +0 -108
- package/dist/components/PrismicRichText.js.map +0 -1
- package/dist/components/PrismicText.cjs +0 -57
- package/dist/components/PrismicText.cjs.map +0 -1
- package/dist/components/PrismicText.d.ts +0 -119
- package/dist/components/PrismicText.js +0 -57
- package/dist/components/PrismicText.js.map +0 -1
- package/dist/components/SliceZone.cjs +0 -156
- package/dist/components/SliceZone.cjs.map +0 -1
- package/dist/components/SliceZone.d.ts +0 -377
- package/dist/components/SliceZone.js +0 -156
- package/dist/components/SliceZone.js.map +0 -1
- package/dist/components/index.d.ts +0 -12
- package/dist/composables.cjs +0 -40
- package/dist/composables.cjs.map +0 -1
- package/dist/composables.d.ts +0 -348
- package/dist/composables.js +0 -40
- package/dist/composables.js.map +0 -1
- package/dist/globalExtensions.d.ts +0 -11
- package/dist/injectionSymbols.cjs +0 -5
- package/dist/injectionSymbols.cjs.map +0 -1
- package/dist/injectionSymbols.d.ts +0 -9
- package/dist/injectionSymbols.js +0 -5
- package/dist/injectionSymbols.js.map +0 -1
- package/dist/lib/__PRODUCTION__.cjs +0 -8
- package/dist/lib/__PRODUCTION__.cjs.map +0 -1
- package/dist/lib/__PRODUCTION__.d.ts +0 -7
- package/dist/lib/__PRODUCTION__.js +0 -8
- package/dist/lib/__PRODUCTION__.js.map +0 -1
- package/dist/lib/getSlots.cjs +0 -21
- package/dist/lib/getSlots.cjs.map +0 -1
- package/dist/lib/getSlots.d.ts +0 -14
- package/dist/lib/getSlots.js +0 -21
- package/dist/lib/getSlots.js.map +0 -1
- package/dist/lib/simplyResolveComponent.cjs +0 -8
- package/dist/lib/simplyResolveComponent.cjs.map +0 -1
- package/dist/lib/simplyResolveComponent.d.ts +0 -12
- package/dist/lib/simplyResolveComponent.js +0 -8
- package/dist/lib/simplyResolveComponent.js.map +0 -1
- package/dist/useStatefulPrismicClientMethod.cjs +0 -39
- package/dist/useStatefulPrismicClientMethod.cjs.map +0 -1
- package/dist/useStatefulPrismicClientMethod.d.ts +0 -65
- package/dist/useStatefulPrismicClientMethod.js +0 -39
- package/dist/useStatefulPrismicClientMethod.js.map +0 -1
- package/src/components/PrismicEmbed.ts +0 -90
- package/src/components/PrismicImage.ts +0 -307
- package/src/components/PrismicLink.ts +0 -324
- package/src/components/PrismicRichText.ts +0 -283
- package/src/components/PrismicText.ts +0 -165
- package/src/components/SliceZone.ts +0 -617
- package/src/components/index.ts +0 -42
- package/src/composables.ts +0 -492
- package/src/globalExtensions.ts +0 -12
- package/src/injectionSymbols.ts +0 -17
- package/src/lib/__PRODUCTION__.ts +0 -12
- package/src/lib/getSlots.ts +0 -43
- package/src/lib/simplyResolveComponent.ts +0 -18
- package/src/useStatefulPrismicClientMethod.ts +0 -158
- package/vetur/attributes.json +0 -113
- package/vetur/tags.json +0 -60
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { RichTextField } from "@prismicio/client"
|
|
3
|
+
import { asText, isFilled } from "@prismicio/client"
|
|
4
|
+
import { DEV } from "esm-env"
|
|
5
|
+
import { watchEffect } from "vue"
|
|
6
|
+
|
|
7
|
+
import Wrapper from "./lib/Wrapper.vue"
|
|
8
|
+
import { devMsg } from "./lib/devMsg"
|
|
9
|
+
|
|
10
|
+
import type { ComponentOrTagName } from "./types"
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Props for `<PrismicText />`.
|
|
14
|
+
*/
|
|
15
|
+
export type PrismicTextProps = {
|
|
16
|
+
/**
|
|
17
|
+
* The Prismic rich text field to render.
|
|
18
|
+
*/
|
|
19
|
+
field: RichTextField | null | undefined
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The string value to be rendered when the field is empty. If a fallback is
|
|
23
|
+
* not given, `""` (nothing) will be rendered.
|
|
24
|
+
*/
|
|
25
|
+
fallback?: string
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The separator used between blocks.
|
|
29
|
+
*
|
|
30
|
+
* @defaultValue `" "` (a whitespace)
|
|
31
|
+
*/
|
|
32
|
+
separator?: string
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* An HTML tag name or a component used to wrap the output. `<PrismicText />`
|
|
36
|
+
* is not wrapped by default.
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue `"template"` (no wrapper)
|
|
39
|
+
*/
|
|
40
|
+
wrapper?: ComponentOrTagName
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const props = defineProps<PrismicTextProps>()
|
|
44
|
+
defineOptions({ name: "PrismicText" })
|
|
45
|
+
|
|
46
|
+
if (DEV) {
|
|
47
|
+
watchEffect(() => {
|
|
48
|
+
if (typeof props.field === "string") {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`[PrismicText] The "field" prop only accepts a Rich Text or title field's value but was provided a different type of field instead (e.g. a Key Text or Select field). You can resolve this error by rendering the field value inline without <PrismicText>. For more details, see ${devMsg(
|
|
51
|
+
"prismictext-works-only-with-rich-text-and-title-fields",
|
|
52
|
+
)}`,
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
}, {})
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<Wrapper v-if="isFilled.richText(field) || fallback" :wrapper="wrapper">
|
|
61
|
+
{{ asText(field) || fallback }}
|
|
62
|
+
</Wrapper>
|
|
63
|
+
</template>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed } from "vue"
|
|
3
|
+
|
|
4
|
+
import Wrapper from "../lib/Wrapper.vue"
|
|
5
|
+
|
|
6
|
+
import type { ComponentOrTagName } from "../types"
|
|
7
|
+
import type {
|
|
8
|
+
SliceComponentType,
|
|
9
|
+
SliceLike,
|
|
10
|
+
SliceZoneComponents,
|
|
11
|
+
SliceZoneLike,
|
|
12
|
+
} from "./types"
|
|
13
|
+
|
|
14
|
+
import { usePrismic } from "../usePrismic"
|
|
15
|
+
|
|
16
|
+
import { TODOSliceComponent } from "./TODOSliceComponent"
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Props for `<SliceZone />`.
|
|
20
|
+
*
|
|
21
|
+
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
22
|
+
*/
|
|
23
|
+
export type SliceZoneProps<TContext = unknown> = {
|
|
24
|
+
/**
|
|
25
|
+
* List of Slice data from the Slice Zone.
|
|
26
|
+
*/
|
|
27
|
+
slices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A record mapping Slice types to Vue components.
|
|
31
|
+
*/
|
|
32
|
+
components?: SliceZoneComponents
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The Vue component rendered if a component mapping from the `components`
|
|
36
|
+
* prop cannot be found.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* Components will be rendered using the {@link SliceComponentProps} interface.
|
|
40
|
+
*
|
|
41
|
+
* @defaultValue The Slice Zone default component provided to `@prismicio/vue` plugin if configured, otherwise `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}.
|
|
42
|
+
*/
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
defaultComponent?: SliceComponentType<any, TContext>
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Arbitrary data made available to all Slice components.
|
|
48
|
+
*/
|
|
49
|
+
context?: TContext
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* An HTML tag name or a component used to wrap the output. `<SliceZone />` is
|
|
53
|
+
* not wrapped by default.
|
|
54
|
+
*
|
|
55
|
+
* @defaultValue `"template"` (no wrapper)
|
|
56
|
+
*/
|
|
57
|
+
wrapper?: ComponentOrTagName
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const props = defineProps<SliceZoneProps>()
|
|
61
|
+
defineOptions({ name: "SliceZone" })
|
|
62
|
+
|
|
63
|
+
const { options } = usePrismic()
|
|
64
|
+
|
|
65
|
+
const renderedSlices = computed(() => {
|
|
66
|
+
return props.slices.map((slice, index) => {
|
|
67
|
+
const type =
|
|
68
|
+
"slice_type" in slice ? (slice.slice_type as string) : slice.type
|
|
69
|
+
|
|
70
|
+
const key =
|
|
71
|
+
"id" in slice && typeof slice.id === "string"
|
|
72
|
+
? slice.id
|
|
73
|
+
: `${index}-${JSON.stringify(slice)}`
|
|
74
|
+
|
|
75
|
+
const is =
|
|
76
|
+
props.components?.[type] ||
|
|
77
|
+
props.defaultComponent ||
|
|
78
|
+
options.components?.sliceZoneDefaultComponent
|
|
79
|
+
|
|
80
|
+
if (!is) {
|
|
81
|
+
return { is: TODOSliceComponent, key, props: { slice } }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (slice.__mapped) {
|
|
85
|
+
const { __mapped, ...mappedProps } = slice
|
|
86
|
+
|
|
87
|
+
return { is, key, props: mappedProps }
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
is,
|
|
92
|
+
key,
|
|
93
|
+
props: {
|
|
94
|
+
slice,
|
|
95
|
+
index,
|
|
96
|
+
context: props.context,
|
|
97
|
+
slices: props.slices,
|
|
98
|
+
},
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<template>
|
|
105
|
+
<Wrapper v-if="slices" :wrapper="wrapper">
|
|
106
|
+
<component
|
|
107
|
+
v-for="renderedSlice in renderedSlices"
|
|
108
|
+
:is="renderedSlice.is"
|
|
109
|
+
:key="renderedSlice.key"
|
|
110
|
+
v-bind="renderedSlice.props"
|
|
111
|
+
/>
|
|
112
|
+
</Wrapper>
|
|
113
|
+
</template>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DEV } from "esm-env"
|
|
2
|
+
import type { PropType } from "vue"
|
|
3
|
+
import { computed, defineComponent, h, watchEffect } from "vue"
|
|
4
|
+
|
|
5
|
+
import type { SliceComponentType, SliceLike } from "./types"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This Slice component can be used as a reminder to provide a proper
|
|
9
|
+
* implementation.
|
|
10
|
+
*
|
|
11
|
+
* This is also the default Vue component rendered when a component mapping
|
|
12
|
+
* cannot be found in `<SliceZone />`.
|
|
13
|
+
*/
|
|
14
|
+
export const TODOSliceComponent = DEV
|
|
15
|
+
? /*#__PURE__*/ (defineComponent({
|
|
16
|
+
name: "TODOSliceComponent",
|
|
17
|
+
props: {
|
|
18
|
+
slice: {
|
|
19
|
+
type: Object as PropType<SliceLike>,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
setup(props) {
|
|
24
|
+
const type = computed(() => {
|
|
25
|
+
return "slice_type" in props.slice
|
|
26
|
+
? props.slice.slice_type
|
|
27
|
+
: props.slice.type
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
watchEffect(() => {
|
|
31
|
+
console.warn(
|
|
32
|
+
`[SliceZone] Could not find a component for Slice type "${type.value}"`,
|
|
33
|
+
props.slice,
|
|
34
|
+
)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
return () => {
|
|
38
|
+
return h(
|
|
39
|
+
"section",
|
|
40
|
+
{
|
|
41
|
+
"data-slice-zone-todo-component": "",
|
|
42
|
+
"data-slice-type": type.value,
|
|
43
|
+
},
|
|
44
|
+
[`Could not find a component for Slice type "${type.value}"`],
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
}) as SliceComponentType)
|
|
49
|
+
: ((() => null) as SliceComponentType)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { markRaw } from "vue"
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
SliceComponentType,
|
|
5
|
+
SliceLike,
|
|
6
|
+
SliceZoneComponents,
|
|
7
|
+
} from "./types"
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Gets an optimized record of Slice types mapped to Vue components. Each
|
|
11
|
+
* components will be rendered for each instance of their Slice type.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* This is essentially an helper function to ensure {@link markRaw} is correctly
|
|
15
|
+
* applied on each components, improving performances.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* ```javascript
|
|
20
|
+
* // Defining a slice components
|
|
21
|
+
* import { defineSliceZoneComponents } from "@prismicio/vue";
|
|
22
|
+
*
|
|
23
|
+
* export default {
|
|
24
|
+
* data() {
|
|
25
|
+
* components: defineSliceZoneComponents({
|
|
26
|
+
* foo: Foo,
|
|
27
|
+
* bar: defineAsyncComponent(
|
|
28
|
+
* () => new Promise((res) => res(Bar)),
|
|
29
|
+
* ),
|
|
30
|
+
* baz: "Baz",
|
|
31
|
+
* }),
|
|
32
|
+
* }
|
|
33
|
+
* };
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
37
|
+
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
38
|
+
*
|
|
39
|
+
* @param components - {@link SliceZoneComponents}
|
|
40
|
+
*
|
|
41
|
+
* @returns A new optimized record of {@link SliceZoneComponents}
|
|
42
|
+
*/
|
|
43
|
+
export const defineSliceZoneComponents = <
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
+
TSlice extends SliceLike = any,
|
|
46
|
+
TContext = unknown,
|
|
47
|
+
>(
|
|
48
|
+
components: SliceZoneComponents<TSlice, TContext>,
|
|
49
|
+
): SliceZoneComponents<TSlice, TContext> => {
|
|
50
|
+
const result = {} as SliceZoneComponents<TSlice, TContext>
|
|
51
|
+
|
|
52
|
+
let type: keyof typeof components
|
|
53
|
+
for (type in components) {
|
|
54
|
+
const component = components[type]
|
|
55
|
+
result[type] =
|
|
56
|
+
typeof component === "string"
|
|
57
|
+
? component
|
|
58
|
+
: markRaw(
|
|
59
|
+
component as SliceComponentType<
|
|
60
|
+
Extract<TSlice, SliceLike<typeof type>>,
|
|
61
|
+
TContext
|
|
62
|
+
>,
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return result
|
|
67
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { PropType } from "vue"
|
|
2
|
+
|
|
3
|
+
import type { SliceComponentProps, SliceLike } from "./types"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Native Vue props for a component rendering content from a Prismic Slice using
|
|
7
|
+
* the `<SliceZone />` component.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam TSlice - The Slice type
|
|
10
|
+
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
11
|
+
* available to all Slice components
|
|
12
|
+
*/
|
|
13
|
+
type DefineComponentSliceComponentProps<
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
TSlice extends SliceLike = any,
|
|
16
|
+
TContext = unknown,
|
|
17
|
+
> = {
|
|
18
|
+
slice: {
|
|
19
|
+
type: PropType<SliceComponentProps<TSlice, TContext>["slice"]>
|
|
20
|
+
required: true
|
|
21
|
+
}
|
|
22
|
+
index: {
|
|
23
|
+
type: PropType<SliceComponentProps<TSlice, TContext>["index"]>
|
|
24
|
+
required: true
|
|
25
|
+
}
|
|
26
|
+
slices: {
|
|
27
|
+
type: PropType<SliceComponentProps<TSlice, TContext>["slices"]>
|
|
28
|
+
required: true
|
|
29
|
+
}
|
|
30
|
+
context: {
|
|
31
|
+
type: PropType<SliceComponentProps<TSlice, TContext>["context"]>
|
|
32
|
+
required: true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Gets native Vue props for a component rendering content from a Prismic Slice
|
|
38
|
+
* using the `<SliceZone />` component.
|
|
39
|
+
*
|
|
40
|
+
* Props are: `["slice", "index", "slices", "context"]`
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
*
|
|
44
|
+
* ```typescript
|
|
45
|
+
* // Defining a new slice component
|
|
46
|
+
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
47
|
+
*
|
|
48
|
+
* defineProps(getSliceComponentProps())
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
*
|
|
53
|
+
* ```typescript
|
|
54
|
+
* // Defining a new slice component with visual hint
|
|
55
|
+
* import { getSliceComponentProps } from "@prismicio/vue"
|
|
56
|
+
*
|
|
57
|
+
* defineProps(
|
|
58
|
+
* getSliceComponentProps(["slice", "index", "slices", "context"]),
|
|
59
|
+
* )
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @typeParam TSlice - The Slice type
|
|
63
|
+
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
64
|
+
* available to all Slice components
|
|
65
|
+
*
|
|
66
|
+
* @param propsHint - An optional array of prop names used for the sole purpose
|
|
67
|
+
* of having a visual hint of which props are made available to the slice,
|
|
68
|
+
* this parameters doesn't have any effect
|
|
69
|
+
*
|
|
70
|
+
* @returns Props object to use with `defineProps()`
|
|
71
|
+
*/
|
|
72
|
+
export const getSliceComponentProps = <
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
|
+
TSlice extends SliceLike = any,
|
|
75
|
+
TContext = unknown,
|
|
76
|
+
>(
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
78
|
+
propsHint?: ["slice", "index", "slices", "context"],
|
|
79
|
+
): DefineComponentSliceComponentProps<TSlice, TContext> => ({
|
|
80
|
+
slice: {
|
|
81
|
+
type: Object as PropType<SliceComponentProps<TSlice, TContext>["slice"]>,
|
|
82
|
+
required: true,
|
|
83
|
+
},
|
|
84
|
+
index: {
|
|
85
|
+
type: Number as PropType<SliceComponentProps<TSlice, TContext>["index"]>,
|
|
86
|
+
required: true,
|
|
87
|
+
},
|
|
88
|
+
slices: {
|
|
89
|
+
type: Array as PropType<SliceComponentProps<TSlice, TContext>["slices"]>,
|
|
90
|
+
required: true,
|
|
91
|
+
},
|
|
92
|
+
context: {
|
|
93
|
+
type: null as unknown as PropType<
|
|
94
|
+
SliceComponentProps<TSlice, TContext>["context"]
|
|
95
|
+
>,
|
|
96
|
+
required: true,
|
|
97
|
+
},
|
|
98
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { TODOSliceComponent } from "./TODOSliceComponent"
|
|
2
|
+
export { getSliceComponentProps } from "./getSliceComponentProps"
|
|
3
|
+
export { defineSliceZoneComponents } from "./defineSliceZoneComponents"
|
|
4
|
+
|
|
5
|
+
export type {
|
|
6
|
+
SliceComponentProps,
|
|
7
|
+
SliceComponentType,
|
|
8
|
+
SliceLike,
|
|
9
|
+
SliceLikeGraphQL,
|
|
10
|
+
SliceLikeRestV2,
|
|
11
|
+
SliceZoneComponents,
|
|
12
|
+
SliceZoneLike,
|
|
13
|
+
} from "./types"
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type { Slice } from "@prismicio/client"
|
|
2
|
+
import type {
|
|
3
|
+
DefineComponent,
|
|
4
|
+
FunctionalComponent,
|
|
5
|
+
defineAsyncComponent,
|
|
6
|
+
} from "vue"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Returns the type of a `SliceLike` type.
|
|
10
|
+
*
|
|
11
|
+
* @typeParam TSlice - The Slice from which the type will be extracted.
|
|
12
|
+
*/
|
|
13
|
+
type ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2
|
|
14
|
+
? TSlice["slice_type"]
|
|
15
|
+
: TSlice extends SliceLikeGraphQL
|
|
16
|
+
? TSlice["type"]
|
|
17
|
+
: never
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The minimum required properties to represent a Prismic Slice from the Prismic
|
|
21
|
+
* Rest API V2 for the `unstable_mapSliceZone()` helper.
|
|
22
|
+
*
|
|
23
|
+
* @typeParam SliceType - Type name of the Slice.
|
|
24
|
+
*/
|
|
25
|
+
export type SliceLikeRestV2<TSliceType extends string = string> = Pick<
|
|
26
|
+
Slice<TSliceType>,
|
|
27
|
+
"id" | "slice_type"
|
|
28
|
+
>
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The minimum required properties to represent a Prismic Slice from the Prismic
|
|
32
|
+
* GraphQL API for the `unstable_mapSliceZone()` helper.
|
|
33
|
+
*
|
|
34
|
+
* @typeParam SliceType - Type name of the Slice.
|
|
35
|
+
*/
|
|
36
|
+
export type SliceLikeGraphQL<TSliceType extends string = string> = {
|
|
37
|
+
type: Slice<TSliceType>["slice_type"]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The minimum required properties to represent a Prismic Slice for the
|
|
42
|
+
* `<SliceZone />` component.
|
|
43
|
+
*
|
|
44
|
+
* If using Prismic's Rest API V2, use the `Slice` export from
|
|
45
|
+
* `@prismicio/client` for a full interface.
|
|
46
|
+
*
|
|
47
|
+
* @typeParam TSliceType - Type name of the Slice
|
|
48
|
+
*/
|
|
49
|
+
export type SliceLike<TSliceType extends string = string> = (
|
|
50
|
+
| SliceLikeRestV2<TSliceType>
|
|
51
|
+
| SliceLikeGraphQL<TSliceType>
|
|
52
|
+
) & {
|
|
53
|
+
/**
|
|
54
|
+
* If `true`, this Slice has been modified from its original value using a
|
|
55
|
+
* mapper and `@prismicio/client`'s `mapSliceZone()`.
|
|
56
|
+
*
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
__mapped?: true
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* A looser version of the `SliceZone` type from `@prismicio/client` using
|
|
64
|
+
* `SliceLike`.
|
|
65
|
+
*
|
|
66
|
+
* If using Prismic's REST API, use the `SliceZone` export from
|
|
67
|
+
* `@prismicio/client` for the full type.
|
|
68
|
+
*
|
|
69
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
70
|
+
*/
|
|
71
|
+
export type SliceZoneLike<TSlice extends SliceLike = SliceLike> =
|
|
72
|
+
readonly TSlice[]
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Vue props for a component rendering content from a Prismic Slice using the
|
|
76
|
+
* `<SliceZone />` component.
|
|
77
|
+
*
|
|
78
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
79
|
+
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
80
|
+
* available to all Slice components
|
|
81
|
+
*/
|
|
82
|
+
export type SliceComponentProps<
|
|
83
|
+
TSlice extends SliceLike = SliceLike,
|
|
84
|
+
TContext = unknown,
|
|
85
|
+
> = {
|
|
86
|
+
/**
|
|
87
|
+
* Slice data for this component.
|
|
88
|
+
*/
|
|
89
|
+
slice: TSlice
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The index of the Slice in the Slice Zone.
|
|
93
|
+
*/
|
|
94
|
+
index: number
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* All Slices from the Slice Zone to which the Slice belongs.
|
|
98
|
+
*/
|
|
99
|
+
// TODO: We have to keep this list of Slices general due to circular
|
|
100
|
+
// reference limtiations. If we had another generic to determine the full
|
|
101
|
+
// union of Slice types, it would include TSlice. This causes TypeScript to
|
|
102
|
+
// throw a compilation error.
|
|
103
|
+
slices: SliceZoneLike<
|
|
104
|
+
TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2
|
|
105
|
+
>
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Arbitrary data passed to `<SliceZone />` and made available to all Slice
|
|
109
|
+
* components.
|
|
110
|
+
*/
|
|
111
|
+
context: TContext
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* A Vue component to be rendered for each instance of its Slice.
|
|
116
|
+
*
|
|
117
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
118
|
+
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
119
|
+
*/
|
|
120
|
+
export type SliceComponentType<
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
122
|
+
TSlice extends SliceLike = any,
|
|
123
|
+
TContext = unknown,
|
|
124
|
+
> =
|
|
125
|
+
// For reference within TypeScript files when `*.vue` type cannot be inferred
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-explicit-any
|
|
127
|
+
| DefineComponent<{}, {}, any>
|
|
128
|
+
// Likewise, for reference with TypeScript files.
|
|
129
|
+
| ReturnType<typeof defineAsyncComponent>
|
|
130
|
+
| DefineComponent<SliceComponentProps<TSlice, TContext>>
|
|
131
|
+
| FunctionalComponent
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* A record of Slice types mapped to Vue components. Each components will be
|
|
135
|
+
* rendered for each instance of their Slice type.
|
|
136
|
+
*
|
|
137
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
138
|
+
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
139
|
+
*/
|
|
140
|
+
export type SliceZoneComponents<
|
|
141
|
+
TSlice extends SliceLike = SliceLike,
|
|
142
|
+
TContext = unknown,
|
|
143
|
+
> =
|
|
144
|
+
// This is purposely not wrapped in Partial to ensure a component is provided
|
|
145
|
+
// for all Slice types. <SliceZone /> will render a default component if one is
|
|
146
|
+
// not provided, but it *should* be a type error if an explicit component is
|
|
147
|
+
// missing.
|
|
148
|
+
//
|
|
149
|
+
// If a developer purposely does not want to provide a component, they can
|
|
150
|
+
// assign it to the TODOSliceComponent exported from this package. This
|
|
151
|
+
// signals to future developers that it is a placeholder and should be
|
|
152
|
+
// implemented.
|
|
153
|
+
{
|
|
154
|
+
[SliceType in ExtractSliceType<TSlice>]:
|
|
155
|
+
| SliceComponentType<
|
|
156
|
+
Extract<TSlice, SliceLike<SliceType>> extends never
|
|
157
|
+
? SliceLike
|
|
158
|
+
: Extract<TSlice, SliceLike<SliceType>>,
|
|
159
|
+
TContext
|
|
160
|
+
>
|
|
161
|
+
// Global components
|
|
162
|
+
| string
|
|
163
|
+
}
|
package/src/createPrismic.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
Client,
|
|
3
|
-
FetchLike,
|
|
4
3
|
HTMLRichTextFunctionSerializer,
|
|
5
4
|
HTMLRichTextMapSerializer,
|
|
6
5
|
LinkResolverFunction,
|
|
@@ -29,15 +28,14 @@ import type {
|
|
|
29
28
|
PrismicPluginOptions,
|
|
30
29
|
} from "./types"
|
|
31
30
|
|
|
32
|
-
import
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} from "./
|
|
40
|
-
import { prismicKey } from "./injectionSymbols"
|
|
31
|
+
import PrismicRichText from "./PrismicRichText/PrismicRichText.vue"
|
|
32
|
+
import SliceZone from "./SliceZone/SliceZone.vue"
|
|
33
|
+
|
|
34
|
+
import PrismicEmbed from "./PrismicEmbed.vue"
|
|
35
|
+
import PrismicImage from "./PrismicImage.vue"
|
|
36
|
+
import PrismicLink from "./PrismicLink.vue"
|
|
37
|
+
import PrismicText from "./PrismicText.vue"
|
|
38
|
+
import { prismicKey } from "./usePrismic"
|
|
41
39
|
|
|
42
40
|
/**
|
|
43
41
|
* Creates a `@prismicio/vue` plugin instance that can be used by a Vue app.
|
|
@@ -55,19 +53,7 @@ export const createPrismic = (options: PrismicPluginOptions): PrismicPlugin => {
|
|
|
55
53
|
if (options.client) {
|
|
56
54
|
client = options.client
|
|
57
55
|
} else {
|
|
58
|
-
client = createClient(options.endpoint,
|
|
59
|
-
fetch: async (endpoint, options) => {
|
|
60
|
-
let fetchFunction: FetchLike
|
|
61
|
-
if (typeof globalThis.fetch === "function") {
|
|
62
|
-
fetchFunction = globalThis.fetch
|
|
63
|
-
} else {
|
|
64
|
-
fetchFunction = (await import("isomorphic-unfetch")).default
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return await fetchFunction(endpoint, options)
|
|
68
|
-
},
|
|
69
|
-
...options.clientConfig,
|
|
70
|
-
})
|
|
56
|
+
client = createClient(options.endpoint, options.clientConfig)
|
|
71
57
|
}
|
|
72
58
|
|
|
73
59
|
const prismicClient: PrismicPluginClient = {
|
|
@@ -91,13 +77,11 @@ export const createPrismic = (options: PrismicPluginOptions): PrismicPlugin => {
|
|
|
91
77
|
serializer:
|
|
92
78
|
(maybeHTMLSerializer as
|
|
93
79
|
| HTMLRichTextFunctionSerializer
|
|
94
|
-
| HTMLRichTextMapSerializer) ||
|
|
95
|
-
options.richTextSerializer ||
|
|
96
|
-
options.htmlSerializer,
|
|
80
|
+
| HTMLRichTextMapSerializer) || options.richTextSerializer,
|
|
97
81
|
}
|
|
98
82
|
: {
|
|
99
83
|
linkResolver: options.linkResolver,
|
|
100
|
-
serializer: options.richTextSerializer
|
|
84
|
+
serializer: options.richTextSerializer,
|
|
101
85
|
...configOrLinkResolver,
|
|
102
86
|
},
|
|
103
87
|
)
|
|
@@ -143,15 +127,26 @@ export const createPrismic = (options: PrismicPluginOptions): PrismicPlugin => {
|
|
|
143
127
|
app.config.globalProperties.$prismic = this
|
|
144
128
|
|
|
145
129
|
if (options.injectComponents !== false) {
|
|
146
|
-
app.component(PrismicLink.name
|
|
147
|
-
app.component(PrismicEmbed.name
|
|
148
|
-
app.component(PrismicImage.name
|
|
149
|
-
app.component(PrismicText.name
|
|
150
|
-
app.component(PrismicRichText.name
|
|
151
|
-
app.component(SliceZone.name
|
|
130
|
+
app.component(PrismicLink.name!, PrismicLink)
|
|
131
|
+
app.component(PrismicEmbed.name!, PrismicEmbed)
|
|
132
|
+
app.component(PrismicImage.name!, PrismicImage)
|
|
133
|
+
app.component(PrismicText.name!, PrismicText)
|
|
134
|
+
app.component(PrismicRichText.name!, PrismicRichText)
|
|
135
|
+
app.component(SliceZone.name!, SliceZone)
|
|
152
136
|
}
|
|
153
137
|
},
|
|
154
138
|
}
|
|
155
139
|
|
|
156
140
|
return prismic
|
|
157
141
|
}
|
|
142
|
+
|
|
143
|
+
declare module "vue" {
|
|
144
|
+
export interface ComponentCustomProperties {
|
|
145
|
+
/**
|
|
146
|
+
* `@prismicio/vue` plugin interface exposed on `this`.
|
|
147
|
+
*
|
|
148
|
+
* @see `@prismicio/vue` plugin interface {@link PrismicPlugin}
|
|
149
|
+
*/
|
|
150
|
+
$prismic: PrismicPlugin
|
|
151
|
+
}
|
|
152
|
+
}
|