@prismicio/vue 5.3.0-pr.88.ee9acb6 → 5.3.0-pr.89.d0f4ac2

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 (134) hide show
  1. package/dist/PrismicImage.vue.d.cts +15 -49
  2. package/dist/PrismicImage.vue.d.cts.map +1 -1
  3. package/dist/PrismicLink.vue.d.cts +57 -52
  4. package/dist/PrismicLink.vue.d.cts.map +1 -1
  5. package/dist/PrismicRichText/PrismicRichText.vue.d.cts +14 -14
  6. package/dist/PrismicRichText/PrismicRichText.vue.d.cts.map +1 -1
  7. package/dist/PrismicRichText/types.d.cts +25 -26
  8. package/dist/PrismicRichText/types.d.cts.map +1 -1
  9. package/dist/PrismicTable/PrismicTable.vue.d.cts +8 -9
  10. package/dist/PrismicTable/PrismicTable.vue.d.cts.map +1 -1
  11. package/dist/PrismicTable/types.d.cts +7 -8
  12. package/dist/PrismicTable/types.d.cts.map +1 -1
  13. package/dist/PrismicText.vue.d.cts +2 -6
  14. package/dist/PrismicText.vue.d.cts.map +1 -1
  15. package/dist/SliceZone/SliceZone.vue.d.cts +3 -14
  16. package/dist/SliceZone/SliceZone.vue.d.cts.map +1 -1
  17. package/dist/SliceZone/types.d.cts +3 -9
  18. package/dist/SliceZone/types.d.cts.map +1 -1
  19. package/dist/createPrismic.d.cts +61 -0
  20. package/dist/createPrismic.d.cts.map +1 -0
  21. package/dist/index.cjs +4 -1
  22. package/dist/index.d.cts +4 -2
  23. package/dist/index.d.ts +4 -2
  24. package/dist/index.js +2 -1
  25. package/dist/package.cjs +1 -1
  26. package/dist/package.cjs.map +1 -1
  27. package/dist/package.js +1 -1
  28. package/dist/package.js.map +1 -1
  29. package/dist/src/PrismicImage.cjs.map +1 -1
  30. package/dist/src/PrismicImage.js.map +1 -1
  31. package/dist/src/PrismicImage.vue.d.ts +15 -49
  32. package/dist/src/PrismicImage.vue.d.ts.map +1 -1
  33. package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  34. package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.js.map +1 -1
  35. package/dist/src/PrismicLink.cjs.map +1 -1
  36. package/dist/src/PrismicLink.js.map +1 -1
  37. package/dist/src/PrismicLink.vue.d.ts +57 -52
  38. package/dist/src/PrismicLink.vue.d.ts.map +1 -1
  39. package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs +6 -10
  40. package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  41. package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.js +6 -10
  42. package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.js.map +1 -1
  43. package/dist/src/PrismicRichText/PrismicRichText.cjs.map +1 -1
  44. package/dist/src/PrismicRichText/PrismicRichText.js.map +1 -1
  45. package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts +18 -18
  46. package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts.map +1 -1
  47. package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs +11 -5
  48. package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  49. package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js +11 -5
  50. package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js.map +1 -1
  51. package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.cjs.map +1 -1
  52. package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.js.map +1 -1
  53. package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs +2 -2
  54. package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  55. package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js +2 -2
  56. package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
  57. package/dist/src/PrismicRichText/PrismicRichTextSerialize.cjs.map +1 -1
  58. package/dist/src/PrismicRichText/PrismicRichTextSerialize.js.map +1 -1
  59. package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs +10 -4
  60. package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  61. package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js +11 -5
  62. package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js.map +1 -1
  63. package/dist/src/PrismicRichText/index.d.ts +1 -1
  64. package/dist/src/PrismicRichText/types.d.ts +25 -26
  65. package/dist/src/PrismicRichText/types.d.ts.map +1 -1
  66. package/dist/src/PrismicTable/PrismicTable.cjs.map +1 -1
  67. package/dist/src/PrismicTable/PrismicTable.js.map +1 -1
  68. package/dist/src/PrismicTable/PrismicTable.vue.d.ts +10 -11
  69. package/dist/src/PrismicTable/PrismicTable.vue.d.ts.map +1 -1
  70. package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs +18 -10
  71. package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  72. package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js +19 -11
  73. package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  74. package/dist/src/PrismicTable/PrismicTableDefaultComponents.cjs +12 -30
  75. package/dist/src/PrismicTable/PrismicTableDefaultComponents.cjs.map +1 -1
  76. package/dist/src/PrismicTable/PrismicTableDefaultComponents.js +12 -30
  77. package/dist/src/PrismicTable/PrismicTableDefaultComponents.js.map +1 -1
  78. package/dist/src/PrismicTable/PrismicTableRow.cjs.map +1 -1
  79. package/dist/src/PrismicTable/PrismicTableRow.js.map +1 -1
  80. package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  81. package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
  82. package/dist/src/PrismicTable/index.d.ts +1 -0
  83. package/dist/src/PrismicTable/types.d.ts +7 -8
  84. package/dist/src/PrismicTable/types.d.ts.map +1 -1
  85. package/dist/src/PrismicText.cjs.map +1 -1
  86. package/dist/src/PrismicText.js.map +1 -1
  87. package/dist/src/PrismicText.vue.d.ts +2 -6
  88. package/dist/src/PrismicText.vue.d.ts.map +1 -1
  89. package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  90. package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.js.map +1 -1
  91. package/dist/src/SliceZone/SliceZone.cjs.map +1 -1
  92. package/dist/src/SliceZone/SliceZone.js.map +1 -1
  93. package/dist/src/SliceZone/SliceZone.vue.d.ts +3 -14
  94. package/dist/src/SliceZone/SliceZone.vue.d.ts.map +1 -1
  95. package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  96. package/dist/src/SliceZone/SliceZone.vue_vue_type_script_setup_true_lang.js.map +1 -1
  97. package/dist/src/SliceZone/types.d.ts +3 -9
  98. package/dist/src/SliceZone/types.d.ts.map +1 -1
  99. package/dist/src/createPrismic.cjs +33 -0
  100. package/dist/src/createPrismic.cjs.map +1 -0
  101. package/dist/src/createPrismic.d.ts +63 -0
  102. package/dist/src/createPrismic.d.ts.map +1 -0
  103. package/dist/src/createPrismic.js +32 -0
  104. package/dist/src/createPrismic.js.map +1 -0
  105. package/dist/src/lib/isInternalURL.cjs +2 -6
  106. package/dist/src/lib/isInternalURL.cjs.map +1 -1
  107. package/dist/src/lib/isInternalURL.js +2 -6
  108. package/dist/src/lib/isInternalURL.js.map +1 -1
  109. package/dist/src/types.cjs.map +1 -1
  110. package/dist/src/types.d.ts +11 -1
  111. package/dist/src/types.d.ts.map +1 -1
  112. package/dist/src/types.js.map +1 -1
  113. package/dist/types.d.cts +11 -1
  114. package/dist/types.d.cts.map +1 -1
  115. package/package.json +1 -3
  116. package/src/PrismicImage.vue +5 -16
  117. package/src/PrismicLink.vue +26 -26
  118. package/src/PrismicRichText/PrismicRichText.vue +33 -23
  119. package/src/PrismicRichText/PrismicRichTextDefaultComponent.vue +8 -4
  120. package/src/PrismicRichText/PrismicRichTextSerialize.vue +4 -3
  121. package/src/PrismicRichText/index.ts +1 -1
  122. package/src/PrismicRichText/types.ts +57 -29
  123. package/src/PrismicTable/PrismicTable.vue +31 -23
  124. package/src/PrismicTable/PrismicTableDefaultComponents.ts +14 -39
  125. package/src/PrismicTable/PrismicTableRow.vue +2 -2
  126. package/src/PrismicTable/index.ts +2 -0
  127. package/src/PrismicTable/types.ts +41 -23
  128. package/src/PrismicText.vue +2 -6
  129. package/src/SliceZone/SliceZone.vue +3 -14
  130. package/src/SliceZone/types.ts +3 -9
  131. package/src/createPrismic.ts +86 -0
  132. package/src/index.ts +5 -1
  133. package/src/lib/isInternalURL.ts +2 -6
  134. package/src/types.ts +13 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SliceZone.js","names":[],"sources":["../../../src/SliceZone/SliceZone.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from \"vue\"\n\nimport type {\n\tSliceComponentType,\n\tSliceLike,\n\tSliceZoneComponents,\n\tSliceZoneLike,\n} from \"./types\"\n\nimport { TODOSliceComponent } from \"./TODOSliceComponent\"\n\n/**\n * Props for `<SliceZone />`.\n *\n * @typeParam TContext - Arbitrary data made available to all Slice components\n */\nexport type SliceZoneProps<TContext = unknown> = {\n\t/**\n\t * List of Slice data from the Slice Zone.\n\t */\n\tslices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>\n\n\t/**\n\t * A record mapping Slice types to Vue components.\n\t */\n\tcomponents?: SliceZoneComponents\n\n\t/**\n\t * The Vue component rendered if a component mapping from the `components`\n\t * prop cannot be found.\n\t *\n\t * @remarks\n\t * Components will be rendered using the {@link SliceComponentProps} interface.\n\t *\n\t * @defaultValue The Slice Zone default component provided to `@prismicio/vue` plugin if configured, otherwise `null` when `process.env.NODE_ENV === \"production\"` else {@link TODOSliceComponent}.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>\n\n\t/**\n\t * Arbitrary data made available to all Slice components.\n\t */\n\tcontext?: TContext\n}\n\nconst props = defineProps<SliceZoneProps>()\ndefineOptions({ name: \"SliceZone\" })\n\nconst renderedSlices = computed(() => {\n\tif (!props.slices) return []\n\n\treturn props.slices.map((slice, index) => {\n\t\tconst type =\n\t\t\t\"slice_type\" in slice ? (slice.slice_type as string) : slice.type\n\n\t\tconst key =\n\t\t\t\"id\" in slice && typeof slice.id === \"string\"\n\t\t\t\t? slice.id\n\t\t\t\t: `${index}-${JSON.stringify(slice)}`\n\n\t\tconst is = props.components?.[type] || props.defaultComponent\n\n\t\tif (!is) {\n\t\t\treturn { is: TODOSliceComponent, key, props: { slice } }\n\t\t}\n\n\t\tif (slice.__mapped) {\n\t\t\tconst { __mapped, ...mappedProps } = slice\n\n\t\t\treturn { is, key, props: mappedProps }\n\t\t}\n\n\t\treturn {\n\t\t\tis,\n\t\t\tkey,\n\t\t\tprops: {\n\t\t\t\tslice,\n\t\t\t\tindex,\n\t\t\t\tcontext: props.context,\n\t\t\t\tslices: props.slices,\n\t\t\t},\n\t\t}\n\t})\n})\n</script>\n\n<template>\n\t<component\n\t\tv-for=\"renderedSlice in renderedSlices\"\n\t\t:is=\"renderedSlice.is\"\n\t\t:key=\"renderedSlice.key\"\n\t\tv-bind=\"renderedSlice.props\"\n\t/>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"SliceZone.js","names":[],"sources":["../../../src/SliceZone/SliceZone.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from \"vue\"\n\nimport type {\n\tSliceComponentType,\n\tSliceLike,\n\tSliceZoneComponents,\n\tSliceZoneLike,\n} from \"./types\"\n\nimport { TODOSliceComponent } from \"./TODOSliceComponent\"\n\n/**\n * Props for `<SliceZone />`.\n *\n * @typeParam TContext - Arbitrary data made available to all Slice components\n */\nexport type SliceZoneProps<TContext = unknown> = {\n\t/** List of slice data from the slice zone. */\n\tslices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>\n\n\t/** A record mapping slice types to React components. */\n\tcomponents?: SliceZoneComponents\n\n\t/**\n\t * The Vue component rendered if a component mapping from the `components`\n\t * prop cannot be found.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>\n\n\t/** Arbitrary data made available to all slice components. */\n\tcontext?: TContext\n}\n\nconst props = defineProps<SliceZoneProps>()\ndefineOptions({ name: \"SliceZone\" })\n\nconst renderedSlices = computed(() => {\n\tif (!props.slices) return []\n\n\treturn props.slices.map((slice, index) => {\n\t\tconst type =\n\t\t\t\"slice_type\" in slice ? (slice.slice_type as string) : slice.type\n\n\t\tconst key =\n\t\t\t\"id\" in slice && typeof slice.id === \"string\"\n\t\t\t\t? slice.id\n\t\t\t\t: `${index}-${JSON.stringify(slice)}`\n\n\t\tconst is = props.components?.[type] || props.defaultComponent\n\n\t\tif (!is) {\n\t\t\treturn { is: TODOSliceComponent, key, props: { slice } }\n\t\t}\n\n\t\tif (slice.__mapped) {\n\t\t\tconst { __mapped, ...mappedProps } = slice\n\n\t\t\treturn { is, key, props: mappedProps }\n\t\t}\n\n\t\treturn {\n\t\t\tis,\n\t\t\tkey,\n\t\t\tprops: {\n\t\t\t\tslice,\n\t\t\t\tindex,\n\t\t\t\tcontext: props.context,\n\t\t\t\tslices: props.slices,\n\t\t\t},\n\t\t}\n\t})\n})\n</script>\n\n<template>\n\t<component\n\t\tv-for=\"renderedSlice in renderedSlices\"\n\t\t:is=\"renderedSlice.is\"\n\t\t:key=\"renderedSlice.key\"\n\t\tv-bind=\"renderedSlice.props\"\n\t/>\n</template>\n"],"mappings":""}
