@prismicio/vue 3.0.0-alpha.5 → 3.0.0-alpha.6
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/index.cjs +40 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +312 -264
- package/dist/index.mjs +40 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/PrismicLink.ts +27 -15
- package/src/components/SliceZone.ts +75 -7
- package/src/components/index.ts +3 -1
- package/src/index.ts +2 -1
- package/src/types.ts +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,315 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { PropType, DefineComponent, FunctionalComponent, VNodeProps, AllowedComponentProps, ComponentCustomProps, ConcreteComponent, App, Ref, ComputedRef, InjectionKey } from 'vue';
|
|
3
3
|
import * as _prismicio_client from '@prismicio/client';
|
|
4
4
|
import { Client, ClientConfig, predicate, cookie, PrismicError, ParsingError, ForbiddenError } from '@prismicio/client';
|
|
5
5
|
import { asText, asHTML, asLink, LinkResolverFunction, asDate, documentToLinkField, HTMLFunctionSerializer, HTMLMapSerializer } from '@prismicio/helpers';
|
|
6
6
|
import * as _prismicio_types from '@prismicio/types';
|
|
7
|
-
import { EmbedField, ImageField, LinkField, PrismicDocument, RichTextField,
|
|
7
|
+
import { Slice, EmbedField, ImageField, LinkField, PrismicDocument, RichTextField, Query } from '@prismicio/types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The minimum required properties to represent a Prismic Slice for the
|
|
11
|
+
* `<SliceZone />` component.
|
|
12
|
+
*
|
|
13
|
+
* If using Prismic's REST API, use the `Slice` export from `@prismicio/types`
|
|
14
|
+
* for a full interface.
|
|
15
|
+
*
|
|
16
|
+
* @typeParam TSliceType - Type name of the Slice
|
|
17
|
+
*/
|
|
18
|
+
declare type SliceLike<TSliceType extends string = string> = Pick<Slice<TSliceType>, "slice_type">;
|
|
19
|
+
/**
|
|
20
|
+
* A looser version of the `SliceZone` type from `@prismicio/types` using `SliceLike`.
|
|
21
|
+
*
|
|
22
|
+
* If using Prismic's REST API, use the `SliceZone` export from
|
|
23
|
+
* `@prismicio/types` for the full type.
|
|
24
|
+
*
|
|
25
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
26
|
+
*/
|
|
27
|
+
declare type SliceZoneLike<TSlice extends SliceLike> = readonly TSlice[];
|
|
28
|
+
/**
|
|
29
|
+
* Vue props for a component rendering content from a Prismic Slice using the
|
|
30
|
+
* `<SliceZone />` component.
|
|
31
|
+
*
|
|
32
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
33
|
+
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
34
|
+
* available to all Slice components
|
|
35
|
+
*/
|
|
36
|
+
declare type SliceComponentProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
37
|
+
/**
|
|
38
|
+
* Slice data for this component.
|
|
39
|
+
*/
|
|
40
|
+
slice: TSlice;
|
|
41
|
+
/**
|
|
42
|
+
* The index of the Slice in the Slice Zone.
|
|
43
|
+
*/
|
|
44
|
+
index: number;
|
|
45
|
+
/**
|
|
46
|
+
* All Slices from the Slice Zone to which the Slice belongs.
|
|
47
|
+
*/
|
|
48
|
+
slices: SliceZoneLike<SliceLike>;
|
|
49
|
+
/**
|
|
50
|
+
* Arbitrary data passed to `<SliceZone />` and made available to all Slice components.
|
|
51
|
+
*/
|
|
52
|
+
context: TContext;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Native Vue props for a component rendering content from a Prismic Slice using
|
|
56
|
+
* the `<SliceZone />` component.
|
|
57
|
+
*
|
|
58
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
59
|
+
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
60
|
+
* available to all Slice components
|
|
61
|
+
*/
|
|
62
|
+
declare type DefineComponentSliceComponentProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
63
|
+
slice: {
|
|
64
|
+
type: PropType<SliceComponentProps<TSlice, TContext>["slice"]>;
|
|
65
|
+
required: true;
|
|
66
|
+
};
|
|
67
|
+
index: {
|
|
68
|
+
type: PropType<SliceComponentProps<TSlice, TContext>["index"]>;
|
|
69
|
+
required: true;
|
|
70
|
+
};
|
|
71
|
+
slices: {
|
|
72
|
+
type: PropType<SliceComponentProps<TSlice, TContext>["slices"]>;
|
|
73
|
+
required: true;
|
|
74
|
+
};
|
|
75
|
+
context: {
|
|
76
|
+
type: PropType<SliceComponentProps<TSlice, TContext>["context"]>;
|
|
77
|
+
required: true;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Gets native Vue props for a component rendering content from a Prismic Slice
|
|
82
|
+
* using the `<SliceZone />` component. Props are: `["slice", "index", "slices",
|
|
83
|
+
* "context"]`
|
|
84
|
+
*
|
|
85
|
+
* @example Defining a new slice component:
|
|
86
|
+
*
|
|
87
|
+
* ```javascript
|
|
88
|
+
* import { getSliceComponentProps } from "@prismicio/vue";
|
|
89
|
+
*
|
|
90
|
+
* export default {
|
|
91
|
+
* props: getSliceComponentProps(),
|
|
92
|
+
* };
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* @example Defining a new slice component with visual hint:
|
|
96
|
+
*
|
|
97
|
+
* ```javascript
|
|
98
|
+
* import { getSliceComponentProps } from "@prismicio/vue";
|
|
99
|
+
*
|
|
100
|
+
* export default {
|
|
101
|
+
* props: getSliceComponentProps(["slice", "index", "slices", "context"]),
|
|
102
|
+
* };
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
106
|
+
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
107
|
+
* available to all Slice components
|
|
108
|
+
* @param propsHint - An optional array of prop names used for the sole purpose
|
|
109
|
+
* of having a visual hint of which props are made available to the slice,
|
|
110
|
+
* this parameters doesn't have any effect
|
|
111
|
+
*
|
|
112
|
+
* @returns Props object to use with {@link defineComponent}
|
|
113
|
+
*/
|
|
114
|
+
declare const getSliceComponentProps: <TSlice extends SliceLike<string> = SliceLike<string>, TContext = unknown>(propsHint?: string[] | undefined) => DefineComponentSliceComponentProps<TSlice, TContext>;
|
|
115
|
+
/**
|
|
116
|
+
* A Vue component to be rendered for each instance of its Slice.
|
|
117
|
+
*
|
|
118
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
119
|
+
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
120
|
+
*/
|
|
121
|
+
declare type SliceComponentType<TSlice extends SliceLike = SliceLike, TContext = unknown> = DefineComponent<SliceComponentProps<TSlice, TContext>> | FunctionalComponent<SliceComponentProps<TSlice, TContext>>;
|
|
122
|
+
/**
|
|
123
|
+
* This Slice component can be used as a reminder to provide a proper implementation.
|
|
124
|
+
*
|
|
125
|
+
* This is also the default Vue component rendered when a component mapping
|
|
126
|
+
* cannot be found in `<SliceZone />`.
|
|
127
|
+
*/
|
|
128
|
+
declare const TODOSliceComponent: FunctionalComponent<SliceComponentProps<SliceLike<string>, unknown>, {}> | DefineComponent<SliceComponentProps<SliceLike<string>, unknown>, {}, {}, vue.ComputedOptions, vue.MethodOptions, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<SliceComponentProps<SliceLike<string>, unknown>>, {}>;
|
|
129
|
+
/**
|
|
130
|
+
* A record of Slice types mapped to Vue components. Each components will be
|
|
131
|
+
* rendered for each instance of their Slice type.
|
|
132
|
+
*
|
|
133
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
134
|
+
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
135
|
+
*/
|
|
136
|
+
declare type SliceZoneComponents<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
137
|
+
[SliceType in keyof Record<TSlice["slice_type"], never>]: SliceComponentType<Extract<TSlice, SliceLike<SliceType>>, TContext> | string;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Gets an optimized record of Slice types mapped to Vue components. Each
|
|
141
|
+
* components will be rendered for each instance of their Slice type.
|
|
142
|
+
*
|
|
143
|
+
* @remarks
|
|
144
|
+
* This is essentially an helper function to ensure {@link markRaw} is correctly
|
|
145
|
+
* applied on each components, improving performances.
|
|
146
|
+
* @example Defining a slice components:
|
|
147
|
+
*
|
|
148
|
+
* ```javascript
|
|
149
|
+
* import { defineSliceZoneComponents } from "@prismicio/vue";
|
|
150
|
+
*
|
|
151
|
+
* export default {
|
|
152
|
+
* data() {
|
|
153
|
+
* components: defineSliceZoneComponents({
|
|
154
|
+
* foo: Foo,
|
|
155
|
+
* bar: defineAsyncComponent(
|
|
156
|
+
* () => new Promise((res) => res(Bar)),
|
|
157
|
+
* ),
|
|
158
|
+
* baz: "Baz",
|
|
159
|
+
* }),
|
|
160
|
+
* }
|
|
161
|
+
* };
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
165
|
+
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
166
|
+
* @param components - {@link SliceZoneComponents}
|
|
167
|
+
*
|
|
168
|
+
* @returns A new optimized record of {@link SliceZoneComponents}
|
|
169
|
+
*/
|
|
170
|
+
declare const defineSliceZoneComponents: <TSlice extends SliceLike<string> = SliceLike<string>, TContext = unknown>(components: SliceZoneComponents<TSlice, TContext>) => SliceZoneComponents<TSlice, TContext>;
|
|
171
|
+
/**
|
|
172
|
+
* Arguments for a `<SliceZone>` `resolver` function.
|
|
173
|
+
*/
|
|
174
|
+
declare type SliceZoneResolverArgs<TSlice extends SliceLike = SliceLike> = {
|
|
175
|
+
/**
|
|
176
|
+
* The Slice to resolve to a Vue component..
|
|
177
|
+
*/
|
|
178
|
+
slice: TSlice;
|
|
179
|
+
/**
|
|
180
|
+
* The name of the Slice.
|
|
181
|
+
*/
|
|
182
|
+
sliceName: TSlice["slice_type"];
|
|
183
|
+
/**
|
|
184
|
+
* The index of the Slice in the Slice Zone.
|
|
185
|
+
*/
|
|
186
|
+
i: number;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* A function that determines the rendered Vue component for each Slice in the
|
|
190
|
+
* Slice Zone. If a nullish value is returned, the component will fallback to
|
|
191
|
+
* the `components` or `defaultComponent` props to determine the rendered component.
|
|
192
|
+
*
|
|
193
|
+
* @deprecated Use the `components` prop instead.
|
|
194
|
+
* @param args - Arguments for the resolver function.
|
|
195
|
+
*
|
|
196
|
+
* @returns The Vue component to render for a Slice.
|
|
197
|
+
*/
|
|
198
|
+
declare type SliceZoneResolver<TSlice extends SliceLike = SliceLike, TContext = unknown> = (args: SliceZoneResolverArgs<TSlice>) => SliceComponentType<TSlice, TContext> | string | undefined | null;
|
|
199
|
+
/**
|
|
200
|
+
* Props for `<SliceZone />`.
|
|
201
|
+
*
|
|
202
|
+
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
203
|
+
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
204
|
+
*/
|
|
205
|
+
declare type SliceZoneProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
206
|
+
/**
|
|
207
|
+
* List of Slice data from the Slice Zone.
|
|
208
|
+
*/
|
|
209
|
+
slices: SliceZoneLike<TSlice>;
|
|
210
|
+
/**
|
|
211
|
+
* A record mapping Slice types to Vue components.
|
|
212
|
+
*/
|
|
213
|
+
components?: SliceZoneComponents;
|
|
214
|
+
/**
|
|
215
|
+
* A function that determines the rendered Vue component for each Slice in the
|
|
216
|
+
* Slice Zone.
|
|
217
|
+
*
|
|
218
|
+
* @deprecated Use the `components` prop instead.
|
|
219
|
+
* @param args - Arguments for the resolver function.
|
|
220
|
+
*
|
|
221
|
+
* @returns The Vue component to render for a Slice.
|
|
222
|
+
*/
|
|
223
|
+
resolver?: SliceZoneResolver<TSlice, TContext>;
|
|
224
|
+
/**
|
|
225
|
+
* Arbitrary data made available to all Slice components.
|
|
226
|
+
*/
|
|
227
|
+
context?: TContext;
|
|
228
|
+
/**
|
|
229
|
+
* A component or a functional component rendered if a component mapping from
|
|
230
|
+
* the `components` prop cannot be found.
|
|
231
|
+
*
|
|
232
|
+
* @remarks
|
|
233
|
+
* Components will be rendered using the {@link SliceComponentProps} interface.
|
|
234
|
+
* @defaultValue The Slice Zone default component provided to `@prismicio/vue` plugin if configured, otherwise `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}.
|
|
235
|
+
*/
|
|
236
|
+
defaultComponent?: SliceComponentType<TSlice, TContext>;
|
|
237
|
+
/**
|
|
238
|
+
* An HTML tag name, a component, or a functional component used to wrap the
|
|
239
|
+
* output. The Slice Zone is not wrapped by default.
|
|
240
|
+
*/
|
|
241
|
+
wrapper?: string | ConcreteComponent;
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* `<SliceZone />` implementation.
|
|
245
|
+
*
|
|
246
|
+
* @internal
|
|
247
|
+
*/
|
|
248
|
+
declare const SliceZoneImpl: DefineComponent<{
|
|
249
|
+
slices: {
|
|
250
|
+
type: PropType<SliceZoneLike<SliceLike<string>>>;
|
|
251
|
+
required: true;
|
|
252
|
+
};
|
|
253
|
+
components: {
|
|
254
|
+
type: PropType<SliceZoneComponents<SliceLike<string>, unknown>>;
|
|
255
|
+
default: undefined;
|
|
256
|
+
required: false;
|
|
257
|
+
};
|
|
258
|
+
resolver: {
|
|
259
|
+
type: PropType<SliceZoneResolver<SliceLike<string>, unknown>>;
|
|
260
|
+
default: undefined;
|
|
261
|
+
required: false;
|
|
262
|
+
};
|
|
263
|
+
context: {
|
|
264
|
+
type: null;
|
|
265
|
+
default: undefined;
|
|
266
|
+
required: false;
|
|
267
|
+
};
|
|
268
|
+
defaultComponent: {
|
|
269
|
+
type: PropType<SliceComponentType<SliceLike<string>, unknown>>;
|
|
270
|
+
default: undefined;
|
|
271
|
+
required: false;
|
|
272
|
+
};
|
|
273
|
+
wrapper: {
|
|
274
|
+
type: PropType<string | ConcreteComponent<{}, any, any, vue.ComputedOptions, vue.MethodOptions>>;
|
|
275
|
+
default: undefined;
|
|
276
|
+
required: false;
|
|
277
|
+
};
|
|
278
|
+
}, (() => null) | (() => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
279
|
+
[key: string]: any;
|
|
280
|
+
}> | vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
281
|
+
[key: string]: any;
|
|
282
|
+
}>[]), unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{
|
|
283
|
+
slices?: unknown;
|
|
284
|
+
components?: unknown;
|
|
285
|
+
resolver?: unknown;
|
|
286
|
+
context?: unknown;
|
|
287
|
+
defaultComponent?: unknown;
|
|
288
|
+
wrapper?: unknown;
|
|
289
|
+
} & {
|
|
290
|
+
slices: SliceZoneLike<SliceLike<string>>;
|
|
291
|
+
} & {
|
|
292
|
+
wrapper?: string | ConcreteComponent<{}, any, any, vue.ComputedOptions, vue.MethodOptions> | undefined;
|
|
293
|
+
context?: any;
|
|
294
|
+
components?: SliceZoneComponents<SliceLike<string>, unknown> | undefined;
|
|
295
|
+
resolver?: SliceZoneResolver<SliceLike<string>, unknown> | undefined;
|
|
296
|
+
defaultComponent?: SliceComponentType<SliceLike<string>, unknown> | undefined;
|
|
297
|
+
}>, {
|
|
298
|
+
wrapper: string | ConcreteComponent<{}, any, any, vue.ComputedOptions, vue.MethodOptions>;
|
|
299
|
+
context: any;
|
|
300
|
+
components: SliceZoneComponents<SliceLike<string>, unknown>;
|
|
301
|
+
resolver: SliceZoneResolver<SliceLike<string>, unknown>;
|
|
302
|
+
defaultComponent: SliceComponentType<SliceLike<string>, unknown>;
|
|
303
|
+
}>;
|
|
304
|
+
/**
|
|
305
|
+
* Component to render a Prismic Slice Zone.
|
|
306
|
+
*
|
|
307
|
+
* @see Component props {@link SliceZoneProps}
|
|
308
|
+
* @see Templating Slice Zones {@link https://prismic.io/docs/technologies/vue-template-content#slices-and-groups}
|
|
309
|
+
*/
|
|
310
|
+
declare const SliceZone: new () => {
|
|
311
|
+
$props: AllowedComponentProps & ComponentCustomProps & VNodeProps & SliceZoneProps;
|
|
312
|
+
};
|
|
8
313
|
|
|
9
314
|
/**
|
|
10
315
|
* Options used by `@prismicio/vue` components.
|
|
@@ -60,7 +365,7 @@ declare type PrismicPluginComponentsOptions = {
|
|
|
60
365
|
* Components will be rendered using the {@link SliceComponentProps} interface.
|
|
61
366
|
* @defaultValue `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}
|
|
62
367
|
*/
|
|
63
|
-
sliceZoneDefaultComponent?:
|
|
368
|
+
sliceZoneDefaultComponent?: SliceComponentType;
|
|
64
369
|
};
|
|
65
370
|
/**
|
|
66
371
|
* Common options supported by `@prismicio/vue` plugin.
|
|
@@ -419,17 +724,17 @@ declare type PrismicLinkProps = {
|
|
|
419
724
|
/**
|
|
420
725
|
* An explicit `target` attribute to apply to the rendered link.
|
|
421
726
|
*/
|
|
422
|
-
target?: string;
|
|
727
|
+
target?: string | null;
|
|
423
728
|
/**
|
|
424
729
|
* An explicit `rel` attribute to apply to the rendered link.
|
|
425
730
|
*/
|
|
426
|
-
rel?: string;
|
|
731
|
+
rel?: string | null;
|
|
427
732
|
/**
|
|
428
733
|
* Value of the `rel` attribute to use on links rendered with `target="_blank"`.
|
|
429
734
|
*
|
|
430
735
|
* @defaultValue The one provided to `@prismicio/vue` plugin if configured, `"noopener noreferrer"` otherwise.
|
|
431
736
|
*/
|
|
432
|
-
blankTargetRelAttribute?: string;
|
|
737
|
+
blankTargetRelAttribute?: string | null;
|
|
433
738
|
/**
|
|
434
739
|
* An HTML tag name, a component, or a functional component used to render
|
|
435
740
|
* internal links.
|
|
@@ -613,263 +918,6 @@ declare const PrismicRichText: new () => {
|
|
|
613
918
|
$props: AllowedComponentProps & ComponentCustomProps & VNodeProps & PrismicRichTextProps;
|
|
614
919
|
};
|
|
615
920
|
|
|
616
|
-
/**
|
|
617
|
-
* The minimum required properties to represent a Prismic Slice for the
|
|
618
|
-
* `<SliceZone />` component.
|
|
619
|
-
*
|
|
620
|
-
* If using Prismic's REST API, use the `Slice` export from `@prismicio/types`
|
|
621
|
-
* for a full interface.
|
|
622
|
-
*
|
|
623
|
-
* @typeParam TSliceType - Type name of the Slice
|
|
624
|
-
*/
|
|
625
|
-
declare type SliceLike<TSliceType extends string = string> = Pick<Slice<TSliceType>, "slice_type">;
|
|
626
|
-
/**
|
|
627
|
-
* A looser version of the `SliceZone` type from `@prismicio/types` using `SliceLike`.
|
|
628
|
-
*
|
|
629
|
-
* If using Prismic's REST API, use the `SliceZone` export from
|
|
630
|
-
* `@prismicio/types` for the full type.
|
|
631
|
-
*
|
|
632
|
-
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
633
|
-
*/
|
|
634
|
-
declare type SliceZoneLike<TSlice extends SliceLike> = readonly TSlice[];
|
|
635
|
-
/**
|
|
636
|
-
* Vue props for a component rendering content from a Prismic Slice using the
|
|
637
|
-
* `<SliceZone />` component.
|
|
638
|
-
*
|
|
639
|
-
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
640
|
-
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
641
|
-
* available to all Slice components
|
|
642
|
-
*/
|
|
643
|
-
declare type SliceComponentProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
644
|
-
/**
|
|
645
|
-
* Slice data for this component.
|
|
646
|
-
*/
|
|
647
|
-
slice: TSlice;
|
|
648
|
-
/**
|
|
649
|
-
* The index of the Slice in the Slice Zone.
|
|
650
|
-
*/
|
|
651
|
-
index: number;
|
|
652
|
-
/**
|
|
653
|
-
* All Slices from the Slice Zone to which the Slice belongs.
|
|
654
|
-
*/
|
|
655
|
-
slices: SliceZoneLike<SliceLike>;
|
|
656
|
-
/**
|
|
657
|
-
* Arbitrary data passed to `<SliceZone />` and made available to all Slice components.
|
|
658
|
-
*/
|
|
659
|
-
context: TContext;
|
|
660
|
-
};
|
|
661
|
-
/**
|
|
662
|
-
* Native Vue props for a component rendering content from a Prismic Slice using
|
|
663
|
-
* the `<SliceZone />` component.
|
|
664
|
-
*
|
|
665
|
-
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
666
|
-
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
667
|
-
* available to all Slice components
|
|
668
|
-
*/
|
|
669
|
-
declare type DefineComponentSliceComponentProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
670
|
-
slice: {
|
|
671
|
-
type: PropType<SliceComponentProps<TSlice, TContext>["slice"]>;
|
|
672
|
-
required: true;
|
|
673
|
-
};
|
|
674
|
-
index: {
|
|
675
|
-
type: PropType<SliceComponentProps<TSlice, TContext>["index"]>;
|
|
676
|
-
required: true;
|
|
677
|
-
};
|
|
678
|
-
slices: {
|
|
679
|
-
type: PropType<SliceComponentProps<TSlice, TContext>["slices"]>;
|
|
680
|
-
required: true;
|
|
681
|
-
};
|
|
682
|
-
context: {
|
|
683
|
-
type: PropType<SliceComponentProps<TSlice, TContext>["context"]>;
|
|
684
|
-
required: true;
|
|
685
|
-
};
|
|
686
|
-
};
|
|
687
|
-
/**
|
|
688
|
-
* Gets native Vue props for a component rendering content from a Prismic Slice
|
|
689
|
-
* using the `<SliceZone />` component. Props are: `["slice", "index", "slices",
|
|
690
|
-
* "context"]`
|
|
691
|
-
*
|
|
692
|
-
* @example Defining a new slice component:
|
|
693
|
-
*
|
|
694
|
-
* ```javascript
|
|
695
|
-
* import { getSliceComponentProps } from "@prismicio/vue";
|
|
696
|
-
*
|
|
697
|
-
* export default {
|
|
698
|
-
* props: getSliceComponentProps(),
|
|
699
|
-
* };
|
|
700
|
-
* ```
|
|
701
|
-
*
|
|
702
|
-
* @example Defining a new slice component with visual hint:
|
|
703
|
-
*
|
|
704
|
-
* ```javascript
|
|
705
|
-
* import { getSliceComponentProps } from "@prismicio/vue";
|
|
706
|
-
*
|
|
707
|
-
* export default {
|
|
708
|
-
* props: getSliceComponentProps(["slice", "index", "slices", "context"]),
|
|
709
|
-
* };
|
|
710
|
-
* ```
|
|
711
|
-
*
|
|
712
|
-
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
713
|
-
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
714
|
-
* available to all Slice components
|
|
715
|
-
* @param propsHint - An optional array of prop names used for the sole purpose
|
|
716
|
-
* of having a visual hint of which props are made available to the slice,
|
|
717
|
-
* this parameters doesn't have any effect
|
|
718
|
-
*
|
|
719
|
-
* @returns Props object to use with {@link defineComponent}
|
|
720
|
-
*/
|
|
721
|
-
declare const getSliceComponentProps: <TSlice extends SliceLike<string> = SliceLike<string>, TContext = unknown>(propsHint?: string[] | undefined) => DefineComponentSliceComponentProps<TSlice, TContext>;
|
|
722
|
-
/**
|
|
723
|
-
* A Vue component to be rendered for each instance of its Slice.
|
|
724
|
-
*
|
|
725
|
-
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
726
|
-
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
727
|
-
*/
|
|
728
|
-
declare type SliceComponentType<TSlice extends SliceLike = SliceLike, TContext = unknown> = DefineComponent<SliceComponentProps<TSlice, TContext>> | FunctionalComponent<SliceComponentProps<TSlice, TContext>>;
|
|
729
|
-
/**
|
|
730
|
-
* This Slice component can be used as a reminder to provide a proper implementation.
|
|
731
|
-
*
|
|
732
|
-
* This is also the default Vue component rendered when a component mapping
|
|
733
|
-
* cannot be found in `<SliceZone />`.
|
|
734
|
-
*/
|
|
735
|
-
declare const TODOSliceComponent: FunctionalComponent<SliceComponentProps<SliceLike<string>, unknown>, {}> | DefineComponent<SliceComponentProps<SliceLike<string>, unknown>, {}, {}, vue.ComputedOptions, vue.MethodOptions, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<SliceComponentProps<SliceLike<string>, unknown>>, {}>;
|
|
736
|
-
/**
|
|
737
|
-
* A record of Slice types mapped to Vue components. Each components will be
|
|
738
|
-
* rendered for each instance of their Slice type.
|
|
739
|
-
*
|
|
740
|
-
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
741
|
-
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
742
|
-
*/
|
|
743
|
-
declare type SliceZoneComponents<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
744
|
-
[SliceType in keyof Record<TSlice["slice_type"], never>]: SliceComponentType<Extract<TSlice, SliceLike<SliceType>>, TContext> | string;
|
|
745
|
-
};
|
|
746
|
-
/**
|
|
747
|
-
* Gets an optimized record of Slice types mapped to Vue components. Each
|
|
748
|
-
* components will be rendered for each instance of their Slice type.
|
|
749
|
-
*
|
|
750
|
-
* @remarks
|
|
751
|
-
* This is essentially an helper function to ensure {@link markRaw} is correctly
|
|
752
|
-
* applied on each components, improving performances.
|
|
753
|
-
* @example Defining a slice components:
|
|
754
|
-
*
|
|
755
|
-
* ```javascript
|
|
756
|
-
* import { getSliceZoneComponents } from "@prismicio/vue";
|
|
757
|
-
*
|
|
758
|
-
* export default {
|
|
759
|
-
* data() {
|
|
760
|
-
* components: getSliceZoneComponents({
|
|
761
|
-
* foo: Foo,
|
|
762
|
-
* bar: defineAsyncComponent(
|
|
763
|
-
* () => new Promise((res) => res(Bar)),
|
|
764
|
-
* ),
|
|
765
|
-
* baz: "Baz",
|
|
766
|
-
* }),
|
|
767
|
-
* }
|
|
768
|
-
* };
|
|
769
|
-
* ```
|
|
770
|
-
*
|
|
771
|
-
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
772
|
-
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
773
|
-
* @param components - {@link SliceZoneComponents}
|
|
774
|
-
*
|
|
775
|
-
* @returns A new optimized record of {@link SliceZoneComponents}
|
|
776
|
-
*/
|
|
777
|
-
declare const getSliceZoneComponents: <TSlice extends SliceLike<string> = SliceLike<string>, TContext = unknown>(components: SliceZoneComponents<TSlice, TContext>) => SliceZoneComponents<TSlice, TContext>;
|
|
778
|
-
/**
|
|
779
|
-
* Props for `<SliceZone />`.
|
|
780
|
-
*
|
|
781
|
-
* @typeParam TSlice - The type(s) of slices in the Slice Zone
|
|
782
|
-
* @typeParam TContext - Arbitrary data made available to all Slice components
|
|
783
|
-
*/
|
|
784
|
-
declare type SliceZoneProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
785
|
-
/**
|
|
786
|
-
* List of Slice data from the Slice Zone.
|
|
787
|
-
*/
|
|
788
|
-
slices: SliceZoneLike<TSlice>;
|
|
789
|
-
/**
|
|
790
|
-
* A record mapping Slice types to Vue components.
|
|
791
|
-
*/
|
|
792
|
-
components: SliceZoneComponents;
|
|
793
|
-
/**
|
|
794
|
-
* Arbitrary data made available to all Slice components.
|
|
795
|
-
*/
|
|
796
|
-
context?: TContext;
|
|
797
|
-
/**
|
|
798
|
-
* A component or a functional component rendered if a component mapping from
|
|
799
|
-
* the `components` prop cannot be found.
|
|
800
|
-
*
|
|
801
|
-
* @remarks
|
|
802
|
-
* Components will be rendered using the {@link SliceComponentProps} interface.
|
|
803
|
-
* @defaultValue The Slice Zone default component provided to `@prismicio/vue` plugin if configured, otherwise `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}.
|
|
804
|
-
*/
|
|
805
|
-
defaultComponent?: SliceComponentType<TSlice, TContext>;
|
|
806
|
-
/**
|
|
807
|
-
* An HTML tag name, a component, or a functional component used to wrap the
|
|
808
|
-
* output. The Slice Zone is not wrapped by default.
|
|
809
|
-
*/
|
|
810
|
-
wrapper?: string | ConcreteComponent;
|
|
811
|
-
};
|
|
812
|
-
/**
|
|
813
|
-
* `<SliceZone />` implementation.
|
|
814
|
-
*
|
|
815
|
-
* @internal
|
|
816
|
-
*/
|
|
817
|
-
declare const SliceZoneImpl: DefineComponent<{
|
|
818
|
-
slices: {
|
|
819
|
-
type: PropType<SliceZoneLike<SliceLike<string>>>;
|
|
820
|
-
required: true;
|
|
821
|
-
};
|
|
822
|
-
components: {
|
|
823
|
-
type: PropType<SliceZoneComponents<SliceLike<string>, unknown>>;
|
|
824
|
-
required: true;
|
|
825
|
-
};
|
|
826
|
-
context: {
|
|
827
|
-
type: null;
|
|
828
|
-
default: undefined;
|
|
829
|
-
required: false;
|
|
830
|
-
};
|
|
831
|
-
defaultComponent: {
|
|
832
|
-
type: PropType<SliceComponentType<SliceLike<string>, unknown>>;
|
|
833
|
-
default: undefined;
|
|
834
|
-
required: false;
|
|
835
|
-
};
|
|
836
|
-
wrapper: {
|
|
837
|
-
type: PropType<string | ConcreteComponent<{}, any, any, vue.ComputedOptions, vue.MethodOptions>>;
|
|
838
|
-
default: undefined;
|
|
839
|
-
required: false;
|
|
840
|
-
};
|
|
841
|
-
}, (() => null) | (() => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
842
|
-
[key: string]: any;
|
|
843
|
-
}> | vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
844
|
-
[key: string]: any;
|
|
845
|
-
}>[]), unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{
|
|
846
|
-
slices?: unknown;
|
|
847
|
-
components?: unknown;
|
|
848
|
-
context?: unknown;
|
|
849
|
-
defaultComponent?: unknown;
|
|
850
|
-
wrapper?: unknown;
|
|
851
|
-
} & {
|
|
852
|
-
slices: SliceZoneLike<SliceLike<string>>;
|
|
853
|
-
components: SliceZoneComponents<SliceLike<string>, unknown>;
|
|
854
|
-
} & {
|
|
855
|
-
wrapper?: string | ConcreteComponent<{}, any, any, vue.ComputedOptions, vue.MethodOptions> | undefined;
|
|
856
|
-
context?: any;
|
|
857
|
-
defaultComponent?: SliceComponentType<SliceLike<string>, unknown> | undefined;
|
|
858
|
-
}>, {
|
|
859
|
-
wrapper: string | ConcreteComponent<{}, any, any, vue.ComputedOptions, vue.MethodOptions>;
|
|
860
|
-
context: any;
|
|
861
|
-
defaultComponent: SliceComponentType<SliceLike<string>, unknown>;
|
|
862
|
-
}>;
|
|
863
|
-
/**
|
|
864
|
-
* Component to render a Prismic Slice Zone.
|
|
865
|
-
*
|
|
866
|
-
* @see Component props {@link SliceZoneProps}
|
|
867
|
-
* @see Templating Slice Zones {@link https://prismic.io/docs/technologies/vue-template-content#slices-and-groups}
|
|
868
|
-
*/
|
|
869
|
-
declare const SliceZone: new () => {
|
|
870
|
-
$props: AllowedComponentProps & ComponentCustomProps & VNodeProps & SliceZoneProps;
|
|
871
|
-
};
|
|
872
|
-
|
|
873
921
|
declare type ClientError = PrismicError<unknown> | ParsingError | ForbiddenError;
|
|
874
922
|
/**
|
|
875
923
|
* @internal
|
|
@@ -1172,4 +1220,4 @@ declare module "@vue/runtime-core" {
|
|
|
1172
1220
|
}
|
|
1173
1221
|
}
|
|
1174
1222
|
|
|
1175
|
-
export { ClientComposableReturnType, DefineComponentSliceComponentProps, PrismicClientComposableState, PrismicEmbed, PrismicEmbedProps, PrismicImage, PrismicImageProps, PrismicLink, PrismicLinkProps, PrismicPlugin, PrismicPluginOptions, PrismicRichText, PrismicRichTextProps, PrismicText, PrismicTextProps, SliceComponentProps, SliceComponentType, SliceLike, SliceZone, SliceZoneComponents, SliceZoneImpl, SliceZoneLike, SliceZoneProps, TODOSliceComponent, UsePrismicLinkOptions, UsePrismicRichTextOptions, UsePrismicTextOptions, createPrismic, dangerouslyUseAllPrismicDocuments,
|
|
1223
|
+
export { ClientComposableReturnType, DefineComponentSliceComponentProps, PrismicClientComposableState, PrismicEmbed, PrismicEmbedProps, PrismicImage, PrismicImageProps, PrismicLink, PrismicLinkProps, PrismicPlugin, PrismicPluginOptions, PrismicRichText, PrismicRichTextProps, PrismicText, PrismicTextProps, SliceComponentProps, SliceComponentType, SliceLike, SliceZone, SliceZoneComponents, SliceZoneImpl, SliceZoneLike, SliceZoneProps, SliceZoneResolver, TODOSliceComponent, UsePrismicLinkOptions, UsePrismicRichTextOptions, UsePrismicTextOptions, createPrismic, dangerouslyUseAllPrismicDocuments, defineSliceZoneComponents, getSliceComponentProps, prismicKey, useAllPrismicDocumentsByEveryTag, useAllPrismicDocumentsByIDs, useAllPrismicDocumentsBySomeTags, useAllPrismicDocumentsByTag, useAllPrismicDocumentsByType, useAllPrismicDocumentsByUIDs, useFirstPrismicDocument, usePrismic, usePrismicDocumentByID, usePrismicDocumentByUID, usePrismicDocuments, usePrismicDocumentsByEveryTag, usePrismicDocumentsByIDs, usePrismicDocumentsBySomeTags, usePrismicDocumentsByTag, usePrismicDocumentsByType, usePrismicDocumentsByUIDs, usePrismicLink, usePrismicRichText, usePrismicText, useSinglePrismicDocument };
|