@prismicio/client 7.0.0-alpha.4 → 7.0.0

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 (178) hide show
  1. package/dist/buildQueryURL.cjs.map +1 -1
  2. package/dist/buildQueryURL.d.ts +4 -4
  3. package/dist/buildQueryURL.js.map +1 -1
  4. package/dist/createClient.cjs +24 -24
  5. package/dist/createClient.cjs.map +1 -1
  6. package/dist/createClient.d.ts +28 -28
  7. package/dist/createClient.js +24 -24
  8. package/dist/createClient.js.map +1 -1
  9. package/dist/filter.cjs +1 -1
  10. package/dist/filter.cjs.map +1 -1
  11. package/dist/filter.d.ts +1 -1
  12. package/dist/filter.js +1 -1
  13. package/dist/filter.js.map +1 -1
  14. package/dist/helpers/asDate.cjs.map +1 -1
  15. package/dist/helpers/asDate.d.ts +2 -2
  16. package/dist/helpers/asDate.js.map +1 -1
  17. package/dist/helpers/asHTML.cjs +5 -5
  18. package/dist/helpers/asHTML.cjs.map +1 -1
  19. package/dist/helpers/asHTML.d.ts +21 -21
  20. package/dist/helpers/asHTML.js +5 -5
  21. package/dist/helpers/asHTML.js.map +1 -1
  22. package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
  23. package/dist/helpers/asImagePixelDensitySrcSet.d.ts +5 -5
  24. package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
  25. package/dist/helpers/asImageSrc.cjs.map +1 -1
  26. package/dist/helpers/asImageSrc.d.ts +3 -3
  27. package/dist/helpers/asImageSrc.js.map +1 -1
  28. package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
  29. package/dist/helpers/asImageWidthSrcSet.d.ts +6 -6
  30. package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
  31. package/dist/helpers/asLink.cjs.map +1 -1
  32. package/dist/helpers/asLink.d.ts +14 -14
  33. package/dist/helpers/asLink.js.map +1 -1
  34. package/dist/helpers/asLinkAttrs.cjs.map +1 -1
  35. package/dist/helpers/asLinkAttrs.d.ts +5 -5
  36. package/dist/helpers/asLinkAttrs.js.map +1 -1
  37. package/dist/helpers/asText.cjs.map +1 -1
  38. package/dist/helpers/asText.d.ts +8 -8
  39. package/dist/helpers/asText.js.map +1 -1
  40. package/dist/helpers/documentToLinkField.cjs.map +1 -1
  41. package/dist/helpers/documentToLinkField.js.map +1 -1
  42. package/dist/helpers/isFilled.cjs +3 -1
  43. package/dist/helpers/isFilled.cjs.map +1 -1
  44. package/dist/helpers/isFilled.d.ts +24 -20
  45. package/dist/helpers/isFilled.js +3 -1
  46. package/dist/helpers/isFilled.js.map +1 -1
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.ts +12 -2
  49. package/dist/index.js.map +1 -1
  50. package/dist/package.json.cjs +1 -1
  51. package/dist/package.json.js +1 -1
  52. package/dist/types/api/repository.d.ts +2 -2
  53. package/dist/types/model/boolean.d.ts +1 -1
  54. package/dist/types/model/color.d.ts +1 -1
  55. package/dist/types/model/contentRelationship.d.ts +1 -1
  56. package/dist/types/model/customType.d.ts +11 -11
  57. package/dist/types/model/date.d.ts +1 -1
  58. package/dist/types/model/embed.d.ts +1 -1
  59. package/dist/types/model/geoPoint.d.ts +1 -1
  60. package/dist/types/model/group.d.ts +1 -1
  61. package/dist/types/model/image.d.ts +3 -3
  62. package/dist/types/model/{integrationFields.d.ts → integration.d.ts} +3 -3
  63. package/dist/types/model/keyText.d.ts +1 -1
  64. package/dist/types/model/link.cjs.map +1 -1
  65. package/dist/types/model/link.d.ts +2 -2
  66. package/dist/types/model/link.js.map +1 -1
  67. package/dist/types/model/linkToMedia.d.ts +1 -1
  68. package/dist/types/model/number.d.ts +1 -1
  69. package/dist/types/model/richText.d.ts +3 -3
  70. package/dist/types/model/select.d.ts +1 -1
  71. package/dist/types/model/sharedSlice.d.ts +2 -2
  72. package/dist/types/model/sharedSliceVariation.d.ts +1 -1
  73. package/dist/types/model/slice.cjs.map +1 -1
  74. package/dist/types/model/slice.d.ts +1 -1
  75. package/dist/types/model/slice.js.map +1 -1
  76. package/dist/types/model/sliceZone.cjs.map +1 -1
  77. package/dist/types/model/sliceZone.d.ts +2 -2
  78. package/dist/types/model/sliceZone.js.map +1 -1
  79. package/dist/types/model/timestamp.d.ts +1 -1
  80. package/dist/types/model/title.d.ts +1 -1
  81. package/dist/types/model/types.cjs +5 -1
  82. package/dist/types/model/types.cjs.map +1 -1
  83. package/dist/types/model/types.d.ts +10 -6
  84. package/dist/types/model/types.js +5 -1
  85. package/dist/types/model/types.js.map +1 -1
  86. package/dist/types/model/uid.d.ts +1 -1
  87. package/dist/types/value/boolean.d.ts +1 -1
  88. package/dist/types/value/color.d.ts +1 -1
  89. package/dist/types/value/contentRelationship.d.ts +1 -1
  90. package/dist/types/value/date.d.ts +1 -1
  91. package/dist/types/value/document.d.ts +4 -4
  92. package/dist/types/value/embed.cjs.map +1 -1
  93. package/dist/types/value/embed.d.ts +1 -1
  94. package/dist/types/value/embed.js.map +1 -1
  95. package/dist/types/value/geoPoint.d.ts +1 -1
  96. package/dist/types/value/group.d.ts +1 -1
  97. package/dist/types/value/image.d.ts +3 -3
  98. package/dist/types/value/{integrationFields.d.ts → integration.d.ts} +2 -2
  99. package/dist/types/value/keyText.d.ts +1 -1
  100. package/dist/types/value/link.cjs.map +1 -1
  101. package/dist/types/value/link.d.ts +2 -2
  102. package/dist/types/value/link.js.map +1 -1
  103. package/dist/types/value/linkToMedia.d.ts +2 -2
  104. package/dist/types/value/number.d.ts +1 -1
  105. package/dist/types/value/richText.cjs.map +1 -1
  106. package/dist/types/value/richText.d.ts +26 -26
  107. package/dist/types/value/richText.js.map +1 -1
  108. package/dist/types/value/select.d.ts +1 -1
  109. package/dist/types/value/sharedSlice.d.ts +1 -1
  110. package/dist/types/value/sharedSliceVariation.d.ts +3 -0
  111. package/dist/types/value/slice.d.ts +1 -1
  112. package/dist/types/value/timestamp.d.ts +1 -1
  113. package/dist/types/value/title.d.ts +1 -1
  114. package/dist/types/value/types.d.ts +2 -2
  115. package/dist/types/webhook/apiUpdate.d.ts +1 -1
  116. package/package.json +2 -2
  117. package/src/buildQueryURL.ts +4 -4
  118. package/src/createClient.ts +28 -28
  119. package/src/filter.ts +1 -1
  120. package/src/helpers/asDate.ts +2 -2
  121. package/src/helpers/asHTML.ts +28 -29
  122. package/src/helpers/asImagePixelDensitySrcSet.ts +5 -5
  123. package/src/helpers/asImageSrc.ts +3 -3
  124. package/src/helpers/asImageWidthSrcSet.ts +6 -6
  125. package/src/helpers/asLink.ts +18 -18
  126. package/src/helpers/asLinkAttrs.ts +5 -5
  127. package/src/helpers/asText.ts +8 -8
  128. package/src/helpers/documentToLinkField.ts +1 -1
  129. package/src/helpers/isFilled.ts +27 -22
  130. package/src/index.ts +19 -3
  131. package/src/types/api/repository.ts +2 -2
  132. package/src/types/model/boolean.ts +1 -1
  133. package/src/types/model/color.ts +1 -1
  134. package/src/types/model/contentRelationship.ts +1 -1
  135. package/src/types/model/customType.ts +11 -11
  136. package/src/types/model/date.ts +1 -1
  137. package/src/types/model/embed.ts +1 -1
  138. package/src/types/model/geoPoint.ts +1 -1
  139. package/src/types/model/group.ts +1 -1
  140. package/src/types/model/image.ts +3 -3
  141. package/src/types/model/{integrationFields.ts → integration.ts} +3 -3
  142. package/src/types/model/keyText.ts +1 -1
  143. package/src/types/model/link.ts +2 -2
  144. package/src/types/model/linkToMedia.ts +1 -1
  145. package/src/types/model/number.ts +1 -1
  146. package/src/types/model/richText.ts +3 -3
  147. package/src/types/model/select.ts +1 -1
  148. package/src/types/model/sharedSlice.ts +2 -2
  149. package/src/types/model/sharedSliceVariation.ts +1 -1
  150. package/src/types/model/slice.ts +1 -1
  151. package/src/types/model/sliceZone.ts +2 -2
  152. package/src/types/model/timestamp.ts +1 -1
  153. package/src/types/model/title.ts +1 -1
  154. package/src/types/model/types.ts +10 -6
  155. package/src/types/model/uid.ts +1 -1
  156. package/src/types/value/boolean.ts +1 -1
  157. package/src/types/value/color.ts +1 -1
  158. package/src/types/value/contentRelationship.ts +1 -1
  159. package/src/types/value/date.ts +1 -1
  160. package/src/types/value/document.ts +4 -4
  161. package/src/types/value/embed.ts +1 -1
  162. package/src/types/value/geoPoint.ts +1 -1
  163. package/src/types/value/group.ts +1 -1
  164. package/src/types/value/image.ts +4 -4
  165. package/src/types/value/{integrationFields.ts → integration.ts} +2 -2
  166. package/src/types/value/keyText.ts +1 -1
  167. package/src/types/value/link.ts +2 -2
  168. package/src/types/value/linkToMedia.ts +2 -2
  169. package/src/types/value/number.ts +1 -1
  170. package/src/types/value/richText.ts +26 -26
  171. package/src/types/value/select.ts +1 -1
  172. package/src/types/value/sharedSlice.ts +1 -1
  173. package/src/types/value/sharedSliceVariation.ts +3 -0
  174. package/src/types/value/slice.ts +1 -1
  175. package/src/types/value/timestamp.ts +1 -1
  176. package/src/types/value/title.ts +1 -1
  177. package/src/types/value/types.ts +2 -2
  178. package/src/types/webhook/apiUpdate.ts +1 -1
