@prismicio/vue 5.3.0-pr.88.72388e2 → 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 (126) hide show
  1. package/dist/PrismicImage.vue.d.cts +13 -19
  2. package/dist/PrismicImage.vue.d.cts.map +1 -1
  3. package/dist/PrismicLink.vue.d.cts +1 -4
  4. package/dist/PrismicLink.vue.d.cts.map +1 -1
  5. package/dist/PrismicRichText/PrismicRichText.vue.d.cts +5 -6
  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 +5 -6
  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 +1 -3
  14. package/dist/PrismicText.vue.d.cts.map +1 -1
  15. package/dist/SliceZone/types.d.cts +3 -9
  16. package/dist/SliceZone/types.d.cts.map +1 -1
  17. package/dist/createPrismic.d.cts +61 -0
  18. package/dist/createPrismic.d.cts.map +1 -0
  19. package/dist/index.cjs +4 -1
  20. package/dist/index.d.cts +4 -2
  21. package/dist/index.d.ts +4 -2
  22. package/dist/index.js +2 -1
  23. package/dist/package.cjs +1 -1
  24. package/dist/package.cjs.map +1 -1
  25. package/dist/package.js +1 -1
  26. package/dist/package.js.map +1 -1
  27. package/dist/src/PrismicImage.cjs.map +1 -1
  28. package/dist/src/PrismicImage.js.map +1 -1
  29. package/dist/src/PrismicImage.vue.d.ts +17 -23
  30. package/dist/src/PrismicImage.vue.d.ts.map +1 -1
  31. package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  32. package/dist/src/PrismicImage.vue_vue_type_script_setup_true_lang.js.map +1 -1
  33. package/dist/src/PrismicLink.cjs.map +1 -1
  34. package/dist/src/PrismicLink.js.map +1 -1
  35. package/dist/src/PrismicLink.vue.d.ts +5 -8
  36. package/dist/src/PrismicLink.vue.d.ts.map +1 -1
  37. package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs +6 -10
  38. package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  39. package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.js +6 -10
  40. package/dist/src/PrismicLink.vue_vue_type_script_setup_true_lang.js.map +1 -1
  41. package/dist/src/PrismicRichText/PrismicRichText.cjs.map +1 -1
  42. package/dist/src/PrismicRichText/PrismicRichText.js.map +1 -1
  43. package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts +9 -10
  44. package/dist/src/PrismicRichText/PrismicRichText.vue.d.ts.map +1 -1
  45. package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs +11 -5
  46. package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  47. package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js +11 -5
  48. package/dist/src/PrismicRichText/PrismicRichText.vue_vue_type_script_setup_true_lang.js.map +1 -1
  49. package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.cjs.map +1 -1
  50. package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.js.map +1 -1
  51. package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs +2 -2
  52. package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  53. package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js +2 -2
  54. package/dist/src/PrismicRichText/PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
  55. package/dist/src/PrismicRichText/PrismicRichTextSerialize.cjs.map +1 -1
  56. package/dist/src/PrismicRichText/PrismicRichTextSerialize.js.map +1 -1
  57. package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs +10 -4
  58. package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  59. package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js +11 -5
  60. package/dist/src/PrismicRichText/PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js.map +1 -1
  61. package/dist/src/PrismicRichText/index.d.ts +1 -1
  62. package/dist/src/PrismicRichText/types.d.ts +25 -26
  63. package/dist/src/PrismicRichText/types.d.ts.map +1 -1
  64. package/dist/src/PrismicTable/PrismicTable.cjs.map +1 -1
  65. package/dist/src/PrismicTable/PrismicTable.js.map +1 -1
  66. package/dist/src/PrismicTable/PrismicTable.vue.d.ts +5 -6
  67. package/dist/src/PrismicTable/PrismicTable.vue.d.ts.map +1 -1
  68. package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs +17 -9
  69. package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  70. package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js +17 -9
  71. package/dist/src/PrismicTable/PrismicTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  72. package/dist/src/PrismicTable/PrismicTableDefaultComponents.cjs +12 -30
  73. package/dist/src/PrismicTable/PrismicTableDefaultComponents.cjs.map +1 -1
  74. package/dist/src/PrismicTable/PrismicTableDefaultComponents.js +12 -30
  75. package/dist/src/PrismicTable/PrismicTableDefaultComponents.js.map +1 -1
  76. package/dist/src/PrismicTable/PrismicTableRow.cjs.map +1 -1
  77. package/dist/src/PrismicTable/PrismicTableRow.js.map +1 -1
  78. package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  79. package/dist/src/PrismicTable/PrismicTableRow.vue_vue_type_script_setup_true_lang.js.map +1 -1
  80. package/dist/src/PrismicTable/index.d.ts +1 -0
  81. package/dist/src/PrismicTable/types.d.ts +7 -8
  82. package/dist/src/PrismicTable/types.d.ts.map +1 -1
  83. package/dist/src/PrismicText.cjs.map +1 -1
  84. package/dist/src/PrismicText.js.map +1 -1
  85. package/dist/src/PrismicText.vue.d.ts +3 -5
  86. package/dist/src/PrismicText.vue.d.ts.map +1 -1
  87. package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  88. package/dist/src/PrismicText.vue_vue_type_script_setup_true_lang.js.map +1 -1
  89. package/dist/src/SliceZone/SliceZone.vue.d.ts +2 -2
  90. package/dist/src/SliceZone/types.d.ts +3 -9
  91. package/dist/src/SliceZone/types.d.ts.map +1 -1
  92. package/dist/src/createPrismic.cjs +33 -0
  93. package/dist/src/createPrismic.cjs.map +1 -0
  94. package/dist/src/createPrismic.d.ts +63 -0
  95. package/dist/src/createPrismic.d.ts.map +1 -0
  96. package/dist/src/createPrismic.js +32 -0
  97. package/dist/src/createPrismic.js.map +1 -0
  98. package/dist/src/lib/isInternalURL.cjs +2 -6
  99. package/dist/src/lib/isInternalURL.cjs.map +1 -1
  100. package/dist/src/lib/isInternalURL.js +2 -6
  101. package/dist/src/lib/isInternalURL.js.map +1 -1
  102. package/dist/src/types.cjs.map +1 -1
  103. package/dist/src/types.d.ts +11 -1
  104. package/dist/src/types.d.ts.map +1 -1
  105. package/dist/src/types.js.map +1 -1
  106. package/dist/types.d.cts +11 -1
  107. package/dist/types.d.cts.map +1 -1
  108. package/package.json +1 -3
  109. package/src/PrismicImage.vue +5 -8
  110. package/src/PrismicLink.vue +14 -14
  111. package/src/PrismicRichText/PrismicRichText.vue +24 -15
  112. package/src/PrismicRichText/PrismicRichTextDefaultComponent.vue +8 -4
  113. package/src/PrismicRichText/PrismicRichTextSerialize.vue +4 -3
  114. package/src/PrismicRichText/index.ts +1 -1
  115. package/src/PrismicRichText/types.ts +57 -29
  116. package/src/PrismicTable/PrismicTable.vue +27 -19
  117. package/src/PrismicTable/PrismicTableDefaultComponents.ts +14 -39
  118. package/src/PrismicTable/PrismicTableRow.vue +2 -2
  119. package/src/PrismicTable/index.ts +2 -0
  120. package/src/PrismicTable/types.ts +41 -23
  121. package/src/PrismicText.vue +1 -3
  122. package/src/SliceZone/types.ts +3 -9
  123. package/src/createPrismic.ts +86 -0
  124. package/src/index.ts +5 -1
  125. package/src/lib/isInternalURL.ts +2 -6
  126. package/src/types.ts +13 -1
@@ -1,4 +1,5 @@
1
1
  const require_types = require('../types.cjs');
2
+ const require_createPrismic = require('../createPrismic.cjs');
2
3
  const require_PrismicRichTextDefaultComponent = require('./PrismicRichTextDefaultComponent.cjs');
3
4
  const require_PrismicRichTextSerialize = require('./PrismicRichTextSerialize.cjs');
4
5
  let vue = require("vue");
@@ -20,18 +21,23 @@ var PrismicRichText_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
20
21
  },
