@prismicio/vue 3.0.0-beta.5 → 3.0.0-beta.8

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.d.ts CHANGED
@@ -5,6 +5,33 @@ import { Client, ClientConfig, predicate, cookie, PrismicError, ParsingError, Fo
5
5
  import { asText, asHTML, asLink, LinkResolverFunction, asDate, asImageSrc, asImageWidthSrcSet, asImagePixelDensitySrcSet, documentToLinkField, HTMLFunctionSerializer, HTMLMapSerializer } from '@prismicio/helpers';
6
6
  import { Slice, EmbedField, ImageField, LinkField, PrismicDocument, RichTextField, Query } from '@prismicio/types';
7
7
 
8
+ /**
9
+ * Returns the type of a `SliceLike` type.
10
+ *
11
+ * @typeParam TSlice - The Slice from which the type will be extracted.
12
+ */
13
+ declare type ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2 ? TSlice["slice_type"] : TSlice extends SliceLikeGraphQL ? TSlice["type"] : never;
14
+ /**
15
+ * The minimum required properties to represent a Prismic Slice from the Prismic
16
+ * Rest API V2 for the `<SliceZone>` component.
17
+ *
18
+ * If using Prismic's Rest API V2, use the `Slice` export from
19
+ * `@prismicio/types` for a full interface.
20
+ *
21
+ * @typeParam TSliceType - Type name of the Slice.
22
+ */
23
+ declare type SliceLikeRestV2<TSliceType extends string = string> = {
24
+ slice_type: Slice<TSliceType>["slice_type"];
25
+ };
26
+ /**
27
+ * The minimum required properties to represent a Prismic Slice from the Prismic
28
+ * GraphQL API for the `<SliceZone>` component.
29
+ *
30
+ * @typeParam TSliceType - Type name of the Slice.
31
+ */
32
+ declare type SliceLikeGraphQL<TSliceType extends string = string> = {
33
+ type: Slice<TSliceType>["slice_type"];
34
+ };
8
35
  /**
9
36
  * The minimum required properties to represent a Prismic Slice for the
10
37
  * `<SliceZone />` component.
@@ -14,7 +41,7 @@ import { Slice, EmbedField, ImageField, LinkField, PrismicDocument, RichTextFiel
14
41
  *
15
42
  * @typeParam TSliceType - Type name of the Slice
16
43
  */
17
- declare type SliceLike<TSliceType extends string = string> = Pick<Slice<TSliceType>, "slice_type">;
44
+ declare type SliceLike<TSliceType extends string = string> = SliceLikeRestV2<TSliceType> | SliceLikeGraphQL<TSliceType>;
18
45
  /**
19
46
  * A looser version of the `SliceZone` type from `@prismicio/types` using `SliceLike`.
20
47
  *
@@ -23,7 +50,7 @@ declare type SliceLike<TSliceType extends string = string> = Pick<Slice<TSliceTy
23
50
  *
24
51
  * @typeParam TSlice - The type(s) of slices in the Slice Zone
25
52
  */
26
- declare type SliceZoneLike<TSlice extends SliceLike> = readonly TSlice[];
53
+ declare type SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[];
27
54
  /**
28
55
  * Vue props for a component rendering content from a Prismic Slice using the
29
56
  * `<SliceZone />` component.
@@ -32,7 +59,7 @@ declare type SliceZoneLike<TSlice extends SliceLike> = readonly TSlice[];
32
59
  * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
33
60
  * available to all Slice components
34
61
  */
35
- declare type SliceComponentProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
62
+ declare type SliceComponentProps<TSlice extends SliceLike = any, TContext = unknown> = {
36
63
  /**
37
64
  * Slice data for this component.
38
65
  */
@@ -58,7 +85,7 @@ declare type SliceComponentProps<TSlice extends SliceLike = SliceLike, TContext
58
85
  * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
59
86
  * available to all Slice components
60
87
  */
61
- declare type DefineComponentSliceComponentProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
88
+ declare type DefineComponentSliceComponentProps<TSlice extends SliceLike = any, TContext = unknown> = {
62
89
  slice: {
63
90
  type: PropType<SliceComponentProps<TSlice, TContext>["slice"]>;
64
91
  required: true;
@@ -110,21 +137,23 @@ declare type DefineComponentSliceComponentProps<TSlice extends SliceLike = Slice
110
137
  *
111
138
  * @returns Props object to use with {@link defineComponent}
112
139
  */
113
- declare const getSliceComponentProps: <TSlice extends SliceLike<string> = SliceLike<string>, TContext = unknown>(propsHint?: ["slice", "index", "slices", "context"] | undefined) => DefineComponentSliceComponentProps<TSlice, TContext>;
140
+ declare const getSliceComponentProps: <TSlice extends SliceLike<string> = SliceLike<string>, TContext = unknown>(propsHint?: ["slice", "index", "slices", "context"]) => DefineComponentSliceComponentProps<TSlice, TContext>;
114
141
  /**
115
142
  * A Vue component to be rendered for each instance of its Slice.
116
143
  *
117
144
  * @typeParam TSlice - The type(s) of slices in the Slice Zone
118
145
  * @typeParam TContext - Arbitrary data made available to all Slice components
119
146
  */
120
- declare type SliceComponentType<TSlice extends SliceLike = SliceLike, TContext = unknown> = DefineComponent<SliceComponentProps<TSlice, TContext>> | FunctionalComponent<SliceComponentProps<TSlice, TContext>>;
147
+ declare type SliceComponentType<TSlice extends SliceLike = any, TContext = unknown> = DefineComponent<SliceComponentProps<TSlice, TContext>> | FunctionalComponent<SliceComponentProps<TSlice, TContext>>;
121
148
  /**
122
149
  * This Slice component can be used as a reminder to provide a proper implementation.
123
150
  *
124
151
  * This is also the default Vue component rendered when a component mapping
125
152
  * cannot be found in `<SliceZone />`.
126
153
  */
127
- 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>>, {}>;
154
+ declare const TODOSliceComponent: FunctionalComponent<SliceComponentProps<any, unknown>, {}> | DefineComponent<SliceComponentProps<any, unknown>, {}, {}, vue.ComputedOptions, vue.MethodOptions, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<SliceComponentProps<any, unknown>>, {
155
+ slice: any;
156
+ }>;
128
157
  /**
129
158
  * A record of Slice types mapped to Vue components. Each components will be
130
159
  * rendered for each instance of their Slice type.
@@ -133,7 +162,7 @@ declare const TODOSliceComponent: FunctionalComponent<SliceComponentProps<SliceL
133
162
  * @typeParam TContext - Arbitrary data made available to all Slice components
134
163
  */
135
164
  declare type SliceZoneComponents<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
136
- [SliceType in keyof Record<TSlice["slice_type"], never>]: SliceComponentType<Extract<TSlice, SliceLike<SliceType>>, TContext> | string;
165
+ [SliceType in ExtractSliceType<TSlice>]: SliceComponentType<Extract<TSlice, SliceLike<SliceType>>, TContext> | string;
137
166
  };
138
167
  /**
139
168
  * Gets an optimized record of Slice types mapped to Vue components. Each
@@ -167,7 +196,7 @@ declare type SliceZoneComponents<TSlice extends SliceLike = SliceLike, TContext
167
196
  *
168
197
  * @returns A new optimized record of {@link SliceZoneComponents}
169
198
  */
170
- declare const defineSliceZoneComponents: <TSlice extends SliceLike<string> = SliceLike<string>, TContext = unknown>(components: SliceZoneComponents<TSlice, TContext>) => SliceZoneComponents<TSlice, TContext>;
199
+ declare const defineSliceZoneComponents: <TSlice extends SliceLike<string> = any, TContext = unknown>(components: SliceZoneComponents<TSlice, TContext>) => SliceZoneComponents<TSlice, TContext>;
171
200
  /**
172
201
  * Arguments for a `<SliceZone>` `resolver` function.
173
202
  */
@@ -179,7 +208,7 @@ declare type SliceZoneResolverArgs<TSlice extends SliceLike = SliceLike> = {
179
208
  /**
180
209
  * The name of the Slice.
181
210
  */
182
- sliceName: TSlice["slice_type"];
211
+ sliceName: ExtractSliceType<TSlice>;
183
212
  /**
184
213
  * The index of the Slice in the Slice Zone.
185
214
  */
@@ -196,18 +225,17 @@ declare type SliceZoneResolverArgs<TSlice extends SliceLike = SliceLike> = {
196
225
  *
197
226
  * @returns The Vue component to render for a Slice.
198
227
  */
199
- declare type SliceZoneResolver<TSlice extends SliceLike = SliceLike, TContext = unknown> = (args: SliceZoneResolverArgs<TSlice>) => SliceComponentType<TSlice, TContext> | string | undefined | null;
228
+ declare type SliceZoneResolver<TSlice extends SliceLike = any, TContext = unknown> = (args: SliceZoneResolverArgs<TSlice>) => SliceComponentType<any, TContext> | string | undefined | null;
200
229
  /**
201
230
  * Props for `<SliceZone />`.
202
231
  *
203
- * @typeParam TSlice - The type(s) of slices in the Slice Zone
204
232
  * @typeParam TContext - Arbitrary data made available to all Slice components
205
233
  */
206
- declare type SliceZoneProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
234
+ declare type SliceZoneProps<TContext = unknown> = {
207
235
  /**
208
236
  * List of Slice data from the Slice Zone.
209
237
  */
210
- slices: SliceZoneLike<TSlice>;
238
+ slices: SliceZoneLike;
211
239
  /**
212
240
  * A record mapping Slice types to Vue components.
213
241
  */
@@ -222,7 +250,7 @@ declare type SliceZoneProps<TSlice extends SliceLike = SliceLike, TContext = unk
222
250
  *
223
251
  * @returns The Vue component to render for a Slice.
224
252
  */
225
- resolver?: SliceZoneResolver<TSlice, TContext>;
253
+ resolver?: SliceZoneResolver<any, TContext>;
226
254
  /**
227
255
  * Arbitrary data made available to all Slice components.
228
256
  */
@@ -236,7 +264,7 @@ declare type SliceZoneProps<TSlice extends SliceLike = SliceLike, TContext = unk
236
264
  *
237
265
  * @defaultValue The Slice Zone default component provided to `@prismicio/vue` plugin if configured, otherwise `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}.
238
266
  */
239
- defaultComponent?: SliceComponentType<TSlice, TContext>;
267
+ defaultComponent?: SliceComponentType<any, TContext>;
240
268
  /**
241
269
  * An HTML tag name, a component, or a functional component used to wrap the
242
270
  * output. The Slice Zone is not wrapped by default.
@@ -677,8 +705,8 @@ declare type PrismicImageProps = {
677
705
  * Adds an additional `srcset` attribute to the image following given widths.
678
706
  *
679
707
  * @remarks
680
- * A special value of `"auto"` is accepted to automatically use image widths
681
- * coming from the API.
708
+ * A special value of `"thumbnails"` is accepted to automatically use image
709
+ * widths coming from the API.
682
710
  * @remarks
683
711
  * A special value of `"defaults"` is accepted to automatically use image
684
712
  * widths coming from the plugin configuration.
@@ -686,7 +714,7 @@ declare type PrismicImageProps = {
686
714
  * This prop is not compatible with the `pixelDensities` prop. When both are
687
715
  * used the `pixelDensities` prop will be ignored.
688
716
  */
689
- widths?: NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>["widths"] | "auto" | "defaults";
717
+ widths?: NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>["widths"] | "thumbnails" | "defaults";
690
718
  /**
691
719
  * Adds an additional `srcset` attribute to the image following giving pixel densities.
692
720
  *
@@ -850,7 +878,7 @@ declare type PrismicTextProps = {
850
878
  /**
851
879
  * The Prismic rich text or title field to render.
852
880
  */
853
- field: RichTextField;
881
+ field: RichTextField | null | undefined;
854
882
  /**
855
883
  * Separator used to join each element.
856
884
  *
@@ -863,6 +891,11 @@ declare type PrismicTextProps = {
863
891
  * @defaultValue `"div"`
864
892
  */
865
893
  wrapper?: string | ConcreteComponent;
894
+ /**
895
+ * The string value to be rendered when the field is empty. If a fallback is
896
+ * not given, `""` (nothing) will be rendered.
897
+ */
898
+ fallback?: string;
866
899
  };
867
900
  /**
868
901
  * Options for {@link usePrismicText}.
@@ -902,7 +935,7 @@ declare type PrismicRichTextProps = {
902
935
  /**
903
936
  * The Prismic rich text or title field to render.
904
937
  */
905
- field: RichTextField;
938
+ field: RichTextField | null | undefined;
906
939
  /**
907
940
  * A link resolver function used to resolve link when not using the route
908
941
  * resolver parameter with `@prismicio/client`.
@@ -926,6 +959,11 @@ declare type PrismicRichTextProps = {
926
959
  * @defaultValue `"div"`
927
960
  */
928
961
  wrapper?: string | ConcreteComponent;
962
+ /**
963
+ * The HTML value to be rendered when the field is empty. If a fallback is not
964
+ * given, `""` (nothing) will be rendered.
965
+ */
966
+ fallback?: string;
929
967
  };
930
968
  /**
931
969
  * Options for {@link usePrismicRichText}.
@@ -1010,6 +1048,8 @@ declare const usePrismicDocuments: <TDocument extends PrismicDocument<Record<str
1010
1048
  removeEventListener: any;
1011
1049
  dispatchEvent: any;
1012
1050
  onabort: any;
1051
+ reason: any;
1052
+ throwIfAborted: any;
1013
1053
  } | undefined;
1014
1054
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
1015
1055
  /**
@@ -1034,6 +1074,8 @@ declare const useFirstPrismicDocument: <TDocument extends PrismicDocument<Record
1034
1074
  removeEventListener: any;
1035
1075
  dispatchEvent: any;
1036
1076
  onabort: any;
1077
+ reason: any;
1078
+ throwIfAborted: any;
1037
1079
  } | undefined;
1038
1080
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument>;
1039
1081
  /**
@@ -1058,6 +1100,8 @@ declare const usePrismicDocumentByID: <TDocument extends PrismicDocument<Record<
1058
1100
  removeEventListener: any;
1059
1101
  dispatchEvent: any;
1060
1102
  onabort: any;
1103
+ reason: any;
1104
+ throwIfAborted: any;
1061
1105
  } | undefined;
1062
1106
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument>;
1063
1107
  /**
@@ -1082,6 +1126,8 @@ declare const usePrismicDocumentsByIDs: <TDocument extends PrismicDocument<Recor
1082
1126
  removeEventListener: any;
1083
1127
  dispatchEvent: any;
1084
1128
  onabort: any;
1129
+ reason: any;
1130
+ throwIfAborted: any;
1085
1131
  } | undefined;
1086
1132
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
1087
1133
  /**
@@ -1100,12 +1146,16 @@ declare const usePrismicDocumentsByIDs: <TDocument extends PrismicDocument<Recor
1100
1146
  * @see Underlying `@prismicio/client` method {@link Client.getAllByIDs}
1101
1147
  */
1102
1148
  declare const useAllPrismicDocumentsByIDs: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(ids: string[], params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
1149
+ limit?: number | undefined;
1150
+ } & {
1103
1151
  signal?: {
1104
1152
  aborted: any;
1105
1153
  addEventListener: any;
1106
1154
  removeEventListener: any;
1107
1155
  dispatchEvent: any;
1108
1156
  onabort: any;
1157
+ reason: any;
1158
+ throwIfAborted: any;
1109
1159
  } | undefined;
1110
1160
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument[]>;
1111
1161
  /**
@@ -1132,6 +1182,8 @@ declare const usePrismicDocumentByUID: <TDocument extends PrismicDocument<Record
1132
1182
  removeEventListener: any;
1133
1183
  dispatchEvent: any;
1134
1184
  onabort: any;
1185
+ reason: any;
1186
+ throwIfAborted: any;
1135
1187
  } | undefined;
1136
1188
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument>;
1137
1189
  /**
@@ -1157,6 +1209,8 @@ declare const usePrismicDocumentsByUIDs: <TDocument extends PrismicDocument<Reco
1157
1209
  removeEventListener: any;
1158
1210
  dispatchEvent: any;
1159
1211
  onabort: any;
1212
+ reason: any;
1213
+ throwIfAborted: any;
1160
1214
  } | undefined;
1161
1215
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
1162
1216
  /**
@@ -1176,12 +1230,16 @@ declare const usePrismicDocumentsByUIDs: <TDocument extends PrismicDocument<Reco
1176
1230
  * @see Underlying `@prismicio/client` method {@link Client.getAllByIDs}
1177
1231
  */
1178
1232
  declare const useAllPrismicDocumentsByUIDs: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(documentType: string, ids: string[], params?: (Partial<_prismicio_client.BuildQueryURLArgs> & {
1233
+ limit?: number | undefined;
1234
+ } & {
1179
1235
  signal?: {
1180
1236
  aborted: any;
1181
1237
  addEventListener: any;
1182
1238
  removeEventListener: any;
1183
1239
  dispatchEvent: any;
1184
1240
  onabort: any;
1241
+ reason: any;
1242
+ throwIfAborted: any;
1185
1243
  } | undefined;
1186
1244
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument[]>;
1187
1245
  /**
@@ -1207,6 +1265,8 @@ declare const useSinglePrismicDocument: <TDocument extends PrismicDocument<Recor
1207
1265
  removeEventListener: any;
1208
1266
  dispatchEvent: any;
1209
1267
  onabort: any;
1268
+ reason: any;
1269
+ throwIfAborted: any;
1210
1270
  } | undefined;
1211
1271
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument>;
1212
1272
  /**
@@ -1232,6 +1292,8 @@ declare const usePrismicDocumentsByType: <TDocument extends PrismicDocument<Reco
1232
1292
  removeEventListener: any;
1233
1293
  dispatchEvent: any;
1234
1294
  onabort: any;
1295
+ reason: any;
1296
+ throwIfAborted: any;
1235
1297
  } | undefined;
1236
1298
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
1237
1299
  /**
@@ -1251,12 +1313,16 @@ declare const usePrismicDocumentsByType: <TDocument extends PrismicDocument<Reco
1251
1313
  * @see Underlying `@prismicio/client` method {@link Client.getAllByType}
1252
1314
  */
1253
1315
  declare const useAllPrismicDocumentsByType: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(documentType: string, params?: (Partial<Omit<_prismicio_client.BuildQueryURLArgs, "page">> & {
1316
+ limit?: number | undefined;
1317
+ } & {
1254
1318
  signal?: {
1255
1319
  aborted: any;
1256
1320
  addEventListener: any;
1257
1321
  removeEventListener: any;
1258
1322
  dispatchEvent: any;
1259
1323
  onabort: any;
1324
+ reason: any;
1325
+ throwIfAborted: any;
1260
1326
  } | undefined;
1261
1327
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument[]>;
1262
1328
  /**
@@ -1281,6 +1347,8 @@ declare const usePrismicDocumentsByTag: <TDocument extends PrismicDocument<Recor
1281
1347
  removeEventListener: any;
1282
1348
  dispatchEvent: any;
1283
1349
  onabort: any;
1350
+ reason: any;
1351
+ throwIfAborted: any;
1284
1352
  } | undefined;
1285
1353
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
1286
1354
  /**
@@ -1300,12 +1368,16 @@ declare const usePrismicDocumentsByTag: <TDocument extends PrismicDocument<Recor
1300
1368
  * @see Underlying `@prismicio/client` method {@link Client.getAllByTag}
1301
1369
  */
1302
1370
  declare const useAllPrismicDocumentsByTag: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(tag: string, params?: (Partial<Omit<_prismicio_client.BuildQueryURLArgs, "page">> & {
1371
+ limit?: number | undefined;
1372
+ } & {
1303
1373
  signal?: {
1304
1374
  aborted: any;
1305
1375
  addEventListener: any;
1306
1376
  removeEventListener: any;
1307
1377
  dispatchEvent: any;
1308
1378
  onabort: any;
1379
+ reason: any;
1380
+ throwIfAborted: any;
1309
1381
  } | undefined;
1310
1382
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument[]>;
1311
1383
  /**
@@ -1331,6 +1403,8 @@ declare const usePrismicDocumentsByEveryTag: <TDocument extends PrismicDocument<
1331
1403
  removeEventListener: any;
1332
1404
  dispatchEvent: any;
1333
1405
  onabort: any;
1406
+ reason: any;
1407
+ throwIfAborted: any;
1334
1408
  } | undefined;
1335
1409
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
1336
1410
  /**
@@ -1350,12 +1424,16 @@ declare const usePrismicDocumentsByEveryTag: <TDocument extends PrismicDocument<
1350
1424
  * @see Underlying `@prismicio/client` method {@link Client.getAllByTags}
1351
1425
  */
1352
1426
  declare const useAllPrismicDocumentsByEveryTag: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(tags: string[], params?: (Partial<Omit<_prismicio_client.BuildQueryURLArgs, "page">> & {
1427
+ limit?: number | undefined;
1428
+ } & {
1353
1429
  signal?: {
1354
1430
  aborted: any;
1355
1431
  addEventListener: any;
1356
1432
  removeEventListener: any;
1357
1433
  dispatchEvent: any;
1358
1434
  onabort: any;
1435
+ reason: any;
1436
+ throwIfAborted: any;
1359
1437
  } | undefined;
1360
1438
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument[]>;
1361
1439
  /**
@@ -1381,6 +1459,8 @@ declare const usePrismicDocumentsBySomeTags: <TDocument extends PrismicDocument<
1381
1459
  removeEventListener: any;
1382
1460
  dispatchEvent: any;
1383
1461
  onabort: any;
1462
+ reason: any;
1463
+ throwIfAborted: any;
1384
1464
  } | undefined;
1385
1465
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
1386
1466
  /**
@@ -1401,12 +1481,16 @@ declare const usePrismicDocumentsBySomeTags: <TDocument extends PrismicDocument<
1401
1481
  * @see Underlying `@prismicio/client` method {@link Client.getAllByTags}
1402
1482
  */
1403
1483
  declare const useAllPrismicDocumentsBySomeTags: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(tags: string[], params?: (Partial<Omit<_prismicio_client.BuildQueryURLArgs, "page">> & {
1484
+ limit?: number | undefined;
1485
+ } & {
1404
1486
  signal?: {
1405
1487
  aborted: any;
1406
1488
  addEventListener: any;
1407
1489
  removeEventListener: any;
1408
1490
  dispatchEvent: any;
1409
1491
  onabort: any;
1492
+ reason: any;
1493
+ throwIfAborted: any;
1410
1494
  } | undefined;
1411
1495
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument[]>;
1412
1496
  /**
@@ -1437,6 +1521,8 @@ declare const dangerouslyUseAllPrismicDocuments: <TDocument extends PrismicDocum
1437
1521
  removeEventListener: any;
1438
1522
  dispatchEvent: any;
1439
1523
  onabort: any;
1524
+ reason: any;
1525
+ throwIfAborted: any;
1440
1526
  } | undefined;
1441
1527
  } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument[]>;
1442
1528
 
@@ -1458,4 +1544,4 @@ declare module "@vue/runtime-core" {
1458
1544
  }
1459
1545
  }
1460
1546
 
1461
- export { ClientComposableReturnType, DefineComponentSliceComponentProps, PrismicClientComposableState, PrismicEmbed, PrismicEmbedProps, PrismicImage, PrismicImageProps, PrismicLink, PrismicLinkProps, PrismicPlugin, PrismicPluginOptions, PrismicRichText, PrismicRichTextProps, PrismicText, PrismicTextProps, SliceComponentProps, SliceComponentType, SliceLike, SliceZone, SliceZoneComponents, SliceZoneLike, SliceZoneProps, SliceZoneResolver, TODOSliceComponent, UsePrismicImageOptions, 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, usePrismicImage, usePrismicLink, usePrismicRichText, usePrismicText, useSinglePrismicDocument };
1547
+ export { ClientComposableReturnType, DefineComponentSliceComponentProps, PrismicClientComposableState, PrismicEmbed, PrismicEmbedProps, PrismicImage, PrismicImageProps, PrismicLink, PrismicLinkProps, PrismicPlugin, PrismicPluginOptions, PrismicRichText, PrismicRichTextProps, PrismicText, PrismicTextProps, SliceComponentProps, SliceComponentType, SliceLike, SliceLikeGraphQL, SliceLikeRestV2, SliceZone, SliceZoneComponents, SliceZoneLike, SliceZoneProps, SliceZoneResolver, TODOSliceComponent, UsePrismicImageOptions, 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, usePrismicImage, usePrismicLink, usePrismicRichText, usePrismicText, useSinglePrismicDocument };
package/dist/index.js CHANGED
@@ -37,6 +37,11 @@ const PrismicEmbedImpl = /* @__PURE__ */ defineComponent({
37
37
  });
38
38
  const PrismicEmbed = PrismicEmbedImpl;
39
39
 
40
+ if (typeof process === "undefined") {
41
+ globalThis.process = { env: {} };
42
+ }
43
+ const __PRODUCTION__ = process.env.NODE_ENV === "production";
44
+
40
45
  const prismicKey = Symbol("prismic");
41
46
 
42
47
  const usePrismic = () => {
@@ -59,18 +64,13 @@ const usePrismicImage = (props) => {
59
64
  const widths = unref(props.widths);
60
65
  const pixelDensities = unref(props.pixelDensities);
61
66
  if (widths) {
62
- if (pixelDensities) {
63
- console.warn("[PrismicImage] `widths` and `pixelDensities` props should not be use alongside each others, only `widths` will be applied", props);
64
- }
65
- if (widths === "auto") {
66
- return asImageWidthSrcSet(field, imgixParams);
67
- } else {
68
- const { url, dimensions, alt: alt2, copyright: copyright2 } = field;
69
- return asImageWidthSrcSet({ url, dimensions, alt: alt2, copyright: copyright2 }, {
70
- ...imgixParams,
71
- widths: widths === "defaults" ? (_a = options.components) == null ? void 0 : _a.imageWidthSrcSetDefaults : widths
72
- });
67
+ if (!__PRODUCTION__ && pixelDensities) {
68
+ console.warn("[PrismicImage] Only one of `widths` or `pixelDensities` props can be provided. You can resolve this warning by removing either the `widths` or `pixelDensities` prop. `widths` will be used in this case.", props);
73
69
  }
70
+ return asImageWidthSrcSet(field, {
71
+ ...imgixParams,
72
+ widths: widths === "defaults" ? (_a = options.components) == null ? void 0 : _a.imageWidthSrcSetDefaults : widths
73
+ });
74
74
  } else if (pixelDensities) {
75
75
  return asImagePixelDensitySrcSet(field, {
76
76
  ...imgixParams,
@@ -290,7 +290,12 @@ const PrismicLink = PrismicLinkImpl;
290
290
  const defaultWrapper$1 = "div";
291
291
  const usePrismicText = (props) => {
292
292
  const text = computed(() => {
293
- return asText(unref(props.field), unref(props.separator));
293
+ var _a;
294
+ const field = unref(props.field);
295
+ if (!isFilled.richText(field)) {
296
+ return (_a = unref(props.fallback)) != null ? _a : "";
297
+ }
298
+ return asText(unref(field), unref(props.separator));
294
299
  });
295
300
  return {
296
301
  text
@@ -301,7 +306,8 @@ const PrismicTextImpl = /* @__PURE__ */ defineComponent({
301
306
  props: {
302
307
  field: {
303
308
  type: Array,
304
- required: true
309
+ default: void 0,
310
+ required: false
305
311
  },
306
312
  separator: {
307
313
  type: String,
@@ -312,12 +318,14 @@ const PrismicTextImpl = /* @__PURE__ */ defineComponent({
312
318
  type: [String, Object, Function],
313
319
  default: void 0,
314
320
  required: false
321
+ },
322
+ fallback: {
323
+ type: String,
324
+ default: void 0,
325
+ required: false
315
326
  }
316
327
  },
317
328
  setup(props) {
318
- if (!props.field) {
319
- return () => null;
320
- }
321
329
  const { text } = usePrismicText(props);
322
330
  return () => {
323
331
  const parent = simplyResolveComponent(props.wrapper || defaultWrapper$1);
@@ -333,10 +341,14 @@ const defaultWrapper = "div";
333
341
  const usePrismicRichText = (props) => {
334
342
  const { options } = usePrismic();
335
343
  const html = computed(() => {
336
- var _a, _b;
337
- const linkResolver = (_a = unref(props.linkResolver)) != null ? _a : options.linkResolver;
338
- const htmlSerializer = (_b = unref(props.htmlSerializer)) != null ? _b : options.htmlSerializer;
339
- return asHTML(unref(props.field), linkResolver, htmlSerializer);
344
+ var _a, _b, _c;
345
+ const field = unref(props.field);
346
+ if (!isFilled.richText(field)) {
347
+ return (_a = unref(props.fallback)) != null ? _a : "";
348
+ }
349
+ const linkResolver = (_b = unref(props.linkResolver)) != null ? _b : options.linkResolver;
350
+ const htmlSerializer = (_c = unref(props.htmlSerializer)) != null ? _c : options.htmlSerializer;
351
+ return asHTML(unref(field), linkResolver, htmlSerializer);
340
352
  });
341
353
  return {
342
354
  html
@@ -347,7 +359,8 @@ const PrismicRichTextImpl = /* @__PURE__ */ defineComponent({
347
359
  props: {
348
360
  field: {
349
361
  type: Array,
350
- required: true
362
+ default: void 0,
363
+ required: false
351
364
  },
352
365
  linkResolver: {
353
366
  type: Function,
@@ -363,16 +376,18 @@ const PrismicRichTextImpl = /* @__PURE__ */ defineComponent({
363
376
  type: [String, Object, Function],
364
377
  default: void 0,
365
378
  required: false
379
+ },
380
+ fallback: {
381
+ type: String,
382
+ default: void 0,
383
+ required: false
366
384
  }
367
385
  },
368
386
  setup(props) {
369
- if (!props.field) {
370
- return () => null;
371
- }
372
387
  const { html } = usePrismicRichText(props);
373
388
  const root = ref(null);
374
389
  const maybeRouter = inject(routerKey, null);
375
- if (maybeRouter) {
390
+ if (maybeRouter && html.value) {
376
391
  let links = [];
377
392
  const navigate = function(event) {
378
393
  event.preventDefault();
@@ -415,11 +430,6 @@ const PrismicRichTextImpl = /* @__PURE__ */ defineComponent({
415
430
  });
416
431
  const PrismicRichText = PrismicRichTextImpl;
417
432
 
418
- if (typeof process === "undefined") {
419
- globalThis.process = { env: {} };
420
- }
421
- const __PRODUCTION__ = process.env.NODE_ENV === "production";
422
-
423
433
  const getSliceComponentProps = (propsHint) => ({
424
434
  slice: {
425
435
  type: Object,
@@ -442,16 +452,15 @@ const TODOSliceComponent = __PRODUCTION__ ? () => null : /* @__PURE__ */ defineC
442
452
  name: "TODOSliceComponent",
443
453
  props: getSliceComponentProps(),
444
454
  setup(props) {
455
+ const type = computed(() => "slice_type" in props.slice ? props.slice.slice_type : props.slice.type);
445
456
  watchEffect(() => {
446
- console.warn(`[SliceZone] Could not find a component for Slice type "${props.slice.slice_type}"`, props.slice);
457
+ console.warn(`[SliceZone] Could not find a component for Slice type "${type.value}"`, props.slice);
447
458
  });
448
459
  return () => {
449
460
  return h("section", {
450
461
  "data-slice-zone-todo-component": "",
451
- "data-slice-type": props.slice.slice_type
452
- }, [
453
- `Could not find a component for Slice type "${props.slice.slice_type}"`
454
- ]);
462
+ "data-slice-type": type.value
463
+ }, [`Could not find a component for Slice type "${type.value}"`]);
455
464
  };
456
465
  }
457
466
  });
@@ -505,11 +514,12 @@ const SliceZoneImpl = /* @__PURE__ */ defineComponent({
505
514
  const renderedSlices = computed(() => {
506
515
  return props.slices.map((slice, index) => {
507
516
  var _a;
508
- let component = props.components && slice.slice_type in props.components ? props.components[slice.slice_type] : props.defaultComponent || ((_a = options.components) == null ? void 0 : _a.sliceZoneDefaultComponent) || TODOSliceComponent;
517
+ const type = "slice_type" in slice ? slice.slice_type : slice.type;
518
+ let component = props.components && type in props.components ? props.components[type] : props.defaultComponent || ((_a = options.components) == null ? void 0 : _a.sliceZoneDefaultComponent) || TODOSliceComponent;
509
519
  if (props.resolver) {
510
520
  const resolvedComponent = props.resolver({
511
521
  slice,
512
- sliceName: slice.slice_type,
522
+ sliceName: type,
513
523
  i: index
514
524
  });
515
525
  if (resolvedComponent) {
@@ -517,7 +527,7 @@ const SliceZoneImpl = /* @__PURE__ */ defineComponent({
517
527
  }
518
528
  }
519
529
  const p = {
520
- key: `${slice.slice_type}-${index}`,
530
+ key: `${index}-${JSON.stringify(slice)}`,
521
531
  slice,
522
532
  index,
523
533
  context: props.context,
@@ -599,13 +609,13 @@ const createPrismic = (options) => {
599
609
  return prismic;
600
610
  };
601
611
 
602
- var PrismicClientComposableState;
603
- (function(PrismicClientComposableState2) {
612
+ var PrismicClientComposableState = /* @__PURE__ */ ((PrismicClientComposableState2) => {
604
613
  PrismicClientComposableState2["Idle"] = "idle";
605
614
  PrismicClientComposableState2["Pending"] = "pending";
606
615
  PrismicClientComposableState2["Success"] = "success";
607
616
  PrismicClientComposableState2["Error"] = "error";
608
- })(PrismicClientComposableState || (PrismicClientComposableState = {}));
617
+ return PrismicClientComposableState2;
618
+ })(PrismicClientComposableState || {});
609
619
 
610
620
  const isParams = (value) => {
611
621
  return typeof value === "object" && value !== null && !Array.isArray(value);