@@ -234,7 +234,7 @@ export type ClientConfig = {
234
234
  ref?: RefStringOrThunk;
235
235
 
236
236
  /**
237
- * A list of Route Resolver objects that define how a document's `url` field
237
+ * A list of route resolver objects that define how a document's `url` property
238
238
  * is resolved.
239
239
  *
240
240
  * {@link https://prismic.io/docs/route-resolver}
@@ -243,8 +243,8 @@ export type ClientConfig = {
243
243
 
244
244
  /**
245
245
  * The `brokenRoute` option allows you to define the route populated in the
246
- * `url` property for broken Link or Content Relationship fields. A broken
247
- * link is a Link or Content Relationship field whose linked document has been
246
+ * `url` property for broken link or content relationship fields. A broken
247
+ * link is a link or content relationship field whose linked document has been
248
248
  * unpublished or deleted.
249
249
  *
250
250
  * {@link https://prismic.io/docs/route-resolver}
@@ -327,7 +327,7 @@ type ResolvePreviewArgs<LinkResolverReturnType> = {
327
327
  linkResolver?: LinkResolverFunction<LinkResolverReturnType>;
328
328
 
329
329
  /**
330
- * A fallback URL if the Link Resolver does not return a value.
330
+ * A fallback URL if the link resolver does not return a value.
331
331
  */
332
332
  defaultURL: string;
333
333
 
@@ -415,7 +415,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
415
415
  accessToken?: string;
416
416
 
417
417
  /**
418
- * A list of Route Resolver objects that define how a document's `url` field
418
+ * A list of route resolver objects that define how a document's `url` field
419
419
  * is resolved.
420
420
  *
421
421
  * {@link https://prismic.io/docs/route-resolver}
@@ -424,8 +424,8 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
424
424
 
425
425
  /**
426
426
  * The `brokenRoute` option allows you to define the route populated in the
427
- * `url` property for broken Link or Content Relationship fields. A broken
428
- * link is a Link or Content Relationship field whose linked document has been
427
+ * `url` property for broken link or content relationship fields. A broken
428
+ * link is a link or content relationship field whose linked document has been
429
429
  * unpublished or deleted.
430
430
  *
431
431
  * {@link https://prismic.io/docs/route-resolver}
@@ -735,7 +735,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
735
735
  * A document's UID is different from its ID. An ID is automatically generated
736
736
  * for all documents and is made available on its `id` property. A UID is
737
737
  * provided in the Prismic editor and is unique among all documents of its
738
- * Custom Type.
738
+ * custom type.
739
739
  * @example
740
740
  *
741
741
  * ```ts
@@ -765,7 +765,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
765
765
  * A document's UID is different from its ID. An ID is automatically generated
766
766
  * for all documents and is made available on its `id` property. A UID is
767
767
  * provided in the Prismic editor and is unique among all documents of its
768
- * Custom Type.
768
+ * custom type.
769
769
  * @example
770
770
  *
771
771
  * ```ts
@@ -801,7 +801,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
801
801
  * A document's UID is different from its ID. An ID is automatically generated
802
802
  * for all documents and is made available on its `id` property. A UID is
803
803
  * provided in the Prismic editor and is unique among all documents of its
804
- * Custom Type.
804
+ * custom type.
805
805
  * @example
806
806
  *
807
807
  * ```ts
@@ -828,13 +828,13 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
828
828
 
829
829
  /**
830
830
  * Queries a document from the Prismic repository with a specific UID and
831
- * Custom Type.
831
+ * custom type.
832
832
  *
833
833
  * @remarks
834
834
  * A document's UID is different from its ID. An ID is automatically generated
835
835
  * for all documents and is made available on its `id` property. A UID is
836
836
  * provided in the Prismic editor and is unique among all documents of its
837
- * Custom Type.
837
+ * custom type.
838
838
  * @example
839
839
  *
840
840
  * ```ts
@@ -842,7 +842,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
842
842
  * ```
843
843
  *
844
844
  * @typeParam TDocument - Type of the Prismic document returned.
845
- * @param documentType - The API ID of the document's Custom Type.
845
+ * @param documentType - The API ID of the document's custom type.
846
846
  * @param uid - UID of the document.
847
847
  * @param params - Parameters to filter, sort, and paginate the results.
848
848
  *
@@ -873,7 +873,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
873
873
  * A document's UID is different from its ID. An ID is automatically generated
874
874
  * for all documents and is made available on its `id` property. A UID is
875
875
  * provided in the Prismic editor and is unique among all documents of its
876
- * Custom Type.
876
+ * custom type.
877
877
  * @example
878
878
  *
879
879
  * ```ts
@@ -884,7 +884,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
884
884
  * ```
885
885
  *
886
886
  * @typeParam TDocument - Type of the Prismic document returned.
887
- * @param documentType - The API ID of the document's Custom Type.
887
+ * @param documentType - The API ID of the document's custom type.
888
888
  * @param uids - A list of document UIDs.
889
889
  * @param params - Parameters to filter, sort, and paginate the results.
890
890
  *
@@ -909,7 +909,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
909
909
 
910
910
  /**
911
911
  * Queries all documents from the Prismic repository with specific UIDs and
912
- * Custom Type.
912
+ * custom type.
913
913
  *
914
914
  * This method may make multiple network requests to query all matching
915
915
  * content.
@@ -918,7 +918,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
918
918
  * A document's UID is different from its ID. An ID is automatically generated
919
919
  * for all documents and is made available on its `id` property. A UID is
920
920
  * provided in the Prismic editor and is unique among all documents of its
921
- * Custom Type.
921
+ * custom type.
922
922
  * @example
923
923
  *
924
924
  * ```ts
@@ -929,7 +929,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
929
929
  * ```
930
930
  *
931
931
  * @typeParam TDocument - Type of Prismic documents returned.
932
- * @param documentType - The API ID of the document's Custom Type.
932
+ * @param documentType - The API ID of the document's custom type.
933
933
  * @param uids - A list of document UIDs.
934
934
  * @param params - Parameters to filter, sort, and paginate the results.
935
935
  *
@@ -955,12 +955,12 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
955
955
 
956
956
  /**
957
957
  * Queries a singleton document from the Prismic repository for a specific
958
- * Custom Type.
958
+ * custom type.
959
959
  *
960
960
  * @remarks
961
961
  * A singleton document is one that is configured in Prismic to only allow one
962
962
  * instance. For example, a repository may be configured to contain just one
963
- * Settings document. This is in contrast to a repeatable Custom Type which
963
+ * Settings document. This is in contrast to a repeatable custom type which
964
964
  * allows multiple instances of itself.
965
965
  * @example
966
966
  *
@@ -969,10 +969,10 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
969
969
  * ```
970
970
  *
971
971
  * @typeParam TDocument - Type of the Prismic document returned.
972
- * @param documentType - The API ID of the singleton Custom Type.
972
+ * @param documentType - The API ID of the singleton custom type.
973
973
  * @param params - Parameters to filter, sort, and paginate the results.
974
974
  *
975
- * @returns The singleton document for the Custom Type, if a matching document
975
+ * @returns The singleton document for the custom type, if a matching document
976
976
  * exists.
977
977
  */
978
978
  async getSingle<
@@ -988,10 +988,10 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
988
988
  }