21
22
  setup(__props) {
22
23
  const props = __props;
24
+ const { componentsConfig } = require_createPrismic.usePrismic();
25
+ const resolvedComponents = (0, vue.computed)(() => {
26
+ return {
27
+ ...componentsConfig?.defaultComponents,
28
+ ...props.components
29
+ };
30
+ });
23
31
  const children = (0, vue.computed)(() => {
24
32
  return (0, __prismicio_client_richtext.asTree)(props.field || []).children;
25
33
  });
26
34
  function getInternalComponent(type) {
27
- const maybeComponentOrShorthand = props.components?.[type];
35
+ const maybeComponentOrShorthand = resolvedComponents.value?.[type];
28
36
  if (require_types.isVueComponent(maybeComponentOrShorthand)) return { is: maybeComponentOrShorthand };
29
37
  return {
30
38
  is: require_PrismicRichTextDefaultComponent.default,
31
- props: {
32
- linkResolver: props.linkResolver,
33
- shorthand: maybeComponentOrShorthand
34
- }
39
+ linkResolver: props.linkResolver,
40
+ shorthand: maybeComponentOrShorthand
35
41
  };
36
42
  }
37
43
  const internalComponents = (0, vue.computed)(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicRichText.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n\tLinkResolverFunction,\n\tRichTextField,\n\tRichTextNodeType,\n} from \"@prismicio/client\"\nimport { asTree } from \"@prismicio/client/richtext\"\nimport type { PropType } from \"vue\"\nimport { computed } from \"vue\"\n\nimport { type ComponentOrTagName, isVueComponent } from \"../types\"\nimport type {\n\tInternalVueRichTextComponent,\n\tVueRichTextSerializer,\n\tVueShorthand,\n} from \"./types\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\nimport PrismicRichTextSerialize from \"./PrismicRichTextSerialize.vue\"\n\n/**\n * Props for `<PrismicRichText />`.\n */\nexport type PrismicRichTextProps = {\n\t/** The Prismic rich text field to render. */\n\tfield: RichTextField | null | undefined\n\n\t/**\n\t * The link resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses route resolvers when querying for your Prismic\n\t * repository's content, a link resolver does not need to be provided.\n\t *\n\t * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * An object that maps a rich text block type to a Vue component or a shorthand definition.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * heading1: Heading1,\n\t * paragraph: { class: 'prose'},\n\t * strong: { as: 'em', class: 'font-bold' },\n\t * }\n\t * ```\n\t */\n\tcomponents?: VueRichTextSerializer\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\n// We're forced to declare props using the JavaScript syntax because `@vue/compiler-sfc`\n// has limitations for inferring types from complex objects.\nconst props = defineProps({\n\tfield: {\n\t\ttype: Array as unknown as PropType<PrismicRichTextProps[\"field\"]>,\n\t},\n\tlinkResolver: {\n\t\ttype: Function as PropType<PrismicRichTextProps[\"linkResolver\"]>,\n\t},\n\tcomponents: {\n\t\ttype: Object as PropType<PrismicRichTextProps[\"components\"]>,\n\t},\n\tfallback: {\n\t\ttype: [String, Object, Function] as PropType<\n\t\t\tPrismicRichTextProps[\"fallback\"]\n\t\t>,\n\t},\n})\ndefineOptions({ name: \"PrismicRichText\" })\n\nconst children = computed(() => {\n\treturn asTree(props.field || []).children\n})\n\nfunction getInternalComponent(type: keyof typeof RichTextNodeType) {\n\tconst maybeComponentOrShorthand = props.components?.[type]\n\n\tif (isVueComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: PrismicRichTextDefaultComponent,\n\t\tprops: {\n\t\t\tlinkResolver: props.linkResolver,\n\t\t\tshorthand: maybeComponentOrShorthand as VueShorthand,\n\t\t},\n\t}\n}\n\nconst internalComponents = computed<InternalVueRichTextComponent>(() => {\n\treturn {\n\t\theading1: getInternalComponent(\"heading1\"),\n\t\theading2: getInternalComponent(\"heading2\"),\n\t\theading3: getInternalComponent(\"heading3\"),\n\t\theading4: getInternalComponent(\"heading4\"),\n\t\theading5: getInternalComponent(\"heading5\"),\n\t\theading6: getInternalComponent(\"heading6\"),\n\t\tparagraph: getInternalComponent(\"paragraph\"),\n\t\tpreformatted: getInternalComponent(\"preformatted\"),\n\t\tstrong: getInternalComponent(\"strong\"),\n\t\tem: getInternalComponent(\"em\"),\n\t\t\"list-item\": getInternalComponent(\"listItem\"),\n\t\t\"o-list-item\": getInternalComponent(\"oListItem\"),\n\t\t\"group-list-item\": getInternalComponent(\"list\"),\n\t\t\"group-o-list-item\": getInternalComponent(\"oList\"),\n\t\timage: getInternalComponent(\"image\"),\n\t\tembed: getInternalComponent(\"embed\"),\n\t\thyperlink: getInternalComponent(\"hyperlink\"),\n\t\tlabel: getInternalComponent(\"label\"),\n\t\tspan: getInternalComponent(\"span\"),\n\t}\n})\n</script>\n\n<template>\n\t<PrismicRichTextSerialize\n\t\tv-if=\"children.length\"\n\t\t:children=\"children\"\n\t\t:internal-components=\"internalComponents\"\n\t/>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EA8DA,MAAM,QAAQ;EAkBd,MAAM,mCAA0B;AAC/B,kDAAc,MAAM,SAAS,EAAE,CAAC,CAAC;IACjC;EAED,SAAS,qBAAqB,MAAqC;GAClE,MAAM,4BAA4B,MAAM,aAAa;AAErD,OAAI,6BAAe,0BAA0B,CAC5C,QAAO,EAAE,IAAI,2BAA0B;AAGxC,UAAO;IACN,IAAI;IACJ,OAAO;KACN,cAAc,MAAM;KACpB,WAAW;KACX;IACF;;EAGD,MAAM,6CAAkE;AACvE,UAAO;IACN,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,WAAW,qBAAqB,YAAY;IAC5C,cAAc,qBAAqB,eAAe;IAClD,QAAQ,qBAAqB,SAAS;IACtC,IAAI,qBAAqB,KAAK;IAC9B,aAAa,qBAAqB,WAAW;IAC7C,eAAe,qBAAqB,YAAY;IAChD,mBAAmB,qBAAqB,OAAO;IAC/C,qBAAqB,qBAAqB,QAAQ;IAClD,OAAO,qBAAqB,QAAQ;IACpC,OAAO,qBAAqB,QAAQ;IACpC,WAAW,qBAAqB,YAAY;IAC5C,OAAO,qBAAqB,QAAQ;IACpC,MAAM,qBAAqB,OAAO;IACnC;IACA;;UAKO,SAAA,MAAS,qDAGd,0CAAA;;IAFA,UAAU,SAAA;IACV,uBAAqB,mBAAA;uDAED,QAAA,wFAAe,QAAA,SAAQ,EAAA,EAAA,KAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"PrismicRichText.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n\tLinkResolverFunction,\n\tRichTextField,\n\tRichTextNodeType,\n} from \"@prismicio/client\"\nimport { asTree } from \"@prismicio/client/richtext\"\nimport type { PropType } from \"vue\"\nimport { computed } from \"vue\"\n\nimport type { ComponentOrTagName, VueComponentShorthand } from \"../types\"\nimport { isVueComponent } from \"../types\"\nimport type {\n\tInternalVueRichTextComponents,\n\tVueRichTextComponent,\n\tVueRichTextComponents,\n} from \"./types\"\n\nimport { usePrismic } from \"../createPrismic\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\nimport PrismicRichTextSerialize from \"./PrismicRichTextSerialize.vue\"\n\n/** Props for `<PrismicRichText />`. */\nexport type PrismicRichTextProps = {\n\t/** The Prismic rich text field to render. */\n\tfield: RichTextField | null | undefined\n\n\t/**\n\t * The link resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses route resolvers when querying for your Prismic\n\t * repository's content, a link resolver does not need to be provided.\n\t *\n\t * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * An object that maps a rich text block type to a Vue component or a\n\t * shorthand definition.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * heading1: Heading1,\n\t * paragraph: { class: 'prose'},\n\t * strong: { as: 'em', class: 'font-bold' },\n\t * }\n\t * ```\n\t */\n\tcomponents?: VueRichTextComponents\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\n// We're forced to declare props using the JavaScript syntax because `@vue/compiler-sfc`\n// has limitations for inferring types from complex objects.\nconst props = defineProps({\n\tfield: {\n\t\ttype: Array as unknown as PropType<PrismicRichTextProps[\"field\"]>,\n\t},\n\tlinkResolver: {\n\t\ttype: Function as PropType<PrismicRichTextProps[\"linkResolver\"]>,\n\t},\n\tcomponents: {\n\t\ttype: Object as PropType<PrismicRichTextProps[\"components\"]>,\n\t},\n\tfallback: {\n\t\ttype: [String, Object, Function] as PropType<\n\t\t\tPrismicRichTextProps[\"fallback\"]\n\t\t>,\n\t},\n})\ndefineOptions({ name: \"PrismicRichText\" })\n\nconst { componentsConfig } = usePrismic()\n\nconst resolvedComponents = computed<VueRichTextComponents>(() => {\n\treturn { ...componentsConfig?.defaultComponents, ...props.components }\n})\n\nconst children = computed(() => {\n\treturn asTree(props.field || []).children\n})\n\nfunction getInternalComponent(type: keyof typeof RichTextNodeType) {\n\tconst maybeComponentOrShorthand = resolvedComponents.value?.[type] as\n\t\t| VueRichTextComponent\n\t\t| VueComponentShorthand\n\t\t| undefined\n\n\tif (isVueComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: PrismicRichTextDefaultComponent,\n\t\tlinkResolver: props.linkResolver,\n\t\tshorthand: maybeComponentOrShorthand,\n\t}\n}\n\nconst internalComponents = computed<InternalVueRichTextComponents>(() => {\n\treturn {\n\t\theading1: getInternalComponent(\"heading1\"),\n\t\theading2: getInternalComponent(\"heading2\"),\n\t\theading3: getInternalComponent(\"heading3\"),\n\t\theading4: getInternalComponent(\"heading4\"),\n\t\theading5: getInternalComponent(\"heading5\"),\n\t\theading6: getInternalComponent(\"heading6\"),\n\t\tparagraph: getInternalComponent(\"paragraph\"),\n\t\tpreformatted: getInternalComponent(\"preformatted\"),\n\t\tstrong: getInternalComponent(\"strong\"),\n\t\tem: getInternalComponent(\"em\"),\n\t\t\"list-item\": getInternalComponent(\"listItem\"),\n\t\t\"o-list-item\": getInternalComponent(\"oListItem\"),\n\t\t\"group-list-item\": getInternalComponent(\"list\"),\n\t\t\"group-o-list-item\": getInternalComponent(\"oList\"),\n\t\timage: getInternalComponent(\"image\"),\n\t\tembed: getInternalComponent(\"embed\"),\n\t\thyperlink: getInternalComponent(\"hyperlink\"),\n\t\tlabel: getInternalComponent(\"label\"),\n\t\tspan: getInternalComponent(\"span\"),\n\t}\n})\n</script>\n\n<template>\n\t<PrismicRichTextSerialize\n\t\tv-if=\"children.length\"\n\t\t:children=\"children\"\n\t\t:internal-components=\"internalComponents\"\n\t/>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAgEA,MAAM,QAAQ;EAkBd,MAAM,EAAE,qBAAqB,kCAAW;EAExC,MAAM,6CAA2D;AAChE,UAAO;IAAE,GAAG,kBAAkB;IAAmB,GAAG,MAAM;IAAW;IACrE;EAED,MAAM,mCAA0B;AAC/B,kDAAc,MAAM,SAAS,EAAE,CAAC,CAAC;IACjC;EAED,SAAS,qBAAqB,MAAqC;GAClE,MAAM,4BAA4B,mBAAmB,QAAQ;AAK7D,OAAI,6BAAe,0BAA0B,CAC5C,QAAO,EAAE,IAAI,2BAA0B;AAGxC,UAAO;IACN,IAAI;IACJ,cAAc,MAAM;IACpB,WAAW;IACZ;;EAGD,MAAM,6CAAmE;AACxE,UAAO;IACN,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,WAAW,qBAAqB,YAAY;IAC5C,cAAc,qBAAqB,eAAe;IAClD,QAAQ,qBAAqB,SAAS;IACtC,IAAI,qBAAqB,KAAK;IAC9B,aAAa,qBAAqB,WAAW;IAC7C,eAAe,qBAAqB,YAAY;IAChD,mBAAmB,qBAAqB,OAAO;IAC/C,qBAAqB,qBAAqB,QAAQ;IAClD,OAAO,qBAAqB,QAAQ;IACpC,OAAO,qBAAqB,QAAQ;IACpC,WAAW,qBAAqB,YAAY;IAC5C,OAAO,qBAAqB,QAAQ;IACpC,MAAM,qBAAqB,OAAO;IACnC;IACA;;UAKO,SAAA,MAAS,qDAGd,0CAAA;;IAFA,UAAU,SAAA;IACV,uBAAqB,mBAAA;uDAED,QAAA,wFAAe,QAAA,SAAQ,EAAA,EAAA,KAAA,GAAA,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { isVueComponent } from "../types.js";
2
+ import { usePrismic } from "../createPrismic.js";
2
3
  import PrismicRichTextDefaultComponent_default from "./PrismicRichTextDefaultComponent.js";
3
4
  import PrismicRichTextSerialize_default from "./PrismicRichTextSerialize.js";
4
5
  import { computed, createBlock, createCommentVNode, defineComponent, openBlock, resolveDynamicComponent } from "vue";
@@ -20,18 +21,23 @@ var PrismicRichText_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
20
21
  },