@@ -9,27 +9,16 @@ import * as vue26 from "vue";
9
9
  * @typeParam TContext - Arbitrary data made available to all Slice components
10
10
  */
11
11
  type SliceZoneProps<TContext = unknown> = {
12
- /**
13
- * List of Slice data from the Slice Zone.
14
- */
12
+ /** List of slice data from the slice zone. */
15
13
  slices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>;
16
- /**
17
- * A record mapping Slice types to Vue components.
18
- */
14
+ /** A record mapping slice types to React components. */
19
15
  components?: SliceZoneComponents;
20
16
  /**
21
17
  * The Vue component rendered if a component mapping from the `components`
22
18
  * prop cannot be found.
23
- *
24
- * @remarks
25
- * Components will be rendered using the {@link SliceComponentProps} interface.
26
- *
27
- * @defaultValue The Slice Zone default component provided to `@prismicio/vue` plugin if configured, otherwise `null` when `process.env.NODE_ENV === "production"` else {@link TODOSliceComponent}.
28
19
  */
29
20
  defaultComponent?: SliceComponentType<any, TContext>;
30
- /**
31
- * Arbitrary data made available to all Slice components.
32
- */
21
+ /** Arbitrary data made available to all slice components. */
33
22
  context?: TContext;
34
23
  };
35
24
  type __VLS_Props = SliceZoneProps;