989
989
 
990
990
  /**
991
- * Queries documents from the Prismic repository for a specific Custom Type.
991
+ * Queries documents from the Prismic repository for a specific custom type.
992
992
  *
993
993
  * Use `getAllByType` instead if you need to query all documents for a
994
- * specific Custom Type.
994
+ * specific custom type.
995
995
  *
996
996
  * @example
997
997
  *
@@ -1000,10 +1000,10 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
1000
1000
  * ```
1001
1001
  *
1002
1002
  * @typeParam TDocument - Type of Prismic documents returned.
1003
- * @param documentType - The API ID of the Custom Type.
1003
+ * @param documentType - The API ID of the custom type.
1004
1004
  * @param params - Parameters to filter, sort, and paginate the results.
1005
1005
  *
1006
- * @returns A paginated response containing documents of the Custom Type.
1006
+ * @returns A paginated response containing documents of the custom type.
1007
1007
  */
1008
1008
  async getByType<
1009
1009
  TDocument extends TDocuments,
@@ -1031,10 +1031,10 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
1031
1031
  * ```
1032
1032
  *
1033
1033
  * @typeParam TDocument - Type of Prismic documents returned.
1034
- * @param documentType - The API ID of the Custom Type.
1034
+ * @param documentType - The API ID of the custom type.
1035
1035
  * @param params - Parameters to filter, sort, and paginate the results.
1036
1036
  *
1037
- * @returns A list of all documents of the Custom Type.
1037
+ * @returns A list of all documents of the custom type.
1038
1038
  */
1039
1039
  async getAllByType<
1040
1040
  TDocument extends TDocuments,
package/src/filter.ts CHANGED
@@ -177,7 +177,7 @@ export const filter = {
177
177
  * The `geopoint.near` filter checks that the value in the path is within
178
178
  * the radius of the given coordinates.
179
179
  *
180
- * This filter will only work for a GeoPoint field.
180
+ * This filter will only work for a geopoint field.
181
181
  *
182
182
  * {@link https://prismic.io/docs/rest-api-technical-reference#geopointnear}
183
183
  */
@@ -9,9 +9,9 @@ type AsDateReturnType<
9
9
  > = Field extends DateField<"filled"> | TimestampField<"filled"> ? Date : null;
10
10
 
11
11
  /**
12
- * Transforms a Date or Timestamp field into a JavaScript Date object
12
+ * Transforms a date or timestamp field into a JavaScript Date object
13
13
  *
14
- * @param dateOrTimestampField - A Date or Timestamp field from Prismic
14
+ * @param dateOrTimestampField - A date or timestamp field from Prismic
15
15
  *
16
16
  * @returns A Date object, null if provided date is falsy
17
17
  * @see Templating date field from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#date-and-timestamp}
@@ -22,13 +22,13 @@ import type { RichTextField } from "../types/value/richText";
22
22
  import { LinkResolverFunction } from "./asLink";
23
23
 
24
24
  /**
25
- * Serializes a node from a Rich Text or Title field with a function to HTML.
25
+ * Serializes a node from a rich text or title field with a function to HTML.
26
26
  *
27
27
  * Unlike a typical `@prismicio/richtext` function serializer, this serializer
28
28
  * converts the `children` argument to a single string rather than an array of
29
29
  * strings.
30
30
  *
31
- * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
31
+ * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
32
32
  */
33
33
  export type HTMLRichTextFunctionSerializer = (
34
34
  type: Parameters<RichTextFunctionSerializer<string>>[0],
@@ -39,13 +39,13 @@ export type HTMLRichTextFunctionSerializer = (
39
39
  ) => string | null | undefined;
40
40
 
41
41
  /**
42
- * Serializes a node from a Rich Text or Title field with a map to HTML
42
+ * Serializes a node from a rich text or title field with a map to HTML
43
43
  *
44
44
  * Unlike a typical `@prismicio/richtext` map serializer, this serializer
45
45
  * converts the `children` property to a single string rather than an array of
46
46
  * strings.
47
47
  *
48
- * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
48
+ * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
49
49
  */
50
50
  export type HTMLRichTextMapSerializer = {
51
51
  [P in keyof RichTextMapSerializer<string>]: (payload: {
@@ -63,7 +63,7 @@ export type HTMLRichTextMapSerializer = {
63
63
  * A {@link RichTextMapSerializerFunction} type specifically for
64
64
  * {@link HTMLRichTextMapSerializer}.
65
65
  *
66
- * @typeParam BlockName - The serializer's Rich Text block type.
66
+ * @typeParam BlockName - The serializer's rich text block type.
67
67
  */
68
68
  type HTMLRichTextMapSerializerFunction<
69
69
  BlockType extends keyof RichTextMapSerializer<string>,
@@ -106,17 +106,17 @@ type ExtractTextTypeGeneric<T> = T extends RichTextMapSerializerFunction<
106
106
  : never;
107
107
 
108
108
  /**
109
- * Serializes a node from a Rich Text or Title field with a map or a function to HTML
109
+ * Serializes a node from a rich text or title field with a map or a function to HTML
110
110
  *
111
111
  * @see {@link HTMLRichTextMapSerializer} and {@link HTMLRichTextFunctionSerializer}
112
- * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
112
+ * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
113
113
  */
114
114
  export type HTMLRichTextSerializer =
115
115
  | HTMLRichTextMapSerializer
116
116
  | HTMLRichTextFunctionSerializer;
117
117
 
118
118
  /**
119
- * Creates a default HTML Rich Text Serializer with a given Link Resolver providing
119
+ * Creates a default HTML rich text serializer with a given link resolver providing
120
120
  * sensible and safe defaults for every node type
121
121
  *
122
122
  * @internal
@@ -211,9 +211,9 @@ type AsHTMLConfig = {
211
211
  linkResolver?: LinkResolverFunction | null;
212
212
 
213
213
  /**
214
- * An optional Rich Text Serializer, unhandled cases will fallback to the default serializer
214
+ * An optional rich text serializer, unhandled cases will fallback to the default serializer
215
215
  */
216
- htmlRichTextSerializer?: HTMLRichTextSerializer | null;
216
+ serializer?: HTMLRichTextSerializer | null;
217
217
  };
218
218
 
219
219
  // TODO: Remove when we remove support for deprecated tuple-style configuration.
@@ -222,7 +222,7 @@ type AsHTMLConfig = {
222
222
  */
223
223
  type AsHTMLDeprecatedTupleConfig = [
224
224
  linkResolver?: LinkResolverFunction | null,
225
- htmlRichTextSerializer?: HTMLRichTextSerializer | null,
225
+ serializer?: HTMLRichTextSerializer | null,
226
226
  ];
227
227
 
228
228
  /**
@@ -234,13 +234,13 @@ type AsHTMLReturnType<Field extends RichTextField | null | undefined> =
234
234
  // TODO: Remove overload when we remove support for deprecated tuple-style configuration.
235
235
  export const asHTML: {
236
236
  /**
237
- * Serializes a Rich Text or Title field to an HTML string.
237
+ * Serializes a rich text or title field to an HTML string.
238
238
  *
239
- * @param richTextField - A Rich Text or Title field from Prismic
239
+ * @param richTextField - A rich text or title field from Prismic
240
240
  * @param config - Configuration that determines the output of `asHTML()`
241
241
  *
242
- * @returns HTML equivalent of the provided Rich Text or Title field
243
- * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
242
+ * @returns HTML equivalent of the provided rich text or title field
243
+ * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
244
244
  */
245
245
  <Field extends RichTextField | null | undefined>(
246
246
  richTextField: Field,
@@ -248,24 +248,24 @@ export const asHTML: {
248
248
  ): AsHTMLReturnType<Field>;
249
249
 
250
250
  /**
251
- * Serializes a Rich Text or Title field to an HTML string.
251
+ * Serializes a rich text or title field to an HTML string.
252
252
  *
253
- * @param richTextField - A Rich Text or Title field from Prismic
253
+ * @param richTextField - A rich text or title field from Prismic
254
254
  * @param linkResolver - An optional link resolver function to resolve links,
255
255
  * without it you're expected to use the `routes` options from the API
256
- * @param htmlRichTextSerializer - An optional Rich Text Serializer, unhandled cases will fallback
256
+ * @param serializer - An optional rich text serializer, unhandled cases will fallback
257
257
  * to the default serializer
258
258
  *
259
- * @returns HTML equivalent of the provided Rich Text or Title field
260
- * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
259
+ * @returns HTML equivalent of the provided rich text or title field
260
+ * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
261
261
  *
262
262
  * @deprecated Use object-style configuration instead.
263
263
  *
264
264
  * ```ts
