@prismicio/vue 4.3.0 → 5.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/README.md +4 -4
  2. package/dist/PrismicEmbed.vue.cjs +25 -0
  3. package/dist/PrismicEmbed.vue.cjs.map +1 -0
  4. package/dist/PrismicEmbed.vue.d.ts +19 -0
  5. package/dist/PrismicEmbed.vue.js +26 -0
  6. package/dist/PrismicEmbed.vue.js.map +1 -0
  7. package/dist/PrismicEmbed.vue2.cjs +4 -0
  8. package/dist/PrismicEmbed.vue2.cjs.map +1 -0
  9. package/dist/PrismicEmbed.vue2.js +5 -0
  10. package/dist/PrismicEmbed.vue2.js.map +1 -0
  11. package/dist/PrismicImage.vue.cjs +84 -0
  12. package/dist/PrismicImage.vue.cjs.map +1 -0
  13. package/dist/PrismicImage.vue.d.ts +224 -0
  14. package/dist/PrismicImage.vue.js +85 -0
  15. package/dist/PrismicImage.vue.js.map +1 -0
  16. package/dist/PrismicImage.vue2.cjs +4 -0
  17. package/dist/PrismicImage.vue2.cjs.map +1 -0
  18. package/dist/PrismicImage.vue2.js +5 -0
  19. package/dist/PrismicImage.vue2.js.map +1 -0
  20. package/dist/PrismicLink.vue.cjs +100 -0
  21. package/dist/PrismicLink.vue.cjs.map +1 -0
  22. package/dist/PrismicLink.vue.d.ts +278 -0
  23. package/dist/PrismicLink.vue.js +101 -0
  24. package/dist/PrismicLink.vue.js.map +1 -0
  25. package/dist/PrismicLink.vue2.cjs +4 -0
  26. package/dist/PrismicLink.vue2.cjs.map +1 -0
  27. package/dist/PrismicLink.vue2.js +5 -0
  28. package/dist/PrismicLink.vue2.js.map +1 -0
  29. package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.cjs +90 -0
  30. package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.cjs.map +1 -0
  31. package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.d.ts +7 -0
  32. package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.js +91 -0
  33. package/dist/PrismicRichText/DeprecatedPrismicRichText.vue.js.map +1 -0
  34. package/dist/PrismicRichText/DeprecatedPrismicRichText.vue2.cjs +4 -0
  35. package/dist/PrismicRichText/DeprecatedPrismicRichText.vue2.cjs.map +1 -0
  36. package/dist/PrismicRichText/DeprecatedPrismicRichText.vue2.js +5 -0
  37. package/dist/PrismicRichText/DeprecatedPrismicRichText.vue2.js.map +1 -0
  38. package/dist/PrismicRichText/PrismicRichText.vue.cjs +85 -0
  39. package/dist/PrismicRichText/PrismicRichText.vue.cjs.map +1 -0
  40. package/dist/PrismicRichText/PrismicRichText.vue.d.ts +57 -0
  41. package/dist/PrismicRichText/PrismicRichText.vue.js +86 -0
  42. package/dist/PrismicRichText/PrismicRichText.vue.js.map +1 -0
  43. package/dist/PrismicRichText/PrismicRichText.vue2.cjs +4 -0
  44. package/dist/PrismicRichText/PrismicRichText.vue2.cjs.map +1 -0
  45. package/dist/PrismicRichText/PrismicRichText.vue2.js +5 -0
  46. package/dist/PrismicRichText/PrismicRichText.vue2.js.map +1 -0
  47. package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.cjs +133 -0
  48. package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.cjs.map +1 -0
  49. package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.d.ts +37 -0
  50. package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.js +134 -0
  51. package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue.js.map +1 -0
  52. package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue2.cjs +4 -0
  53. package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue2.cjs.map +1 -0
  54. package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue2.js +5 -0
  55. package/dist/PrismicRichText/PrismicRichTextDefaultComponent.vue2.js.map +1 -0
  56. package/dist/PrismicRichText/PrismicRichTextSerialize.vue.cjs +47 -0
  57. package/dist/PrismicRichText/PrismicRichTextSerialize.vue.cjs.map +1 -0
  58. package/dist/PrismicRichText/PrismicRichTextSerialize.vue.d.ts +10 -0
  59. package/dist/PrismicRichText/PrismicRichTextSerialize.vue.js +48 -0
  60. package/dist/PrismicRichText/PrismicRichTextSerialize.vue.js.map +1 -0
  61. package/dist/PrismicRichText/PrismicRichTextSerialize.vue2.cjs +4 -0
  62. package/dist/PrismicRichText/PrismicRichTextSerialize.vue2.cjs.map +1 -0
  63. package/dist/PrismicRichText/PrismicRichTextSerialize.vue2.js +5 -0
  64. package/dist/PrismicRichText/PrismicRichTextSerialize.vue2.js.map +1 -0
  65. package/dist/PrismicRichText/getRichTextComponentProps.cjs +10 -0
  66. package/dist/PrismicRichText/getRichTextComponentProps.cjs.map +1 -0
  67. package/dist/PrismicRichText/getRichTextComponentProps.d.ts +49 -0
  68. package/dist/PrismicRichText/getRichTextComponentProps.js +10 -0
  69. package/dist/PrismicRichText/getRichTextComponentProps.js.map +1 -0
  70. package/dist/PrismicRichText/index.d.ts +2 -0
  71. package/dist/PrismicRichText/types.d.ts +22 -0
  72. package/dist/PrismicText.vue.cjs +43 -0
  73. package/dist/PrismicText.vue.cjs.map +1 -0
  74. package/dist/PrismicText.vue.d.ts +31 -0
  75. package/dist/PrismicText.vue.js +44 -0
  76. package/dist/PrismicText.vue.js.map +1 -0
  77. package/dist/PrismicText.vue2.cjs +4 -0
  78. package/dist/PrismicText.vue2.cjs.map +1 -0
  79. package/dist/PrismicText.vue2.js +5 -0
  80. package/dist/PrismicText.vue2.js.map +1 -0
  81. package/dist/SliceZone/SliceZone.vue.cjs +63 -0
  82. package/dist/SliceZone/SliceZone.vue.cjs.map +1 -0
  83. package/dist/SliceZone/SliceZone.vue.d.ts +40 -0
  84. package/dist/SliceZone/SliceZone.vue.js +64 -0
  85. package/dist/SliceZone/SliceZone.vue.js.map +1 -0
  86. package/dist/SliceZone/SliceZone.vue2.cjs +4 -0
  87. package/dist/SliceZone/SliceZone.vue2.cjs.map +1 -0
  88. package/dist/SliceZone/SliceZone.vue2.js +5 -0
  89. package/dist/SliceZone/SliceZone.vue2.js.map +1 -0
  90. package/dist/SliceZone/TODOSliceComponent.cjs +29 -0
  91. package/dist/SliceZone/TODOSliceComponent.cjs.map +1 -0
  92. package/dist/SliceZone/TODOSliceComponent.d.ts +9 -0
  93. package/dist/SliceZone/TODOSliceComponent.js +29 -0
  94. package/dist/SliceZone/TODOSliceComponent.js.map +1 -0
  95. package/dist/SliceZone/defineSliceZoneComponents.cjs +14 -0
  96. package/dist/SliceZone/defineSliceZoneComponents.cjs.map +1 -0
  97. package/dist/SliceZone/defineSliceZoneComponents.d.ts +36 -0
  98. package/dist/SliceZone/defineSliceZoneComponents.js +14 -0
  99. package/dist/SliceZone/defineSliceZoneComponents.js.map +1 -0
  100. package/dist/SliceZone/getSliceComponentProps.cjs +22 -0
  101. package/dist/SliceZone/getSliceComponentProps.cjs.map +1 -0
  102. package/dist/SliceZone/getSliceComponentProps.d.ts +66 -0
  103. package/dist/SliceZone/getSliceComponentProps.js +22 -0
  104. package/dist/SliceZone/getSliceComponentProps.js.map +1 -0
  105. package/dist/SliceZone/index.d.ts +4 -0
  106. package/dist/SliceZone/types.d.ts +97 -0
  107. package/dist/createPrismic.cjs +17 -50
  108. package/dist/createPrismic.cjs.map +1 -1
  109. package/dist/createPrismic.d.ts +10 -0
  110. package/dist/createPrismic.js +16 -27
  111. package/dist/createPrismic.js.map +1 -1
  112. package/dist/index.cjs +21 -40
  113. package/dist/index.cjs.map +1 -1
  114. package/dist/index.d.ts +19 -9
  115. package/dist/index.js +19 -38
  116. package/dist/index.js.map +1 -1
  117. package/dist/lib/Wrapper.vue.cjs +20 -0
  118. package/dist/lib/Wrapper.vue.cjs.map +1 -0
  119. package/dist/lib/Wrapper.vue.d.ts +34 -0
  120. package/dist/lib/Wrapper.vue.js +21 -0
  121. package/dist/lib/Wrapper.vue.js.map +1 -0
  122. package/dist/lib/Wrapper.vue2.cjs +4 -0
  123. package/dist/lib/Wrapper.vue2.cjs.map +1 -0
  124. package/dist/lib/Wrapper.vue2.js +5 -0
  125. package/dist/lib/Wrapper.vue2.js.map +1 -0
  126. package/dist/lib/devMsg.cjs +8 -0
  127. package/dist/lib/devMsg.cjs.map +1 -0
  128. package/dist/lib/devMsg.d.ts +16 -0
  129. package/dist/lib/devMsg.js +8 -0
  130. package/dist/lib/devMsg.js.map +1 -0
  131. package/dist/lib/isInternalURL.cjs.map +1 -1
  132. package/dist/lib/isInternalURL.js.map +1 -1
  133. package/dist/package.json.cjs +5 -0
  134. package/dist/package.json.cjs.map +1 -0
  135. package/dist/package.json.js +5 -0
  136. package/dist/package.json.js.map +1 -0
  137. package/dist/types.d.ts +42 -58
  138. package/dist/usePrismic.cjs +3 -2
  139. package/dist/usePrismic.cjs.map +1 -1
  140. package/dist/usePrismic.d.ts +13 -5
  141. package/dist/usePrismic.js +2 -1
  142. package/dist/usePrismic.js.map +1 -1
  143. package/package.json +32 -35
  144. package/src/PrismicEmbed.vue +42 -0
  145. package/src/PrismicImage.vue +160 -0
  146. package/src/PrismicLink.vue +191 -0
  147. package/src/PrismicRichText/DeprecatedPrismicRichText.vue +130 -0
  148. package/src/PrismicRichText/PrismicRichText.vue +157 -0
  149. package/src/PrismicRichText/PrismicRichTextDefaultComponent.vue +63 -0
  150. package/src/PrismicRichText/PrismicRichTextSerialize.vue +52 -0
  151. package/src/PrismicRichText/getRichTextComponentProps.ts +63 -0
  152. package/src/PrismicRichText/index.ts +3 -0
  153. package/src/PrismicRichText/types.ts +37 -0
  154. package/src/PrismicText.vue +63 -0
  155. package/src/SliceZone/SliceZone.vue +113 -0
  156. package/src/SliceZone/TODOSliceComponent.ts +49 -0
  157. package/src/SliceZone/defineSliceZoneComponents.ts +67 -0
  158. package/src/SliceZone/getSliceComponentProps.ts +98 -0
  159. package/src/SliceZone/index.ts +13 -0
  160. package/src/SliceZone/types.ts +163 -0
  161. package/src/createPrismic.ts +54 -53
  162. package/src/index.ts +33 -58
  163. package/src/lib/Wrapper.vue +22 -0
  164. package/src/lib/devMsg.ts +20 -0
  165. package/src/lib/isInternalURL.ts +4 -4
  166. package/src/types.ts +91 -109
  167. package/src/usePrismic.ts +16 -9
  168. package/dist/components/PrismicEmbed.cjs +0 -36
  169. package/dist/components/PrismicEmbed.cjs.map +0 -1
  170. package/dist/components/PrismicEmbed.d.ts +0 -59
  171. package/dist/components/PrismicEmbed.js +0 -36
  172. package/dist/components/PrismicEmbed.js.map +0 -1
  173. package/dist/components/PrismicImage.cjs +0 -122
  174. package/dist/components/PrismicImage.cjs.map +0 -1
  175. package/dist/components/PrismicImage.d.ts +0 -163
  176. package/dist/components/PrismicImage.js +0 -122
  177. package/dist/components/PrismicImage.js.map +0 -1
  178. package/dist/components/PrismicLink.cjs +0 -120
  179. package/dist/components/PrismicLink.cjs.map +0 -1
  180. package/dist/components/PrismicLink.d.ts +0 -196
  181. package/dist/components/PrismicLink.js +0 -120
  182. package/dist/components/PrismicLink.js.map +0 -1
  183. package/dist/components/PrismicRichText.cjs +0 -108
  184. package/dist/components/PrismicRichText.cjs.map +0 -1
  185. package/dist/components/PrismicRichText.d.ts +0 -161
  186. package/dist/components/PrismicRichText.js +0 -108
  187. package/dist/components/PrismicRichText.js.map +0 -1
  188. package/dist/components/PrismicText.cjs +0 -57
  189. package/dist/components/PrismicText.cjs.map +0 -1
  190. package/dist/components/PrismicText.d.ts +0 -119
  191. package/dist/components/PrismicText.js +0 -57
  192. package/dist/components/PrismicText.js.map +0 -1
  193. package/dist/components/SliceZone.cjs +0 -156
  194. package/dist/components/SliceZone.cjs.map +0 -1
  195. package/dist/components/SliceZone.d.ts +0 -375
  196. package/dist/components/SliceZone.js +0 -156
  197. package/dist/components/SliceZone.js.map +0 -1
  198. package/dist/components/index.d.ts +0 -12
  199. package/dist/composables.cjs +0 -40
  200. package/dist/composables.cjs.map +0 -1
  201. package/dist/composables.d.ts +0 -330
  202. package/dist/composables.js +0 -40
  203. package/dist/composables.js.map +0 -1
  204. package/dist/globalExtensions.d.ts +0 -11
  205. package/dist/injectionSymbols.cjs +0 -5
  206. package/dist/injectionSymbols.cjs.map +0 -1
  207. package/dist/injectionSymbols.d.ts +0 -9
  208. package/dist/injectionSymbols.js +0 -5
  209. package/dist/injectionSymbols.js.map +0 -1
  210. package/dist/lib/__PRODUCTION__.cjs +0 -8
  211. package/dist/lib/__PRODUCTION__.cjs.map +0 -1
  212. package/dist/lib/__PRODUCTION__.d.ts +0 -7
  213. package/dist/lib/__PRODUCTION__.js +0 -8
  214. package/dist/lib/__PRODUCTION__.js.map +0 -1
  215. package/dist/lib/getSlots.cjs +0 -19
  216. package/dist/lib/getSlots.cjs.map +0 -1
  217. package/dist/lib/getSlots.d.ts +0 -14
  218. package/dist/lib/getSlots.js +0 -19
  219. package/dist/lib/getSlots.js.map +0 -1
  220. package/dist/lib/simplyResolveComponent.cjs +0 -8
  221. package/dist/lib/simplyResolveComponent.cjs.map +0 -1
  222. package/dist/lib/simplyResolveComponent.d.ts +0 -12
  223. package/dist/lib/simplyResolveComponent.js +0 -8
  224. package/dist/lib/simplyResolveComponent.js.map +0 -1
  225. package/dist/useStatefulPrismicClientMethod.cjs +0 -39
  226. package/dist/useStatefulPrismicClientMethod.cjs.map +0 -1
  227. package/dist/useStatefulPrismicClientMethod.d.ts +0 -64
  228. package/dist/useStatefulPrismicClientMethod.js +0 -39
  229. package/dist/useStatefulPrismicClientMethod.js.map +0 -1
  230. package/src/components/PrismicEmbed.ts +0 -91
  231. package/src/components/PrismicImage.ts +0 -309
  232. package/src/components/PrismicLink.ts +0 -326
  233. package/src/components/PrismicRichText.ts +0 -282
  234. package/src/components/PrismicText.ts +0 -167
  235. package/src/components/SliceZone.ts +0 -619
  236. package/src/components/index.ts +0 -46
  237. package/src/composables.ts +0 -474
  238. package/src/globalExtensions.ts +0 -12
  239. package/src/injectionSymbols.ts +0 -17
  240. package/src/lib/__PRODUCTION__.ts +0 -12
  241. package/src/lib/getSlots.ts +0 -37
  242. package/src/lib/simplyResolveComponent.ts +0 -23
  243. package/src/useStatefulPrismicClientMethod.ts +0 -156
  244. package/vetur/attributes.json +0 -113
  245. package/vetur/tags.json +0 -60
