@prismicio/vue 4.3.0 → 5.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +278 -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 +7 -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 +40 -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 +34 -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/lib/isInternalURL.cjs.map +1 -1
- package/dist/lib/isInternalURL.js.map +1 -1
- 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 +42 -58
- package/dist/usePrismic.cjs +3 -2
- package/dist/usePrismic.cjs.map +1 -1
- package/dist/usePrismic.d.ts +13 -5
- package/dist/usePrismic.js +2 -1
- package/dist/usePrismic.js.map +1 -1
- package/package.json +32 -35
- 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 +54 -53
- package/src/index.ts +33 -58
- package/src/lib/Wrapper.vue +22 -0
- package/src/lib/devMsg.ts +20 -0
- package/src/lib/isInternalURL.ts +4 -4
- package/src/types.ts +91 -109
- package/src/usePrismic.ts +16 -9
- 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 -163
- 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 -196
- 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 -375
- 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 -330
- 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 -19
- package/dist/lib/getSlots.cjs.map +0 -1
- package/dist/lib/getSlots.d.ts +0 -14
- package/dist/lib/getSlots.js +0 -19
- 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 -64
- package/dist/useStatefulPrismicClientMethod.js +0 -39
- package/dist/useStatefulPrismicClientMethod.js.map +0 -1
- package/src/components/PrismicEmbed.ts +0 -91
- package/src/components/PrismicImage.ts +0 -309
- package/src/components/PrismicLink.ts +0 -326
- package/src/components/PrismicRichText.ts +0 -282
- package/src/components/PrismicText.ts +0 -167
- package/src/components/SliceZone.ts +0 -619
- package/src/components/index.ts +0 -46
- package/src/composables.ts +0 -474
- 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 -37
- package/src/lib/simplyResolveComponent.ts +0 -23
- package/src/useStatefulPrismicClientMethod.ts +0 -156
- package/vetur/attributes.json +0 -113
- package/vetur/tags.json +0 -60
package/src/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
AsLinkAttrsConfig,
|
|
2
3
|
ClientConfig,
|
|
3
4
|
CreateClient,
|
|
4
5
|
HTMLRichTextFunctionSerializer,
|
|
@@ -16,20 +17,20 @@ import type {
|
|
|
16
17
|
documentToLinkField,
|
|
17
18
|
filter,
|
|
18
19
|
isFilled,
|
|
19
|
-
} from "@prismicio/client"
|
|
20
|
-
import type { App, ConcreteComponent, DefineComponent, Raw, Ref } from "vue"
|
|
20
|
+
} from "@prismicio/client"
|
|
21
|
+
import type { App, ConcreteComponent, DefineComponent, Raw, Ref } from "vue"
|
|
21
22
|
|
|
22
23
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
23
24
|
// Imports for @link references:
|
|
24
|
-
import type { RouterLink } from "vue-router"
|
|
25
|
+
import type { RouterLink } from "vue-router"
|
|
26
|
+
|
|
27
|
+
import type { VueRichTextSerializer } from "./PrismicRichText/types"
|
|
25
28
|
|
|
26
29
|
import type {
|
|
27
30
|
SliceComponentProps,
|
|
28
31
|
SliceComponentType,
|
|
29
32
|
TODOSliceComponent,
|
|
30
|
-
} from "./
|
|
31
|
-
|
|
32
|
-
import type { usePrismicDocuments } from "./composables";
|
|
33
|
+
} from "./SliceZone"
|
|
33
34
|
|
|
34
35
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
35
36
|
|
|
@@ -38,16 +39,16 @@ import type { usePrismicDocuments } from "./composables";
|
|
|
38
39
|
*/
|
|
39
40
|
type PrismicPluginComponentsOptions = {
|
|
40
41
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
42
|
+
* The `rel` attribute for the link. By default, `"noreferrer"` is provided if
|
|
43
|
+
* the link's URL is external. This prop can be provided a function to use the
|
|
44
|
+
* link's metadata to determine the `rel` value.
|
|
43
45
|
*
|
|
44
|
-
* @defaultValue `"
|
|
46
|
+
* @defaultValue `"noreferrer"`
|
|
45
47
|
*/
|
|
46
|
-
|
|
48
|
+
linkRel?: AsLinkAttrsConfig["rel"]
|
|
47
49
|
|
|
48
50
|
/**
|
|
49
|
-
* An HTML tag name
|
|
50
|
-
* internal links.
|
|
51
|
+
* An HTML tag name or a component used to render internal links.
|
|
51
52
|
*
|
|
52
53
|
* @remarks
|
|
53
54
|
* HTML tag names will be rendered using the anchor tag interface (`href`,
|
|
@@ -55,13 +56,13 @@ type PrismicPluginComponentsOptions = {
|
|
|
55
56
|
* @remarks
|
|
56
57
|
* Components will be rendered using Vue Router {@link RouterLink} interface
|
|
57
58
|
* (`to` props).
|
|
59
|
+
*
|
|
58
60
|
* @defaultValue {@link RouterLink}
|
|
59
61
|
*/
|
|
60
|
-
linkInternalComponent?:
|
|
62
|
+
linkInternalComponent?: ComponentOrTagName
|
|
61
63
|
|
|
62
64
|
/**
|
|
63
|
-
* An HTML tag name
|
|
64
|
-
* external links.
|
|
65
|
+
* An HTML tag name or a component used to render external links.
|
|
65
66
|
*
|
|
66
67
|
* @remarks
|
|
67
68
|
* HTML tag names will be rendered using the anchor tag interface (`href`,
|
|
@@ -69,21 +70,10 @@ type PrismicPluginComponentsOptions = {
|
|
|
69
70
|
* @remarks
|
|
70
71
|
* Components will be rendered using Vue Router {@link RouterLink} interface
|
|
71
72
|
* (`to` props).
|
|
72
|
-
* @defaultValue `"a"`
|
|
73
|
-
*/
|
|
74
|
-
linkExternalComponent?: string | ConcreteComponent | Raw<DefineComponent>;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* An HTML tag name, a component, or a functional component used to render
|
|
78
|
-
* images.
|
|
79
73
|
*
|
|
80
|
-
* @
|
|
81
|
-
* HTML tag names and components will be rendered using the `img` tag
|
|
82
|
-
* interface (`src` and `alt` attribute). Components will also receive an
|
|
83
|
-
* additional `copyright` props.
|
|
84
|
-
* @defaultValue `"img"`
|
|
74
|
+
* @defaultValue `"a"`
|
|
85
75
|
*/
|
|
86
|
-
|
|
76
|
+
linkExternalComponent?: ComponentOrTagName
|
|
87
77
|
|
|
88
78
|
/**
|
|
89
79
|
* Default widths to use when rendering an image with `widths="defaults"`
|
|
@@ -92,9 +82,10 @@ type PrismicPluginComponentsOptions = {
|
|
|
92
82
|
* Consider configuring image widths within your content type definition and
|
|
93
83
|
* using `widths="auto"` instead to give content writers the ability to crop
|
|
94
84
|
* images in the editor.
|
|
85
|
+
*
|
|
95
86
|
* @defaultValue `@prismicio/client` defaults
|
|
96
87
|
*/
|
|
97
|
-
imageWidthSrcSetDefaults?: number[]
|
|
88
|
+
imageWidthSrcSetDefaults?: number[]
|
|
98
89
|
|
|
99
90
|
/**
|
|
100
91
|
* Default pixel densities to use when rendering an image with
|
|
@@ -102,7 +93,15 @@ type PrismicPluginComponentsOptions = {
|
|
|
102
93
|
*
|
|
103
94
|
* @defaultValue `@prismicio/client` defaults
|
|
104
95
|
*/
|
|
105
|
-
imagePixelDensitySrcSetDefaults?: number[]
|
|
96
|
+
imagePixelDensitySrcSetDefaults?: number[]
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* An optional map of Rich Text block types to Vue Components. It is used to
|
|
100
|
+
* render Rich Text or title fields.
|
|
101
|
+
*
|
|
102
|
+
* @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/rich-text}
|
|
103
|
+
*/
|
|
104
|
+
richTextComponents?: VueRichTextSerializer
|
|
106
105
|
|
|
107
106
|
/**
|
|
108
107
|
* A component or a functional component rendered if a component mapping from
|
|
@@ -113,8 +112,8 @@ type PrismicPluginComponentsOptions = {
|
|
|
113
112
|
*
|
|
114
113
|
* @defaultValue `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}
|
|
115
114
|
*/
|
|
116
|
-
sliceZoneDefaultComponent?: SliceComponentType
|
|
117
|
-
}
|
|
115
|
+
sliceZoneDefaultComponent?: SliceComponentType
|
|
116
|
+
}
|
|
118
117
|
|
|
119
118
|
/**
|
|
120
119
|
* Common options supported by `@prismicio/vue` plugin.
|
|
@@ -127,43 +126,36 @@ type PrismicPluginOptionsBase = {
|
|
|
127
126
|
*
|
|
128
127
|
* @see Link resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#link-resolver}
|
|
129
128
|
*/
|
|
130
|
-
linkResolver?: LinkResolverFunction
|
|
129
|
+
linkResolver?: LinkResolverFunction
|
|
131
130
|
|
|
132
131
|
/**
|
|
133
132
|
* An optional HTML serializer to customize the way rich text fields are
|
|
134
133
|
* rendered.
|
|
135
134
|
*
|
|
135
|
+
* @remarks
|
|
136
|
+
* To provide global components for the `<PrismicRichText />` component, use
|
|
137
|
+
* the `components.richTextComponents` option instead.
|
|
138
|
+
*
|
|
136
139
|
* @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
|
|
137
140
|
*/
|
|
138
141
|
richTextSerializer?:
|
|
139
142
|
| HTMLRichTextFunctionSerializer
|
|
140
|
-
| HTMLRichTextMapSerializer
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* An optional HTML serializer to customize the way rich text fields are
|
|
144
|
-
* rendered.
|
|
145
|
-
*
|
|
146
|
-
* @deprecated Use `richTextSerializer` instead.
|
|
147
|
-
*
|
|
148
|
-
* @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
|
|
149
|
-
*/
|
|
150
|
-
// TODO: Remove in v5
|
|
151
|
-
htmlSerializer?: HTMLRichTextFunctionSerializer | HTMLRichTextMapSerializer;
|
|
143
|
+
| HTMLRichTextMapSerializer
|
|
152
144
|
|
|
153
145
|
/**
|
|
154
146
|
* Whether or not to inject components globally.
|
|
155
147
|
*
|
|
156
148
|
* @defaultValue `true`
|
|
157
149
|
*/
|
|
158
|
-
injectComponents?: boolean
|
|
150
|
+
injectComponents?: boolean
|
|
159
151
|
|
|
160
152
|
/**
|
|
161
153
|
* Options used by Prismic Vue components.
|
|
162
154
|
*
|
|
163
155
|
* @see Components options {@link PrismicPluginComponentsOptions}
|
|
164
156
|
*/
|
|
165
|
-
components?: PrismicPluginComponentsOptions
|
|
166
|
-
}
|
|
157
|
+
components?: PrismicPluginComponentsOptions
|
|
158
|
+
}
|
|
167
159
|
|
|
168
160
|
/**
|
|
169
161
|
* Options to init `@prismicio/vue` plugin with a client instance.
|
|
@@ -179,24 +171,25 @@ type PrismicPluginOptionsWithClient = PrismicPluginOptionsBase & {
|
|
|
179
171
|
* The client will be used by `@prismicio/vue` composables, such as
|
|
180
172
|
* {@link usePrismicDocuments} and exposed through `this.$prismic.client` and
|
|
181
173
|
* `usePrismic().client`.
|
|
174
|
+
*
|
|
182
175
|
* @see Prismic client documentation {@link https://prismic.io/docs/technologies/javascript}
|
|
183
176
|
*/
|
|
184
|
-
client: ReturnType<CreateClient
|
|
177
|
+
client: ReturnType<CreateClient>
|
|
185
178
|
|
|
186
179
|
/**
|
|
187
180
|
* Ensures type union is a strict or.
|
|
188
181
|
*
|
|
189
182
|
* @internal
|
|
190
183
|
*/
|
|
191
|
-
endpoint?: never
|
|
184
|
+
endpoint?: never
|
|
192
185
|
|
|
193
186
|
/**
|
|
194
187
|
* Ensures type union is a strict or.
|
|
195
188
|
*
|
|
196
189
|
* @internal
|
|
197
190
|
*/
|
|
198
|
-
clientConfig?: never
|
|
199
|
-
}
|
|
191
|
+
clientConfig?: never
|
|
192
|
+
}
|
|
200
193
|
|
|
201
194
|
/**
|
|
202
195
|
* Options to init `@prismicio/vue` plugin with a repository ID or API endpoint.
|
|
@@ -212,19 +205,20 @@ type PrismicPluginOptionsWithEndpoint = PrismicPluginOptionsBase & {
|
|
|
212
205
|
* Said client will be used by `@prismicio/vue` composables, such as
|
|
213
206
|
* {@link usePrismicDocuments} and exposed through `this.$prismic.client` and
|
|
214
207
|
* `usePrismic().client`.
|
|
208
|
+
*
|
|
215
209
|
* @example
|
|
216
210
|
*
|
|
217
211
|
* ```javascript
|
|
218
212
|
* // A repository ID
|
|
219
|
-
* "my-repo"
|
|
213
|
+
* "my-repo"
|
|
220
214
|
*
|
|
221
215
|
* //A full repository endpoint
|
|
222
|
-
* "https://my-repo.cdn.prismic.io/api/v2"
|
|
216
|
+
* "https://my-repo.cdn.prismic.io/api/v2"
|
|
223
217
|
* ```
|
|
224
218
|
*
|
|
225
219
|
* @see Prismic client documentation {@link https://prismic.io/docs/technologies/javascript}
|
|
226
220
|
*/
|
|
227
|
-
endpoint: string
|
|
221
|
+
endpoint: string
|
|
228
222
|
|
|
229
223
|
/**
|
|
230
224
|
* An optional object to configure `@prismicio/client` instance further.
|
|
@@ -261,15 +255,15 @@ type PrismicPluginOptionsWithEndpoint = PrismicPluginOptionsBase & {
|
|
|
261
255
|
* @see Prismic client documentation {@link https://prismic.io/docs/technologies/javascript}
|
|
262
256
|
* @see Route resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
|
|
263
257
|
*/
|
|
264
|
-
clientConfig?: ClientConfig
|
|
258
|
+
clientConfig?: ClientConfig
|
|
265
259
|
|
|
266
260
|
/**
|
|
267
261
|
* Ensures type union is a strict or.
|
|
268
262
|
*
|
|
269
263
|
* @internal
|
|
270
264
|
*/
|
|
271
|
-
client?: never
|
|
272
|
-
}
|
|
265
|
+
client?: never
|
|
266
|
+
}
|
|
273
267
|
|
|
274
268
|
/**
|
|
275
269
|
* `@prismicio/vue` plugin options.
|
|
@@ -279,7 +273,7 @@ type PrismicPluginOptionsWithEndpoint = PrismicPluginOptionsBase & {
|
|
|
279
273
|
*/
|
|
280
274
|
export type PrismicPluginOptions =
|
|
281
275
|
| PrismicPluginOptionsWithClient
|
|
282
|
-
| PrismicPluginOptionsWithEndpoint
|
|
276
|
+
| PrismicPluginOptionsWithEndpoint
|
|
283
277
|
|
|
284
278
|
/**
|
|
285
279
|
* `@prismicio/client` related methods and properties exposed by
|
|
@@ -290,18 +284,18 @@ export type PrismicPluginClient = {
|
|
|
290
284
|
/**
|
|
291
285
|
* A `@prismicio/client` instance.
|
|
292
286
|
*/
|
|
293
|
-
client: ReturnType<CreateClient
|
|
287
|
+
client: ReturnType<CreateClient>
|
|
294
288
|
|
|
295
289
|
/**
|
|
296
290
|
* Query filters from `@prismicio/client`.
|
|
297
291
|
*/
|
|
298
|
-
filter: typeof filter
|
|
292
|
+
filter: typeof filter
|
|
299
293
|
|
|
300
294
|
/**
|
|
301
295
|
* Prismic cookies from `@prismicio/client`.
|
|
302
296
|
*/
|
|
303
|
-
cookie: typeof cookie
|
|
304
|
-
}
|
|
297
|
+
cookie: typeof cookie
|
|
298
|
+
}
|
|
305
299
|
|
|
306
300
|
/**
|
|
307
301
|
* `@prismicio/client` related methods exposed by `@prismicio/vue` plugin and
|
|
@@ -314,7 +308,7 @@ export type PrismicPluginHelpers = {
|
|
|
314
308
|
*
|
|
315
309
|
* @see Templating rich text and title fields {@link https://prismic.io/docs/technologies/vue-template-content#rich-text-and-titles}
|
|
316
310
|
*/
|
|
317
|
-
asText: typeof asText
|
|
311
|
+
asText: typeof asText
|
|
318
312
|
|
|
319
313
|
/**
|
|
320
314
|
* Serializes a rich text or title field to an HTML string. This is
|
|
@@ -326,9 +320,10 @@ export type PrismicPluginHelpers = {
|
|
|
326
320
|
* @remarks
|
|
327
321
|
* If no `htmlSerializer` is provided the function will use the one provided
|
|
328
322
|
* to the plugin at {@link PrismicPluginOptions.htmlSerializer} if available.
|
|
323
|
+
*
|
|
329
324
|
* @see Templating rich text and title fields {@link https://prismic.io/docs/technologies/vue-template-content#rich-text-and-titles}
|
|
330
325
|
*/
|
|
331
|
-
asHTML: typeof asHTML
|
|
326
|
+
asHTML: typeof asHTML
|
|
332
327
|
|
|
333
328
|
/**
|
|
334
329
|
* Resolves any type of link field or document to a URL. This is
|
|
@@ -337,9 +332,10 @@ export type PrismicPluginHelpers = {
|
|
|
337
332
|
* @remarks
|
|
338
333
|
* If no `linkResolver` is provided the function will use the one provided to
|
|
339
334
|
* the plugin at {@link PrismicPluginOptions.linkResolver} if available.
|
|
335
|
+
*
|
|
340
336
|
* @see Templating link fields {@link https://prismic.io/docs/technologies/vue-template-content#links-and-content-relationships}
|
|
341
337
|
*/
|
|
342
|
-
asLink: typeof asLink
|
|
338
|
+
asLink: typeof asLink
|
|
343
339
|
|
|
344
340
|
/**
|
|
345
341
|
* Resolves any type of link field or document to a set of link attributes.
|
|
@@ -348,42 +344,43 @@ export type PrismicPluginHelpers = {
|
|
|
348
344
|
* @remarks
|
|
349
345
|
* If no `linkResolver` is provided the function will use the one provided to
|
|
350
346
|
* the plugin at {@link PrismicPluginOptions.linkResolver} if available.
|
|
347
|
+
*
|
|
351
348
|
* @see Templating link fields {@link https://prismic.io/docs/technologies/vue-template-content#links-and-content-relationships}
|
|
352
349
|
*/
|
|
353
|
-
asLinkAttrs: typeof asLinkAttrs
|
|
350
|
+
asLinkAttrs: typeof asLinkAttrs
|
|
354
351
|
|
|
355
352
|
/**
|
|
356
353
|
* Transforms a date or timestamp field into a JavaScript Date object. This is
|
|
357
354
|
* `@prismicio/client` {@link asDate} function.
|
|
358
355
|
*/
|
|
359
|
-
asDate: typeof asDate
|
|
356
|
+
asDate: typeof asDate
|
|
360
357
|
|
|
361
358
|
/**
|
|
362
|
-
* Returns the URL of an
|
|
359
|
+
* Returns the URL of an image field with optional image transformations (via
|
|
363
360
|
* Imgix URL parameters). This is `@prismicio/client` {@link asImageSrc}
|
|
364
361
|
* function.
|
|
365
362
|
*/
|
|
366
|
-
asImageSrc: typeof asImageSrc
|
|
363
|
+
asImageSrc: typeof asImageSrc
|
|
367
364
|
|
|
368
365
|
/**
|
|
369
|
-
* Creates a width-based `srcset` from an
|
|
366
|
+
* Creates a width-based `srcset` from an image field with optional image
|
|
370
367
|
* transformations (via Imgix URL parameters). This is `@prismicio/client`
|
|
371
368
|
* {@link asImageWidthSrcSet} function.
|
|
372
369
|
*/
|
|
373
|
-
asImageWidthSrcSet: typeof asImageWidthSrcSet
|
|
370
|
+
asImageWidthSrcSet: typeof asImageWidthSrcSet
|
|
374
371
|
|
|
375
372
|
/**
|
|
376
|
-
* Creates a pixel-density-based `srcset` from an
|
|
373
|
+
* Creates a pixel-density-based `srcset` from an image field with optional
|
|
377
374
|
* image transformations (via Imgix URL parameters). This is
|
|
378
375
|
* `@prismicio/client` {@link asImagePixelDensitySrcSet} function.
|
|
379
376
|
*/
|
|
380
|
-
asImagePixelDensitySrcSet: typeof asImagePixelDensitySrcSet
|
|
377
|
+
asImagePixelDensitySrcSet: typeof asImagePixelDensitySrcSet
|
|
381
378
|
|
|
382
379
|
/**
|
|
383
380
|
* Helpers to determine if a field is filled. This is `@prismicio/client`
|
|
384
381
|
* {@link isFilled} object.
|
|
385
382
|
*/
|
|
386
|
-
isFilled: typeof isFilled
|
|
383
|
+
isFilled: typeof isFilled
|
|
387
384
|
|
|
388
385
|
/**
|
|
389
386
|
* Converts a document into a link field. This is `@prismicio/client`
|
|
@@ -391,8 +388,8 @@ export type PrismicPluginHelpers = {
|
|
|
391
388
|
*
|
|
392
389
|
* @internal
|
|
393
390
|
*/
|
|
394
|
-
documentToLinkField: typeof documentToLinkField
|
|
395
|
-
}
|
|
391
|
+
documentToLinkField: typeof documentToLinkField
|
|
392
|
+
}
|
|
396
393
|
|
|
397
394
|
/**
|
|
398
395
|
* Methods and properties exposed by `@prismicio/vue` plugin and accessible
|
|
@@ -404,41 +401,16 @@ export type PrismicPlugin = {
|
|
|
404
401
|
*
|
|
405
402
|
* @see `@prismicio/vue` plugin options {@link PrismicPluginOptions}
|
|
406
403
|
*/
|
|
407
|
-
readonly options: PrismicPluginOptions
|
|
404
|
+
readonly options: PrismicPluginOptions
|
|
408
405
|
|
|
409
406
|
/**
|
|
410
407
|
* `@prismicio/vue` plugin install function used by Vue.
|
|
411
408
|
*
|
|
412
409
|
* @internal
|
|
413
410
|
*/
|
|
414
|
-
install: (app: App) => void
|
|
411
|
+
install: (app: App) => void
|
|
415
412
|
} & PrismicPluginClient &
|
|
416
|
-
PrismicPluginHelpers
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* States of a `@prismicio/client` composable.
|
|
420
|
-
*/
|
|
421
|
-
export const enum PrismicClientComposableState {
|
|
422
|
-
/**
|
|
423
|
-
* The composable has not started fetching.
|
|
424
|
-
*/
|
|
425
|
-
Idle = "idle",
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* The composable is fetching data.
|
|
429
|
-
*/
|
|
430
|
-
Pending = "pending",
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* The composable sucessfully fetched data.
|
|
434
|
-
*/
|
|
435
|
-
Success = "success",
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* The composable failed to fetch data.
|
|
439
|
-
*/
|
|
440
|
-
Error = "error",
|
|
441
|
-
}
|
|
413
|
+
PrismicPluginHelpers
|
|
442
414
|
|
|
443
415
|
// Helpers
|
|
444
416
|
|
|
@@ -449,8 +421,8 @@ export const enum PrismicClientComposableState {
|
|
|
449
421
|
* @internal
|
|
450
422
|
*/
|
|
451
423
|
export type VueUseOptions<T> = {
|
|
452
|
-
[K in keyof T]: Ref<T[K]> | T[K]
|
|
453
|
-
}
|
|
424
|
+
[K in keyof T]: Ref<T[K]> | T[K]
|
|
425
|
+
}
|
|
454
426
|
|
|
455
427
|
/**
|
|
456
428
|
* Type to transform a static tuple into one that allows passing Refs as values.
|
|
@@ -458,5 +430,15 @@ export type VueUseOptions<T> = {
|
|
|
458
430
|
* @internal
|
|
459
431
|
*/
|
|
460
432
|
export type VueUseParameters<T> = {
|
|
461
|
-
[K in keyof T]: T extends number ? Ref<T[K]> | T[K] : T[K]
|
|
462
|
-
}
|
|
433
|
+
[K in keyof T]: T extends number ? Ref<T[K]> | T[K] : T[K]
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* A component or a tag name to be used as props.
|
|
438
|
+
*
|
|
439
|
+
* @internal
|
|
440
|
+
*/
|
|
441
|
+
export type ComponentOrTagName =
|
|
442
|
+
| string
|
|
443
|
+
| ConcreteComponent
|
|
444
|
+
| Raw<DefineComponent>
|
package/src/usePrismic.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { InjectionKey } from "vue"
|
|
2
|
+
import { inject } from "vue"
|
|
2
3
|
|
|
3
|
-
import { PrismicPlugin } from "./types"
|
|
4
|
+
import type { PrismicPlugin } from "./types"
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* `@prismicio/vue` plugin interface interface location used for
|
|
8
|
+
* {@link usePrismic}.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export const prismicKey = Symbol("prismic") as InjectionKey<PrismicPlugin>
|
|
6
13
|
|
|
7
14
|
/**
|
|
8
15
|
* Accesses `@prismicio/vue` plugin interface.
|
|
@@ -11,19 +18,19 @@ import { prismicKey } from "./injectionSymbols";
|
|
|
11
18
|
*
|
|
12
19
|
* ```javascript
|
|
13
20
|
* // With the composition API
|
|
14
|
-
* import { usePrismic } from "@prismicio/vue"
|
|
21
|
+
* import { usePrismic } from "@prismicio/vue"
|
|
15
22
|
*
|
|
16
23
|
* export default {
|
|
17
24
|
* setup() {
|
|
18
|
-
* const prismic = usePrismic()
|
|
25
|
+
* const prismic = usePrismic()
|
|
19
26
|
*
|
|
20
|
-
* return {}
|
|
27
|
+
* return {}
|
|
21
28
|
* },
|
|
22
|
-
* }
|
|
29
|
+
* }
|
|
23
30
|
* ```
|
|
24
31
|
*
|
|
25
32
|
* @returns The interface {@link PrismicPlugin}
|
|
26
33
|
*/
|
|
27
34
|
export const usePrismic = (): PrismicPlugin => {
|
|
28
|
-
return inject(prismicKey, { options: { endpoint: "" } } as PrismicPlugin)
|
|
29
|
-
}
|
|
35
|
+
return inject(prismicKey, { options: { endpoint: "" } } as PrismicPlugin)
|
|
36
|
+
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const vue = require("vue");
|
|
4
|
-
const simplyResolveComponent = require("../lib/simplyResolveComponent.cjs");
|
|
5
|
-
const defaultWrapper = "div";
|
|
6
|
-
const PrismicEmbedImpl = /* @__PURE__ */ vue.defineComponent({
|
|
7
|
-
name: "PrismicEmbed",
|
|
8
|
-
props: {
|
|
9
|
-
field: {
|
|
10
|
-
type: Object,
|
|
11
|
-
required: true
|
|
12
|
-
},
|
|
13
|
-
wrapper: {
|
|
14
|
-
type: [String, Object, Function],
|
|
15
|
-
default: void 0,
|
|
16
|
-
required: false
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
setup(props) {
|
|
20
|
-
if (!props.field) {
|
|
21
|
-
return () => null;
|
|
22
|
-
}
|
|
23
|
-
return () => {
|
|
24
|
-
return vue.h(simplyResolveComponent.simplyResolveComponent(props.wrapper || defaultWrapper), {
|
|
25
|
-
"data-oembed": props.field.embed_url,
|
|
26
|
-
"data-oembed-type": props.field.type,
|
|
27
|
-
"data-oembed-provider": props.field.provider_name,
|
|
28
|
-
innerHTML: props.field.html || null
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
const PrismicEmbed = PrismicEmbedImpl;
|
|
34
|
-
exports.PrismicEmbed = PrismicEmbed;
|
|
35
|
-
exports.PrismicEmbedImpl = PrismicEmbedImpl;
|
|
36
|
-
//# sourceMappingURL=PrismicEmbed.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicEmbed.cjs","sources":["../../../src/components/PrismicEmbed.ts"],"sourcesContent":["import { EmbedField } from \"@prismicio/client\";\nimport {\n\tAllowedComponentProps,\n\tComponentCustomProps,\n\tConcreteComponent,\n\tDefineComponent,\n\tPropType,\n\tRaw,\n\tVNodeProps,\n\tdefineComponent,\n\th,\n} from \"vue\";\n\nimport { simplyResolveComponent } from \"../lib/simplyResolveComponent\";\n\n/**\n * The default component rendered to wrap the embed.\n */\nconst defaultWrapper = \"div\";\n\n/**\n * Props for `<PrismicEmbed />`.\n */\nexport type PrismicEmbedProps = {\n\t/**\n\t * The Prismic embed field to render.\n\t */\n\tfield: EmbedField;\n\n\t/**\n\t * An HTML tag name, a component, or a functional component used to wrap the\n\t * output.\n\t *\n\t * @defaultValue `\"div\"`\n\t */\n\twrapper?: string | ConcreteComponent | Raw<DefineComponent>;\n};\n\n/**\n * `<PrismicEmbed />` implementation.\n *\n * @internal\n */\nexport const PrismicEmbedImpl = /*#__PURE__*/ defineComponent({\n\tname: \"PrismicEmbed\",\n\tprops: {\n\t\tfield: {\n\t\t\ttype: Object as PropType<EmbedField>,\n\t\t\trequired: true,\n\t\t},\n\t\twrapper: {\n\t\t\ttype: [String, Object, Function] as PropType<\n\t\t\t\tstring | ConcreteComponent | Raw<DefineComponent>\n\t\t\t>,\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.field) {\n\t\t\treturn () => null;\n\t\t}\n\n\t\treturn () => {\n\t\t\treturn h(simplyResolveComponent(props.wrapper || defaultWrapper), {\n\t\t\t\t\"data-oembed\": props.field.embed_url,\n\t\t\t\t\"data-oembed-type\": props.field.type,\n\t\t\t\t\"data-oembed-provider\": props.field.provider_name,\n\t\t\t\tinnerHTML: props.field.html || null,\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 embed field.\n *\n * @see Component props {@link PrismicEmbedProps}\n * @see Templating embed fields {@link https://prismic.io/docs/technologies/vue-template-content#embeds}\n */\nexport const PrismicEmbed = PrismicEmbedImpl as unknown as {\n\tnew (): {\n\t\t$props: AllowedComponentProps &\n\t\t\tComponentCustomProps &\n\t\t\tVNodeProps &\n\t\t\tPrismicEmbedProps;\n\t};\n};\n"],"names":["defineComponent","h","simplyResolveComponent"],"mappings":";;;;AAkBA,MAAM,iBAAiB;AAyBhB,MAAM,mBAAiDA,oBAAAA,gBAAA;AAAA,EAC7D,MAAM;AAAA,EACN,OAAO;AAAA,IACN,OAAO;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IACV;AAAA,IACD,SAAS;AAAA,MACR,MAAM,CAAC,QAAQ,QAAQ,QAAQ;AAAA,MAG/B,SAAS;AAAA,MACT,UAAU;AAAA,IACV;AAAA,EACD;AAAA,EACD,MAAM,OAAK;AAEN,QAAA,CAAC,MAAM,OAAO;AACjB,aAAO,MAAM;AAAA,IACd;AAEA,WAAO,MAAK;AACX,aAAOC,IAAE,EAAAC,uBAAA,uBAAuB,MAAM,WAAW,cAAc,GAAG;AAAA,QACjE,eAAe,MAAM,MAAM;AAAA,QAC3B,oBAAoB,MAAM,MAAM;AAAA,QAChC,wBAAwB,MAAM,MAAM;AAAA,QACpC,WAAW,MAAM,MAAM,QAAQ;AAAA,MAAA,CAC/B;AAAA,IAAA;AAAA,EAEH;AACA,CAAA;AAUM,MAAM,eAAe;;;"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { EmbedField } from "@prismicio/client";
|
|
2
|
-
import { AllowedComponentProps, ComponentCustomProps, ConcreteComponent, DefineComponent, PropType, Raw, VNodeProps } from "vue";
|
|
3
|
-
/**
|
|
4
|
-
* Props for `<PrismicEmbed />`.
|
|
5
|
-
*/
|
|
6
|
-
export type PrismicEmbedProps = {
|
|
7
|
-
/**
|
|
8
|
-
* The Prismic embed field to render.
|
|
9
|
-
*/
|
|
10
|
-
field: EmbedField;
|
|
11
|
-
/**
|
|
12
|
-
* An HTML tag name, a component, or a functional component used to wrap the
|
|
13
|
-
* output.
|
|
14
|
-
*
|
|
15
|
-
* @defaultValue `"div"`
|
|
16
|
-
*/
|
|
17
|
-
wrapper?: string | ConcreteComponent | Raw<DefineComponent>;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* `<PrismicEmbed />` implementation.
|
|
21
|
-
*
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
export declare const PrismicEmbedImpl: DefineComponent<{
|
|
25
|
-
field: {
|
|
26
|
-
type: PropType<EmbedField>;
|
|
27
|
-
required: true;
|
|
28
|
-
};
|
|
29
|
-
wrapper: {
|
|
30
|
-
type: PropType<string | ConcreteComponent | Raw<DefineComponent>>;
|
|
31
|
-
default: undefined;
|
|
32
|
-
required: false;
|
|
33
|
-
};
|
|
34
|
-
}, (() => null) | (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
35
|
-
[key: string]: any;
|
|
36
|
-
}>), unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
37
|
-
field: {
|
|
38
|
-
type: PropType<EmbedField>;
|
|
39
|
-
required: true;
|
|
40
|
-
};
|
|
41
|
-
wrapper: {
|
|
42
|
-
type: PropType<string | ConcreteComponent | Raw<DefineComponent>>;
|
|
43
|
-
default: undefined;
|
|
44
|
-
required: false;
|
|
45
|
-
};
|
|
46
|
-
}>>, {
|
|
47
|
-
wrapper: string | ConcreteComponent | Raw<DefineComponent>;
|
|
48
|
-
}, {}>;
|
|
49
|
-
/**
|
|
50
|
-
* Component to render a Prismic embed field.
|
|
51
|
-
*
|
|
52
|
-
* @see Component props {@link PrismicEmbedProps}
|
|
53
|
-
* @see Templating embed fields {@link https://prismic.io/docs/technologies/vue-template-content#embeds}
|
|
54
|
-
*/
|
|
55
|
-
export declare const PrismicEmbed: {
|
|
56
|
-
new (): {
|
|
57
|
-
$props: AllowedComponentProps & ComponentCustomProps & VNodeProps & PrismicEmbedProps;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h } from "vue";
|
|
2
|
-
import { simplyResolveComponent } from "../lib/simplyResolveComponent.js";
|
|
3
|
-
const defaultWrapper = "div";
|
|
4
|
-
const PrismicEmbedImpl = /* @__PURE__ */ defineComponent({
|
|
5
|
-
name: "PrismicEmbed",
|
|
6
|
-
props: {
|
|
7
|
-
field: {
|
|
8
|
-
type: Object,
|
|
9
|
-
required: true
|
|
10
|
-
},
|
|
11
|
-
wrapper: {
|
|
12
|
-
type: [String, Object, Function],
|
|
13
|
-
default: void 0,
|
|
14
|
-
required: false
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
setup(props) {
|
|
18
|
-
if (!props.field) {
|
|
19
|
-
return () => null;
|
|
20
|
-
}
|
|
21
|
-
return () => {
|
|
22
|
-
return h(simplyResolveComponent(props.wrapper || defaultWrapper), {
|
|
23
|
-
"data-oembed": props.field.embed_url,
|
|
24
|
-
"data-oembed-type": props.field.type,
|
|
25
|
-
"data-oembed-provider": props.field.provider_name,
|
|
26
|
-
innerHTML: props.field.html || null
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const PrismicEmbed = PrismicEmbedImpl;
|
|
32
|
-
export {
|
|
33
|
-
PrismicEmbed,
|
|
34
|
-
PrismicEmbedImpl
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=PrismicEmbed.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrismicEmbed.js","sources":["../../../src/components/PrismicEmbed.ts"],"sourcesContent":["import { EmbedField } from \"@prismicio/client\";\nimport {\n\tAllowedComponentProps,\n\tComponentCustomProps,\n\tConcreteComponent,\n\tDefineComponent,\n\tPropType,\n\tRaw,\n\tVNodeProps,\n\tdefineComponent,\n\th,\n} from \"vue\";\n\nimport { simplyResolveComponent } from \"../lib/simplyResolveComponent\";\n\n/**\n * The default component rendered to wrap the embed.\n */\nconst defaultWrapper = \"div\";\n\n/**\n * Props for `<PrismicEmbed />`.\n */\nexport type PrismicEmbedProps = {\n\t/**\n\t * The Prismic embed field to render.\n\t */\n\tfield: EmbedField;\n\n\t/**\n\t * An HTML tag name, a component, or a functional component used to wrap the\n\t * output.\n\t *\n\t * @defaultValue `\"div\"`\n\t */\n\twrapper?: string | ConcreteComponent | Raw<DefineComponent>;\n};\n\n/**\n * `<PrismicEmbed />` implementation.\n *\n * @internal\n */\nexport const PrismicEmbedImpl = /*#__PURE__*/ defineComponent({\n\tname: \"PrismicEmbed\",\n\tprops: {\n\t\tfield: {\n\t\t\ttype: Object as PropType<EmbedField>,\n\t\t\trequired: true,\n\t\t},\n\t\twrapper: {\n\t\t\ttype: [String, Object, Function] as PropType<\n\t\t\t\tstring | ConcreteComponent | Raw<DefineComponent>\n\t\t\t>,\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.field) {\n\t\t\treturn () => null;\n\t\t}\n\n\t\treturn () => {\n\t\t\treturn h(simplyResolveComponent(props.wrapper || defaultWrapper), {\n\t\t\t\t\"data-oembed\": props.field.embed_url,\n\t\t\t\t\"data-oembed-type\": props.field.type,\n\t\t\t\t\"data-oembed-provider\": props.field.provider_name,\n\t\t\t\tinnerHTML: props.field.html || null,\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 embed field.\n *\n * @see Component props {@link PrismicEmbedProps}\n * @see Templating embed fields {@link https://prismic.io/docs/technologies/vue-template-content#embeds}\n */\nexport const PrismicEmbed = PrismicEmbedImpl as unknown as {\n\tnew (): {\n\t\t$props: AllowedComponentProps &\n\t\t\tComponentCustomProps &\n\t\t\tVNodeProps &\n\t\t\tPrismicEmbedProps;\n\t};\n};\n"],"names":[],"mappings":";;AAkBA,MAAM,iBAAiB;AAyBhB,MAAM,mBAAiD,gCAAA;AAAA,EAC7D,MAAM;AAAA,EACN,OAAO;AAAA,IACN,OAAO;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IACV;AAAA,IACD,SAAS;AAAA,MACR,MAAM,CAAC,QAAQ,QAAQ,QAAQ;AAAA,MAG/B,SAAS;AAAA,MACT,UAAU;AAAA,IACV;AAAA,EACD;AAAA,EACD,MAAM,OAAK;AAEN,QAAA,CAAC,MAAM,OAAO;AACjB,aAAO,MAAM;AAAA,IACd;AAEA,WAAO,MAAK;AACX,aAAO,EAAE,uBAAuB,MAAM,WAAW,cAAc,GAAG;AAAA,QACjE,eAAe,MAAM,MAAM;AAAA,QAC3B,oBAAoB,MAAM,MAAM;AAAA,QAChC,wBAAwB,MAAM,MAAM;AAAA,QACpC,WAAW,MAAM,MAAM,QAAQ;AAAA,MAAA,CAC/B;AAAA,IAAA;AAAA,EAEH;AACA,CAAA;AAUM,MAAM,eAAe;"}
|