@@ -1 +1 @@
1
- {"version":3,"file":"SliceZone.vue.d.ts","names":[],"sources":["../../../src/SliceZone/SliceZone.vue"],"sourcesContent":[],"mappings":";;;;;;;;AAiHA;;AAIoC,KAJxB,cAIwB,CAAA,WAAA,OAAA,CAAA,GAAA;EAAY;;;EAiBJ,MAAA,EAjBnC,aAiBmC,CAjBrB,SAiBqB,GAAA,CAjBR,SAiBQ,GAjBI,MAiBJ,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,CAAA;EAAxB;;;EAQf,UAAA,CAAA,EApBS,mBAoBK;EAyEb;;;;;;;;;EAAY,gBAAA,CAAA,EAjFE,kBAiFF,CAAA,GAAA,EAjF0B,QAiF1B,CAAA;EAAA;AAAA;;YA5EP;;KAGN,WAAA,GAAc;cAyEb,cAAY,KAAA,CAAA,gBAAA,6BAAA,KAAA,CAAA,qBAAA,EAAA,KAAA,CAAA,qBAAA,cAAA,KAAA,CAAA,WAAA,EAAA,SAAA,eAAA,sCAAA,KAAA,CAAA,uBAAA;cAAA,iBAGU"}
1
+ {"version":3,"file":"SliceZone.vue.d.ts","names":[],"sources":["../../../src/SliceZone/SliceZone.vue"],"sourcesContent":[],"mappings":";;;;;;;;AAsGA;;AAEoC,KAFxB,cAEwB,CAAA,WAAA,OAAA,CAAA,GAAA;EAAY;EAAvC,MAAA,EAAA,aAAA,CAAc,SAAd,GAAA,CAA2B,SAA3B,GAAuC,MAAvC,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,CAAA;EAGK;EAO8B,UAAA,CAAA,EAP9B,mBAO8B;EAAxB;;;AAInB;EA2EK,gBAEJ,CAAA,EAjFkB,kBAiFlB,CAAA,GAAA,EAjF0C,QAiF1C,CAAA;EAFgB;EAAA,OAAA,CAAA,EA5EP,QA4EO;CAAA;KAzEb,WAAA,GAAc,cAyED;cAAZ,YAAY,EAAA,KAAA,CAAA,eAAA,CAAA,WAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,KAAA,CAAA,qBAAA,EAAA,KAAA,CAAA,qBAAA,EAAA,CAAA,CAAA,EAAA,MAAA,EAAA,KAAA,CAAA,WAAA,EAAA,QAAA,CAAA,WAAA,CAAA,GAAA,QAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,MAAA,EAAA,KAAA,CAAA,uBAAA,EAAA,KAAA,EAAA,CAAA,CAAA,EAAA,GAAA,CAAA;cAAA,QAAA,EAAA,OAGU,YAHV"}
@@ -1 +1 @@
1
- {"version":3,"file":"SliceZone.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/SliceZone/SliceZone.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from \"vue\"\n\nimport type {\n\tSliceComponentType,\n\tSliceLike,\n\tSliceZoneComponents,\n\tSliceZoneLike,\n} from \"./types\"\n\nimport { TODOSliceComponent } from \"./TODOSliceComponent\"\n\n/**\n * Props for `<SliceZone />`.\n *\n * @typeParam TContext - Arbitrary data made available to all Slice components\n */\nexport type SliceZoneProps<TContext = unknown> = {\n\t/**\n\t * List of Slice data from the Slice Zone.\n\t */\n\tslices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>\n\n\t/**\n\t * A record mapping Slice types to Vue components.\n\t */\n\tcomponents?: SliceZoneComponents\n\n\t/**\n\t * The Vue component rendered if a component mapping from the `components`\n\t * prop cannot be found.\n\t *\n\t * @remarks\n\t * Components will be rendered using the {@link SliceComponentProps} interface.\n\t *\n\t * @defaultValue The Slice Zone default component provided to `@prismicio/vue` plugin if configured, otherwise `null` when `process.env.NODE_ENV === \"production\"` else {@link TODOSliceComponent}.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>\n\n\t/**\n\t * Arbitrary data made available to all Slice components.\n\t */\n\tcontext?: TContext\n}\n\nconst props = defineProps<SliceZoneProps>()\ndefineOptions({ name: \"SliceZone\" })\n\nconst renderedSlices = computed(() => {\n\tif (!props.slices) return []\n\n\treturn props.slices.map((slice, index) => {\n\t\tconst type =\n\t\t\t\"slice_type\" in slice ? (slice.slice_type as string) : slice.type\n\n\t\tconst key =\n\t\t\t\"id\" in slice && typeof slice.id === \"string\"\n\t\t\t\t? slice.id\n\t\t\t\t: `${index}-${JSON.stringify(slice)}`\n\n\t\tconst is = props.components?.[type] || props.defaultComponent\n\n\t\tif (!is) {\n\t\t\treturn { is: TODOSliceComponent, key, props: { slice } }\n\t\t}\n\n\t\tif (slice.__mapped) {\n\t\t\tconst { __mapped, ...mappedProps } = slice\n\n\t\t\treturn { is, key, props: mappedProps }\n\t\t}\n\n\t\treturn {\n\t\t\tis,\n\t\t\tkey,\n\t\t\tprops: {\n\t\t\t\tslice,\n\t\t\t\tindex,\n\t\t\t\tcontext: props.context,\n\t\t\t\tslices: props.slices,\n\t\t\t},\n\t\t}\n\t})\n})\n</script>\n\n<template>\n\t<component\n\t\tv-for=\"renderedSlice in renderedSlices\"\n\t\t:is=\"renderedSlice.is\"\n\t\t:key=\"renderedSlice.key\"\n\t\tv-bind=\"renderedSlice.props\"\n\t/>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EA8CA,MAAM,QAAQ;EAGd,MAAM,yCAAgC;AACrC,OAAI,CAAC,MAAM,OAAQ,QAAO,EAAC;AAE3B,UAAO,MAAM,OAAO,KAAK,OAAO,UAAU;IACzC,MAAM,OACL,gBAAgB,QAAS,MAAM,aAAwB,MAAM;IAE9D,MAAM,MACL,QAAQ,SAAS,OAAO,MAAM,OAAO,WAClC,MAAM,KACN,GAAG,MAAM,GAAG,KAAK,UAAU,MAAM;IAErC,MAAM,KAAK,MAAM,aAAa,SAAS,MAAM;AAE7C,QAAI,CAAC,GACJ,QAAO;KAAE,IAAI;KAAoB;KAAK,OAAO,EAAE,OAAO;KAAC;AAGxD,QAAI,MAAM,UAAU;KACnB,MAAM,EAAE,UAAU,GAAG,gBAAgB;AAErC,YAAO;MAAE;MAAI;MAAK,OAAO;MAAY;;AAGtC,WAAO;KACN;KACA;KACA,OAAO;MACN;MACA;MACA,SAAS,MAAM;MACf,QAAQ,MAAM;MACd;KACF;KACA;IACD;;gEASE,cAAA,0BAJuB,eAAA,QAAjB,kBAAa;uFACf,cAAc,GAAE,sBAGpB,EAFA,KAAK,cAAc,0BACZ,cAAc,MAAK,EAAA,MAAA,GAAA"}
1
+ {"version":3,"file":"SliceZone.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/SliceZone/SliceZone.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from \"vue\"\n\nimport type {\n\tSliceComponentType,\n\tSliceLike,\n\tSliceZoneComponents,\n\tSliceZoneLike,\n} from \"./types\"\n\nimport { TODOSliceComponent } from \"./TODOSliceComponent\"\n\n/**\n * Props for `<SliceZone />`.\n *\n * @typeParam TContext - Arbitrary data made available to all Slice components\n */\nexport type SliceZoneProps<TContext = unknown> = {\n\t/** List of slice data from the slice zone. */\n\tslices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>\n\n\t/** A record mapping slice types to React components. */\n\tcomponents?: SliceZoneComponents\n\n\t/**\n\t * The Vue component rendered if a component mapping from the `components`\n\t * prop cannot be found.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>\n\n\t/** Arbitrary data made available to all slice components. */\n\tcontext?: TContext\n}\n\nconst props = defineProps<SliceZoneProps>()\ndefineOptions({ name: \"SliceZone\" })\n\nconst renderedSlices = computed(() => {\n\tif (!props.slices) return []\n\n\treturn props.slices.map((slice, index) => {\n\t\tconst type =\n\t\t\t\"slice_type\" in slice ? (slice.slice_type as string) : slice.type\n\n\t\tconst key =\n\t\t\t\"id\" in slice && typeof slice.id === \"string\"\n\t\t\t\t? slice.id\n\t\t\t\t: `${index}-${JSON.stringify(slice)}`\n\n\t\tconst is = props.components?.[type] || props.defaultComponent\n\n\t\tif (!is) {\n\t\t\treturn { is: TODOSliceComponent, key, props: { slice } }\n\t\t}\n\n\t\tif (slice.__mapped) {\n\t\t\tconst { __mapped, ...mappedProps } = slice\n\n\t\t\treturn { is, key, props: mappedProps }\n\t\t}\n\n\t\treturn {\n\t\t\tis,\n\t\t\tkey,\n\t\t\tprops: {\n\t\t\t\tslice,\n\t\t\t\tindex,\n\t\t\t\tcontext: props.context,\n\t\t\t\tslices: props.slices,\n\t\t\t},\n\t\t}\n\t})\n})\n</script>\n\n<template>\n\t<component\n\t\tv-for=\"renderedSlice in renderedSlices\"\n\t\t:is=\"renderedSlice.is\"\n\t\t:key=\"renderedSlice.key\"\n\t\tv-bind=\"renderedSlice.props\"\n\t/>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCA,MAAM,QAAQ;EAGd,MAAM,yCAAgC;AACrC,OAAI,CAAC,MAAM,OAAQ,QAAO,EAAC;AAE3B,UAAO,MAAM,OAAO,KAAK,OAAO,UAAU;IACzC,MAAM,OACL,gBAAgB,QAAS,MAAM,aAAwB,MAAM;IAE9D,MAAM,MACL,QAAQ,SAAS,OAAO,MAAM,OAAO,WAClC,MAAM,KACN,GAAG,MAAM,GAAG,KAAK,UAAU,MAAM;IAErC,MAAM,KAAK,MAAM,aAAa,SAAS,MAAM;AAE7C,QAAI,CAAC,GACJ,QAAO;KAAE,IAAI;KAAoB;KAAK,OAAO,EAAE,OAAO;KAAC;AAGxD,QAAI,MAAM,UAAU;KACnB,MAAM,EAAE,UAAU,GAAG,gBAAgB;AAErC,YAAO;MAAE;MAAI;MAAK,OAAO;MAAY;;AAGtC,WAAO;KACN;KACA;KACA,OAAO;MACN;MACA;MACA,SAAS,MAAM;MACf,QAAQ,MAAM;MACd;KACF;KACA;IACD;;gEASE,cAAA,0BAJuB,eAAA,QAAjB,kBAAa;uFACf,cAAc,GAAE,sBAGpB,EAFA,KAAK,cAAc,0BACZ,cAAc,MAAK,EAAA,MAAA,GAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SliceZone.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/SliceZone/SliceZone.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from \"vue\"\n\nimport type {\n\tSliceComponentType,\n\tSliceLike,\n\tSliceZoneComponents,\n\tSliceZoneLike,\n} from \"./types\"\n\nimport { TODOSliceComponent } from \"./TODOSliceComponent\"\n\n/**\n * Props for `<SliceZone />`.\n *\n * @typeParam TContext - Arbitrary data made available to all Slice components\n */\nexport type SliceZoneProps<TContext = unknown> = {\n\t/**\n\t * List of Slice data from the Slice Zone.\n\t */\n\tslices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>\n\n\t/**\n\t * A record mapping Slice types to Vue components.\n\t */\n\tcomponents?: SliceZoneComponents\n\n\t/**\n\t * The Vue component rendered if a component mapping from the `components`\n\t * prop cannot be found.\n\t *\n\t * @remarks\n\t * Components will be rendered using the {@link SliceComponentProps} interface.\n\t *\n\t * @defaultValue The Slice Zone default component provided to `@prismicio/vue` plugin if configured, otherwise `null` when `process.env.NODE_ENV === \"production\"` else {@link TODOSliceComponent}.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>\n\n\t/**\n\t * Arbitrary data made available to all Slice components.\n\t */\n\tcontext?: TContext\n}\n\nconst props = defineProps<SliceZoneProps>()\ndefineOptions({ name: \"SliceZone\" })\n\nconst renderedSlices = computed(() => {\n\tif (!props.slices) return []\n\n\treturn props.slices.map((slice, index) => {\n\t\tconst type =\n\t\t\t\"slice_type\" in slice ? (slice.slice_type as string) : slice.type\n\n\t\tconst key =\n\t\t\t\"id\" in slice && typeof slice.id === \"string\"\n\t\t\t\t? slice.id\n\t\t\t\t: `${index}-${JSON.stringify(slice)}`\n\n\t\tconst is = props.components?.[type] || props.defaultComponent\n\n\t\tif (!is) {\n\t\t\treturn { is: TODOSliceComponent, key, props: { slice } }\n\t\t}\n\n\t\tif (slice.__mapped) {\n\t\t\tconst { __mapped, ...mappedProps } = slice\n\n\t\t\treturn { is, key, props: mappedProps }\n\t\t}\n\n\t\treturn {\n\t\t\tis,\n\t\t\tkey,\n\t\t\tprops: {\n\t\t\t\tslice,\n\t\t\t\tindex,\n\t\t\t\tcontext: props.context,\n\t\t\t\tslices: props.slices,\n\t\t\t},\n\t\t}\n\t})\n})\n</script>\n\n<template>\n\t<component\n\t\tv-for=\"renderedSlice in renderedSlices\"\n\t\t:is=\"renderedSlice.is\"\n\t\t:key=\"renderedSlice.key\"\n\t\tv-bind=\"renderedSlice.props\"\n\t/>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EA8CA,MAAM,QAAQ;EAGd,MAAM,iBAAiB,eAAe;AACrC,OAAI,CAAC,MAAM,OAAQ,QAAO,EAAC;AAE3B,UAAO,MAAM,OAAO,KAAK,OAAO,UAAU;IACzC,MAAM,OACL,gBAAgB,QAAS,MAAM,aAAwB,MAAM;IAE9D,MAAM,MACL,QAAQ,SAAS,OAAO,MAAM,OAAO,WAClC,MAAM,KACN,GAAG,MAAM,GAAG,KAAK,UAAU,MAAM;IAErC,MAAM,KAAK,MAAM,aAAa,SAAS,MAAM;AAE7C,QAAI,CAAC,GACJ,QAAO;KAAE,IAAI;KAAoB;KAAK,OAAO,EAAE,OAAO;KAAC;AAGxD,QAAI,MAAM,UAAU;KACnB,MAAM,EAAE,UAAU,GAAG,gBAAgB;AAErC,YAAO;MAAE;MAAI;MAAK,OAAO;MAAY;;AAGtC,WAAO;KACN;KACA;KACA,OAAO;MACN;MACA;MACA,SAAS,MAAM;MACf,QAAQ,MAAM;MACd;KACF;KACA;IACD;;2BAIA,mBAKE,UAAA,MAAA,WAJuB,eAAA,QAAjB,kBAAa;wBADrB,YAKE,wBAHI,cAAc,GAAE,EAFtB,WAKE,EAFA,KAAK,cAAc,0BACZ,cAAc,MAAK,EAAA,MAAA,GAAA"}
1
+ {"version":3,"file":"SliceZone.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/SliceZone/SliceZone.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed } from \"vue\"\n\nimport type {\n\tSliceComponentType,\n\tSliceLike,\n\tSliceZoneComponents,\n\tSliceZoneLike,\n} from \"./types\"\n\nimport { TODOSliceComponent } from \"./TODOSliceComponent\"\n\n/**\n * Props for `<SliceZone />`.\n *\n * @typeParam TContext - Arbitrary data made available to all Slice components\n */\nexport type SliceZoneProps<TContext = unknown> = {\n\t/** List of slice data from the slice zone. */\n\tslices: SliceZoneLike<SliceLike | (SliceLike & Record<string, unknown>)>\n\n\t/** A record mapping slice types to React components. */\n\tcomponents?: SliceZoneComponents\n\n\t/**\n\t * The Vue component rendered if a component mapping from the `components`\n\t * prop cannot be found.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tdefaultComponent?: SliceComponentType<any, TContext>\n\n\t/** Arbitrary data made available to all slice components. */\n\tcontext?: TContext\n}\n\nconst props = defineProps<SliceZoneProps>()\ndefineOptions({ name: \"SliceZone\" })\n\nconst renderedSlices = computed(() => {\n\tif (!props.slices) return []\n\n\treturn props.slices.map((slice, index) => {\n\t\tconst type =\n\t\t\t\"slice_type\" in slice ? (slice.slice_type as string) : slice.type\n\n\t\tconst key =\n\t\t\t\"id\" in slice && typeof slice.id === \"string\"\n\t\t\t\t? slice.id\n\t\t\t\t: `${index}-${JSON.stringify(slice)}`\n\n\t\tconst is = props.components?.[type] || props.defaultComponent\n\n\t\tif (!is) {\n\t\t\treturn { is: TODOSliceComponent, key, props: { slice } }\n\t\t}\n\n\t\tif (slice.__mapped) {\n\t\t\tconst { __mapped, ...mappedProps } = slice\n\n\t\t\treturn { is, key, props: mappedProps }\n\t\t}\n\n\t\treturn {\n\t\t\tis,\n\t\t\tkey,\n\t\t\tprops: {\n\t\t\t\tslice,\n\t\t\t\tindex,\n\t\t\t\tcontext: props.context,\n\t\t\t\tslices: props.slices,\n\t\t\t},\n\t\t}\n\t})\n})\n</script>\n\n<template>\n\t<component\n\t\tv-for=\"renderedSlice in renderedSlices\"\n\t\t:is=\"renderedSlice.is\"\n\t\t:key=\"renderedSlice.key\"\n\t\tv-bind=\"renderedSlice.props\"\n\t/>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCA,MAAM,QAAQ;EAGd,MAAM,iBAAiB,eAAe;AACrC,OAAI,CAAC,MAAM,OAAQ,QAAO,EAAC;AAE3B,UAAO,MAAM,OAAO,KAAK,OAAO,UAAU;IACzC,MAAM,OACL,gBAAgB,QAAS,MAAM,aAAwB,MAAM;IAE9D,MAAM,MACL,QAAQ,SAAS,OAAO,MAAM,OAAO,WAClC,MAAM,KACN,GAAG,MAAM,GAAG,KAAK,UAAU,MAAM;IAErC,MAAM,KAAK,MAAM,aAAa,SAAS,MAAM;AAE7C,QAAI,CAAC,GACJ,QAAO;KAAE,IAAI;KAAoB;KAAK,OAAO,EAAE,OAAO;KAAC;AAGxD,QAAI,MAAM,UAAU;KACnB,MAAM,EAAE,UAAU,GAAG,gBAAgB;AAErC,YAAO;MAAE;MAAI;MAAK,OAAO;MAAY;;AAGtC,WAAO;KACN;KACA;KACA,OAAO;MACN;MACA;MACA,SAAS,MAAM;MACf,QAAQ,MAAM;MACd;KACF;KACA;IACD;;2BAIA,mBAKE,UAAA,MAAA,WAJuB,eAAA,QAAjB,kBAAa;wBADrB,YAKE,wBAHI,cAAc,GAAE,EAFtB,WAKE,EAFA,KAAK,cAAc,0BACZ,cAAc,MAAK,EAAA,MAAA,GAAA"}
@@ -62,17 +62,11 @@ type SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[];
62
62
  * available to all Slice components
