@prismicio/vue 3.1.4 → 3.2.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/dist/components/PrismicEmbed.cjs.map +1 -1
- package/dist/components/PrismicEmbed.d.ts +57 -63
- package/dist/components/PrismicEmbed.js.map +1 -1
- package/dist/components/PrismicImage.cjs +2 -2
- package/dist/components/PrismicImage.cjs.map +1 -1
- package/dist/components/PrismicImage.d.ts +162 -162
- package/dist/components/PrismicImage.js +2 -2
- package/dist/components/PrismicImage.js.map +1 -1
- package/dist/components/PrismicLink.cjs +3 -3
- package/dist/components/PrismicLink.cjs.map +1 -1
- package/dist/components/PrismicLink.d.ts +191 -191
- package/dist/components/PrismicLink.js +3 -3
- package/dist/components/PrismicLink.js.map +1 -1
- package/dist/components/PrismicRichText.cjs +10 -5
- package/dist/components/PrismicRichText.cjs.map +1 -1
- package/dist/components/PrismicRichText.d.ts +160 -139
- package/dist/components/PrismicRichText.js +10 -5
- package/dist/components/PrismicRichText.js.map +1 -1
- package/dist/components/PrismicText.cjs +1 -1
- package/dist/components/PrismicText.cjs.map +1 -1
- package/dist/components/PrismicText.d.ts +117 -117
- package/dist/components/PrismicText.js +1 -1
- package/dist/components/PrismicText.js.map +1 -1
- package/dist/components/SliceZone.cjs +1 -1
- package/dist/components/SliceZone.cjs.map +1 -1
- package/dist/components/SliceZone.d.ts +357 -359
- package/dist/components/SliceZone.js +1 -1
- package/dist/components/SliceZone.js.map +1 -1
- package/dist/components/index.d.ts +12 -12
- package/dist/composables.cjs.map +1 -1
- package/dist/composables.d.ts +366 -366
- package/dist/composables.js.map +1 -1
- package/dist/createPrismic.cjs +3 -3
- package/dist/createPrismic.cjs.map +1 -1
- package/dist/createPrismic.d.ts +12 -12
- package/dist/createPrismic.js +3 -3
- package/dist/createPrismic.js.map +1 -1
- package/dist/globalExtensions.d.ts +11 -11
- package/dist/index.cjs +16 -16
- package/dist/index.d.ts +10 -10
- package/dist/index.js +3 -3
- package/dist/injectionSymbols.cjs.map +1 -1
- package/dist/injectionSymbols.d.ts +9 -9
- package/dist/injectionSymbols.js.map +1 -1
- package/dist/lib/__PRODUCTION__.d.ts +7 -7
- package/dist/lib/getSlots.d.ts +14 -14
- package/dist/lib/isInternalURL.d.ts +8 -8
- package/dist/lib/simplyResolveComponent.cjs.map +1 -1
- package/dist/lib/simplyResolveComponent.d.ts +12 -12
- package/dist/lib/simplyResolveComponent.js.map +1 -1
- package/dist/types.d.ts +366 -357
- package/dist/usePrismic.cjs.map +1 -1
- package/dist/usePrismic.d.ts +21 -21
- package/dist/usePrismic.js.map +1 -1
- package/dist/useStatefulPrismicClientMethod.cjs.map +1 -1
- package/dist/useStatefulPrismicClientMethod.d.ts +64 -64
- package/dist/useStatefulPrismicClientMethod.js.map +1 -1
- package/package.json +31 -23
- package/src/components/PrismicEmbed.ts +10 -5
- package/src/components/PrismicImage.ts +20 -15
- package/src/components/PrismicLink.ts +23 -16
- package/src/components/PrismicRichText.ts +44 -18
- package/src/components/PrismicText.ts +13 -9
- package/src/components/SliceZone.ts +12 -8
- package/src/composables.ts +2 -5
- package/src/createPrismic.ts +18 -21
- package/src/injectionSymbols.ts +0 -2
- package/src/lib/simplyResolveComponent.ts +8 -2
- package/src/types.ts +24 -16
- package/src/usePrismic.ts +2 -1
- package/src/useStatefulPrismicClientMethod.ts +3 -3
- package/vetur/attributes.json +1 -6
- package/vetur/tags.json +17 -3
|
@@ -1,36 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HTMLFunctionSerializer,
|
|
3
|
+
HTMLMapSerializer,
|
|
4
|
+
LinkResolverFunction,
|
|
5
|
+
asHTML,
|
|
6
|
+
isFilled,
|
|
7
|
+
} from "@prismicio/helpers";
|
|
1
8
|
import {
|
|
2
9
|
AllowedComponentProps,
|
|
3
10
|
Component,
|
|
4
11
|
ComponentCustomProps,
|
|
5
|
-
computed,
|
|
6
12
|
ComputedRef,
|
|
7
13
|
ConcreteComponent,
|
|
14
|
+
DefineComponent,
|
|
15
|
+
PropType,
|
|
16
|
+
Raw,
|
|
17
|
+
VNodeProps,
|
|
18
|
+
computed,
|
|
8
19
|
defineComponent,
|
|
9
20
|
h,
|
|
10
21
|
inject,
|
|
11
22
|
nextTick,
|
|
12
23
|
onBeforeUnmount,
|
|
13
|
-
PropType,
|
|
14
24
|
ref,
|
|
15
25
|
unref,
|
|
16
|
-
VNodeProps,
|
|
17
26
|
watch,
|
|
18
27
|
} from "vue";
|
|
19
28
|
import { routerKey } from "vue-router";
|
|
20
29
|
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
HTMLFunctionSerializer,
|
|
24
|
-
HTMLMapSerializer,
|
|
25
|
-
isFilled,
|
|
26
|
-
LinkResolverFunction,
|
|
27
|
-
} from "@prismicio/helpers";
|
|
28
|
-
import { RichTextField } from "@prismicio/types";
|
|
30
|
+
import { isInternalURL } from "../lib/isInternalURL";
|
|
31
|
+
import { simplyResolveComponent } from "../lib/simplyResolveComponent";
|
|
29
32
|
|
|
30
33
|
import { VueUseOptions } from "../types";
|
|
34
|
+
import { RichTextField } from "@prismicio/types";
|
|
35
|
+
|
|
31
36
|
import { usePrismic } from "../usePrismic";
|
|
32
|
-
import { simplyResolveComponent } from "../lib/simplyResolveComponent";
|
|
33
|
-
import { isInternalURL } from "../lib/isInternalURL";
|
|
34
37
|
|
|
35
38
|
/**
|
|
36
39
|
* The default component rendered to wrap the HTML output.
|
|
@@ -63,6 +66,17 @@ export type PrismicRichTextProps = {
|
|
|
63
66
|
*
|
|
64
67
|
* @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
|
|
65
68
|
*/
|
|
69
|
+
serializer?: HTMLFunctionSerializer | HTMLMapSerializer;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* An HTML serializer to customize the way rich text fields are rendered.
|
|
73
|
+
*
|
|
74
|
+
* @deprecated Use `serializer` instead.
|
|
75
|
+
*
|
|
76
|
+
* @defaultValue The HTML serializer provided to `@prismicio/vue` plugin if configured.
|
|
77
|
+
*
|
|
78
|
+
* @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
|
|
79
|
+
*/
|
|
66
80
|
htmlSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;
|
|
67
81
|
|
|
68
82
|
/**
|
|
@@ -71,7 +85,7 @@ export type PrismicRichTextProps = {
|
|
|
71
85
|
*
|
|
72
86
|
* @defaultValue `"div"`
|
|
73
87
|
*/
|
|
74
|
-
wrapper?: string | ConcreteComponent
|
|
88
|
+
wrapper?: string | ConcreteComponent | Raw<DefineComponent>;
|
|
75
89
|
|
|
76
90
|
/**
|
|
77
91
|
* The HTML value to be rendered when the field is empty. If a fallback is not
|
|
@@ -118,10 +132,13 @@ export const usePrismicRichText = (
|
|
|
118
132
|
}
|
|
119
133
|
|
|
120
134
|
const linkResolver = unref(props.linkResolver) ?? options.linkResolver;
|
|
121
|
-
const
|
|
122
|
-
unref(props.
|
|
135
|
+
const serializer =
|
|
136
|
+
unref(props.serializer) ??
|
|
137
|
+
unref(props.htmlSerializer) ??
|
|
138
|
+
options.richTextSerializer ??
|
|
139
|
+
options.htmlSerializer;
|
|
123
140
|
|
|
124
|
-
return asHTML(unref(field), linkResolver,
|
|
141
|
+
return asHTML(unref(field), linkResolver, serializer);
|
|
125
142
|
});
|
|
126
143
|
|
|
127
144
|
return {
|
|
@@ -147,6 +164,13 @@ export const PrismicRichTextImpl = /*#__PURE__*/ defineComponent({
|
|
|
147
164
|
default: undefined,
|
|
148
165
|
required: false,
|
|
149
166
|
},
|
|
167
|
+
serializer: {
|
|
168
|
+
type: [Function, Object] as PropType<
|
|
169
|
+
HTMLFunctionSerializer | HTMLMapSerializer
|
|
170
|
+
>,
|
|
171
|
+
default: undefined,
|
|
172
|
+
required: false,
|
|
173
|
+
},
|
|
150
174
|
htmlSerializer: {
|
|
151
175
|
type: [Function, Object] as PropType<
|
|
152
176
|
HTMLFunctionSerializer | HTMLMapSerializer
|
|
@@ -155,7 +179,9 @@ export const PrismicRichTextImpl = /*#__PURE__*/ defineComponent({
|
|
|
155
179
|
required: false,
|
|
156
180
|
},
|
|
157
181
|
wrapper: {
|
|
158
|
-
type: [String, Object, Function] as PropType<
|
|
182
|
+
type: [String, Object, Function] as PropType<
|
|
183
|
+
string | ConcreteComponent | Raw<DefineComponent>
|
|
184
|
+
>,
|
|
159
185
|
default: undefined,
|
|
160
186
|
required: false,
|
|
161
187
|
},
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
+
import { asText, isFilled } from "@prismicio/helpers";
|
|
1
2
|
import {
|
|
2
3
|
AllowedComponentProps,
|
|
3
4
|
ComponentCustomProps,
|
|
4
|
-
computed,
|
|
5
5
|
ComputedRef,
|
|
6
6
|
ConcreteComponent,
|
|
7
|
-
|
|
8
|
-
h,
|
|
7
|
+
DefineComponent,
|
|
9
8
|
PropType,
|
|
10
|
-
|
|
9
|
+
Raw,
|
|
11
10
|
VNode,
|
|
12
11
|
VNodeProps,
|
|
12
|
+
computed,
|
|
13
|
+
defineComponent,
|
|
14
|
+
h,
|
|
15
|
+
unref,
|
|
13
16
|
} from "vue";
|
|
14
17
|
|
|
15
|
-
import {
|
|
16
|
-
import { RichTextField } from "@prismicio/types";
|
|
18
|
+
import { simplyResolveComponent } from "../lib/simplyResolveComponent";
|
|
17
19
|
|
|
18
20
|
import { VueUseOptions } from "../types";
|
|
19
|
-
import {
|
|
21
|
+
import { RichTextField } from "@prismicio/types";
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* The default component rendered to wrap the text output.
|
|
@@ -44,7 +46,7 @@ export type PrismicTextProps = {
|
|
|
44
46
|
*
|
|
45
47
|
* @defaultValue `"div"`
|
|
46
48
|
*/
|
|
47
|
-
wrapper?: string | ConcreteComponent
|
|
49
|
+
wrapper?: string | ConcreteComponent | Raw<DefineComponent>;
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
52
|
* The string value to be rendered when the field is empty. If a fallback is
|
|
@@ -116,7 +118,9 @@ export const PrismicTextImpl = /*#__PURE__*/ defineComponent({
|
|
|
116
118
|
required: false,
|
|
117
119
|
},
|
|
118
120
|
wrapper: {
|
|
119
|
-
type: [String, Object, Function] as PropType<
|
|
121
|
+
type: [String, Object, Function] as PropType<
|
|
122
|
+
string | ConcreteComponent | Raw<DefineComponent>
|
|
123
|
+
>,
|
|
120
124
|
default: undefined,
|
|
121
125
|
required: false,
|
|
122
126
|
},
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AllowedComponentProps,
|
|
3
3
|
ComponentCustomProps,
|
|
4
|
-
computed,
|
|
5
4
|
ConcreteComponent,
|
|
6
5
|
DefineComponent,
|
|
7
|
-
defineComponent,
|
|
8
6
|
FunctionalComponent,
|
|
9
|
-
h,
|
|
10
|
-
markRaw,
|
|
11
7
|
PropType,
|
|
8
|
+
Raw,
|
|
12
9
|
VNodeProps,
|
|
10
|
+
computed,
|
|
11
|
+
defineComponent,
|
|
12
|
+
h,
|
|
13
|
+
markRaw,
|
|
13
14
|
watchEffect,
|
|
14
15
|
} from "vue";
|
|
15
16
|
|
|
17
|
+
import { __PRODUCTION__ } from "../lib/__PRODUCTION__";
|
|
18
|
+
import { simplyResolveComponent } from "../lib/simplyResolveComponent";
|
|
19
|
+
|
|
16
20
|
import { Slice } from "@prismicio/types";
|
|
17
21
|
|
|
18
|
-
import { simplyResolveComponent } from "../lib/simplyResolveComponent";
|
|
19
|
-
import { __PRODUCTION__ } from "../lib/__PRODUCTION__";
|
|
20
22
|
import { usePrismic } from "../usePrismic";
|
|
21
23
|
|
|
22
24
|
/**
|
|
@@ -442,7 +444,7 @@ export type SliceZoneProps<TContext = unknown> = {
|
|
|
442
444
|
* An HTML tag name, a component, or a functional component used to wrap the
|
|
443
445
|
* output. The Slice Zone is not wrapped by default.
|
|
444
446
|
*/
|
|
445
|
-
wrapper?: string | ConcreteComponent
|
|
447
|
+
wrapper?: string | ConcreteComponent | Raw<DefineComponent>;
|
|
446
448
|
};
|
|
447
449
|
|
|
448
450
|
/**
|
|
@@ -478,7 +480,9 @@ export const SliceZoneImpl = /*#__PURE__*/ defineComponent({
|
|
|
478
480
|
required: false,
|
|
479
481
|
},
|
|
480
482
|
wrapper: {
|
|
481
|
-
type: [String, Object, Function] as PropType<
|
|
483
|
+
type: [String, Object, Function] as PropType<
|
|
484
|
+
string | ConcreteComponent | Raw<DefineComponent>
|
|
485
|
+
>,
|
|
482
486
|
default: undefined,
|
|
483
487
|
required: false,
|
|
484
488
|
},
|
package/src/composables.ts
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
|
|
3
2
|
// Imports for @link references:
|
|
4
|
-
|
|
5
3
|
import type { Client } from "@prismicio/client";
|
|
6
4
|
|
|
7
5
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
8
|
-
|
|
9
6
|
import { PrismicDocument, Query } from "@prismicio/types";
|
|
10
7
|
|
|
11
8
|
import {
|
|
12
|
-
ClientMethodParameters,
|
|
13
9
|
ClientComposableReturnType,
|
|
14
|
-
|
|
10
|
+
ClientMethodParameters,
|
|
15
11
|
ComposableOnlyParameters,
|
|
12
|
+
useStatefulPrismicClientMethod,
|
|
16
13
|
} from "./useStatefulPrismicClientMethod";
|
|
17
14
|
|
|
18
15
|
// Composables
|
package/src/createPrismic.ts
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
import { App } from "vue";
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
|
-
createClient,
|
|
5
|
-
predicate,
|
|
6
|
-
cookie,
|
|
7
2
|
Client,
|
|
8
3
|
FetchLike,
|
|
4
|
+
cookie,
|
|
5
|
+
createClient,
|
|
6
|
+
predicate,
|
|
9
7
|
} from "@prismicio/client";
|
|
10
8
|
import {
|
|
11
|
-
asText,
|
|
12
|
-
asHTML,
|
|
13
|
-
asLink,
|
|
14
9
|
asDate,
|
|
10
|
+
asHTML,
|
|
11
|
+
asImagePixelDensitySrcSet,
|
|
15
12
|
asImageSrc,
|
|
16
13
|
asImageWidthSrcSet,
|
|
17
|
-
|
|
14
|
+
asLink,
|
|
15
|
+
asText,
|
|
18
16
|
documentToLinkField,
|
|
19
17
|
} from "@prismicio/helpers";
|
|
18
|
+
import { App } from "vue";
|
|
19
|
+
|
|
20
|
+
import type {
|
|
21
|
+
PrismicPlugin,
|
|
22
|
+
PrismicPluginClient,
|
|
23
|
+
PrismicPluginHelpers,
|
|
24
|
+
PrismicPluginOptions,
|
|
25
|
+
} from "./types";
|
|
20
26
|
|
|
21
27
|
import {
|
|
22
28
|
PrismicEmbed,
|
|
@@ -27,12 +33,6 @@ import {
|
|
|
27
33
|
SliceZone,
|
|
28
34
|
} from "./components";
|
|
29
35
|
import { prismicKey } from "./injectionSymbols";
|
|
30
|
-
import type {
|
|
31
|
-
PrismicPlugin,
|
|
32
|
-
PrismicPluginClient,
|
|
33
|
-
PrismicPluginHelpers,
|
|
34
|
-
PrismicPluginOptions,
|
|
35
|
-
} from "./types";
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Creates a `@prismicio/vue` plugin instance that can be used by a Vue app.
|
|
@@ -54,12 +54,9 @@ export const createPrismic = (options: PrismicPluginOptions): PrismicPlugin => {
|
|
|
54
54
|
fetch: async (endpoint, options) => {
|
|
55
55
|
let fetchFunction: FetchLike;
|
|
56
56
|
if (typeof globalThis.fetch === "function") {
|
|
57
|
-
|
|
58
|
-
fetchFunction = globalThis.fetch as FetchLike;
|
|
57
|
+
fetchFunction = globalThis.fetch;
|
|
59
58
|
} else {
|
|
60
|
-
|
|
61
|
-
fetchFunction = (await import("isomorphic-unfetch"))
|
|
62
|
-
.default as FetchLike;
|
|
59
|
+
fetchFunction = (await import("isomorphic-unfetch")).default;
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
return await fetchFunction(endpoint, options);
|
|
@@ -81,7 +78,7 @@ export const createPrismic = (options: PrismicPluginOptions): PrismicPlugin => {
|
|
|
81
78
|
return asHTML(
|
|
82
79
|
richTextField,
|
|
83
80
|
linkResolver || options.linkResolver,
|
|
84
|
-
htmlSerializer || options.htmlSerializer,
|
|
81
|
+
htmlSerializer || options.richTextSerializer || options.htmlSerializer,
|
|
85
82
|
);
|
|
86
83
|
},
|
|
87
84
|
asLink: (linkField, linkResolver) => {
|
package/src/injectionSymbols.ts
CHANGED
|
@@ -3,9 +3,7 @@ import type { InjectionKey } from "vue";
|
|
|
3
3
|
import type { PrismicPlugin } from "./types";
|
|
4
4
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6
|
-
|
|
7
6
|
// Imports for @link references:
|
|
8
|
-
|
|
9
7
|
import type { usePrismic } from "./usePrismic";
|
|
10
8
|
|
|
11
9
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ConcreteComponent,
|
|
3
|
+
DefineComponent,
|
|
4
|
+
Raw,
|
|
5
|
+
VNode,
|
|
6
|
+
resolveDynamicComponent,
|
|
7
|
+
} from "vue";
|
|
2
8
|
|
|
3
9
|
/**
|
|
4
10
|
* A stricter version of {@link resolveDynamicComponent} that resolves only type
|
|
@@ -11,7 +17,7 @@ import { ConcreteComponent, resolveDynamicComponent, VNode } from "vue";
|
|
|
11
17
|
* @internal
|
|
12
18
|
*/
|
|
13
19
|
export const simplyResolveComponent = (
|
|
14
|
-
component: string | ConcreteComponent
|
|
20
|
+
component: string | ConcreteComponent | Raw<DefineComponent>,
|
|
15
21
|
): string | VNode => {
|
|
16
22
|
return resolveDynamicComponent(component) as string | VNode;
|
|
17
23
|
};
|
package/src/types.ts
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
import type { App, ConcreteComponent, Ref } from "vue";
|
|
2
|
-
|
|
3
1
|
import type {
|
|
4
|
-
Client,
|
|
5
2
|
ClientConfig,
|
|
3
|
+
CreateClient,
|
|
6
4
|
cookie,
|
|
7
5
|
predicate,
|
|
8
6
|
} from "@prismicio/client";
|
|
9
7
|
import type {
|
|
10
|
-
asText,
|
|
11
|
-
asHTML,
|
|
12
|
-
asLink,
|
|
13
|
-
asDate,
|
|
14
|
-
documentToLinkField,
|
|
15
8
|
HTMLFunctionSerializer,
|
|
16
9
|
HTMLMapSerializer,
|
|
17
10
|
LinkResolverFunction,
|
|
11
|
+
asDate,
|
|
12
|
+
asHTML,
|
|
13
|
+
asImagePixelDensitySrcSet,
|
|
18
14
|
asImageSrc,
|
|
19
15
|
asImageWidthSrcSet,
|
|
20
|
-
|
|
16
|
+
asLink,
|
|
17
|
+
asText,
|
|
18
|
+
documentToLinkField,
|
|
21
19
|
} from "@prismicio/helpers";
|
|
20
|
+
import type { App, ConcreteComponent, DefineComponent, Raw, Ref } from "vue";
|
|
22
21
|
|
|
23
22
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
24
|
-
|
|
25
23
|
// Imports for @link references:
|
|
26
|
-
|
|
27
24
|
import type { RouterLink } from "vue-router";
|
|
28
25
|
|
|
29
26
|
import type {
|
|
@@ -60,7 +57,7 @@ type PrismicPluginComponentsOptions = {
|
|
|
60
57
|
* (`to` props).
|
|
61
58
|
* @defaultValue {@link RouterLink}
|
|
62
59
|
*/
|
|
63
|
-
linkInternalComponent?: string | ConcreteComponent
|
|
60
|
+
linkInternalComponent?: string | ConcreteComponent | Raw<DefineComponent>;
|
|
64
61
|
|
|
65
62
|
/**
|
|
66
63
|
* An HTML tag name, a component, or a functional component used to render
|
|
@@ -74,7 +71,7 @@ type PrismicPluginComponentsOptions = {
|
|
|
74
71
|
* (`to` props).
|
|
75
72
|
* @defaultValue `"a"`
|
|
76
73
|
*/
|
|
77
|
-
linkExternalComponent?: string | ConcreteComponent
|
|
74
|
+
linkExternalComponent?: string | ConcreteComponent | Raw<DefineComponent>;
|
|
78
75
|
|
|
79
76
|
/**
|
|
80
77
|
* An HTML tag name, a component, or a functional component used to render
|
|
@@ -86,7 +83,7 @@ type PrismicPluginComponentsOptions = {
|
|
|
86
83
|
* additional `copyright` props.
|
|
87
84
|
* @defaultValue `"img"`
|
|
88
85
|
*/
|
|
89
|
-
imageComponent?: string | ConcreteComponent
|
|
86
|
+
imageComponent?: string | ConcreteComponent | Raw<DefineComponent>;
|
|
90
87
|
|
|
91
88
|
/**
|
|
92
89
|
* Default widths to use when rendering an image with `widths="defaults"`
|
|
@@ -138,6 +135,17 @@ type PrismicPluginOptionsBase = {
|
|
|
138
135
|
*
|
|
139
136
|
* @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
|
|
140
137
|
*/
|
|
138
|
+
richTextSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* An optional HTML serializer to customize the way rich text fields are
|
|
142
|
+
* rendered.
|
|
143
|
+
*
|
|
144
|
+
* @deprecated Use `richTextSerializer` instead.
|
|
145
|
+
*
|
|
146
|
+
* @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
|
|
147
|
+
*/
|
|
148
|
+
// TODO: Remove in v5
|
|
141
149
|
htmlSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;
|
|
142
150
|
|
|
143
151
|
/**
|
|
@@ -171,7 +179,7 @@ type PrismicPluginOptionsWithClient = PrismicPluginOptionsBase & {
|
|
|
171
179
|
* `usePrismic().client`.
|
|
172
180
|
* @see Prismic client documentation {@link https://prismic.io/docs/technologies/javascript}
|
|
173
181
|
*/
|
|
174
|
-
client:
|
|
182
|
+
client: ReturnType<CreateClient>;
|
|
175
183
|
|
|
176
184
|
/**
|
|
177
185
|
* Ensures type union is a strict or.
|
|
@@ -276,7 +284,7 @@ export type PrismicPluginClient = {
|
|
|
276
284
|
/**
|
|
277
285
|
* A `@prismicio/client` instance.
|
|
278
286
|
*/
|
|
279
|
-
client:
|
|
287
|
+
client: ReturnType<CreateClient>;
|
|
280
288
|
|
|
281
289
|
/**
|
|
282
290
|
* Query predicates from `@prismicio/client`.
|
package/src/usePrismic.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { isRef, ref, Ref, shallowRef, unref, watch } from "vue";
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
Client,
|
|
5
3
|
ForbiddenError,
|
|
6
4
|
ParsingError,
|
|
7
5
|
PrismicError,
|
|
8
6
|
} from "@prismicio/client";
|
|
7
|
+
import { Ref, isRef, ref, shallowRef, unref, watch } from "vue";
|
|
9
8
|
|
|
10
|
-
import { usePrismic } from "./usePrismic";
|
|
11
9
|
import { PrismicClientComposableState, VueUseParameters } from "./types";
|
|
12
10
|
|
|
11
|
+
import { usePrismic } from "./usePrismic";
|
|
12
|
+
|
|
13
13
|
// Helpers
|
|
14
14
|
type UnwrapPromise<T> = T extends Promise<infer U> ? U : T;
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
package/vetur/attributes.json
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
"type": "string | object | function",
|
|
8
8
|
"description": "An HTML tag name, a component, or a functional component used to wrap the output. Defaults to `\"div\"`."
|
|
9
9
|
},
|
|
10
|
-
|
|
11
10
|
"prismic-image/field": {
|
|
12
11
|
"type": "object",
|
|
13
12
|
"description": "The Prismic image field to render."
|
|
@@ -28,7 +27,6 @@
|
|
|
28
27
|
"type": "array | string",
|
|
29
28
|
"description": "Adds an additional `srcset` attribute to the image following giving pixel densities."
|
|
30
29
|
},
|
|
31
|
-
|
|
32
30
|
"prismic-link/field": {
|
|
33
31
|
"type": "object",
|
|
34
32
|
"description": "The Prismic link field or document to render."
|
|
@@ -57,7 +55,6 @@
|
|
|
57
55
|
"type": "string | object | function",
|
|
58
56
|
"description": "An HTML tag name, a component, or a functional component used to render external links. Defaults to the one provided to `@prismicio/vue` plugin if configured, `\"a\"` otherwise."
|
|
59
57
|
},
|
|
60
|
-
|
|
61
58
|
"prismic-rich-text/field": {
|
|
62
59
|
"type": "array",
|
|
63
60
|
"description": "The Prismic rich text or title field to render."
|
|
@@ -66,7 +63,7 @@
|
|
|
66
63
|
"type": "function",
|
|
67
64
|
"description": "A link resolver function used to resolve links when not using the route resolver parameter with `@prismicio/client`. Defaults to the link resolver provided to `@prismicio/vue` plugin if configured."
|
|
68
65
|
},
|
|
69
|
-
"prismic-rich-text/
|
|
66
|
+
"prismic-rich-text/serializer": {
|
|
70
67
|
"type": "function | object",
|
|
71
68
|
"description": "An HTML serializer to customize the way rich text fields are rendered. Defaults to the HTML serializer provided to `@prismicio/vue` plugin if configured."
|
|
72
69
|
},
|
|
@@ -78,7 +75,6 @@
|
|
|
78
75
|
"type": "string",
|
|
79
76
|
"description": "The HTML value to be rendered when the field is empty. If a fallback is not given, `\"\"` (nothing) will be rendered."
|
|
80
77
|
},
|
|
81
|
-
|
|
82
78
|
"prismic-text/field": {
|
|
83
79
|
"type": "array",
|
|
84
80
|
"description": "The Prismic rich text or title field to render."
|
|
@@ -95,7 +91,6 @@
|
|
|
95
91
|
"type": "string",
|
|
96
92
|
"description": "The string value to be rendered when the field is empty. If a fallback is not given, `\"\"` (nothing) will be rendered."
|
|
97
93
|
},
|
|
98
|
-
|
|
99
94
|
"slice-zone/slices": {
|
|
100
95
|
"type": "array",
|
|
101
96
|
"description": "List of Slice data from the Slice Zone."
|
package/vetur/tags.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"prismic-embed": {
|
|
3
|
-
"attributes": [
|
|
3
|
+
"attributes": [
|
|
4
|
+
"field",
|
|
5
|
+
"wrapper"
|
|
6
|
+
],
|
|
4
7
|
"description": "Component to render a Prismic embed field."
|
|
5
8
|
},
|
|
6
9
|
"prismic-image": {
|
|
@@ -26,11 +29,22 @@
|
|
|
26
29
|
"description": "Component to render a Prismic link field."
|
|
27
30
|
},
|
|
28
31
|
"prismic-rich-text": {
|
|
29
|
-
"attributes": [
|
|
32
|
+
"attributes": [
|
|
33
|
+
"field",
|
|
34
|
+
"link-resolver",
|
|
35
|
+
"serializer",
|
|
36
|
+
"wrapper",
|
|
37
|
+
"fallback"
|
|
38
|
+
],
|
|
30
39
|
"description": "Component to render a Prismic rich text field as HTML."
|
|
31
40
|
},
|
|
32
41
|
"prismic-text": {
|
|
33
|
-
"attributes": [
|
|
42
|
+
"attributes": [
|
|
43
|
+
"field",
|
|
44
|
+
"separator",
|
|
45
|
+
"wrapper",
|
|
46
|
+
"fallback"
|
|
47
|
+
],
|
|
34
48
|
"description": "Component to render a Prismic rich text field as plain text."
|
|
35
49
|
},
|
|
36
50
|
"slice-zone": {
|