@@ -0,0 +1,134 @@
1
+ import { defineComponent, computed, openBlock, createElementBlock, renderSlot, createBlock, withCtx, createVNode, normalizeClass, Fragment, renderList, createCommentVNode, createTextVNode, toDisplayString } from "vue";
2
+ import _sfc_main$3 from "../PrismicEmbed.vue.js";
3
+ import _sfc_main$2 from "../PrismicImage.vue.js";
4
+ import _sfc_main$1 from "../PrismicLink.vue.js";
5
+ const _hoisted_1 = ["dir"];
6
+ const _hoisted_2 = ["dir"];
7
+ const _hoisted_3 = ["dir"];
8
+ const _hoisted_4 = ["dir"];
9
+ const _hoisted_5 = ["dir"];
10
+ const _hoisted_6 = ["dir"];
11
+ const _hoisted_7 = ["dir"];
12
+ const _hoisted_8 = { key: 7 };
13
+ const _hoisted_9 = { key: 8 };
14
+ const _hoisted_10 = { key: 9 };
15
+ const _hoisted_11 = ["dir"];
16
+ const _hoisted_12 = ["dir"];
17
+ const _hoisted_13 = { key: 12 };
18
+ const _hoisted_14 = { key: 13 };
19
+ const _hoisted_15 = {
20
+ key: 14,
21
+ class: "block-img"
22
+ };
23
+ const _hoisted_16 = { key: 0 };
24
+ const _sfc_main = /* @__PURE__ */ defineComponent({
25
+ ...{ name: "PrismicRichTextDefaultComponent" },
26
+ __name: "PrismicRichTextDefaultComponent",
27
+ props: {
28
+ node: {},
29
+ linkResolver: {}
30
+ },
31
+ setup(__props) {
32
+ const props = __props;
33
+ const dir = computed(() => {
34
+ return "direction" in props.node && props.node.direction === "rtl" ? "rtl" : void 0;
35
+ });
36
+ return (_ctx, _cache) => {
37
+ return _ctx.node.type === "heading1" ? (openBlock(), createElementBlock("h1", {
38
+ key: 0,
39
+ dir: dir.value
40
+ }, [
41
+ renderSlot(_ctx.$slots, "default")
42
+ ], 8, _hoisted_1)) : _ctx.node.type === "heading2" ? (openBlock(), createElementBlock("h2", {
43
+ key: 1,
44
+ dir: dir.value
45
+ }, [
46
+ renderSlot(_ctx.$slots, "default")
47
+ ], 8, _hoisted_2)) : _ctx.node.type === "heading3" ? (openBlock(), createElementBlock("h3", {
48
+ key: 2,
49
+ dir: dir.value
50
+ }, [
51
+ renderSlot(_ctx.$slots, "default")
52
+ ], 8, _hoisted_3)) : _ctx.node.type === "heading4" ? (openBlock(), createElementBlock("h4", {
53
+ key: 3,
54
+ dir: dir.value
55
+ }, [
56
+ renderSlot(_ctx.$slots, "default")
57
+ ], 8, _hoisted_4)) : _ctx.node.type === "heading5" ? (openBlock(), createElementBlock("h5", {
58
+ key: 4,
59
+ dir: dir.value
60
+ }, [
61
+ renderSlot(_ctx.$slots, "default")
62
+ ], 8, _hoisted_5)) : _ctx.node.type === "heading6" ? (openBlock(), createElementBlock("h6", {
63
+ key: 5,
64
+ dir: dir.value
65
+ }, [
66
+ renderSlot(_ctx.$slots, "default")
67
+ ], 8, _hoisted_6)) : _ctx.node.type === "paragraph" ? (openBlock(), createElementBlock("p", {
68
+ key: 6,
69
+ dir: dir.value
70
+ }, [
71
+ renderSlot(_ctx.$slots, "default")
72
+ ], 8, _hoisted_7)) : _ctx.node.type === "preformatted" ? (openBlock(), createElementBlock("pre", _hoisted_8, [
73
+ renderSlot(_ctx.$slots, "default")
74
+ ])) : _ctx.node.type === "strong" ? (openBlock(), createElementBlock("strong", _hoisted_9, [
75
+ renderSlot(_ctx.$slots, "default")
76
+ ])) : _ctx.node.type === "em" ? (openBlock(), createElementBlock("em", _hoisted_10, [
77
+ renderSlot(_ctx.$slots, "default")
78
+ ])) : _ctx.node.type === "list-item" ? (openBlock(), createElementBlock("li", {
79
+ key: 10,
80
+ dir: dir.value
81
+ }, [
82
+ renderSlot(_ctx.$slots, "default")
83
+ ], 8, _hoisted_11)) : _ctx.node.type === "o-list-item" ? (openBlock(), createElementBlock("li", {
84
+ key: 11,
85
+ dir: dir.value
86
+ }, [
87
+ renderSlot(_ctx.$slots, "default")
88
+ ], 8, _hoisted_12)) : _ctx.node.type === "group-list-item" ? (openBlock(), createElementBlock("ul", _hoisted_13, [
89
+ renderSlot(_ctx.$slots, "default")
90
+ ])) : _ctx.node.type === "group-o-list-item" ? (openBlock(), createElementBlock("ol", _hoisted_14, [
91
+ renderSlot(_ctx.$slots, "default")
92
+ ])) : _ctx.node.type === "image" ? (openBlock(), createElementBlock("p", _hoisted_15, [
93
+ _ctx.node.linkTo ? (openBlock(), createBlock(_sfc_main$1, {
94
+ key: 0,
95
+ field: _ctx.node.linkTo
96
+ }, {
97
+ default: withCtx(() => [
98
+ createVNode(_sfc_main$2, { field: _ctx.node }, null, 8, ["field"])
99
+ ]),
100
+ _: 1
101
+ }, 8, ["field"])) : (openBlock(), createBlock(_sfc_main$2, {
102
+ key: 1,
103
+ field: _ctx.node
104
+ }, null, 8, ["field"]))
105
+ ])) : _ctx.node.type === "embed" ? (openBlock(), createBlock(_sfc_main$3, {
106
+ key: 15,
107
+ field: _ctx.node.oembed
108
+ }, null, 8, ["field"])) : _ctx.node.type === "hyperlink" ? (openBlock(), createBlock(_sfc_main$1, {
109
+ key: 16,
110
+ field: _ctx.node.data,
111
+ "link-resolver": _ctx.linkResolver
112
+ }, {
113
+ default: withCtx(() => [
114
+ renderSlot(_ctx.$slots, "default")
115
+ ]),
116
+ _: 3
117
+ }, 8, ["field", "link-resolver"])) : _ctx.node.type === "label" ? (openBlock(), createElementBlock("span", {
118
+ key: 17,
119
+ class: normalizeClass(_ctx.node.data.label)
120
+ }, [
121
+ renderSlot(_ctx.$slots, "default")
122
+ ], 2)) : (openBlock(true), createElementBlock(Fragment, { key: 18 }, renderList(_ctx.node.text.split("\n"), (line, index) => {
123
+ return openBlock(), createElementBlock(Fragment, { key: line }, [
124
+ index > 0 ? (openBlock(), createElementBlock("br", _hoisted_16)) : createCommentVNode("", true),
125
+ createTextVNode(toDisplayString(line), 1)
126
+ ], 64);
127
+ }), 128));
128
+ };
129
+ }
130
+ });
131
+ export {
132
+ _sfc_main as default
133
+ };
134
+ //# sourceMappingURL=PrismicRichTextDefaultComponent.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicRichTextDefaultComponent.vue.js","sources":["../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { RichTextComponentProps } from \"./types\"\n\nimport PrismicEmbed from \"../PrismicEmbed.vue\"\nimport PrismicImage from \"../PrismicImage.vue\"\nimport PrismicLink from \"../PrismicLink.vue\"\n\nconst props = defineProps<\n\tRichTextComponentProps & {\n\t\tlinkResolver?: LinkResolverFunction\n\t}\n>()\ndefineOptions({ name: \"PrismicRichTextDefaultComponent\" })\n\nconst dir = computed(() => {\n\treturn \"direction\" in props.node && props.node.direction === \"rtl\"\n\t\t? \"rtl\"\n\t\t: undefined\n})\n</script>\n\n<template>\n\t<h1 v-if=\"node.type === 'heading1'\" :dir=\"dir\"><slot /></h1>\n\t<h2 v-else-if=\"node.type === 'heading2'\" :dir=\"dir\"><slot /></h2>\n\t<h3 v-else-if=\"node.type === 'heading3'\" :dir=\"dir\"><slot /></h3>\n\t<h4 v-else-if=\"node.type === 'heading4'\" :dir=\"dir\"><slot /></h4>\n\t<h5 v-else-if=\"node.type === 'heading5'\" :dir=\"dir\"><slot /></h5>\n\t<h6 v-else-if=\"node.type === 'heading6'\" :dir=\"dir\"><slot /></h6>\n\t<p v-else-if=\"node.type === 'paragraph'\" :dir=\"dir\"><slot /></p>\n\t<pre v-else-if=\"node.type === 'preformatted'\"><slot /></pre>\n\t<strong v-else-if=\"node.type === 'strong'\"><slot /></strong>\n\t<em v-else-if=\"node.type === 'em'\"><slot /></em>\n\t<li v-else-if=\"node.type === 'list-item'\" :dir=\"dir\"><slot /></li>\n\t<li v-else-if=\"node.type === 'o-list-item'\" :dir=\"dir\"><slot /></li>\n\t<ul v-else-if=\"node.type === 'group-list-item'\">\n\t\t<slot />\n\t</ul>\n\t<ol v-else-if=\"node.type === 'group-o-list-item'\">\n\t\t<slot />\n\t</ol>\n\t<p class=\"block-img\" v-else-if=\"node.type === 'image'\">\n\t\t<PrismicLink v-if=\"node.linkTo\" :field=\"node.linkTo\"\n\t\t\t><PrismicImage :field=\"node\"\n\t\t/></PrismicLink>\n\t\t<PrismicImage v-else :field=\"node\" />\n\t</p>\n\t<PrismicEmbed v-else-if=\"node.type === 'embed'\" :field=\"node.oembed\" />\n\t<PrismicLink\n\t\tv-else-if=\"node.type === 'hyperlink'\"\n\t\t:field=\"node.data\"\n\t\t:link-resolver=\"linkResolver\"\n\t\t><slot\n\t/></PrismicLink>\n\t<span v-else-if=\"node.type === 'label'\" :class=\"node.data.label\"\n\t\t><slot\n\t/></span>\n\t<template v-else v-for=\"(line, index) in node.text.split('\\n')\" :key=\"line\"\n\t\t><br v-if=\"index > 0\" />{{ line }}</template\n\t>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,UAAM,QAAQ;AAOR,UAAA,MAAM,SAAS,MAAM;AAC1B,aAAO,eAAe,MAAM,QAAQ,MAAM,KAAK,cAAc,QAC1D,QACA;AAAA,IAAA,CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ const PrismicRichTextDefaultComponent_vue_vue_type_script_setup_true_lang = require("./PrismicRichTextDefaultComponent.vue.cjs");
3
+ module.exports = PrismicRichTextDefaultComponent_vue_vue_type_script_setup_true_lang;
4
+ //# sourceMappingURL=PrismicRichTextDefaultComponent.vue2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicRichTextDefaultComponent.vue2.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./PrismicRichTextDefaultComponent.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
5
+ //# sourceMappingURL=PrismicRichTextDefaultComponent.vue2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicRichTextDefaultComponent.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ const vue = require("vue");
3
+ const PrismicRichTextDefaultComponent_vue_vue_type_script_setup_true_lang = require("./PrismicRichTextDefaultComponent.vue.cjs");
4
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
5
+ ...{ name: "PrismicRichTextSerialize" },
6
+ __name: "PrismicRichTextSerialize",
7
+ props: {
8
+ components: {},
9
+ children: {},
10
+ linkResolver: {}
11
+ },
12
+ setup(__props) {
13
+ const CHILD_TYPE_RENAMES = {
14
+ "list-item": "listItem",
15
+ "o-list-item": "oListItem",
16
+ "group-list-item": "list",
17
+ "group-o-list-item": "oList"
18
+ };
19
+ const props = __props;
20
+ function getComponent(child) {
21
+ var _a;
22
+ return ((_a = props.components) == null ? void 0 : _a[CHILD_TYPE_RENAMES[child.type] || child.type]) || PrismicRichTextDefaultComponent_vue_vue_type_script_setup_true_lang;
23
+ }
24
+ return (_ctx, _cache) => {
25
+ const _component_PrismicRichTextSerialize = vue.resolveComponent("PrismicRichTextSerialize", true);
26
+ return vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(props.children, (child) => {
27
+ return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(getComponent(child)), {
28
+ key: JSON.stringify(child),
29
+ node: child.node,
30
+ "link-resolver": getComponent(child) === PrismicRichTextDefaultComponent_vue_vue_type_script_setup_true_lang ? props.linkResolver : void 0
31
+ }, {
32
+ default: vue.withCtx(() => [
33
+ child.children.length ? (vue.openBlock(), vue.createBlock(_component_PrismicRichTextSerialize, {
34
+ key: 0,
35
+ children: child.children,
36
+ components: _ctx.components,
37
+ "link-resolver": _ctx.linkResolver
38
+ }, null, 8, ["children", "components", "link-resolver"])) : vue.createCommentVNode("", true)
39
+ ]),
40
+ _: 2
41
+ }, 1032, ["node", "link-resolver"]);
42
+ }), 128);
43
+ };
44
+ }
45
+ });
46
+ module.exports = _sfc_main;
47
+ //# sourceMappingURL=PrismicRichTextSerialize.vue.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicRichTextSerialize.vue.cjs","sources":["../../src/PrismicRichText/PrismicRichTextSerialize.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport type { asTree } from \"@prismicio/client/richtext\"\n\nimport type { VueRichTextSerializer } from \"./types\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\n\nconst CHILD_TYPE_RENAMES = {\n\t\"list-item\": \"listItem\",\n\t\"o-list-item\": \"oListItem\",\n\t\"group-list-item\": \"list\",\n\t\"group-o-list-item\": \"oList\",\n} as const\n\ntype PrismicRichTextSerializeProps = {\n\tcomponents?: VueRichTextSerializer\n\tchildren: ReturnType<typeof asTree>[\"children\"]\n\tlinkResolver?: LinkResolverFunction\n}\n\nconst props = defineProps<PrismicRichTextSerializeProps>()\ndefineOptions({ name: \"PrismicRichTextSerialize\" })\n\nfunction getComponent(child: ReturnType<typeof asTree>[\"children\"][number]) {\n\treturn (\n\t\tprops.components?.[\n\t\t\tCHILD_TYPE_RENAMES[child.type as keyof typeof CHILD_TYPE_RENAMES] ||\n\t\t\t\t(child.type as keyof typeof props.components)\n\t\t] || PrismicRichTextDefaultComponent\n\t)\n}\n</script>\n\n<template>\n\t<component\n\t\tv-for=\"child in props.children\"\n\t\t:key=\"JSON.stringify(child)\"\n\t\t:is=\"getComponent(child)\"\n\t\t:node=\"child.node\"\n\t\t:link-resolver=\"\n\t\t\tgetComponent(child) === PrismicRichTextDefaultComponent\n\t\t\t\t? props.linkResolver\n\t\t\t\t: undefined\n\t\t\"\n\t\t><PrismicRichTextSerialize\n\t\t\tv-if=\"child.children.length\"\n\t\t\t:children=\"child.children\"\n\t\t\t:components=\"components\"\n\t\t\t:link-resolver=\"linkResolver\"\n\t/></component>\n</template>\n"],"names":["PrismicRichTextDefaultComponent"],"mappings":";;;;;;;;;;;;AAQA,UAAM,qBAAqB;AAAA,MAC1B,aAAa;AAAA,MACb,eAAe;AAAA,MACf,mBAAmB;AAAA,MACnB,qBAAqB;AAAA,IACtB;AAQA,UAAM,QAAQ;AAGd,aAAS,aAAa,OAAsD;;AAE1E,eAAA,WAAM,eAAN,mBACC,mBAAmB,MAAM,IAAuC,KAC9D,MAAM,UACJA;AAAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,10 @@
1
+ import { LinkResolverFunction } from '@prismicio/client';
2
+ import { asTree } from '@prismicio/client/richtext';
3
+ import { VueRichTextSerializer } from './types';
4
+ type PrismicRichTextSerializeProps = {
5
+ components?: VueRichTextSerializer;
6
+ children: ReturnType<typeof asTree>["children"];
7
+ linkResolver?: LinkResolverFunction;
8
+ };
9
+ declare const _default: import('vue').DefineComponent<PrismicRichTextSerializeProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<PrismicRichTextSerializeProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
10
+ export default _default;
@@ -0,0 +1,48 @@
1
+ import { defineComponent, resolveComponent, openBlock, createElementBlock, Fragment, renderList, createBlock, resolveDynamicComponent, withCtx, createCommentVNode } from "vue";
2
+ import _sfc_main$1 from "./PrismicRichTextDefaultComponent.vue.js";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ ...{ name: "PrismicRichTextSerialize" },
5
+ __name: "PrismicRichTextSerialize",
6
+ props: {
7
+ components: {},
8
+ children: {},
9
+ linkResolver: {}
10
+ },
11
+ setup(__props) {
12
+ const CHILD_TYPE_RENAMES = {
13
+ "list-item": "listItem",
14
+ "o-list-item": "oListItem",
15
+ "group-list-item": "list",
16
+ "group-o-list-item": "oList"
17
+ };
18
+ const props = __props;
19
+ function getComponent(child) {
20
+ var _a;
21
+ return ((_a = props.components) == null ? void 0 : _a[CHILD_TYPE_RENAMES[child.type] || child.type]) || _sfc_main$1;
22
+ }
23
+ return (_ctx, _cache) => {
24
+ const _component_PrismicRichTextSerialize = resolveComponent("PrismicRichTextSerialize", true);
25
+ return openBlock(true), createElementBlock(Fragment, null, renderList(props.children, (child) => {
26
+ return openBlock(), createBlock(resolveDynamicComponent(getComponent(child)), {
27
+ key: JSON.stringify(child),
28
+ node: child.node,
29
+ "link-resolver": getComponent(child) === _sfc_main$1 ? props.linkResolver : void 0
30
+ }, {
31
+ default: withCtx(() => [
32
+ child.children.length ? (openBlock(), createBlock(_component_PrismicRichTextSerialize, {
33
+ key: 0,
34
+ children: child.children,
35
+ components: _ctx.components,
36
+ "link-resolver": _ctx.linkResolver
37
+ }, null, 8, ["children", "components", "link-resolver"])) : createCommentVNode("", true)
38
+ ]),
39
+ _: 2
40
+ }, 1032, ["node", "link-resolver"]);
41
+ }), 128);
42
+ };
43
+ }
44
+ });
45
+ export {
46
+ _sfc_main as default
47
+ };
48
+ //# sourceMappingURL=PrismicRichTextSerialize.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicRichTextSerialize.vue.js","sources":["../../src/PrismicRichText/PrismicRichTextSerialize.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport type { asTree } from \"@prismicio/client/richtext\"\n\nimport type { VueRichTextSerializer } from \"./types\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\n\nconst CHILD_TYPE_RENAMES = {\n\t\"list-item\": \"listItem\",\n\t\"o-list-item\": \"oListItem\",\n\t\"group-list-item\": \"list\",\n\t\"group-o-list-item\": \"oList\",\n} as const\n\ntype PrismicRichTextSerializeProps = {\n\tcomponents?: VueRichTextSerializer\n\tchildren: ReturnType<typeof asTree>[\"children\"]\n\tlinkResolver?: LinkResolverFunction\n}\n\nconst props = defineProps<PrismicRichTextSerializeProps>()\ndefineOptions({ name: \"PrismicRichTextSerialize\" })\n\nfunction getComponent(child: ReturnType<typeof asTree>[\"children\"][number]) {\n\treturn (\n\t\tprops.components?.[\n\t\t\tCHILD_TYPE_RENAMES[child.type as keyof typeof CHILD_TYPE_RENAMES] ||\n\t\t\t\t(child.type as keyof typeof props.components)\n\t\t] || PrismicRichTextDefaultComponent\n\t)\n}\n</script>\n\n<template>\n\t<component\n\t\tv-for=\"child in props.children\"\n\t\t:key=\"JSON.stringify(child)\"\n\t\t:is=\"getComponent(child)\"\n\t\t:node=\"child.node\"\n\t\t:link-resolver=\"\n\t\t\tgetComponent(child) === PrismicRichTextDefaultComponent\n\t\t\t\t? props.linkResolver\n\t\t\t\t: undefined\n\t\t\"\n\t\t><PrismicRichTextSerialize\n\t\t\tv-if=\"child.children.length\"\n\t\t\t:children=\"child.children\"\n\t\t\t:components=\"components\"\n\t\t\t:link-resolver=\"linkResolver\"\n\t/></component>\n</template>\n"],"names":["PrismicRichTextDefaultComponent"],"mappings":";;;;;;;;;;;AAQA,UAAM,qBAAqB;AAAA,MAC1B,aAAa;AAAA,MACb,eAAe;AAAA,MACf,mBAAmB;AAAA,MACnB,qBAAqB;AAAA,IACtB;AAQA,UAAM,QAAQ;AAGd,aAAS,aAAa,OAAsD;;AAE1E,eAAA,WAAM,eAAN,mBACC,mBAAmB,MAAM,IAAuC,KAC9D,MAAM,UACJA;AAAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ const PrismicRichTextSerialize_vue_vue_type_script_setup_true_lang = require("./PrismicRichTextSerialize.vue.cjs");
3
+ module.exports = PrismicRichTextSerialize_vue_vue_type_script_setup_true_lang;
4
+ //# sourceMappingURL=PrismicRichTextSerialize.vue2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicRichTextSerialize.vue2.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./PrismicRichTextSerialize.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
5
+ //# sourceMappingURL=PrismicRichTextSerialize.vue2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicRichTextSerialize.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const getRichTextComponentProps = (type) => ({
4
+ node: {
5
+ type: Object,
6
+ required: true
7
+ }
8
+ });
9
+ exports.getRichTextComponentProps = getRichTextComponentProps;
10
+ //# sourceMappingURL=getRichTextComponentProps.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRichTextComponentProps.cjs","sources":["../../../src/PrismicRichText/getRichTextComponentProps.ts"],"sourcesContent":["import type { RTAnyNode } from \"@prismicio/client\"\nimport type { PropType } from \"vue\"\n\nimport type { RichTextComponentProps } from \"./types\"\n\n/**\n * Native Vue props for a component rendering nodes from a Prismic rich text\n * field using the `<PrismicRichText />` component.\n *\n * @typeParam TRTNode - The type of rich text node(s) this component handles\n */\ntype DefineComponentRichTextComponentProps<\n\tTRTNode extends RTAnyNode = RTAnyNode,\n> = {\n\tnode: {\n\t\ttype: PropType<RichTextComponentProps<TRTNode>[\"node\"]>\n\t\trequired: true\n\t}\n}\n\n/**\n * Gets native Vue props for a component rendering nodes from a Prismic rich\n * text field using the `<PrismicRichText />` component.\n *\n * Props are: `[\"node\"]`\n *\n * @example\n *\n * ```javascript\n * // Defining a new rich text component\n * import { getRichTextComponentProps } from \"@prismicio/vue\"\n *\n * defineProps(getRichTextComponentProps())\n * ```\n *\n * @example\n *\n * ```typescript\n * // Defining a new rich text component for a specific node type\n * import { getRichTextComponentProps } from \"@prismicio/vue\"\n *\n * defineProps(getRichTextComponentProps(\"heading1\"))\n * ```\n *\n * @typeParam TRTType - The type of rich text node(s) this component handles\n *\n * @param type - The type of rich text node this component handles\n *\n * @returns Props object to use with `defineProps()`\n */\nexport const getRichTextComponentProps = <TRTType extends RTAnyNode[\"type\"]>(\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\ttype?: TRTType,\n): DefineComponentRichTextComponentProps<\n\tExtract<RTAnyNode, { type: TRTType }>\n> => ({\n\tnode: {\n\t\ttype: Object as PropType<\n\t\t\tRichTextComponentProps<Extract<RTAnyNode, { type: TRTType }>>[\"node\"]\n\t\t>,\n\t\trequired: true,\n\t},\n})\n"],"names":[],"mappings":";;AAkDa,MAAA,4BAA4B,CAExC,UAGK;AAAA,EACL,MAAM;AAAA,IACL,MAAM;AAAA,IAGN,UAAU;AAAA,EAAA;AAEX;;"}
@@ -0,0 +1,49 @@
1
+ import type { RTAnyNode } from "@prismicio/client";
2
+ import type { PropType } from "vue";
3
+ import type { RichTextComponentProps } from "./types";
4
+ /**
5
+ * Native Vue props for a component rendering nodes from a Prismic rich text
6
+ * field using the `<PrismicRichText />` component.
7
+ *
8
+ * @typeParam TRTNode - The type of rich text node(s) this component handles
9
+ */
10
+ type DefineComponentRichTextComponentProps<TRTNode extends RTAnyNode = RTAnyNode> = {
11
+ node: {
12
+ type: PropType<RichTextComponentProps<TRTNode>["node"]>;
13
+ required: true;
14
+ };
15
+ };
16
+ /**
17
+ * Gets native Vue props for a component rendering nodes from a Prismic rich
18
+ * text field using the `<PrismicRichText />` component.
19
+ *
20
+ * Props are: `["node"]`
21
+ *
22
+ * @example
23
+ *
24
+ * ```javascript
25
+ * // Defining a new rich text component
26
+ * import { getRichTextComponentProps } from "@prismicio/vue"
27
+ *
28
+ * defineProps(getRichTextComponentProps())
29
+ * ```
30
+ *
31
+ * @example
32
+ *
33
+ * ```typescript
34
+ * // Defining a new rich text component for a specific node type
35
+ * import { getRichTextComponentProps } from "@prismicio/vue"
36
+ *
37
+ * defineProps(getRichTextComponentProps("heading1"))
38
+ * ```
39
+ *
40
+ * @typeParam TRTType - The type of rich text node(s) this component handles
41
+ *
42
+ * @param type - The type of rich text node this component handles
43
+ *
44
+ * @returns Props object to use with `defineProps()`
45
+ */
46
+ export declare const getRichTextComponentProps: <TRTType extends RTAnyNode["type"]>(type?: TRTType) => DefineComponentRichTextComponentProps<Extract<RTAnyNode, {
47
+ type: TRTType;
48
+ }>>;
49
+ export {};
@@ -0,0 +1,10 @@
1
+ const getRichTextComponentProps = (type) => ({
2
+ node: {
3
+ type: Object,
4
+ required: true
5
+ }
6
+ });
7
+ export {
8
+ getRichTextComponentProps
9
+ };
10
+ //# sourceMappingURL=getRichTextComponentProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRichTextComponentProps.js","sources":["../../../src/PrismicRichText/getRichTextComponentProps.ts"],"sourcesContent":["import type { RTAnyNode } from \"@prismicio/client\"\nimport type { PropType } from \"vue\"\n\nimport type { RichTextComponentProps } from \"./types\"\n\n/**\n * Native Vue props for a component rendering nodes from a Prismic rich text\n * field using the `<PrismicRichText />` component.\n *\n * @typeParam TRTNode - The type of rich text node(s) this component handles\n */\ntype DefineComponentRichTextComponentProps<\n\tTRTNode extends RTAnyNode = RTAnyNode,\n> = {\n\tnode: {\n\t\ttype: PropType<RichTextComponentProps<TRTNode>[\"node\"]>\n\t\trequired: true\n\t}\n}\n\n/**\n * Gets native Vue props for a component rendering nodes from a Prismic rich\n * text field using the `<PrismicRichText />` component.\n *\n * Props are: `[\"node\"]`\n *\n * @example\n *\n * ```javascript\n * // Defining a new rich text component\n * import { getRichTextComponentProps } from \"@prismicio/vue\"\n *\n * defineProps(getRichTextComponentProps())\n * ```\n *\n * @example\n *\n * ```typescript\n * // Defining a new rich text component for a specific node type\n * import { getRichTextComponentProps } from \"@prismicio/vue\"\n *\n * defineProps(getRichTextComponentProps(\"heading1\"))\n * ```\n *\n * @typeParam TRTType - The type of rich text node(s) this component handles\n *\n * @param type - The type of rich text node this component handles\n *\n * @returns Props object to use with `defineProps()`\n */\nexport const getRichTextComponentProps = <TRTType extends RTAnyNode[\"type\"]>(\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\ttype?: TRTType,\n): DefineComponentRichTextComponentProps<\n\tExtract<RTAnyNode, { type: TRTType }>\n> => ({\n\tnode: {\n\t\ttype: Object as PropType<\n\t\t\tRichTextComponentProps<Extract<RTAnyNode, { type: TRTType }>>[\"node\"]\n\t\t>,\n\t\trequired: true,\n\t},\n})\n"],"names":[],"mappings":"AAkDa,MAAA,4BAA4B,CAExC,UAGK;AAAA,EACL,MAAM;AAAA,IACL,MAAM;AAAA,IAGN,UAAU;AAAA,EAAA;AAEX;"}
@@ -0,0 +1,2 @@
1
+ export { getRichTextComponentProps } from "./getRichTextComponentProps";
2
+ export type { VueRichTextSerializer, RichTextComponentProps } from "./types";
@@ -0,0 +1,22 @@
1
+ import type { RTAnyNode, RichTextNodeType } from "@prismicio/client";
2
+ import type { DefineComponent, FunctionalComponent, defineAsyncComponent } from "vue";
3
+ /**
4
+ * A map of Rich Text block types to Vue Components. It is used to render Rich
5
+ * Text or title fields.
6
+ *
7
+ * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/rich-text}
8
+ */
9
+ export type VueRichTextSerializer = Partial<Record<keyof typeof RichTextNodeType, VueRichTextComponent>>;
10
+ /**
11
+ * Props for a component rendering nodes from a Prismic rich text field.
12
+ */
13
+ export type RichTextComponentProps<TRTNode extends RTAnyNode = RTAnyNode> = {
14
+ node: TRTNode;
15
+ };
16
+ /**
17
+ * A Vue component rendering a node from a Prismic rich text field.
18
+ *
19
+ * @typeParam TRTNode - The type of rich text node(s) this component handles
20
+ */
21
+ type VueRichTextComponent<TRTNode extends RTAnyNode = RTAnyNode> = DefineComponent<{}, {}, any> | ReturnType<typeof defineAsyncComponent> | DefineComponent<RichTextComponentProps<TRTNode>> | FunctionalComponent<RichTextComponentProps<TRTNode>>;
22
+ export {};
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ const vue = require("vue");
3
+ const client = require("@prismicio/client");
4
+ const esmEnv = require("esm-env");
5
+ const Wrapper_vue_vue_type_script_setup_true_lang = require("./lib/Wrapper.vue.cjs");
6
+ const devMsg = require("./lib/devMsg.cjs");
7
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
8
+ ...{ name: "PrismicText" },
9
+ __name: "PrismicText",
10
+ props: {
11
+ field: {},
12
+ fallback: {},
13
+ separator: {},
14
+ wrapper: {}
15
+ },
16
+ setup(__props) {
17
+ const props = __props;
18
+ if (esmEnv.DEV) {
19
+ vue.watchEffect(() => {
20
+ if (typeof props.field === "string") {
21
+ throw new Error(
22
+ `[PrismicText] The "field" prop only accepts a Rich Text or title field's value but was provided a different type of field instead (e.g. a Key Text or Select field). You can resolve this error by rendering the field value inline without <PrismicText>. For more details, see ${devMsg.devMsg(
23
+ "prismictext-works-only-with-rich-text-and-title-fields"
24
+ )}`
25
+ );
26
+ }
27
+ }, {});
28
+ }
29
+ return (_ctx, _cache) => {
30
+ return vue.unref(client.isFilled).richText(_ctx.field) || _ctx.fallback ? (vue.openBlock(), vue.createBlock(Wrapper_vue_vue_type_script_setup_true_lang, {
31
+ key: 0,
32
+ wrapper: _ctx.wrapper
33
+ }, {
34
+ default: vue.withCtx(() => [
35
+ vue.createTextVNode(vue.toDisplayString(vue.unref(client.asText)(_ctx.field) || _ctx.fallback), 1)
36
+ ]),
37
+ _: 1
38
+ }, 8, ["wrapper"])) : vue.createCommentVNode("", true);
39
+ };
40
+ }
41
+ });
42
+ module.exports = _sfc_main;
43
+ //# sourceMappingURL=PrismicText.vue.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicText.vue.cjs","sources":["../src/PrismicText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { RichTextField } from \"@prismicio/client\"\nimport { asText, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { watchEffect } from \"vue\"\n\nimport Wrapper from \"./lib/Wrapper.vue\"\nimport { devMsg } from \"./lib/devMsg\"\n\nimport type { ComponentOrTagName } from \"./types\"\n\n/**\n * Props for `<PrismicText />`.\n */\nexport type PrismicTextProps = {\n\t/**\n\t * The Prismic rich text field to render.\n\t */\n\tfield: RichTextField | null | undefined\n\n\t/**\n\t * The string value to be rendered when the field is empty. If a fallback is\n\t * not given, `\"\"` (nothing) will be rendered.\n\t */\n\tfallback?: string\n\n\t/**\n\t * The separator used between blocks.\n\t *\n\t * @defaultValue `\" \"` (a whitespace)\n\t */\n\tseparator?: string\n\n\t/**\n\t * An HTML tag name or a component used to wrap the output. `<PrismicText />`\n\t * is not wrapped by default.\n\t *\n\t * @defaultValue `\"template\"` (no wrapper)\n\t */\n\twrapper?: ComponentOrTagName\n}\n\nconst props = defineProps<PrismicTextProps>()\ndefineOptions({ name: \"PrismicText\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.field === \"string\") {\n\t\t\tthrow new Error(\n\t\t\t\t`[PrismicText] The \"field\" prop only accepts a Rich Text or title field's value but was provided a different type of field instead (e.g. a Key Text or Select field). You can resolve this error by rendering the field value inline without <PrismicText>. For more details, see ${devMsg(\n\t\t\t\t\t\"prismictext-works-only-with-rich-text-and-title-fields\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\t}, {})\n}\n</script>\n\n<template>\n\t<Wrapper v-if=\"isFilled.richText(field) || fallback\" :wrapper=\"wrapper\">\n\t\t{{ asText(field) || fallback }}\n\t</Wrapper>\n</template>\n"],"names":["DEV","watchEffect","devMsg"],"mappings":";;;;;;;;;;;;;;;;AA0CA,UAAM,QAAQ;AAGd,QAAIA,YAAK;AACRC,UAAAA,YAAY,MAAM;AACb,YAAA,OAAO,MAAM,UAAU,UAAU;AACpC,gBAAM,IAAI;AAAA,YACT,oRAAoRC,OAAA;AAAA,cACnR;AAAA,YAAA,CACA;AAAA,UACF;AAAA,QAAA;AAAA,MAEF,GAAG,EAAE;AAAA,IAAA;;;;;;;;;;;;;;;"}
@@ -0,0 +1,31 @@
1
+ import { RichTextField } from '@prismicio/client';
2
+ import { ComponentOrTagName } from './types';
3
+ /**
4
+ * Props for `<PrismicText />`.
5
+ */
6
+ export type PrismicTextProps = {
7
+ /**
8
+ * The Prismic rich text field to render.
9
+ */
10
+ field: RichTextField | null | undefined;
11
+ /**
12
+ * The string value to be rendered when the field is empty. If a fallback is
13
+ * not given, `""` (nothing) will be rendered.
14
+ */
15
+ fallback?: string;
16
+ /**
17
+ * The separator used between blocks.
18
+ *
19
+ * @defaultValue `" "` (a whitespace)
20
+ */
21
+ separator?: string;
22
+ /**
23
+ * An HTML tag name or a component used to wrap the output. `<PrismicText />`
24
+ * is not wrapped by default.
25
+ *
26
+ * @defaultValue `"template"` (no wrapper)
27
+ */
28
+ wrapper?: ComponentOrTagName;
29
+ };
30
+ declare const _default: import('vue').DefineComponent<PrismicTextProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<PrismicTextProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
31
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import { defineComponent, watchEffect, unref, openBlock, createBlock, withCtx, createTextVNode, toDisplayString, createCommentVNode } from "vue";
2
+ import { isFilled, asText } from "@prismicio/client";
3
+ import { DEV } from "esm-env";
4
+ import _sfc_main$1 from "./lib/Wrapper.vue.js";
5
+ import { devMsg } from "./lib/devMsg.js";
6
+ const _sfc_main = /* @__PURE__ */ defineComponent({
7
+ ...{ name: "PrismicText" },
8
+ __name: "PrismicText",
9
+ props: {
10
+ field: {},
11
+ fallback: {},
12
+ separator: {},
13
+ wrapper: {}
14
+ },
15
+ setup(__props) {
16
+ const props = __props;
17
+ if (DEV) {
18
+ watchEffect(() => {
19
+ if (typeof props.field === "string") {
20
+ throw new Error(
21
+ `[PrismicText] The "field" prop only accepts a Rich Text or title field's value but was provided a different type of field instead (e.g. a Key Text or Select field). You can resolve this error by rendering the field value inline without <PrismicText>. For more details, see ${devMsg(
22
+ "prismictext-works-only-with-rich-text-and-title-fields"
23
+ )}`
24
+ );
25
+ }
26
+ }, {});
27
+ }
28
+ return (_ctx, _cache) => {
29
+ return unref(isFilled).richText(_ctx.field) || _ctx.fallback ? (openBlock(), createBlock(_sfc_main$1, {
30
+ key: 0,
31
+ wrapper: _ctx.wrapper
32
+ }, {
33
+ default: withCtx(() => [
34
+ createTextVNode(toDisplayString(unref(asText)(_ctx.field) || _ctx.fallback), 1)
35
+ ]),
36
+ _: 1
37
+ }, 8, ["wrapper"])) : createCommentVNode("", true);
38
+ };
39
+ }
40
+ });
41
+ export {
42
+ _sfc_main as default
43
+ };
44
+ //# sourceMappingURL=PrismicText.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicText.vue.js","sources":["../src/PrismicText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { RichTextField } from \"@prismicio/client\"\nimport { asText, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { watchEffect } from \"vue\"\n\nimport Wrapper from \"./lib/Wrapper.vue\"\nimport { devMsg } from \"./lib/devMsg\"\n\nimport type { ComponentOrTagName } from \"./types\"\n\n/**\n * Props for `<PrismicText />`.\n */\nexport type PrismicTextProps = {\n\t/**\n\t * The Prismic rich text field to render.\n\t */\n\tfield: RichTextField | null | undefined\n\n\t/**\n\t * The string value to be rendered when the field is empty. If a fallback is\n\t * not given, `\"\"` (nothing) will be rendered.\n\t */\n\tfallback?: string\n\n\t/**\n\t * The separator used between blocks.\n\t *\n\t * @defaultValue `\" \"` (a whitespace)\n\t */\n\tseparator?: string\n\n\t/**\n\t * An HTML tag name or a component used to wrap the output. `<PrismicText />`\n\t * is not wrapped by default.\n\t *\n\t * @defaultValue `\"template\"` (no wrapper)\n\t */\n\twrapper?: ComponentOrTagName\n}\n\nconst props = defineProps<PrismicTextProps>()\ndefineOptions({ name: \"PrismicText\" })\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (typeof props.field === \"string\") {\n\t\t\tthrow new Error(\n\t\t\t\t`[PrismicText] The \"field\" prop only accepts a Rich Text or title field's value but was provided a different type of field instead (e.g. a Key Text or Select field). You can resolve this error by rendering the field value inline without <PrismicText>. For more details, see ${devMsg(\n\t\t\t\t\t\"prismictext-works-only-with-rich-text-and-title-fields\",\n\t\t\t\t)}`,\n\t\t\t)\n\t\t}\n\t}, {})\n}\n</script>\n\n<template>\n\t<Wrapper v-if=\"isFilled.richText(field) || fallback\" :wrapper=\"wrapper\">\n\t\t{{ asText(field) || fallback }}\n\t</Wrapper>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA0CA,UAAM,QAAQ;AAGd,QAAI,KAAK;AACR,kBAAY,MAAM;AACb,YAAA,OAAO,MAAM,UAAU,UAAU;AACpC,gBAAM,IAAI;AAAA,YACT,oRAAoR;AAAA,cACnR;AAAA,YAAA,CACA;AAAA,UACF;AAAA,QAAA;AAAA,MAEF,GAAG,EAAE;AAAA,IAAA;;;;;;;;;;;;;;"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ const PrismicText_vue_vue_type_script_setup_true_lang = require("./PrismicText.vue.cjs");
3
+ module.exports = PrismicText_vue_vue_type_script_setup_true_lang;
4
+ //# sourceMappingURL=PrismicText.vue2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicText.vue2.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./PrismicText.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
5
+ //# sourceMappingURL=PrismicText.vue2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicText.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}