@prismicio/vue 5.0.0 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  const vue = require("vue");
3
3
  const client = require("@prismicio/client");
4
- const esmEnv = require("esm-env");
5
- const devMsg = require("./lib/devMsg.cjs");
6
4
  const isInternalURL = require("./lib/isInternalURL.cjs");
7
5
  const usePrismic = require("./usePrismic.cjs");
8
6
  const defaultInternalComponent = "router-link";
@@ -22,40 +20,6 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
22
20
  setup(__props) {
23
21
  const props = __props;
24
22
  const { options } = usePrismic.usePrismic();
25
- if (esmEnv.DEV) {
26
- vue.watchEffect(() => {
27
- if (props.field) {
28
- if (!props.field.link_type) {
29
- console.error(
30
- `[PrismicLink] This "field" prop value caused an error to be thrown.
31
- `,
32
- props.field
33
- );
34
- throw new Error(
35
- `[PrismicLink] The provided field is missing required properties to properly render a link. The link will not render. For more details, see ${devMsg.devMsg(
36
- "missing-link-properties"
37
- )}`
38
- );
39
- } else if (("text" in props.field ? Object.keys(props.field).length > 2 : Object.keys(props.field).length > 1) && !("url" in props.field || "uid" in props.field || "id" in props.field)) {
40
- console.warn(
41
- `[PrismicLink] The provided field is missing required properties to properly render a link. The link may not render correctly. For more details, see ${devMsg.devMsg(
42
- "missing-link-properties"
43
- )}`,
44
- props.field
45
- );
46
- }
47
- } else if (props.document) {
48
- if (!("url" in props.document || "id" in props.document)) {
49
- console.warn(
50
- `[PrismicLink] The provided document is missing required properties to properly render a link. The link may not render correctly. For more details, see ${devMsg.devMsg(
51
- "missing-link-properties"
52
- )}`,
53
- props.document
54
- );
55
- }
56
- }
57
- });
58
- }
59
23
  const rawAttrs = vue.computed(() => {
60
24
  return client.asLinkAttrs(props.field || props.document, {
61
25
  linkResolver: props.linkResolver || options.linkResolver,
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicLink.vue.cjs","sources":["../src/PrismicLink.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { AsLinkAttrsConfig } from \"@prismicio/client\"\nimport {\n\ttype LinkField,\n\ttype LinkResolverFunction,\n\ttype PrismicDocument,\n\tasLinkAttrs,\n} from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { computed, watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\nimport { isInternalURL } from \"./lib/isInternalURL\"\n\nimport type { ComponentOrTagName } from \"./types\"\n\nimport { usePrismic } from \"./usePrismic\"\n\n/**\n * The default component rendered for internal URLs.\n */\nconst defaultInternalComponent = \"router-link\"\n\n/**\n * The default component rendered for external URLs.\n */\nconst defaultExternalComponent = \"a\"\n\n/**\n * The default rel attribute rendered for external URLs.\n */\nconst defaultExternalRelAttribute = \"noreferrer\"\n\n/**\n * Props for `<PrismicLink />`.\n */\nexport type PrismicLinkProps = {\n\t/**\n\t * A link resolver function used to resolve links when not using the route\n\t * resolver parameter with `@prismicio/client`.\n\t *\n\t * @defaultValue The link resolver provided to `@prismicio/vue` plugin if configured.\n\t *\n\t * @see Link resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#link-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The `rel` attribute for the link. By default, `\"noreferrer\"` is provided if\n\t * the link's URL is external. This prop can be provided a function to use the\n\t * link's metadata to determine the `rel` value.\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured.\n\t */\n\trel?: string | AsLinkAttrsConfig[\"rel\"]\n\n\t/**\n\t * An HTML tag name or a component used to render internal links.\n\t *\n\t * @remarks\n\t * HTML tag names will be rendered using the anchor tag interface (`href`,\n\t * `target`, and `rel` attributes).\n\t * @remarks\n\t * Components will be rendered using Vue Router {@link RouterLink} interface\n\t * (`to` props).\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured, {@link RouterLink} otherwise.\n\t */\n\tinternalComponent?: ComponentOrTagName\n\n\t/**\n\t * An HTML tag name or a component used to render external links.\n\t *\n\t * @remarks\n\t * HTML tag names will be rendered using the anchor tag interface (`href`,\n\t * `target`, and `rel` attributes).\n\t * @remarks\n\t * Components will be rendered using Vue Router {@link RouterLink} interface\n\t * (`to` props).\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured, `\"a\"` otherwise.\n\t */\n\texternalComponent?: ComponentOrTagName\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * The Prismic link field to render.\n\t\t\t */\n\t\t\tfield: LinkField\n\t\t\tdocument?: never\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The Prismic document to render as a link.\n\t\t\t */\n\t\t\tdocument: PrismicDocument\n\t\t\tfield?: never\n\t }\n)\n\nconst props = defineProps<PrismicLinkProps>()\ndefineOptions({ name: \"PrismicLink\" })\n\nconst { options } = usePrismic()\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (props.field) {\n\t\t\tif (!props.field.link_type) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[PrismicLink] This \"field\" prop value caused an error to be thrown.\\n`,\n\t\t\t\t\tprops.field,\n\t\t\t\t)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`[PrismicLink] The provided field is missing required properties to properly render a link. The link will not render. For more details, see ${devMsg(\n\t\t\t\t\t\t\"missing-link-properties\",\n\t\t\t\t\t)}`,\n\t\t\t\t)\n\t\t\t} else if (\n\t\t\t\t(\"text\" in props.field\n\t\t\t\t\t? Object.keys(props.field).length > 2\n\t\t\t\t\t: Object.keys(props.field).length > 1) &&\n\t\t\t\t!(\"url\" in props.field || \"uid\" in props.field || \"id\" in props.field)\n\t\t\t) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[PrismicLink] The provided field is missing required properties to properly render a link. The link may not render correctly. For more details, see ${devMsg(\n\t\t\t\t\t\t\"missing-link-properties\",\n\t\t\t\t\t)}`,\n\t\t\t\t\tprops.field,\n\t\t\t\t)\n\t\t\t}\n\t\t} else if (props.document) {\n\t\t\tif (!(\"url\" in props.document || \"id\" in props.document)) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[PrismicLink] The provided document is missing required properties to properly render a link. The link may not render correctly. For more details, see ${devMsg(\n\t\t\t\t\t\t\"missing-link-properties\",\n\t\t\t\t\t)}`,\n\t\t\t\t\tprops.document,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t})\n}\n\nconst rawAttrs = computed(() => {\n\treturn asLinkAttrs(props.field || props.document, {\n\t\tlinkResolver: props.linkResolver || options.linkResolver,\n\t\trel(args) {\n\t\t\tconst maybeRel = props.rel || options.components?.linkRel\n\t\t\tif (maybeRel) {\n\t\t\t\treturn typeof maybeRel === \"function\" ? maybeRel(args) : maybeRel\n\t\t\t}\n\n\t\t\treturn args.isExternal ? defaultExternalRelAttribute : undefined\n\t\t},\n\t})\n})\n\nconst component = computed(() => {\n\treturn isInternalURL(rawAttrs.value.href || \"\")\n\t\t? props.internalComponent ||\n\t\t\t\toptions.components?.linkInternalComponent ||\n\t\t\t\tdefaultInternalComponent\n\t\t: props.externalComponent ||\n\t\t\t\toptions.components?.linkExternalComponent ||\n\t\t\t\tdefaultExternalComponent\n})\n\n// Match Vue Router's `<RouterLink />` interface unless the component is an anchor tag.\nconst attrs = computed(() => {\n\treturn component.value === \"a\"\n\t\t? {\n\t\t\t\thref: rawAttrs.value.href,\n\t\t\t\ttarget: rawAttrs.value.target,\n\t\t\t\trel: rawAttrs.value.rel,\n\t\t\t}\n\t\t: {\n\t\t\t\tto: rawAttrs.value.href,\n\t\t\t\ttarget: rawAttrs.value.target,\n\t\t\t\trel: rawAttrs.value.rel,\n\t\t\t}\n})\n</script>\n\n<template>\n\t<component :is=\"component\" v-bind=\"attrs\">\n\t\t<slot>\n\t\t\t{{ props.field && \"text\" in props.field ? props.field.text : undefined }}\n\t\t</slot>\n\t</component>\n</template>\n"],"names":["usePrismic","DEV","watchEffect","devMsg","computed","asLinkAttrs","isInternalURL"],"mappings":";;;;;;;AAqBA,MAAM,2BAA2B;AAKjC,MAAM,2BAA2B;AAKjC,MAAM,8BAA8B;;;;;;;;;;;;;AAqEpC,UAAM,QAAQ;AAGR,UAAA,EAAE,QAAQ,IAAIA,sBAAW;AAE/B,QAAIC,YAAK;AACRC,UAAAA,YAAY,MAAM;AACjB,YAAI,MAAM,OAAO;AACZ,cAAA,CAAC,MAAM,MAAM,WAAW;AACnB,oBAAA;AAAA,cACP;AAAA;AAAA,cACA,MAAM;AAAA,YACP;AACA,kBAAM,IAAI;AAAA,cACT,8IAA8IC,OAAA;AAAA,gBAC7I;AAAA,cAAA,CACA;AAAA,YACF;AAAA,UACD,YACE,UAAU,MAAM,QACd,OAAO,KAAK,MAAM,KAAK,EAAE,SAAS,IAClC,OAAO,KAAK,MAAM,KAAK,EAAE,SAAS,MACrC,EAAE,SAAS,MAAM,SAAS,SAAS,MAAM,SAAS,QAAQ,MAAM,QAC/D;AACO,oBAAA;AAAA,cACP,uJAAuJA,OAAA;AAAA,gBACtJ;AAAA,cAAA,CACA;AAAA,cACD,MAAM;AAAA,YACP;AAAA,UAAA;AAAA,QACD,WACU,MAAM,UAAU;AAC1B,cAAI,EAAE,SAAS,MAAM,YAAY,QAAQ,MAAM,WAAW;AACjD,oBAAA;AAAA,cACP,0JAA0JA,OAAA;AAAA,gBACzJ;AAAA,cAAA,CACA;AAAA,cACD,MAAM;AAAA,YACP;AAAA,UAAA;AAAA,QACD;AAAA,MACD,CACA;AAAA,IAAA;AAGI,UAAA,WAAWC,IAAAA,SAAS,MAAM;AAC/B,aAAOC,OAAY,YAAA,MAAM,SAAS,MAAM,UAAU;AAAA,QACjD,cAAc,MAAM,gBAAgB,QAAQ;AAAA,QAC5C,IAAI,MAAM;;AACT,gBAAM,WAAW,MAAM,SAAO,aAAQ,eAAR,mBAAoB;AAClD,cAAI,UAAU;AACb,mBAAO,OAAO,aAAa,aAAa,SAAS,IAAI,IAAI;AAAA,UAAA;AAGnD,iBAAA,KAAK,aAAa,8BAA8B;AAAA,QAAA;AAAA,MACxD,CACA;AAAA,IAAA,CACD;AAEK,UAAA,YAAYD,IAAAA,SAAS,MAAM;;AAChC,aAAOE,cAAAA,cAAc,SAAS,MAAM,QAAQ,EAAE,IAC3C,MAAM,uBACN,aAAQ,eAAR,mBAAoB,0BACpB,2BACA,MAAM,uBACN,aAAQ,eAAR,mBAAoB,0BACpB;AAAA,IAAA,CACH;AAGK,UAAA,QAAQF,IAAAA,SAAS,MAAM;AACrB,aAAA,UAAU,UAAU,MACxB;AAAA,QACA,MAAM,SAAS,MAAM;AAAA,QACrB,QAAQ,SAAS,MAAM;AAAA,QACvB,KAAK,SAAS,MAAM;AAAA,MAAA,IAEpB;AAAA,QACA,IAAI,SAAS,MAAM;AAAA,QACnB,QAAQ,SAAS,MAAM;AAAA,QACvB,KAAK,SAAS,MAAM;AAAA,MACrB;AAAA,IAAA,CACF;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"PrismicLink.vue.cjs","sources":["../src/PrismicLink.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { AsLinkAttrsConfig } from \"@prismicio/client\"\nimport {\n\ttype LinkField,\n\ttype LinkResolverFunction,\n\ttype PrismicDocument,\n\tasLinkAttrs,\n} from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport { isInternalURL } from \"./lib/isInternalURL\"\n\nimport type { ComponentOrTagName } from \"./types\"\n\nimport { usePrismic } from \"./usePrismic\"\n\n/**\n * The default component rendered for internal URLs.\n */\nconst defaultInternalComponent = \"router-link\"\n\n/**\n * The default component rendered for external URLs.\n */\nconst defaultExternalComponent = \"a\"\n\n/**\n * The default rel attribute rendered for external URLs.\n */\nconst defaultExternalRelAttribute = \"noreferrer\"\n\n/**\n * Props for `<PrismicLink />`.\n */\nexport type PrismicLinkProps = {\n\t/**\n\t * A link resolver function used to resolve links when not using the route\n\t * resolver parameter with `@prismicio/client`.\n\t *\n\t * @defaultValue The link resolver provided to `@prismicio/vue` plugin if configured.\n\t *\n\t * @see Link resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#link-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The `rel` attribute for the link. By default, `\"noreferrer\"` is provided if\n\t * the link's URL is external. This prop can be provided a function to use the\n\t * link's metadata to determine the `rel` value.\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured.\n\t */\n\trel?: string | AsLinkAttrsConfig[\"rel\"]\n\n\t/**\n\t * An HTML tag name or a component used to render internal links.\n\t *\n\t * @remarks\n\t * HTML tag names will be rendered using the anchor tag interface (`href`,\n\t * `target`, and `rel` attributes).\n\t * @remarks\n\t * Components will be rendered using Vue Router {@link RouterLink} interface\n\t * (`to` props).\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured, {@link RouterLink} otherwise.\n\t */\n\tinternalComponent?: ComponentOrTagName\n\n\t/**\n\t * An HTML tag name or a component used to render external links.\n\t *\n\t * @remarks\n\t * HTML tag names will be rendered using the anchor tag interface (`href`,\n\t * `target`, and `rel` attributes).\n\t * @remarks\n\t * Components will be rendered using Vue Router {@link RouterLink} interface\n\t * (`to` props).\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured, `\"a\"` otherwise.\n\t */\n\texternalComponent?: ComponentOrTagName\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * The Prismic link field to render.\n\t\t\t */\n\t\t\tfield: LinkField\n\t\t\tdocument?: never\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The Prismic document to render as a link.\n\t\t\t */\n\t\t\tdocument: PrismicDocument\n\t\t\tfield?: never\n\t }\n)\n\nconst props = defineProps<PrismicLinkProps>()\ndefineOptions({ name: \"PrismicLink\" })\n\nconst { options } = usePrismic()\n\nconst rawAttrs = computed(() => {\n\treturn asLinkAttrs(props.field || props.document, {\n\t\tlinkResolver: props.linkResolver || options.linkResolver,\n\t\trel(args) {\n\t\t\tconst maybeRel = props.rel || options.components?.linkRel\n\t\t\tif (maybeRel) {\n\t\t\t\treturn typeof maybeRel === \"function\" ? maybeRel(args) : maybeRel\n\t\t\t}\n\n\t\t\treturn args.isExternal ? defaultExternalRelAttribute : undefined\n\t\t},\n\t})\n})\n\nconst component = computed(() => {\n\treturn isInternalURL(rawAttrs.value.href || \"\")\n\t\t? props.internalComponent ||\n\t\t\t\toptions.components?.linkInternalComponent ||\n\t\t\t\tdefaultInternalComponent\n\t\t: props.externalComponent ||\n\t\t\t\toptions.components?.linkExternalComponent ||\n\t\t\t\tdefaultExternalComponent\n})\n\n// Match Vue Router's `<RouterLink />` interface unless the component is an anchor tag.\nconst attrs = computed(() => {\n\treturn component.value === \"a\"\n\t\t? {\n\t\t\t\thref: rawAttrs.value.href,\n\t\t\t\ttarget: rawAttrs.value.target,\n\t\t\t\trel: rawAttrs.value.rel,\n\t\t\t}\n\t\t: {\n\t\t\t\tto: rawAttrs.value.href,\n\t\t\t\ttarget: rawAttrs.value.target,\n\t\t\t\trel: rawAttrs.value.rel,\n\t\t\t}\n})\n</script>\n\n<template>\n\t<component :is=\"component\" v-bind=\"attrs\">\n\t\t<slot>\n\t\t\t{{ props.field && \"text\" in props.field ? props.field.text : undefined }}\n\t\t</slot>\n\t</component>\n</template>\n"],"names":["usePrismic","computed","asLinkAttrs","isInternalURL"],"mappings":";;;;;AAmBA,MAAM,2BAA2B;AAKjC,MAAM,2BAA2B;AAKjC,MAAM,8BAA8B;;;;;;;;;;;;;AAqEpC,UAAM,QAAQ;AAGR,UAAA,EAAE,QAAQ,IAAIA,sBAAW;AAEzB,UAAA,WAAWC,IAAAA,SAAS,MAAM;AAC/B,aAAOC,OAAY,YAAA,MAAM,SAAS,MAAM,UAAU;AAAA,QACjD,cAAc,MAAM,gBAAgB,QAAQ;AAAA,QAC5C,IAAI,MAAM;;AACT,gBAAM,WAAW,MAAM,SAAO,aAAQ,eAAR,mBAAoB;AAClD,cAAI,UAAU;AACb,mBAAO,OAAO,aAAa,aAAa,SAAS,IAAI,IAAI;AAAA,UAAA;AAGnD,iBAAA,KAAK,aAAa,8BAA8B;AAAA,QAAA;AAAA,MACxD,CACA;AAAA,IAAA,CACD;AAEK,UAAA,YAAYD,IAAAA,SAAS,MAAM;;AAChC,aAAOE,cAAAA,cAAc,SAAS,MAAM,QAAQ,EAAE,IAC3C,MAAM,uBACN,aAAQ,eAAR,mBAAoB,0BACpB,2BACA,MAAM,uBACN,aAAQ,eAAR,mBAAoB,0BACpB;AAAA,IAAA,CACH;AAGK,UAAA,QAAQF,IAAAA,SAAS,MAAM;AACrB,aAAA,UAAU,UAAU,MACxB;AAAA,QACA,MAAM,SAAS,MAAM;AAAA,QACrB,QAAQ,SAAS,MAAM;AAAA,QACvB,KAAK,SAAS,MAAM;AAAA,MAAA,IAEpB;AAAA,QACA,IAAI,SAAS,MAAM;AAAA,QACnB,QAAQ,SAAS,MAAM;AAAA,QACvB,KAAK,SAAS,MAAM;AAAA,MACrB;AAAA,IAAA,CACF;;;;;;;;;;;;;;"}
@@ -1,7 +1,5 @@
1
- import { defineComponent, watchEffect, computed, openBlock, createBlock, resolveDynamicComponent, normalizeProps, guardReactiveProps, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
1
+ import { defineComponent, computed, openBlock, createBlock, resolveDynamicComponent, normalizeProps, guardReactiveProps, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
2
2
  import { asLinkAttrs } from "@prismicio/client";
3
- import { DEV } from "esm-env";
4
- import { devMsg } from "./lib/devMsg.js";
5
3
  import { isInternalURL } from "./lib/isInternalURL.js";
6
4
  import { usePrismic } from "./usePrismic.js";
7
5
  const defaultInternalComponent = "router-link";
@@ -21,40 +19,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
21
19
  setup(__props) {
22
20
  const props = __props;
23
21
  const { options } = usePrismic();
24
- if (DEV) {
25
- watchEffect(() => {
26
- if (props.field) {
27
- if (!props.field.link_type) {
28
- console.error(
29
- `[PrismicLink] This "field" prop value caused an error to be thrown.
30
- `,
31
- props.field
32
- );
33
- throw new Error(
34
- `[PrismicLink] The provided field is missing required properties to properly render a link. The link will not render. For more details, see ${devMsg(
35
- "missing-link-properties"
36
- )}`
37
- );
38
- } else if (("text" in props.field ? Object.keys(props.field).length > 2 : Object.keys(props.field).length > 1) && !("url" in props.field || "uid" in props.field || "id" in props.field)) {
39
- console.warn(
40
- `[PrismicLink] The provided field is missing required properties to properly render a link. The link may not render correctly. For more details, see ${devMsg(
41
- "missing-link-properties"
42
- )}`,
43
- props.field
44
- );
45
- }
46
- } else if (props.document) {
47
- if (!("url" in props.document || "id" in props.document)) {
48
- console.warn(
49
- `[PrismicLink] The provided document is missing required properties to properly render a link. The link may not render correctly. For more details, see ${devMsg(
50
- "missing-link-properties"
51
- )}`,
52
- props.document
53
- );
54
- }
55
- }
56
- });
57
- }
58
22
  const rawAttrs = computed(() => {
59
23
  return asLinkAttrs(props.field || props.document, {
60
24
  linkResolver: props.linkResolver || options.linkResolver,
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicLink.vue.js","sources":["../src/PrismicLink.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { AsLinkAttrsConfig } from \"@prismicio/client\"\nimport {\n\ttype LinkField,\n\ttype LinkResolverFunction,\n\ttype PrismicDocument,\n\tasLinkAttrs,\n} from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport { computed, watchEffect } from \"vue\"\n\nimport { devMsg } from \"./lib/devMsg\"\nimport { isInternalURL } from \"./lib/isInternalURL\"\n\nimport type { ComponentOrTagName } from \"./types\"\n\nimport { usePrismic } from \"./usePrismic\"\n\n/**\n * The default component rendered for internal URLs.\n */\nconst defaultInternalComponent = \"router-link\"\n\n/**\n * The default component rendered for external URLs.\n */\nconst defaultExternalComponent = \"a\"\n\n/**\n * The default rel attribute rendered for external URLs.\n */\nconst defaultExternalRelAttribute = \"noreferrer\"\n\n/**\n * Props for `<PrismicLink />`.\n */\nexport type PrismicLinkProps = {\n\t/**\n\t * A link resolver function used to resolve links when not using the route\n\t * resolver parameter with `@prismicio/client`.\n\t *\n\t * @defaultValue The link resolver provided to `@prismicio/vue` plugin if configured.\n\t *\n\t * @see Link resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#link-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The `rel` attribute for the link. By default, `\"noreferrer\"` is provided if\n\t * the link's URL is external. This prop can be provided a function to use the\n\t * link's metadata to determine the `rel` value.\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured.\n\t */\n\trel?: string | AsLinkAttrsConfig[\"rel\"]\n\n\t/**\n\t * An HTML tag name or a component used to render internal links.\n\t *\n\t * @remarks\n\t * HTML tag names will be rendered using the anchor tag interface (`href`,\n\t * `target`, and `rel` attributes).\n\t * @remarks\n\t * Components will be rendered using Vue Router {@link RouterLink} interface\n\t * (`to` props).\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured, {@link RouterLink} otherwise.\n\t */\n\tinternalComponent?: ComponentOrTagName\n\n\t/**\n\t * An HTML tag name or a component used to render external links.\n\t *\n\t * @remarks\n\t * HTML tag names will be rendered using the anchor tag interface (`href`,\n\t * `target`, and `rel` attributes).\n\t * @remarks\n\t * Components will be rendered using Vue Router {@link RouterLink} interface\n\t * (`to` props).\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured, `\"a\"` otherwise.\n\t */\n\texternalComponent?: ComponentOrTagName\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * The Prismic link field to render.\n\t\t\t */\n\t\t\tfield: LinkField\n\t\t\tdocument?: never\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The Prismic document to render as a link.\n\t\t\t */\n\t\t\tdocument: PrismicDocument\n\t\t\tfield?: never\n\t }\n)\n\nconst props = defineProps<PrismicLinkProps>()\ndefineOptions({ name: \"PrismicLink\" })\n\nconst { options } = usePrismic()\n\nif (DEV) {\n\twatchEffect(() => {\n\t\tif (props.field) {\n\t\t\tif (!props.field.link_type) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[PrismicLink] This \"field\" prop value caused an error to be thrown.\\n`,\n\t\t\t\t\tprops.field,\n\t\t\t\t)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`[PrismicLink] The provided field is missing required properties to properly render a link. The link will not render. For more details, see ${devMsg(\n\t\t\t\t\t\t\"missing-link-properties\",\n\t\t\t\t\t)}`,\n\t\t\t\t)\n\t\t\t} else if (\n\t\t\t\t(\"text\" in props.field\n\t\t\t\t\t? Object.keys(props.field).length > 2\n\t\t\t\t\t: Object.keys(props.field).length > 1) &&\n\t\t\t\t!(\"url\" in props.field || \"uid\" in props.field || \"id\" in props.field)\n\t\t\t) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[PrismicLink] The provided field is missing required properties to properly render a link. The link may not render correctly. For more details, see ${devMsg(\n\t\t\t\t\t\t\"missing-link-properties\",\n\t\t\t\t\t)}`,\n\t\t\t\t\tprops.field,\n\t\t\t\t)\n\t\t\t}\n\t\t} else if (props.document) {\n\t\t\tif (!(\"url\" in props.document || \"id\" in props.document)) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[PrismicLink] The provided document is missing required properties to properly render a link. The link may not render correctly. For more details, see ${devMsg(\n\t\t\t\t\t\t\"missing-link-properties\",\n\t\t\t\t\t)}`,\n\t\t\t\t\tprops.document,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t})\n}\n\nconst rawAttrs = computed(() => {\n\treturn asLinkAttrs(props.field || props.document, {\n\t\tlinkResolver: props.linkResolver || options.linkResolver,\n\t\trel(args) {\n\t\t\tconst maybeRel = props.rel || options.components?.linkRel\n\t\t\tif (maybeRel) {\n\t\t\t\treturn typeof maybeRel === \"function\" ? maybeRel(args) : maybeRel\n\t\t\t}\n\n\t\t\treturn args.isExternal ? defaultExternalRelAttribute : undefined\n\t\t},\n\t})\n})\n\nconst component = computed(() => {\n\treturn isInternalURL(rawAttrs.value.href || \"\")\n\t\t? props.internalComponent ||\n\t\t\t\toptions.components?.linkInternalComponent ||\n\t\t\t\tdefaultInternalComponent\n\t\t: props.externalComponent ||\n\t\t\t\toptions.components?.linkExternalComponent ||\n\t\t\t\tdefaultExternalComponent\n})\n\n// Match Vue Router's `<RouterLink />` interface unless the component is an anchor tag.\nconst attrs = computed(() => {\n\treturn component.value === \"a\"\n\t\t? {\n\t\t\t\thref: rawAttrs.value.href,\n\t\t\t\ttarget: rawAttrs.value.target,\n\t\t\t\trel: rawAttrs.value.rel,\n\t\t\t}\n\t\t: {\n\t\t\t\tto: rawAttrs.value.href,\n\t\t\t\ttarget: rawAttrs.value.target,\n\t\t\t\trel: rawAttrs.value.rel,\n\t\t\t}\n})\n</script>\n\n<template>\n\t<component :is=\"component\" v-bind=\"attrs\">\n\t\t<slot>\n\t\t\t{{ props.field && \"text\" in props.field ? props.field.text : undefined }}\n\t\t</slot>\n\t</component>\n</template>\n"],"names":[],"mappings":";;;;;;AAqBA,MAAM,2BAA2B;AAKjC,MAAM,2BAA2B;AAKjC,MAAM,8BAA8B;;;;;;;;;;;;;AAqEpC,UAAM,QAAQ;AAGR,UAAA,EAAE,QAAQ,IAAI,WAAW;AAE/B,QAAI,KAAK;AACR,kBAAY,MAAM;AACjB,YAAI,MAAM,OAAO;AACZ,cAAA,CAAC,MAAM,MAAM,WAAW;AACnB,oBAAA;AAAA,cACP;AAAA;AAAA,cACA,MAAM;AAAA,YACP;AACA,kBAAM,IAAI;AAAA,cACT,8IAA8I;AAAA,gBAC7I;AAAA,cAAA,CACA;AAAA,YACF;AAAA,UACD,YACE,UAAU,MAAM,QACd,OAAO,KAAK,MAAM,KAAK,EAAE,SAAS,IAClC,OAAO,KAAK,MAAM,KAAK,EAAE,SAAS,MACrC,EAAE,SAAS,MAAM,SAAS,SAAS,MAAM,SAAS,QAAQ,MAAM,QAC/D;AACO,oBAAA;AAAA,cACP,uJAAuJ;AAAA,gBACtJ;AAAA,cAAA,CACA;AAAA,cACD,MAAM;AAAA,YACP;AAAA,UAAA;AAAA,QACD,WACU,MAAM,UAAU;AAC1B,cAAI,EAAE,SAAS,MAAM,YAAY,QAAQ,MAAM,WAAW;AACjD,oBAAA;AAAA,cACP,0JAA0J;AAAA,gBACzJ;AAAA,cAAA,CACA;AAAA,cACD,MAAM;AAAA,YACP;AAAA,UAAA;AAAA,QACD;AAAA,MACD,CACA;AAAA,IAAA;AAGI,UAAA,WAAW,SAAS,MAAM;AAC/B,aAAO,YAAY,MAAM,SAAS,MAAM,UAAU;AAAA,QACjD,cAAc,MAAM,gBAAgB,QAAQ;AAAA,QAC5C,IAAI,MAAM;;AACT,gBAAM,WAAW,MAAM,SAAO,aAAQ,eAAR,mBAAoB;AAClD,cAAI,UAAU;AACb,mBAAO,OAAO,aAAa,aAAa,SAAS,IAAI,IAAI;AAAA,UAAA;AAGnD,iBAAA,KAAK,aAAa,8BAA8B;AAAA,QAAA;AAAA,MACxD,CACA;AAAA,IAAA,CACD;AAEK,UAAA,YAAY,SAAS,MAAM;;AAChC,aAAO,cAAc,SAAS,MAAM,QAAQ,EAAE,IAC3C,MAAM,uBACN,aAAQ,eAAR,mBAAoB,0BACpB,2BACA,MAAM,uBACN,aAAQ,eAAR,mBAAoB,0BACpB;AAAA,IAAA,CACH;AAGK,UAAA,QAAQ,SAAS,MAAM;AACrB,aAAA,UAAU,UAAU,MACxB;AAAA,QACA,MAAM,SAAS,MAAM;AAAA,QACrB,QAAQ,SAAS,MAAM;AAAA,QACvB,KAAK,SAAS,MAAM;AAAA,MAAA,IAEpB;AAAA,QACA,IAAI,SAAS,MAAM;AAAA,QACnB,QAAQ,SAAS,MAAM;AAAA,QACvB,KAAK,SAAS,MAAM;AAAA,MACrB;AAAA,IAAA,CACF;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"PrismicLink.vue.js","sources":["../src/PrismicLink.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { AsLinkAttrsConfig } from \"@prismicio/client\"\nimport {\n\ttype LinkField,\n\ttype LinkResolverFunction,\n\ttype PrismicDocument,\n\tasLinkAttrs,\n} from \"@prismicio/client\"\nimport { computed } from \"vue\"\n\nimport { isInternalURL } from \"./lib/isInternalURL\"\n\nimport type { ComponentOrTagName } from \"./types\"\n\nimport { usePrismic } from \"./usePrismic\"\n\n/**\n * The default component rendered for internal URLs.\n */\nconst defaultInternalComponent = \"router-link\"\n\n/**\n * The default component rendered for external URLs.\n */\nconst defaultExternalComponent = \"a\"\n\n/**\n * The default rel attribute rendered for external URLs.\n */\nconst defaultExternalRelAttribute = \"noreferrer\"\n\n/**\n * Props for `<PrismicLink />`.\n */\nexport type PrismicLinkProps = {\n\t/**\n\t * A link resolver function used to resolve links when not using the route\n\t * resolver parameter with `@prismicio/client`.\n\t *\n\t * @defaultValue The link resolver provided to `@prismicio/vue` plugin if configured.\n\t *\n\t * @see Link resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#link-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The `rel` attribute for the link. By default, `\"noreferrer\"` is provided if\n\t * the link's URL is external. This prop can be provided a function to use the\n\t * link's metadata to determine the `rel` value.\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured.\n\t */\n\trel?: string | AsLinkAttrsConfig[\"rel\"]\n\n\t/**\n\t * An HTML tag name or a component used to render internal links.\n\t *\n\t * @remarks\n\t * HTML tag names will be rendered using the anchor tag interface (`href`,\n\t * `target`, and `rel` attributes).\n\t * @remarks\n\t * Components will be rendered using Vue Router {@link RouterLink} interface\n\t * (`to` props).\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured, {@link RouterLink} otherwise.\n\t */\n\tinternalComponent?: ComponentOrTagName\n\n\t/**\n\t * An HTML tag name or a component used to render external links.\n\t *\n\t * @remarks\n\t * HTML tag names will be rendered using the anchor tag interface (`href`,\n\t * `target`, and `rel` attributes).\n\t * @remarks\n\t * Components will be rendered using Vue Router {@link RouterLink} interface\n\t * (`to` props).\n\t *\n\t * @defaultValue The one provided to `@prismicio/vue` plugin if configured, `\"a\"` otherwise.\n\t */\n\texternalComponent?: ComponentOrTagName\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * The Prismic link field to render.\n\t\t\t */\n\t\t\tfield: LinkField\n\t\t\tdocument?: never\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The Prismic document to render as a link.\n\t\t\t */\n\t\t\tdocument: PrismicDocument\n\t\t\tfield?: never\n\t }\n)\n\nconst props = defineProps<PrismicLinkProps>()\ndefineOptions({ name: \"PrismicLink\" })\n\nconst { options } = usePrismic()\n\nconst rawAttrs = computed(() => {\n\treturn asLinkAttrs(props.field || props.document, {\n\t\tlinkResolver: props.linkResolver || options.linkResolver,\n\t\trel(args) {\n\t\t\tconst maybeRel = props.rel || options.components?.linkRel\n\t\t\tif (maybeRel) {\n\t\t\t\treturn typeof maybeRel === \"function\" ? maybeRel(args) : maybeRel\n\t\t\t}\n\n\t\t\treturn args.isExternal ? defaultExternalRelAttribute : undefined\n\t\t},\n\t})\n})\n\nconst component = computed(() => {\n\treturn isInternalURL(rawAttrs.value.href || \"\")\n\t\t? props.internalComponent ||\n\t\t\t\toptions.components?.linkInternalComponent ||\n\t\t\t\tdefaultInternalComponent\n\t\t: props.externalComponent ||\n\t\t\t\toptions.components?.linkExternalComponent ||\n\t\t\t\tdefaultExternalComponent\n})\n\n// Match Vue Router's `<RouterLink />` interface unless the component is an anchor tag.\nconst attrs = computed(() => {\n\treturn component.value === \"a\"\n\t\t? {\n\t\t\t\thref: rawAttrs.value.href,\n\t\t\t\ttarget: rawAttrs.value.target,\n\t\t\t\trel: rawAttrs.value.rel,\n\t\t\t}\n\t\t: {\n\t\t\t\tto: rawAttrs.value.href,\n\t\t\t\ttarget: rawAttrs.value.target,\n\t\t\t\trel: rawAttrs.value.rel,\n\t\t\t}\n})\n</script>\n\n<template>\n\t<component :is=\"component\" v-bind=\"attrs\">\n\t\t<slot>\n\t\t\t{{ props.field && \"text\" in props.field ? props.field.text : undefined }}\n\t\t</slot>\n\t</component>\n</template>\n"],"names":[],"mappings":";;;;AAmBA,MAAM,2BAA2B;AAKjC,MAAM,2BAA2B;AAKjC,MAAM,8BAA8B;;;;;;;;;;;;;AAqEpC,UAAM,QAAQ;AAGR,UAAA,EAAE,QAAQ,IAAI,WAAW;AAEzB,UAAA,WAAW,SAAS,MAAM;AAC/B,aAAO,YAAY,MAAM,SAAS,MAAM,UAAU;AAAA,QACjD,cAAc,MAAM,gBAAgB,QAAQ;AAAA,QAC5C,IAAI,MAAM;;AACT,gBAAM,WAAW,MAAM,SAAO,aAAQ,eAAR,mBAAoB;AAClD,cAAI,UAAU;AACb,mBAAO,OAAO,aAAa,aAAa,SAAS,IAAI,IAAI;AAAA,UAAA;AAGnD,iBAAA,KAAK,aAAa,8BAA8B;AAAA,QAAA;AAAA,MACxD,CACA;AAAA,IAAA,CACD;AAEK,UAAA,YAAY,SAAS,MAAM;;AAChC,aAAO,cAAc,SAAS,MAAM,QAAQ,EAAE,IAC3C,MAAM,uBACN,aAAQ,eAAR,mBAAoB,0BACpB,2BACA,MAAM,uBACN,aAAQ,eAAR,mBAAoB,0BACpB;AAAA,IAAA,CACH;AAGK,UAAA,QAAQ,SAAS,MAAM;AACrB,aAAA,UAAU,UAAU,MACxB;AAAA,QACA,MAAM,SAAS,MAAM;AAAA,QACrB,QAAQ,SAAS,MAAM;AAAA,QACvB,KAAK,SAAS,MAAM;AAAA,MAAA,IAEpB;AAAA,QACA,IAAI,SAAS,MAAM;AAAA,QACnB,QAAQ,SAAS,MAAM;AAAA,QACvB,KAAK,SAAS,MAAM;AAAA,MACrB;AAAA,IAAA,CACF;;;;;;;;;;;;;"}
@@ -24,7 +24,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
24
24
  vue.onMounted(() => {
25
25
  console.warn(
26
26
  `[PrismicRichText] You're using the deprecated version of \`<PrismicRichText>\` because either the \`serializer\` prop or the plugin \`richTextSerializer\` option were provided. This API will be removed in a future major. For more details, see ${devMsg.devMsg(
27
- "html-serialization-is-deprecated-with-prismic-rich-text.md"
27
+ "html-serialization-is-deprecated-with-prismic-rich-text"
28
28
  )}`
29
29
  );
30
30
  });
@@ -1 +1 @@
1
- {"version":3,"file":"DeprecatedPrismicRichText.vue.cjs","sources":["../../src/PrismicRichText/DeprecatedPrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n// TODO: Remove in v6\nimport { asHTML, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport type { Component } from \"vue\"\nimport {\n\tcomputed,\n\tinject,\n\tnextTick,\n\tonBeforeUnmount,\n\tonMounted,\n\tref,\n\twatch,\n} from \"vue\"\nimport { routerKey } from \"vue-router\"\n\nimport { devMsg } from \"../lib/devMsg\"\nimport { isInternalURL } from \"../lib/isInternalURL\"\n\nimport { usePrismic } from \"../usePrismic\"\n\nimport type { PrismicRichTextProps } from \"./PrismicRichText.vue\"\n\n/**\n * The default component rendered to wrap the HTML output.\n */\nconst defaultWrapper = \"div\"\n\nconst props = defineProps<\n\tPick<\n\t\tPrismicRichTextProps,\n\t\t\"field\" | \"linkResolver\" | \"serializer\" | \"wrapper\"\n\t> & { fallback?: string }\n>()\ndefineOptions({ name: \"DeprecatedPrismicRichText\" })\n\nconst { options } = usePrismic()\n\nif (DEV) {\n\tonMounted(() => {\n\t\tconsole.warn(\n\t\t\t`[PrismicRichText] You're using the deprecated version of \\`<PrismicRichText>\\` because either the \\`serializer\\` prop or the plugin \\`richTextSerializer\\` option were provided. This API will be removed in a future major. For more details, see ${devMsg(\n\t\t\t\t\"html-serialization-is-deprecated-with-prismic-rich-text.md\",\n\t\t\t)}`,\n\t\t)\n\t})\n}\n\nconst html = computed(() => {\n\tif (!isFilled.richText(props.field)) {\n\t\treturn props.fallback ?? \"\"\n\t}\n\n\tconst linkResolver = props.linkResolver ?? options.linkResolver\n\tconst serializer = props.serializer ?? options.richTextSerializer\n\n\treturn asHTML(props.field, { linkResolver, serializer })\n})\n\n// Internal links handling\nconst root = ref<HTMLElement | Comment | Component | null>(null)\n\nconst maybeRouter = inject(routerKey, null)\n\ntype InternalLink = {\n\telement: HTMLAnchorElement\n\tlistener: EventListener\n}\n\nlet links: InternalLink[] = []\n\nconst navigate: EventListener = function (\n\tthis: { href: string },\n\tevent: Event,\n) {\n\tevent.preventDefault()\n\tmaybeRouter?.push(this.href)\n}\n\nconst addListeners = () => {\n\tconst node: HTMLElement | Comment | null =\n\t\troot.value && \"$el\" in root.value ? root.value.$el : root.value\n\tif (node && \"querySelectorAll\" in node) {\n\t\t// Get all internal link tags and add listeners on them\n\t\tlinks = Array.from(node.querySelectorAll(\"a\"))\n\t\t\t.map((element) => {\n\t\t\t\tconst href = element.getAttribute(\"href\")\n\n\t\t\t\tif (href && isInternalURL(href)) {\n\t\t\t\t\tconst listener = navigate.bind({ href })\n\t\t\t\t\telement.addEventListener(\"click\", listener)\n\n\t\t\t\t\treturn { element, listener }\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter((link): link is InternalLink => link as boolean)\n\t}\n}\n\nconst removeListeners = () => {\n\tlinks.forEach(({ element, listener }) =>\n\t\telement.removeEventListener(\"click\", listener),\n\t)\n\tlinks = []\n}\n\nwatch(\n\thtml,\n\t() => {\n\t\tremoveListeners()\n\t\tnextTick(addListeners)\n\t},\n\t{ immediate: true },\n)\n\nonBeforeUnmount(() => {\n\tremoveListeners()\n})\n</script>\n\n<template>\n\t<component\n\t\tv-if=\"isFilled.richText(field) || fallback\"\n\t\tref=\"root\"\n\t\t:is=\"wrapper || defaultWrapper\"\n\t\tv-html=\"html\"\n\t/>\n</template>\n"],"names":["usePrismic","DEV","onMounted","devMsg","computed","isFilled","asHTML","ref","inject","routerKey","isInternalURL","watch","nextTick","onBeforeUnmount"],"mappings":";;;;;;;;AA0BA,MAAM,iBAAiB;;;;;;;;;;;;AAEvB,UAAM,QAAQ;AAQR,UAAA,EAAE,QAAQ,IAAIA,sBAAW;AAE/B,QAAIC,YAAK;AACRC,UAAAA,UAAU,MAAM;AACP,gBAAA;AAAA,UACP,sPAAsPC,OAAA;AAAA,YACrP;AAAA,UAAA,CACA;AAAA,QACF;AAAA,MAAA,CACA;AAAA,IAAA;AAGI,UAAA,OAAOC,IAAAA,SAAS,MAAM;AAC3B,UAAI,CAACC,OAAAA,SAAS,SAAS,MAAM,KAAK,GAAG;AACpC,eAAO,MAAM,YAAY;AAAA,MAAA;AAGpB,YAAA,eAAe,MAAM,gBAAgB,QAAQ;AAC7C,YAAA,aAAa,MAAM,cAAc,QAAQ;AAE/C,aAAOC,OAAAA,OAAO,MAAM,OAAO,EAAE,cAAc,YAAY;AAAA,IAAA,CACvD;AAGK,UAAA,OAAOC,QAA8C,IAAI;AAEzD,UAAA,cAAcC,IAAAA,OAAOC,UAAA,WAAW,IAAI;AAO1C,QAAI,QAAwB,CAAC;AAEvB,UAAA,WAA0B,SAE/B,OACC;AACD,YAAM,eAAe;AACR,iDAAA,KAAK,KAAK;AAAA,IACxB;AAEA,UAAM,eAAe,MAAM;AACpB,YAAA,OACL,KAAK,SAAS,SAAS,KAAK,QAAQ,KAAK,MAAM,MAAM,KAAK;AACvD,UAAA,QAAQ,sBAAsB,MAAM;AAE/B,gBAAA,MAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC,EAC3C,IAAI,CAAC,YAAY;AACX,gBAAA,OAAO,QAAQ,aAAa,MAAM;AAEpC,cAAA,QAAQC,4BAAc,IAAI,GAAG;AAChC,kBAAM,WAAW,SAAS,KAAK,EAAE,MAAM;AAC/B,oBAAA,iBAAiB,SAAS,QAAQ;AAEnC,mBAAA,EAAE,SAAS,SAAS;AAAA,UAAA,OACrB;AACC,mBAAA;AAAA,UAAA;AAAA,QAER,CAAA,EACA,OAAO,CAAC,SAA+B,IAAe;AAAA,MAAA;AAAA,IAE1D;AAEA,UAAM,kBAAkB,MAAM;AACvB,YAAA;AAAA,QAAQ,CAAC,EAAE,SAAS,SAAA,MACzB,QAAQ,oBAAoB,SAAS,QAAQ;AAAA,MAC9C;AACA,cAAQ,CAAC;AAAA,IACV;AAEAC,QAAA;AAAA,MACC;AAAA,MACA,MAAM;AACW,wBAAA;AAChBC,YAAAA,SAAS,YAAY;AAAA,MACtB;AAAA,MACA,EAAE,WAAW,KAAK;AAAA,IACnB;AAEAC,QAAAA,gBAAgB,MAAM;AACL,sBAAA;AAAA,IAAA,CAChB;;;;;;;;;;;;"}
1
+ {"version":3,"file":"DeprecatedPrismicRichText.vue.cjs","sources":["../../src/PrismicRichText/DeprecatedPrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n// TODO: Remove in v6\nimport { asHTML, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport type { Component } from \"vue\"\nimport {\n\tcomputed,\n\tinject,\n\tnextTick,\n\tonBeforeUnmount,\n\tonMounted,\n\tref,\n\twatch,\n} from \"vue\"\nimport { routerKey } from \"vue-router\"\n\nimport { devMsg } from \"../lib/devMsg\"\nimport { isInternalURL } from \"../lib/isInternalURL\"\n\nimport { usePrismic } from \"../usePrismic\"\n\nimport type { PrismicRichTextProps } from \"./PrismicRichText.vue\"\n\n/**\n * The default component rendered to wrap the HTML output.\n */\nconst defaultWrapper = \"div\"\n\nconst props = defineProps<\n\tPick<\n\t\tPrismicRichTextProps,\n\t\t\"field\" | \"linkResolver\" | \"serializer\" | \"wrapper\"\n\t> & { fallback?: string }\n>()\ndefineOptions({ name: \"DeprecatedPrismicRichText\" })\n\nconst { options } = usePrismic()\n\nif (DEV) {\n\tonMounted(() => {\n\t\tconsole.warn(\n\t\t\t`[PrismicRichText] You're using the deprecated version of \\`<PrismicRichText>\\` because either the \\`serializer\\` prop or the plugin \\`richTextSerializer\\` option were provided. This API will be removed in a future major. For more details, see ${devMsg(\n\t\t\t\t\"html-serialization-is-deprecated-with-prismic-rich-text\",\n\t\t\t)}`,\n\t\t)\n\t})\n}\n\nconst html = computed(() => {\n\tif (!isFilled.richText(props.field)) {\n\t\treturn props.fallback ?? \"\"\n\t}\n\n\tconst linkResolver = props.linkResolver ?? options.linkResolver\n\tconst serializer = props.serializer ?? options.richTextSerializer\n\n\treturn asHTML(props.field, { linkResolver, serializer })\n})\n\n// Internal links handling\nconst root = ref<HTMLElement | Comment | Component | null>(null)\n\nconst maybeRouter = inject(routerKey, null)\n\ntype InternalLink = {\n\telement: HTMLAnchorElement\n\tlistener: EventListener\n}\n\nlet links: InternalLink[] = []\n\nconst navigate: EventListener = function (\n\tthis: { href: string },\n\tevent: Event,\n) {\n\tevent.preventDefault()\n\tmaybeRouter?.push(this.href)\n}\n\nconst addListeners = () => {\n\tconst node: HTMLElement | Comment | null =\n\t\troot.value && \"$el\" in root.value ? root.value.$el : root.value\n\tif (node && \"querySelectorAll\" in node) {\n\t\t// Get all internal link tags and add listeners on them\n\t\tlinks = Array.from(node.querySelectorAll(\"a\"))\n\t\t\t.map((element) => {\n\t\t\t\tconst href = element.getAttribute(\"href\")\n\n\t\t\t\tif (href && isInternalURL(href)) {\n\t\t\t\t\tconst listener = navigate.bind({ href })\n\t\t\t\t\telement.addEventListener(\"click\", listener)\n\n\t\t\t\t\treturn { element, listener }\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter((link): link is InternalLink => link as boolean)\n\t}\n}\n\nconst removeListeners = () => {\n\tlinks.forEach(({ element, listener }) =>\n\t\telement.removeEventListener(\"click\", listener),\n\t)\n\tlinks = []\n}\n\nwatch(\n\thtml,\n\t() => {\n\t\tremoveListeners()\n\t\tnextTick(addListeners)\n\t},\n\t{ immediate: true },\n)\n\nonBeforeUnmount(() => {\n\tremoveListeners()\n})\n</script>\n\n<template>\n\t<component\n\t\tv-if=\"isFilled.richText(field) || fallback\"\n\t\tref=\"root\"\n\t\t:is=\"wrapper || defaultWrapper\"\n\t\tv-html=\"html\"\n\t/>\n</template>\n"],"names":["usePrismic","DEV","onMounted","devMsg","computed","isFilled","asHTML","ref","inject","routerKey","isInternalURL","watch","nextTick","onBeforeUnmount"],"mappings":";;;;;;;;AA0BA,MAAM,iBAAiB;;;;;;;;;;;;AAEvB,UAAM,QAAQ;AAQR,UAAA,EAAE,QAAQ,IAAIA,sBAAW;AAE/B,QAAIC,YAAK;AACRC,UAAAA,UAAU,MAAM;AACP,gBAAA;AAAA,UACP,sPAAsPC,OAAA;AAAA,YACrP;AAAA,UAAA,CACA;AAAA,QACF;AAAA,MAAA,CACA;AAAA,IAAA;AAGI,UAAA,OAAOC,IAAAA,SAAS,MAAM;AAC3B,UAAI,CAACC,OAAAA,SAAS,SAAS,MAAM,KAAK,GAAG;AACpC,eAAO,MAAM,YAAY;AAAA,MAAA;AAGpB,YAAA,eAAe,MAAM,gBAAgB,QAAQ;AAC7C,YAAA,aAAa,MAAM,cAAc,QAAQ;AAE/C,aAAOC,OAAAA,OAAO,MAAM,OAAO,EAAE,cAAc,YAAY;AAAA,IAAA,CACvD;AAGK,UAAA,OAAOC,QAA8C,IAAI;AAEzD,UAAA,cAAcC,IAAAA,OAAOC,UAAA,WAAW,IAAI;AAO1C,QAAI,QAAwB,CAAC;AAEvB,UAAA,WAA0B,SAE/B,OACC;AACD,YAAM,eAAe;AACR,iDAAA,KAAK,KAAK;AAAA,IACxB;AAEA,UAAM,eAAe,MAAM;AACpB,YAAA,OACL,KAAK,SAAS,SAAS,KAAK,QAAQ,KAAK,MAAM,MAAM,KAAK;AACvD,UAAA,QAAQ,sBAAsB,MAAM;AAE/B,gBAAA,MAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC,EAC3C,IAAI,CAAC,YAAY;AACX,gBAAA,OAAO,QAAQ,aAAa,MAAM;AAEpC,cAAA,QAAQC,4BAAc,IAAI,GAAG;AAChC,kBAAM,WAAW,SAAS,KAAK,EAAE,MAAM;AAC/B,oBAAA,iBAAiB,SAAS,QAAQ;AAEnC,mBAAA,EAAE,SAAS,SAAS;AAAA,UAAA,OACrB;AACC,mBAAA;AAAA,UAAA;AAAA,QAER,CAAA,EACA,OAAO,CAAC,SAA+B,IAAe;AAAA,MAAA;AAAA,IAE1D;AAEA,UAAM,kBAAkB,MAAM;AACvB,YAAA;AAAA,QAAQ,CAAC,EAAE,SAAS,SAAA,MACzB,QAAQ,oBAAoB,SAAS,QAAQ;AAAA,MAC9C;AACA,cAAQ,CAAC;AAAA,IACV;AAEAC,QAAA;AAAA,MACC;AAAA,MACA,MAAM;AACW,wBAAA;AAChBC,YAAAA,SAAS,YAAY;AAAA,MACtB;AAAA,MACA,EAAE,WAAW,KAAK;AAAA,IACnB;AAEAC,QAAAA,gBAAgB,MAAM;AACL,sBAAA;AAAA,IAAA,CAChB;;;;;;;;;;;;"}
@@ -23,7 +23,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23
23
  onMounted(() => {
24
24
  console.warn(
25
25
  `[PrismicRichText] You're using the deprecated version of \`<PrismicRichText>\` because either the \`serializer\` prop or the plugin \`richTextSerializer\` option were provided. This API will be removed in a future major. For more details, see ${devMsg(
26
- "html-serialization-is-deprecated-with-prismic-rich-text.md"
26
+ "html-serialization-is-deprecated-with-prismic-rich-text"
27
27
  )}`
28
28
  );
29
29
  });
@@ -1 +1 @@
1
- {"version":3,"file":"DeprecatedPrismicRichText.vue.js","sources":["../../src/PrismicRichText/DeprecatedPrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n// TODO: Remove in v6\nimport { asHTML, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport type { Component } from \"vue\"\nimport {\n\tcomputed,\n\tinject,\n\tnextTick,\n\tonBeforeUnmount,\n\tonMounted,\n\tref,\n\twatch,\n} from \"vue\"\nimport { routerKey } from \"vue-router\"\n\nimport { devMsg } from \"../lib/devMsg\"\nimport { isInternalURL } from \"../lib/isInternalURL\"\n\nimport { usePrismic } from \"../usePrismic\"\n\nimport type { PrismicRichTextProps } from \"./PrismicRichText.vue\"\n\n/**\n * The default component rendered to wrap the HTML output.\n */\nconst defaultWrapper = \"div\"\n\nconst props = defineProps<\n\tPick<\n\t\tPrismicRichTextProps,\n\t\t\"field\" | \"linkResolver\" | \"serializer\" | \"wrapper\"\n\t> & { fallback?: string }\n>()\ndefineOptions({ name: \"DeprecatedPrismicRichText\" })\n\nconst { options } = usePrismic()\n\nif (DEV) {\n\tonMounted(() => {\n\t\tconsole.warn(\n\t\t\t`[PrismicRichText] You're using the deprecated version of \\`<PrismicRichText>\\` because either the \\`serializer\\` prop or the plugin \\`richTextSerializer\\` option were provided. This API will be removed in a future major. For more details, see ${devMsg(\n\t\t\t\t\"html-serialization-is-deprecated-with-prismic-rich-text.md\",\n\t\t\t)}`,\n\t\t)\n\t})\n}\n\nconst html = computed(() => {\n\tif (!isFilled.richText(props.field)) {\n\t\treturn props.fallback ?? \"\"\n\t}\n\n\tconst linkResolver = props.linkResolver ?? options.linkResolver\n\tconst serializer = props.serializer ?? options.richTextSerializer\n\n\treturn asHTML(props.field, { linkResolver, serializer })\n})\n\n// Internal links handling\nconst root = ref<HTMLElement | Comment | Component | null>(null)\n\nconst maybeRouter = inject(routerKey, null)\n\ntype InternalLink = {\n\telement: HTMLAnchorElement\n\tlistener: EventListener\n}\n\nlet links: InternalLink[] = []\n\nconst navigate: EventListener = function (\n\tthis: { href: string },\n\tevent: Event,\n) {\n\tevent.preventDefault()\n\tmaybeRouter?.push(this.href)\n}\n\nconst addListeners = () => {\n\tconst node: HTMLElement | Comment | null =\n\t\troot.value && \"$el\" in root.value ? root.value.$el : root.value\n\tif (node && \"querySelectorAll\" in node) {\n\t\t// Get all internal link tags and add listeners on them\n\t\tlinks = Array.from(node.querySelectorAll(\"a\"))\n\t\t\t.map((element) => {\n\t\t\t\tconst href = element.getAttribute(\"href\")\n\n\t\t\t\tif (href && isInternalURL(href)) {\n\t\t\t\t\tconst listener = navigate.bind({ href })\n\t\t\t\t\telement.addEventListener(\"click\", listener)\n\n\t\t\t\t\treturn { element, listener }\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter((link): link is InternalLink => link as boolean)\n\t}\n}\n\nconst removeListeners = () => {\n\tlinks.forEach(({ element, listener }) =>\n\t\telement.removeEventListener(\"click\", listener),\n\t)\n\tlinks = []\n}\n\nwatch(\n\thtml,\n\t() => {\n\t\tremoveListeners()\n\t\tnextTick(addListeners)\n\t},\n\t{ immediate: true },\n)\n\nonBeforeUnmount(() => {\n\tremoveListeners()\n})\n</script>\n\n<template>\n\t<component\n\t\tv-if=\"isFilled.richText(field) || fallback\"\n\t\tref=\"root\"\n\t\t:is=\"wrapper || defaultWrapper\"\n\t\tv-html=\"html\"\n\t/>\n</template>\n"],"names":[],"mappings":";;;;;;;AA0BA,MAAM,iBAAiB;;;;;;;;;;;;AAEvB,UAAM,QAAQ;AAQR,UAAA,EAAE,QAAQ,IAAI,WAAW;AAE/B,QAAI,KAAK;AACR,gBAAU,MAAM;AACP,gBAAA;AAAA,UACP,sPAAsP;AAAA,YACrP;AAAA,UAAA,CACA;AAAA,QACF;AAAA,MAAA,CACA;AAAA,IAAA;AAGI,UAAA,OAAO,SAAS,MAAM;AAC3B,UAAI,CAAC,SAAS,SAAS,MAAM,KAAK,GAAG;AACpC,eAAO,MAAM,YAAY;AAAA,MAAA;AAGpB,YAAA,eAAe,MAAM,gBAAgB,QAAQ;AAC7C,YAAA,aAAa,MAAM,cAAc,QAAQ;AAE/C,aAAO,OAAO,MAAM,OAAO,EAAE,cAAc,YAAY;AAAA,IAAA,CACvD;AAGK,UAAA,OAAO,IAA8C,IAAI;AAEzD,UAAA,cAAc,OAAO,WAAW,IAAI;AAO1C,QAAI,QAAwB,CAAC;AAEvB,UAAA,WAA0B,SAE/B,OACC;AACD,YAAM,eAAe;AACR,iDAAA,KAAK,KAAK;AAAA,IACxB;AAEA,UAAM,eAAe,MAAM;AACpB,YAAA,OACL,KAAK,SAAS,SAAS,KAAK,QAAQ,KAAK,MAAM,MAAM,KAAK;AACvD,UAAA,QAAQ,sBAAsB,MAAM;AAE/B,gBAAA,MAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC,EAC3C,IAAI,CAAC,YAAY;AACX,gBAAA,OAAO,QAAQ,aAAa,MAAM;AAEpC,cAAA,QAAQ,cAAc,IAAI,GAAG;AAChC,kBAAM,WAAW,SAAS,KAAK,EAAE,MAAM;AAC/B,oBAAA,iBAAiB,SAAS,QAAQ;AAEnC,mBAAA,EAAE,SAAS,SAAS;AAAA,UAAA,OACrB;AACC,mBAAA;AAAA,UAAA;AAAA,QAER,CAAA,EACA,OAAO,CAAC,SAA+B,IAAe;AAAA,MAAA;AAAA,IAE1D;AAEA,UAAM,kBAAkB,MAAM;AACvB,YAAA;AAAA,QAAQ,CAAC,EAAE,SAAS,SAAA,MACzB,QAAQ,oBAAoB,SAAS,QAAQ;AAAA,MAC9C;AACA,cAAQ,CAAC;AAAA,IACV;AAEA;AAAA,MACC;AAAA,MACA,MAAM;AACW,wBAAA;AAChB,iBAAS,YAAY;AAAA,MACtB;AAAA,MACA,EAAE,WAAW,KAAK;AAAA,IACnB;AAEA,oBAAgB,MAAM;AACL,sBAAA;AAAA,IAAA,CAChB;;;;;;;;;;;"}
1
+ {"version":3,"file":"DeprecatedPrismicRichText.vue.js","sources":["../../src/PrismicRichText/DeprecatedPrismicRichText.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n// TODO: Remove in v6\nimport { asHTML, isFilled } from \"@prismicio/client\"\nimport { DEV } from \"esm-env\"\nimport type { Component } from \"vue\"\nimport {\n\tcomputed,\n\tinject,\n\tnextTick,\n\tonBeforeUnmount,\n\tonMounted,\n\tref,\n\twatch,\n} from \"vue\"\nimport { routerKey } from \"vue-router\"\n\nimport { devMsg } from \"../lib/devMsg\"\nimport { isInternalURL } from \"../lib/isInternalURL\"\n\nimport { usePrismic } from \"../usePrismic\"\n\nimport type { PrismicRichTextProps } from \"./PrismicRichText.vue\"\n\n/**\n * The default component rendered to wrap the HTML output.\n */\nconst defaultWrapper = \"div\"\n\nconst props = defineProps<\n\tPick<\n\t\tPrismicRichTextProps,\n\t\t\"field\" | \"linkResolver\" | \"serializer\" | \"wrapper\"\n\t> & { fallback?: string }\n>()\ndefineOptions({ name: \"DeprecatedPrismicRichText\" })\n\nconst { options } = usePrismic()\n\nif (DEV) {\n\tonMounted(() => {\n\t\tconsole.warn(\n\t\t\t`[PrismicRichText] You're using the deprecated version of \\`<PrismicRichText>\\` because either the \\`serializer\\` prop or the plugin \\`richTextSerializer\\` option were provided. This API will be removed in a future major. For more details, see ${devMsg(\n\t\t\t\t\"html-serialization-is-deprecated-with-prismic-rich-text\",\n\t\t\t)}`,\n\t\t)\n\t})\n}\n\nconst html = computed(() => {\n\tif (!isFilled.richText(props.field)) {\n\t\treturn props.fallback ?? \"\"\n\t}\n\n\tconst linkResolver = props.linkResolver ?? options.linkResolver\n\tconst serializer = props.serializer ?? options.richTextSerializer\n\n\treturn asHTML(props.field, { linkResolver, serializer })\n})\n\n// Internal links handling\nconst root = ref<HTMLElement | Comment | Component | null>(null)\n\nconst maybeRouter = inject(routerKey, null)\n\ntype InternalLink = {\n\telement: HTMLAnchorElement\n\tlistener: EventListener\n}\n\nlet links: InternalLink[] = []\n\nconst navigate: EventListener = function (\n\tthis: { href: string },\n\tevent: Event,\n) {\n\tevent.preventDefault()\n\tmaybeRouter?.push(this.href)\n}\n\nconst addListeners = () => {\n\tconst node: HTMLElement | Comment | null =\n\t\troot.value && \"$el\" in root.value ? root.value.$el : root.value\n\tif (node && \"querySelectorAll\" in node) {\n\t\t// Get all internal link tags and add listeners on them\n\t\tlinks = Array.from(node.querySelectorAll(\"a\"))\n\t\t\t.map((element) => {\n\t\t\t\tconst href = element.getAttribute(\"href\")\n\n\t\t\t\tif (href && isInternalURL(href)) {\n\t\t\t\t\tconst listener = navigate.bind({ href })\n\t\t\t\t\telement.addEventListener(\"click\", listener)\n\n\t\t\t\t\treturn { element, listener }\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter((link): link is InternalLink => link as boolean)\n\t}\n}\n\nconst removeListeners = () => {\n\tlinks.forEach(({ element, listener }) =>\n\t\telement.removeEventListener(\"click\", listener),\n\t)\n\tlinks = []\n}\n\nwatch(\n\thtml,\n\t() => {\n\t\tremoveListeners()\n\t\tnextTick(addListeners)\n\t},\n\t{ immediate: true },\n)\n\nonBeforeUnmount(() => {\n\tremoveListeners()\n})\n</script>\n\n<template>\n\t<component\n\t\tv-if=\"isFilled.richText(field) || fallback\"\n\t\tref=\"root\"\n\t\t:is=\"wrapper || defaultWrapper\"\n\t\tv-html=\"html\"\n\t/>\n</template>\n"],"names":[],"mappings":";;;;;;;AA0BA,MAAM,iBAAiB;;;;;;;;;;;;AAEvB,UAAM,QAAQ;AAQR,UAAA,EAAE,QAAQ,IAAI,WAAW;AAE/B,QAAI,KAAK;AACR,gBAAU,MAAM;AACP,gBAAA;AAAA,UACP,sPAAsP;AAAA,YACrP;AAAA,UAAA,CACA;AAAA,QACF;AAAA,MAAA,CACA;AAAA,IAAA;AAGI,UAAA,OAAO,SAAS,MAAM;AAC3B,UAAI,CAAC,SAAS,SAAS,MAAM,KAAK,GAAG;AACpC,eAAO,MAAM,YAAY;AAAA,MAAA;AAGpB,YAAA,eAAe,MAAM,gBAAgB,QAAQ;AAC7C,YAAA,aAAa,MAAM,cAAc,QAAQ;AAE/C,aAAO,OAAO,MAAM,OAAO,EAAE,cAAc,YAAY;AAAA,IAAA,CACvD;AAGK,UAAA,OAAO,IAA8C,IAAI;AAEzD,UAAA,cAAc,OAAO,WAAW,IAAI;AAO1C,QAAI,QAAwB,CAAC;AAEvB,UAAA,WAA0B,SAE/B,OACC;AACD,YAAM,eAAe;AACR,iDAAA,KAAK,KAAK;AAAA,IACxB;AAEA,UAAM,eAAe,MAAM;AACpB,YAAA,OACL,KAAK,SAAS,SAAS,KAAK,QAAQ,KAAK,MAAM,MAAM,KAAK;AACvD,UAAA,QAAQ,sBAAsB,MAAM;AAE/B,gBAAA,MAAM,KAAK,KAAK,iBAAiB,GAAG,CAAC,EAC3C,IAAI,CAAC,YAAY;AACX,gBAAA,OAAO,QAAQ,aAAa,MAAM;AAEpC,cAAA,QAAQ,cAAc,IAAI,GAAG;AAChC,kBAAM,WAAW,SAAS,KAAK,EAAE,MAAM;AAC/B,oBAAA,iBAAiB,SAAS,QAAQ;AAEnC,mBAAA,EAAE,SAAS,SAAS;AAAA,UAAA,OACrB;AACC,mBAAA;AAAA,UAAA;AAAA,QAER,CAAA,EACA,OAAO,CAAC,SAA+B,IAAe;AAAA,MAAA;AAAA,IAE1D;AAEA,UAAM,kBAAkB,MAAM;AACvB,YAAA;AAAA,QAAQ,CAAC,EAAE,SAAS,SAAA,MACzB,QAAQ,oBAAoB,SAAS,QAAQ;AAAA,MAC9C;AACA,cAAQ,CAAC;AAAA,IACV;AAEA;AAAA,MACC;AAAA,MACA,MAAM;AACW,wBAAA;AAChB,iBAAS,YAAY;AAAA,MACtB;AAAA,MACA,EAAE,WAAW,KAAK;AAAA,IACnB;AAEA,oBAAgB,MAAM;AACL,sBAAA;AAAA,IAAA,CAChB;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const version = "5.0.0";
3
+ const version = "5.0.2";
4
4
  exports.version = version;
5
5
  //# sourceMappingURL=package.json.cjs.map
@@ -1,4 +1,4 @@
1
- const version = "5.0.0";
1
+ const version = "5.0.2";
2
2
  export {
3
3
  version
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/vue",
3
- "version": "5.0.0",
3
+ "version": "5.0.2",
4
4
  "description": "Vue plugin, components, and composables to fetch and present Prismic content",
5
5
  "keywords": [
6
6
  "typescript",
@@ -6,10 +6,8 @@ import {
6
6
  type PrismicDocument,
7
7
  asLinkAttrs,
8
8
  } from "@prismicio/client"
9
- import { DEV } from "esm-env"
10
- import { computed, watchEffect } from "vue"
9
+ import { computed } from "vue"
11
10
 
12
- import { devMsg } from "./lib/devMsg"
13
11
  import { isInternalURL } from "./lib/isInternalURL"
14
12
 
15
13
  import type { ComponentOrTagName } from "./types"
@@ -103,45 +101,6 @@ defineOptions({ name: "PrismicLink" })
103
101
 
104
102
  const { options } = usePrismic()
105
103
 
106
- if (DEV) {
107
- watchEffect(() => {
108
- if (props.field) {
109
- if (!props.field.link_type) {
110
- console.error(
111
- `[PrismicLink] This "field" prop value caused an error to be thrown.\n`,
112
- props.field,
113
- )
114
- throw new Error(
115
- `[PrismicLink] The provided field is missing required properties to properly render a link. The link will not render. For more details, see ${devMsg(
116
- "missing-link-properties",
117
- )}`,
118
- )
119
- } else if (
120
- ("text" in props.field
121
- ? Object.keys(props.field).length > 2
122
- : Object.keys(props.field).length > 1) &&
123
- !("url" in props.field || "uid" in props.field || "id" in props.field)
124
- ) {
125
- console.warn(
126
- `[PrismicLink] The provided field is missing required properties to properly render a link. The link may not render correctly. For more details, see ${devMsg(
127
- "missing-link-properties",
128
- )}`,
129
- props.field,
130
- )
131
- }
132
- } else if (props.document) {
133
- if (!("url" in props.document || "id" in props.document)) {
134
- console.warn(
135
- `[PrismicLink] The provided document is missing required properties to properly render a link. The link may not render correctly. For more details, see ${devMsg(
136
- "missing-link-properties",
137
- )}`,
138
- props.document,
139
- )
140
- }
141
- }
142
- })
143
- }
144
-
145
104
  const rawAttrs = computed(() => {
146
105
  return asLinkAttrs(props.field || props.document, {
147
106
  linkResolver: props.linkResolver || options.linkResolver,
@@ -40,7 +40,7 @@ if (DEV) {
40
40
  onMounted(() => {
41
41
  console.warn(
42
42
  `[PrismicRichText] You're using the deprecated version of \`<PrismicRichText>\` because either the \`serializer\` prop or the plugin \`richTextSerializer\` option were provided. This API will be removed in a future major. For more details, see ${devMsg(
43
- "html-serialization-is-deprecated-with-prismic-rich-text.md",
43
+ "html-serialization-is-deprecated-with-prismic-rich-text",
44
44
  )}`,
45
45
  )
46
46
  })