63
63
  */
64
64
  type SliceComponentProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
65
- /**
66
- * Slice data for this component.
67
- */
65
+ /** Slice data for this component. */
68
66
  slice: TSlice;
69
- /**
70
- * The index of the Slice in the Slice Zone.
71
- */
67
+ /** The index of the Slice in the Slice Zone. */
72
68
  index: number;
73
- /**
74
- * All Slices from the Slice Zone to which the Slice belongs.
75
- */
69
+ /** All Slices from the Slice Zone to which the Slice belongs. */
76
70
  slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>;
77
71
  /**
78
72
  * Arbitrary data passed to `<SliceZone />` and made available to all Slice
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/SliceZone/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAKY;;;KAOP,gBAA4D,CAAA,eAA5B,SAA4B,CAAA,GAAf,MAAe,SAAA,eAAA,GAC9D,MAD8D,CAAA,YAAA,CAAA,GAE9D,MAF8D,SAE/C,gBAF+C,GAG7D,MAH6D,CAAA,MAAA,CAAA,GAAA,KAAA;;;;;;AAYjE;AACO,KADK,eACL,CAAA,mBAAA,MAAA,GAAA,MAAA,CAAA,GAD2D,IAC3D,CAAN,KAAM,CAAA,UAAA,CAAA,EAAA,IAAA,GAAA,YAAA,CAAA;;;;AAUP;AAaA;;AACG,KAdS,gBAcT,CAAA,mBAAA,MAAA,GAAA,MAAA,CAAA,GAAA;EACiB,IAAA,EAdb,KAca,CAdP,UAcO,CAAA,CAAA,YAAA,CAAA;CAAjB;;AAoBH;;;;;AAWA;;;AAOQ,KAxCI,SAwCJ,CAAA,mBAAA,MAAA,GAAA,MAAA,CAAA,GAAA,CAvCL,eAuCK,CAvCW,UAuCX,CAAA,GAtCL,gBAsCK,CAtCY,UAsCZ,CAAA,CAAA,GAAA;EAeN;;;;;;EAOgB,QAAA,CAAA,EAAA,IAAA;AASlB,CAAA;;;;;;;;;;AAWsB,KA5DV,aA4DU,CAAA,eA5DmB,SA4DnB,GA5D+B,SA4D/B,CAAA,GAAA,SA3DZ,MA2DY,EAAA;AAStB;;;;;;;;AAgBK,KA1EO,mBA0EP,CAAA,eAzEW,SAyEX,GAzEuB,SAyEvB,EAAA,WAAA,OAAA,CAAA,GAAA;EACG;;;EACgB,KAAA,EArEhB,MAqEgB;EAAhB;;;EAHe,KAAA,EAAA,MAAA;;;;UApDd,cACP,eAAe,mBAAmB,mBAAmB;;;;;WAO7C;;;;;;;;KASE,kCAEI,uCAKb,+BAEA,kBAAkB,wBAClB,gBAAgB,oBAAoB,QAAQ,aAC5C;;;;;;;;KASS,mCACI,YAAY,iDAaZ,iBAAiB,UAC5B,mBACA,QAAQ,QAAQ,UAAU,4BACvB,YACA,QAAQ,QAAQ,UAAU,aAC7B"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/SliceZone/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAKY;;;KAOP,gBAA4D,CAAA,eAA5B,SAA4B,CAAA,GAAf,MAAe,SAAA,eAAA,GAC9D,MAD8D,CAAA,YAAA,CAAA,GAE9D,MAF8D,SAE/C,gBAF+C,GAG7D,MAH6D,CAAA,MAAA,CAAA,GAAA,KAAA;;;;;;AAYjE;AACO,KADK,eACL,CAAA,mBAAA,MAAA,GAAA,MAAA,CAAA,GAD2D,IAC3D,CAAN,KAAM,CAAA,UAAA,CAAA,EAAA,IAAA,GAAA,YAAA,CAAA;;;;AAUP;AAaA;;AACG,KAdS,gBAcT,CAAA,mBAAA,MAAA,GAAA,MAAA,CAAA,GAAA;EACiB,IAAA,EAdb,KAca,CAdP,UAcO,CAAA,CAAA,YAAA,CAAA;CAAjB;;AAoBH;;;;;AAWA;;;AAKQ,KAtCI,SAsCJ,CAAA,mBAAA,MAAA,GAAA,MAAA,CAAA,GAAA,CArCL,eAqCK,CArCW,UAqCX,CAAA,GApCL,gBAoCK,CApCY,UAoCZ,CAAA,CAAA,GAAA;EAWN;;;;;;EAOgB,QAAA,CAAA,EAAA,IAAA;AASlB,CAAA;;;;;;;;;;AAWsB,KAtDV,aAsDU,CAAA,eAtDmB,SAsDnB,GAtD+B,SAsD/B,CAAA,GAAA,SArDZ,MAqDY,EAAA;AAStB;;;;;;;;AAgBK,KApEO,mBAoEP,CAAA,eAnEW,SAmEX,GAnEuB,SAmEvB,EAAA,WAAA,OAAA,CAAA,GAAA;EACG;EACQ,KAAA,EAjER,MAiEQ;EAAkB;EAAV,KAAA,EAAA,MAAA;EAAhB;EACH,MAAA,EAxDI,aAwDJ,CAvDH,MAuDG,SAvDY,gBAuDZ,GAvD+B,gBAuD/B,GAvDkD,eAuDlD,CAAA;EAJA;;;;WA5CK;;;;;;;;KASE,kCAEI,uCAKb,+BAEA,kBAAkB,wBAClB,gBAAgB,oBAAoB,QAAQ,aAC5C;;;;;;;;KASS,mCACI,YAAY,iDAaZ,iBAAiB,UAC5B,mBACA,QAAQ,QAAQ,UAAU,4BACvB,YACA,QAAQ,QAAQ,UAAU,aAC7B"}
@@ -0,0 +1,33 @@
1
+ let vue = require("vue");
2
+ let __prismicio_client = require("@prismicio/client");
3
+
4
+ //#region src/createPrismic.ts
5
+ const prismicKey = Symbol.for("@prismicio/vue/plugin");
6
+ /** Creates a Prismic Vue plugin instance that can be used by a Vue app. */
7
+ const createPrismic = (config) => {
8
+ return {
9
+ ...config,
10
+ isFilled: __prismicio_client.isFilled,
11
+ install(app) {
12
+ app.provide(prismicKey, this);
13
+ app.config.globalProperties.$prismic = this;
14
+ }
15
+ };
16
+ };
17
+ /**
18
+ * Access the Prismic Vue plugin interface.
19
+ *
20
+ * @example
21
+ *
22
+ * ```typescript
23
+ * const { client, isFilled } = usePrismic()
24
+ * ```
25
+ */
26
+ const usePrismic = () => {
27
+ return (0, vue.inject)(prismicKey, { componentsConfig: {} });
28
+ };
29
+
30
+ //#endregion
31
+ exports.createPrismic = createPrismic;
32
+ exports.usePrismic = usePrismic;
33
+ //# sourceMappingURL=createPrismic.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPrismic.cjs","names":[],"sources":["../../src/createPrismic.ts"],"sourcesContent":["import type { CreateClient } from \"@prismicio/client\"\nimport { isFilled } from \"@prismicio/client\"\nimport { type App, type InjectionKey, inject } from \"vue\"\n\nimport type { ComponentOrTagName } from \"./types\"\n\nimport type { VueRichTextComponents } from \"./PrismicRichText\"\nimport type { VueTableComponents } from \"./PrismicTable\"\n\nconst prismicKey = Symbol.for(\n\t\"@prismicio/vue/plugin\",\n) as InjectionKey<PrismicPlugin>\n\n/** Components configuration. */\ntype ComponentsConfig = {\n\t/** The default component rendered for internal URLs. */\n\tlinkInternalComponent?: ComponentOrTagName\n\n\t/** The default component rendered for external URLs. */\n\tlinkExternalComponent?: ComponentOrTagName\n\n\t/**\n\t * The default components or shorthand definitions for Rich Text and Table\n\t * fields.\n\t */\n\tdefaultComponents?: VueRichTextComponents & VueTableComponents\n}\n\n/**\n * Prismic Vue plugin interface accessible through `usePrismic()` and\n * `$prismic`.\n */\nexport type PrismicPlugin = {\n\t/** A Prismic client that can be used to query content from a repository. */\n\tclient: ReturnType<CreateClient>\n\n\t/** Helpers to determine if a field is filled. */\n\tisFilled: typeof isFilled\n\n\t/** @internal */\n\treadonly componentsConfig?: ComponentsConfig\n\n\t/** @internal */\n\tinstall: (app: App) => void\n}\n\n/** Prismic Vue plugin configuration. */\nexport type PrismicPluginConfig = {\n\t/** A Prismic client instance to inject into the Vue app. */\n\tclient: ReturnType<CreateClient>\n\n\t/** Components configuration. */\n\tcomponentsConfig?: ComponentsConfig\n}\n\n/** Creates a Prismic Vue plugin instance that can be used by a Vue app. */\nexport const createPrismic = (config: PrismicPluginConfig): PrismicPlugin => {\n\treturn {\n\t\t...config,\n\t\tisFilled,\n\t\tinstall(app: App): void {\n\t\t\tapp.provide(prismicKey, this)\n\t\t\tapp.config.globalProperties.$prismic = this\n\t\t},\n\t}\n}\n\n/**\n * Access the Prismic Vue plugin interface.\n *\n * @example\n *\n * ```typescript\n * const { client, isFilled } = usePrismic()\n * ```\n */\nexport const usePrismic = (): PrismicPlugin => {\n\treturn inject(prismicKey, { componentsConfig: {} } as PrismicPlugin)\n}\n\ndeclare module \"vue\" {\n\texport interface ComponentCustomProperties {\n\t\t/** The Prismic Vue plugin interface. */\n\t\t$prismic: PrismicPlugin\n\t}\n}\n"],"mappings":";;;;AASA,MAAM,aAAa,OAAO,IACzB,wBACA;;AA6CD,MAAa,iBAAiB,WAA+C;AAC5E,QAAO;EACN,GAAG;EACH;EACA,QAAQ,KAAgB;AACvB,OAAI,QAAQ,YAAY,KAAK;AAC7B,OAAI,OAAO,iBAAiB,WAAW;;EAExC;;;;;;;;;;;AAYF,MAAa,mBAAkC;AAC9C,wBAAc,YAAY,EAAE,kBAAkB,EAAE,EAAE,CAAkB"}
@@ -0,0 +1,63 @@
1
+ import { ComponentOrTagName } from "./types.js";
2
+ import { VueRichTextComponents } from "./PrismicRichText/types.js";
3
+ import "./PrismicRichText/index.js";
4
+ import { VueTableComponents } from "./PrismicTable/types.js";
5
+ import "./PrismicTable/index.js";
6
+ import { App } from "vue";
7
+ import { CreateClient, isFilled } from "@prismicio/client";
8
+
9
+ //#region src/createPrismic.d.ts
10
+ /** Components configuration. */
11
+ type ComponentsConfig = {
12
+ /** The default component rendered for internal URLs. */
13
+ linkInternalComponent?: ComponentOrTagName;
14
+ /** The default component rendered for external URLs. */
15
+ linkExternalComponent?: ComponentOrTagName;
16
+ /**
17
+ * The default components or shorthand definitions for Rich Text and Table
18
+ * fields.
19
+ */
20
+ defaultComponents?: VueRichTextComponents & VueTableComponents;
21
+ };
22
+ /**
23
+ * Prismic Vue plugin interface accessible through `usePrismic()` and
24
+ * `$prismic`.
25
+ */
26
+ type PrismicPlugin = {
27
+ /** A Prismic client that can be used to query content from a repository. */
28
+ client: ReturnType<CreateClient>;
29
+ /** Helpers to determine if a field is filled. */
30
+ isFilled: typeof isFilled;
31
+ /** @internal */
32
+ readonly componentsConfig?: ComponentsConfig;
33
+ /** @internal */
34
+ install: (app: App) => void;
35
+ };
36
+ /** Prismic Vue plugin configuration. */
37
+ type PrismicPluginConfig = {
38
+ /** A Prismic client instance to inject into the Vue app. */
39
+ client: ReturnType<CreateClient>;
40
+ /** Components configuration. */
41
+ componentsConfig?: ComponentsConfig;
42
+ };
43
+ /** Creates a Prismic Vue plugin instance that can be used by a Vue app. */
44
+ declare const createPrismic: (config: PrismicPluginConfig) => PrismicPlugin;
45
+ /**
46
+ * Access the Prismic Vue plugin interface.
47
+ *
48
+ * @example
49
+ *
50
+ * ```typescript
51
+ * const { client, isFilled } = usePrismic()
52
+ * ```
53
+ */
54
+ declare const usePrismic: () => PrismicPlugin;
55
+ declare module "vue" {
56
+ interface ComponentCustomProperties {
57
+ /** The Prismic Vue plugin interface. */
58
+ $prismic: PrismicPlugin;
59
+ }
60
+ }
61
+ //#endregion
62
+ export { PrismicPlugin, PrismicPluginConfig, createPrismic, usePrismic };
63
+ //# sourceMappingURL=createPrismic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPrismic.d.ts","names":[],"sources":["../../src/createPrismic.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;KAcK,gBAAA;;EAAA,qBAAgB,CAAA,EAEI,kBAFJ;EAEI;EAGA,qBAAA,CAAA,EAAA,kBAAA;EAMJ;;;AAOrB;EAEoB,iBAAA,CAAA,EATC,qBASD,GATyB,kBASzB;CAAX;;;;;AAaG,KAfA,aAAA,GAemB;EAEX;EAAX,MAAA,EAfA,UAeA,CAfW,YAeX,CAAA;EAGW;EAAgB,QAAA,EAAA,OAflB,QAekB;EAIvB;EAoBA,SAAA,gBAAiB,CAAA,EApCD,gBAsC5B;EAAA;EAAA,OAAA,EAAA,CAAA,GAAA,EAnCe,GAmCf,EAAA,GAAA,IAAA;;;AAKwB,KApCb,mBAAA,GAoCa;;UAlChB,WAAW;;qBAGA;;;cAIP,wBAAyB,wBAAsB;;;;;;;;;;cAoB/C,kBAAiB;;;;cAOlB"}
@@ -0,0 +1,32 @@
1
+ import { inject } from "vue";
2
+ import { isFilled } from "@prismicio/client";
3
+
4
+ //#region src/createPrismic.ts
5
+ const prismicKey = Symbol.for("@prismicio/vue/plugin");
6
+ /** Creates a Prismic Vue plugin instance that can be used by a Vue app. */
7
+ const createPrismic = (config) => {
8
+ return {
9
+ ...config,
10
+ isFilled,
11
+ install(app) {
12
+ app.provide(prismicKey, this);
13
+ app.config.globalProperties.$prismic = this;
14
+ }
15
+ };
16
+ };
17
+ /**
18
+ * Access the Prismic Vue plugin interface.
19
+ *
20
+ * @example
21
+ *
22
+ * ```typescript
23
+ * const { client, isFilled } = usePrismic()
24
+ * ```
25
+ */
26
+ const usePrismic = () => {
27
+ return inject(prismicKey, { componentsConfig: {} });
28
+ };
29
+
30
+ //#endregion
31
+ export { createPrismic, usePrismic };
32
+ //# sourceMappingURL=createPrismic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPrismic.js","names":[],"sources":["../../src/createPrismic.ts"],"sourcesContent":["import type { CreateClient } from \"@prismicio/client\"\nimport { isFilled } from \"@prismicio/client\"\nimport { type App, type InjectionKey, inject } from \"vue\"\n\nimport type { ComponentOrTagName } from \"./types\"\n\nimport type { VueRichTextComponents } from \"./PrismicRichText\"\nimport type { VueTableComponents } from \"./PrismicTable\"\n\nconst prismicKey = Symbol.for(\n\t\"@prismicio/vue/plugin\",\n) as InjectionKey<PrismicPlugin>\n\n/** Components configuration. */\ntype ComponentsConfig = {\n\t/** The default component rendered for internal URLs. */\n\tlinkInternalComponent?: ComponentOrTagName\n\n\t/** The default component rendered for external URLs. */\n\tlinkExternalComponent?: ComponentOrTagName\n\n\t/**\n\t * The default components or shorthand definitions for Rich Text and Table\n\t * fields.\n\t */\n\tdefaultComponents?: VueRichTextComponents & VueTableComponents\n}\n\n/**\n * Prismic Vue plugin interface accessible through `usePrismic()` and\n * `$prismic`.\n */\nexport type PrismicPlugin = {\n\t/** A Prismic client that can be used to query content from a repository. */\n\tclient: ReturnType<CreateClient>\n\n\t/** Helpers to determine if a field is filled. */\n\tisFilled: typeof isFilled\n\n\t/** @internal */\n\treadonly componentsConfig?: ComponentsConfig\n\n\t/** @internal */\n\tinstall: (app: App) => void\n}\n\n/** Prismic Vue plugin configuration. */\nexport type PrismicPluginConfig = {\n\t/** A Prismic client instance to inject into the Vue app. */\n\tclient: ReturnType<CreateClient>\n\n\t/** Components configuration. */\n\tcomponentsConfig?: ComponentsConfig\n}\n\n/** Creates a Prismic Vue plugin instance that can be used by a Vue app. */\nexport const createPrismic = (config: PrismicPluginConfig): PrismicPlugin => {\n\treturn {\n\t\t...config,\n\t\tisFilled,\n\t\tinstall(app: App): void {\n\t\t\tapp.provide(prismicKey, this)\n\t\t\tapp.config.globalProperties.$prismic = this\n\t\t},\n\t}\n}\n\n/**\n * Access the Prismic Vue plugin interface.\n *\n * @example\n *\n * ```typescript\n * const { client, isFilled } = usePrismic()\n * ```\n */\nexport const usePrismic = (): PrismicPlugin => {\n\treturn inject(prismicKey, { componentsConfig: {} } as PrismicPlugin)\n}\n\ndeclare module \"vue\" {\n\texport interface ComponentCustomProperties {\n\t\t/** The Prismic Vue plugin interface. */\n\t\t$prismic: PrismicPlugin\n\t}\n}\n"],"mappings":";;;;AASA,MAAM,aAAa,OAAO,IACzB,wBACA;;AA6CD,MAAa,iBAAiB,WAA+C;AAC5E,QAAO;EACN,GAAG;EACH;EACA,QAAQ,KAAgB;AACvB,OAAI,QAAQ,YAAY,KAAK;AAC7B,OAAI,OAAO,iBAAiB,WAAW;;EAExC;;;;;;;;;;;AAYF,MAAa,mBAAkC;AAC9C,QAAO,OAAO,YAAY,EAAE,kBAAkB,EAAE,EAAE,CAAkB"}
@@ -8,13 +8,9 @@
8
8
  * @returns `true` if `url` is internal, `false` otherwise