21
22
  setup(__props) {
22
23
  const props = __props;
24
+ const { componentsConfig } = usePrismic();
25
+ const resolvedComponents = computed(() => {
26
+ return {
27
+ ...componentsConfig?.defaultComponents,
28
+ ...props.components
29
+ };
30
+ });
23
31
  const children = computed(() => {
24
32
  return asTree(props.field || []).children;
25
33
  });
26
34
  function getInternalComponent(type) {
27
- const maybeComponentOrShorthand = props.components?.[type];
35
+ const maybeComponentOrShorthand = resolvedComponents.value?.[type];
28
36
  if (isVueComponent(maybeComponentOrShorthand)) return { is: maybeComponentOrShorthand };
29
37
  return {
30
38
  is: PrismicRichTextDefaultComponent_default,
31
- props: {
32
- linkResolver: props.linkResolver,
33
- shorthand: maybeComponentOrShorthand
34
- }
39
+ linkResolver: props.linkResolver,
40
+ shorthand: maybeComponentOrShorthand
35
41
  };
36
42
  }
37
43
  const internalComponents = computed(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicRichText.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n\tLinkResolverFunction,\n\tRichTextField,\n\tRichTextNodeType,\n} from \"@prismicio/client\"\nimport { asTree } from \"@prismicio/client/richtext\"\nimport type { PropType } from \"vue\"\nimport { computed } from \"vue\"\n\nimport { type ComponentOrTagName, isVueComponent } from \"../types\"\nimport type {\n\tInternalVueRichTextComponent,\n\tVueRichTextSerializer,\n\tVueShorthand,\n} from \"./types\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\nimport PrismicRichTextSerialize from \"./PrismicRichTextSerialize.vue\"\n\n/**\n * Props for `<PrismicRichText />`.\n */\nexport type PrismicRichTextProps = {\n\t/** The Prismic rich text field to render. */\n\tfield: RichTextField | null | undefined\n\n\t/**\n\t * The link resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses route resolvers when querying for your Prismic\n\t * repository's content, a link resolver does not need to be provided.\n\t *\n\t * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * An object that maps a rich text block type to a Vue component or a shorthand definition.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * heading1: Heading1,\n\t * paragraph: { class: 'prose'},\n\t * strong: { as: 'em', class: 'font-bold' },\n\t * }\n\t * ```\n\t */\n\tcomponents?: VueRichTextSerializer\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\n// We're forced to declare props using the JavaScript syntax because `@vue/compiler-sfc`\n// has limitations for inferring types from complex objects.\nconst props = defineProps({\n\tfield: {\n\t\ttype: Array as unknown as PropType<PrismicRichTextProps[\"field\"]>,\n\t},\n\tlinkResolver: {\n\t\ttype: Function as PropType<PrismicRichTextProps[\"linkResolver\"]>,\n\t},\n\tcomponents: {\n\t\ttype: Object as PropType<PrismicRichTextProps[\"components\"]>,\n\t},\n\tfallback: {\n\t\ttype: [String, Object, Function] as PropType<\n\t\t\tPrismicRichTextProps[\"fallback\"]\n\t\t>,\n\t},\n})\ndefineOptions({ name: \"PrismicRichText\" })\n\nconst children = computed(() => {\n\treturn asTree(props.field || []).children\n})\n\nfunction getInternalComponent(type: keyof typeof RichTextNodeType) {\n\tconst maybeComponentOrShorthand = props.components?.[type]\n\n\tif (isVueComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: PrismicRichTextDefaultComponent,\n\t\tprops: {\n\t\t\tlinkResolver: props.linkResolver,\n\t\t\tshorthand: maybeComponentOrShorthand as VueShorthand,\n\t\t},\n\t}\n}\n\nconst internalComponents = computed<InternalVueRichTextComponent>(() => {\n\treturn {\n\t\theading1: getInternalComponent(\"heading1\"),\n\t\theading2: getInternalComponent(\"heading2\"),\n\t\theading3: getInternalComponent(\"heading3\"),\n\t\theading4: getInternalComponent(\"heading4\"),\n\t\theading5: getInternalComponent(\"heading5\"),\n\t\theading6: getInternalComponent(\"heading6\"),\n\t\tparagraph: getInternalComponent(\"paragraph\"),\n\t\tpreformatted: getInternalComponent(\"preformatted\"),\n\t\tstrong: getInternalComponent(\"strong\"),\n\t\tem: getInternalComponent(\"em\"),\n\t\t\"list-item\": getInternalComponent(\"listItem\"),\n\t\t\"o-list-item\": getInternalComponent(\"oListItem\"),\n\t\t\"group-list-item\": getInternalComponent(\"list\"),\n\t\t\"group-o-list-item\": getInternalComponent(\"oList\"),\n\t\timage: getInternalComponent(\"image\"),\n\t\tembed: getInternalComponent(\"embed\"),\n\t\thyperlink: getInternalComponent(\"hyperlink\"),\n\t\tlabel: getInternalComponent(\"label\"),\n\t\tspan: getInternalComponent(\"span\"),\n\t}\n})\n</script>\n\n<template>\n\t<PrismicRichTextSerialize\n\t\tv-if=\"children.length\"\n\t\t:children=\"children\"\n\t\t:internal-components=\"internalComponents\"\n\t/>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EA8DA,MAAM,QAAQ;EAkBd,MAAM,WAAW,eAAe;AAC/B,UAAO,OAAO,MAAM,SAAS,EAAE,CAAC,CAAC;IACjC;EAED,SAAS,qBAAqB,MAAqC;GAClE,MAAM,4BAA4B,MAAM,aAAa;AAErD,OAAI,eAAe,0BAA0B,CAC5C,QAAO,EAAE,IAAI,2BAA0B;AAGxC,UAAO;IACN,IAAI;IACJ,OAAO;KACN,cAAc,MAAM;KACpB,WAAW;KACX;IACF;;EAGD,MAAM,qBAAqB,eAA6C;AACvE,UAAO;IACN,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,WAAW,qBAAqB,YAAY;IAC5C,cAAc,qBAAqB,eAAe;IAClD,QAAQ,qBAAqB,SAAS;IACtC,IAAI,qBAAqB,KAAK;IAC9B,aAAa,qBAAqB,WAAW;IAC7C,eAAe,qBAAqB,YAAY;IAChD,mBAAmB,qBAAqB,OAAO;IAC/C,qBAAqB,qBAAqB,QAAQ;IAClD,OAAO,qBAAqB,QAAQ;IACpC,OAAO,qBAAqB,QAAQ;IACpC,WAAW,qBAAqB,YAAY;IAC5C,OAAO,qBAAqB,QAAQ;IACpC,MAAM,qBAAqB,OAAO;IACnC;IACA;;UAKO,SAAA,MAAS,uBADhB,YAIE,kCAAA;;IAFA,UAAU,SAAA;IACV,uBAAqB,mBAAA;uDAED,QAAA,yBAAtB,YAAiD,wBAAZ,QAAA,SAAQ,EAAA,EAAA,KAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"PrismicRichText.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n\tLinkResolverFunction,\n\tRichTextField,\n\tRichTextNodeType,\n} from \"@prismicio/client\"\nimport { asTree } from \"@prismicio/client/richtext\"\nimport type { PropType } from \"vue\"\nimport { computed } from \"vue\"\n\nimport type { ComponentOrTagName, VueComponentShorthand } from \"../types\"\nimport { isVueComponent } from \"../types\"\nimport type {\n\tInternalVueRichTextComponents,\n\tVueRichTextComponent,\n\tVueRichTextComponents,\n} from \"./types\"\n\nimport { usePrismic } from \"../createPrismic\"\n\nimport PrismicRichTextDefaultComponent from \"./PrismicRichTextDefaultComponent.vue\"\nimport PrismicRichTextSerialize from \"./PrismicRichTextSerialize.vue\"\n\n/** Props for `<PrismicRichText />`. */\nexport type PrismicRichTextProps = {\n\t/** The Prismic rich text field to render. */\n\tfield: RichTextField | null | undefined\n\n\t/**\n\t * The link resolver used to resolve links.\n\t *\n\t * @remarks\n\t * If your app uses route resolvers when querying for your Prismic\n\t * repository's content, a link resolver does not need to be provided.\n\t *\n\t * @see Learn about link resolvers and route resolvers {@link https://prismic.io/docs/routes}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * An object that maps a rich text block type to a Vue component or a\n\t * shorthand definition.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * heading1: Heading1,\n\t * paragraph: { class: 'prose'},\n\t * strong: { as: 'em', class: 'font-bold' },\n\t * }\n\t * ```\n\t */\n\tcomponents?: VueRichTextComponents\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\n// We're forced to declare props using the JavaScript syntax because `@vue/compiler-sfc`\n// has limitations for inferring types from complex objects.\nconst props = defineProps({\n\tfield: {\n\t\ttype: Array as unknown as PropType<PrismicRichTextProps[\"field\"]>,\n\t},\n\tlinkResolver: {\n\t\ttype: Function as PropType<PrismicRichTextProps[\"linkResolver\"]>,\n\t},\n\tcomponents: {\n\t\ttype: Object as PropType<PrismicRichTextProps[\"components\"]>,\n\t},\n\tfallback: {\n\t\ttype: [String, Object, Function] as PropType<\n\t\t\tPrismicRichTextProps[\"fallback\"]\n\t\t>,\n\t},\n})\ndefineOptions({ name: \"PrismicRichText\" })\n\nconst { componentsConfig } = usePrismic()\n\nconst resolvedComponents = computed<VueRichTextComponents>(() => {\n\treturn { ...componentsConfig?.defaultComponents, ...props.components }\n})\n\nconst children = computed(() => {\n\treturn asTree(props.field || []).children\n})\n\nfunction getInternalComponent(type: keyof typeof RichTextNodeType) {\n\tconst maybeComponentOrShorthand = resolvedComponents.value?.[type] as\n\t\t| VueRichTextComponent\n\t\t| VueComponentShorthand\n\t\t| undefined\n\n\tif (isVueComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: PrismicRichTextDefaultComponent,\n\t\tlinkResolver: props.linkResolver,\n\t\tshorthand: maybeComponentOrShorthand,\n\t}\n}\n\nconst internalComponents = computed<InternalVueRichTextComponents>(() => {\n\treturn {\n\t\theading1: getInternalComponent(\"heading1\"),\n\t\theading2: getInternalComponent(\"heading2\"),\n\t\theading3: getInternalComponent(\"heading3\"),\n\t\theading4: getInternalComponent(\"heading4\"),\n\t\theading5: getInternalComponent(\"heading5\"),\n\t\theading6: getInternalComponent(\"heading6\"),\n\t\tparagraph: getInternalComponent(\"paragraph\"),\n\t\tpreformatted: getInternalComponent(\"preformatted\"),\n\t\tstrong: getInternalComponent(\"strong\"),\n\t\tem: getInternalComponent(\"em\"),\n\t\t\"list-item\": getInternalComponent(\"listItem\"),\n\t\t\"o-list-item\": getInternalComponent(\"oListItem\"),\n\t\t\"group-list-item\": getInternalComponent(\"list\"),\n\t\t\"group-o-list-item\": getInternalComponent(\"oList\"),\n\t\timage: getInternalComponent(\"image\"),\n\t\tembed: getInternalComponent(\"embed\"),\n\t\thyperlink: getInternalComponent(\"hyperlink\"),\n\t\tlabel: getInternalComponent(\"label\"),\n\t\tspan: getInternalComponent(\"span\"),\n\t}\n})\n</script>\n\n<template>\n\t<PrismicRichTextSerialize\n\t\tv-if=\"children.length\"\n\t\t:children=\"children\"\n\t\t:internal-components=\"internalComponents\"\n\t/>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAgEA,MAAM,QAAQ;EAkBd,MAAM,EAAE,qBAAqB,YAAW;EAExC,MAAM,qBAAqB,eAAsC;AAChE,UAAO;IAAE,GAAG,kBAAkB;IAAmB,GAAG,MAAM;IAAW;IACrE;EAED,MAAM,WAAW,eAAe;AAC/B,UAAO,OAAO,MAAM,SAAS,EAAE,CAAC,CAAC;IACjC;EAED,SAAS,qBAAqB,MAAqC;GAClE,MAAM,4BAA4B,mBAAmB,QAAQ;AAK7D,OAAI,eAAe,0BAA0B,CAC5C,QAAO,EAAE,IAAI,2BAA0B;AAGxC,UAAO;IACN,IAAI;IACJ,cAAc,MAAM;IACpB,WAAW;IACZ;;EAGD,MAAM,qBAAqB,eAA8C;AACxE,UAAO;IACN,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,UAAU,qBAAqB,WAAW;IAC1C,WAAW,qBAAqB,YAAY;IAC5C,cAAc,qBAAqB,eAAe;IAClD,QAAQ,qBAAqB,SAAS;IACtC,IAAI,qBAAqB,KAAK;IAC9B,aAAa,qBAAqB,WAAW;IAC7C,eAAe,qBAAqB,YAAY;IAChD,mBAAmB,qBAAqB,OAAO;IAC/C,qBAAqB,qBAAqB,QAAQ;IAClD,OAAO,qBAAqB,QAAQ;IACpC,OAAO,qBAAqB,QAAQ;IACpC,WAAW,qBAAqB,YAAY;IAC5C,OAAO,qBAAqB,QAAQ;IACpC,MAAM,qBAAqB,OAAO;IACnC;IACA;;UAKO,SAAA,MAAS,uBADhB,YAIE,kCAAA;;IAFA,UAAU,SAAA;IACV,uBAAqB,mBAAA;uDAED,QAAA,yBAAtB,YAAiD,wBAAZ,QAAA,SAAQ,EAAA,EAAA,KAAA,GAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicRichTextDefaultComponent.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { RichTextComponentProps, VueShorthand } from \"./types\"\n\nimport PrismicImage from \"../PrismicImage.vue\"\nimport PrismicLink from \"../PrismicLink.vue\"\n\nconst props = defineProps<\n\tRichTextComponentProps & {\n\t\tlinkResolver?: LinkResolverFunction\n\t\tshorthand?: VueShorthand\n\t}\n>()\ndefineOptions({ name: \"PrismicRichTextDefaultComponent\" })\n\nconst as = computed(() => {\n\treturn props.node.type !== \"image\" && props.node.type !== \"span\"\n\t\t? props.shorthand?.as\n\t\t: undefined\n})\n\nconst attrs = computed(() => {\n\tconst { as, ...attrs } = props.shorthand ?? {}\n\n\treturn attrs\n})\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<component v-if=\"as\" :is=\"as\" :dir=\"dir\" v-bind=\"attrs\"><slot /></component>\n\t<h1 v-else-if=\"node.type === 'heading1'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h1>\n\t<h2 v-else-if=\"node.type === 'heading2'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h2>\n\t<h3 v-else-if=\"node.type === 'heading3'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h3>\n\t<h4 v-else-if=\"node.type === 'heading4'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h4>\n\t<h5 v-else-if=\"node.type === 'heading5'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h5>\n\t<h6 v-else-if=\"node.type === 'heading6'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h6>\n\t<p v-else-if=\"node.type === 'paragraph'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</p>\n\t<pre v-else-if=\"node.type === 'preformatted'\" v-bind=\"attrs\"><slot /></pre>\n\t<strong v-else-if=\"node.type === 'strong'\" v-bind=\"attrs\"><slot /></strong>\n\t<em v-else-if=\"node.type === 'em'\" v-bind=\"attrs\"><slot /></em>\n\t<li v-else-if=\"node.type === 'list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<li v-else-if=\"node.type === 'o-list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<ul v-else-if=\"node.type === 'group-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ul>\n\t<ol v-else-if=\"node.type === 'group-o-list-item'\" v-bind=\"attrs\">\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\" v-bind=\"attrs\" />\n\t</p>\n\t<div\n\t\tv-else-if=\"node.type === 'embed'\"\n\t\t:data-oembed=\"node.oembed.embed_url\"\n\t\t:data-oembed-type=\"node.oembed.type\"\n\t\t:data-oembed-provider=\"node.oembed.provider_name\"\n\t\tv-html=\"node.oembed.html\"\n\t\tv-bind=\"attrs\"\n\t/>\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\tv-bind=\"attrs\"\n\t\t><slot\n\t/></PrismicLink>\n\t<span\n\t\tv-else-if=\"node.type === 'label'\"\n\t\t:class=\"node.data.label\"\n\t\tv-bind=\"attrs\"\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"],"mappings":""}
