@prismicio/vue 3.0.0 → 3.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/vue",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "description": "Vue plugin, components, and composables to fetch and present Prismic content",
5
5
  "keywords": [
6
6
  "typescript",
@@ -44,45 +44,46 @@
44
44
  "release:beta:dry": "standard-version --release-as major --prerelease beta --dry-run",
45
45
  "release:dry": "standard-version --dry-run",
46
46
  "size": "size-limit",
47
- "test": "npm run lint && npm run unit && npm run build && npm run size",
47
+ "test": "npm run lint && npm run types && npm run unit && npm run build && npm run size",
48
+ "types": "tsc --noEmit",
48
49
  "unit": "vitest run --coverage",
49
50
  "unit:watch": "vitest watch"
50
51
  },
51
52
  "dependencies": {
52
- "@prismicio/client": "^6.6.1",
53
- "@prismicio/helpers": "^2.3.2",
54
- "@prismicio/types": "^0.2.0",
53
+ "@prismicio/client": "^6.7.1",
54
+ "@prismicio/helpers": "^2.3.5",
55
+ "@prismicio/types": "^0.2.3",
55
56
  "isomorphic-unfetch": "^3.1.0",
56
- "vue-router": "^4.1.2"
57
+ "vue-router": "^4.1.5"
57
58
  },
58
59
  "devDependencies": {
59
- "@prismicio/mock": "^0.0.10",
60
- "@size-limit/preset-small-lib": "^7.0.8",
60
+ "@prismicio/mock": "^0.1.1",
61
+ "@size-limit/preset-small-lib": "^8.1.0",
61
62
  "@types/escape-html": "^1.0.2",
62
- "@types/jsdom-global": "^3.0.2",
63
- "@typescript-eslint/eslint-plugin": "^5.30.6",
64
- "@typescript-eslint/parser": "^5.30.6",
65
- "@vitejs/plugin-vue": "^3.0.1",
66
- "@vue/compiler-sfc": "^3.2.37",
67
- "@vue/eslint-config-typescript": "^11.0.0",
68
- "@vue/test-utils": "^2.0.2",
69
- "c8": "^7.11.3",
70
- "eslint": "^8.20.0",
63
+ "@types/jsdom-global": "^3.0.4",
64
+ "@typescript-eslint/eslint-plugin": "^5.39.0",
65
+ "@typescript-eslint/parser": "^5.39.0",
66
+ "@vitejs/plugin-vue": "^3.1.2",
67
+ "@vitest/coverage-c8": "^0.23.4",
68
+ "@vue/compiler-sfc": "^3.2.40",
69
+ "@vue/eslint-config-typescript": "^11.0.2",
70
+ "@vue/test-utils": "^2.1.0",
71
+ "eslint": "^8.24.0",
71
72
  "eslint-config-prettier": "^8.5.0",
72
73
  "eslint-plugin-prettier": "^4.2.1",
73
- "eslint-plugin-tsdoc": "^0.2.16",
74
- "eslint-plugin-vue": "^9.2.0",
75
- "jsdom": "^20.0.0",
74
+ "eslint-plugin-tsdoc": "^0.2.17",
75
+ "eslint-plugin-vue": "^9.6.0",
76
+ "jsdom": "^20.0.1",
76
77
  "jsdom-global": "^3.0.2",
77
78
  "prettier": "^2.7.1",
78
- "prettier-plugin-jsdoc": "^0.3.38",
79
+ "prettier-plugin-jsdoc": "^0.4.2",
79
80
  "siroc": "^0.16.0",
80
- "size-limit": "^7.0.8",
81
+ "size-limit": "^8.1.0",
81
82
  "standard-version": "^9.5.0",
82
- "typescript": "^4.7.4",
83
- "vite": "^3.0.1",
84
- "vitest": "^0.18.1",
85
- "vue": "^3.2.37"
83
+ "typescript": "^4.8.4",
84
+ "vite": "^3.1.4",
85
+ "vitest": "^0.23.4",
86
+ "vue": "^3.2.40"
86
87
  },