9
9
  */
10
10
  const isInternalURL = (url) => {
11
- /**
12
- * @see Regex101 expression: {@link https://regex101.com/r/1y7iod/1}
13
- */
11
+ /** @see Regex101 expression: {@link https://regex101.com/r/1y7iod/1} */
14
12
  const isInternal = /^\/(?!\/)/.test(url);
15
- /**
16
- * @see Regex101 expression: {@link https://regex101.com/r/RnUseS/1}
17
- */
13
+ /** @see Regex101 expression: {@link https://regex101.com/r/RnUseS/1} */
18
14
  const isSpecialLink = !isInternal && !/^https?:\/\//i.test(url);
19
15
  return isInternal && !isSpecialLink;
20
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"isInternalURL.cjs","names":[],"sources":["../../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external\n *\n * @returns `true` if `url` is internal, `false` otherwise\n */\n// TODO: This does not detect all relative URLs as internal, such as `about` or `./about`. This function assumes relative URLs start with a \"/\"`.\nexport const isInternalURL = (url: string): boolean => {\n\t/**\n\t * @see Regex101 expression: {@link https://regex101.com/r/1y7iod/1}\n\t */\n\tconst isInternal = /^\\/(?!\\/)/.test(url)\n\t/**\n\t * @see Regex101 expression: {@link https://regex101.com/r/RnUseS/1}\n\t */\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//i.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,iBAAiB,QAAyB;;;;CAItD,MAAM,aAAa,YAAY,KAAK,IAAI;;;;CAIxC,MAAM,gBAAgB,CAAC,cAAc,CAAC,gBAAgB,KAAK,IAAI;AAE/D,QAAO,cAAc,CAAC"}
1
+ {"version":3,"file":"isInternalURL.cjs","names":[],"sources":["../../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external\n *\n * @returns `true` if `url` is internal, `false` otherwise\n */\n// TODO: This does not detect all relative URLs as internal, such as `about` or `./about`. This function assumes relative URLs start with a \"/\"`.\nexport const isInternalURL = (url: string): boolean => {\n\t/** @see Regex101 expression: {@link https://regex101.com/r/1y7iod/1} */\n\tconst isInternal = /^\\/(?!\\/)/.test(url)\n\t/** @see Regex101 expression: {@link https://regex101.com/r/RnUseS/1} */\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//i.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,iBAAiB,QAAyB;;CAEtD,MAAM,aAAa,YAAY,KAAK,IAAI;;CAExC,MAAM,gBAAgB,CAAC,cAAc,CAAC,gBAAgB,KAAK,IAAI;AAE/D,QAAO,cAAc,CAAC"}
@@ -7,13 +7,9 @@
7
7
  * @returns `true` if `url` is internal, `false` otherwise
8
8
  */
9
9
  const isInternalURL = (url) => {
10
- /**
11
- * @see Regex101 expression: {@link https://regex101.com/r/1y7iod/1}
12
- */
10
+ /** @see Regex101 expression: {@link https://regex101.com/r/1y7iod/1} */
13
11
  const isInternal = /^\/(?!\/)/.test(url);
14
- /**
15
- * @see Regex101 expression: {@link https://regex101.com/r/RnUseS/1}
16
- */
12
+ /** @see Regex101 expression: {@link https://regex101.com/r/RnUseS/1} */
17
13
  const isSpecialLink = !isInternal && !/^https?:\/\//i.test(url);
18
14
  return isInternal && !isSpecialLink;
19
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"isInternalURL.js","names":[],"sources":["../../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external\n *\n * @returns `true` if `url` is internal, `false` otherwise\n */\n// TODO: This does not detect all relative URLs as internal, such as `about` or `./about`. This function assumes relative URLs start with a \"/\"`.\nexport const isInternalURL = (url: string): boolean => {\n\t/**\n\t * @see Regex101 expression: {@link https://regex101.com/r/1y7iod/1}\n\t */\n\tconst isInternal = /^\\/(?!\\/)/.test(url)\n\t/**\n\t * @see Regex101 expression: {@link https://regex101.com/r/RnUseS/1}\n\t */\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//i.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,iBAAiB,QAAyB;;;;CAItD,MAAM,aAAa,YAAY,KAAK,IAAI;;;;CAIxC,MAAM,gBAAgB,CAAC,cAAc,CAAC,gBAAgB,KAAK,IAAI;AAE/D,QAAO,cAAc,CAAC"}
1
+ {"version":3,"file":"isInternalURL.js","names":[],"sources":["../../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external\n *\n * @returns `true` if `url` is internal, `false` otherwise\n */\n// TODO: This does not detect all relative URLs as internal, such as `about` or `./about`. This function assumes relative URLs start with a \"/\"`.\nexport const isInternalURL = (url: string): boolean => {\n\t/** @see Regex101 expression: {@link https://regex101.com/r/1y7iod/1} */\n\tconst isInternal = /^\\/(?!\\/)/.test(url)\n\t/** @see Regex101 expression: {@link https://regex101.com/r/RnUseS/1} */\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//i.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,iBAAiB,QAAyB;;CAEtD,MAAM,aAAa,YAAY,KAAK,IAAI;;CAExC,MAAM,gBAAgB,CAAC,cAAc,CAAC,gBAAgB,KAAK,IAAI;AAE/D,QAAO,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {\n\tConcreteComponent,\n\tDefineComponent,\n\tFunctionalComponent,\n\tRaw,\n\tdefineAsyncComponent,\n} from \"vue\"\n\nexport type ComponentOrTagName =\n\t| string\n\t| ConcreteComponent\n\t| Raw<DefineComponent>\n\nexport type VueComponent<TProps> =\n\t// For reference within TypeScript files when `*.vue` type cannot be inferred\n\t// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-explicit-any\n\t| DefineComponent<{}, {}, any>\n\t// Likewise, for reference with TypeScript files.\n\t| ReturnType<typeof defineAsyncComponent>\n\t| DefineComponent<TProps>\n\t| FunctionalComponent<TProps>\n\nexport const isVueComponent = <T>(\n\tcomponent: VueComponent<T> | unknown,\n): component is VueComponent<T> => {\n\treturn (\n\t\t!!component &&\n\t\t(typeof component === \"function\" ||\n\t\t\t(typeof component === \"object\" &&\n\t\t\t\t((\"render\" in component && typeof component.render === \"function\") ||\n\t\t\t\t\t(\"setup\" in component && typeof component.setup === \"function\") ||\n\t\t\t\t\t(\"__file\" in component && !!component.__file) ||\n\t\t\t\t\t(\"__name\" in component && !!component.__name) ||\n\t\t\t\t\t(\"props\" in component && typeof component.props === \"object\"))))\n\t)\n}\n"],"mappings":";;AAsBA,MAAa,kBACZ,cACkC;AAClC,QACC,CAAC,CAAC,cACD,OAAO,cAAc,cACpB,OAAO,cAAc,aACnB,YAAY,aAAa,OAAO,UAAU,WAAW,cACrD,WAAW,aAAa,OAAO,UAAU,UAAU,cACnD,YAAY,aAAa,CAAC,CAAC,UAAU,UACrC,YAAY,aAAa,CAAC,CAAC,UAAU,UACrC,WAAW,aAAa,OAAO,UAAU,UAAU"}
1
+ {"version":3,"file":"types.cjs","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {\n\tConcreteComponent,\n\tDefineComponent,\n\tFunctionalComponent,\n\tRaw,\n\tdefineAsyncComponent,\n} from \"vue\"\n\nexport type ComponentOrTagName =\n\t| string\n\t| ConcreteComponent\n\t| Raw<DefineComponent>\n\nexport type VueComponent<TProps> =\n\t// For reference within TypeScript files when `*.vue` type cannot be inferred\n\t// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-explicit-any\n\t| DefineComponent<{}, {}, any>\n\t// Likewise, for reference with TypeScript files.\n\t| ReturnType<typeof defineAsyncComponent>\n\t| DefineComponent<TProps>\n\t| FunctionalComponent<TProps>\n\n/**\n * A shorthand definition for `<PrismicRichText />` and `<PrismicTable />`\n * component types.\n */\nexport type VueComponentShorthand = {\n\t/** The HTML element type rendered for this node type. */\n\tas?: string\n\n\t/** Other attributes to apply to the element type. */\n\t[Attribute: string]: string | boolean | null | undefined\n}\n\nexport const isVueComponent = <T>(\n\tcomponent: VueComponent<T> | VueComponentShorthand | undefined,\n): component is VueComponent<T> => {\n\treturn (\n\t\t!!component &&\n\t\t(typeof component === \"function\" ||\n\t\t\t(typeof component === \"object\" &&\n\t\t\t\t((\"render\" in component && typeof component.render === \"function\") ||\n\t\t\t\t\t(\"setup\" in component && typeof component.setup === \"function\") ||\n\t\t\t\t\t(\"__file\" in component && !!component.__file) ||\n\t\t\t\t\t(\"__name\" in component && !!component.__name) ||\n\t\t\t\t\t(\"props\" in component && typeof component.props === \"object\"))))\n\t)\n}\n"],"mappings":";;AAkCA,MAAa,kBACZ,cACkC;AAClC,QACC,CAAC,CAAC,cACD,OAAO,cAAc,cACpB,OAAO,cAAc,aACnB,YAAY,aAAa,OAAO,UAAU,WAAW,cACrD,WAAW,aAAa,OAAO,UAAU,UAAU,cACnD,YAAY,aAAa,CAAC,CAAC,UAAU,UACrC,YAAY,aAAa,CAAC,CAAC,UAAU,UACrC,WAAW,aAAa,OAAO,UAAU,UAAU"}
@@ -3,6 +3,16 @@ import { ConcreteComponent, DefineComponent, FunctionalComponent, Raw, defineAsy
3
3
  //#region src/types.d.ts
4
4
  type ComponentOrTagName = string | ConcreteComponent | Raw<DefineComponent>;
5
5
  type VueComponent<TProps> = DefineComponent<{}, {}, any> | ReturnType<typeof defineAsyncComponent> | DefineComponent<TProps> | FunctionalComponent<TProps>;
6
+ /**
7
+ * A shorthand definition for `<PrismicRichText />` and `<PrismicTable />`
8
+ * component types.
9
+ */
10
+ type VueComponentShorthand = {
11
+ /** The HTML element type rendered for this node type. */
12
+ as?: string;
13
+ /** Other attributes to apply to the element type. */
14
+ [Attribute: string]: string | boolean | null | undefined;
15
+ };
6
16
  //#endregion
7
- export { ComponentOrTagName, VueComponent };
17
+ export { ComponentOrTagName, VueComponent, VueComponentShorthand };
8
18
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"sourcesContent":[],"mappings":";;;KAQY,kBAAA,YAET,oBACA,IAAI;KAEK,uBAGT,+BAEA,kBAAkB,wBAClB,gBAAgB,UAChB,oBAAoB"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"sourcesContent":[],"mappings":";;;KAQY,kBAAA,YAET,oBACA,IAAI;KAEK,uBAGT,+BAEA,kBAAkB,wBAClB,gBAAgB,UAChB,oBAAoB;AAZvB;;;;AAGM,KAeM,qBAAA,GAfN;EAEM;EAGT,EAAA,CAAA,EAAA,MAAA;EAEkB;EAAlB,CAAA,SAAA,EAAA,MAAA,CAAA,EAAA,MAAA,GAAA,OAAA,GAAA,IAAA,GAAA,SAAA;CACgB"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {\n\tConcreteComponent,\n\tDefineComponent,\n\tFunctionalComponent,\n\tRaw,\n\tdefineAsyncComponent,\n} from \"vue\"\n\nexport type ComponentOrTagName =\n\t| string\n\t| ConcreteComponent\n\t| Raw<DefineComponent>\n\nexport type VueComponent<TProps> =\n\t// For reference within TypeScript files when `*.vue` type cannot be inferred\n\t// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-explicit-any\n\t| DefineComponent<{}, {}, any>\n\t// Likewise, for reference with TypeScript files.\n\t| ReturnType<typeof defineAsyncComponent>\n\t| DefineComponent<TProps>\n\t| FunctionalComponent<TProps>\n\nexport const isVueComponent = <T>(\n\tcomponent: VueComponent<T> | unknown,\n): component is VueComponent<T> => {\n\treturn (\n\t\t!!component &&\n\t\t(typeof component === \"function\" ||\n\t\t\t(typeof component === \"object\" &&\n\t\t\t\t((\"render\" in component && typeof component.render === \"function\") ||\n\t\t\t\t\t(\"setup\" in component && typeof component.setup === \"function\") ||\n\t\t\t\t\t(\"__file\" in component && !!component.__file) ||\n\t\t\t\t\t(\"__name\" in component && !!component.__name) ||\n\t\t\t\t\t(\"props\" in component && typeof component.props === \"object\"))))\n\t)\n}\n"],"mappings":";AAsBA,MAAa,kBACZ,cACkC;AAClC,QACC,CAAC,CAAC,cACD,OAAO,cAAc,cACpB,OAAO,cAAc,aACnB,YAAY,aAAa,OAAO,UAAU,WAAW,cACrD,WAAW,aAAa,OAAO,UAAU,UAAU,cACnD,YAAY,aAAa,CAAC,CAAC,UAAU,UACrC,YAAY,aAAa,CAAC,CAAC,UAAU,UACrC,WAAW,aAAa,OAAO,UAAU,UAAU"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["import type {\n\tConcreteComponent,\n\tDefineComponent,\n\tFunctionalComponent,\n\tRaw,\n\tdefineAsyncComponent,\n} from \"vue\"\n\nexport type ComponentOrTagName =\n\t| string\n\t| ConcreteComponent\n\t| Raw<DefineComponent>\n\nexport type VueComponent<TProps> =\n\t// For reference within TypeScript files when `*.vue` type cannot be inferred\n\t// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-explicit-any\n\t| DefineComponent<{}, {}, any>\n\t// Likewise, for reference with TypeScript files.\n\t| ReturnType<typeof defineAsyncComponent>\n\t| DefineComponent<TProps>\n\t| FunctionalComponent<TProps>\n\n/**\n * A shorthand definition for `<PrismicRichText />` and `<PrismicTable />`\n * component types.\n */\nexport type VueComponentShorthand = {\n\t/** The HTML element type rendered for this node type. */\n\tas?: string\n\n\t/** Other attributes to apply to the element type. */\n\t[Attribute: string]: string | boolean | null | undefined\n}\n\nexport const isVueComponent = <T>(\n\tcomponent: VueComponent<T> | VueComponentShorthand | undefined,\n): component is VueComponent<T> => {\n\treturn (\n\t\t!!component &&\n\t\t(typeof component === \"function\" ||\n\t\t\t(typeof component === \"object\" &&\n\t\t\t\t((\"render\" in component && typeof component.render === \"function\") ||\n\t\t\t\t\t(\"setup\" in component && typeof component.setup === \"function\") ||\n\t\t\t\t\t(\"__file\" in component && !!component.__file) ||\n\t\t\t\t\t(\"__name\" in component && !!component.__name) ||\n\t\t\t\t\t(\"props\" in component && typeof component.props === \"object\"))))\n\t)\n}\n"],"mappings":";AAkCA,MAAa,kBACZ,cACkC;AAClC,QACC,CAAC,CAAC,cACD,OAAO,cAAc,cACpB,OAAO,cAAc,aACnB,YAAY,aAAa,OAAO,UAAU,WAAW,cACrD,WAAW,aAAa,OAAO,UAAU,UAAU,cACnD,YAAY,aAAa,CAAC,CAAC,UAAU,UACrC,YAAY,aAAa,CAAC,CAAC,UAAU,UACrC,WAAW,aAAa,OAAO,UAAU,UAAU"}
package/dist/types.d.cts CHANGED
@@ -3,6 +3,16 @@ import { ConcreteComponent, DefineComponent, FunctionalComponent, Raw, defineAsy
3
3
  //#region src/types.d.ts
4
4
  type ComponentOrTagName = string | ConcreteComponent | Raw<DefineComponent>;
5
5
  type VueComponent<TProps> = DefineComponent<{}, {}, any> | ReturnType<typeof defineAsyncComponent> | DefineComponent<TProps> | FunctionalComponent<TProps>;
6
+ /**
7
+ * A shorthand definition for `<PrismicRichText />` and `<PrismicTable />`
8
+ * component types.
9
+ */
10
+ type VueComponentShorthand = {
11
+ /** The HTML element type rendered for this node type. */
12
+ as?: string;
13
+ /** Other attributes to apply to the element type. */
14
+ [Attribute: string]: string | boolean | null | undefined;
15
+ };
6
16
  //#endregion
7
- export { ComponentOrTagName, VueComponent };
17
+ export { ComponentOrTagName, VueComponent, VueComponentShorthand };
8
18
  //# sourceMappingURL=types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAQY,kBAAA,YAET,oBACA,IAAI;KAEK,uBAGT,+BAEA,kBAAkB,wBAClB,gBAAgB,UAChB,oBAAoB"}
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAQY,kBAAA,YAET,oBACA,IAAI;KAEK,uBAGT,+BAEA,kBAAkB,wBAClB,gBAAgB,UAChB,oBAAoB;AAZvB;;;;AAGM,KAeM,qBAAA,GAfN;EAEM;EAGT,EAAA,CAAA,EAAA,MAAA;EAEkB;EAAlB,CAAA,SAAA,EAAA,MAAA,CAAA,EAAA,MAAA,GAAA,OAAA,GAAA,IAAA,GAAA,SAAA;CACgB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/vue",
3
- "version": "5.3.0-pr.88.ee9acb6",
3
+ "version": "5.3.0-pr.89.d0f4ac2",
4
4
  "description": "Vue plugin, components, and composables to fetch and present Prismic content",
5
5
  "keywords": [
6
6
  "typescript",
@@ -34,8 +34,6 @@
34
34
  "build": "tsdown",
35
35
  "dev": "tsdown --watch",
36
36
  "format": "prettier --write .",
37
- "playground:build": "vite build playground",
38
- "playground:dev": "vite playground",
39
37
  "prepare": "npm run build",
40
38
  "lint": "oxlint --deny-warnings",
41
39
  "types": "vue-tsc --noEmit",
@@ -10,13 +10,9 @@ import { computed, watchEffect } from "vue"
10
10
 
11
11
  import { devMsg } from "./lib/devMsg"
12
12
 
13
- /**
14
- * Props for `<PrismicImage />`.
15
- */
13
+ /** Props for `<PrismicImage />`. */
16
14
  export type PrismicImageProps = {
17
- /**
18
- * The Prismic image field or thumbnail to render.
19
- */
15
+ /** The Prismic image field or thumbnail to render. */
20
16
  field: ImageField | ImageField<string>
21
17
 
22
18
  /**
@@ -61,11 +57,10 @@ export type PrismicImageProps = {
61
57
  } & (
62
58
  | {
63
59
  /**
64
- * Widths used to build a `srcset` value for the image field.
60
+ * Widths (in pixels) used to build a `srcset` value for the image field.
65
61
  *
66
- * If a `widths` prop is not given or `"defaults"` is passed, the
67
- * following widths will be used: 640, 750, 828, 1080, 1200, 1920, 2048,
68
- * 3840.
62
+ * If omitted or set to `"defaults"`, the following widths will be used:
63
+ * 640, 750, 828, 1080, 1200, 1920, 2048, 3840.
69
64
  *
70
65
  * If the image field contains responsive views, each responsive view can
71
66
  * be used as a width in the resulting `srcset` by passing `"thumbnails"`
@@ -75,15 +70,9 @@ export type PrismicImageProps = {
75
70
  | NonNullable<Parameters<typeof asImageWidthSrcSet>[1]>["widths"]
76
71
  | "thumbnails"
77
72
  | "defaults"
78
- /**
79
- * Not used when the `widths` prop is used.
80
- */
81
73
  pixelDensities?: never
82
74
  }
83
75
  | {
84
- /**
85
- * Not used when the `widths` prop is used.
86
- */
87
76
  widths?: never
88
77
  /**
89
78
  * Pixel densities used to build a `srcset` value for the image field.
@@ -12,32 +12,27 @@ import { isInternalURL } from "./lib/isInternalURL"
12
12
 
13
13
  import type { ComponentOrTagName } from "./types"
14
14
 
15
- /**
16
- * The default component rendered for internal URLs.
17
- */
15
+ import { usePrismic } from "./createPrismic"
16
+
17
+ /** The default component rendered for internal URLs. */
18
18
  const defaultInternalComponent = "router-link"
19
19
 
20
- /**
21
- * The default component rendered for external URLs.
22
- */
20
+ /** The default component rendered for external URLs. */
23
21
  const defaultExternalComponent = "a"
24
22
 
25
- /**
26
- * The default rel attribute rendered for external URLs.
27
- */
23
+ /** The default rel attribute rendered for external URLs. */
28
24
  const defaultExternalRelAttribute = "noreferrer"
29
25
 
30
- /**
31
- * Props for `<PrismicLink />`.
32
- */
26
+ /** Props for `<PrismicLink />`. */
33
27
  export type PrismicLinkProps = {
34
28
  /**
35
- * A link resolver function used to resolve links when not using the route
36
- * resolver parameter with `@prismicio/client`.
29
+ * The link resolver used to resolve links.
37
30
  *
38
- * @defaultValue The link resolver provided to `@prismicio/vue` plugin if configured.
31
+ * @remarks
32
+ * If your app uses route resolvers when querying for your Prismic
33
+ * repository's content, a link resolver does not need to be provided.
39
34
  *
40
- * @see Link resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#link-resolver}
35
+ * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}
41
36
  */
42
37
  linkResolver?: LinkResolverFunction
43
38
 
@@ -49,30 +44,29 @@ export type PrismicLinkProps = {
49
44
  rel?: string | AsLinkAttrsConfig["rel"]
50
45
 
51
46
  /**
52
- * The Vue component rendered for links when the URL is internal.
47
+ * The component rendered for internal URLs.
48
+ *
49
+ * If your app uses a client-side router that requires a special Link
50
+ * component, provide the Link component to this prop.
53
51
  *
54
52
  * @defaultValue `<RouterLink>`
55
53
  */
56
54
  internalComponent?: ComponentOrTagName
57
55
 
58
56
  /**
59
- * The Vue component rendered for links when the URL is external.
57
+ * The component rendered for external URLs.
60
58
  *
61
59
  * @defaultValue `<a>`
62
60
  */
63
61
  externalComponent?: ComponentOrTagName
64
62
  } & (
65
63
  | {
66
- /**
67
- * The Prismic link field to render.
68
- */
64
+ /** The Prismic link field to render. */
69
65
  field: LinkField
70
66
  document?: never
71
67
  }
72
68
  | {
73
- /**
74
- * The Prismic document to render as a link.
75
- */
69
+ /** The Prismic document to render as a link. */
76
70
  document: PrismicDocument
77
71
  field?: never
78
72
  }
@@ -81,6 +75,8 @@ export type PrismicLinkProps = {
81
75
  const props = defineProps<PrismicLinkProps>()
82
76
  defineOptions({ name: "PrismicLink" })
83
77
 
78
+ const { componentsConfig } = usePrismic()
79
+
84
80
  const rawAttrs = computed(() => {
85
81
  return asLinkAttrs(props.field || props.document, {
86
82
  linkResolver: props.linkResolver,
@@ -96,8 +92,12 @@ const rawAttrs = computed(() => {
96
92
 
97
93
  const component = computed(() => {
98
94
  return isInternalURL(rawAttrs.value.href || "")
99
- ? props.internalComponent || defaultInternalComponent
100
- : props.externalComponent || defaultExternalComponent
95
+ ? props.internalComponent ||
96
+ componentsConfig?.linkInternalComponent ||
97
+ defaultInternalComponent
98
+ : props.externalComponent ||
99
+ componentsConfig?.linkExternalComponent ||
100
+ defaultExternalComponent
101
101
  })
102
102
 
103
103
  // Match Vue Router's `<RouterLink />` interface unless the component is an anchor tag.