1
+ {"version":3,"file":"PrismicRichTextDefaultComponent.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { VueComponentShorthand } from \"../types\"\nimport type { RichTextComponentProps } from \"./types\"\n\nimport PrismicImage from \"../PrismicImage.vue\"\nimport PrismicLink from \"../PrismicLink.vue\"\n\nconst props = defineProps<\n\tRichTextComponentProps & {\n\t\tlinkResolver?: LinkResolverFunction\n\t\tshorthand?: VueComponentShorthand\n\t}\n>()\ndefineOptions({ name: \"PrismicRichTextDefaultComponent\" })\n\nconst as = computed(() => {\n\treturn props.node.type !== \"image\" &&\n\t\tprops.node.type !== \"hyperlink\" &&\n\t\tprops.node.type !== \"label\" &&\n\t\tprops.node.type !== \"span\"\n\t\t? props.shorthand?.as\n\t\t: undefined\n})\n\nconst attrs = computed(() => {\n\tconst { as, ...attrs } = props.shorthand ?? {}\n\n\treturn attrs\n})\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<component v-if=\"as\" :is=\"as\" :dir=\"dir\" v-bind=\"attrs\"><slot /></component>\n\t<h1 v-else-if=\"node.type === 'heading1'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h1>\n\t<h2 v-else-if=\"node.type === 'heading2'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h2>\n\t<h3 v-else-if=\"node.type === 'heading3'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h3>\n\t<h4 v-else-if=\"node.type === 'heading4'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h4>\n\t<h5 v-else-if=\"node.type === 'heading5'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h5>\n\t<h6 v-else-if=\"node.type === 'heading6'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h6>\n\t<p v-else-if=\"node.type === 'paragraph'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</p>\n\t<pre v-else-if=\"node.type === 'preformatted'\" v-bind=\"attrs\"><slot /></pre>\n\t<strong v-else-if=\"node.type === 'strong'\" v-bind=\"attrs\"><slot /></strong>\n\t<em v-else-if=\"node.type === 'em'\" v-bind=\"attrs\"><slot /></em>\n\t<li v-else-if=\"node.type === 'list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<li v-else-if=\"node.type === 'o-list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<ul v-else-if=\"node.type === 'group-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ul>\n\t<ol v-else-if=\"node.type === 'group-o-list-item'\" v-bind=\"attrs\">\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\" v-bind=\"attrs\"\n\t\t/></PrismicLink>\n\t\t<PrismicImage v-else :field=\"node\" v-bind=\"attrs\" />\n\t</p>\n\t<div\n\t\tv-else-if=\"node.type === 'embed'\"\n\t\t:data-oembed=\"node.oembed.embed_url\"\n\t\t:data-oembed-type=\"node.oembed.type\"\n\t\t:data-oembed-provider=\"node.oembed.provider_name\"\n\t\tv-html=\"node.oembed.html\"\n\t\tv-bind=\"attrs\"\n\t/>\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\tv-bind=\"attrs\"\n\t\t><slot\n\t/></PrismicLink>\n\t<span\n\t\tv-else-if=\"node.type === 'label'\"\n\t\t:class=\"node.data.label\"\n\t\tv-bind=\"attrs\"\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"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicRichTextDefaultComponent.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { RichTextComponentProps, VueShorthand } from \"./types\"\n\nimport PrismicImage from \"../PrismicImage.vue\"\nimport PrismicLink from \"../PrismicLink.vue\"\n\nconst props = defineProps<\n\tRichTextComponentProps & {\n\t\tlinkResolver?: LinkResolverFunction\n\t\tshorthand?: VueShorthand\n\t}\n>()\ndefineOptions({ name: \"PrismicRichTextDefaultComponent\" })\n\nconst as = computed(() => {\n\treturn props.node.type !== \"image\" && props.node.type !== \"span\"\n\t\t? props.shorthand?.as\n\t\t: undefined\n})\n\nconst attrs = computed(() => {\n\tconst { as, ...attrs } = props.shorthand ?? {}\n\n\treturn attrs\n})\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<component v-if=\"as\" :is=\"as\" :dir=\"dir\" v-bind=\"attrs\"><slot /></component>\n\t<h1 v-else-if=\"node.type === 'heading1'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h1>\n\t<h2 v-else-if=\"node.type === 'heading2'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h2>\n\t<h3 v-else-if=\"node.type === 'heading3'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h3>\n\t<h4 v-else-if=\"node.type === 'heading4'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h4>\n\t<h5 v-else-if=\"node.type === 'heading5'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h5>\n\t<h6 v-else-if=\"node.type === 'heading6'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h6>\n\t<p v-else-if=\"node.type === 'paragraph'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</p>\n\t<pre v-else-if=\"node.type === 'preformatted'\" v-bind=\"attrs\"><slot /></pre>\n\t<strong v-else-if=\"node.type === 'strong'\" v-bind=\"attrs\"><slot /></strong>\n\t<em v-else-if=\"node.type === 'em'\" v-bind=\"attrs\"><slot /></em>\n\t<li v-else-if=\"node.type === 'list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<li v-else-if=\"node.type === 'o-list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<ul v-else-if=\"node.type === 'group-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ul>\n\t<ol v-else-if=\"node.type === 'group-o-list-item'\" v-bind=\"attrs\">\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\" v-bind=\"attrs\" />\n\t</p>\n\t<div\n\t\tv-else-if=\"node.type === 'embed'\"\n\t\t:data-oembed=\"node.oembed.embed_url\"\n\t\t:data-oembed-type=\"node.oembed.type\"\n\t\t:data-oembed-provider=\"node.oembed.provider_name\"\n\t\tv-html=\"node.oembed.html\"\n\t\tv-bind=\"attrs\"\n\t/>\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\tv-bind=\"attrs\"\n\t\t><slot\n\t/></PrismicLink>\n\t<span\n\t\tv-else-if=\"node.type === 'label'\"\n\t\t:class=\"node.data.label\"\n\t\tv-bind=\"attrs\"\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"],"mappings":""}
1
+ {"version":3,"file":"PrismicRichTextDefaultComponent.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { VueComponentShorthand } from \"../types\"\nimport type { RichTextComponentProps } from \"./types\"\n\nimport PrismicImage from \"../PrismicImage.vue\"\nimport PrismicLink from \"../PrismicLink.vue\"\n\nconst props = defineProps<\n\tRichTextComponentProps & {\n\t\tlinkResolver?: LinkResolverFunction\n\t\tshorthand?: VueComponentShorthand\n\t}\n>()\ndefineOptions({ name: \"PrismicRichTextDefaultComponent\" })\n\nconst as = computed(() => {\n\treturn props.node.type !== \"image\" &&\n\t\tprops.node.type !== \"hyperlink\" &&\n\t\tprops.node.type !== \"label\" &&\n\t\tprops.node.type !== \"span\"\n\t\t? props.shorthand?.as\n\t\t: undefined\n})\n\nconst attrs = computed(() => {\n\tconst { as, ...attrs } = props.shorthand ?? {}\n\n\treturn attrs\n})\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<component v-if=\"as\" :is=\"as\" :dir=\"dir\" v-bind=\"attrs\"><slot /></component>\n\t<h1 v-else-if=\"node.type === 'heading1'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h1>\n\t<h2 v-else-if=\"node.type === 'heading2'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h2>\n\t<h3 v-else-if=\"node.type === 'heading3'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h3>\n\t<h4 v-else-if=\"node.type === 'heading4'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h4>\n\t<h5 v-else-if=\"node.type === 'heading5'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h5>\n\t<h6 v-else-if=\"node.type === 'heading6'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h6>\n\t<p v-else-if=\"node.type === 'paragraph'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</p>\n\t<pre v-else-if=\"node.type === 'preformatted'\" v-bind=\"attrs\"><slot /></pre>\n\t<strong v-else-if=\"node.type === 'strong'\" v-bind=\"attrs\"><slot /></strong>\n\t<em v-else-if=\"node.type === 'em'\" v-bind=\"attrs\"><slot /></em>\n\t<li v-else-if=\"node.type === 'list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<li v-else-if=\"node.type === 'o-list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<ul v-else-if=\"node.type === 'group-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ul>\n\t<ol v-else-if=\"node.type === 'group-o-list-item'\" v-bind=\"attrs\">\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\" v-bind=\"attrs\"\n\t\t/></PrismicLink>\n\t\t<PrismicImage v-else :field=\"node\" v-bind=\"attrs\" />\n\t</p>\n\t<div\n\t\tv-else-if=\"node.type === 'embed'\"\n\t\t:data-oembed=\"node.oembed.embed_url\"\n\t\t:data-oembed-type=\"node.oembed.type\"\n\t\t:data-oembed-provider=\"node.oembed.provider_name\"\n\t\tv-html=\"node.oembed.html\"\n\t\tv-bind=\"attrs\"\n\t/>\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\tv-bind=\"attrs\"\n\t\t><slot\n\t/></PrismicLink>\n\t<span\n\t\tv-else-if=\"node.type === 'label'\"\n\t\t:class=\"node.data.label\"\n\t\tv-bind=\"attrs\"\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"],"mappings":""}
@@ -43,7 +43,7 @@ var PrismicRichTextDefaultComponent_vue_vue_type_script_setup_true_lang_default
43
43
  setup(__props) {
44
44
  const props = __props;
45
45
  const as = (0, vue.computed)(() => {
46
- return props.node.type !== "image" && props.node.type !== "span" ? props.shorthand?.as : void 0;
46
+ return props.node.type !== "image" && props.node.type !== "hyperlink" && props.node.type !== "label" && props.node.type !== "span" ? props.shorthand?.as : void 0;
47
47
  });
48
48
  const attrs = (0, vue.computed)(() => {
49
49
  const { as: as$1, ...attrs$1 } = props.shorthand ?? {};
@@ -90,7 +90,7 @@ var PrismicRichTextDefaultComponent_vue_vue_type_script_setup_true_lang_default
90
90
  key: 0,
91
91
  field: __props.node.linkTo
92
92
  }, {
93
- default: (0, vue.withCtx)(() => [(0, vue.createVNode)(require_PrismicImage.default, { field: __props.node }, null, 8, ["field"])]),
93
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)(require_PrismicImage.default, (0, vue.mergeProps)({ field: __props.node }, attrs.value), null, 16, ["field"])]),
94
94
  _: 1
