@prismicio/react 2.5.0 → 2.5.2
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/PrismicImage.cjs +67 -0
- package/dist/PrismicImage.cjs.map +1 -0
- package/dist/PrismicImage.d.ts +163 -0
- package/dist/PrismicImage.js +49 -0
- package/dist/PrismicImage.js.map +1 -0
- package/dist/PrismicLink.cjs +91 -0
- package/dist/PrismicLink.cjs.map +1 -0
- package/dist/PrismicLink.d.ts +105 -0
- package/dist/PrismicLink.js +73 -0
- package/dist/PrismicLink.js.map +1 -0
- package/dist/PrismicProvider.cjs +41 -0
- package/dist/PrismicProvider.cjs.map +1 -0
- package/dist/PrismicProvider.d.ts +84 -0
- package/dist/PrismicProvider.js +24 -0
- package/dist/PrismicProvider.js.map +1 -0
- package/dist/PrismicRichText.cjs +97 -0
- package/dist/PrismicRichText.cjs.map +1 -0
- package/dist/PrismicRichText.d.ts +116 -0
- package/dist/PrismicRichText.js +78 -0
- package/dist/PrismicRichText.js.map +1 -0
- package/dist/PrismicText.cjs +42 -0
- package/dist/PrismicText.cjs.map +1 -0
- package/dist/PrismicText.d.ts +39 -0
- package/dist/PrismicText.js +24 -0
- package/dist/PrismicText.js.map +1 -0
- package/dist/PrismicToolbar.cjs +41 -0
- package/dist/PrismicToolbar.cjs.map +1 -0
- package/dist/PrismicToolbar.d.ts +21 -0
- package/dist/PrismicToolbar.js +24 -0
- package/dist/PrismicToolbar.js.map +1 -0
- package/dist/SliceZone.cjs +58 -0
- package/dist/SliceZone.cjs.map +1 -0
- package/dist/SliceZone.d.ts +188 -0
- package/dist/SliceZone.js +41 -0
- package/dist/SliceZone.js.map +1 -0
- package/dist/clientHooks.cjs +40 -0
- package/dist/clientHooks.cjs.map +1 -0
- package/dist/clientHooks.d.ts +357 -0
- package/dist/clientHooks.js +40 -0
- package/dist/clientHooks.js.map +1 -0
- package/dist/index.cjs +46 -574
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +23 -1267
- package/dist/index.js +46 -519
- package/dist/index.js.map +1 -1
- package/dist/lib/__PRODUCTION__.cjs +8 -0
- package/dist/lib/__PRODUCTION__.cjs.map +1 -0
- package/dist/lib/__PRODUCTION__.d.ts +7 -0
- package/dist/lib/__PRODUCTION__.js +8 -0
- package/dist/lib/__PRODUCTION__.js.map +1 -0
- package/dist/lib/devMsg.cjs +8 -0
- package/dist/lib/devMsg.cjs.map +1 -0
- package/dist/lib/devMsg.d.ts +16 -0
- package/dist/lib/devMsg.js +8 -0
- package/dist/lib/devMsg.js.map +1 -0
- package/dist/lib/invariant.cjs +15 -0
- package/dist/lib/invariant.cjs.map +1 -0
- package/dist/lib/invariant.d.ts +24 -0
- package/dist/lib/invariant.js +15 -0
- package/dist/lib/invariant.js.map +1 -0
- package/dist/lib/isInternalURL.cjs +9 -0
- package/dist/lib/isInternalURL.cjs.map +1 -0
- package/dist/lib/isInternalURL.d.ts +8 -0
- package/dist/lib/isInternalURL.js +9 -0
- package/dist/lib/isInternalURL.js.map +1 -0
- package/dist/lib/pascalCase.cjs +10 -0
- package/dist/lib/pascalCase.cjs.map +1 -0
- package/dist/lib/pascalCase.d.ts +26 -0
- package/dist/lib/pascalCase.js +10 -0
- package/dist/lib/pascalCase.js.map +1 -0
- package/dist/package.json.cjs +5 -0
- package/dist/package.json.cjs.map +1 -0
- package/dist/package.json.js +5 -0
- package/dist/package.json.js.map +1 -0
- package/dist/types.d.ts +19 -0
- package/dist/usePrismicClient.cjs +12 -0
- package/dist/usePrismicClient.cjs.map +1 -0
- package/dist/usePrismicClient.d.ts +11 -0
- package/dist/usePrismicClient.js +12 -0
- package/dist/usePrismicClient.js.map +1 -0
- package/dist/usePrismicContext.cjs +26 -0
- package/dist/usePrismicContext.cjs.map +1 -0
- package/dist/usePrismicContext.d.ts +8 -0
- package/dist/usePrismicContext.js +9 -0
- package/dist/usePrismicContext.js.map +1 -0
- package/dist/usePrismicPreviewResolver.cjs +44 -0
- package/dist/usePrismicPreviewResolver.cjs.map +1 -0
- package/dist/usePrismicPreviewResolver.d.ts +45 -0
- package/dist/usePrismicPreviewResolver.js +27 -0
- package/dist/usePrismicPreviewResolver.js.map +1 -0
- package/dist/useStatefulPrismicClientMethod.cjs +89 -0
- package/dist/useStatefulPrismicClientMethod.cjs.map +1 -0
- package/dist/useStatefulPrismicClientMethod.d.ts +44 -0
- package/dist/useStatefulPrismicClientMethod.js +72 -0
- package/dist/useStatefulPrismicClientMethod.js.map +1 -0
- package/package.json +43 -41
- package/src/PrismicImage.tsx +2 -1
- package/src/PrismicLink.tsx +0 -1
- package/src/PrismicProvider.tsx +6 -3
- package/src/PrismicText.tsx +2 -1
- package/src/SliceZone.tsx +8 -4
- package/src/clientHooks.ts +52 -44
- package/src/useStatefulPrismicClientMethod.ts +2 -1
package/src/SliceZone.tsx
CHANGED
|
@@ -53,7 +53,8 @@ export type SliceLike<SliceType extends string = string> =
|
|
|
53
53
|
| SliceLikeGraphQL<SliceType>;
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
* A looser version of the `SliceZone` type from `@prismicio/types` using
|
|
56
|
+
* A looser version of the `SliceZone` type from `@prismicio/types` using
|
|
57
|
+
* `SliceLike`.
|
|
57
58
|
*
|
|
58
59
|
* If using Prismic's Rest API V2, use the `SliceZone` export from
|
|
59
60
|
* `@prismicio/types` for the full type.
|
|
@@ -96,7 +97,8 @@ export type SliceComponentProps<
|
|
|
96
97
|
slices: SliceZoneLike<SliceLike>;
|
|
97
98
|
|
|
98
99
|
/**
|
|
99
|
-
* Arbitrary data passed to `<SliceZone>` and made available to all Slice
|
|
100
|
+
* Arbitrary data passed to `<SliceZone>` and made available to all Slice
|
|
101
|
+
* components.
|
|
100
102
|
*/
|
|
101
103
|
context: TContext;
|
|
102
104
|
};
|
|
@@ -145,7 +147,8 @@ export type SliceZoneComponents<
|
|
|
145
147
|
};
|
|
146
148
|
|
|
147
149
|
/**
|
|
148
|
-
* This Slice component can be used as a reminder to provide a proper
|
|
150
|
+
* This Slice component can be used as a reminder to provide a proper
|
|
151
|
+
* implementation.
|
|
149
152
|
*
|
|
150
153
|
* This is also the default React component rendered when a component mapping
|
|
151
154
|
* cannot be found in `<SliceZone>`.
|
|
@@ -198,7 +201,8 @@ type SliceZoneResolverArgs<
|
|
|
198
201
|
/**
|
|
199
202
|
* A function that determines the rendered React component for each Slice in the
|
|
200
203
|
* Slice Zone. If a nullish value is returned, the component will fallback to
|
|
201
|
-
* the `components` or `defaultComponent` props to determine the rendered
|
|
204
|
+
* the `components` or `defaultComponent` props to determine the rendered
|
|
205
|
+
* component.
|
|
202
206
|
*
|
|
203
207
|
* @deprecated Use the `components` prop instead.
|
|
204
208
|
*
|
package/src/clientHooks.ts
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
* A hook that queries content from the Prismic repository.
|
|
12
12
|
*
|
|
13
13
|
* @remarks
|
|
14
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
15
|
-
*
|
|
14
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
15
|
+
* `params.client`.
|
|
16
16
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
17
17
|
*
|
|
18
18
|
* @param params - Parameters to filter, sort, and paginate results
|
|
@@ -31,8 +31,8 @@ export const usePrismicDocuments = <TDocument extends prismicT.PrismicDocument>(
|
|
|
31
31
|
* first result, if any.
|
|
32
32
|
*
|
|
33
33
|
* @remarks
|
|
34
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
35
|
-
*
|
|
34
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
35
|
+
* `params.client`.
|
|
36
36
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
37
37
|
*
|
|
38
38
|
* @param params - Parameters to filter, sort, and paginate results
|
|
@@ -50,11 +50,12 @@ export const useFirstPrismicDocument = <
|
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* A hook that queries content from the Prismic repository and returns all
|
|
53
|
-
* matching content. If no predicates are provided, all documents will be
|
|
53
|
+
* matching content. If no predicates are provided, all documents will be
|
|
54
|
+
* fetched.
|
|
54
55
|
*
|
|
55
56
|
* @remarks
|
|
56
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
57
|
-
*
|
|
57
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
58
|
+
* `params.client`.
|
|
58
59
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
59
60
|
*
|
|
60
61
|
* @param params - Parameters to filter and sort results
|
|
@@ -74,11 +75,12 @@ export const useAllPrismicDocumentsDangerously = <
|
|
|
74
75
|
useStatefulPrismicClientMethod("dangerouslyGetAll", args);
|
|
75
76
|
|
|
76
77
|
/**
|
|
77
|
-
* A hook that queries a document from the Prismic repository with a specific
|
|
78
|
+
* A hook that queries a document from the Prismic repository with a specific
|
|
79
|
+
* ID.
|
|
78
80
|
*
|
|
79
81
|
* @remarks
|
|
80
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
81
|
-
*
|
|
82
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
83
|
+
* `params.client`.
|
|
82
84
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
83
85
|
*
|
|
84
86
|
* @param id - ID of the document
|
|
@@ -102,8 +104,8 @@ export const usePrismicDocumentByID = <
|
|
|
102
104
|
* A hook that queries documents from the Prismic repository with specific IDs.
|
|
103
105
|
*
|
|
104
106
|
* @remarks
|
|
105
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
106
|
-
*
|
|
107
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
108
|
+
* `params.client`.
|
|
107
109
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
108
110
|
*
|
|
109
111
|
* @param ids - A list of document IDs
|
|
@@ -124,11 +126,12 @@ export const usePrismicDocumentsByIDs = <
|
|
|
124
126
|
useStatefulPrismicClientMethod("getByIDs", args);
|
|
125
127
|
|
|
126
128
|
/**
|
|
127
|
-
* A hook that queries all documents from the Prismic repository with specific
|
|
129
|
+
* A hook that queries all documents from the Prismic repository with specific
|
|
130
|
+
* IDs.
|
|
128
131
|
*
|
|
129
132
|
* @remarks
|
|
130
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
131
|
-
*
|
|
133
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
134
|
+
* `params.client`.
|
|
132
135
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
133
136
|
*
|
|
134
137
|
* @param ids - A list of document IDs
|
|
@@ -153,8 +156,8 @@ export const useAllPrismicDocumentsByIDs = <
|
|
|
153
156
|
* UID and Custom Type.
|
|
154
157
|
*
|
|
155
158
|
* @remarks
|
|
156
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
157
|
-
*
|
|
159
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
160
|
+
* `params.client`.
|
|
158
161
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
159
162
|
*
|
|
160
163
|
* @param documentType - The API ID of the document's Custom Type
|
|
@@ -181,8 +184,8 @@ export const usePrismicDocumentByUID = <
|
|
|
181
184
|
* of a Custom Type.
|
|
182
185
|
*
|
|
183
186
|
* @remarks
|
|
184
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
185
|
-
*
|
|
187
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
188
|
+
* `params.client`.
|
|
186
189
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
187
190
|
*
|
|
188
191
|
* @param documentType - The API ID of the document's Custom Type
|
|
@@ -209,8 +212,8 @@ export const usePrismicDocumentsByUIDs = <
|
|
|
209
212
|
* UIDs of a Custom Type.
|
|
210
213
|
*
|
|
211
214
|
* @remarks
|
|
212
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
213
|
-
*
|
|
215
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
216
|
+
* `params.client`.
|
|
214
217
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
215
218
|
*
|
|
216
219
|
* @param documentType - The API ID of the document's Custom Type
|
|
@@ -237,8 +240,8 @@ export const useAllPrismicDocumentsByUIDs = <
|
|
|
237
240
|
* specific Custom Type.
|
|
238
241
|
*
|
|
239
242
|
* @remarks
|
|
240
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
241
|
-
*
|
|
243
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
244
|
+
* `params.client`.
|
|
242
245
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
243
246
|
*
|
|
244
247
|
* @param documentType - The API ID of the singleton Custom Type
|
|
@@ -259,11 +262,12 @@ export const useSinglePrismicDocument = <
|
|
|
259
262
|
useStatefulPrismicClientMethod("getSingle", args);
|
|
260
263
|
|
|
261
264
|
/**
|
|
262
|
-
* A hook that queries documents from the Prismic repository for a specific
|
|
265
|
+
* A hook that queries documents from the Prismic repository for a specific
|
|
266
|
+
* Custom Type.
|
|
263
267
|
*
|
|
264
268
|
* @remarks
|
|
265
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
266
|
-
*
|
|
269
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
270
|
+
* `params.client`.
|
|
267
271
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
268
272
|
*
|
|
269
273
|
* @param documentType - The API ID of the Custom Type
|
|
@@ -288,8 +292,8 @@ export const usePrismicDocumentsByType = <
|
|
|
288
292
|
* Custom Type.
|
|
289
293
|
*
|
|
290
294
|
* @remarks
|
|
291
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
292
|
-
*
|
|
295
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
296
|
+
* `params.client`.
|
|
293
297
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
294
298
|
*
|
|
295
299
|
* @param documentType - The API ID of the Custom Type
|
|
@@ -310,11 +314,12 @@ export const useAllPrismicDocumentsByType = <
|
|
|
310
314
|
useStatefulPrismicClientMethod("getAllByType", args);
|
|
311
315
|
|
|
312
316
|
/**
|
|
313
|
-
* A hook that queries documents from the Prismic repository with a specific
|
|
317
|
+
* A hook that queries documents from the Prismic repository with a specific
|
|
318
|
+
* tag.
|
|
314
319
|
*
|
|
315
320
|
* @remarks
|
|
316
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
317
|
-
*
|
|
321
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
322
|
+
* `params.client`.
|
|
318
323
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
319
324
|
*
|
|
320
325
|
* @param tag - The tag that must be included on a document
|
|
@@ -335,11 +340,12 @@ export const usePrismicDocumentsByTag = <
|
|
|
335
340
|
useStatefulPrismicClientMethod("getByTag", args);
|
|
336
341
|
|
|
337
342
|
/**
|
|
338
|
-
* A hook that queries all documents from the Prismic repository with a specific
|
|
343
|
+
* A hook that queries all documents from the Prismic repository with a specific
|
|
344
|
+
* tag.
|
|
339
345
|
*
|
|
340
346
|
* @remarks
|
|
341
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
342
|
-
*
|
|
347
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
348
|
+
* `params.client`.
|
|
343
349
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
344
350
|
*
|
|
345
351
|
* @param tag - The tag that must be included on a document
|
|
@@ -361,11 +367,12 @@ export const useAllPrismicDocumentsByTag = <
|
|
|
361
367
|
|
|
362
368
|
/**
|
|
363
369
|
* A hook that queries documents from the Prismic repository with specific tags.
|
|
364
|
-
* A document must be tagged with at least one of the queried tags to be
|
|
370
|
+
* A document must be tagged with at least one of the queried tags to be
|
|
371
|
+
* included.
|
|
365
372
|
*
|
|
366
373
|
* @remarks
|
|
367
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
368
|
-
*
|
|
374
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
375
|
+
* `params.client`.
|
|
369
376
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
370
377
|
*
|
|
371
378
|
* @param tags - A list of tags that must be included on a document
|
|
@@ -387,11 +394,12 @@ export const usePrismicDocumentsBySomeTags = <
|
|
|
387
394
|
|
|
388
395
|
/**
|
|
389
396
|
* A hook that queries all documents from the Prismic repository with specific
|
|
390
|
-
* tags. A document must be tagged with at least one of the queried tags to be
|
|
397
|
+
* tags. A document must be tagged with at least one of the queried tags to be
|
|
398
|
+
* included.
|
|
391
399
|
*
|
|
392
400
|
* @remarks
|
|
393
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
394
|
-
*
|
|
401
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
402
|
+
* `params.client`.
|
|
395
403
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
396
404
|
*
|
|
397
405
|
* @param tags - A list of tags that must be included on a document
|
|
@@ -416,8 +424,8 @@ export const useAllPrismicDocumentsBySomeTags = <
|
|
|
416
424
|
* A document must be tagged with all of the queried tags to be included.
|
|
417
425
|
*
|
|
418
426
|
* @remarks
|
|
419
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
420
|
-
*
|
|
427
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
428
|
+
* `params.client`.
|
|
421
429
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
422
430
|
*
|
|
423
431
|
* @param tags - A list of tags that must be included on a document
|
|
@@ -442,8 +450,8 @@ export const usePrismicDocumentsByEveryTag = <
|
|
|
442
450
|
* tags. A document must be tagged with all of the queried tags to be included.
|
|
443
451
|
*
|
|
444
452
|
* @remarks
|
|
445
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
446
|
-
*
|
|
453
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
454
|
+
* `params.client`.
|
|
447
455
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
448
456
|
*
|
|
449
457
|
* @param tags - A list of tags that must be included on a document
|
|
@@ -76,7 +76,8 @@ export type HookOnlyParameters = {
|
|
|
76
76
|
*
|
|
77
77
|
* @param value - The value to check.
|
|
78
78
|
*
|
|
79
|
-
* @returns `true` if `value` is a `@prismicio/client` params object, `false`
|
|
79
|
+
* @returns `true` if `value` is a `@prismicio/client` params object, `false`
|
|
80
|
+
* otherwise.
|
|
80
81
|
*/
|
|
81
82
|
const isParams = (
|
|
82
83
|
value: unknown,
|