@prismicio/react 2.5.0 → 2.5.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.
Files changed (102) hide show
  1. package/dist/PrismicImage.cjs +67 -0
  2. package/dist/PrismicImage.cjs.map +1 -0
  3. package/dist/PrismicImage.d.ts +163 -0
  4. package/dist/PrismicImage.js +49 -0
  5. package/dist/PrismicImage.js.map +1 -0
  6. package/dist/PrismicLink.cjs +91 -0
  7. package/dist/PrismicLink.cjs.map +1 -0
  8. package/dist/PrismicLink.d.ts +105 -0
  9. package/dist/PrismicLink.js +73 -0
  10. package/dist/PrismicLink.js.map +1 -0
  11. package/dist/PrismicProvider.cjs +41 -0
  12. package/dist/PrismicProvider.cjs.map +1 -0
  13. package/dist/PrismicProvider.d.ts +84 -0
  14. package/dist/PrismicProvider.js +24 -0
  15. package/dist/PrismicProvider.js.map +1 -0
  16. package/dist/PrismicRichText.cjs +97 -0
  17. package/dist/PrismicRichText.cjs.map +1 -0
  18. package/dist/PrismicRichText.d.ts +116 -0
  19. package/dist/PrismicRichText.js +78 -0
  20. package/dist/PrismicRichText.js.map +1 -0
  21. package/dist/PrismicText.cjs +42 -0
  22. package/dist/PrismicText.cjs.map +1 -0
  23. package/dist/PrismicText.d.ts +39 -0
  24. package/dist/PrismicText.js +24 -0
  25. package/dist/PrismicText.js.map +1 -0
  26. package/dist/PrismicToolbar.cjs +41 -0
  27. package/dist/PrismicToolbar.cjs.map +1 -0
  28. package/dist/PrismicToolbar.d.ts +21 -0
  29. package/dist/PrismicToolbar.js +24 -0
  30. package/dist/PrismicToolbar.js.map +1 -0
  31. package/dist/SliceZone.cjs +58 -0
  32. package/dist/SliceZone.cjs.map +1 -0
  33. package/dist/SliceZone.d.ts +188 -0
  34. package/dist/SliceZone.js +41 -0
  35. package/dist/SliceZone.js.map +1 -0
  36. package/dist/clientHooks.cjs +40 -0
  37. package/dist/clientHooks.cjs.map +1 -0
  38. package/dist/clientHooks.d.ts +357 -0
  39. package/dist/clientHooks.js +40 -0
  40. package/dist/clientHooks.js.map +1 -0
  41. package/dist/index.cjs +46 -574
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.d.ts +46 -1290
  44. package/dist/index.js +46 -519
  45. package/dist/index.js.map +1 -1
  46. package/dist/lib/__PRODUCTION__.cjs +8 -0
  47. package/dist/lib/__PRODUCTION__.cjs.map +1 -0
  48. package/dist/lib/__PRODUCTION__.d.ts +7 -0
  49. package/dist/lib/__PRODUCTION__.js +8 -0
  50. package/dist/lib/__PRODUCTION__.js.map +1 -0
  51. package/dist/lib/devMsg.cjs +8 -0
  52. package/dist/lib/devMsg.cjs.map +1 -0
  53. package/dist/lib/devMsg.d.ts +16 -0
  54. package/dist/lib/devMsg.js +8 -0
  55. package/dist/lib/devMsg.js.map +1 -0
  56. package/dist/lib/invariant.cjs +15 -0
  57. package/dist/lib/invariant.cjs.map +1 -0
  58. package/dist/lib/invariant.d.ts +24 -0
  59. package/dist/lib/invariant.js +15 -0
  60. package/dist/lib/invariant.js.map +1 -0
  61. package/dist/lib/isInternalURL.cjs +9 -0
  62. package/dist/lib/isInternalURL.cjs.map +1 -0
  63. package/dist/lib/isInternalURL.d.ts +8 -0
  64. package/dist/lib/isInternalURL.js +9 -0
  65. package/dist/lib/isInternalURL.js.map +1 -0
  66. package/dist/lib/pascalCase.cjs +10 -0
  67. package/dist/lib/pascalCase.cjs.map +1 -0
  68. package/dist/lib/pascalCase.d.ts +26 -0
  69. package/dist/lib/pascalCase.js +10 -0
  70. package/dist/lib/pascalCase.js.map +1 -0
  71. package/dist/package.json.cjs +5 -0
  72. package/dist/package.json.cjs.map +1 -0
  73. package/dist/package.json.js +5 -0
  74. package/dist/package.json.js.map +1 -0
  75. package/dist/types.d.ts +19 -0
  76. package/dist/usePrismicClient.cjs +12 -0
  77. package/dist/usePrismicClient.cjs.map +1 -0
  78. package/dist/usePrismicClient.d.ts +11 -0
  79. package/dist/usePrismicClient.js +12 -0
  80. package/dist/usePrismicClient.js.map +1 -0
  81. package/dist/usePrismicContext.cjs +26 -0
  82. package/dist/usePrismicContext.cjs.map +1 -0
  83. package/dist/usePrismicContext.d.ts +8 -0
  84. package/dist/usePrismicContext.js +9 -0
  85. package/dist/usePrismicContext.js.map +1 -0
  86. package/dist/usePrismicPreviewResolver.cjs +44 -0
  87. package/dist/usePrismicPreviewResolver.cjs.map +1 -0
  88. package/dist/usePrismicPreviewResolver.d.ts +45 -0
  89. package/dist/usePrismicPreviewResolver.js +27 -0
  90. package/dist/usePrismicPreviewResolver.js.map +1 -0
  91. package/dist/useStatefulPrismicClientMethod.cjs +89 -0
  92. package/dist/useStatefulPrismicClientMethod.cjs.map +1 -0
  93. package/dist/useStatefulPrismicClientMethod.d.ts +44 -0
  94. package/dist/useStatefulPrismicClientMethod.js +72 -0
  95. package/dist/useStatefulPrismicClientMethod.js.map +1 -0
  96. package/package.json +43 -41
  97. package/src/PrismicImage.tsx +2 -1
  98. package/src/PrismicProvider.tsx +6 -3
  99. package/src/PrismicText.tsx +2 -1
  100. package/src/SliceZone.tsx +8 -4
  101. package/src/clientHooks.ts +52 -44
  102. package/src/useStatefulPrismicClientMethod.ts +2 -1
