@prismicio/vue 3.1.0 → 3.1.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.
Files changed (94) hide show
  1. package/dist/components/PrismicEmbed.cjs +36 -0
  2. package/dist/components/PrismicEmbed.cjs.map +1 -0
  3. package/dist/components/PrismicEmbed.d.ts +63 -0
  4. package/dist/components/PrismicEmbed.js +36 -0
  5. package/dist/components/PrismicEmbed.js.map +1 -0
  6. package/dist/components/PrismicImage.cjs +122 -0
  7. package/dist/components/PrismicImage.cjs.map +1 -0
  8. package/dist/components/PrismicImage.d.ts +162 -0
  9. package/dist/components/PrismicImage.js +122 -0
  10. package/dist/components/PrismicImage.js.map +1 -0
  11. package/dist/components/PrismicLink.cjs +115 -0
  12. package/dist/components/PrismicLink.cjs.map +1 -0
  13. package/dist/components/PrismicLink.d.ts +191 -0
  14. package/dist/components/PrismicLink.js +115 -0
  15. package/dist/components/PrismicLink.js.map +1 -0
  16. package/dist/components/PrismicRichText.cjs +103 -0
  17. package/dist/components/PrismicRichText.cjs.map +1 -0
  18. package/dist/components/PrismicRichText.d.ts +139 -0
  19. package/dist/components/PrismicRichText.js +103 -0
  20. package/dist/components/PrismicRichText.js.map +1 -0
  21. package/dist/components/PrismicText.cjs +57 -0
  22. package/dist/components/PrismicText.cjs.map +1 -0
  23. package/dist/components/PrismicText.d.ts +117 -0
  24. package/dist/components/PrismicText.js +57 -0
  25. package/dist/components/PrismicText.js.map +1 -0
  26. package/dist/components/SliceZone.cjs +134 -0
  27. package/dist/components/SliceZone.cjs.map +1 -0
  28. package/dist/components/SliceZone.d.ts +359 -0
  29. package/dist/components/SliceZone.js +134 -0
  30. package/dist/components/SliceZone.js.map +1 -0
  31. package/dist/components/index.d.ts +12 -0
  32. package/dist/composables.cjs +40 -0
  33. package/dist/composables.cjs.map +1 -0
  34. package/dist/composables.d.ts +366 -0
  35. package/dist/composables.js +40 -0
  36. package/dist/composables.js.map +1 -0
  37. package/dist/createPrismic.cjs +87 -0
  38. package/dist/createPrismic.cjs.map +1 -0
  39. package/dist/createPrismic.d.ts +12 -0
  40. package/dist/createPrismic.js +69 -0
  41. package/dist/createPrismic.js.map +1 -0
  42. package/dist/globalExtensions.d.ts +11 -0
  43. package/dist/index.cjs +46 -764
  44. package/dist/index.cjs.map +1 -1
  45. package/dist/index.d.ts +10 -1404
  46. package/dist/index.js +45 -707
  47. package/dist/index.js.map +1 -1
  48. package/dist/injectionSymbols.cjs +5 -0
  49. package/dist/injectionSymbols.cjs.map +1 -0
  50. package/dist/injectionSymbols.d.ts +9 -0
  51. package/dist/injectionSymbols.js +5 -0
  52. package/dist/injectionSymbols.js.map +1 -0
  53. package/dist/lib/__PRODUCTION__.cjs +8 -0
  54. package/dist/lib/__PRODUCTION__.cjs.map +1 -0
  55. package/dist/lib/__PRODUCTION__.d.ts +7 -0
  56. package/dist/lib/__PRODUCTION__.js +8 -0
  57. package/dist/lib/__PRODUCTION__.js.map +1 -0
  58. package/dist/lib/getSlots.cjs +19 -0
  59. package/dist/lib/getSlots.cjs.map +1 -0
  60. package/dist/lib/getSlots.d.ts +14 -0
  61. package/dist/lib/getSlots.js +19 -0
  62. package/dist/lib/getSlots.js.map +1 -0
  63. package/dist/lib/isInternalURL.cjs +9 -0
  64. package/dist/lib/isInternalURL.cjs.map +1 -0
  65. package/dist/lib/isInternalURL.d.ts +8 -0
  66. package/dist/lib/isInternalURL.js +9 -0
  67. package/dist/lib/isInternalURL.js.map +1 -0
  68. package/dist/lib/simplyResolveComponent.cjs +8 -0
  69. package/dist/lib/simplyResolveComponent.cjs.map +1 -0
  70. package/dist/lib/simplyResolveComponent.d.ts +12 -0
  71. package/dist/lib/simplyResolveComponent.js +8 -0
  72. package/dist/lib/simplyResolveComponent.js.map +1 -0
  73. package/dist/types.d.ts +357 -0
  74. package/dist/usePrismic.cjs +9 -0
  75. package/dist/usePrismic.cjs.map +1 -0
  76. package/dist/usePrismic.d.ts +21 -0
  77. package/dist/usePrismic.js +9 -0
  78. package/dist/usePrismic.js.map +1 -0
  79. package/dist/useStatefulPrismicClientMethod.cjs +36 -0
  80. package/dist/useStatefulPrismicClientMethod.cjs.map +1 -0
  81. package/dist/useStatefulPrismicClientMethod.d.ts +64 -0
  82. package/dist/useStatefulPrismicClientMethod.js +36 -0
  83. package/dist/useStatefulPrismicClientMethod.js.map +1 -0
  84. package/package.json +28 -28
  85. package/src/components/PrismicEmbed.ts +2 -1
  86. package/src/components/PrismicImage.ts +8 -5
  87. package/src/components/PrismicLink.ts +4 -2
  88. package/src/components/PrismicRichText.ts +4 -2
  89. package/src/components/PrismicText.ts +6 -3
  90. package/src/components/SliceZone.ts +12 -7
  91. package/src/composables.ts +56 -46
  92. package/src/injectionSymbols.ts +2 -1
  93. package/src/types.ts +14 -7
  94. package/src/useStatefulPrismicClientMethod.ts +6 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composables.cjs","sources":["../../src/composables.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n// Imports for @link references:\n\nimport type { Client } from \"@prismicio/client\";\n\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\nimport { PrismicDocument, Query } from \"@prismicio/types\";\n\nimport {\n\tClientMethodParameters,\n\tClientComposableReturnType,\n\tuseStatefulPrismicClientMethod,\n\tComposableOnlyParameters,\n} from \"./useStatefulPrismicClientMethod\";\n\n// Composables\n\n/**\n * A composable 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.get}\n */\nexport const usePrismicDocuments = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tparams?: ClientMethodParameters<\"get\">[0] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"get\", args);\n\n/**\n * A composable that queries content from the Prismic repository and returns\n * only the 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getFirst}\n */\nexport const useFirstPrismicDocument = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tparams?: ClientMethodParameters<\"getFirst\">[0] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getFirst\", args);\n\n/**\n * A composable that queries a document from the Prismic repository with a\n * specific 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByID}\n */\nexport const usePrismicDocumentByID = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getByID\">[0],\n\t\tparams?: ClientMethodParameters<\"getByID\">[1] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByID\", args);\n\n/**\n * A composable that queries 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, sort, and paginate results\n *\n * @returns The composable payload {@link ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByIDs}\n */\nexport const usePrismicDocumentsByIDs = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tids: ClientMethodParameters<\"getByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getByIDs\">[1] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByIDs\", args);\n\n/**\n * A composable that queries all documents from the Prismic repository with\n * 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 and sort results\n *\n * @returns The composable payload {@link ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAllByIDs}\n */\nexport const useAllPrismicDocumentsByIDs = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tids: ClientMethodParameters<\"getAllByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByIDs\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByIDs\", args);\n\n/**\n * A composable that queries a document from the Prismic repository with a\n * specific 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByUID}\n */\nexport const usePrismicDocumentByUID = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUID\">[0],\n\t\tuid: ClientMethodParameters<\"getByUID\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUID\">[2] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByUID\", args);\n\n/**\n * A composable that queries documents from the Prismic repository with specific\n * UIDs.\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 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByIDs}\n */\nexport const usePrismicDocumentsByUIDs = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUIDs\">[0],\n\t\tuids: ClientMethodParameters<\"getByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUIDs\">[2] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByUIDs\", args);\n\n/**\n * A composable that queries all documents from the Prismic repository with\n * specific UIDs.\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 document's Custom Type\n * @param uids - A list of document UIDs\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAllByIDs}\n */\nexport const useAllPrismicDocumentsByUIDs = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getAllByUIDs\">[0],\n\t\tids: ClientMethodParameters<\"getAllByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getAllByUIDs\">[2] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByUIDs\", args);\n\n/**\n * A composable that queries a singleton document from the Prismic repository\n * for a 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getSingle}\n */\nexport const useSinglePrismicDocument = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getSingle\">[0],\n\t\tparams?: ClientMethodParameters<\"getSingle\">[1] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getSingle\", args);\n\n/**\n * A composable that queries documents 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 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByType}\n */\nexport const usePrismicDocumentsByType = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getByType\">[1] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByType\", args);\n\n/**\n * A composable that queries all documents 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 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAllByType}\n */\nexport const useAllPrismicDocumentsByType = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getAllByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByType\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByType\", args);\n\n/**\n * A composable that queries documents from the Prismic repository with a\n * specific 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByTag}\n */\nexport const usePrismicDocumentsByTag = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByTag\">[1] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByTag\", args);\n\n/**\n * A composable that queries all documents from the Prismic repository with a\n * specific 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAllByTag}\n */\nexport const useAllPrismicDocumentsByTag = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByTag\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByTag\", args);\n\n/**\n * A composable that queries 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, sort, and paginate results\n *\n * @returns The composable payload {@link ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByTags}\n */\nexport const usePrismicDocumentsByEveryTag = <\n\tTDocument extends PrismicDocument,\n>(\n\t...args: [\n\t\ttags: ClientMethodParameters<\"getByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByEveryTag\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByEveryTag\", args);\n\n/**\n * A composable that queries all documents from the Prismic repository with\n * specific tags. A document must be tagged with all 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAllByTags}\n */\nexport const useAllPrismicDocumentsByEveryTag = <\n\tTDocument extends PrismicDocument,\n>(\n\t...args: [\n\t\ttags: ClientMethodParameters<\"getAllByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByEveryTag\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByEveryTag\", args);\n\n/**\n * A composable that queries 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, sort, and paginate results\n *\n * @returns The composable payload {@link ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByTags}\n */\nexport const usePrismicDocumentsBySomeTags = <\n\tTDocument extends PrismicDocument,\n>(\n\t...args: [\n\t\ttags: ClientMethodParameters<\"getBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getBySomeTags\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getBySomeTags\", args);\n\n/**\n * A composable that queries all documents from the Prismic repository with\n * specific tags. A document must be tagged with at least one of the queried\n * 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAllByTags}\n */\nexport const useAllPrismicDocumentsBySomeTags = <\n\tTDocument extends PrismicDocument,\n>(\n\t...args: [\n\t\ttags: ClientMethodParameters<\"getAllBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllBySomeTags\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllBySomeTags\", args);\n\n/**\n * **IMPORTANT**: Avoid using `dangerouslyUseAllPrismicDocuments` as it may be\n * slower and require more resources than other composables. Prefer using other\n * composables that filter by predicates such as\n * `useAllPrismicDocumentsByType`.\n *\n * A composable 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAll}\n */\nexport const dangerouslyUseAllPrismicDocuments = <\n\tTDocument extends PrismicDocument,\n>(\n\t...args: [\n\t\tparams?: ClientMethodParameters<\"dangerouslyGetAll\">[0] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"dangerouslyGetAll\", args);\n"],"names":["useStatefulPrismicClientMethod"],"mappings":";;;AAiCO,MAAM,sBAAsB,IAC/B,SAIHA,+BAAAA,+BAA+B,OAAO,IAAI;AAiBpC,MAAM,0BAA0B,IACnC,SAIHA,+BAAAA,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,yBAAyB,IAClC,SAKHA,+BAAAA,+BAA+B,WAAW,IAAI;AAkBxC,MAAM,2BAA2B,IACpC,SAKHA,+BAAAA,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,8BAA8B,IACvC,SAMHA,+BAAAA,+BAA+B,eAAe,IAAI;AAmB5C,MAAM,0BAA0B,IACnC,SAMHA,+BAAAA,+BAA+B,YAAY,IAAI;AAmBzC,MAAM,4BAA4B,IACrC,SAMHA,+BAAAA,+BAA+B,aAAa,IAAI;AAmB1C,MAAM,+BAA+B,IACxC,SAOHA,+BAAAA,+BAA+B,gBAAgB,IAAI;AAkB7C,MAAM,2BAA2B,IACpC,SAKHA,+BAAAA,+BAA+B,aAAa,IAAI;AAkB1C,MAAM,4BAA4B,IACrC,SAKHA,+BAAAA,+BAA+B,aAAa,IAAI;AAkB1C,MAAM,+BAA+B,IACxC,SAMHA,+BAAAA,+BAA+B,gBAAgB,IAAI;AAkB7C,MAAM,2BAA2B,IACpC,SAKHA,+BAAAA,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,8BAA8B,IACvC,SAMHA,+BAAAA,+BAA+B,eAAe,IAAI;AAkB5C,MAAM,gCAAgC,IAGzC,SAMHA,+BAAAA,+BAA+B,iBAAiB,IAAI;AAmB9C,MAAM,mCAAmC,IAG5C,SAMHA,+BAAAA,+BAA+B,oBAAoB,IAAI;AAmBjD,MAAM,gCAAgC,IAGzC,SAMHA,+BAAAA,+BAA+B,iBAAiB,IAAI;AAmB9C,MAAM,mCAAmC,IAG5C,SAMHA,+BAAAA,+BAA+B,oBAAoB,IAAI;AAuBjD,MAAM,oCAAoC,IAG7C,SAKHA,+BAAA,+BAA+B,qBAAqB,IAAI;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,366 @@
