@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
package/dist/types.d.ts
CHANGED
|
@@ -1,357 +1,366 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { SliceComponentType } from "./components/SliceZone";
|
|
5
|
-
/**
|
|
6
|
-
* Options used by `@prismicio/vue` components.
|
|
7
|
-
*/
|
|
8
|
-
type PrismicPluginComponentsOptions = {
|
|
9
|
-
/**
|
|
10
|
-
* Value of the `rel` attribute to use on links rendered with
|
|
11
|
-
* `target="_blank"`
|
|
12
|
-
*
|
|
13
|
-
* @defaultValue `"noopener noreferrer"`
|
|
14
|
-
*/
|
|
15
|
-
linkBlankTargetRelAttribute?: string;
|
|
16
|
-
/**
|
|
17
|
-
* An HTML tag name, a component, or a functional component used to render
|
|
18
|
-
* internal links.
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* HTML tag names will be rendered using the anchor tag interface (`href`,
|
|
22
|
-
* `target`, and `rel` attributes).
|
|
23
|
-
* @remarks
|
|
24
|
-
* Components will be rendered using Vue Router {@link RouterLink} interface
|
|
25
|
-
* (`to` props).
|
|
26
|
-
* @defaultValue {@link RouterLink}
|
|
27
|
-
*/
|
|
28
|
-
linkInternalComponent?: string | ConcreteComponent
|
|
29
|
-
/**
|
|
30
|
-
* An HTML tag name, a component, or a functional component used to render
|
|
31
|
-
* external links.
|
|
32
|
-
*
|
|
33
|
-
* @remarks
|
|
34
|
-
* HTML tag names will be rendered using the anchor tag interface (`href`,
|
|
35
|
-
* `target`, and `rel` attributes).
|
|
36
|
-
* @remarks
|
|
37
|
-
* Components will be rendered using Vue Router {@link RouterLink} interface
|
|
38
|
-
* (`to` props).
|
|
39
|
-
* @defaultValue `"a"`
|
|
40
|
-
*/
|
|
41
|
-
linkExternalComponent?: string | ConcreteComponent
|
|
42
|
-
/**
|
|
43
|
-
* An HTML tag name, a component, or a functional component used to render
|
|
44
|
-
* images.
|
|
45
|
-
*
|
|
46
|
-
* @remarks
|
|
47
|
-
* HTML tag names and components will be rendered using the `img` tag
|
|
48
|
-
* interface (`src` and `alt` attribute). Components will also receive an
|
|
49
|
-
* additional `copyright` props.
|
|
50
|
-
* @defaultValue `"img"`
|
|
51
|
-
*/
|
|
52
|
-
imageComponent?: string | ConcreteComponent
|
|
53
|
-
/**
|
|
54
|
-
* Default widths to use when rendering an image with `widths="defaults"`
|
|
55
|
-
*
|
|
56
|
-
* @remarks
|
|
57
|
-
* Consider configuring image widths within your content type definition and
|
|
58
|
-
* using `widths="auto"` instead to give content writers the ability to crop
|
|
59
|
-
* images in the editor.
|
|
60
|
-
* @defaultValue `@prismicio/helpers` defaults
|
|
61
|
-
*/
|
|
62
|
-
imageWidthSrcSetDefaults?: number[];
|
|
63
|
-
/**
|
|
64
|
-
* Default pixel densities to use when rendering an image with
|
|
65
|
-
* `pixel-densities="defaults"`
|
|
66
|
-
*
|
|
67
|
-
* @defaultValue `@prismicio/helpers` defaults
|
|
68
|
-
*/
|
|
69
|
-
imagePixelDensitySrcSetDefaults?: number[];
|
|
70
|
-
/**
|
|
71
|
-
* A component or a functional component rendered if a component mapping from
|
|
72
|
-
* the `components` prop cannot be found.
|
|
73
|
-
*
|
|
74
|
-
* @remarks
|
|
75
|
-
* Components will be rendered using the {@link SliceComponentProps} interface.
|
|
76
|
-
*
|
|
77
|
-
* @defaultValue `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}
|
|
78
|
-
*/
|
|
79
|
-
sliceZoneDefaultComponent?: SliceComponentType;
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Common options supported by `@prismicio/vue` plugin.
|
|
83
|
-
*/
|
|
84
|
-
type PrismicPluginOptionsBase = {
|
|
85
|
-
/**
|
|
86
|
-
* An optional link resolver function used to resolve links to Prismic
|
|
87
|
-
* documents when not using the route resolver parameter with
|
|
88
|
-
* `@prismicio/client`.
|
|
89
|
-
*
|
|
90
|
-
* @see Link resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#link-resolver}
|
|
91
|
-
*/
|
|
92
|
-
linkResolver?: LinkResolverFunction;
|
|
93
|
-
/**
|
|
94
|
-
* An optional HTML serializer to customize the way rich text fields are
|
|
95
|
-
* rendered.
|
|
96
|
-
*
|
|
97
|
-
* @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
|
|
98
|
-
*/
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
* `
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
*
|
|
251
|
-
* @
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
*
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
*
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
*
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
*
|
|
325
|
-
*/
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Type to transform a static
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
1
|
+
import type { ClientConfig, CreateClient, cookie, predicate } from "@prismicio/client";
|
|
2
|
+
import type { HTMLFunctionSerializer, HTMLMapSerializer, LinkResolverFunction, asDate, asHTML, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet, asLink, asText, documentToLinkField } from "@prismicio/helpers";
|
|
3
|
+
import type { App, ConcreteComponent, DefineComponent, Raw, Ref } from "vue";
|
|
4
|
+
import type { SliceComponentType } from "./components/SliceZone";
|
|
5
|
+
/**
|
|
6
|
+
* Options used by `@prismicio/vue` components.
|
|
7
|
+
*/
|
|
8
|
+
type PrismicPluginComponentsOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* Value of the `rel` attribute to use on links rendered with
|
|
11
|
+
* `target="_blank"`
|
|
12
|
+
*
|
|
13
|
+
* @defaultValue `"noopener noreferrer"`
|
|
14
|
+
*/
|
|
15
|
+
linkBlankTargetRelAttribute?: string;
|
|
16
|
+
/**
|
|
17
|
+
* An HTML tag name, a component, or a functional component used to render
|
|
18
|
+
* internal links.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* HTML tag names will be rendered using the anchor tag interface (`href`,
|
|
22
|
+
* `target`, and `rel` attributes).
|
|
23
|
+
* @remarks
|
|
24
|
+
* Components will be rendered using Vue Router {@link RouterLink} interface
|
|
25
|
+
* (`to` props).
|
|
26
|
+
* @defaultValue {@link RouterLink}
|
|
27
|
+
*/
|
|
28
|
+
linkInternalComponent?: string | ConcreteComponent | Raw<DefineComponent>;
|
|
29
|
+
/**
|
|
30
|
+
* An HTML tag name, a component, or a functional component used to render
|
|
31
|
+
* external links.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* HTML tag names will be rendered using the anchor tag interface (`href`,
|
|
35
|
+
* `target`, and `rel` attributes).
|
|
36
|
+
* @remarks
|
|
37
|
+
* Components will be rendered using Vue Router {@link RouterLink} interface
|
|
38
|
+
* (`to` props).
|
|
39
|
+
* @defaultValue `"a"`
|
|
40
|
+
*/
|
|
41
|
+
linkExternalComponent?: string | ConcreteComponent | Raw<DefineComponent>;
|
|
42
|
+
/**
|
|
43
|
+
* An HTML tag name, a component, or a functional component used to render
|
|
44
|
+
* images.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* HTML tag names and components will be rendered using the `img` tag
|
|
48
|
+
* interface (`src` and `alt` attribute). Components will also receive an
|
|
49
|
+
* additional `copyright` props.
|
|
50
|
+
* @defaultValue `"img"`
|
|
51
|
+
*/
|
|
52
|
+
imageComponent?: string | ConcreteComponent | Raw<DefineComponent>;
|
|
53
|
+
/**
|
|
54
|
+
* Default widths to use when rendering an image with `widths="defaults"`
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* Consider configuring image widths within your content type definition and
|
|
58
|
+
* using `widths="auto"` instead to give content writers the ability to crop
|
|
59
|
+
* images in the editor.
|
|
60
|
+
* @defaultValue `@prismicio/helpers` defaults
|
|
61
|
+
*/
|
|
62
|
+
imageWidthSrcSetDefaults?: number[];
|
|
63
|
+
/**
|
|
64
|
+
* Default pixel densities to use when rendering an image with
|
|
65
|
+
* `pixel-densities="defaults"`
|
|
66
|
+
*
|
|
67
|
+
* @defaultValue `@prismicio/helpers` defaults
|
|
68
|
+
*/
|
|
69
|
+
imagePixelDensitySrcSetDefaults?: number[];
|
|
70
|
+
/**
|
|
71
|
+
* A component or a functional component rendered if a component mapping from
|
|
72
|
+
* the `components` prop cannot be found.
|
|
73
|
+
*
|
|
74
|
+
* @remarks
|
|
75
|
+
* Components will be rendered using the {@link SliceComponentProps} interface.
|
|
76
|
+
*
|
|
77
|
+
* @defaultValue `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}
|
|
78
|
+
*/
|
|
79
|
+
sliceZoneDefaultComponent?: SliceComponentType;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Common options supported by `@prismicio/vue` plugin.
|
|
83
|
+
*/
|
|
84
|
+
type PrismicPluginOptionsBase = {
|
|
85
|
+
/**
|
|
86
|
+
* An optional link resolver function used to resolve links to Prismic
|
|
87
|
+
* documents when not using the route resolver parameter with
|
|
88
|
+
* `@prismicio/client`.
|
|
89
|
+
*
|
|
90
|
+
* @see Link resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#link-resolver}
|
|
91
|
+
*/
|
|
92
|
+
linkResolver?: LinkResolverFunction;
|
|
93
|
+
/**
|
|
94
|
+
* An optional HTML serializer to customize the way rich text fields are
|
|
95
|
+
* rendered.
|
|
96
|
+
*
|
|
97
|
+
* @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
|
|
98
|
+
*/
|
|
99
|
+
richTextSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;
|
|
100
|
+
/**
|
|
101
|
+
* An optional HTML serializer to customize the way rich text fields are
|
|
102
|
+
* rendered.
|
|
103
|
+
*
|
|
104
|
+
* @deprecated Use `richTextSerializer` instead.
|
|
105
|
+
*
|
|
106
|
+
* @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
|
|
107
|
+
*/
|
|
108
|
+
htmlSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;
|
|
109
|
+
/**
|
|
110
|
+
* Whether or not to inject components globally.
|
|
111
|
+
*
|
|
112
|
+
* @defaultValue `true`
|
|
113
|
+
*/
|
|
114
|
+
injectComponents?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Options used by Prismic Vue components.
|
|
117
|
+
*
|
|
118
|
+
* @see Components options {@link PrismicPluginComponentsOptions}
|
|
119
|
+
*/
|
|
120
|
+
components?: PrismicPluginComponentsOptions;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Options to init `@prismicio/vue` plugin with a client instance.
|
|
124
|
+
*
|
|
125
|
+
* @see {@link PrismicPluginOptionsBase} for shared options
|
|
126
|
+
*/
|
|
127
|
+
type PrismicPluginOptionsWithClient = PrismicPluginOptionsBase & {
|
|
128
|
+
/**
|
|
129
|
+
* A `@prismicio/client` instance used to fetch content from a Prismic
|
|
130
|
+
* repository to configure the plugin with.
|
|
131
|
+
*
|
|
132
|
+
* @remarks
|
|
133
|
+
* The client will be used by `@prismicio/vue` composables, such as
|
|
134
|
+
* {@link usePrismicDocuments} and exposed through `this.$prismic.client` and
|
|
135
|
+
* `usePrismic().client`.
|
|
136
|
+
* @see Prismic client documentation {@link https://prismic.io/docs/technologies/javascript}
|
|
137
|
+
*/
|
|
138
|
+
client: ReturnType<CreateClient>;
|
|
139
|
+
/**
|
|
140
|
+
* Ensures type union is a strict or.
|
|
141
|
+
*
|
|
142
|
+
* @internal
|
|
143
|
+
*/
|
|
144
|
+
endpoint?: never;
|
|
145
|
+
/**
|
|
146
|
+
* Ensures type union is a strict or.
|
|
147
|
+
*
|
|
148
|
+
* @internal
|
|
149
|
+
*/
|
|
150
|
+
clientConfig?: never;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Options to init `@prismicio/vue` plugin with a repository ID or API endpoint.
|
|
154
|
+
*
|
|
155
|
+
* @see {@link PrismicPluginOptionsBase} for shared options
|
|
156
|
+
*/
|
|
157
|
+
type PrismicPluginOptionsWithEndpoint = PrismicPluginOptionsBase & {
|
|
158
|
+
/**
|
|
159
|
+
* A Prismic repository endpoint to init the plugin's `@prismicio/client`
|
|
160
|
+
* instance used to fetch content from a Prismic repository with.
|
|
161
|
+
*
|
|
162
|
+
* @remarks
|
|
163
|
+
* Said client will be used by `@prismicio/vue` composables, such as
|
|
164
|
+
* {@link usePrismicDocuments} and exposed through `this.$prismic.client` and
|
|
165
|
+
* `usePrismic().client`.
|
|
166
|
+
* @example A repository ID:
|
|
167
|
+
*
|
|
168
|
+
* "my-repo";
|
|
169
|
+
*
|
|
170
|
+
* @example A full repository endpoint:
|
|
171
|
+
*
|
|
172
|
+
* "https://my-repo.cdn.prismic.io/api/v2";
|
|
173
|
+
*
|
|
174
|
+
* @see Prismic client documentation {@link https://prismic.io/docs/technologies/javascript}
|
|
175
|
+
*/
|
|
176
|
+
endpoint: string;
|
|
177
|
+
/**
|
|
178
|
+
* An optional object to configure `@prismicio/client` instance further.
|
|
179
|
+
*
|
|
180
|
+
* @example Accessing a private private repository:
|
|
181
|
+
*
|
|
182
|
+
* ```javascript
|
|
183
|
+
* {
|
|
184
|
+
* "accessToken": "abc"
|
|
185
|
+
* }
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* @example Using a route resolver:
|
|
189
|
+
*
|
|
190
|
+
* ```javascript
|
|
191
|
+
* {
|
|
192
|
+
* "defaultParams": {
|
|
193
|
+
* "routes": [
|
|
194
|
+
* {
|
|
195
|
+
* "type": "page",
|
|
196
|
+
* "path": "/:uid"
|
|
197
|
+
* },
|
|
198
|
+
* {
|
|
199
|
+
* "type": "post",
|
|
200
|
+
* "path": "/blog/:uid"
|
|
201
|
+
* }
|
|
202
|
+
* ]
|
|
203
|
+
* }
|
|
204
|
+
* }
|
|
205
|
+
* ```
|
|
206
|
+
*
|
|
207
|
+
* @see Prismic client documentation {@link https://prismic.io/docs/technologies/javascript}
|
|
208
|
+
* @see Route resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
|
|
209
|
+
*/
|
|
210
|
+
clientConfig?: ClientConfig;
|
|
211
|
+
/**
|
|
212
|
+
* Ensures type union is a strict or.
|
|
213
|
+
*
|
|
214
|
+
* @internal
|
|
215
|
+
*/
|
|
216
|
+
client?: never;
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* `@prismicio/vue` plugin options.
|
|
220
|
+
*
|
|
221
|
+
* @see Prismic Official Vue.js documentation: {@link https://prismic.io/docs/technologies/vuejs}
|
|
222
|
+
* @see Plugin repository: {@link https://github.com/prismicio/prismic-vue}
|
|
223
|
+
*/
|
|
224
|
+
export type PrismicPluginOptions = PrismicPluginOptionsWithClient | PrismicPluginOptionsWithEndpoint;
|
|
225
|
+
/**
|
|
226
|
+
* `@prismicio/client` related methods and properties exposed by
|
|
227
|
+
* `@prismicio/vue` plugin and accessible through `this.$prismic` and
|
|
228
|
+
* `usePrismic()`.
|
|
229
|
+
*/
|
|
230
|
+
export type PrismicPluginClient = {
|
|
231
|
+
/**
|
|
232
|
+
* A `@prismicio/client` instance.
|
|
233
|
+
*/
|
|
234
|
+
client: ReturnType<CreateClient>;
|
|
235
|
+
/**
|
|
236
|
+
* Query predicates from `@prismicio/client`.
|
|
237
|
+
*/
|
|
238
|
+
predicate: typeof predicate;
|
|
239
|
+
/**
|
|
240
|
+
* Prismic cookies from `@prismicio/client`.
|
|
241
|
+
*/
|
|
242
|
+
cookie: typeof cookie;
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* `@prismicio/helpers` related methods exposed by `@prismicio/vue` plugin and
|
|
246
|
+
* accessible through `this.$prismic` and `usePrismic()`.
|
|
247
|
+
*/
|
|
248
|
+
export type PrismicPluginHelpers = {
|
|
249
|
+
/**
|
|
250
|
+
* Serializes a rich text or title field to a plain text string. This is
|
|
251
|
+
* `@prismicio/helpers` {@link asText} function.
|
|
252
|
+
*
|
|
253
|
+
* @see Templating rich text and title fields {@link https://prismic.io/docs/technologies/vue-template-content#rich-text-and-titles}
|
|
254
|
+
*/
|
|
255
|
+
asText: typeof asText;
|
|
256
|
+
/**
|
|
257
|
+
* Serializes a rich text or title field to an HTML string. This is
|
|
258
|
+
* `@prismicio/helpers` {@link asHTML} function.
|
|
259
|
+
*
|
|
260
|
+
* @remarks
|
|
261
|
+
* If no `linkResolver` is provided the function will use the one provided to
|
|
262
|
+
* the plugin at {@link PrismicPluginOptions.linkResolver} if available.
|
|
263
|
+
* @remarks
|
|
264
|
+
* If no `htmlSerializer` is provided the function will use the one provided
|
|
265
|
+
* to the plugin at {@link PrismicPluginOptions.htmlSerializer} if available.
|
|
266
|
+
* @see Templating rich text and title fields {@link https://prismic.io/docs/technologies/vue-template-content#rich-text-and-titles}
|
|
267
|
+
*/
|
|
268
|
+
asHTML: typeof asHTML;
|
|
269
|
+
/**
|
|
270
|
+
* Resolves any type of link field or document to a URL. This is
|
|
271
|
+
* `@prismicio/helpers` {@link asLink} function.
|
|
272
|
+
*
|
|
273
|
+
* @remarks
|
|
274
|
+
* If no `linkResolver` is provided the function will use the one provided to
|
|
275
|
+
* the plugin at {@link PrismicPluginOptions.linkResolver} if available.
|
|
276
|
+
* @see Templating link fields {@link https://prismic.io/docs/technologies/vue-template-content#links-and-content-relationships}
|
|
277
|
+
*/
|
|
278
|
+
asLink: (linkField: Parameters<typeof asLink>[0], linkResolver?: LinkResolverFunction) => string | null;
|
|
279
|
+
/**
|
|
280
|
+
* Transforms a date or timestamp field into a JavaScript Date object. This is
|
|
281
|
+
* `@prismicio/helpers` {@link asDate} function.
|
|
282
|
+
*/
|
|
283
|
+
asDate: typeof asDate;
|
|
284
|
+
/**
|
|
285
|
+
* Returns the URL of an Image field with optional image transformations (via
|
|
286
|
+
* Imgix URL parameters). This is `@prismicio/helpers` {@link asImageSrc}
|
|
287
|
+
* function.
|
|
288
|
+
*/
|
|
289
|
+
asImageSrc: typeof asImageSrc;
|
|
290
|
+
/**
|
|
291
|
+
* Creates a width-based `srcset` from an Image field with optional image
|
|
292
|
+
* transformations (via Imgix URL parameters). This is `@prismicio/helpers`
|
|
293
|
+
* {@link asImageWidthSrcSet} function.
|
|
294
|
+
*/
|
|
295
|
+
asImageWidthSrcSet: typeof asImageWidthSrcSet;
|
|
296
|
+
/**
|
|
297
|
+
* Creates a pixel-density-based `srcset` from an Image field with optional
|
|
298
|
+
* image transformations (via Imgix URL parameters). This is
|
|
299
|
+
* `@prismicio/helpers` {@link asImagePixelDensitySrcSet} function.
|
|
300
|
+
*/
|
|
301
|
+
asImagePixelDensitySrcSet: typeof asImagePixelDensitySrcSet;
|
|
302
|
+
/**
|
|
303
|
+
* Converts a document into a link field. This is `@prismicio/helpers`
|
|
304
|
+
* {@link documentToLinkField} function.
|
|
305
|
+
*
|
|
306
|
+
* @internal
|
|
307
|
+
*/
|
|
308
|
+
documentToLinkField: typeof documentToLinkField;
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
* Methods and properties exposed by `@prismicio/vue` plugin and accessible
|
|
312
|
+
* through `this.$prismic` and `usePrismic()`.
|
|
313
|
+
*/
|
|
314
|
+
export type PrismicPlugin = {
|
|
315
|
+
/**
|
|
316
|
+
* Options uses to initialize the plugin.
|
|
317
|
+
*
|
|
318
|
+
* @see `@prismicio/vue` plugin options {@link PrismicPluginOptions}
|
|
319
|
+
*/
|
|
320
|
+
readonly options: PrismicPluginOptions;
|
|
321
|
+
/**
|
|
322
|
+
* `@prismicio/vue` plugin install function used by Vue.
|
|
323
|
+
*
|
|
324
|
+
* @internal
|
|
325
|
+
*/
|
|
326
|
+
install: (app: App) => void;
|
|
327
|
+
} & PrismicPluginClient & PrismicPluginHelpers;
|
|
328
|
+
/**
|
|
329
|
+
* States of a `@prismicio/client` composable.
|
|
330
|
+
*/
|
|
331
|
+
export declare const enum PrismicClientComposableState {
|
|
332
|
+
/**
|
|
333
|
+
* The composable has not started fetching.
|
|
334
|
+
*/
|
|
335
|
+
Idle = "idle",
|
|
336
|
+
/**
|
|
337
|
+
* The composable is fetching data.
|
|
338
|
+
*/
|
|
339
|
+
Pending = "pending",
|
|
340
|
+
/**
|
|
341
|
+
* The composable sucessfully fetched data.
|
|
342
|
+
*/
|
|
343
|
+
Success = "success",
|
|
344
|
+
/**
|
|
345
|
+
* The composable failed to fetch data.
|
|
346
|
+
*/
|
|
347
|
+
Error = "error"
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Type to transform a static object into one that allows passing Refs as
|
|
351
|
+
* values.
|
|
352
|
+
*
|
|
353
|
+
* @internal
|
|
354
|
+
*/
|
|
355
|
+
export type VueUseOptions<T> = {
|
|
356
|
+
[K in keyof T]: Ref<T[K]> | T[K];
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
359
|
+
* Type to transform a static tuple into one that allows passing Refs as values.
|
|
360
|
+
*
|
|
361
|
+
* @internal
|
|
362
|
+
*/
|
|
363
|
+
export type VueUseParameters<T> = {
|
|
364
|
+
[K in keyof T]: T extends number ? Ref<T[K]> | T[K] : T[K];
|
|
365
|
+
};
|
|
366
|
+
export {};
|