@@ -0,0 +1,357 @@
1
+ import type * as prismicT from "@prismicio/types";
2
+ import { ClientHookReturnType, HookOnlyParameters } from "./useStatefulPrismicClientMethod";
3
+ /**
4
+ * A hook that queries content from the Prismic repository.
5
+ *
6
+ * @remarks
7
+ * An additional `@prismicio/client` instance can be provided at
8
+ * `params.client`.
9
+ * @typeParam TDocument - Type of Prismic documents returned
10
+ *
11
+ * @param params - Parameters to filter, sort, and paginate results
12
+ *
13
+ * @returns The composable payload {@link ClientHookReturnType}
14
+ *
15
+ * @see Underlying `@prismicio/client` method {@link proto.get}
16
+ */
17
+ export declare const usePrismicDocuments: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
18
+ signal?: any;
19
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
20
+ /**
21
+ * A hook that queries content from the Prismic repository and returns only the
22
+ * first result, if any.
23
+ *
24
+ * @remarks
25
+ * An additional `@prismicio/client` instance can be provided at
26
+ * `params.client`.
27
+ * @typeParam TDocument - Type of the Prismic document returned
28
+ *
29
+ * @param params - Parameters to filter, sort, and paginate results
30
+ *
31
+ * @returns The composable payload {@link ClientHookReturnType}
32
+ *
33
+ * @see Underlying `@prismicio/client` method {@link proto.getFirst}
34
+ */
35
+ export declare const useFirstPrismicDocument: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
36
+ signal?: any;
37
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument>;
38
+ /**
39
+ * A hook that queries content from the Prismic repository and returns all
40
+ * matching content. If no predicates are provided, all documents will be
41
+ * fetched.
42
+ *
43
+ * @remarks
44
+ * An additional `@prismicio/client` instance can be provided at
45
+ * `params.client`.
46
+ * @typeParam TDocument - Type of Prismic documents returned
47
+ *
48
+ * @param params - Parameters to filter and sort results
49
+ *
50
+ * @returns The composable payload {@link ClientHookReturnType}
51
+ *
52
+ * @see Underlying `@prismicio/client` method {@link proto.getAll}
53
+ */
54
+ export declare const useAllPrismicDocumentsDangerously: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(params?: (Partial<Omit<import("@prismicio/client").BuildQueryURLArgs, "page">> & {
55
+ limit?: number | undefined;
56
+ } & {
57
+ signal?: any;
58
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
59
+ /**
60
+ * A hook that queries a document from the Prismic repository with a specific
61
+ * ID.
62
+ *
63
+ * @remarks
64
+ * An additional `@prismicio/client` instance can be provided at
65
+ * `params.client`.
66
+ * @typeParam TDocument - Type of the Prismic document returned
67
+ *
68
+ * @param id - ID of the document
69
+ * @param params - Parameters to filter, sort, and paginate results
70
+ *
71
+ * @returns The composable payload {@link ClientHookReturnType}
72
+ *
73
+ * @see Underlying `@prismicio/client` method {@link proto.getByID}
74
+ */
75
+ export declare const usePrismicDocumentByID: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(id: string, params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
76
+ signal?: any;
77
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument>;
78
+ /**
79
+ * A hook that queries documents from the Prismic repository with specific IDs.
80
+ *
81
+ * @remarks
82
+ * An additional `@prismicio/client` instance can be provided at
83
+ * `params.client`.
84
+ * @typeParam TDocument - Type of Prismic documents returned
85
+ *
86
+ * @param ids - A list of document IDs
87
+ * @param params - Parameters to filter, sort, and paginate results
88
+ *
89
+ * @returns The composable payload {@link ClientHookReturnType}
90
+ *
91
+ * @see Underlying `@prismicio/client` method {@link proto.getByIDs}
92
+ */
93
+ export declare const usePrismicDocumentsByIDs: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(id: string[], params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
94
+ signal?: any;
95
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
96
+ /**
97
+ * A hook that queries all documents from the Prismic repository with specific
98
+ * IDs.
99
+ *
100
+ * @remarks
101
+ * An additional `@prismicio/client` instance can be provided at
102
+ * `params.client`.
103
+ * @typeParam TDocument - Type of Prismic documents returned
104
+ *
105
+ * @param ids - A list of document IDs
106
+ * @param params - Parameters to filter and sort results
107
+ *
108
+ * @returns The composable payload {@link ClientHookReturnType}
109
+ *
110
+ * @see Underlying `@prismicio/client` method {@link proto.getAllByIDs}
111
+ */
112
+ export declare const useAllPrismicDocumentsByIDs: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(id: string[], params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
113
+ limit?: number | undefined;
114
+ } & {
115
+ signal?: any;
116
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
117
+ /**
118
+ * A hook that queries a document from the Prismic repository with a specific
119
+ * UID and Custom Type.
120
+ *
121
+ * @remarks
122
+ * An additional `@prismicio/client` instance can be provided at
123
+ * `params.client`.
124
+ * @typeParam TDocument - Type of the Prismic document returned
125
+ *
126
+ * @param documentType - The API ID of the document's Custom Type
127
+ * @param uid - UID of the document
128
+ * @param params - Parameters to filter, sort, and paginate results
129
+ *
130
+ * @returns The composable payload {@link ClientHookReturnType}
131
+ *
132
+ * @see Underlying `@prismicio/client` method {@link proto.getByUID}
133
+ */
134
+ export declare const usePrismicDocumentByUID: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(documentType: any, uid: string, params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
135
+ signal?: any;
136
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument>;
137
+ /**
138
+ * A hook that queries documents from the Prismic repository with specific UIDs
139
+ * of a Custom Type.
140
+ *
141
+ * @remarks
142
+ * An additional `@prismicio/client` instance can be provided at
143
+ * `params.client`.
144
+ * @typeParam TDocument - Type of the Prismic document returned
145
+ *
146
+ * @param documentType - The API ID of the document's Custom Type
147
+ * @param uids - A list of document UIDs.
148
+ * @param params - Parameters to filter, sort, and paginate results
149
+ *
150
+ * @returns The composable payload {@link ClientHookReturnType}
151
+ *
152
+ * @see Underlying `@prismicio/client` method {@link proto.getByUID}
153
+ */
154
+ export declare const usePrismicDocumentsByUIDs: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(documentType: any, uids: string[], params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
155
+ signal?: any;
156
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
157
+ /**
158
+ * A hook that queries all documents from the Prismic repository with specific
159
+ * UIDs of a Custom Type.
160
+ *
161
+ * @remarks
162
+ * An additional `@prismicio/client` instance can be provided at
163
+ * `params.client`.
164
+ * @typeParam TDocument - Type of the Prismic document returned
165
+ *
166
+ * @param documentType - The API ID of the document's Custom Type
167
+ * @param uids - A list of document UIDs.
168
+ * @param params - Parameters to filter, sort, and paginate results
169
+ *
170
+ * @returns The composable payload {@link ClientHookReturnType}
171
+ *
172
+ * @see Underlying `@prismicio/client` method {@link proto.getByUID}
173
+ */
174
+ export declare const useAllPrismicDocumentsByUIDs: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(documentType: any, uids: string[], params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
175
+ signal?: any;
176
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
177
+ /**
178
+ * A hook that queries a singleton document from the Prismic repository for a
179
+ * specific Custom Type.
180
+ *
181
+ * @remarks
182
+ * An additional `@prismicio/client` instance can be provided at
183
+ * `params.client`.
184
+ * @typeParam TDocument - Type of the Prismic document returned
185
+ *
186
+ * @param documentType - The API ID of the singleton Custom Type
187
+ * @param params - Parameters to filter, sort, and paginate results
188
+ *
189
+ * @returns The composable payload {@link ClientHookReturnType}
190
+ *
191
+ * @see Underlying `@prismicio/client` method {@link proto.getSingle}
192
+ */
193
+ export declare const useSinglePrismicDocument: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(documentType: any, params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
194
+ signal?: any;
195
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument>;
196
+ /**
197
+ * A hook that queries documents from the Prismic repository for a specific
198
+ * Custom Type.
199
+ *
200
+ * @remarks
201
+ * An additional `@prismicio/client` instance can be provided at
202
+ * `params.client`.
203
+ * @typeParam TDocument - Type of Prismic documents returned
204
+ *
205
+ * @param documentType - The API ID of the Custom Type
206
+ * @param params - Parameters to filter, sort, and paginate results
207
+ *
208
+ * @returns The composable payload {@link ClientHookReturnType}
209
+ *
210
+ * @see Underlying `@prismicio/client` method {@link proto.getByType}
211
+ */
212
+ export declare const usePrismicDocumentsByType: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(documentType: any, params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
213
+ signal?: any;
214
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
215
+ /**
216
+ * A hook that queries all documents from the Prismic repository for a specific
217
+ * Custom Type.
218
+ *
219
+ * @remarks
220
+ * An additional `@prismicio/client` instance can be provided at
221
+ * `params.client`.
222
+ * @typeParam TDocument - Type of Prismic documents returned
223
+ *
224
+ * @param documentType - The API ID of the Custom Type
225
+ * @param params - Parameters to filter and sort results
226
+ *
227
+ * @returns The composable payload {@link ClientHookReturnType}
228
+ *
229
+ * @see Underlying `@prismicio/client` method {@link proto.getAllByType}
230
+ */
231
+ export declare const useAllPrismicDocumentsByType: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(documentType: any, params?: (Partial<Omit<import("@prismicio/client").BuildQueryURLArgs, "page">> & {
232
+ limit?: number | undefined;
233
+ } & {
234
+ signal?: any;
235
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
236
+ /**
237
+ * A hook that queries documents from the Prismic repository with a specific
238
+ * tag.
239
+ *
240
+ * @remarks
241
+ * An additional `@prismicio/client` instance can be provided at
242
+ * `params.client`.
243
+ * @typeParam TDocument - Type of Prismic documents returned
244
+ *
245
+ * @param tag - The tag that must be included on a document
246
+ * @param params - Parameters to filter, sort, and paginate results
247
+ *
248
+ * @returns The composable payload {@link ClientHookReturnType}
249
+ *
250
+ * @see Underlying `@prismicio/client` method {@link proto.getByTag}
251
+ */
252
+ export declare const usePrismicDocumentsByTag: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(tag: string, params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
253
+ signal?: any;
254
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
255
+ /**
256
+ * A hook that queries all documents from the Prismic repository with a specific
257
+ * tag.
258
+ *
259
+ * @remarks
260
+ * An additional `@prismicio/client` instance can be provided at
261
+ * `params.client`.
262
+ * @typeParam TDocument - Type of Prismic documents returned
263
+ *
264
+ * @param tag - The tag that must be included on a document
265
+ * @param params - Parameters to filter and sort results
266
+ *
267
+ * @returns The composable payload {@link ClientHookReturnType}
268
+ *
269
+ * @see Underlying `@prismicio/client` method {@link proto.getAllByTag}
270
+ */
271
+ export declare const useAllPrismicDocumentsByTag: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(tag: string, params?: (Partial<Omit<import("@prismicio/client").BuildQueryURLArgs, "page">> & {
272
+ limit?: number | undefined;
273
+ } & {
274
+ signal?: any;
275
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
276
+ /**
277
+ * A hook that queries documents from the Prismic repository with specific tags.
278
+ * A document must be tagged with at least one of the queried tags to be
279
+ * included.
280
+ *
281
+ * @remarks
282
+ * An additional `@prismicio/client` instance can be provided at
283
+ * `params.client`.
284
+ * @typeParam TDocument - Type of Prismic documents returned
285
+ *
286
+ * @param tags - A list of tags that must be included on a document
287
+ * @param params - Parameters to filter, sort, and paginate results
288
+ *
289
+ * @returns The composable payload {@link ClientHookReturnType}
290
+ *
291
+ * @see Underlying `@prismicio/client` method {@link proto.getByTags}
292
+ */
293
+ export declare const usePrismicDocumentsBySomeTags: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(tag: string[], params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
294
+ signal?: any;
295
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
296
+ /**
297
+ * A hook that queries all documents from the Prismic repository with specific
298
+ * tags. A document must be tagged with at least one of the queried tags to be
299
+ * included.
300
+ *
301
+ * @remarks
302
+ * An additional `@prismicio/client` instance can be provided at
303
+ * `params.client`.
304
+ * @typeParam TDocument - Type of Prismic documents returned
305
+ *
306
+ * @param tags - A list of tags that must be included on a document
307
+ * @param params - Parameters to filter and sort results
308
+ *
309
+ * @returns The composable payload {@link ClientHookReturnType}
310
+ *
311
+ * @see Underlying `@prismicio/client` method {@link proto.getAllByTags}
312
+ */
313
+ export declare const useAllPrismicDocumentsBySomeTags: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(tag: string[], params?: (Partial<Omit<import("@prismicio/client").BuildQueryURLArgs, "page">> & {
314
+ limit?: number | undefined;
315
+ } & {
316
+ signal?: any;
317
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
318
+ /**
319
+ * A hook that queries documents from the Prismic repository with specific tags.
320
+ * A document must be tagged with all of the queried tags to be included.
321
+ *
322
+ * @remarks
323
+ * An additional `@prismicio/client` instance can be provided at
324
+ * `params.client`.
325
+ * @typeParam TDocument - Type of Prismic documents returned
326
+ *
327
+ * @param tags - A list of tags that must be included on a document
328
+ * @param params - Parameters to filter, sort, and paginate results
329
+ *
330
+ * @returns The composable payload {@link ClientHookReturnType}
331
+ *
332
+ * @see Underlying `@prismicio/client` method {@link proto.getByTags}
333
+ */
334
+ export declare const usePrismicDocumentsByEveryTag: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(tag: string[], params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
335
+ signal?: any;
336
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<prismicT.Query<TDocument>>;
337
+ /**
338
+ * A hook that queries all documents from the Prismic repository with specific
339
+ * tags. A document must be tagged with all of the queried tags to be included.
340
+ *
341
+ * @remarks
342
+ * An additional `@prismicio/client` instance can be provided at
343
+ * `params.client`.
344
+ * @typeParam TDocument - Type of Prismic documents returned
345
+ *
346
+ * @param tags - A list of tags that must be included on a document
347
+ * @param params - Parameters to filter and sort results
348
+ *
349
+ * @returns The composable payload {@link ClientHookReturnType}
350
+ *
351
+ * @see Underlying `@prismicio/client` method {@link proto.getAllByTags}
352
+ */
353
+ export declare const useAllPrismicDocumentsByEveryTag: <TDocument extends prismicT.PrismicDocument<Record<string, any>, string, string>>(tag: string[], params?: (Partial<Omit<import("@prismicio/client").BuildQueryURLArgs, "page">> & {
354
+ limit?: number | undefined;
355
+ } & {
356
+ signal?: any;
357
+ } & HookOnlyParameters) | undefined) => ClientHookReturnType<TDocument[]>;
@@ -0,0 +1,40 @@
1
+ import { useStatefulPrismicClientMethod } from "./useStatefulPrismicClientMethod.js";
2
+ const usePrismicDocuments = (...args) => useStatefulPrismicClientMethod("get", args);
3
+ const useFirstPrismicDocument = (...args) => useStatefulPrismicClientMethod("getFirst", args);
4
+ const useAllPrismicDocumentsDangerously = (...args) => useStatefulPrismicClientMethod("dangerouslyGetAll", args);
5
+ const usePrismicDocumentByID = (...args) => useStatefulPrismicClientMethod("getByID", args);
6
+ const usePrismicDocumentsByIDs = (...args) => useStatefulPrismicClientMethod("getByIDs", args);
7
+ const useAllPrismicDocumentsByIDs = (...args) => useStatefulPrismicClientMethod("getAllByIDs", args);
8
+ const usePrismicDocumentByUID = (...args) => useStatefulPrismicClientMethod("getByUID", args);
9
+ const usePrismicDocumentsByUIDs = (...args) => useStatefulPrismicClientMethod("getByUIDs", args);
10
+ const useAllPrismicDocumentsByUIDs = (...args) => useStatefulPrismicClientMethod("getAllByUIDs", args);
11
+ const useSinglePrismicDocument = (...args) => useStatefulPrismicClientMethod("getSingle", args);
12
+ const usePrismicDocumentsByType = (...args) => useStatefulPrismicClientMethod("getByType", args);
13
+ const useAllPrismicDocumentsByType = (...args) => useStatefulPrismicClientMethod("getAllByType", args);
14
+ const usePrismicDocumentsByTag = (...args) => useStatefulPrismicClientMethod("getByTag", args);
15
+ const useAllPrismicDocumentsByTag = (...args) => useStatefulPrismicClientMethod("getAllByTag", args);
16
+ const usePrismicDocumentsBySomeTags = (...args) => useStatefulPrismicClientMethod("getBySomeTags", args);
17
+ const useAllPrismicDocumentsBySomeTags = (...args) => useStatefulPrismicClientMethod("getAllBySomeTags", args);
18
+ const usePrismicDocumentsByEveryTag = (...args) => useStatefulPrismicClientMethod("getByEveryTag", args);
19
+ const useAllPrismicDocumentsByEveryTag = (...args) => useStatefulPrismicClientMethod("getAllByEveryTag", args);
20
+ export {
21
+ useAllPrismicDocumentsByEveryTag,
22
+ useAllPrismicDocumentsByIDs,
23
+ useAllPrismicDocumentsBySomeTags,
24
+ useAllPrismicDocumentsByTag,
25
+ useAllPrismicDocumentsByType,
26
+ useAllPrismicDocumentsByUIDs,
27
+ useAllPrismicDocumentsDangerously,
28
+ useFirstPrismicDocument,
29
+ usePrismicDocumentByID,
30
+ usePrismicDocumentByUID,
31
+ usePrismicDocuments,
32
+ usePrismicDocumentsByEveryTag,
33
+ usePrismicDocumentsByIDs,
34
+ usePrismicDocumentsBySomeTags,
35
+ usePrismicDocumentsByTag,
36
+ usePrismicDocumentsByType,
37
+ usePrismicDocumentsByUIDs,
38
+ useSinglePrismicDocument
39
+ };
40
+ //# sourceMappingURL=clientHooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientHooks.js","sources":["../../src/clientHooks.ts"],"sourcesContent":["import type * as prismicT from \"@prismicio/types\";\n\nimport {\n\tClientHookReturnType,\n\tClientMethodParameters,\n\tHookOnlyParameters,\n\tuseStatefulPrismicClientMethod,\n} from \"./useStatefulPrismicClientMethod\";\n\n/**\n * A hook that queries content from the Prismic repository.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.get}\n */\nexport const usePrismicDocuments = <TDocument extends prismicT.PrismicDocument>(\n\t...args: [params?: ClientMethodParameters<\"get\">[0] & HookOnlyParameters]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"get\", args);\n\n/**\n * A hook that queries content from the Prismic repository and returns only the\n * first result, if any.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getFirst}\n */\nexport const useFirstPrismicDocument = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [params?: ClientMethodParameters<\"getFirst\">[0] & HookOnlyParameters]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getFirst\", args);\n\n/**\n * A hook that queries content from the Prismic repository and returns all\n * matching content. If no predicates are provided, all documents will be\n * fetched.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAll}\n */\nexport const useAllPrismicDocumentsDangerously = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tparams?: ClientMethodParameters<\"dangerouslyGetAll\">[0] &\n\t\t\tHookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"dangerouslyGetAll\", args);\n\n/**\n * A hook that queries a document from the Prismic repository with a specific\n * ID.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param id - ID of the document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByID}\n */\nexport const usePrismicDocumentByID = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getByID\">[0],\n\t\tparams?: ClientMethodParameters<\"getByID\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByID\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific IDs.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param ids - A list of document IDs\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByIDs}\n */\nexport const usePrismicDocumentsByIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getByIDs\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByIDs\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * IDs.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param ids - A list of document IDs\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByIDs}\n */\nexport const useAllPrismicDocumentsByIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getAllByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByIDs\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByIDs\", args);\n\n/**\n * A hook that queries a document from the Prismic repository with a specific\n * UID and Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uid - UID of the document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const usePrismicDocumentByUID = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUID\">[0],\n\t\tuid: ClientMethodParameters<\"getByUID\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUID\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByUID\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific UIDs\n * of a Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uids - A list of document UIDs.\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const usePrismicDocumentsByUIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUIDs\">[0],\n\t\tuids: ClientMethodParameters<\"getByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUIDs\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByUIDs\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * UIDs of a Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the document's Custom Type\n * @param uids - A list of document UIDs.\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByUID}\n */\nexport const useAllPrismicDocumentsByUIDs = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUIDs\">[0],\n\t\tuids: ClientMethodParameters<\"getByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUIDs\">[2] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByUIDs\", args);\n\n/**\n * A hook that queries a singleton document from the Prismic repository for a\n * specific Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of the Prismic document returned\n *\n * @param documentType - The API ID of the singleton Custom Type\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getSingle}\n */\nexport const useSinglePrismicDocument = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getSingle\">[0],\n\t\tparams?: ClientMethodParameters<\"getSingle\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getSingle\", args);\n\n/**\n * A hook that queries documents from the Prismic repository for a specific\n * Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param documentType - The API ID of the Custom Type\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByType}\n */\nexport const usePrismicDocumentsByType = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getByType\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByType\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository for a specific\n * Custom Type.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param documentType - The API ID of the Custom Type\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByType}\n */\nexport const useAllPrismicDocumentsByType = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getAllByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByType\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByType\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with a specific\n * tag.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tag - The tag that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTag}\n */\nexport const usePrismicDocumentsByTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByTag\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with a specific\n * tag.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tag - The tag that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTag}\n */\nexport const useAllPrismicDocumentsByTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByTag\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific tags.\n * A document must be tagged with at least one of the queried tags to be\n * included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTags}\n */\nexport const usePrismicDocumentsBySomeTags = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getBySomeTags\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getBySomeTags\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * tags. A document must be tagged with at least one of the queried tags to be\n * included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTags}\n */\nexport const useAllPrismicDocumentsBySomeTags = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllBySomeTags\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllBySomeTags\", args);\n\n/**\n * A hook that queries documents from the Prismic repository with specific tags.\n * A document must be tagged with all of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter, sort, and paginate results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getByTags}\n */\nexport const usePrismicDocumentsByEveryTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByEveryTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<prismicT.Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByEveryTag\", args);\n\n/**\n * A hook that queries all documents from the Prismic repository with specific\n * tags. A document must be tagged with all of the queried tags to be included.\n *\n * @remarks\n * An additional `@prismicio/client` instance can be provided at\n * `params.client`.\n * @typeParam TDocument - Type of Prismic documents returned\n *\n * @param tags - A list of tags that must be included on a document\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientHookReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link proto.getAllByTags}\n */\nexport const useAllPrismicDocumentsByEveryTag = <\n\tTDocument extends prismicT.PrismicDocument,\n>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByEveryTag\">[1] & HookOnlyParameters,\n\t]\n): ClientHookReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByEveryTag\", args);\n"],"names":[],"mappings":";AAuBO,MAAM,sBAAsB,IAC/B,SAEH,+BAA+B,OAAO,IAAI;AAiBpC,MAAM,0BAA0B,IAGnC,SAEH,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,oCAAoC,IAG7C,SAKH,+BAA+B,qBAAqB,IAAI;AAkBlD,MAAM,yBAAyB,IAGlC,SAKH,+BAA+B,WAAW,IAAI;AAiBxC,MAAM,2BAA2B,IAGpC,SAKH,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,8BAA8B,IAGvC,SAKH,+BAA+B,eAAe,IAAI;AAmB5C,MAAM,0BAA0B,IAGnC,SAMH,+BAA+B,YAAY,IAAI;AAmBzC,MAAM,4BAA4B,IAGrC,SAMH,+BAA+B,aAAa,IAAI;AAmB1C,MAAM,+BAA+B,IAGxC,SAMH,+BAA+B,gBAAgB,IAAI;AAkB7C,MAAM,2BAA2B,IAGpC,SAKH,+BAA+B,aAAa,IAAI;AAkB1C,MAAM,4BAA4B,IAGrC,SAKH,+BAA+B,aAAa,IAAI;AAkB1C,MAAM,+BAA+B,IAGxC,SAKH,+BAA+B,gBAAgB,IAAI;AAkB7C,MAAM,2BAA2B,IAGpC,SAKH,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,8BAA8B,IAGvC,SAKH,+BAA+B,eAAe,IAAI;AAmB5C,MAAM,gCAAgC,IAGzC,SAKH,+BAA+B,iBAAiB,IAAI;AAmB9C,MAAM,mCAAmC,IAG5C,SAKH,+BAA+B,oBAAoB,IAAI;AAkBjD,MAAM,gCAAgC,IAGzC,SAKH,+BAA+B,iBAAiB,IAAI;AAkB9C,MAAM,mCAAmC,IAG5C,SAKH,+BAA+B,oBAAoB,IAAI;"}