95
95
  }, 8, ["field"])) : ((0, vue.openBlock)(), (0, vue.createBlock)(require_PrismicImage.default, (0, vue.mergeProps)({
96
96
  key: 1,
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { RichTextComponentProps, VueShorthand } from \"./types\"\n\nimport PrismicImage from \"../PrismicImage.vue\"\nimport PrismicLink from \"../PrismicLink.vue\"\n\nconst props = defineProps<\n\tRichTextComponentProps & {\n\t\tlinkResolver?: LinkResolverFunction\n\t\tshorthand?: VueShorthand\n\t}\n>()\ndefineOptions({ name: \"PrismicRichTextDefaultComponent\" })\n\nconst as = computed(() => {\n\treturn props.node.type !== \"image\" && props.node.type !== \"span\"\n\t\t? props.shorthand?.as\n\t\t: undefined\n})\n\nconst attrs = computed(() => {\n\tconst { as, ...attrs } = props.shorthand ?? {}\n\n\treturn attrs\n})\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<component v-if=\"as\" :is=\"as\" :dir=\"dir\" v-bind=\"attrs\"><slot /></component>\n\t<h1 v-else-if=\"node.type === 'heading1'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h1>\n\t<h2 v-else-if=\"node.type === 'heading2'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h2>\n\t<h3 v-else-if=\"node.type === 'heading3'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h3>\n\t<h4 v-else-if=\"node.type === 'heading4'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h4>\n\t<h5 v-else-if=\"node.type === 'heading5'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h5>\n\t<h6 v-else-if=\"node.type === 'heading6'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h6>\n\t<p v-else-if=\"node.type === 'paragraph'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</p>\n\t<pre v-else-if=\"node.type === 'preformatted'\" v-bind=\"attrs\"><slot /></pre>\n\t<strong v-else-if=\"node.type === 'strong'\" v-bind=\"attrs\"><slot /></strong>\n\t<em v-else-if=\"node.type === 'em'\" v-bind=\"attrs\"><slot /></em>\n\t<li v-else-if=\"node.type === 'list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<li v-else-if=\"node.type === 'o-list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<ul v-else-if=\"node.type === 'group-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ul>\n\t<ol v-else-if=\"node.type === 'group-o-list-item'\" v-bind=\"attrs\">\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\" v-bind=\"attrs\" />\n\t</p>\n\t<div\n\t\tv-else-if=\"node.type === 'embed'\"\n\t\t:data-oembed=\"node.oembed.embed_url\"\n\t\t:data-oembed-type=\"node.oembed.type\"\n\t\t:data-oembed-provider=\"node.oembed.provider_name\"\n\t\tv-html=\"node.oembed.html\"\n\t\tv-bind=\"attrs\"\n\t/>\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\tv-bind=\"attrs\"\n\t\t><slot\n\t/></PrismicLink>\n\t<span\n\t\tv-else-if=\"node.type === 'label'\"\n\t\t:class=\"node.data.label\"\n\t\tv-bind=\"attrs\"\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA,MAAM,QAAQ;EAQd,MAAM,6BAAoB;AACzB,UAAO,MAAM,KAAK,SAAS,WAAW,MAAM,KAAK,SAAS,SACvD,MAAM,WAAW,KACjB;IACH;EAED,MAAM,gCAAuB;GAC5B,MAAM,EAAE,UAAI,GAAG,YAAU,MAAM,aAAa,EAAC;AA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IAHP,OAAO,QAAA,KAAK,KAAK;MACV,MAAA,MAAK,EAAA,qBAEZ,KAAA,QAAA,UAAA,iEAGD,cAAA,EAAA,KAAA,IAAA,sBAFwC,QAAA,KAAK,KAAK,MAAK,KAAA,GAA/B,MAAM,UAAK;kFAAkC,MAAI,EAAA,CAC9D,QAAK,uDAAQ,MAAA,YAAA,iGAAG,KAAI,EAAA,EAAA"}
1
+ {"version":3,"file":"PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { VueComponentShorthand } from \"../types\"\nimport type { RichTextComponentProps } from \"./types\"\n\nimport PrismicImage from \"../PrismicImage.vue\"\nimport PrismicLink from \"../PrismicLink.vue\"\n\nconst props = defineProps<\n\tRichTextComponentProps & {\n\t\tlinkResolver?: LinkResolverFunction\n\t\tshorthand?: VueComponentShorthand\n\t}\n>()\ndefineOptions({ name: \"PrismicRichTextDefaultComponent\" })\n\nconst as = computed(() => {\n\treturn props.node.type !== \"image\" &&\n\t\tprops.node.type !== \"hyperlink\" &&\n\t\tprops.node.type !== \"label\" &&\n\t\tprops.node.type !== \"span\"\n\t\t? props.shorthand?.as\n\t\t: undefined\n})\n\nconst attrs = computed(() => {\n\tconst { as, ...attrs } = props.shorthand ?? {}\n\n\treturn attrs\n})\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<component v-if=\"as\" :is=\"as\" :dir=\"dir\" v-bind=\"attrs\"><slot /></component>\n\t<h1 v-else-if=\"node.type === 'heading1'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h1>\n\t<h2 v-else-if=\"node.type === 'heading2'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h2>\n\t<h3 v-else-if=\"node.type === 'heading3'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h3>\n\t<h4 v-else-if=\"node.type === 'heading4'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h4>\n\t<h5 v-else-if=\"node.type === 'heading5'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h5>\n\t<h6 v-else-if=\"node.type === 'heading6'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h6>\n\t<p v-else-if=\"node.type === 'paragraph'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</p>\n\t<pre v-else-if=\"node.type === 'preformatted'\" v-bind=\"attrs\"><slot /></pre>\n\t<strong v-else-if=\"node.type === 'strong'\" v-bind=\"attrs\"><slot /></strong>\n\t<em v-else-if=\"node.type === 'em'\" v-bind=\"attrs\"><slot /></em>\n\t<li v-else-if=\"node.type === 'list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<li v-else-if=\"node.type === 'o-list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<ul v-else-if=\"node.type === 'group-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ul>\n\t<ol v-else-if=\"node.type === 'group-o-list-item'\" v-bind=\"attrs\">\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\" v-bind=\"attrs\"\n\t\t/></PrismicLink>\n\t\t<PrismicImage v-else :field=\"node\" v-bind=\"attrs\" />\n\t</p>\n\t<div\n\t\tv-else-if=\"node.type === 'embed'\"\n\t\t:data-oembed=\"node.oembed.embed_url\"\n\t\t:data-oembed-type=\"node.oembed.type\"\n\t\t:data-oembed-provider=\"node.oembed.provider_name\"\n\t\tv-html=\"node.oembed.html\"\n\t\tv-bind=\"attrs\"\n\t/>\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\tv-bind=\"attrs\"\n\t\t><slot\n\t/></PrismicLink>\n\t<span\n\t\tv-else-if=\"node.type === 'label'\"\n\t\t:class=\"node.data.label\"\n\t\tv-bind=\"attrs\"\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUA,MAAM,QAAQ;EAQd,MAAM,6BAAoB;AACzB,UAAO,MAAM,KAAK,SAAS,WAC1B,MAAM,KAAK,SAAS,eACpB,MAAM,KAAK,SAAS,WACpB,MAAM,KAAK,SAAS,SAClB,MAAM,WAAW,KACjB;IACH;EAED,MAAM,gCAAuB;GAC5B,MAAM,EAAE,UAAI,GAAG,YAAU,MAAM,aAAa,EAAC;AAE7C,UAAO;IACP;EAED,MAAM,8BAAqB;AAC1B,UAAO,eAAe,MAAM,QAAQ,MAAM,KAAK,cAAc,QAC1D,QACA;IACH;;UAIiB,GAAA,qFAAS,GAAA,MAAE,sBAAgD;;IAA7C,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA;oCAAU,qBAAA,KAAA,QAAA,UAAA;;sBACjD,QAAA,KAAK,SAAI,gEAEnB,0BAAA;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,qBACxD,KAAA,QAAA,UAAA,sBAEM,QAAA,KAAK,SAAI,gEAEnB,0BAAA;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,qBACxD,KAAA,QAAA,UAAA,sBAEM,QAAA,KAAK,SAAI,gEAEnB,0BAAA;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,q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AA,qBACtD,KAAA,QAAA,UAAA,UAEuB,QAAA,KAAK,SAAI,6DAKrC,KALJ,aAKI,CAJgB,QAAA,KAAK,qDAER,6BAAA;;IAFiB,OAAO,QAAA,KAAK;;oCAE3C,sBAAA,kDAAA,EADe,OAAO,QAAA,MAAI,EAAU,MAAA,MAAK,EAAA,MAAA,IAAA,CAAA,QAAA,CAAA;;mEAES,kDAAA;;IAA9B,OAAO,QAAA;MAAc,MAAA,MAAK,EAAA,MAAA,IAAA,CAAA,QAAA,CAAA,OAGrC,QAAA,KAAK,SAAI,6DAMnB,2BAAA;;IALA,eAAa,QAAA,KAAK,OAAO;IACzB,oBAAkB,QAAA,KAAK,OAAO;IAC9B,wBAAsB,QAAA,KAAK,OAAO;IACnC,WAAQ,QAAA,KAAK,OAAO;MACZ,MAAA,MAAK,EAAA,MAAA,IAAA,YAAA,IAGF,QAAA,KAAK,SAAI,0DAKL,iDAAA;;IAJd,OAAO,QAAA,KAAK;IACZ,iBAAe,QAAA;MACR,MAAA,MAAK,EAAA;oCAEZ,qBAAA,KAAA,QAAA,UAAA;;yCAEU,QAAA,KAAK,SAAI,6DAIZ,4BAAA;;IAHP,OAAO,QAAA,KAAK,KAAK;MACV,MAAA,MAAK,EAAA,qBAEZ,KAAA,QAAA,UAAA,iEAGD,cAAA,EAAA,KAAA,IAAA,sBAFwC,QAAA,KAAK,KAAK,MAAK,KAAA,GAA/B,MAAM,UAAK;kFAAkC,MAAI,EAAA,CAC9D,QAAK,uDAAQ,MAAA,YAAA,iGAAG,KAAI,EAAA,EAAA"}
@@ -43,7 +43,7 @@ var PrismicRichTextDefaultComponent_vue_vue_type_script_setup_true_lang_default
43
43
  setup(__props) {
44
44
  const props = __props;
45
45
  const as = computed(() => {
46
- return props.node.type !== "image" && props.node.type !== "span" ? props.shorthand?.as : void 0;
46
+ return props.node.type !== "image" && props.node.type !== "hyperlink" && props.node.type !== "label" && props.node.type !== "span" ? props.shorthand?.as : void 0;
47
47
  });
48
48
  const attrs = computed(() => {
49
49
  const { as: as$1, ...attrs$1 } = props.shorthand ?? {};
@@ -90,7 +90,7 @@ var PrismicRichTextDefaultComponent_vue_vue_type_script_setup_true_lang_default
90
90
  key: 0,
91
91
  field: __props.node.linkTo
92
92
  }, {
93
- default: withCtx(() => [createVNode(PrismicImage_default, { field: __props.node }, null, 8, ["field"])]),
93
+ default: withCtx(() => [createVNode(PrismicImage_default, mergeProps({ field: __props.node }, attrs.value), null, 16, ["field"])]),
94
94
  _: 1
95
95
  }, 8, ["field"])) : (openBlock(), createBlock(PrismicImage_default, mergeProps({
96
96
  key: 1,
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { RichTextComponentProps, VueShorthand } from \"./types\"\n\nimport PrismicImage from \"../PrismicImage.vue\"\nimport PrismicLink from \"../PrismicLink.vue\"\n\nconst props = defineProps<\n\tRichTextComponentProps & {\n\t\tlinkResolver?: LinkResolverFunction\n\t\tshorthand?: VueShorthand\n\t}\n>()\ndefineOptions({ name: \"PrismicRichTextDefaultComponent\" })\n\nconst as = computed(() => {\n\treturn props.node.type !== \"image\" && props.node.type !== \"span\"\n\t\t? props.shorthand?.as\n\t\t: undefined\n})\n\nconst attrs = computed(() => {\n\tconst { as, ...attrs } = props.shorthand ?? {}\n\n\treturn attrs\n})\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<component v-if=\"as\" :is=\"as\" :dir=\"dir\" v-bind=\"attrs\"><slot /></component>\n\t<h1 v-else-if=\"node.type === 'heading1'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h1>\n\t<h2 v-else-if=\"node.type === 'heading2'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h2>\n\t<h3 v-else-if=\"node.type === 'heading3'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h3>\n\t<h4 v-else-if=\"node.type === 'heading4'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h4>\n\t<h5 v-else-if=\"node.type === 'heading5'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h5>\n\t<h6 v-else-if=\"node.type === 'heading6'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h6>\n\t<p v-else-if=\"node.type === 'paragraph'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</p>\n\t<pre v-else-if=\"node.type === 'preformatted'\" v-bind=\"attrs\"><slot /></pre>\n\t<strong v-else-if=\"node.type === 'strong'\" v-bind=\"attrs\"><slot /></strong>\n\t<em v-else-if=\"node.type === 'em'\" v-bind=\"attrs\"><slot /></em>\n\t<li v-else-if=\"node.type === 'list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<li v-else-if=\"node.type === 'o-list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<ul v-else-if=\"node.type === 'group-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ul>\n\t<ol v-else-if=\"node.type === 'group-o-list-item'\" v-bind=\"attrs\">\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\" v-bind=\"attrs\" />\n\t</p>\n\t<div\n\t\tv-else-if=\"node.type === 'embed'\"\n\t\t:data-oembed=\"node.oembed.embed_url\"\n\t\t:data-oembed-type=\"node.oembed.type\"\n\t\t:data-oembed-provider=\"node.oembed.provider_name\"\n\t\tv-html=\"node.oembed.html\"\n\t\tv-bind=\"attrs\"\n\t/>\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\tv-bind=\"attrs\"\n\t\t><slot\n\t/></PrismicLink>\n\t<span\n\t\tv-else-if=\"node.type === 'label'\"\n\t\t:class=\"node.data.label\"\n\t\tv-bind=\"attrs\"\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA,MAAM,QAAQ;EAQd,MAAM,KAAK,eAAe;AACzB,UAAO,MAAM,KAAK,SAAS,WAAW,MAAM,KAAK,SAAS,SACvD,MAAM,WAAW,KACjB;IACH;EAED,MAAM,QAAQ,eAAe;GAC5B,MAAM,EAAE,UAAI,GAAG,YAAU,MAAM,aAAa,EAAC;AAE7C,UAAO;IACP;EAED,MAAM,MAAM,eAAe;AAC1B,UAAO,eAAe,MAAM,QAAQ,MAAM,KAAK,cAAc,QAC1D,QACA;IACH;;UAIiB,GAAA,sBAAjB,YAA4E,wBAAlD,GAAA,MAAE,EAA5B,WAA4E;;IAA7C,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA;2BAAU,CAAR,WAAQ,KAAA,QAAA,UAAA;;sBACjD,QAAA,KAAK,SAAI,2BAAxB,mBAEK,MAFL,WAEK;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,CAChE,WAAQ,KAAA,QAAA,UAAA,sBAEM,QAAA,KAAK,SAAI,2BAAxB,mBAEK,MAFL,WAEK;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,CAChE,WAAQ,KAAA,QAAA,UAAA,sBAEM,QAAA,KAAK,SAAI,2BA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,MAAK,KAAA,GAA/B,MAAM,UAAK;4DAAkC,MAAI,EAAA,CAC9D,QAAK,kBAAf,mBAAuB,MAAA,YAAA,sEAAG,KAAI,EAAA,EAAA"}
1
+ {"version":3,"file":"PrismicRichTextDefaultComponent.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextDefaultComponent.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { LinkResolverFunction } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { VueComponentShorthand } from \"../types\"\nimport type { RichTextComponentProps } from \"./types\"\n\nimport PrismicImage from \"../PrismicImage.vue\"\nimport PrismicLink from \"../PrismicLink.vue\"\n\nconst props = defineProps<\n\tRichTextComponentProps & {\n\t\tlinkResolver?: LinkResolverFunction\n\t\tshorthand?: VueComponentShorthand\n\t}\n>()\ndefineOptions({ name: \"PrismicRichTextDefaultComponent\" })\n\nconst as = computed(() => {\n\treturn props.node.type !== \"image\" &&\n\t\tprops.node.type !== \"hyperlink\" &&\n\t\tprops.node.type !== \"label\" &&\n\t\tprops.node.type !== \"span\"\n\t\t? props.shorthand?.as\n\t\t: undefined\n})\n\nconst attrs = computed(() => {\n\tconst { as, ...attrs } = props.shorthand ?? {}\n\n\treturn attrs\n})\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<component v-if=\"as\" :is=\"as\" :dir=\"dir\" v-bind=\"attrs\"><slot /></component>\n\t<h1 v-else-if=\"node.type === 'heading1'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h1>\n\t<h2 v-else-if=\"node.type === 'heading2'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h2>\n\t<h3 v-else-if=\"node.type === 'heading3'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h3>\n\t<h4 v-else-if=\"node.type === 'heading4'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h4>\n\t<h5 v-else-if=\"node.type === 'heading5'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h5>\n\t<h6 v-else-if=\"node.type === 'heading6'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</h6>\n\t<p v-else-if=\"node.type === 'paragraph'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</p>\n\t<pre v-else-if=\"node.type === 'preformatted'\" v-bind=\"attrs\"><slot /></pre>\n\t<strong v-else-if=\"node.type === 'strong'\" v-bind=\"attrs\"><slot /></strong>\n\t<em v-else-if=\"node.type === 'em'\" v-bind=\"attrs\"><slot /></em>\n\t<li v-else-if=\"node.type === 'list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<li v-else-if=\"node.type === 'o-list-item'\" :dir=\"dir\" v-bind=\"attrs\">\n\t\t<slot />\n\t</li>\n\t<ul v-else-if=\"node.type === 'group-list-item'\" v-bind=\"attrs\">\n\t\t<slot />\n\t</ul>\n\t<ol v-else-if=\"node.type === 'group-o-list-item'\" v-bind=\"attrs\">\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\" v-bind=\"attrs\"\n\t\t/></PrismicLink>\n\t\t<PrismicImage v-else :field=\"node\" v-bind=\"attrs\" />\n\t</p>\n\t<div\n\t\tv-else-if=\"node.type === 'embed'\"\n\t\t:data-oembed=\"node.oembed.embed_url\"\n\t\t:data-oembed-type=\"node.oembed.type\"\n\t\t:data-oembed-provider=\"node.oembed.provider_name\"\n\t\tv-html=\"node.oembed.html\"\n\t\tv-bind=\"attrs\"\n\t/>\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\tv-bind=\"attrs\"\n\t\t><slot\n\t/></PrismicLink>\n\t<span\n\t\tv-else-if=\"node.type === 'label'\"\n\t\t:class=\"node.data.label\"\n\t\tv-bind=\"attrs\"\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUA,MAAM,QAAQ;EAQd,MAAM,KAAK,eAAe;AACzB,UAAO,MAAM,KAAK,SAAS,WAC1B,MAAM,KAAK,SAAS,eACpB,MAAM,KAAK,SAAS,WACpB,MAAM,KAAK,SAAS,SAClB,MAAM,WAAW,KACjB;IACH;EAED,MAAM,QAAQ,eAAe;GAC5B,MAAM,EAAE,UAAI,GAAG,YAAU,MAAM,aAAa,EAAC;AAE7C,UAAO;IACP;EAED,MAAM,MAAM,eAAe;AAC1B,UAAO,eAAe,MAAM,QAAQ,MAAM,KAAK,cAAc,QAC1D,QACA;IACH;;UAIiB,GAAA,sBAAjB,YAA4E,wBAAlD,GAAA,MAAE,EAA5B,WAA4E;;IAA7C,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA;2BAAU,CAAR,WAAQ,KAAA,QAAA,UAAA;;sBACjD,QAAA,KAAK,SAAI,2BAAxB,mBAEK,MAFL,WAEK;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,CAChE,WAAQ,KAAA,QAAA,UAAA,sBAEM,QAAA,KAAK,SAAI,2BAAxB,mBAEK,MAFL,WAEK;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,CAChE,WAAQ,KAAA,QAAA,UAAA,sBAEM,QAAA,KAAK,SAAI,2BAAxB,mBAEK,MAFL,WAEK;;IAFqC,KAAK,IAAA;MAAa,MAAA,MAAK,EAAA,CAChE,WAAQ,KAAA,QAAA,UAAA,sBAEM,QAAA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AA,sEAAG,KAAI,EAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicRichTextSerialize.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextSerialize.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { asTree } from \"@prismicio/client/richtext\"\n\nimport type { InternalVueRichTextComponent } from \"./types\"\n\ntype PrismicRichTextSerializeProps = {\n\tchildren: ReturnType<typeof asTree>[\"children\"]\n\tinternalComponents: InternalVueRichTextComponent\n}\n\nconst props = defineProps<PrismicRichTextSerializeProps>()\ndefineOptions({ name: \"PrismicRichTextSerialize\" })\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=\"internalComponents[child.type].is\"\n\t\t:node=\"child.node\"\n\t\tv-bind=\"internalComponents[child.type].props\"\n\t\t><PrismicRichTextSerialize\n\t\t\tv-if=\"child.children.length\"\n\t\t\t:children=\"child.children\"\n\t\t\t:internal-components=\"internalComponents\"\n\t/></component>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"PrismicRichTextSerialize.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextSerialize.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { asTree } from \"@prismicio/client/richtext\"\n\nimport type { InternalVueRichTextComponents } from \"./types\"\n\ntype PrismicRichTextSerializeProps = {\n\tchildren: ReturnType<typeof asTree>[\"children\"]\n\tinternalComponents: InternalVueRichTextComponents\n}\n\nconst props = defineProps<PrismicRichTextSerializeProps>()\ndefineOptions({ name: \"PrismicRichTextSerialize\" })\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=\"internalComponents[child.type].is\"\n\t\t:node=\"child.node\"\n\t\t:link-resolver=\"internalComponents[child.type].linkResolver\"\n\t\t:shorthand=\"internalComponents[child.type].shorthand\"\n\t\t><PrismicRichTextSerialize\n\t\t\tv-if=\"child.children.length\"\n\t\t\t:children=\"child.children\"\n\t\t\t:internal-components=\"internalComponents\"\n\t/></component>\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicRichTextSerialize.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextSerialize.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { asTree } from \"@prismicio/client/richtext\"\n\nimport type { InternalVueRichTextComponent } from \"./types\"\n\ntype PrismicRichTextSerializeProps = {\n\tchildren: ReturnType<typeof asTree>[\"children\"]\n\tinternalComponents: InternalVueRichTextComponent\n}\n\nconst props = defineProps<PrismicRichTextSerializeProps>()\ndefineOptions({ name: \"PrismicRichTextSerialize\" })\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=\"internalComponents[child.type].is\"\n\t\t:node=\"child.node\"\n\t\tv-bind=\"internalComponents[child.type].props\"\n\t\t><PrismicRichTextSerialize\n\t\t\tv-if=\"child.children.length\"\n\t\t\t:children=\"child.children\"\n\t\t\t:internal-components=\"internalComponents\"\n\t/></component>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"PrismicRichTextSerialize.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextSerialize.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { asTree } from \"@prismicio/client/richtext\"\n\nimport type { InternalVueRichTextComponents } from \"./types\"\n\ntype PrismicRichTextSerializeProps = {\n\tchildren: ReturnType<typeof asTree>[\"children\"]\n\tinternalComponents: InternalVueRichTextComponents\n}\n\nconst props = defineProps<PrismicRichTextSerializeProps>()\ndefineOptions({ name: \"PrismicRichTextSerialize\" })\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=\"internalComponents[child.type].is\"\n\t\t:node=\"child.node\"\n\t\t:link-resolver=\"internalComponents[child.type].linkResolver\"\n\t\t:shorthand=\"internalComponents[child.type].shorthand\"\n\t\t><PrismicRichTextSerialize\n\t\t\tv-if=\"child.children.length\"\n\t\t\t:children=\"child.children\"\n\t\t\t:internal-components=\"internalComponents\"\n\t/></component>\n</template>\n"],"mappings":""}
@@ -19,17 +19,23 @@ var PrismicRichTextSerialize_vue_vue_type_script_setup_true_lang_default = /* @_
19
19
  return (_ctx, _cache) => {
20
20
  const _component_PrismicRichTextSerialize = (0, vue.resolveComponent)("PrismicRichTextSerialize", true);
21
21
  return (0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(props.children, (child) => {
22
- return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(__props.internalComponents[child.type].is), (0, vue.mergeProps)({
22
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(__props.internalComponents[child.type].is), {
23
23
  key: JSON.stringify(child),
24
- node: child.node
25
- }, { ref_for: true }, __props.internalComponents[child.type].props), {
24
+ node: child.node,
25
+ "link-resolver": __props.internalComponents[child.type].linkResolver,
26
+ shorthand: __props.internalComponents[child.type].shorthand
27
+ }, {
26
28
  default: (0, vue.withCtx)(() => [child.children.length ? ((0, vue.openBlock)(), (0, vue.createBlock)(_component_PrismicRichTextSerialize, {
27
29
  key: 0,
28
30
  children: child.children,
29
31
  "internal-components": __props.internalComponents
30
32
  }, null, 8, ["children", "internal-components"])) : (0, vue.createCommentVNode)("v-if", true)]),
31
33
  _: 2
32
- }, 1040, ["node"]);
34
+ }, 1032, [
35
+ "node",
36
+ "link-resolver",
37
+ "shorthand"
38
+ ]);
33
39
  }), 128);
34
40
  };
35
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextSerialize.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { asTree } from \"@prismicio/client/richtext\"\n\nimport type { InternalVueRichTextComponent } from \"./types\"\n\ntype PrismicRichTextSerializeProps = {\n\tchildren: ReturnType<typeof asTree>[\"children\"]\n\tinternalComponents: InternalVueRichTextComponent\n}\n\nconst props = defineProps<PrismicRichTextSerializeProps>()\ndefineOptions({ name: \"PrismicRichTextSerialize\" })\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=\"internalComponents[child.type].is\"\n\t\t:node=\"child.node\"\n\t\tv-bind=\"internalComponents[child.type].props\"\n\t\t><PrismicRichTextSerialize\n\t\t\tv-if=\"child.children.length\"\n\t\t\t:children=\"child.children\"\n\t\t\t:internal-components=\"internalComponents\"\n\t/></component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAUA,MAAM,QAAQ;;;gEAeC,cAAA,0BATG,MAAM,WAAf,UAAK;uFAEP,QAAA,mBAAmB,MAAM,MAAM,GAAE,sBAOzB;KARZ,KAAK,KAAK,UAAU,MAAK;KAEzB,MAAM,MAAM;0BACL,QAAA,mBAAmB,MAAM,MAAM,MAAK,EAAA;qCAK3C,CAHM,MAAM,SAAS,qDAGrB,qCAAA;;MAFC,UAAU,MAAM;MAChB,uBAAqB,QAAA"}
1
+ {"version":3,"file":"PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextSerialize.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { asTree } from \"@prismicio/client/richtext\"\n\nimport type { InternalVueRichTextComponents } from \"./types\"\n\ntype PrismicRichTextSerializeProps = {\n\tchildren: ReturnType<typeof asTree>[\"children\"]\n\tinternalComponents: InternalVueRichTextComponents\n}\n\nconst props = defineProps<PrismicRichTextSerializeProps>()\ndefineOptions({ name: \"PrismicRichTextSerialize\" })\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=\"internalComponents[child.type].is\"\n\t\t:node=\"child.node\"\n\t\t:link-resolver=\"internalComponents[child.type].linkResolver\"\n\t\t:shorthand=\"internalComponents[child.type].shorthand\"\n\t\t><PrismicRichTextSerialize\n\t\t\tv-if=\"child.children.length\"\n\t\t\t:children=\"child.children\"\n\t\t\t:internal-components=\"internalComponents\"\n\t/></component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAUA,MAAM,QAAQ;;;gEAgBC,cAAA,0BAVG,MAAM,WAAf,UAAK;uFAEP,QAAA,mBAAmB,MAAM,MAAM,GAAE,EAAA;KADrC,KAAK,KAAK,UAAU,MAAK;KAEzB,MAAM,MAAM;KACZ,iBAAe,QAAA,mBAAmB,MAAM,MAAM;KAC9C,WAAW,QAAA,mBAAmB,MAAM,MAAM;;qCAK1C,CAHM,MAAM,SAAS,qDAGrB,qCAAA;;MAFC,UAAU,MAAM;MAChB,uBAAqB,QAAA"}
@@ -1,4 +1,4 @@
1
- import { Fragment, createBlock, createCommentVNode, createElementBlock, defineComponent, mergeProps, openBlock, renderList, resolveComponent, resolveDynamicComponent, withCtx } from "vue";
1
+ import { Fragment, createBlock, createCommentVNode, createElementBlock, defineComponent, openBlock, renderList, resolveComponent, resolveDynamicComponent, withCtx } from "vue";
2
2
 
3
3
  //#region src/PrismicRichText/PrismicRichTextSerialize.vue?vue&type=script&setup=true&lang.ts
4
4
  var PrismicRichTextSerialize_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
@@ -19,17 +19,23 @@ var PrismicRichTextSerialize_vue_vue_type_script_setup_true_lang_default = /* @_
19
19
  return (_ctx, _cache) => {
20
20
  const _component_PrismicRichTextSerialize = resolveComponent("PrismicRichTextSerialize", true);
21
21
  return openBlock(true), createElementBlock(Fragment, null, renderList(props.children, (child) => {
22
- return openBlock(), createBlock(resolveDynamicComponent(__props.internalComponents[child.type].is), mergeProps({
22
+ return openBlock(), createBlock(resolveDynamicComponent(__props.internalComponents[child.type].is), {
23
23
  key: JSON.stringify(child),
24
- node: child.node
25
- }, { ref_for: true }, __props.internalComponents[child.type].props), {
24
+ node: child.node,
25
+ "link-resolver": __props.internalComponents[child.type].linkResolver,
26
+ shorthand: __props.internalComponents[child.type].shorthand
27
+ }, {
26
28
  default: withCtx(() => [child.children.length ? (openBlock(), createBlock(_component_PrismicRichTextSerialize, {
27
29
  key: 0,
28
30
  children: child.children,
29
31
  "internal-components": __props.internalComponents
30
32
  }, null, 8, ["children", "internal-components"])) : createCommentVNode("v-if", true)]),
31
33
  _: 2
32
- }, 1040, ["node"]);
34
+ }, 1032, [
35
+ "node",
36
+ "link-resolver",
37
+ "shorthand"
38
+ ]);
33
39
  }), 128);
34
40
  };
35
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextSerialize.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { asTree } from \"@prismicio/client/richtext\"\n\nimport type { InternalVueRichTextComponent } from \"./types\"\n\ntype PrismicRichTextSerializeProps = {\n\tchildren: ReturnType<typeof asTree>[\"children\"]\n\tinternalComponents: InternalVueRichTextComponent\n}\n\nconst props = defineProps<PrismicRichTextSerializeProps>()\ndefineOptions({ name: \"PrismicRichTextSerialize\" })\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=\"internalComponents[child.type].is\"\n\t\t:node=\"child.node\"\n\t\tv-bind=\"internalComponents[child.type].props\"\n\t\t><PrismicRichTextSerialize\n\t\t\tv-if=\"child.children.length\"\n\t\t\t:children=\"child.children\"\n\t\t\t:internal-components=\"internalComponents\"\n\t/></component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAUA,MAAM,QAAQ;;;2BAKb,mBAUc,UAAA,MAAA,WATG,MAAM,WAAf,UAAK;wBADb,YAUc,wBAPR,QAAA,mBAAmB,MAAM,MAAM,GAAE,EAHvC,WAUc;KARZ,KAAK,KAAK,UAAU,MAAK;KAEzB,MAAM,MAAM;0BACL,QAAA,mBAAmB,MAAM,MAAM,MAAK,EAAA;4BAK3C,CAHM,MAAM,SAAS,uBADrB,YAIA,qCAAA;;MAFC,UAAU,MAAM;MAChB,uBAAqB,QAAA"}
1
+ {"version":3,"file":"PrismicRichTextSerialize.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/PrismicRichText/PrismicRichTextSerialize.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { asTree } from \"@prismicio/client/richtext\"\n\nimport type { InternalVueRichTextComponents } from \"./types\"\n\ntype PrismicRichTextSerializeProps = {\n\tchildren: ReturnType<typeof asTree>[\"children\"]\n\tinternalComponents: InternalVueRichTextComponents\n}\n\nconst props = defineProps<PrismicRichTextSerializeProps>()\ndefineOptions({ name: \"PrismicRichTextSerialize\" })\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=\"internalComponents[child.type].is\"\n\t\t:node=\"child.node\"\n\t\t:link-resolver=\"internalComponents[child.type].linkResolver\"\n\t\t:shorthand=\"internalComponents[child.type].shorthand\"\n\t\t><PrismicRichTextSerialize\n\t\t\tv-if=\"child.children.length\"\n\t\t\t:children=\"child.children\"\n\t\t\t:internal-components=\"internalComponents\"\n\t/></component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAUA,MAAM,QAAQ;;;2BAKb,mBAWc,UAAA,MAAA,WAVG,MAAM,WAAf,UAAK;wBADb,YAWc,wBARR,QAAA,mBAAmB,MAAM,MAAM,GAAE,EAAA;KADrC,KAAK,KAAK,UAAU,MAAK;KAEzB,MAAM,MAAM;KACZ,iBAAe,QAAA,mBAAmB,MAAM,MAAM;KAC9C,WAAW,QAAA,mBAAmB,MAAM,MAAM;;4BAK1C,CAHM,MAAM,SAAS,uBADrB,YAIA,qCAAA;;MAFC,UAAU,MAAM;MAChB,uBAAqB,QAAA"}
@@ -1,2 +1,2 @@
1
- import { RichTextComponentProps, VueRichTextSerializer } from "./types.js";
1
+ import { RichTextComponentProps, VueRichTextComponents } from "./types.js";
2
2
  import { getRichTextComponentProps } from "./getRichTextComponentProps.js";
@@ -1,5 +1,5 @@
1
- import { VueComponent } from "../types.js";
2
- import { LinkResolverFunction, RTAnyNode, RichTextNodeType } from "@prismicio/client";
1
+ import { VueComponentShorthand } from "../types.js";
2
+ import { LinkResolverFunction, RTAnyNode, RTEmNode, RTEmbedNode, RTHeading1Node, RTHeading2Node, RTHeading3Node, RTHeading4Node, RTHeading5Node, RTHeading6Node, RTImageNode, RTLabelNode, RTLinkNode, RTListItemNode, RTListNode, RTOListItemNode, RTOListNode, RTParagraphNode, RTPreformattedNode, RTSpanNode, RTStrongNode } from "@prismicio/client";
3
3
 
4
4
  //#region src/PrismicRichText/types.d.ts
5
5
 
@@ -9,32 +9,31 @@ import { LinkResolverFunction, RTAnyNode, RichTextNodeType } from "@prismicio/cl
9
9
  *
10
10
  * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/rich-text}
11
11
  */
12
- type VueRichTextSerializer = Partial<Record<keyof typeof RichTextNodeType, VueRichTextComponent | VueShorthand>>;
13
- /**
14
- * Props for a component rendering nodes from a Prismic rich text field.
15
- */
12
+ type VueRichTextComponents = {
13
+ heading1?: RichTextComponentProps<RTHeading1Node> | VueComponentShorthand;
14
+ heading2?: RichTextComponentProps<RTHeading2Node> | VueComponentShorthand;
15
+ heading3?: RichTextComponentProps<RTHeading3Node> | VueComponentShorthand;
16
+ heading4?: RichTextComponentProps<RTHeading4Node> | VueComponentShorthand;
17
+ heading5?: RichTextComponentProps<RTHeading5Node> | VueComponentShorthand;
18
+ heading6?: RichTextComponentProps<RTHeading6Node> | VueComponentShorthand;
19
+ paragraph?: RichTextComponentProps<RTParagraphNode> | VueComponentShorthand;
20
+ preformatted?: RichTextComponentProps<RTPreformattedNode> | VueComponentShorthand;
21
+ strong?: RichTextComponentProps<RTStrongNode> | VueComponentShorthand;
22
+ em?: RichTextComponentProps<RTEmNode> | VueComponentShorthand;
23
+ listItem?: RichTextComponentProps<RTListItemNode> | VueComponentShorthand;
24
+ oListItem?: RichTextComponentProps<RTOListItemNode> | VueComponentShorthand;
25
+ list?: RichTextComponentProps<RTListNode> | VueComponentShorthand;
26
+ oList?: RichTextComponentProps<RTOListNode> | VueComponentShorthand;
27
+ image?: RichTextComponentProps<RTImageNode> | Omit<VueComponentShorthand, "as">;
28
+ embed?: RichTextComponentProps<RTEmbedNode> | VueComponentShorthand;
29
+ hyperlink?: RichTextComponentProps<RTLinkNode> | Omit<VueComponentShorthand, "as">;
30
+ label?: RichTextComponentProps<RTLabelNode> | Omit<VueComponentShorthand, "as">;
31
+ span?: RichTextComponentProps<RTSpanNode>;
32
+ };
33
+ /** Props for a component rendering nodes from a Prismic rich text field. */
16
34
  type RichTextComponentProps<TRTNode extends RTAnyNode = RTAnyNode> = {
17
35
  node: TRTNode;
18
36
  };
19
- /**
20
- * A Vue component rendering a node from a Prismic rich text field.
21
- *
22
- * @typeParam TRTNode - The type of rich text node(s) this component handles
23
- */
24
- type VueRichTextComponent<TRTNode extends RTAnyNode = RTAnyNode> = VueComponent<RichTextComponentProps<TRTNode>>;
25
- /**
26
- * A shorthand definition for {@link VueRichTextSerializer} component types.
27
- */
28
- type VueShorthand = {
29
- /**
30
- * The HTML element type rendered for this node type.
31
- */
32
- as?: string;
33
- /**
34
- * Other attributes to apply to the element type.
35
- */
36
- [Attribute: string]: string | boolean | null | undefined;
37
- };
38
37
  //#endregion
39
- export { RichTextComponentProps, VueRichTextSerializer, VueShorthand };
38
+ export { RichTextComponentProps, VueRichTextComponents };
40
39
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/PrismicRichText/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAcA;;;;AACC,KADW,qBAAA,GAAwB,OACnC,CAAA,MAAA,CAAA,MAAA,OAAoB,gBAApB,EAAsC,oBAAtC,GAA6D,YAA7D,CAAA,CAAA;;;AAMD;AAAmD,KAAvC,sBAAuC,CAAA,gBAAA,SAAA,GAAY,SAAZ,CAAA,GAAA;EAAY,IAAA,EACxD,OADwD;CACxD;;AACN;;;;KAOI,oBACJ,CAAA,gBADyC,SACzC,GADqD,SACrD,CAAA,GADkE,YAClE,CAAA,sBAAA,CAAuB,OAAvB,CAAA,CAAA;;;AAMD;KAAY,YAAA"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/PrismicRichText/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAiCA;;;;AAEmC,KAFvB,qBAAA,GAEuB;EAAvB,QAAA,CAAA,EADA,sBACA,CADuB,cACvB,CAAA,GADyC,qBACzC;EAAyC,QAAA,CAAA,EAAzC,sBAAyC,CAAlB,cAAkB,CAAA,GAAA,qBAAA;EAClB,QAAA,CAAA,EAAvB,sBAAuB,CAAA,cAAA,CAAA,GAAkB,qBAAlB;EAAvB,QAAA,CAAA,EACA,sBADA,CACuB,cADvB,CAAA,GACyC,qBADzC;EAAyC,QAAA,CAAA,EAEzC,sBAFyC,CAElB,cAFkB,CAAA,GAEA,qBAFA;EAClB,QAAA,CAAA,EAEvB,sBAFuB,CAEA,cAFA,CAAA,GAEkB,qBAFlB;EAAvB,SAAA,CAAA,EAGC,sBAHD,CAGwB,eAHxB,CAAA,GAG2C,qBAH3C;EAAyC,YAAA,CAAA,EAKjD,sBALiD,CAK1B,kBAL0B,CAAA,GAMjD,qBANiD;EAClB,MAAA,CAAA,EAMzB,sBANyB,CAMF,YANE,CAAA,GAMc,qBANd;EAAvB,EAAA,CAAA,EAON,sBAPM,CAOiB,QAPjB,CAAA,GAO6B,qBAP7B;EAAyC,QAAA,CAAA,EAQzC,sBARyC,CAQlB,cARkB,CAAA,GAQA,qBARA;EAClB,SAAA,CAAA,EAQtB,sBARsB,CAQC,eARD,CAAA,GAQoB,qBARpB;EAAvB,IAAA,CAAA,EASJ,sBATI,CASmB,UATnB,CAAA,GASiC,qBATjC;EAAyC,KAAA,CAAA,EAU5C,sBAV4C,CAUrB,WAVqB,CAAA,GAUN,qBAVM;EACjB,KAAA,CAAA,EAWhC,sBAXgC,CAWT,WAXS,CAAA,GAYhC,IAZgC,CAY3B,qBAZ2B,EAAA,IAAA,CAAA;EAAvB,KAAA,CAAA,EAaJ,sBAbI,CAamB,WAbnB,CAAA,GAakC,qBAblC;EAA0C,SAAA,CAAA,EAenD,sBAfmD,CAe5B,UAf4B,CAAA,GAgBnD,IAhBmD,CAgB9C,qBAhB8C,EAAA,IAAA,CAAA;EAE5B,KAAA,CAAA,EAgBvB,sBAhBuB,CAgBA,WAhBA,CAAA,GAiBvB,IAjBuB,CAiBlB,qBAjBkB,EAAA,IAAA,CAAA;EAAvB,IAAA,CAAA,EAkBI,sBAlBJ,CAkB2B,UAlB3B,CAAA;CACA;;AACM,KAoBE,sBApBF,CAAA,gBAoByC,SApBzC,GAoBqD,SApBrD,CAAA,GAAA;EAAuC,IAAA,EAqB1C,OArB0C;CACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicTable.cjs","names":[],"sources":["../../../src/PrismicTable/PrismicTable.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { type TableField, isFilled } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { VueShorthand } from \"../PrismicRichText/types\"\nimport { type ComponentOrTagName, isVueComponent } from \"../types\"\nimport type { InternalVueTableComponents, VueTableComponents } from \"./types\"\n\nimport type { VueRichTextSerializer } from \"../PrismicRichText\"\n\nimport { defaultTableComponents } from \"./PrismicTableDefaultComponents\"\nimport PrismicTableRow from \"./PrismicTableRow.vue\"\n\n/**\n * Props for `<PrismicTable />`.\n */\nexport type PrismicTableProps = {\n\t/** The Prismic table field to render. */\n\tfield: TableField | undefined\n\n\t/**\n\t * An object that maps a table block type to a Vue component or a shorthand definition.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * table: Table,\n\t * thead: { class: 'bg-black text-white' },\n\t * th: { as: 'td', class: 'font-bold' },\n\t * }\n\t * ```\n\t */\n\tcomponents?: VueTableComponents & VueRichTextSerializer\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` (nothing) will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\nconst props = defineProps<PrismicTableProps>()\ndefineOptions({ name: \"PrismicTable\" })\n\nfunction getInternalComponent(type: keyof VueTableComponents) {\n\tconst maybeComponentOrShorthand = props.components?.[type]\n\n\tif (isVueComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: defaultTableComponents[type],\n\t\tshorthand: maybeComponentOrShorthand as VueShorthand,\n\t}\n}\n\nconst tableComponents = computed<InternalVueTableComponents>(() => {\n\treturn {\n\t\ttable: getInternalComponent(\"table\"),\n\t\tthead: getInternalComponent(\"thead\"),\n\t\ttbody: getInternalComponent(\"tbody\"),\n\t\ttr: getInternalComponent(\"tr\"),\n\t\tth: getInternalComponent(\"th\"),\n\t\ttd: getInternalComponent(\"td\"),\n\t}\n})\n</script>\n\n<template>\n\t<component\n\t\tv-if=\"isFilled.table(field)\"\n\t\t:is=\"tableComponents.table.is\"\n\t\t:table=\"field\"\n\t\tv-bind=\"{ ...$attrs, ...tableComponents.table.shorthand }\"\n\t>\n\t\t<component\n\t\t\tv-if=\"field.head\"\n\t\t\t:is=\"tableComponents.thead.is\"\n\t\t\t:head=\"field.head\"\n\t\t\tv-bind=\"tableComponents.thead.shorthand\"\n\t\t>\n\t\t\t<PrismicTableRow\n\t\t\t\tv-for=\"row in field.head.rows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\t:row=\"row\"\n\t\t\t\t:internalTableComponents=\"tableComponents\"\n\t\t\t\t:components=\"components\"\n\t\t\t/>\n\t\t</component>\n\t\t<component\n\t\t\t:is=\"tableComponents.tbody.is\"\n\t\t\t:body=\"field.body\"\n\t\t\tv-bind=\"tableComponents.tbody.shorthand\"\n\t\t>\n\t\t\t<PrismicTableRow\n\t\t\t\tv-for=\"row in field.body.rows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\t:row=\"row\"\n\t\t\t\t:internalTableComponents=\"tableComponents\"\n\t\t\t\t:components=\"components\"\n\t\t\t/>\n\t\t</component>\n\t</component>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" v-bind=\"$attrs\" />\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"PrismicTable.cjs","names":[],"sources":["../../../src/PrismicTable/PrismicTable.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { type TableField, isFilled } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { ComponentOrTagName, VueComponentShorthand } from \"../types\"\nimport { isVueComponent } from \"../types\"\nimport type { InternalVueTableComponents, VueTableComponents } from \"./types\"\n\nimport type { VueRichTextComponents } from \"../PrismicRichText\"\nimport { usePrismic } from \"../createPrismic\"\n\nimport { defaultTableComponents } from \"./PrismicTableDefaultComponents\"\nimport PrismicTableRow from \"./PrismicTableRow.vue\"\n\n/** Props for `<PrismicTable />`. */\nexport type PrismicTableProps = {\n\t/** The Prismic table field to render. */\n\tfield: TableField | undefined\n\n\t/**\n\t * An object that maps a table block type to a Vue component or a shorthand\n\t * definition.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * table: Table,\n\t * thead: { class: 'bg-black text-white' },\n\t * th: { as: 'td', class: 'font-bold' },\n\t * }\n\t * ```\n\t */\n\tcomponents?: VueTableComponents & VueRichTextComponents\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` (nothing) will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\nconst props = defineProps<PrismicTableProps>()\ndefineOptions({ name: \"PrismicTable\" })\n\nconst { componentsConfig } = usePrismic()\n\nconst resolvedComponents = computed<VueTableComponents & VueRichTextComponents>(\n\t() => {\n\t\treturn { ...componentsConfig?.defaultComponents, ...props.components }\n\t},\n)\n\nfunction getInternalComponent(type: keyof VueTableComponents) {\n\tconst maybeComponentOrShorthand = resolvedComponents.value?.[type]\n\n\tif (isVueComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: defaultTableComponents[type],\n\t\tshorthand: maybeComponentOrShorthand as VueComponentShorthand,\n\t}\n}\n\nconst internalTableComponents = computed<InternalVueTableComponents>(() => {\n\treturn {\n\t\ttable: getInternalComponent(\"table\"),\n\t\tthead: getInternalComponent(\"thead\"),\n\t\ttbody: getInternalComponent(\"tbody\"),\n\t\ttr: getInternalComponent(\"tr\"),\n\t\tth: getInternalComponent(\"th\"),\n\t\ttd: getInternalComponent(\"td\"),\n\t}\n})\n</script>\n\n<template>\n\t<component\n\t\tv-if=\"isFilled.table(field)\"\n\t\t:is=\"internalTableComponents.table.is\"\n\t\t:table=\"field\"\n\t\tv-bind=\"{ ...$attrs, ...internalTableComponents.table.shorthand }\"\n\t>\n\t\t<component\n\t\t\tv-if=\"field.head\"\n\t\t\t:is=\"internalTableComponents.thead.is\"\n\t\t\t:head=\"field.head\"\n\t\t\tv-bind=\"internalTableComponents.thead.shorthand\"\n\t\t>\n\t\t\t<PrismicTableRow\n\t\t\t\tv-for=\"row in field.head.rows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\t:row=\"row\"\n\t\t\t\t:internalTableComponents=\"internalTableComponents\"\n\t\t\t\t:components=\"components\"\n\t\t\t/>\n\t\t</component>\n\t\t<component\n\t\t\t:is=\"internalTableComponents.tbody.is\"\n\t\t\t:body=\"field.body\"\n\t\t\tv-bind=\"internalTableComponents.tbody.shorthand\"\n\t\t>\n\t\t\t<PrismicTableRow\n\t\t\t\tv-for=\"row in field.body.rows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\t:row=\"row\"\n\t\t\t\t:internalTableComponents=\"internalTableComponents\"\n\t\t\t\t:components=\"components\"\n\t\t\t/>\n\t\t</component>\n\t</component>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" v-bind=\"$attrs\" />\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicTable.js","names":[],"sources":["../../../src/PrismicTable/PrismicTable.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { type TableField, isFilled } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { VueShorthand } from \"../PrismicRichText/types\"\nimport { type ComponentOrTagName, isVueComponent } from \"../types\"\nimport type { InternalVueTableComponents, VueTableComponents } from \"./types\"\n\nimport type { VueRichTextSerializer } from \"../PrismicRichText\"\n\nimport { defaultTableComponents } from \"./PrismicTableDefaultComponents\"\nimport PrismicTableRow from \"./PrismicTableRow.vue\"\n\n/**\n * Props for `<PrismicTable />`.\n */\nexport type PrismicTableProps = {\n\t/** The Prismic table field to render. */\n\tfield: TableField | undefined\n\n\t/**\n\t * An object that maps a table block type to a Vue component or a shorthand definition.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * table: Table,\n\t * thead: { class: 'bg-black text-white' },\n\t * th: { as: 'td', class: 'font-bold' },\n\t * }\n\t * ```\n\t */\n\tcomponents?: VueTableComponents & VueRichTextSerializer\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` (nothing) will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\nconst props = defineProps<PrismicTableProps>()\ndefineOptions({ name: \"PrismicTable\" })\n\nfunction getInternalComponent(type: keyof VueTableComponents) {\n\tconst maybeComponentOrShorthand = props.components?.[type]\n\n\tif (isVueComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: defaultTableComponents[type],\n\t\tshorthand: maybeComponentOrShorthand as VueShorthand,\n\t}\n}\n\nconst tableComponents = computed<InternalVueTableComponents>(() => {\n\treturn {\n\t\ttable: getInternalComponent(\"table\"),\n\t\tthead: getInternalComponent(\"thead\"),\n\t\ttbody: getInternalComponent(\"tbody\"),\n\t\ttr: getInternalComponent(\"tr\"),\n\t\tth: getInternalComponent(\"th\"),\n\t\ttd: getInternalComponent(\"td\"),\n\t}\n})\n</script>\n\n<template>\n\t<component\n\t\tv-if=\"isFilled.table(field)\"\n\t\t:is=\"tableComponents.table.is\"\n\t\t:table=\"field\"\n\t\tv-bind=\"{ ...$attrs, ...tableComponents.table.shorthand }\"\n\t>\n\t\t<component\n\t\t\tv-if=\"field.head\"\n\t\t\t:is=\"tableComponents.thead.is\"\n\t\t\t:head=\"field.head\"\n\t\t\tv-bind=\"tableComponents.thead.shorthand\"\n\t\t>\n\t\t\t<PrismicTableRow\n\t\t\t\tv-for=\"row in field.head.rows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\t:row=\"row\"\n\t\t\t\t:internalTableComponents=\"tableComponents\"\n\t\t\t\t:components=\"components\"\n\t\t\t/>\n\t\t</component>\n\t\t<component\n\t\t\t:is=\"tableComponents.tbody.is\"\n\t\t\t:body=\"field.body\"\n\t\t\tv-bind=\"tableComponents.tbody.shorthand\"\n\t\t>\n\t\t\t<PrismicTableRow\n\t\t\t\tv-for=\"row in field.body.rows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\t:row=\"row\"\n\t\t\t\t:internalTableComponents=\"tableComponents\"\n\t\t\t\t:components=\"components\"\n\t\t\t/>\n\t\t</component>\n\t</component>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" v-bind=\"$attrs\" />\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"PrismicTable.js","names":[],"sources":["../../../src/PrismicTable/PrismicTable.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { type TableField, isFilled } from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport type { ComponentOrTagName, VueComponentShorthand } from \"../types\"\nimport { isVueComponent } from \"../types\"\nimport type { InternalVueTableComponents, VueTableComponents } from \"./types\"\n\nimport type { VueRichTextComponents } from \"../PrismicRichText\"\nimport { usePrismic } from \"../createPrismic\"\n\nimport { defaultTableComponents } from \"./PrismicTableDefaultComponents\"\nimport PrismicTableRow from \"./PrismicTableRow.vue\"\n\n/** Props for `<PrismicTable />`. */\nexport type PrismicTableProps = {\n\t/** The Prismic table field to render. */\n\tfield: TableField | undefined\n\n\t/**\n\t * An object that maps a table block type to a Vue component or a shorthand\n\t * definition.\n\t *\n\t * @example\n\t *\n\t * ```javascript\n\t * {\n\t * table: Table,\n\t * thead: { class: 'bg-black text-white' },\n\t * th: { as: 'td', class: 'font-bold' },\n\t * }\n\t * ```\n\t */\n\tcomponents?: VueTableComponents & VueRichTextComponents\n\n\t/**\n\t * The value to be rendered when the field is empty. If a fallback is not\n\t * given, `null` (nothing) will be rendered.\n\t */\n\tfallback?: ComponentOrTagName\n}\n\nconst props = defineProps<PrismicTableProps>()\ndefineOptions({ name: \"PrismicTable\" })\n\nconst { componentsConfig } = usePrismic()\n\nconst resolvedComponents = computed<VueTableComponents & VueRichTextComponents>(\n\t() => {\n\t\treturn { ...componentsConfig?.defaultComponents, ...props.components }\n\t},\n)\n\nfunction getInternalComponent(type: keyof VueTableComponents) {\n\tconst maybeComponentOrShorthand = resolvedComponents.value?.[type]\n\n\tif (isVueComponent(maybeComponentOrShorthand)) {\n\t\treturn { is: maybeComponentOrShorthand }\n\t}\n\n\treturn {\n\t\tis: defaultTableComponents[type],\n\t\tshorthand: maybeComponentOrShorthand as VueComponentShorthand,\n\t}\n}\n\nconst internalTableComponents = computed<InternalVueTableComponents>(() => {\n\treturn {\n\t\ttable: getInternalComponent(\"table\"),\n\t\tthead: getInternalComponent(\"thead\"),\n\t\ttbody: getInternalComponent(\"tbody\"),\n\t\ttr: getInternalComponent(\"tr\"),\n\t\tth: getInternalComponent(\"th\"),\n\t\ttd: getInternalComponent(\"td\"),\n\t}\n})\n</script>\n\n<template>\n\t<component\n\t\tv-if=\"isFilled.table(field)\"\n\t\t:is=\"internalTableComponents.table.is\"\n\t\t:table=\"field\"\n\t\tv-bind=\"{ ...$attrs, ...internalTableComponents.table.shorthand }\"\n\t>\n\t\t<component\n\t\t\tv-if=\"field.head\"\n\t\t\t:is=\"internalTableComponents.thead.is\"\n\t\t\t:head=\"field.head\"\n\t\t\tv-bind=\"internalTableComponents.thead.shorthand\"\n\t\t>\n\t\t\t<PrismicTableRow\n\t\t\t\tv-for=\"row in field.head.rows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\t:row=\"row\"\n\t\t\t\t:internalTableComponents=\"internalTableComponents\"\n\t\t\t\t:components=\"components\"\n\t\t\t/>\n\t\t</component>\n\t\t<component\n\t\t\t:is=\"internalTableComponents.tbody.is\"\n\t\t\t:body=\"field.body\"\n\t\t\tv-bind=\"internalTableComponents.tbody.shorthand\"\n\t\t>\n\t\t\t<PrismicTableRow\n\t\t\t\tv-for=\"row in field.body.rows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\t:row=\"row\"\n\t\t\t\t:internalTableComponents=\"internalTableComponents\"\n\t\t\t\t:components=\"components\"\n\t\t\t/>\n\t\t</component>\n\t</component>\n\t<component v-else-if=\"fallback\" :is=\"fallback\" v-bind=\"$attrs\" />\n</template>\n"],"mappings":""}
@@ -1,19 +1,18 @@
1
1
  import { ComponentOrTagName } from "../types.js";
2
- import { VueRichTextSerializer } from "../PrismicRichText/types.js";
2
+ import { VueRichTextComponents } from "../PrismicRichText/types.js";
3
3
  import "../PrismicRichText/index.js";
4
4
  import { VueTableComponents } from "./types.js";
5
5
  import * as vue0 from "vue";
6
6
  import { TableField } from "@prismicio/client";
7
7
 
8
8
  //#region src/PrismicTable/PrismicTable.vue.d.ts
9
- /**
10
- * Props for `<PrismicTable />`.
11
- */
9
+ /** Props for `<PrismicTable />`. */
12
10
  type PrismicTableProps = {
13
11
  /** The Prismic table field to render. */
14
12
  field: TableField | undefined;
15
13
  /**
16
- * An object that maps a table block type to a Vue component or a shorthand definition.
14
+ * An object that maps a table block type to a Vue component or a shorthand
15
+ * definition.
17
16
  *
18
17
  * @example
19
18
  *
@@ -25,7 +24,7 @@ type PrismicTableProps = {
25
24
  * }
26
25
  * ```
27
26
  */
28
- components?: VueTableComponents & VueRichTextSerializer;
27
+ components?: VueTableComponents & VueRichTextComponents;
29
28
  /**
30
29
  * The value to be rendered when the field is empty. If a fallback is not
31
30
  * given, `null` (nothing) will be rendered.
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicTable.vue.d.ts","names":[],"sources":["../../../src/PrismicTable/PrismicTable.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;;KA4HY,iBAAA;EAAA;EAEJ,KAAA,EAAA,UAAA,GAAA,SAAA;EAeM;;;;AAOb;;;;;;;;;EAkJiB,UAAA,CAAA,EAzJJ,kBAyJI,GAzJiB,qBAyJjB;EAAA;AAAA;;;aAnJN;;cAmJN,cAAY,IAAA,CAAA,gBAAA,mCAAA,IAAA,CAAA,qBAAA,EAAA,IAAA,CAAA,qBAAA,cAAA,IAAA,CAAA,WAAA,EAAA,SAAA,qBAAA,sCAAA,IAAA,CAAA,uBAAA;cAAA,iBAGU"}
1
+ {"version":3,"file":"PrismicTable.vue.d.ts","names":[],"sources":["../../../src/PrismicTable/PrismicTable.vue"],"sourcesContent":[],"mappings":";;;;;;;;;KAmIY,iBAAA;;SAEJ;EAFI;;;;;;AAyBX;;;;;;;;EA0JiB,UAAA,CAAA,EAjKJ,kBAiKI,GAjKiB,qBAiKjB;EAAA;;AAAA;;aA3JN;;cA2JN,cAAY,IAAA,CAAA,gBAAA,mCAAA,IAAA,CAAA,qBAAA,EAAA,IAAA,CAAA,qBAAA,cAAA,IAAA,CAAA,WAAA,EAAA,SAAA,qBAAA,sCAAA,IAAA,CAAA,uBAAA;cAAA,iBAGU"}