265
265
  * asHTML(field);
266
266
  * asHTML(field, { linkResolver });
267
- * asHTML(field, { htmlRichTextSerializer });
268
- * asHTML(field, { linkResolver, htmlRichTextSerializer });
267
+ * asHTML(field, { serializer });
268
+ * asHTML(field, { linkResolver, serializer });
269
269
  * ```
270
270
  */
271
271
  <Field extends RichTextField | null | undefined>(
@@ -279,8 +279,7 @@ export const asHTML: {
279
279
  ): AsHTMLReturnType<Field> => {
280
280
  if (richTextField) {
281
281
  // TODO: Remove when we remove support for deprecated tuple-style configuration.
282
- const [configObjectOrLinkResolver, maybeHTMLRichTextSerializer] =
283
- configObjectOrTuple;
282
+ const [configObjectOrLinkResolver, maybeSerializer] = configObjectOrTuple;
284
283
  let config: AsHTMLConfig;
285
284
  if (
286
285
  typeof configObjectOrLinkResolver === "function" ||
@@ -288,20 +287,20 @@ export const asHTML: {
288
287
  ) {
289
288
  config = {
290
289
  linkResolver: configObjectOrLinkResolver,
291
- htmlRichTextSerializer: maybeHTMLRichTextSerializer,
290
+ serializer: maybeSerializer,
292
291
  };
293
292
  } else {
294
293
  config = { ...configObjectOrLinkResolver };
295
294
  }
296
295
 
297
296
  let serializer: RichTextFunctionSerializer<string>;
298
- if (config.htmlRichTextSerializer) {
297
+ if (config.serializer) {
299
298
  serializer = composeSerializers(
300
- typeof config.htmlRichTextSerializer === "object"
301
- ? wrapMapSerializerWithStringChildren(config.htmlRichTextSerializer)
299
+ typeof config.serializer === "object"
300
+ ? wrapMapSerializerWithStringChildren(config.serializer)
302
301
  : (type, node, text, children, key) =>
303
302
  // TypeScript doesn't narrow the type correctly here since it is now in a callback function, so we have to cast it here.
304
- (config.htmlRichTextSerializer as HTMLRichTextFunctionSerializer)(
303
+ (config.serializer as HTMLRichTextFunctionSerializer)(
305
304
  type,
306
305
  node,
307
306
  text,
@@ -30,12 +30,12 @@ type AsImagePixelDensitySrcSetReturnType<
30
30
  > = Field extends ImageFieldImage<"filled">
31
31
  ? {
32
32
  /**
33
- * The Image field's image URL with Imgix URL parameters (if given).
33
+ * The image field's image URL with Imgix URL parameters (if given).
34
34
  */
35
35
  src: string;
36
36
 
37
37
  /**
38
- * A pixel-densitye-based `srcset` attribute value for the Image field's
38
+ * A pixel-densitye-based `srcset` attribute value for the image field's
39
39
  * image with Imgix URL parameters (if given).
40
40
  */
41
41
  srcset: string;
@@ -43,7 +43,7 @@ type AsImagePixelDensitySrcSetReturnType<
43
43
  : null;
44
44
 
45
45
  /**
46
- * Creates a pixel-density-based `srcset` from an Image field with optional
46
+ * Creates a pixel-density-based `srcset` from an image field with optional
47
47
  * image transformations (via Imgix URL parameters).
48
48
  *
49
49
  * If a `pixelDensities` parameter is not given, the following pixel densities
@@ -68,8 +68,8 @@ type AsImagePixelDensitySrcSetReturnType<
68
68
  * @param config - An object of Imgix URL API parameters. The `pixelDensities`
69
69
  * parameter defines the resulting `srcset` widths.
70
70
  *
71
- * @returns A `srcset` attribute value for the Image field with Imgix URL
72
- * parameters (if given). If the Image field is empty, `null` is returned.
71
+ * @returns A `srcset` attribute value for the image field with Imgix URL
72
+ * parameters (if given). If the image field is empty, `null` is returned.
73
73
  * @see Imgix URL parameters reference: https://docs.imgix.com/apis/rendering
74
74
  */
75
75
  export const asImagePixelDensitySrcSet = <
@@ -11,7 +11,7 @@ type AsImageSrcReturnType<Field extends ImageFieldImage | null | undefined> =
11
11
  Field extends ImageFieldImage<"filled"> ? string : null;
12
12
 
13
13
  /**
14
- * Returns the URL of an Image field with optional image transformations (via
14
+ * Returns the URL of an image field with optional image transformations (via
15
15
  * Imgix URL parameters).
16
16
  *
17
17
  * @example
@@ -25,8 +25,8 @@ type AsImageSrcReturnType<Field extends ImageFieldImage | null | undefined> =
25
25
  * an image URL.
26
26
  * @param config - An object of Imgix URL API parameters to transform the image.
27
27
  *
28
- * @returns The Image field's image URL with transformations applied (if given).
29
- * If the Image field is empty, `null` is returned.
28
+ * @returns The image field's image URL with transformations applied (if given).
29
+ * If the image field is empty, `null` is returned.
30
30
  * @see Imgix URL parameters reference: https://docs.imgix.com/apis/rendering
31
31
  */
32
32
  export const asImageSrc = <Field extends ImageFieldImage | null | undefined>(
@@ -21,12 +21,12 @@ type AsImageWidthSrcSetReturnType<
21
21
  > = Field extends ImageFieldImage<"filled">
22
22
  ? {
23
23
  /**
24
- * The Image field's image URL with Imgix URL parameters (if given).
24
+ * The image field's image URL with Imgix URL parameters (if given).
25
25
  */
26
26
  src: string;
27
27
 
28
28
  /**
29
- * A width-based `srcset` attribute value for the Image field's image with
29
+ * A width-based `srcset` attribute value for the image field's image with
30
30
  * Imgix URL parameters (if given).
31
31
  */
32
32
  srcset: string;
@@ -41,13 +41,13 @@ type AsImageWidthSrcSetConfig = Omit<BuildWidthSrcSetParams, "widths"> & {
41
41
  };
42
42
 
43
43
  /**
44
- * Creates a width-based `srcset` from an Image field with optional image
44
+ * Creates a width-based `srcset` from an image field with optional image
45
45
  * transformations (via Imgix URL parameters).
46
46
  *
47
47
  * If a `widths` parameter is not given, the following widths will be used by
48
48
  * default: 640, 750, 828, 1080, 1200, 1920, 2048, 3840.
49
49
  *
50
- * If the Image field contains responsive views, each responsive view can be
50
+ * If the image field contains responsive views, each responsive view can be
51
51
  * used as a width in the resulting `srcset` by passing `"thumbnails"` as the
52
52
  * `widths` parameter.
53
53
  *
@@ -72,8 +72,8 @@ type AsImageWidthSrcSetConfig = Omit<BuildWidthSrcSetParams, "widths"> & {
72
72
  * defines the resulting `srcset` widths. Pass `"thumbnails"` to automatically
73
73
  * use the field's responsive views.
74
74
  *
75
- * @returns A `srcset` attribute value for the Image field with Imgix URL
76
- * parameters (if given). If the Image field is empty, `null` is returned.
75
+ * @returns A `srcset` attribute value for the image field with Imgix URL
76
+ * parameters (if given). If the image field is empty, `null` is returned.
77
77
  * @see Imgix URL parameters reference: https://docs.imgix.com/apis/rendering
78
78
  */
79
79
  export const asImageWidthSrcSet = <
@@ -6,11 +6,11 @@ import type { FilledLinkToMediaField } from "../types/value/linkToMedia";
6
6
  import { documentToLinkField } from "./documentToLinkField";
7
7
 
8
8
  /**
9
- * Resolves a Link to a Prismic document to a URL
9
+ * Resolves a link to a Prismic document to a URL
10
10
  *
11
11
  * @typeParam ReturnType - Return type of your link resolver function, useful if
12
12
  * you prefer to return a complex object
13
- * @param linkToDocumentField - A document Link Field to resolve
13
+ * @param linkToDocumentField - A document link field to resolve
14
14
  *
15
15
  * @returns Resolved URL
16
16
  * @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
@@ -25,7 +25,7 @@ export type LinkResolverFunction<ReturnType = string | null | undefined> = (
25
25
  type AsLinkConfig<LinkResolverFunctionReturnType = string | null | undefined> =
26
26
  {
27
27
  /**
28
- * An optional Link Resolver function. Without it, you are
28
+ * An optional link resolver function. Without it, you are
29
29
  * expected to use the `routes` options from the API.
30
30
  */
31
31
  linkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType> | null;
@@ -62,16 +62,16 @@ export type AsLinkReturnType<
62
62
  // TODO: Remove overload when we remove support for deprecated tuple-style configuration.
63
63
  export const asLink: {
64
64
  /**
65
- * Resolves any type of Link field or Prismic document to a URL.
65
+ * Resolves any type of link field or Prismic document to a URL.
66
66
  *
67
- * @typeParam LinkResolverFunctionReturnType - Link Resolver function return
67
+ * @typeParam LinkResolverFunctionReturnType - link resolver function return
68
68
  * type
69
69
  * @typeParam Field - Link field or Prismic document to resolve to a URL
70
- * @param linkFieldOrDocument - Any kind of Link field or a document to resolve
70
+ * @param linkFieldOrDocument - Any kind of link field or a document to resolve
71
71
  * @param config - Configuration that determines the output of `asLink()`
72
72
  *
73
- * @returns Resolved URL or, if the provided Link field or document is empty, `null`
74
- * @see Prismic Link Resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
73
+ * @returns Resolved URL or, if the provided link field or document is empty, `null`
74
+ * @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
75
75
  * @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}
76
76
  */
77
77
  <
@@ -87,17 +87,17 @@ export const asLink: {
87
87
  ): AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
88
88
 
89
89
  /**
90
- * Resolves any type of Link field or Prismic document to a URL.
90
+ * Resolves any type of link field or Prismic document to a URL.
91
91
  *
92
- * @typeParam LinkResolverFunctionReturnType - Link Resolver function return
92
+ * @typeParam LinkResolverFunctionReturnType - link resolver function return
93
93
  * type
94
94
  * @typeParam Field - Link field or Prismic document to resolve to a URL
95
- * @param linkFieldOrDocument - Any kind of Link field or a document to resolve
96
- * @param linkResolver - An optional Link Resolver function. Without it, you are
95
+ * @param linkFieldOrDocument - Any kind of link field or a document to resolve
96
+ * @param linkResolver - An optional link resolver function. Without it, you are
97
97
  * expected to use the `routes` options from the API
98
98
  *
99
- * @returns Resolved URL or, if the provided Link field or document is empty, `null`
100
- * @see Prismic Link Resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
99
+ * @returns Resolved URL or, if the provided link field or document is empty, `null`
100
+ * @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
101
101
  * @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}
102
102
  *
103
103
  * @deprecated Use object-style configuration instead.
@@ -136,7 +136,7 @@ export const asLink: {
136
136
  return null as AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
137
137
  }
138
138
 
139
- // Converts document to Link Field if needed
139
+ // Converts document to link field if needed
140
140
  const linkField =
141
141
  // prettier-ignore
142
142
  (
@@ -172,7 +172,7 @@ export const asLink: {
172
172
 
173
173
  case LinkType.Document: {
174
174
  if ("id" in linkField && config.linkResolver) {
175
- // When using Link Resolver...
175
+ // When using link resolver...
176
176
  const resolvedURL = config.linkResolver(linkField);
177
177
 
178
178
  if (resolvedURL != null) {
@@ -184,14 +184,14 @@ export const asLink: {
184
184
  }
185
185
 
186
186
  if ("url" in linkField && linkField.url) {
187
- // When using Route Resolver...
187
+ // When using route resolver...
188
188
  return linkField.url as AsLinkReturnType<
189
189
  LinkResolverFunctionReturnType,
190
190
  Field
191
191
  >;
192
192
  }
193
193
 
194
- // When empty or Link Resolver and Route Resolver are not used...
194
+ // When empty or link resolver and route resolver are not used...
195
195
  return null as AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
196
196
  }
197
197
 
@@ -66,18 +66,18 @@ type AsLinkAttrsReturnType<
66
66
  };
67
67
 
68
68
  /**
69
- * Resolves any type of Link field or Prismic document to a set of link attributes. The attributes are designed to be passed to link HTML elements, like `<a>`.
69
+ * Resolves any type of link field or Prismic document to a set of link attributes. The attributes are designed to be passed to link HTML elements, like `<a>`.
70
70
  *
71
71
  * If a resolved URL is external (i.e. starts with a protocol like `https://`), `rel` is returned as `"noreferrer"`.
72
72
  *
73
- * @typeParam LinkResolverFunctionReturnType - Link Resolver function return
73
+ * @typeParam LinkResolverFunctionReturnType - link resolver function return
74
74
  * type
75
75
  * @typeParam Field - Link field or Prismic document to resolve to link attributes
76
- * @param linkFieldOrDocument - Any kind of Link field or a document to resolve
76
+ * @param linkFieldOrDocument - Any kind of link field or a document to resolve
77
77
  * @param config - Configuration that determines the output of `asLinkAttrs()`
78
78
  *
79
- * @returns Resolved set of link attributes or, if the provided Link field or document is empty, and empty object
80
- * @see Prismic Link Resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
79
+ * @returns Resolved set of link attributes or, if the provided link field or document is empty, and empty object
80
+ * @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
81
81
  * @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}
82
82
  */
83
83
  export const asLinkAttrs = <