1
+ import { PrismicDocument, Query } from "@prismicio/types";
2
+ import { ClientComposableReturnType, ComposableOnlyParameters } from "./useStatefulPrismicClientMethod";
3
+ /**
4
+ * A composable 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 ClientComposableReturnType}
14
+ *
15
+ * @see Underlying `@prismicio/client` method {@link Client.get}
16
+ */
17
+ export declare const usePrismicDocuments: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
18
+ signal?: any;
19
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
20
+ /**
21
+ * A composable that queries content from the Prismic repository and returns
22
+ * only the 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 ClientComposableReturnType}
32
+ *
33
+ * @see Underlying `@prismicio/client` method {@link Client.getFirst}
34
+ */
35
+ export declare const useFirstPrismicDocument: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
36
+ signal?: any;
37
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument>;
38
+ /**
39
+ * A composable that queries a document from the Prismic repository with a
40
+ * specific ID.
41
+ *
42
+ * @remarks
43
+ * An additional `@prismicio/client` instance can be provided at
44
+ * `params.client`.
45
+ * @typeParam TDocument - Type of the Prismic document returned
46
+ *
47
+ * @param id - ID of the document
48
+ * @param params - Parameters to filter, sort, and paginate results
49
+ *
50
+ * @returns The composable payload {@link ClientComposableReturnType}
51
+ *
52
+ * @see Underlying `@prismicio/client` method {@link Client.getByID}
53
+ */
54
+ export declare const usePrismicDocumentByID: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(id: string, params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
55
+ signal?: any;
56
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument>;
57
+ /**
58
+ * A composable that queries documents from the Prismic repository with specific
59
+ * IDs.
60
+ *
61
+ * @remarks
62
+ * An additional `@prismicio/client` instance can be provided at
63
+ * `params.client`.
64
+ * @typeParam TDocument - Type of Prismic documents returned
65
+ *
66
+ * @param ids - A list of document IDs
67
+ * @param params - Parameters to filter, sort, and paginate results
68
+ *
69
+ * @returns The composable payload {@link ClientComposableReturnType}
70
+ *
71
+ * @see Underlying `@prismicio/client` method {@link Client.getByIDs}
72
+ */
73
+ export declare const usePrismicDocumentsByIDs: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(ids: string[], params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
74
+ signal?: any;
75
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
76
+ /**
77
+ * A composable that queries all documents from the Prismic repository with
78
+ * specific IDs.
79
+ *
80
+ * @remarks
81
+ * An additional `@prismicio/client` instance can be provided at
82
+ * `params.client`.
83
+ * @typeParam TDocument - Type of Prismic documents returned
84
+ *
85
+ * @param ids - A list of document IDs
86
+ * @param params - Parameters to filter and sort results
87
+ *
88
+ * @returns The composable payload {@link ClientComposableReturnType}
89
+ *
90
+ * @see Underlying `@prismicio/client` method {@link Client.getAllByIDs}
91
+ */
92
+ export declare const useAllPrismicDocumentsByIDs: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(ids: string[], params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
93
+ limit?: number | undefined;
94
+ } & {
95
+ signal?: any;
96
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument[]>;
97
+ /**
98
+ * A composable that queries a document from the Prismic repository with a
99
+ * specific UID and Custom Type.
100
+ *
101
+ * @remarks
102
+ * An additional `@prismicio/client` instance can be provided at
103
+ * `params.client`.
104
+ * @typeParam TDocument - Type of the Prismic document returned
105
+ *
106
+ * @param documentType - The API ID of the document's Custom Type
107
+ * @param uid - UID of the document
108
+ * @param params - Parameters to filter, sort, and paginate results
109
+ *
110
+ * @returns The composable payload {@link ClientComposableReturnType}
111
+ *
112
+ * @see Underlying `@prismicio/client` method {@link Client.getByUID}
113
+ */
114
+ export declare const usePrismicDocumentByUID: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(documentType: any, uid: string, params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
115
+ signal?: any;
116
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument>;
117
+ /**
118
+ * A composable that queries documents from the Prismic repository with specific
119
+ * UIDs.
120
+ *
121
+ * @remarks
122
+ * An additional `@prismicio/client` instance can be provided at
123
+ * `params.client`.
124
+ * @typeParam TDocument - Type of Prismic documents returned
125
+ *
126
+ * @param documentType - The API ID of the document's Custom Type
127
+ * @param uids - A list of document UIDs
128
+ * @param params - Parameters to filter, sort, and paginate results
129
+ *
130
+ * @returns The composable payload {@link ClientComposableReturnType}
131
+ *
132
+ * @see Underlying `@prismicio/client` method {@link Client.getByIDs}
133
+ */
134
+ export declare const usePrismicDocumentsByUIDs: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(documentType: any, uids: string[], params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
135
+ signal?: any;
136
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
137
+ /**
138
+ * A composable that queries all documents from the Prismic repository with
139
+ * specific UIDs.
140
+ *
141
+ * @remarks
142
+ * An additional `@prismicio/client` instance can be provided at
143
+ * `params.client`.
144
+ * @typeParam TDocument - Type of Prismic documents 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 and sort results
149
+ *
150
+ * @returns The composable payload {@link ClientComposableReturnType}
151
+ *
152
+ * @see Underlying `@prismicio/client` method {@link Client.getAllByIDs}
153
+ */
154
+ export declare const useAllPrismicDocumentsByUIDs: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(documentType: any, ids: string[], params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
155
+ limit?: number | undefined;
156
+ } & {
157
+ signal?: any;
158
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument[]>;
159
+ /**
160
+ * A composable that queries a singleton document from the Prismic repository
161
+ * for a specific Custom Type.
162
+ *
163
+ * @remarks
164
+ * An additional `@prismicio/client` instance can be provided at
165
+ * `params.client`.
166
+ * @typeParam TDocument - Type of the Prismic document returned
167
+ *
168
+ * @param documentType - The API ID of the singleton Custom Type
169
+ * @param params - Parameters to filter, sort, and paginate results
170
+ *
171
+ * @returns The composable payload {@link ClientComposableReturnType}
172
+ *
173
+ * @see Underlying `@prismicio/client` method {@link Client.getSingle}
174
+ */
175
+ export declare const useSinglePrismicDocument: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(documentType: any, params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
176
+ signal?: any;
177
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument>;
178
+ /**
179
+ * A composable that queries documents from the Prismic repository for a
180
+ * specific Custom Type.
181
+ *
182
+ * @remarks
183
+ * An additional `@prismicio/client` instance can be provided at
184
+ * `params.client`.
185
+ * @typeParam TDocument - Type of Prismic documents returned
186
+ *
187
+ * @param documentType - The API ID of the Custom Type
188
+ * @param params - Parameters to filter, sort, and paginate results
189
+ *
190
+ * @returns The composable payload {@link ClientComposableReturnType}
191
+ *
192
+ * @see Underlying `@prismicio/client` method {@link Client.getByType}
193
+ */
194
+ export declare const usePrismicDocumentsByType: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(documentType: any, params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
195
+ signal?: any;
196
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
197
+ /**
198
+ * A composable that queries all documents from the Prismic repository for a
199
+ * specific Custom Type.
200
+ *
201
+ * @remarks
202
+ * An additional `@prismicio/client` instance can be provided at
203
+ * `params.client`.
204
+ * @typeParam TDocument - Type of Prismic documents returned
205
+ *
206
+ * @param documentType - The API ID of the Custom Type
207
+ * @param params - Parameters to filter and sort results
208
+ *
209
+ * @returns The composable payload {@link ClientComposableReturnType}
210
+ *
211
+ * @see Underlying `@prismicio/client` method {@link Client.getAllByType}
212
+ */
213
+ export declare const useAllPrismicDocumentsByType: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(documentType: any, params?: (Partial<Omit<import("@prismicio/client").BuildQueryURLArgs, "page">> & {
214
+ limit?: number | undefined;
215
+ } & {
216
+ signal?: any;
217
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument[]>;
218
+ /**
219
+ * A composable that queries documents from the Prismic repository with a
220
+ * specific tag.
221
+ *
222
+ * @remarks
223
+ * An additional `@prismicio/client` instance can be provided at
224
+ * `params.client`.
225
+ * @typeParam TDocument - Type of Prismic documents returned
226
+ *
227
+ * @param tag - The tag that must be included on a document
228
+ * @param params - Parameters to filter, sort, and paginate results
229
+ *
230
+ * @returns The composable payload {@link ClientComposableReturnType}
231
+ *
232
+ * @see Underlying `@prismicio/client` method {@link Client.getByTag}
233
+ */
234
+ export declare const usePrismicDocumentsByTag: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(tag: string, params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
235
+ signal?: any;
236
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
237
+ /**
238
+ * A composable that queries all documents from the Prismic repository with a
239
+ * specific tag.
240
+ *
241
+ * @remarks
242
+ * An additional `@prismicio/client` instance can be provided at
243
+ * `params.client`.
244
+ * @typeParam TDocument - Type of Prismic documents returned
245
+ *
246
+ * @param tag - The tag that must be included on a document
247
+ * @param params - Parameters to filter and sort results
248
+ *
249
+ * @returns The composable payload {@link ClientComposableReturnType}
250
+ *
251
+ * @see Underlying `@prismicio/client` method {@link Client.getAllByTag}
252
+ */
253
+ export declare const useAllPrismicDocumentsByTag: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(tag: string, params?: (Partial<Omit<import("@prismicio/client").BuildQueryURLArgs, "page">> & {
254
+ limit?: number | undefined;
255
+ } & {
256
+ signal?: any;
257
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument[]>;
258
+ /**
259
+ * A composable that queries documents from the Prismic repository with specific
260
+ * tags. A document must be tagged with all of the queried tags to be included.
261
+ *
262
+ * @remarks
263
+ * An additional `@prismicio/client` instance can be provided at
264
+ * `params.client`.
265
+ * @typeParam TDocument - Type of Prismic documents returned
266
+ *
267
+ * @param tags - A list of tags that must be included on a document
268
+ * @param params - Parameters to filter, sort, and paginate results
269
+ *
270
+ * @returns The composable payload {@link ClientComposableReturnType}
271
+ *
272
+ * @see Underlying `@prismicio/client` method {@link Client.getByTags}
273
+ */
274
+ export declare const usePrismicDocumentsByEveryTag: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(tags: string[], params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
275
+ signal?: any;
276
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
277
+ /**
278
+ * A composable that queries all documents from the Prismic repository with
279
+ * specific tags. A document must be tagged with all of the queried tags to be
280
+ * included.
281
+ *
282
+ * @remarks
283
+ * An additional `@prismicio/client` instance can be provided at
284
+ * `params.client`.
285
+ * @typeParam TDocument - Type of Prismic documents returned
286
+ *
287
+ * @param tags - A list of tags that must be included on a document
288
+ * @param params - Parameters to filter and sort results
289
+ *
290
+ * @returns The composable payload {@link ClientComposableReturnType}
291
+ *
292
+ * @see Underlying `@prismicio/client` method {@link Client.getAllByTags}
293
+ */
294
+ export declare const useAllPrismicDocumentsByEveryTag: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(tags: string[], params?: (Partial<Omit<import("@prismicio/client").BuildQueryURLArgs, "page">> & {
295
+ limit?: number | undefined;
296
+ } & {
297
+ signal?: any;
298
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument[]>;
299
+ /**
300
+ * A composable that queries documents from the Prismic repository with specific
301
+ * tags. A document must be tagged with at least one of the queried tags to be
302
+ * included.
303
+ *
304
+ * @remarks
305
+ * An additional `@prismicio/client` instance can be provided at
306
+ * `params.client`.
307
+ * @typeParam TDocument - Type of Prismic documents returned
308
+ *
309
+ * @param tags - A list of tags that must be included on a document
310
+ * @param params - Parameters to filter, sort, and paginate results
311
+ *
312
+ * @returns The composable payload {@link ClientComposableReturnType}
313
+ *
314
+ * @see Underlying `@prismicio/client` method {@link Client.getByTags}
315
+ */
316
+ export declare const usePrismicDocumentsBySomeTags: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(tags: string[], params?: (Partial<import("@prismicio/client").BuildQueryURLArgs> & {
317
+ signal?: any;
318
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<Query<TDocument>>;
319
+ /**
320
+ * A composable that queries all documents from the Prismic repository with
321
+ * specific tags. A document must be tagged with at least one of the queried
322
+ * tags to be included.
323
+ *
324
+ * @remarks
325
+ * An additional `@prismicio/client` instance can be provided at
326
+ * `params.client`.
327
+ * @typeParam TDocument - Type of Prismic documents returned
328
+ *
329
+ * @param tags - A list of tags that must be included on a document
330
+ * @param params - Parameters to filter and sort results
331
+ *
332
+ * @returns The composable payload {@link ClientComposableReturnType}
333
+ *
334
+ * @see Underlying `@prismicio/client` method {@link Client.getAllByTags}
335
+ */
336
+ export declare const useAllPrismicDocumentsBySomeTags: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(tags: string[], params?: (Partial<Omit<import("@prismicio/client").BuildQueryURLArgs, "page">> & {
337
+ limit?: number | undefined;
338
+ } & {
339
+ signal?: any;
340
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<TDocument[]>;
341
+ /**
342
+ * **IMPORTANT**: Avoid using `dangerouslyUseAllPrismicDocuments` as it may be
343
+ * slower and require more resources than other composables. Prefer using other
344
+ * composables that filter by predicates such as
345
+ * `useAllPrismicDocumentsByType`.
346
+ *
347
+ * A composable that queries content from the Prismic repository and returns all
348
+ * matching content. If no predicates are provided, all documents will be
349
+ * fetched.
350
+ *
351
+ * @remarks
352
+ * An additional `@prismicio/client` instance can be provided at
353
+ * `params.client`.
354
+ * @typeParam TDocument - Type of Prismic documents returned
355
+ *
356
+ * @param params - Parameters to filter and sort results
357
+ *
358
+ * @returns The composable payload {@link ClientComposableReturnType}
359
+ *
360
+ * @see Underlying `@prismicio/client` method {@link Client.getAll}
361
+ */
362
+ export declare const dangerouslyUseAllPrismicDocuments: <TDocument extends PrismicDocument<Record<string, any>, string, string>>(params?: (Partial<Omit<import("@prismicio/client").BuildQueryURLArgs, "page">> & {
363
+ limit?: number | undefined;
364
+ } & {
365
+ signal?: any;
366
+ } & ComposableOnlyParameters) | undefined) => ClientComposableReturnType<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 usePrismicDocumentByID = (...args) => useStatefulPrismicClientMethod("getByID", args);
5
+ const usePrismicDocumentsByIDs = (...args) => useStatefulPrismicClientMethod("getByIDs", args);
6
+ const useAllPrismicDocumentsByIDs = (...args) => useStatefulPrismicClientMethod("getAllByIDs", args);
7
+ const usePrismicDocumentByUID = (...args) => useStatefulPrismicClientMethod("getByUID", args);
8
+ const usePrismicDocumentsByUIDs = (...args) => useStatefulPrismicClientMethod("getByUIDs", args);
9
+ const useAllPrismicDocumentsByUIDs = (...args) => useStatefulPrismicClientMethod("getAllByUIDs", args);
10
+ const useSinglePrismicDocument = (...args) => useStatefulPrismicClientMethod("getSingle", args);
11
+ const usePrismicDocumentsByType = (...args) => useStatefulPrismicClientMethod("getByType", args);
12
+ const useAllPrismicDocumentsByType = (...args) => useStatefulPrismicClientMethod("getAllByType", args);
13
+ const usePrismicDocumentsByTag = (...args) => useStatefulPrismicClientMethod("getByTag", args);
14
+ const useAllPrismicDocumentsByTag = (...args) => useStatefulPrismicClientMethod("getAllByTag", args);
15
+ const usePrismicDocumentsByEveryTag = (...args) => useStatefulPrismicClientMethod("getByEveryTag", args);
16
+ const useAllPrismicDocumentsByEveryTag = (...args) => useStatefulPrismicClientMethod("getAllByEveryTag", args);
17
+ const usePrismicDocumentsBySomeTags = (...args) => useStatefulPrismicClientMethod("getBySomeTags", args);
18
+ const useAllPrismicDocumentsBySomeTags = (...args) => useStatefulPrismicClientMethod("getAllBySomeTags", args);
19
+ const dangerouslyUseAllPrismicDocuments = (...args) => useStatefulPrismicClientMethod("dangerouslyGetAll", args);
20
+ export {
21
+ dangerouslyUseAllPrismicDocuments,
22
+ useAllPrismicDocumentsByEveryTag,
23
+ useAllPrismicDocumentsByIDs,
24
+ useAllPrismicDocumentsBySomeTags,
25
+ useAllPrismicDocumentsByTag,
26
+ useAllPrismicDocumentsByType,
27
+ useAllPrismicDocumentsByUIDs,
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=composables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composables.js","sources":["../../src/composables.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n\n// Imports for @link references:\n\nimport type { Client } from \"@prismicio/client\";\n\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\nimport { PrismicDocument, Query } from \"@prismicio/types\";\n\nimport {\n\tClientMethodParameters,\n\tClientComposableReturnType,\n\tuseStatefulPrismicClientMethod,\n\tComposableOnlyParameters,\n} from \"./useStatefulPrismicClientMethod\";\n\n// Composables\n\n/**\n * A composable 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.get}\n */\nexport const usePrismicDocuments = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tparams?: ClientMethodParameters<\"get\">[0] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"get\", args);\n\n/**\n * A composable that queries content from the Prismic repository and returns\n * only the 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getFirst}\n */\nexport const useFirstPrismicDocument = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tparams?: ClientMethodParameters<\"getFirst\">[0] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getFirst\", args);\n\n/**\n * A composable that queries a document from the Prismic repository with a\n * specific 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByID}\n */\nexport const usePrismicDocumentByID = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tid: ClientMethodParameters<\"getByID\">[0],\n\t\tparams?: ClientMethodParameters<\"getByID\">[1] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByID\", args);\n\n/**\n * A composable that queries 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, sort, and paginate results\n *\n * @returns The composable payload {@link ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByIDs}\n */\nexport const usePrismicDocumentsByIDs = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tids: ClientMethodParameters<\"getByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getByIDs\">[1] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByIDs\", args);\n\n/**\n * A composable that queries all documents from the Prismic repository with\n * 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 and sort results\n *\n * @returns The composable payload {@link ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAllByIDs}\n */\nexport const useAllPrismicDocumentsByIDs = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tids: ClientMethodParameters<\"getAllByIDs\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByIDs\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByIDs\", args);\n\n/**\n * A composable that queries a document from the Prismic repository with a\n * specific 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByUID}\n */\nexport const usePrismicDocumentByUID = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUID\">[0],\n\t\tuid: ClientMethodParameters<\"getByUID\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUID\">[2] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getByUID\", args);\n\n/**\n * A composable that queries documents from the Prismic repository with specific\n * UIDs.\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 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByIDs}\n */\nexport const usePrismicDocumentsByUIDs = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByUIDs\">[0],\n\t\tuids: ClientMethodParameters<\"getByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getByUIDs\">[2] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByUIDs\", args);\n\n/**\n * A composable that queries all documents from the Prismic repository with\n * specific UIDs.\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 document's Custom Type\n * @param uids - A list of document UIDs\n * @param params - Parameters to filter and sort results\n *\n * @returns The composable payload {@link ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAllByIDs}\n */\nexport const useAllPrismicDocumentsByUIDs = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getAllByUIDs\">[0],\n\t\tids: ClientMethodParameters<\"getAllByUIDs\">[1],\n\t\tparams?: ClientMethodParameters<\"getAllByUIDs\">[2] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByUIDs\", args);\n\n/**\n * A composable that queries a singleton document from the Prismic repository\n * for a 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getSingle}\n */\nexport const useSinglePrismicDocument = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getSingle\">[0],\n\t\tparams?: ClientMethodParameters<\"getSingle\">[1] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument> =>\n\tuseStatefulPrismicClientMethod(\"getSingle\", args);\n\n/**\n * A composable that queries documents 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 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByType}\n */\nexport const usePrismicDocumentsByType = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getByType\">[1] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByType\", args);\n\n/**\n * A composable that queries all documents 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 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAllByType}\n */\nexport const useAllPrismicDocumentsByType = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\tdocumentType: ClientMethodParameters<\"getAllByType\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByType\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByType\", args);\n\n/**\n * A composable that queries documents from the Prismic repository with a\n * specific 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByTag}\n */\nexport const usePrismicDocumentsByTag = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByTag\">[1] & ComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByTag\", args);\n\n/**\n * A composable that queries all documents from the Prismic repository with a\n * specific 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAllByTag}\n */\nexport const useAllPrismicDocumentsByTag = <TDocument extends PrismicDocument>(\n\t...args: [\n\t\ttag: ClientMethodParameters<\"getAllByTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByTag\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByTag\", args);\n\n/**\n * A composable that queries 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, sort, and paginate results\n *\n * @returns The composable payload {@link ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByTags}\n */\nexport const usePrismicDocumentsByEveryTag = <\n\tTDocument extends PrismicDocument,\n>(\n\t...args: [\n\t\ttags: ClientMethodParameters<\"getByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getByEveryTag\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getByEveryTag\", args);\n\n/**\n * A composable that queries all documents from the Prismic repository with\n * specific tags. A document must be tagged with all 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAllByTags}\n */\nexport const useAllPrismicDocumentsByEveryTag = <\n\tTDocument extends PrismicDocument,\n>(\n\t...args: [\n\t\ttags: ClientMethodParameters<\"getAllByEveryTag\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllByEveryTag\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllByEveryTag\", args);\n\n/**\n * A composable that queries 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, sort, and paginate results\n *\n * @returns The composable payload {@link ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getByTags}\n */\nexport const usePrismicDocumentsBySomeTags = <\n\tTDocument extends PrismicDocument,\n>(\n\t...args: [\n\t\ttags: ClientMethodParameters<\"getBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getBySomeTags\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<Query<TDocument>> =>\n\tuseStatefulPrismicClientMethod(\"getBySomeTags\", args);\n\n/**\n * A composable that queries all documents from the Prismic repository with\n * specific tags. A document must be tagged with at least one of the queried\n * 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAllByTags}\n */\nexport const useAllPrismicDocumentsBySomeTags = <\n\tTDocument extends PrismicDocument,\n>(\n\t...args: [\n\t\ttags: ClientMethodParameters<\"getAllBySomeTags\">[0],\n\t\tparams?: ClientMethodParameters<\"getAllBySomeTags\">[1] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"getAllBySomeTags\", args);\n\n/**\n * **IMPORTANT**: Avoid using `dangerouslyUseAllPrismicDocuments` as it may be\n * slower and require more resources than other composables. Prefer using other\n * composables that filter by predicates such as\n * `useAllPrismicDocumentsByType`.\n *\n * A composable 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 ClientComposableReturnType}\n *\n * @see Underlying `@prismicio/client` method {@link Client.getAll}\n */\nexport const dangerouslyUseAllPrismicDocuments = <\n\tTDocument extends PrismicDocument,\n>(\n\t...args: [\n\t\tparams?: ClientMethodParameters<\"dangerouslyGetAll\">[0] &\n\t\t\tComposableOnlyParameters,\n\t]\n): ClientComposableReturnType<TDocument[]> =>\n\tuseStatefulPrismicClientMethod(\"dangerouslyGetAll\", args);\n"],"names":[],"mappings":";AAiCO,MAAM,sBAAsB,IAC/B,SAIH,+BAA+B,OAAO,IAAI;AAiBpC,MAAM,0BAA0B,IACnC,SAIH,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,yBAAyB,IAClC,SAKH,+BAA+B,WAAW,IAAI;AAkBxC,MAAM,2BAA2B,IACpC,SAKH,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,8BAA8B,IACvC,SAMH,+BAA+B,eAAe,IAAI;AAmB5C,MAAM,0BAA0B,IACnC,SAMH,+BAA+B,YAAY,IAAI;AAmBzC,MAAM,4BAA4B,IACrC,SAMH,+BAA+B,aAAa,IAAI;AAmB1C,MAAM,+BAA+B,IACxC,SAOH,+BAA+B,gBAAgB,IAAI;AAkB7C,MAAM,2BAA2B,IACpC,SAKH,+BAA+B,aAAa,IAAI;AAkB1C,MAAM,4BAA4B,IACrC,SAKH,+BAA+B,aAAa,IAAI;AAkB1C,MAAM,+BAA+B,IACxC,SAMH,+BAA+B,gBAAgB,IAAI;AAkB7C,MAAM,2BAA2B,IACpC,SAKH,+BAA+B,YAAY,IAAI;AAkBzC,MAAM,8BAA8B,IACvC,SAMH,+BAA+B,eAAe,IAAI;AAkB5C,MAAM,gCAAgC,IAGzC,SAMH,+BAA+B,iBAAiB,IAAI;AAmB9C,MAAM,mCAAmC,IAG5C,SAMH,+BAA+B,oBAAoB,IAAI;AAmBjD,MAAM,gCAAgC,IAGzC,SAMH,+BAA+B,iBAAiB,IAAI;AAmB9C,MAAM,mCAAmC,IAG5C,SAMH,+BAA+B,oBAAoB,IAAI;AAuBjD,MAAM,oCAAoC,IAG7C,SAKH,+BAA+B,qBAAqB,IAAI;"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
+ mod
19
+ ));
20
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
21
+ const client = require("@prismicio/client");
22
+ const helpers = require("@prismicio/helpers");
23
+ const PrismicEmbed = require("./components/PrismicEmbed.cjs");
24
+ const PrismicImage = require("./components/PrismicImage.cjs");
25
+ const PrismicLink = require("./components/PrismicLink.cjs");
26
+ const PrismicText = require("./components/PrismicText.cjs");
27
+ const PrismicRichText = require("./components/PrismicRichText.cjs");
28
+ const SliceZone = require("./components/SliceZone.cjs");
29
+ const injectionSymbols = require("./injectionSymbols.cjs");
30
+ const createPrismic = (options) => {
31
+ let client$1;
32
+ if (options.client) {
33
+ client$1 = options.client;
34
+ } else {
35
+ client$1 = client.createClient(options.endpoint, {
36
+ fetch: async (endpoint, options2) => {
37
+ let fetchFunction;
38
+ if (typeof globalThis.fetch === "function") {
39
+ fetchFunction = globalThis.fetch;
40
+ } else {
41
+ fetchFunction = (await import("isomorphic-unfetch")).default;
42
+ }
43
+ return await fetchFunction(endpoint, options2);
44
+ },
45
+ ...options.clientConfig
46
+ });
47
+ }
48
+ const prismicClient = {
49
+ client: client$1,
50
+ predicate: client.predicate,
51
+ cookie: client.cookie
52
+ };
53
+ const prismicHelpers = {
54
+ asText: helpers.asText,
55
+ asHTML: (richTextField, linkResolver, htmlSerializer) => {
56
+ return helpers.asHTML(richTextField, linkResolver || options.linkResolver, htmlSerializer || options.htmlSerializer);
57
+ },
58
+ asLink: (linkField, linkResolver) => {
59
+ return helpers.asLink(linkField, linkResolver || options.linkResolver);
60
+ },
61
+ asDate: helpers.asDate,
62
+ asImageSrc: helpers.asImageSrc,
63
+ asImageWidthSrcSet: helpers.asImageWidthSrcSet,
64
+ asImagePixelDensitySrcSet: helpers.asImagePixelDensitySrcSet,
65
+ documentToLinkField: helpers.documentToLinkField
66
+ };
67
+ const prismic = {
68
+ options,
69
+ ...prismicClient,
70
+ ...prismicHelpers,
71
+ install(app) {
72
+ app.provide(injectionSymbols.prismicKey, this);
73
+ app.config.globalProperties.$prismic = this;
74
+ if (options.injectComponents !== false) {
75
+ app.component(PrismicLink.PrismicLink.name, PrismicLink.PrismicLink);
76
+ app.component(PrismicEmbed.PrismicEmbed.name, PrismicEmbed.PrismicEmbed);
77
+ app.component(PrismicImage.PrismicImage.name, PrismicImage.PrismicImage);
78
+ app.component(PrismicText.PrismicText.name, PrismicText.PrismicText);
79
+ app.component(PrismicRichText.PrismicRichText.name, PrismicRichText.PrismicRichText);
80
+ app.component(SliceZone.SliceZone.name, SliceZone.SliceZone);
81
+ }
82
+ }
83
+ };
84
+ return prismic;
85
+ };
86
+ exports.createPrismic = createPrismic;
87
+ //# sourceMappingURL=createPrismic.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPrismic.cjs","sources":["../../src/createPrismic.ts"],"sourcesContent":["import { App } from \"vue\";\n\nimport {\n\tcreateClient,\n\tpredicate,\n\tcookie,\n\tClient,\n\tFetchLike,\n} from \"@prismicio/client\";\nimport {\n\tasText,\n\tasHTML,\n\tasLink,\n\tasDate,\n\tasImageSrc,\n\tasImageWidthSrcSet,\n\tasImagePixelDensitySrcSet,\n\tdocumentToLinkField,\n} from \"@prismicio/helpers\";\n\nimport {\n\tPrismicEmbed,\n\tPrismicImage,\n\tPrismicLink,\n\tPrismicRichText,\n\tPrismicText,\n\tSliceZone,\n} from \"./components\";\nimport { prismicKey } from \"./injectionSymbols\";\nimport type {\n\tPrismicPlugin,\n\tPrismicPluginClient,\n\tPrismicPluginHelpers,\n\tPrismicPluginOptions,\n} from \"./types\";\n\n/**\n * Creates a `@prismicio/vue` plugin instance that can be used by a Vue app.\n *\n * @param options - {@link PrismicPluginOptions}\n *\n * @returns `@prismicio/vue` plugin instance {@link PrismicPlugin}\n *\n * @see Prismic Official Vue.js documentation: {@link https://prismic.io/docs/technologies/vuejs}\n * @see Plugin repository: {@link https://github.com/prismicio/prismic-vue}\n */\nexport const createPrismic = (options: PrismicPluginOptions): PrismicPlugin => {\n\t// Create plugin client\n\tlet client: Client;\n\tif (options.client) {\n\t\tclient = options.client;\n\t} else {\n\t\tclient = createClient(options.endpoint, {\n\t\t\tfetch: async (endpoint, options) => {\n\t\t\t\tlet fetchFunction: FetchLike;\n\t\t\t\tif (typeof globalThis.fetch === \"function\") {\n\t\t\t\t\t// TODO: Remove after https://github.com/prismicio/prismic-client/issues/254\n\t\t\t\t\tfetchFunction = globalThis.fetch as FetchLike;\n\t\t\t\t} else {\n\t\t\t\t\t// TODO: Remove after https://github.com/prismicio/prismic-client/issues/254\n\t\t\t\t\tfetchFunction = (await import(\"isomorphic-unfetch\"))\n\t\t\t\t\t\t.default as FetchLike;\n\t\t\t\t}\n\n\t\t\t\treturn await fetchFunction(endpoint, options);\n\t\t\t},\n\t\t\t...options.clientConfig,\n\t\t});\n\t}\n\n\tconst prismicClient: PrismicPluginClient = {\n\t\tclient,\n\t\tpredicate,\n\t\tcookie,\n\t};\n\n\t// Create plugin helpers\n\tconst prismicHelpers: PrismicPluginHelpers = {\n\t\tasText,\n\t\tasHTML: (richTextField, linkResolver, htmlSerializer) => {\n\t\t\treturn asHTML(\n\t\t\t\trichTextField,\n\t\t\t\tlinkResolver || options.linkResolver,\n\t\t\t\thtmlSerializer || options.htmlSerializer,\n\t\t\t);\n\t\t},\n\t\tasLink: (linkField, linkResolver) => {\n\t\t\treturn asLink(linkField, linkResolver || options.linkResolver);\n\t\t},\n\t\tasDate,\n\t\tasImageSrc,\n\t\tasImageWidthSrcSet,\n\t\tasImagePixelDensitySrcSet,\n\t\tdocumentToLinkField,\n\t};\n\n\t// Create plugin interface\n\tconst prismic: PrismicPlugin = {\n\t\toptions,\n\n\t\t...prismicClient,\n\t\t...prismicHelpers,\n\n\t\tinstall(app: App): void {\n\t\t\tapp.provide(prismicKey, this);\n\t\t\tapp.config.globalProperties.$prismic = this;\n\n\t\t\tif (options.injectComponents !== false) {\n\t\t\t\tapp.component(PrismicLink.name, PrismicLink);\n\t\t\t\tapp.component(PrismicEmbed.name, PrismicEmbed);\n\t\t\t\tapp.component(PrismicImage.name, PrismicImage);\n\t\t\t\tapp.component(PrismicText.name, PrismicText);\n\t\t\t\tapp.component(PrismicRichText.name, PrismicRichText);\n\t\t\t\tapp.component(SliceZone.name, SliceZone);\n\t\t\t}\n\t\t},\n\t};\n\n\treturn prismic;\n};\n"],"names":["client","createClient","options","predicate","cookie","asText","asHTML","asLink","asDate","asImageSrc","asImageWidthSrcSet","asImagePixelDensitySrcSet","documentToLinkField","prismicKey","PrismicLink","PrismicEmbed","PrismicImage","PrismicText","PrismicRichText","SliceZone"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8Ca,MAAA,gBAAgB,CAAC,YAAgD;AAEzE,MAAAA;AACJ,MAAI,QAAQ,QAAQ;AACnBA,eAAS,QAAQ;AAAA,EAAA,OACX;AACGA,eAAAC,OAAAA,aAAa,QAAQ,UAAU;AAAA,MACvC,OAAO,OAAO,UAAUC,aAAW;AAC9B,YAAA;AACA,YAAA,OAAO,WAAW,UAAU,YAAY;AAE3C,0BAAgB,WAAW;AAAA,QAAA,OACrB;AAEW,2BAAA,MAAM,OAAO,uBAC5B;AAAA,QACF;AAEM,eAAA,MAAM,cAAc,UAAUA,QAAO;AAAA,MAC7C;AAAA,MACA,GAAG,QAAQ;AAAA,IAAA,CACX;AAAA,EACD;AAED,QAAM,gBAAqC;AAAA,IAAA,QAC1CF;AAAAA,IAAA,WACAG,OAAA;AAAA,IAAA,QACAC,OAAA;AAAA,EAAA;AAID,QAAM,iBAAuC;AAAA,IAAA,QAC5CC,QAAA;AAAA,IACA,QAAQ,CAAC,eAAe,cAAc,mBAAkB;AACvD,aAAOC,eACN,eACA,gBAAgB,QAAQ,cACxB,kBAAkB,QAAQ,cAAc;AAAA,IAE1C;AAAA,IACA,QAAQ,CAAC,WAAW,iBAAgB;AACnC,aAAOC,QAAO,OAAA,WAAW,gBAAgB,QAAQ,YAAY;AAAA,IAC9D;AAAA,IAAA,QACAC,QAAA;AAAA,IAAA,YACAC,QAAA;AAAA,IAAA,oBACAC,QAAA;AAAA,IAAA,2BACAC,QAAA;AAAA,IAAA,qBACAC,QAAA;AAAA,EAAA;AAID,QAAM,UAAyB;AAAA,IAC9B;AAAA,IAEA,GAAG;AAAA,IACH,GAAG;AAAA,IAEH,QAAQ,KAAQ;AACX,UAAA,QAAQC,6BAAY,IAAI;AACxB,UAAA,OAAO,iBAAiB,WAAW;AAEnC,UAAA,QAAQ,qBAAqB,OAAO;AACnC,YAAA,UAAUC,YAAAA,YAAY,MAAMA,YAAW,WAAA;AACvC,YAAA,UAAUC,aAAAA,aAAa,MAAMA,aAAY,YAAA;AACzC,YAAA,UAAUC,aAAAA,aAAa,MAAMA,aAAY,YAAA;AACzC,YAAA,UAAUC,YAAAA,YAAY,MAAMA,YAAW,WAAA;AACvC,YAAA,UAAUC,gBAAAA,gBAAgB,MAAMA,gBAAe,eAAA;AAC/C,YAAA,UAAUC,UAAAA,UAAU,MAAMA,UAAS,SAAA;AAAA,MACvC;AAAA,IACF;AAAA,EAAA;AAGM,SAAA;AACR;;"}
@@ -0,0 +1,12 @@
1
+ import type { PrismicPlugin, PrismicPluginOptions } from "./types";
2
+ /**
3
+ * Creates a `@prismicio/vue` plugin instance that can be used by a Vue app.
4
+ *
5
+ * @param options - {@link PrismicPluginOptions}
6
+ *
7
+ * @returns `@prismicio/vue` plugin instance {@link PrismicPlugin}
8
+ *
9
+ * @see Prismic Official Vue.js documentation: {@link https://prismic.io/docs/technologies/vuejs}
10
+ * @see Plugin repository: {@link https://github.com/prismicio/prismic-vue}
11
+ */
12
+ export declare const createPrismic: (options: PrismicPluginOptions) => PrismicPlugin;