87
88
  "peerDependencies": {
88
89
  "vue": "^3.0.0"
@@ -26,7 +26,8 @@ export type PrismicEmbedProps = {
26
26
  field: EmbedField;
27
27
 
28
28
  /**
29
- * An HTML tag name, a component, or a functional component used to wrap the output.
29
+ * An HTML tag name, a component, or a functional component used to wrap the
30
+ * output.
30
31
  *
31
32
  * @defaultValue `"div"`
32
33
  */
@@ -39,7 +39,8 @@ export type PrismicImageProps = {
39
39
  field: ImageField;
40
40
 
41
41
  /**
42
- * An HTML tag name, a component, or a functional component used to render images.
42
+ * An HTML tag name, a component, or a functional component used to render
43
+ * images.
43
44
  *
44
45
  * @remarks
45
46
  * HTML tag names and components will be rendered using the `img` tag
@@ -75,7 +76,8 @@ export type PrismicImageProps = {
75
76
  | "defaults";
76
77
 
77
78
  /**
78
- * Adds an additional `srcset` attribute to the image following giving pixel densities.
79
+ * Adds an additional `srcset` attribute to the image following giving pixel
80
+ * densities.
79
81
  *
80
82
  * @remarks
81
83
  * A special value of `"defaults"` is accepted to automatically use image
@@ -124,7 +126,8 @@ export type UsePrismicImageReturnType = {
124
126
  };
125
127
 
126
128
  /**
127
- * A low level composable that returns a resolved information about a Prismic image field.
129
+ * A low level composable that returns a resolved information about a Prismic
130
+ * image field.
128
131
  *
129
132
  * @param props - {@link UsePrismicImageOptions}
130
133
  *
@@ -66,7 +66,8 @@ export type PrismicLinkProps = {
66
66
  rel?: string | null;
67
67
 
68
68
  /**
69
- * Value of the `rel` attribute to use on links rendered with `target="_blank"`.
69
+ * Value of the `rel` attribute to use on links rendered with
70
+ * `target="_blank"`.
70
71
  *
71
72
  * @defaultValue The one provided to `@prismicio/vue` plugin if configured, `"noopener noreferrer"` otherwise.
72
73
  */
@@ -132,7 +133,8 @@ export type UsePrismicLinkReturnType = {
132
133
  };
133
134
 
134
135
  /**
135
- * A low level composable that returns resolved information about a Prismic link field.
136
+ * A low level composable that returns resolved information about a Prismic link
137
+ * field.
136
138
  *
137
139
  * @param props - {@link UsePrismicLinkOptions}
138
140
  *
@@ -66,7 +66,8 @@ export type PrismicRichTextProps = {
66
66
  htmlSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;
67
67
 
68
68
  /**
69
- * An HTML tag name, a component, or a functional component used to wrap the output.
69
+ * An HTML tag name, a component, or a functional component used to wrap the
70
+ * output.
70
71
  *
71
72
  * @defaultValue `"div"`
72
73
  */
@@ -101,7 +102,8 @@ export type UsePrismicRichTextReturnType = {
101
102
  *
102
103
  * @param props - {@link UsePrismicRichTextOptions}
103
104
  *
104
- * @returns - Serialized rich text field as HTML {@link UsePrismicRichTextReturnType}
105
+ * @returns - Serialized rich text field as HTML
106
+ * {@link UsePrismicRichTextReturnType}
105
107
  */
106
108
  export const usePrismicRichText = (
107
109
  props: UsePrismicRichTextOptions,
@@ -39,7 +39,8 @@ export type PrismicTextProps = {
39
39
  separator?: string;
40
40
 
41
41
  /**
42
- * An HTML tag name, a component, or a functional component used to wrap the output.
42
+ * An HTML tag name, a component, or a functional component used to wrap the
43
+ * output.
43
44
  *
44
45
  * @defaultValue `"div"`
45
46
  */
@@ -70,11 +71,13 @@ export type UsePrismicTextReturnType = {
70
71
  };
71
72
 
72
73
  /**
73
- * A low level composable that returns a serialized rich text field as plain text.
74
+ * A low level composable that returns a serialized rich text field as plain
75
+ * text.
74
76
  *
75
77
  * @param props - {@link UsePrismicTextOptions}
76
78
  *
77
- * @returns - Serialized rich text field as plain text {@link UsePrismicTextReturnType}
79
+ * @returns - Serialized rich text field as plain text
80
+ * {@link UsePrismicTextReturnType}
78
81
  */
79
82
  export const usePrismicText = (
80
83
  props: UsePrismicTextOptions,
@@ -41,6 +41,7 @@ type ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2
41
41
  */
42
42
  export type SliceLikeRestV2<TSliceType extends string = string> = {
43
43
  slice_type: Slice<TSliceType>["slice_type"];
44
+ id?: string;
44
45
  };
45
46
 
46
47
  /**
@@ -67,7 +68,8 @@ export type SliceLike<TSliceType extends string = string> =
67
68
  | SliceLikeGraphQL<TSliceType>;
68
69
 
69
70
  /**
70
- * A looser version of the `SliceZone` type from `@prismicio/types` using `SliceLike`.
71
+ * A looser version of the `SliceZone` type from `@prismicio/types` using
72
+ * `SliceLike`.
71
73
  *
72
74
  * If using Prismic's REST API, use the `SliceZone` export from
73
75
  * `@prismicio/types` for the full type.
@@ -110,7 +112,8 @@ export type SliceComponentProps<
110
112
  slices: SliceZoneLike<SliceLike>;
111
113
 
112
114
  /**
113
- * Arbitrary data passed to `<SliceZone />` and made available to all Slice components.
115
+ * Arbitrary data passed to `<SliceZone />` and made available to all Slice
116
+ * components.
114
117
  */
115
118
  context: TContext;
116
119
  };
@@ -119,7 +122,7 @@ export type SliceComponentProps<
119
122
  * Native Vue props for a component rendering content from a Prismic Slice using
120
123
  * the `<SliceZone />` component.
121
124
  *
122
- * @typeParam TSlice - The type(s) of slices in the Slice Zone
125
+ * @typeParam TSlice - The Slice type
123
126
  * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
124
127
  * available to all Slice components
125
128
  */
@@ -171,7 +174,7 @@ export type DefineComponentSliceComponentProps<
171
174
  * };
172
175
  * ```
173
176
  *
174
- * @typeParam TSlice - The type(s) of slices in the Slice Zone
177
+ * @typeParam TSlice - The Slice type
175
178
  * @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
176
179
  * available to all Slice components
177
180
  * @param propsHint - An optional array of prop names used for the sole purpose
@@ -181,7 +184,8 @@ export type DefineComponentSliceComponentProps<
181
184
  * @returns Props object to use with {@link defineComponent}
182
185
  */
183
186
  export const getSliceComponentProps = <
184
- TSlice extends SliceLike = SliceLike,
187
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
188
+ TSlice extends SliceLike = any,
185
189
  TContext = unknown,
186
190
  >(
187
191
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -222,7 +226,8 @@ export type SliceComponentType<
222
226
  | FunctionalComponent<SliceComponentProps<TSlice, TContext>>;
223
227
 
224
228
  /**
225
- * This Slice component can be used as a reminder to provide a proper implementation.
229
+ * This Slice component can be used as a reminder to provide a proper
230
+ * implementation.
226
231
  *
227
232
  * This is also the default Vue component rendered when a component mapping
228
233
  * cannot be found in `<SliceZone />`.
@@ -366,7 +371,8 @@ export type SliceZoneResolverArgs<TSlice extends SliceLike = SliceLike> = {
366
371
  /**
367
372
  * A function that determines the rendered Vue component for each Slice in the
368
373
  * Slice Zone. If a nullish value is returned, the component will fallback to
369
- * the `components` or `defaultComponent` props to determine the rendered component.
374
+ * the `components` or `defaultComponent` props to determine the rendered
375
+ * component.
370
376
  *
371
377
  * @deprecated Use the `components` prop instead.
372
378
  *
@@ -506,8 +512,13 @@ export const SliceZoneImpl = /*#__PURE__*/ defineComponent({
506
512
  }
507
513
  }
508
514
 
515
+ const key =
516
+ "id" in slice && slice.id
517
+ ? slice.id
518
+ : `${index}-${JSON.stringify(slice)}`;
519
+
509
520
  const p = {
510
- key: `${index}-${JSON.stringify(slice)}`,
521
+ key,
511
522
  slice,
512
523
  index,
513
524
  context: props.context,
@@ -21,8 +21,8 @@ import {
21
21
  * A composable that queries content from the Prismic repository.
22
22
  *
23
23
  * @remarks
24
- * An additional `@prismicio/client` instance can be provided at `params.client`.
25
- *
24
+ * An additional `@prismicio/client` instance can be provided at
25
+ * `params.client`.
26
26
  * @typeParam TDocument - Type of Prismic documents returned
27
27
  *
28
28
  * @param params - Parameters to filter, sort, and paginate results
@@ -43,8 +43,8 @@ export const usePrismicDocuments = <TDocument extends PrismicDocument>(
43
43
  * only the first result, if any.
44
44
  *
45
45
  * @remarks
46
- * An additional `@prismicio/client` instance can be provided at `params.client`.
47
- *
46
+ * An additional `@prismicio/client` instance can be provided at
47
+ * `params.client`.
48
48
  * @typeParam TDocument - Type of the Prismic document returned
49
49
  *
50
50
  * @param params - Parameters to filter, sort, and paginate results
@@ -61,11 +61,12 @@ export const useFirstPrismicDocument = <TDocument extends PrismicDocument>(
61
61
  useStatefulPrismicClientMethod("getFirst", args);
62
62
 
63
63
  /**
64
- * A composable that queries a document from the Prismic repository with a specific ID.
64
+ * A composable that queries a document from the Prismic repository with a
65
+ * specific ID.
65
66
  *
66
67
  * @remarks
67
- * An additional `@prismicio/client` instance can be provided at `params.client`.
68
- *
68
+ * An additional `@prismicio/client` instance can be provided at
69
+ * `params.client`.
69
70
  * @typeParam TDocument - Type of the Prismic document returned
70
71
  *
71
72
  * @param id - ID of the document
@@ -84,11 +85,12 @@ export const usePrismicDocumentByID = <TDocument extends PrismicDocument>(
84
85
  useStatefulPrismicClientMethod("getByID", args);
85
86
 
86
87
  /**
87
- * A composable that queries documents from the Prismic repository with specific IDs.
88
+ * A composable that queries documents from the Prismic repository with specific
89
+ * IDs.
88
90
  *
89
91
  * @remarks
90
- * An additional `@prismicio/client` instance can be provided at `params.client`.
91
- *
92
+ * An additional `@prismicio/client` instance can be provided at
93
+ * `params.client`.
92
94
  * @typeParam TDocument - Type of Prismic documents returned
93
95
  *
94
96
  * @param ids - A list of document IDs
@@ -107,11 +109,12 @@ export const usePrismicDocumentsByIDs = <TDocument extends PrismicDocument>(
107
109
  useStatefulPrismicClientMethod("getByIDs", args);
108
110
 
109
111
  /**
110
- * A composable that queries all documents from the Prismic repository with specific IDs.
112
+ * A composable that queries all documents from the Prismic repository with
113
+ * specific IDs.
111
114
  *
112
115
  * @remarks
113
- * An additional `@prismicio/client` instance can be provided at `params.client`.
114
- *
116
+ * An additional `@prismicio/client` instance can be provided at
117
+ * `params.client`.
115
118
  * @typeParam TDocument - Type of Prismic documents returned
116
119
  *
117
120
  * @param ids - A list of document IDs
@@ -135,8 +138,8 @@ export const useAllPrismicDocumentsByIDs = <TDocument extends PrismicDocument>(
135
138
  * specific UID and Custom Type.
136
139
  *
137
140
  * @remarks
138
- * An additional `@prismicio/client` instance can be provided at `params.client`.
139
- *
141
+ * An additional `@prismicio/client` instance can be provided at
142
+ * `params.client`.
140
143
  * @typeParam TDocument - Type of the Prismic document returned
141
144
  *
142
145
  * @param documentType - The API ID of the document's Custom Type
@@ -157,11 +160,12 @@ export const usePrismicDocumentByUID = <TDocument extends PrismicDocument>(
157
160
  useStatefulPrismicClientMethod("getByUID", args);
158
161
 
159
162
  /**
160
- * A composable that queries documents from the Prismic repository with specific UIDs.
163
+ * A composable that queries documents from the Prismic repository with specific
164
+ * UIDs.
161
165
  *
162
166
  * @remarks
163
- * An additional `@prismicio/client` instance can be provided at `params.client`.
164
- *
167
+ * An additional `@prismicio/client` instance can be provided at
168
+ * `params.client`.
165
169
  * @typeParam TDocument - Type of Prismic documents returned
166
170
  *
167
171
  * @param documentType - The API ID of the document's Custom Type
@@ -182,11 +186,12 @@ export const usePrismicDocumentsByUIDs = <TDocument extends PrismicDocument>(
182
186
  useStatefulPrismicClientMethod("getByUIDs", args);
183
187
 
184
188
  /**
185
- * A composable that queries all documents from the Prismic repository with specific UIDs.
189
+ * A composable that queries all documents from the Prismic repository with
190
+ * specific UIDs.
186
191
  *
187
192
  * @remarks
188
- * An additional `@prismicio/client` instance can be provided at `params.client`.
189
- *
193
+ * An additional `@prismicio/client` instance can be provided at
194
+ * `params.client`.
190
195
  * @typeParam TDocument - Type of Prismic documents returned
191
196
  *
192
197
  * @param documentType - The API ID of the document's Custom Type
@@ -212,8 +217,8 @@ export const useAllPrismicDocumentsByUIDs = <TDocument extends PrismicDocument>(
212
217
  * for a specific Custom Type.
213
218
  *
214
219
  * @remarks
215
- * An additional `@prismicio/client` instance can be provided at `params.client`.
216
- *
220
+ * An additional `@prismicio/client` instance can be provided at
221
+ * `params.client`.
217
222
  * @typeParam TDocument - Type of the Prismic document returned
218
223
  *
219
224
  * @param documentType - The API ID of the singleton Custom Type
@@ -236,8 +241,8 @@ export const useSinglePrismicDocument = <TDocument extends PrismicDocument>(
236
241
  * specific Custom Type.
237
242
  *
238
243
  * @remarks
239
- * An additional `@prismicio/client` instance can be provided at `params.client`.
240
- *
244
+ * An additional `@prismicio/client` instance can be provided at
245
+ * `params.client`.
241
246
  * @typeParam TDocument - Type of Prismic documents returned
242
247
  *
243
248
  * @param documentType - The API ID of the Custom Type
@@ -260,8 +265,8 @@ export const usePrismicDocumentsByType = <TDocument extends PrismicDocument>(
260
265
  * specific Custom Type.
261
266
  *
262
267
  * @remarks
263
- * An additional `@prismicio/client` instance can be provided at `params.client`.
264
- *
268
+ * An additional `@prismicio/client` instance can be provided at
269
+ * `params.client`.
265
270
  * @typeParam TDocument - Type of Prismic documents returned
266
271
  *
267
272
  * @param documentType - The API ID of the Custom Type
@@ -281,11 +286,12 @@ export const useAllPrismicDocumentsByType = <TDocument extends PrismicDocument>(
281
286
  useStatefulPrismicClientMethod("getAllByType", args);
282
287
 
283
288
  /**
284
- * A composable that queries documents from the Prismic repository with a specific tag.
289
+ * A composable that queries documents from the Prismic repository with a
290
+ * specific tag.
285
291
  *
286
292
  * @remarks
287
- * An additional `@prismicio/client` instance can be provided at `params.client`.
288
- *
293
+ * An additional `@prismicio/client` instance can be provided at
294
+ * `params.client`.
289
295
  * @typeParam TDocument - Type of Prismic documents returned
290
296
  *
291
297
  * @param tag - The tag that must be included on a document
@@ -308,8 +314,8 @@ export const usePrismicDocumentsByTag = <TDocument extends PrismicDocument>(
308
314
  * specific tag.
309
315
  *
310
316
  * @remarks
311
- * An additional `@prismicio/client` instance can be provided at `params.client`.
312
- *
317
+ * An additional `@prismicio/client` instance can be provided at
318
+ * `params.client`.
313
319
  * @typeParam TDocument - Type of Prismic documents returned
314
320
  *
315
321
  * @param tag - The tag that must be included on a document
@@ -333,8 +339,8 @@ export const useAllPrismicDocumentsByTag = <TDocument extends PrismicDocument>(
333
339
  * tags. A document must be tagged with all of the queried tags to be included.
334
340
  *
335
341
  * @remarks
336
- * An additional `@prismicio/client` instance can be provided at `params.client`.
337
- *
342
+ * An additional `@prismicio/client` instance can be provided at
343
+ * `params.client`.
338
344
  * @typeParam TDocument - Type of Prismic documents returned
339
345
  *
340
346
  * @param tags - A list of tags that must be included on a document
@@ -357,11 +363,12 @@ export const usePrismicDocumentsByEveryTag = <
357
363
 
358
364
  /**
359
365
  * A composable that queries all documents from the Prismic repository with
360
- * specific tags. A document must be tagged with all of the queried tags to be included.
366
+ * specific tags. A document must be tagged with all of the queried tags to be
367
+ * included.
361
368
  *
362
369
  * @remarks
363
- * An additional `@prismicio/client` instance can be provided at `params.client`.
364
- *
370
+ * An additional `@prismicio/client` instance can be provided at
371
+ * `params.client`.
365
372
  * @typeParam TDocument - Type of Prismic documents returned
366
373
  *
367
374
  * @param tags - A list of tags that must be included on a document
@@ -384,11 +391,12 @@ export const useAllPrismicDocumentsByEveryTag = <
384
391
 
385
392
  /**
386
393
  * A composable that queries documents from the Prismic repository with specific
387
- * tags. A document must be tagged with at least one of the queried tags to be included.
394
+ * tags. A document must be tagged with at least one of the queried tags to be
395
+ * included.
388
396
  *
389
397
  * @remarks
390
- * An additional `@prismicio/client` instance can be provided at `params.client`.
391
- *
398
+ * An additional `@prismicio/client` instance can be provided at
399
+ * `params.client`.
392
400
  * @typeParam TDocument - Type of Prismic documents returned
393
401
  *
394
402
  * @param tags - A list of tags that must be included on a document
@@ -415,8 +423,8 @@ export const usePrismicDocumentsBySomeTags = <
415
423
  * tags to be included.
416
424
  *
417
425
  * @remarks
418
- * An additional `@prismicio/client` instance can be provided at `params.client`.
419
- *
426
+ * An additional `@prismicio/client` instance can be provided at
427
+ * `params.client`.
420
428
  * @typeParam TDocument - Type of Prismic documents returned
421
429
  *
422
430
  * @param tags - A list of tags that must be included on a document
@@ -440,14 +448,16 @@ export const useAllPrismicDocumentsBySomeTags = <
440
448
  /**
441
449
  * **IMPORTANT**: Avoid using `dangerouslyUseAllPrismicDocuments` as it may be
442
450
  * slower and require more resources than other composables. Prefer using other
443
- * composables that filter by predicates such as `useAllPrismicDocumentsByType`.
451
+ * composables that filter by predicates such as
452
+ * `useAllPrismicDocumentsByType`.
444
453
  *
445
454
  * A composable that queries content from the Prismic repository and returns all
446
- * matching content. If no predicates are provided, all documents will be fetched.
455
+ * matching content. If no predicates are provided, all documents will be
456
+ * fetched.
447
457
  *
448
458
  * @remarks
449
- * An additional `@prismicio/client` instance can be provided at `params.client`.
450
- *
459
+ * An additional `@prismicio/client` instance can be provided at
460
+ * `params.client`.
451
461
  * @typeParam TDocument - Type of Prismic documents returned
452
462
  *
453
463
  * @param params - Parameters to filter and sort results
@@ -54,9 +54,12 @@ export const createPrismic = (options: PrismicPluginOptions): PrismicPlugin => {
54
54
  fetch: async (endpoint, options) => {
55
55
  let fetchFunction: FetchLike;
56
56
  if (typeof globalThis.fetch === "function") {
57
- fetchFunction = globalThis.fetch;
57
+ // TODO: Remove after https://github.com/prismicio/prismic-client/issues/254
58
+ fetchFunction = globalThis.fetch as FetchLike;
58
59
  } else {
59
- fetchFunction = (await import("isomorphic-unfetch")).default;
60
+ // TODO: Remove after https://github.com/prismicio/prismic-client/issues/254
61
+ fetchFunction = (await import("isomorphic-unfetch"))
62
+ .default as FetchLike;
60
63
  }
61
64
 
62
65
  return await fetchFunction(endpoint, options);
@@ -11,7 +11,8 @@ import type { usePrismic } from "./usePrismic";
11
11
  /* eslint-enable @typescript-eslint/no-unused-vars */
12
12
 
13
13
  /**
14
- * `@prismicio/vue` plugin interface interface location used for {@link usePrismic}.
14
+ * `@prismicio/vue` plugin interface interface location used for
15
+ * {@link usePrismic}.
15
16
  *
16
17
  * @internal
17
18
  */
package/src/types.ts CHANGED
@@ -41,7 +41,8 @@ import type { usePrismicDocuments } from "./composables";
41
41
  */
42
42
  type PrismicPluginComponentsOptions = {
43
43
  /**
44
- * Value of the `rel` attribute to use on links rendered with `target="_blank"`
44
+ * Value of the `rel` attribute to use on links rendered with
45
+ * `target="_blank"`
45
46
  *
46
47
  * @defaultValue `"noopener noreferrer"`
47
48
  */
@@ -76,7 +77,8 @@ type PrismicPluginComponentsOptions = {
76
77
  linkExternalComponent?: string | ConcreteComponent;
77
78
 
78
79
  /**
79
- * An HTML tag name, a component, or a functional component used to render images.
80
+ * An HTML tag name, a component, or a functional component used to render
81
+ * images.
80
82
  *
81
83
  * @remarks
82
84
  * HTML tag names and components will be rendered using the `img` tag
@@ -123,14 +125,16 @@ type PrismicPluginComponentsOptions = {
123
125
  type PrismicPluginOptionsBase = {
124
126
  /**
125
127
  * An optional link resolver function used to resolve links to Prismic
126
- * documents when not using the route resolver parameter with `@prismicio/client`.
128
+ * documents when not using the route resolver parameter with
129
+ * `@prismicio/client`.
127
130
  *
128
131
  * @see Link resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#link-resolver}
129
132
  */
130
133
  linkResolver?: LinkResolverFunction;
131
134
 
132
135
  /**
133
- * An optional HTML serializer to customize the way rich text fields are rendered.
136
+ * An optional HTML serializer to customize the way rich text fields are
137
+ * rendered.
134
138
  *
135
139
  * @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
136
140
  */
@@ -265,7 +269,8 @@ export type PrismicPluginOptions =
265
269
 
266
270
  /**
267
271
  * `@prismicio/client` related methods and properties exposed by
268
- * `@prismicio/vue` plugin and accessible through `this.$prismic` and `usePrismic()`.
272
+ * `@prismicio/vue` plugin and accessible through `this.$prismic` and
273
+ * `usePrismic()`.
269
274
  */
270
275
  export type PrismicPluginClient = {
271
276
  /**
@@ -333,7 +338,8 @@ export type PrismicPluginHelpers = {
333
338
 
334
339
  /**
335
340
  * Returns the URL of an Image field with optional image transformations (via
336
- * Imgix URL parameters). This is `@prismicio/helpers` {@link asImageSrc} function.
341
+ * Imgix URL parameters). This is `@prismicio/helpers` {@link asImageSrc}
342
+ * function.
337
343
  */
338
344
  asImageSrc: typeof asImageSrc;
339
345
 
@@ -409,7 +415,8 @@ export const enum PrismicClientComposableState {
409
415
  // Helpers
410
416
 
411
417
  /**
412
- * Type to transform a static object into one that allows passing Refs as values.
418
+ * Type to transform a static object into one that allows passing Refs as
419
+ * values.
413
420
  *
414
421
  * @internal
415
422
  */
@@ -45,7 +45,8 @@ export type ComposableOnlyParameters = {
45
45
  /**
46
46
  * The return type of a `@prismicio/client` Vue composable.
47
47
  *
48
- * @typeParam TData - The expected format of the `data` property of the returned object
48
+ * @typeParam TData - The expected format of the `data` property of the returned
49
+ * object
49
50
  */
50
51
  export type ClientComposableReturnType<TData = unknown> = {
51
52
  /**
@@ -59,7 +60,8 @@ export type ClientComposableReturnType<TData = unknown> = {
59
60
  data: Ref<TData | null>;
60
61
 
61
62
  /**
62
- * Error returned by the composable's client method call if in an errror state.
63
+ * Error returned by the composable's client method call if in an errror
64
+ * state.
63
65
  */
64
66
  error: Ref<ClientError | Error | null>;
65
67
 
@@ -74,7 +76,8 @@ export type ClientComposableReturnType<TData = unknown> = {
74
76
  *
75
77
  * @param value - The value to check
76
78
  *
77
- * @returns `true` if `value` is a `@prismicio/client` params object, `false` otherwise
79
+ * @returns `true` if `value` is a `@prismicio/client` params object, `false`
80
+ * otherwise
78
81
  */
79
82
  const isParams = (
80
83
  value: unknown,